diff options
author | Len Brown <len.brown@intel.com> | 2011-03-18 18:06:08 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2011-03-18 18:06:08 -0400 |
commit | 05534c9ffc9d5d950b14de8ba49a7609dc59b0b8 (patch) | |
tree | 65a01a1e0bc0e28c64fb5105cc763949f5412b4b | |
parent | dd87cc53c42f3260b7eb7f60822de0fa9e58af59 (diff) | |
parent | 589c7a39ae2f2b74fd13ae344ca1dcca61da6bca (diff) |
Merge branch 'acpica' into release
139 files changed, 3208 insertions, 2283 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 6f99e1260db8..8afba6321e24 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1692,6 +1692,13 @@ M: Andy Whitcroft <apw@canonical.com> | |||
1692 | S: Supported | 1692 | S: Supported |
1693 | F: scripts/checkpatch.pl | 1693 | F: scripts/checkpatch.pl |
1694 | 1694 | ||
1695 | CHINESE DOCUMENTATION | ||
1696 | M: Harry Wei <harryxiyou@gmail.com> | ||
1697 | L: xiyoulinuxkernelgroup@googlegroups.com | ||
1698 | L: linux-kernel@zh-kernel.org (moderated for non-subscribers) | ||
1699 | S: Maintained | ||
1700 | F: Documentation/zh_CN/ | ||
1701 | |||
1695 | CISCO VIC ETHERNET NIC DRIVER | 1702 | CISCO VIC ETHERNET NIC DRIVER |
1696 | M: Vasanthy Kolluri <vkolluri@cisco.com> | 1703 | M: Vasanthy Kolluri <vkolluri@cisco.com> |
1697 | M: Roopa Prabhu <roprabhu@cisco.com> | 1704 | M: Roopa Prabhu <roprabhu@cisco.com> |
@@ -5266,7 +5273,7 @@ S: Maintained | |||
5266 | F: drivers/net/wireless/rtl818x/rtl8180/ | 5273 | F: drivers/net/wireless/rtl818x/rtl8180/ |
5267 | 5274 | ||
5268 | RTL8187 WIRELESS DRIVER | 5275 | RTL8187 WIRELESS DRIVER |
5269 | M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 5276 | M: Herton Ronaldo Krzesinski <herton@canonical.com> |
5270 | M: Hin-Tak Leung <htl10@users.sourceforge.net> | 5277 | M: Hin-Tak Leung <htl10@users.sourceforge.net> |
5271 | M: Larry Finger <Larry.Finger@lwfinger.net> | 5278 | M: Larry Finger <Larry.Finger@lwfinger.net> |
5272 | L: linux-wireless@vger.kernel.org | 5279 | L: linux-wireless@vger.kernel.org |
@@ -6104,7 +6111,7 @@ S: Maintained | |||
6104 | F: security/tomoyo/ | 6111 | F: security/tomoyo/ |
6105 | 6112 | ||
6106 | TOPSTAR LAPTOP EXTRAS DRIVER | 6113 | TOPSTAR LAPTOP EXTRAS DRIVER |
6107 | M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 6114 | M: Herton Ronaldo Krzesinski <herton@canonical.com> |
6108 | L: platform-driver-x86@vger.kernel.org | 6115 | L: platform-driver-x86@vger.kernel.org |
6109 | S: Maintained | 6116 | S: Maintained |
6110 | F: drivers/platform/x86/topstar-laptop.c | 6117 | F: drivers/platform/x86/topstar-laptop.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 38 | 3 | SUBLEVEL = 38 |
4 | EXTRAVERSION = -rc6 | 4 | EXTRAVERSION = -rc7 |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c index 337392c3f549..acb7ae5b0a25 100644 --- a/arch/arm/mach-omap2/clkt_dpll.c +++ b/arch/arm/mach-omap2/clkt_dpll.c | |||
@@ -77,7 +77,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n) | |||
77 | dd = clk->dpll_data; | 77 | dd = clk->dpll_data; |
78 | 78 | ||
79 | /* DPLL divider must result in a valid jitter correction val */ | 79 | /* DPLL divider must result in a valid jitter correction val */ |
80 | fint = clk->parent->rate / (n + 1); | 80 | fint = clk->parent->rate / n; |
81 | if (fint < DPLL_FINT_BAND1_MIN) { | 81 | if (fint < DPLL_FINT_BAND1_MIN) { |
82 | 82 | ||
83 | pr_debug("rejecting n=%d due to Fint failure, " | 83 | pr_debug("rejecting n=%d due to Fint failure, " |
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 394413dc7deb..0a585dfa9874 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c | |||
@@ -334,7 +334,7 @@ static struct omap_mbox mbox_iva_info = { | |||
334 | .priv = &omap2_mbox_iva_priv, | 334 | .priv = &omap2_mbox_iva_priv, |
335 | }; | 335 | }; |
336 | 336 | ||
337 | struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL }; | 337 | struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL }; |
338 | #endif | 338 | #endif |
339 | 339 | ||
340 | #if defined(CONFIG_ARCH_OMAP4) | 340 | #if defined(CONFIG_ARCH_OMAP4) |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 98148b6c36e9..6c84659cf846 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -605,7 +605,7 @@ static void __init omap_mux_dbg_create_entry( | |||
605 | list_for_each_entry(e, &partition->muxmodes, node) { | 605 | list_for_each_entry(e, &partition->muxmodes, node) { |
606 | struct omap_mux *m = &e->mux; | 606 | struct omap_mux *m = &e->mux; |
607 | 607 | ||
608 | (void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir, | 608 | (void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir, |
609 | m, &omap_mux_dbg_signal_fops); | 609 | m, &omap_mux_dbg_signal_fops); |
610 | } | 610 | } |
611 | } | 611 | } |
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 125f56591fb5..a5a83b358ddd 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -637,14 +637,14 @@ static int __init pm_dbg_init(void) | |||
637 | 637 | ||
638 | } | 638 | } |
639 | 639 | ||
640 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d, | 640 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d, |
641 | &enable_off_mode, &pm_dbg_option_fops); | 641 | &enable_off_mode, &pm_dbg_option_fops); |
642 | (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d, | 642 | (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUSR, d, |
643 | &sleep_while_idle, &pm_dbg_option_fops); | 643 | &sleep_while_idle, &pm_dbg_option_fops); |
644 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, | 644 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUSR, d, |
645 | &wakeup_timer_seconds, &pm_dbg_option_fops); | 645 | &wakeup_timer_seconds, &pm_dbg_option_fops); |
646 | (void) debugfs_create_file("wakeup_timer_milliseconds", | 646 | (void) debugfs_create_file("wakeup_timer_milliseconds", |
647 | S_IRUGO | S_IWUGO, d, &wakeup_timer_milliseconds, | 647 | S_IRUGO | S_IWUSR, d, &wakeup_timer_milliseconds, |
648 | &pm_dbg_option_fops); | 648 | &pm_dbg_option_fops); |
649 | pm_dbg_init_done = 1; | 649 | pm_dbg_init_done = 1; |
650 | 650 | ||
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h index 729a644ce852..3300ff6e3cfe 100644 --- a/arch/arm/mach-omap2/prcm_mpu44xx.h +++ b/arch/arm/mach-omap2/prcm_mpu44xx.h | |||
@@ -38,8 +38,8 @@ | |||
38 | #define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 | 38 | #define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 |
39 | 39 | ||
40 | /* PRCM_MPU clockdomain register offsets (from instance start) */ | 40 | /* PRCM_MPU clockdomain register offsets (from instance start) */ |
41 | #define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0000 | 41 | #define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0018 |
42 | #define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0000 | 42 | #define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0018 |
43 | 43 | ||
44 | 44 | ||
45 | /* | 45 | /* |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index c37e823266d3..95ac336fe3f7 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -900,7 +900,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
900 | return PTR_ERR(dbg_dir); | 900 | return PTR_ERR(dbg_dir); |
901 | } | 901 | } |
902 | 902 | ||
903 | (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir, | 903 | (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, dbg_dir, |
904 | (void *)sr_info, &pm_sr_fops); | 904 | (void *)sr_info, &pm_sr_fops); |
905 | (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, | 905 | (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, |
906 | &sr_info->err_weight); | 906 | &sr_info->err_weight); |
@@ -939,7 +939,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
939 | strcpy(name, "volt_"); | 939 | strcpy(name, "volt_"); |
940 | sprintf(volt_name, "%d", volt_data[i].volt_nominal); | 940 | sprintf(volt_name, "%d", volt_data[i].volt_nominal); |
941 | strcat(name, volt_name); | 941 | strcat(name, volt_name); |
942 | (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir, | 942 | (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir, |
943 | &(sr_info->nvalue_table[i].nvalue)); | 943 | &(sr_info->nvalue_table[i].nvalue)); |
944 | } | 944 | } |
945 | 945 | ||
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 7b7c2683ae7b..0fc550e7e482 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/mach/time.h> | 39 | #include <asm/mach/time.h> |
40 | #include <plat/dmtimer.h> | 40 | #include <plat/dmtimer.h> |
41 | #include <asm/localtimer.h> | 41 | #include <asm/localtimer.h> |
42 | #include <asm/sched_clock.h> | ||
42 | 43 | ||
43 | #include "timer-gp.h" | 44 | #include "timer-gp.h" |
44 | 45 | ||
@@ -190,6 +191,7 @@ static void __init omap2_gp_clocksource_init(void) | |||
190 | /* | 191 | /* |
191 | * clocksource | 192 | * clocksource |
192 | */ | 193 | */ |
194 | static DEFINE_CLOCK_DATA(cd); | ||
193 | static struct omap_dm_timer *gpt_clocksource; | 195 | static struct omap_dm_timer *gpt_clocksource; |
194 | static cycle_t clocksource_read_cycles(struct clocksource *cs) | 196 | static cycle_t clocksource_read_cycles(struct clocksource *cs) |
195 | { | 197 | { |
@@ -204,6 +206,15 @@ static struct clocksource clocksource_gpt = { | |||
204 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 206 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
205 | }; | 207 | }; |
206 | 208 | ||
209 | static void notrace dmtimer_update_sched_clock(void) | ||
210 | { | ||
211 | u32 cyc; | ||
212 | |||
213 | cyc = omap_dm_timer_read_counter(gpt_clocksource); | ||
214 | |||
215 | update_sched_clock(&cd, cyc, (u32)~0); | ||
216 | } | ||
217 | |||
207 | /* Setup free-running counter for clocksource */ | 218 | /* Setup free-running counter for clocksource */ |
208 | static void __init omap2_gp_clocksource_init(void) | 219 | static void __init omap2_gp_clocksource_init(void) |
209 | { | 220 | { |
@@ -224,6 +235,8 @@ static void __init omap2_gp_clocksource_init(void) | |||
224 | 235 | ||
225 | omap_dm_timer_set_load_start(gpt, 1, 0); | 236 | omap_dm_timer_set_load_start(gpt, 1, 0); |
226 | 237 | ||
238 | init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate); | ||
239 | |||
227 | if (clocksource_register_hz(&clocksource_gpt, tick_rate)) | 240 | if (clocksource_register_hz(&clocksource_gpt, tick_rate)) |
228 | printk(err2, clocksource_gpt.name); | 241 | printk(err2, clocksource_gpt.name); |
229 | } | 242 | } |
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index 459b319a9fad..49d3208793e5 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox) | |||
322 | 322 | ||
323 | struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) | 323 | struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) |
324 | { | 324 | { |
325 | struct omap_mbox *mbox; | 325 | struct omap_mbox *_mbox, *mbox = NULL; |
326 | int ret; | 326 | int i, ret; |
327 | 327 | ||
328 | if (!mboxes) | 328 | if (!mboxes) |
329 | return ERR_PTR(-EINVAL); | 329 | return ERR_PTR(-EINVAL); |
330 | 330 | ||
331 | for (mbox = *mboxes; mbox; mbox++) | 331 | for (i = 0; (_mbox = mboxes[i]); i++) { |
332 | if (!strcmp(mbox->name, name)) | 332 | if (!strcmp(_mbox->name, name)) { |
333 | mbox = _mbox; | ||
333 | break; | 334 | break; |
335 | } | ||
336 | } | ||
334 | 337 | ||
335 | if (!mbox) | 338 | if (!mbox) |
336 | return ERR_PTR(-ENOENT); | 339 | return ERR_PTR(-ENOENT); |
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index aa92684aa674..ef14da1f4ec5 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -88,6 +88,7 @@ extern int acpi_disabled; | |||
88 | extern int acpi_pci_disabled; | 88 | extern int acpi_pci_disabled; |
89 | extern int acpi_skip_timer_override; | 89 | extern int acpi_skip_timer_override; |
90 | extern int acpi_use_timer_override; | 90 | extern int acpi_use_timer_override; |
91 | extern int acpi_fix_pin2_polarity; | ||
91 | 92 | ||
92 | extern u8 acpi_sci_flags; | 93 | extern u8 acpi_sci_flags; |
93 | extern int acpi_sci_override_gsi; | 94 | extern int acpi_sci_override_gsi; |
diff --git a/arch/x86/include/asm/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h index 6c22bf353f26..725b77831993 100644 --- a/arch/x86/include/asm/smpboot_hooks.h +++ b/arch/x86/include/asm/smpboot_hooks.h | |||
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void) | |||
34 | */ | 34 | */ |
35 | CMOS_WRITE(0, 0xf); | 35 | CMOS_WRITE(0, 0xf); |
36 | 36 | ||
37 | *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0; | 37 | *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline void __init smpboot_setup_io_apic(void) | 40 | static inline void __init smpboot_setup_io_apic(void) |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b3a71137983a..3e6e2d68f761 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -72,6 +72,7 @@ u8 acpi_sci_flags __initdata; | |||
72 | int acpi_sci_override_gsi __initdata; | 72 | int acpi_sci_override_gsi __initdata; |
73 | int acpi_skip_timer_override __initdata; | 73 | int acpi_skip_timer_override __initdata; |
74 | int acpi_use_timer_override __initdata; | 74 | int acpi_use_timer_override __initdata; |
75 | int acpi_fix_pin2_polarity __initdata; | ||
75 | 76 | ||
76 | #ifdef CONFIG_X86_LOCAL_APIC | 77 | #ifdef CONFIG_X86_LOCAL_APIC |
77 | static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; | 78 | static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; |
@@ -415,10 +416,15 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, | |||
415 | return 0; | 416 | return 0; |
416 | } | 417 | } |
417 | 418 | ||
418 | if (acpi_skip_timer_override && | 419 | if (intsrc->source_irq == 0 && intsrc->global_irq == 2) { |
419 | intsrc->source_irq == 0 && intsrc->global_irq == 2) { | 420 | if (acpi_skip_timer_override) { |
420 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); | 421 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); |
421 | return 0; | 422 | return 0; |
423 | } | ||
424 | if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) { | ||
425 | intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; | ||
426 | printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); | ||
427 | } | ||
422 | } | 428 | } |
423 | 429 | ||
424 | mp_override_legacy_irq(intsrc->source_irq, | 430 | mp_override_legacy_irq(intsrc->source_irq, |
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 51ef31a89be9..51d4e1663066 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -284,7 +284,7 @@ static int __init apbt_clockevent_register(void) | |||
284 | memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); | 284 | memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); |
285 | 285 | ||
286 | if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { | 286 | if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { |
287 | apbt_clockevent.rating = APBT_CLOCKEVENT_RATING - 100; | 287 | adev->evt.rating = APBT_CLOCKEVENT_RATING - 100; |
288 | global_clock_event = &adev->evt; | 288 | global_clock_event = &adev->evt; |
289 | printk(KERN_DEBUG "%s clockevent registered as global\n", | 289 | printk(KERN_DEBUG "%s clockevent registered as global\n", |
290 | global_clock_event->name); | 290 | global_clock_event->name); |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 76b8cd953dee..9efbdcc56425 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -143,15 +143,10 @@ static void __init ati_bugs(int num, int slot, int func) | |||
143 | 143 | ||
144 | static u32 __init ati_sbx00_rev(int num, int slot, int func) | 144 | static u32 __init ati_sbx00_rev(int num, int slot, int func) |
145 | { | 145 | { |
146 | u32 old, d; | 146 | u32 d; |
147 | 147 | ||
148 | d = read_pci_config(num, slot, func, 0x70); | ||
149 | old = d; | ||
150 | d &= ~(1<<8); | ||
151 | write_pci_config(num, slot, func, 0x70, d); | ||
152 | d = read_pci_config(num, slot, func, 0x8); | 148 | d = read_pci_config(num, slot, func, 0x8); |
153 | d &= 0xff; | 149 | d &= 0xff; |
154 | write_pci_config(num, slot, func, 0x70, old); | ||
155 | 150 | ||
156 | return d; | 151 | return d; |
157 | } | 152 | } |
@@ -160,13 +155,16 @@ static void __init ati_bugs_contd(int num, int slot, int func) | |||
160 | { | 155 | { |
161 | u32 d, rev; | 156 | u32 d, rev; |
162 | 157 | ||
163 | if (acpi_use_timer_override) | ||
164 | return; | ||
165 | |||
166 | rev = ati_sbx00_rev(num, slot, func); | 158 | rev = ati_sbx00_rev(num, slot, func); |
159 | if (rev >= 0x40) | ||
160 | acpi_fix_pin2_polarity = 1; | ||
161 | |||
167 | if (rev > 0x13) | 162 | if (rev > 0x13) |
168 | return; | 163 | return; |
169 | 164 | ||
165 | if (acpi_use_timer_override) | ||
166 | return; | ||
167 | |||
170 | /* check for IRQ0 interrupt swap */ | 168 | /* check for IRQ0 interrupt swap */ |
171 | d = read_pci_config(num, slot, func, 0x64); | 169 | d = read_pci_config(num, slot, func, 0x64); |
172 | if (!(d & (1<<14))) | 170 | if (!(d & (1<<14))) |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index fc7aae1e2bc7..715037caeb43 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -285,6 +285,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
285 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), | 285 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), |
286 | }, | 286 | }, |
287 | }, | 287 | }, |
288 | { /* Handle problems with rebooting on VersaLogic Menlow boards */ | ||
289 | .callback = set_bios_reboot, | ||
290 | .ident = "VersaLogic Menlow based board", | ||
291 | .matches = { | ||
292 | DMI_MATCH(DMI_BOARD_VENDOR, "VersaLogic Corporation"), | ||
293 | DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"), | ||
294 | }, | ||
295 | }, | ||
288 | { } | 296 | { } |
289 | }; | 297 | }; |
290 | 298 | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 54ce246a383e..63fec1531e89 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2777,6 +2777,8 @@ static int dr_interception(struct vcpu_svm *svm) | |||
2777 | kvm_register_write(&svm->vcpu, reg, val); | 2777 | kvm_register_write(&svm->vcpu, reg, val); |
2778 | } | 2778 | } |
2779 | 2779 | ||
2780 | skip_emulated_instruction(&svm->vcpu); | ||
2781 | |||
2780 | return 1; | 2782 | return 1; |
2781 | } | 2783 | } |
2782 | 2784 | ||
diff --git a/block/genhd.c b/block/genhd.c index 6a5b772aa201..cbf1112a885c 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1355,7 +1355,7 @@ int invalidate_partition(struct gendisk *disk, int partno) | |||
1355 | struct block_device *bdev = bdget_disk(disk, partno); | 1355 | struct block_device *bdev = bdget_disk(disk, partno); |
1356 | if (bdev) { | 1356 | if (bdev) { |
1357 | fsync_bdev(bdev); | 1357 | fsync_bdev(bdev); |
1358 | res = __invalidate_device(bdev); | 1358 | res = __invalidate_device(bdev, true); |
1359 | bdput(bdev); | 1359 | bdput(bdev); |
1360 | } | 1360 | } |
1361 | return res; | 1361 | return res; |
diff --git a/block/ioctl.c b/block/ioctl.c index 9049d460fa89..1124cd297263 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -294,9 +294,11 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | if (get_user(n, (int __user *) arg)) | 295 | if (get_user(n, (int __user *) arg)) |
296 | return -EFAULT; | 296 | return -EFAULT; |
297 | if (!(mode & FMODE_EXCL) && | 297 | if (!(mode & FMODE_EXCL)) { |
298 | blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0) | 298 | bdgrab(bdev); |
299 | return -EBUSY; | 299 | if (blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0) |
300 | return -EBUSY; | ||
301 | } | ||
300 | ret = set_blocksize(bdev, n); | 302 | ret = set_blocksize(bdev, n); |
301 | if (!(mode & FMODE_EXCL)) | 303 | if (!(mode & FMODE_EXCL)) |
302 | blkdev_put(bdev, mode | FMODE_EXCL); | 304 | blkdev_put(bdev, mode | FMODE_EXCL); |
diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index eec2eadd2431..a1224712fd0c 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile | |||
@@ -10,7 +10,7 @@ obj-y += acpi.o | |||
10 | 10 | ||
11 | acpi-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ | 11 | acpi-y := dsfield.o dsmthdat.o dsopcode.o dswexec.o dswscope.o \ |
12 | dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ | 12 | dsmethod.o dsobject.o dsutils.o dswload.o dswstate.o \ |
13 | dsinit.o | 13 | dsinit.o dsargs.o dscontrol.o dswload2.o |
14 | 14 | ||
15 | acpi-y += evevent.o evregion.o evsci.o evxfevnt.o \ | 15 | acpi-y += evevent.o evregion.o evsci.o evxfevnt.o \ |
16 | evmisc.o evrgnini.o evxface.o evxfregn.o \ | 16 | evmisc.o evrgnini.o evxface.o evxfregn.o \ |
@@ -45,4 +45,4 @@ acpi-y += tbxface.o tbinstal.o tbutils.o tbfind.o tbfadt.o tbxfroot.o | |||
45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ | 45 | acpi-y += utalloc.o utdebug.o uteval.o utinit.o utmisc.o utxface.o \ |
46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ | 46 | utcopy.o utdelete.o utglobal.o utmath.o utobject.o \ |
47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ | 47 | utstate.o utmutex.o utobject.o utresrc.o utlock.o utids.o \ |
48 | utosi.o utxferror.o | 48 | utosi.o utxferror.o utdecode.o |
diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index 666271b65418..2d1b7ffa377a 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h | |||
@@ -48,7 +48,7 @@ | |||
48 | #define NAMEOF_ARG_NTE "__A0" | 48 | #define NAMEOF_ARG_NTE "__A0" |
49 | 49 | ||
50 | /* | 50 | /* |
51 | * dsopcode - support for late evaluation | 51 | * dsargs - execution of dynamic arguments for static objects |
52 | */ | 52 | */ |
53 | acpi_status | 53 | acpi_status |
54 | acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc); | 54 | acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc); |
@@ -62,6 +62,20 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc); | |||
62 | 62 | ||
63 | acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc); | 63 | acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc); |
64 | 64 | ||
65 | /* | ||
66 | * dscontrol - support for execution control opcodes | ||
67 | */ | ||
68 | acpi_status | ||
69 | acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | ||
70 | union acpi_parse_object *op); | ||
71 | |||
72 | acpi_status | ||
73 | acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state, | ||
74 | union acpi_parse_object *op); | ||
75 | |||
76 | /* | ||
77 | * dsopcode - support for late operand evaluation | ||
78 | */ | ||
65 | acpi_status | 79 | acpi_status |
66 | acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, | 80 | acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, |
67 | union acpi_parse_object *op); | 81 | union acpi_parse_object *op); |
@@ -86,17 +100,6 @@ acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, | |||
86 | acpi_status acpi_ds_initialize_region(acpi_handle obj_handle); | 100 | acpi_status acpi_ds_initialize_region(acpi_handle obj_handle); |
87 | 101 | ||
88 | /* | 102 | /* |
89 | * dsctrl - Parser/Interpreter interface, control stack routines | ||
90 | */ | ||
91 | acpi_status | ||
92 | acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | ||
93 | union acpi_parse_object *op); | ||
94 | |||
95 | acpi_status | ||
96 | acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state, | ||
97 | union acpi_parse_object *op); | ||
98 | |||
99 | /* | ||
100 | * dsexec - Parser/Interpreter interface, method execution callbacks | 103 | * dsexec - Parser/Interpreter interface, method execution callbacks |
101 | */ | 104 | */ |
102 | acpi_status | 105 | acpi_status |
@@ -136,23 +139,26 @@ acpi_ds_init_field_objects(union acpi_parse_object *op, | |||
136 | struct acpi_walk_state *walk_state); | 139 | struct acpi_walk_state *walk_state); |
137 | 140 | ||
138 | /* | 141 | /* |
139 | * dsload - Parser/Interpreter interface, namespace load callbacks | 142 | * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks |
140 | */ | 143 | */ |
141 | acpi_status | 144 | acpi_status |
145 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); | ||
146 | |||
147 | acpi_status | ||
142 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, | 148 | acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state, |
143 | union acpi_parse_object **out_op); | 149 | union acpi_parse_object **out_op); |
144 | 150 | ||
145 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); | 151 | acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state); |
146 | 152 | ||
153 | /* | ||
154 | * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks | ||
155 | */ | ||
147 | acpi_status | 156 | acpi_status |
148 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | 157 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, |
149 | union acpi_parse_object **out_op); | 158 | union acpi_parse_object **out_op); |
150 | 159 | ||
151 | acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state); | 160 | acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state); |
152 | 161 | ||
153 | acpi_status | ||
154 | acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number); | ||
155 | |||
156 | /* | 162 | /* |
157 | * dsmthdat - method data (locals/args) | 163 | * dsmthdat - method data (locals/args) |
158 | */ | 164 | */ |
diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index 82a1bd283db8..d69750b83b36 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h | |||
@@ -273,6 +273,10 @@ ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]; | |||
273 | ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; | 273 | ACPI_EXTERN u8 acpi_gbl_last_owner_id_index; |
274 | ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; | 274 | ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset; |
275 | 275 | ||
276 | /* Initialization sequencing */ | ||
277 | |||
278 | ACPI_EXTERN u8 acpi_gbl_reg_methods_executed; | ||
279 | |||
276 | /* Misc */ | 280 | /* Misc */ |
277 | 281 | ||
278 | ACPI_EXTERN u32 acpi_gbl_original_mode; | 282 | ACPI_EXTERN u32 acpi_gbl_original_mode; |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index edc25867ad9d..c7f743ca395b 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -89,25 +89,6 @@ union acpi_parse_object; | |||
89 | #define ACPI_MAX_MUTEX 7 | 89 | #define ACPI_MAX_MUTEX 7 |
90 | #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 | 90 | #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 |
91 | 91 | ||
92 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
93 | #ifdef DEFINE_ACPI_GLOBALS | ||
94 | |||
95 | /* Debug names for the mutexes above */ | ||
96 | |||
97 | static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { | ||
98 | "ACPI_MTX_Interpreter", | ||
99 | "ACPI_MTX_Namespace", | ||
100 | "ACPI_MTX_Tables", | ||
101 | "ACPI_MTX_Events", | ||
102 | "ACPI_MTX_Caches", | ||
103 | "ACPI_MTX_Memory", | ||
104 | "ACPI_MTX_CommandComplete", | ||
105 | "ACPI_MTX_CommandReady" | ||
106 | }; | ||
107 | |||
108 | #endif | ||
109 | #endif | ||
110 | |||
111 | /* Lock structure for reader/writer interfaces */ | 92 | /* Lock structure for reader/writer interfaces */ |
112 | 93 | ||
113 | struct acpi_rw_lock { | 94 | struct acpi_rw_lock { |
diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c new file mode 100644 index 000000000000..8c7b99728aa2 --- /dev/null +++ b/drivers/acpi/acpica/dsargs.c | |||
@@ -0,0 +1,391 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: dsargs - Support for execution of dynamic arguments for static | ||
4 | * objects (regions, fields, buffer fields, etc.) | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2011, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #include <acpi/acpi.h> | ||
46 | #include "accommon.h" | ||
47 | #include "acparser.h" | ||
48 | #include "amlcode.h" | ||
49 | #include "acdispat.h" | ||
50 | #include "acnamesp.h" | ||
51 | |||
52 | #define _COMPONENT ACPI_DISPATCHER | ||
53 | ACPI_MODULE_NAME("dsargs") | ||
54 | |||
55 | /* Local prototypes */ | ||
56 | static acpi_status | ||
57 | acpi_ds_execute_arguments(struct acpi_namespace_node *node, | ||
58 | struct acpi_namespace_node *scope_node, | ||
59 | u32 aml_length, u8 *aml_start); | ||
60 | |||
61 | /******************************************************************************* | ||
62 | * | ||
63 | * FUNCTION: acpi_ds_execute_arguments | ||
64 | * | ||
65 | * PARAMETERS: Node - Object NS node | ||
66 | * scope_node - Parent NS node | ||
67 | * aml_length - Length of executable AML | ||
68 | * aml_start - Pointer to the AML | ||
69 | * | ||
70 | * RETURN: Status. | ||
71 | * | ||
72 | * DESCRIPTION: Late (deferred) execution of region or field arguments | ||
73 | * | ||
74 | ******************************************************************************/ | ||
75 | |||
76 | static acpi_status | ||
77 | acpi_ds_execute_arguments(struct acpi_namespace_node *node, | ||
78 | struct acpi_namespace_node *scope_node, | ||
79 | u32 aml_length, u8 *aml_start) | ||
80 | { | ||
81 | acpi_status status; | ||
82 | union acpi_parse_object *op; | ||
83 | struct acpi_walk_state *walk_state; | ||
84 | |||
85 | ACPI_FUNCTION_TRACE(ds_execute_arguments); | ||
86 | |||
87 | /* Allocate a new parser op to be the root of the parsed tree */ | ||
88 | |||
89 | op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); | ||
90 | if (!op) { | ||
91 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
92 | } | ||
93 | |||
94 | /* Save the Node for use in acpi_ps_parse_aml */ | ||
95 | |||
96 | op->common.node = scope_node; | ||
97 | |||
98 | /* Create and initialize a new parser state */ | ||
99 | |||
100 | walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); | ||
101 | if (!walk_state) { | ||
102 | status = AE_NO_MEMORY; | ||
103 | goto cleanup; | ||
104 | } | ||
105 | |||
106 | status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, | ||
107 | aml_length, NULL, ACPI_IMODE_LOAD_PASS1); | ||
108 | if (ACPI_FAILURE(status)) { | ||
109 | acpi_ds_delete_walk_state(walk_state); | ||
110 | goto cleanup; | ||
111 | } | ||
112 | |||
113 | /* Mark this parse as a deferred opcode */ | ||
114 | |||
115 | walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP; | ||
116 | walk_state->deferred_node = node; | ||
117 | |||
118 | /* Pass1: Parse the entire declaration */ | ||
119 | |||
120 | status = acpi_ps_parse_aml(walk_state); | ||
121 | if (ACPI_FAILURE(status)) { | ||
122 | goto cleanup; | ||
123 | } | ||
124 | |||
125 | /* Get and init the Op created above */ | ||
126 | |||
127 | op->common.node = node; | ||
128 | acpi_ps_delete_parse_tree(op); | ||
129 | |||
130 | /* Evaluate the deferred arguments */ | ||
131 | |||
132 | op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); | ||
133 | if (!op) { | ||
134 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
135 | } | ||
136 | |||
137 | op->common.node = scope_node; | ||
138 | |||
139 | /* Create and initialize a new parser state */ | ||
140 | |||
141 | walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); | ||
142 | if (!walk_state) { | ||
143 | status = AE_NO_MEMORY; | ||
144 | goto cleanup; | ||
145 | } | ||
146 | |||
147 | /* Execute the opcode and arguments */ | ||
148 | |||
149 | status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, | ||
150 | aml_length, NULL, ACPI_IMODE_EXECUTE); | ||
151 | if (ACPI_FAILURE(status)) { | ||
152 | acpi_ds_delete_walk_state(walk_state); | ||
153 | goto cleanup; | ||
154 | } | ||
155 | |||
156 | /* Mark this execution as a deferred opcode */ | ||
157 | |||
158 | walk_state->deferred_node = node; | ||
159 | status = acpi_ps_parse_aml(walk_state); | ||
160 | |||
161 | cleanup: | ||
162 | acpi_ps_delete_parse_tree(op); | ||
163 | return_ACPI_STATUS(status); | ||
164 | } | ||
165 | |||
166 | /******************************************************************************* | ||
167 | * | ||
168 | * FUNCTION: acpi_ds_get_buffer_field_arguments | ||
169 | * | ||
170 | * PARAMETERS: obj_desc - A valid buffer_field object | ||
171 | * | ||
172 | * RETURN: Status. | ||
173 | * | ||
174 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late | ||
175 | * evaluation of these field attributes. | ||
176 | * | ||
177 | ******************************************************************************/ | ||
178 | |||
179 | acpi_status | ||
180 | acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | ||
181 | { | ||
182 | union acpi_operand_object *extra_desc; | ||
183 | struct acpi_namespace_node *node; | ||
184 | acpi_status status; | ||
185 | |||
186 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); | ||
187 | |||
188 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
189 | return_ACPI_STATUS(AE_OK); | ||
190 | } | ||
191 | |||
192 | /* Get the AML pointer (method object) and buffer_field node */ | ||
193 | |||
194 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
195 | node = obj_desc->buffer_field.node; | ||
196 | |||
197 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_BUFFER_FIELD, | ||
198 | node, NULL)); | ||
199 | |||
200 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", | ||
201 | acpi_ut_get_node_name(node))); | ||
202 | |||
203 | /* Execute the AML code for the term_arg arguments */ | ||
204 | |||
205 | status = acpi_ds_execute_arguments(node, node->parent, | ||
206 | extra_desc->extra.aml_length, | ||
207 | extra_desc->extra.aml_start); | ||
208 | return_ACPI_STATUS(status); | ||
209 | } | ||
210 | |||
211 | /******************************************************************************* | ||
212 | * | ||
213 | * FUNCTION: acpi_ds_get_bank_field_arguments | ||
214 | * | ||
215 | * PARAMETERS: obj_desc - A valid bank_field object | ||
216 | * | ||
217 | * RETURN: Status. | ||
218 | * | ||
219 | * DESCRIPTION: Get bank_field bank_value. This implements the late | ||
220 | * evaluation of these field attributes. | ||
221 | * | ||
222 | ******************************************************************************/ | ||
223 | |||
224 | acpi_status | ||
225 | acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc) | ||
226 | { | ||
227 | union acpi_operand_object *extra_desc; | ||
228 | struct acpi_namespace_node *node; | ||
229 | acpi_status status; | ||
230 | |||
231 | ACPI_FUNCTION_TRACE_PTR(ds_get_bank_field_arguments, obj_desc); | ||
232 | |||
233 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
234 | return_ACPI_STATUS(AE_OK); | ||
235 | } | ||
236 | |||
237 | /* Get the AML pointer (method object) and bank_field node */ | ||
238 | |||
239 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
240 | node = obj_desc->bank_field.node; | ||
241 | |||
242 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
243 | (ACPI_TYPE_LOCAL_BANK_FIELD, node, NULL)); | ||
244 | |||
245 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", | ||
246 | acpi_ut_get_node_name(node))); | ||
247 | |||
248 | /* Execute the AML code for the term_arg arguments */ | ||
249 | |||
250 | status = acpi_ds_execute_arguments(node, node->parent, | ||
251 | extra_desc->extra.aml_length, | ||
252 | extra_desc->extra.aml_start); | ||
253 | return_ACPI_STATUS(status); | ||
254 | } | ||
255 | |||
256 | /******************************************************************************* | ||
257 | * | ||
258 | * FUNCTION: acpi_ds_get_buffer_arguments | ||
259 | * | ||
260 | * PARAMETERS: obj_desc - A valid Buffer object | ||
261 | * | ||
262 | * RETURN: Status. | ||
263 | * | ||
264 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements | ||
265 | * the late evaluation of these attributes. | ||
266 | * | ||
267 | ******************************************************************************/ | ||
268 | |||
269 | acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | ||
270 | { | ||
271 | struct acpi_namespace_node *node; | ||
272 | acpi_status status; | ||
273 | |||
274 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); | ||
275 | |||
276 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
277 | return_ACPI_STATUS(AE_OK); | ||
278 | } | ||
279 | |||
280 | /* Get the Buffer node */ | ||
281 | |||
282 | node = obj_desc->buffer.node; | ||
283 | if (!node) { | ||
284 | ACPI_ERROR((AE_INFO, | ||
285 | "No pointer back to namespace node in buffer object %p", | ||
286 | obj_desc)); | ||
287 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
288 | } | ||
289 | |||
290 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Buffer Arg Init\n")); | ||
291 | |||
292 | /* Execute the AML code for the term_arg arguments */ | ||
293 | |||
294 | status = acpi_ds_execute_arguments(node, node, | ||
295 | obj_desc->buffer.aml_length, | ||
296 | obj_desc->buffer.aml_start); | ||
297 | return_ACPI_STATUS(status); | ||
298 | } | ||
299 | |||
300 | /******************************************************************************* | ||
301 | * | ||
302 | * FUNCTION: acpi_ds_get_package_arguments | ||
303 | * | ||
304 | * PARAMETERS: obj_desc - A valid Package object | ||
305 | * | ||
306 | * RETURN: Status. | ||
307 | * | ||
308 | * DESCRIPTION: Get Package length and initializer byte list. This implements | ||
309 | * the late evaluation of these attributes. | ||
310 | * | ||
311 | ******************************************************************************/ | ||
312 | |||
313 | acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | ||
314 | { | ||
315 | struct acpi_namespace_node *node; | ||
316 | acpi_status status; | ||
317 | |||
318 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); | ||
319 | |||
320 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
321 | return_ACPI_STATUS(AE_OK); | ||
322 | } | ||
323 | |||
324 | /* Get the Package node */ | ||
325 | |||
326 | node = obj_desc->package.node; | ||
327 | if (!node) { | ||
328 | ACPI_ERROR((AE_INFO, | ||
329 | "No pointer back to namespace node in package %p", | ||
330 | obj_desc)); | ||
331 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
332 | } | ||
333 | |||
334 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Package Arg Init\n")); | ||
335 | |||
336 | /* Execute the AML code for the term_arg arguments */ | ||
337 | |||
338 | status = acpi_ds_execute_arguments(node, node, | ||
339 | obj_desc->package.aml_length, | ||
340 | obj_desc->package.aml_start); | ||
341 | return_ACPI_STATUS(status); | ||
342 | } | ||
343 | |||
344 | /******************************************************************************* | ||
345 | * | ||
346 | * FUNCTION: acpi_ds_get_region_arguments | ||
347 | * | ||
348 | * PARAMETERS: obj_desc - A valid region object | ||
349 | * | ||
350 | * RETURN: Status. | ||
351 | * | ||
352 | * DESCRIPTION: Get region address and length. This implements the late | ||
353 | * evaluation of these region attributes. | ||
354 | * | ||
355 | ******************************************************************************/ | ||
356 | |||
357 | acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | ||
358 | { | ||
359 | struct acpi_namespace_node *node; | ||
360 | acpi_status status; | ||
361 | union acpi_operand_object *extra_desc; | ||
362 | |||
363 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); | ||
364 | |||
365 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | ||
366 | return_ACPI_STATUS(AE_OK); | ||
367 | } | ||
368 | |||
369 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
370 | if (!extra_desc) { | ||
371 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
372 | } | ||
373 | |||
374 | /* Get the Region node */ | ||
375 | |||
376 | node = obj_desc->region.node; | ||
377 | |||
378 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
379 | (ACPI_TYPE_REGION, node, NULL)); | ||
380 | |||
381 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", | ||
382 | acpi_ut_get_node_name(node), | ||
383 | extra_desc->extra.aml_start)); | ||
384 | |||
385 | /* Execute the argument AML */ | ||
386 | |||
387 | status = acpi_ds_execute_arguments(node, node->parent, | ||
388 | extra_desc->extra.aml_length, | ||
389 | extra_desc->extra.aml_start); | ||
390 | return_ACPI_STATUS(status); | ||
391 | } | ||
diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c new file mode 100644 index 000000000000..26c49fff58da --- /dev/null +++ b/drivers/acpi/acpica/dscontrol.c | |||
@@ -0,0 +1,410 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: dscontrol - Support for execution control opcodes - | ||
4 | * if/else/while/return | ||
5 | * | ||
6 | *****************************************************************************/ | ||
7 | |||
8 | /* | ||
9 | * Copyright (C) 2000 - 2011, Intel Corp. | ||
10 | * All rights reserved. | ||
11 | * | ||
12 | * Redistribution and use in source and binary forms, with or without | ||
13 | * modification, are permitted provided that the following conditions | ||
14 | * are met: | ||
15 | * 1. Redistributions of source code must retain the above copyright | ||
16 | * notice, this list of conditions, and the following disclaimer, | ||
17 | * without modification. | ||
18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
19 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
20 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
21 | * including a substantially similar Disclaimer requirement for further | ||
22 | * binary redistribution. | ||
23 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
24 | * of any contributors may be used to endorse or promote products derived | ||
25 | * from this software without specific prior written permission. | ||
26 | * | ||
27 | * Alternatively, this software may be distributed under the terms of the | ||
28 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
29 | * Software Foundation. | ||
30 | * | ||
31 | * NO WARRANTY | ||
32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
42 | * POSSIBILITY OF SUCH DAMAGES. | ||
43 | */ | ||
44 | |||
45 | #include <acpi/acpi.h> | ||
46 | #include "accommon.h" | ||
47 | #include "amlcode.h" | ||
48 | #include "acdispat.h" | ||
49 | #include "acinterp.h" | ||
50 | |||
51 | #define _COMPONENT ACPI_DISPATCHER | ||
52 | ACPI_MODULE_NAME("dscontrol") | ||
53 | |||
54 | /******************************************************************************* | ||
55 | * | ||
56 | * FUNCTION: acpi_ds_exec_begin_control_op | ||
57 | * | ||
58 | * PARAMETERS: walk_list - The list that owns the walk stack | ||
59 | * Op - The control Op | ||
60 | * | ||
61 | * RETURN: Status | ||
62 | * | ||
63 | * DESCRIPTION: Handles all control ops encountered during control method | ||
64 | * execution. | ||
65 | * | ||
66 | ******************************************************************************/ | ||
67 | acpi_status | ||
68 | acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | ||
69 | union acpi_parse_object *op) | ||
70 | { | ||
71 | acpi_status status = AE_OK; | ||
72 | union acpi_generic_state *control_state; | ||
73 | |||
74 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); | ||
75 | |||
76 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", | ||
77 | op, op->common.aml_opcode, walk_state)); | ||
78 | |||
79 | switch (op->common.aml_opcode) { | ||
80 | case AML_WHILE_OP: | ||
81 | |||
82 | /* | ||
83 | * If this is an additional iteration of a while loop, continue. | ||
84 | * There is no need to allocate a new control state. | ||
85 | */ | ||
86 | if (walk_state->control_state) { | ||
87 | if (walk_state->control_state->control. | ||
88 | aml_predicate_start == | ||
89 | (walk_state->parser_state.aml - 1)) { | ||
90 | |||
91 | /* Reset the state to start-of-loop */ | ||
92 | |||
93 | walk_state->control_state->common.state = | ||
94 | ACPI_CONTROL_CONDITIONAL_EXECUTING; | ||
95 | break; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /*lint -fallthrough */ | ||
100 | |||
101 | case AML_IF_OP: | ||
102 | |||
103 | /* | ||
104 | * IF/WHILE: Create a new control state to manage these | ||
105 | * constructs. We need to manage these as a stack, in order | ||
106 | * to handle nesting. | ||
107 | */ | ||
108 | control_state = acpi_ut_create_control_state(); | ||
109 | if (!control_state) { | ||
110 | status = AE_NO_MEMORY; | ||
111 | break; | ||
112 | } | ||
113 | /* | ||
114 | * Save a pointer to the predicate for multiple executions | ||
115 | * of a loop | ||
116 | */ | ||
117 | control_state->control.aml_predicate_start = | ||
118 | walk_state->parser_state.aml - 1; | ||
119 | control_state->control.package_end = | ||
120 | walk_state->parser_state.pkg_end; | ||
121 | control_state->control.opcode = op->common.aml_opcode; | ||
122 | |||
123 | /* Push the control state on this walk's control stack */ | ||
124 | |||
125 | acpi_ut_push_generic_state(&walk_state->control_state, | ||
126 | control_state); | ||
127 | break; | ||
128 | |||
129 | case AML_ELSE_OP: | ||
130 | |||
131 | /* Predicate is in the state object */ | ||
132 | /* If predicate is true, the IF was executed, ignore ELSE part */ | ||
133 | |||
134 | if (walk_state->last_predicate) { | ||
135 | status = AE_CTRL_TRUE; | ||
136 | } | ||
137 | |||
138 | break; | ||
139 | |||
140 | case AML_RETURN_OP: | ||
141 | |||
142 | break; | ||
143 | |||
144 | default: | ||
145 | break; | ||
146 | } | ||
147 | |||
148 | return (status); | ||
149 | } | ||
150 | |||
151 | /******************************************************************************* | ||
152 | * | ||
153 | * FUNCTION: acpi_ds_exec_end_control_op | ||
154 | * | ||
155 | * PARAMETERS: walk_list - The list that owns the walk stack | ||
156 | * Op - The control Op | ||
157 | * | ||
158 | * RETURN: Status | ||
159 | * | ||
160 | * DESCRIPTION: Handles all control ops encountered during control method | ||
161 | * execution. | ||
162 | * | ||
163 | ******************************************************************************/ | ||
164 | |||
165 | acpi_status | ||
166 | acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | ||
167 | union acpi_parse_object * op) | ||
168 | { | ||
169 | acpi_status status = AE_OK; | ||
170 | union acpi_generic_state *control_state; | ||
171 | |||
172 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); | ||
173 | |||
174 | switch (op->common.aml_opcode) { | ||
175 | case AML_IF_OP: | ||
176 | |||
177 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op)); | ||
178 | |||
179 | /* | ||
180 | * Save the result of the predicate in case there is an | ||
181 | * ELSE to come | ||
182 | */ | ||
183 | walk_state->last_predicate = | ||
184 | (u8)walk_state->control_state->common.value; | ||
185 | |||
186 | /* | ||
187 | * Pop the control state that was created at the start | ||
188 | * of the IF and free it | ||
189 | */ | ||
190 | control_state = | ||
191 | acpi_ut_pop_generic_state(&walk_state->control_state); | ||
192 | acpi_ut_delete_generic_state(control_state); | ||
193 | break; | ||
194 | |||
195 | case AML_ELSE_OP: | ||
196 | |||
197 | break; | ||
198 | |||
199 | case AML_WHILE_OP: | ||
200 | |||
201 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | ||
202 | |||
203 | control_state = walk_state->control_state; | ||
204 | if (control_state->common.value) { | ||
205 | |||
206 | /* Predicate was true, the body of the loop was just executed */ | ||
207 | |||
208 | /* | ||
209 | * This loop counter mechanism allows the interpreter to escape | ||
210 | * possibly infinite loops. This can occur in poorly written AML | ||
211 | * when the hardware does not respond within a while loop and the | ||
212 | * loop does not implement a timeout. | ||
213 | */ | ||
214 | control_state->control.loop_count++; | ||
215 | if (control_state->control.loop_count > | ||
216 | ACPI_MAX_LOOP_ITERATIONS) { | ||
217 | status = AE_AML_INFINITE_LOOP; | ||
218 | break; | ||
219 | } | ||
220 | |||
221 | /* | ||
222 | * Go back and evaluate the predicate and maybe execute the loop | ||
223 | * another time | ||
224 | */ | ||
225 | status = AE_CTRL_PENDING; | ||
226 | walk_state->aml_last_while = | ||
227 | control_state->control.aml_predicate_start; | ||
228 | break; | ||
229 | } | ||
230 | |||
231 | /* Predicate was false, terminate this while loop */ | ||
232 | |||
233 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
234 | "[WHILE_OP] termination! Op=%p\n", op)); | ||
235 | |||
236 | /* Pop this control state and free it */ | ||
237 | |||
238 | control_state = | ||
239 | acpi_ut_pop_generic_state(&walk_state->control_state); | ||
240 | acpi_ut_delete_generic_state(control_state); | ||
241 | break; | ||
242 | |||
243 | case AML_RETURN_OP: | ||
244 | |||
245 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
246 | "[RETURN_OP] Op=%p Arg=%p\n", op, | ||
247 | op->common.value.arg)); | ||
248 | |||
249 | /* | ||
250 | * One optional operand -- the return value | ||
251 | * It can be either an immediate operand or a result that | ||
252 | * has been bubbled up the tree | ||
253 | */ | ||
254 | if (op->common.value.arg) { | ||
255 | |||
256 | /* Since we have a real Return(), delete any implicit return */ | ||
257 | |||
258 | acpi_ds_clear_implicit_return(walk_state); | ||
259 | |||
260 | /* Return statement has an immediate operand */ | ||
261 | |||
262 | status = | ||
263 | acpi_ds_create_operands(walk_state, | ||
264 | op->common.value.arg); | ||
265 | if (ACPI_FAILURE(status)) { | ||
266 | return (status); | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * If value being returned is a Reference (such as | ||
271 | * an arg or local), resolve it now because it may | ||
272 | * cease to exist at the end of the method. | ||
273 | */ | ||
274 | status = | ||
275 | acpi_ex_resolve_to_value(&walk_state->operands[0], | ||
276 | walk_state); | ||
277 | if (ACPI_FAILURE(status)) { | ||
278 | return (status); | ||
279 | } | ||
280 | |||
281 | /* | ||
282 | * Get the return value and save as the last result | ||
283 | * value. This is the only place where walk_state->return_desc | ||
284 | * is set to anything other than zero! | ||
285 | */ | ||
286 | walk_state->return_desc = walk_state->operands[0]; | ||
287 | } else if (walk_state->result_count) { | ||
288 | |||
289 | /* Since we have a real Return(), delete any implicit return */ | ||
290 | |||
291 | acpi_ds_clear_implicit_return(walk_state); | ||
292 | |||
293 | /* | ||
294 | * The return value has come from a previous calculation. | ||
295 | * | ||
296 | * If value being returned is a Reference (such as | ||
297 | * an arg or local), resolve it now because it may | ||
298 | * cease to exist at the end of the method. | ||
299 | * | ||
300 | * Allow references created by the Index operator to return | ||
301 | * unchanged. | ||
302 | */ | ||
303 | if ((ACPI_GET_DESCRIPTOR_TYPE | ||
304 | (walk_state->results->results.obj_desc[0]) == | ||
305 | ACPI_DESC_TYPE_OPERAND) | ||
306 | && ((walk_state->results->results.obj_desc[0])-> | ||
307 | common.type == ACPI_TYPE_LOCAL_REFERENCE) | ||
308 | && ((walk_state->results->results.obj_desc[0])-> | ||
309 | reference.class != ACPI_REFCLASS_INDEX)) { | ||
310 | status = | ||
311 | acpi_ex_resolve_to_value(&walk_state-> | ||
312 | results->results. | ||
313 | obj_desc[0], | ||
314 | walk_state); | ||
315 | if (ACPI_FAILURE(status)) { | ||
316 | return (status); | ||
317 | } | ||
318 | } | ||
319 | |||
320 | walk_state->return_desc = | ||
321 | walk_state->results->results.obj_desc[0]; | ||
322 | } else { | ||
323 | /* No return operand */ | ||
324 | |||
325 | if (walk_state->num_operands) { | ||
326 | acpi_ut_remove_reference(walk_state-> | ||
327 | operands[0]); | ||
328 | } | ||
329 | |||
330 | walk_state->operands[0] = NULL; | ||
331 | walk_state->num_operands = 0; | ||
332 | walk_state->return_desc = NULL; | ||
333 | } | ||
334 | |||
335 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
336 | "Completed RETURN_OP State=%p, RetVal=%p\n", | ||
337 | walk_state, walk_state->return_desc)); | ||
338 | |||
339 | /* End the control method execution right now */ | ||
340 | |||
341 | status = AE_CTRL_TERMINATE; | ||
342 | break; | ||
343 | |||
344 | case AML_NOOP_OP: | ||
345 | |||
346 | /* Just do nothing! */ | ||
347 | break; | ||
348 | |||
349 | case AML_BREAK_POINT_OP: | ||
350 | |||
351 | /* | ||
352 | * Set the single-step flag. This will cause the debugger (if present) | ||
353 | * to break to the console within the AML debugger at the start of the | ||
354 | * next AML instruction. | ||
355 | */ | ||
356 | ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE); | ||
357 | ACPI_DEBUGGER_EXEC(acpi_os_printf | ||
358 | ("**break** Executed AML BreakPoint opcode\n")); | ||
359 | |||
360 | /* Call to the OSL in case OS wants a piece of the action */ | ||
361 | |||
362 | status = acpi_os_signal(ACPI_SIGNAL_BREAKPOINT, | ||
363 | "Executed AML Breakpoint opcode"); | ||
364 | break; | ||
365 | |||
366 | case AML_BREAK_OP: | ||
367 | case AML_CONTINUE_OP: /* ACPI 2.0 */ | ||
368 | |||
369 | /* Pop and delete control states until we find a while */ | ||
370 | |||
371 | while (walk_state->control_state && | ||
372 | (walk_state->control_state->control.opcode != | ||
373 | AML_WHILE_OP)) { | ||
374 | control_state = | ||
375 | acpi_ut_pop_generic_state(&walk_state-> | ||
376 | control_state); | ||
377 | acpi_ut_delete_generic_state(control_state); | ||
378 | } | ||
379 | |||
380 | /* No while found? */ | ||
381 | |||
382 | if (!walk_state->control_state) { | ||
383 | return (AE_AML_NO_WHILE); | ||
384 | } | ||
385 | |||
386 | /* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */ | ||
387 | |||
388 | walk_state->aml_last_while = | ||
389 | walk_state->control_state->control.package_end; | ||
390 | |||
391 | /* Return status depending on opcode */ | ||
392 | |||
393 | if (op->common.aml_opcode == AML_BREAK_OP) { | ||
394 | status = AE_CTRL_BREAK; | ||
395 | } else { | ||
396 | status = AE_CTRL_CONTINUE; | ||
397 | } | ||
398 | break; | ||
399 | |||
400 | default: | ||
401 | |||
402 | ACPI_ERROR((AE_INFO, "Unknown control opcode=0x%X Op=%p", | ||
403 | op->common.aml_opcode, op)); | ||
404 | |||
405 | status = AE_AML_BAD_OPCODE; | ||
406 | break; | ||
407 | } | ||
408 | |||
409 | return (status); | ||
410 | } | ||
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index bbecf293aeeb..c627a288e027 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c | |||
@@ -1,7 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: dsopcode - Dispatcher Op Region support and handling of | 3 | * Module Name: dsopcode - Dispatcher suport for regions and fields |
4 | * "control" opcodes | ||
5 | * | 4 | * |
6 | *****************************************************************************/ | 5 | *****************************************************************************/ |
7 | 6 | ||
@@ -57,11 +56,6 @@ ACPI_MODULE_NAME("dsopcode") | |||
57 | 56 | ||
58 | /* Local prototypes */ | 57 | /* Local prototypes */ |
59 | static acpi_status | 58 | static acpi_status |
60 | acpi_ds_execute_arguments(struct acpi_namespace_node *node, | ||
61 | struct acpi_namespace_node *scope_node, | ||
62 | u32 aml_length, u8 * aml_start); | ||
63 | |||
64 | static acpi_status | ||
65 | acpi_ds_init_buffer_field(u16 aml_opcode, | 59 | acpi_ds_init_buffer_field(u16 aml_opcode, |
66 | union acpi_operand_object *obj_desc, | 60 | union acpi_operand_object *obj_desc, |
67 | union acpi_operand_object *buffer_desc, | 61 | union acpi_operand_object *buffer_desc, |
@@ -71,361 +65,6 @@ acpi_ds_init_buffer_field(u16 aml_opcode, | |||
71 | 65 | ||
72 | /******************************************************************************* | 66 | /******************************************************************************* |
73 | * | 67 | * |
74 | * FUNCTION: acpi_ds_execute_arguments | ||
75 | * | ||
76 | * PARAMETERS: Node - Object NS node | ||
77 | * scope_node - Parent NS node | ||
78 | * aml_length - Length of executable AML | ||
79 | * aml_start - Pointer to the AML | ||
80 | * | ||
81 | * RETURN: Status. | ||
82 | * | ||
83 | * DESCRIPTION: Late (deferred) execution of region or field arguments | ||
84 | * | ||
85 | ******************************************************************************/ | ||
86 | |||
87 | static acpi_status | ||
88 | acpi_ds_execute_arguments(struct acpi_namespace_node *node, | ||
89 | struct acpi_namespace_node *scope_node, | ||
90 | u32 aml_length, u8 * aml_start) | ||
91 | { | ||
92 | acpi_status status; | ||
93 | union acpi_parse_object *op; | ||
94 | struct acpi_walk_state *walk_state; | ||
95 | |||
96 | ACPI_FUNCTION_TRACE(ds_execute_arguments); | ||
97 | |||
98 | /* | ||
99 | * Allocate a new parser op to be the root of the parsed tree | ||
100 | */ | ||
101 | op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); | ||
102 | if (!op) { | ||
103 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
104 | } | ||
105 | |||
106 | /* Save the Node for use in acpi_ps_parse_aml */ | ||
107 | |||
108 | op->common.node = scope_node; | ||
109 | |||
110 | /* Create and initialize a new parser state */ | ||
111 | |||
112 | walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); | ||
113 | if (!walk_state) { | ||
114 | status = AE_NO_MEMORY; | ||
115 | goto cleanup; | ||
116 | } | ||
117 | |||
118 | status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, | ||
119 | aml_length, NULL, ACPI_IMODE_LOAD_PASS1); | ||
120 | if (ACPI_FAILURE(status)) { | ||
121 | acpi_ds_delete_walk_state(walk_state); | ||
122 | goto cleanup; | ||
123 | } | ||
124 | |||
125 | /* Mark this parse as a deferred opcode */ | ||
126 | |||
127 | walk_state->parse_flags = ACPI_PARSE_DEFERRED_OP; | ||
128 | walk_state->deferred_node = node; | ||
129 | |||
130 | /* Pass1: Parse the entire declaration */ | ||
131 | |||
132 | status = acpi_ps_parse_aml(walk_state); | ||
133 | if (ACPI_FAILURE(status)) { | ||
134 | goto cleanup; | ||
135 | } | ||
136 | |||
137 | /* Get and init the Op created above */ | ||
138 | |||
139 | op->common.node = node; | ||
140 | acpi_ps_delete_parse_tree(op); | ||
141 | |||
142 | /* Evaluate the deferred arguments */ | ||
143 | |||
144 | op = acpi_ps_alloc_op(AML_INT_EVAL_SUBTREE_OP); | ||
145 | if (!op) { | ||
146 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
147 | } | ||
148 | |||
149 | op->common.node = scope_node; | ||
150 | |||
151 | /* Create and initialize a new parser state */ | ||
152 | |||
153 | walk_state = acpi_ds_create_walk_state(0, NULL, NULL, NULL); | ||
154 | if (!walk_state) { | ||
155 | status = AE_NO_MEMORY; | ||
156 | goto cleanup; | ||
157 | } | ||
158 | |||
159 | /* Execute the opcode and arguments */ | ||
160 | |||
161 | status = acpi_ds_init_aml_walk(walk_state, op, NULL, aml_start, | ||
162 | aml_length, NULL, ACPI_IMODE_EXECUTE); | ||
163 | if (ACPI_FAILURE(status)) { | ||
164 | acpi_ds_delete_walk_state(walk_state); | ||
165 | goto cleanup; | ||
166 | } | ||
167 | |||
168 | /* Mark this execution as a deferred opcode */ | ||
169 | |||
170 | walk_state->deferred_node = node; | ||
171 | status = acpi_ps_parse_aml(walk_state); | ||
172 | |||
173 | cleanup: | ||
174 | acpi_ps_delete_parse_tree(op); | ||
175 | return_ACPI_STATUS(status); | ||
176 | } | ||
177 | |||
178 | /******************************************************************************* | ||
179 | * | ||
180 | * FUNCTION: acpi_ds_get_buffer_field_arguments | ||
181 | * | ||
182 | * PARAMETERS: obj_desc - A valid buffer_field object | ||
183 | * | ||
184 | * RETURN: Status. | ||
185 | * | ||
186 | * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late | ||
187 | * evaluation of these field attributes. | ||
188 | * | ||
189 | ******************************************************************************/ | ||
190 | |||
191 | acpi_status | ||
192 | acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) | ||
193 | { | ||
194 | union acpi_operand_object *extra_desc; | ||
195 | struct acpi_namespace_node *node; | ||
196 | acpi_status status; | ||
197 | |||
198 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_field_arguments, obj_desc); | ||
199 | |||
200 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
201 | return_ACPI_STATUS(AE_OK); | ||
202 | } | ||
203 | |||
204 | /* Get the AML pointer (method object) and buffer_field node */ | ||
205 | |||
206 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
207 | node = obj_desc->buffer_field.node; | ||
208 | |||
209 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
210 | (ACPI_TYPE_BUFFER_FIELD, node, NULL)); | ||
211 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", | ||
212 | acpi_ut_get_node_name(node))); | ||
213 | |||
214 | /* Execute the AML code for the term_arg arguments */ | ||
215 | |||
216 | status = acpi_ds_execute_arguments(node, node->parent, | ||
217 | extra_desc->extra.aml_length, | ||
218 | extra_desc->extra.aml_start); | ||
219 | return_ACPI_STATUS(status); | ||
220 | } | ||
221 | |||
222 | /******************************************************************************* | ||
223 | * | ||
224 | * FUNCTION: acpi_ds_get_bank_field_arguments | ||
225 | * | ||
226 | * PARAMETERS: obj_desc - A valid bank_field object | ||
227 | * | ||
228 | * RETURN: Status. | ||
229 | * | ||
230 | * DESCRIPTION: Get bank_field bank_value. This implements the late | ||
231 | * evaluation of these field attributes. | ||
232 | * | ||
233 | ******************************************************************************/ | ||
234 | |||
235 | acpi_status | ||
236 | acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc) | ||
237 | { | ||
238 | union acpi_operand_object *extra_desc; | ||
239 | struct acpi_namespace_node *node; | ||
240 | acpi_status status; | ||
241 | |||
242 | ACPI_FUNCTION_TRACE_PTR(ds_get_bank_field_arguments, obj_desc); | ||
243 | |||
244 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
245 | return_ACPI_STATUS(AE_OK); | ||
246 | } | ||
247 | |||
248 | /* Get the AML pointer (method object) and bank_field node */ | ||
249 | |||
250 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
251 | node = obj_desc->bank_field.node; | ||
252 | |||
253 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
254 | (ACPI_TYPE_LOCAL_BANK_FIELD, node, NULL)); | ||
255 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BankField Arg Init\n", | ||
256 | acpi_ut_get_node_name(node))); | ||
257 | |||
258 | /* Execute the AML code for the term_arg arguments */ | ||
259 | |||
260 | status = acpi_ds_execute_arguments(node, node->parent, | ||
261 | extra_desc->extra.aml_length, | ||
262 | extra_desc->extra.aml_start); | ||
263 | return_ACPI_STATUS(status); | ||
264 | } | ||
265 | |||
266 | /******************************************************************************* | ||
267 | * | ||
268 | * FUNCTION: acpi_ds_get_buffer_arguments | ||
269 | * | ||
270 | * PARAMETERS: obj_desc - A valid Buffer object | ||
271 | * | ||
272 | * RETURN: Status. | ||
273 | * | ||
274 | * DESCRIPTION: Get Buffer length and initializer byte list. This implements | ||
275 | * the late evaluation of these attributes. | ||
276 | * | ||
277 | ******************************************************************************/ | ||
278 | |||
279 | acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc) | ||
280 | { | ||
281 | struct acpi_namespace_node *node; | ||
282 | acpi_status status; | ||
283 | |||
284 | ACPI_FUNCTION_TRACE_PTR(ds_get_buffer_arguments, obj_desc); | ||
285 | |||
286 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
287 | return_ACPI_STATUS(AE_OK); | ||
288 | } | ||
289 | |||
290 | /* Get the Buffer node */ | ||
291 | |||
292 | node = obj_desc->buffer.node; | ||
293 | if (!node) { | ||
294 | ACPI_ERROR((AE_INFO, | ||
295 | "No pointer back to namespace node in buffer object %p", | ||
296 | obj_desc)); | ||
297 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
298 | } | ||
299 | |||
300 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Buffer Arg Init\n")); | ||
301 | |||
302 | /* Execute the AML code for the term_arg arguments */ | ||
303 | |||
304 | status = acpi_ds_execute_arguments(node, node, | ||
305 | obj_desc->buffer.aml_length, | ||
306 | obj_desc->buffer.aml_start); | ||
307 | return_ACPI_STATUS(status); | ||
308 | } | ||
309 | |||
310 | /******************************************************************************* | ||
311 | * | ||
312 | * FUNCTION: acpi_ds_get_package_arguments | ||
313 | * | ||
314 | * PARAMETERS: obj_desc - A valid Package object | ||
315 | * | ||
316 | * RETURN: Status. | ||
317 | * | ||
318 | * DESCRIPTION: Get Package length and initializer byte list. This implements | ||
319 | * the late evaluation of these attributes. | ||
320 | * | ||
321 | ******************************************************************************/ | ||
322 | |||
323 | acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc) | ||
324 | { | ||
325 | struct acpi_namespace_node *node; | ||
326 | acpi_status status; | ||
327 | |||
328 | ACPI_FUNCTION_TRACE_PTR(ds_get_package_arguments, obj_desc); | ||
329 | |||
330 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | ||
331 | return_ACPI_STATUS(AE_OK); | ||
332 | } | ||
333 | |||
334 | /* Get the Package node */ | ||
335 | |||
336 | node = obj_desc->package.node; | ||
337 | if (!node) { | ||
338 | ACPI_ERROR((AE_INFO, | ||
339 | "No pointer back to namespace node in package %p", | ||
340 | obj_desc)); | ||
341 | return_ACPI_STATUS(AE_AML_INTERNAL); | ||
342 | } | ||
343 | |||
344 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Package Arg Init\n")); | ||
345 | |||
346 | /* Execute the AML code for the term_arg arguments */ | ||
347 | |||
348 | status = acpi_ds_execute_arguments(node, node, | ||
349 | obj_desc->package.aml_length, | ||
350 | obj_desc->package.aml_start); | ||
351 | return_ACPI_STATUS(status); | ||
352 | } | ||
353 | |||
354 | /***************************************************************************** | ||
355 | * | ||
356 | * FUNCTION: acpi_ds_get_region_arguments | ||
357 | * | ||
358 | * PARAMETERS: obj_desc - A valid region object | ||
359 | * | ||
360 | * RETURN: Status. | ||
361 | * | ||
362 | * DESCRIPTION: Get region address and length. This implements the late | ||
363 | * evaluation of these region attributes. | ||
364 | * | ||
365 | ****************************************************************************/ | ||
366 | |||
367 | acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) | ||
368 | { | ||
369 | struct acpi_namespace_node *node; | ||
370 | acpi_status status; | ||
371 | union acpi_operand_object *extra_desc; | ||
372 | |||
373 | ACPI_FUNCTION_TRACE_PTR(ds_get_region_arguments, obj_desc); | ||
374 | |||
375 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { | ||
376 | return_ACPI_STATUS(AE_OK); | ||
377 | } | ||
378 | |||
379 | extra_desc = acpi_ns_get_secondary_object(obj_desc); | ||
380 | if (!extra_desc) { | ||
381 | return_ACPI_STATUS(AE_NOT_EXIST); | ||
382 | } | ||
383 | |||
384 | /* Get the Region node */ | ||
385 | |||
386 | node = obj_desc->region.node; | ||
387 | |||
388 | ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname | ||
389 | (ACPI_TYPE_REGION, node, NULL)); | ||
390 | |||
391 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", | ||
392 | acpi_ut_get_node_name(node), | ||
393 | extra_desc->extra.aml_start)); | ||
394 | |||
395 | /* Execute the argument AML */ | ||
396 | |||
397 | status = acpi_ds_execute_arguments(node, node->parent, | ||
398 | extra_desc->extra.aml_length, | ||
399 | extra_desc->extra.aml_start); | ||
400 | if (ACPI_FAILURE(status)) { | ||
401 | return_ACPI_STATUS(status); | ||
402 | } | ||
403 | |||
404 | /* Validate the region address/length via the host OS */ | ||
405 | |||
406 | status = acpi_os_validate_address(obj_desc->region.space_id, | ||
407 | obj_desc->region.address, | ||
408 | (acpi_size) obj_desc->region.length, | ||
409 | acpi_ut_get_node_name(node)); | ||
410 | |||
411 | if (ACPI_FAILURE(status)) { | ||
412 | /* | ||
413 | * Invalid address/length. We will emit an error message and mark | ||
414 | * the region as invalid, so that it will cause an additional error if | ||
415 | * it is ever used. Then return AE_OK. | ||
416 | */ | ||
417 | ACPI_EXCEPTION((AE_INFO, status, | ||
418 | "During address validation of OpRegion [%4.4s]", | ||
419 | node->name.ascii)); | ||
420 | obj_desc->common.flags |= AOPOBJ_INVALID; | ||
421 | status = AE_OK; | ||
422 | } | ||
423 | |||
424 | return_ACPI_STATUS(status); | ||
425 | } | ||
426 | |||
427 | /******************************************************************************* | ||
428 | * | ||
429 | * FUNCTION: acpi_ds_initialize_region | 68 | * FUNCTION: acpi_ds_initialize_region |
430 | * | 69 | * |
431 | * PARAMETERS: obj_handle - Region namespace node | 70 | * PARAMETERS: obj_handle - Region namespace node |
@@ -826,8 +465,9 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, | |||
826 | * | 465 | * |
827 | * RETURN: Status | 466 | * RETURN: Status |
828 | * | 467 | * |
829 | * DESCRIPTION: Get region address and length | 468 | * DESCRIPTION: Get region address and length. |
830 | * Called from acpi_ds_exec_end_op during data_table_region parse tree walk | 469 | * Called from acpi_ds_exec_end_op during data_table_region parse |
470 | * tree walk. | ||
831 | * | 471 | * |
832 | ******************************************************************************/ | 472 | ******************************************************************************/ |
833 | 473 | ||
@@ -1114,360 +754,3 @@ acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state, | |||
1114 | acpi_ut_remove_reference(operand_desc); | 754 | acpi_ut_remove_reference(operand_desc); |
1115 | return_ACPI_STATUS(status); | 755 | return_ACPI_STATUS(status); |
1116 | } | 756 | } |
1117 | |||
1118 | /******************************************************************************* | ||
1119 | * | ||
1120 | * FUNCTION: acpi_ds_exec_begin_control_op | ||
1121 | * | ||
1122 | * PARAMETERS: walk_list - The list that owns the walk stack | ||
1123 | * Op - The control Op | ||
1124 | * | ||
1125 | * RETURN: Status | ||
1126 | * | ||
1127 | * DESCRIPTION: Handles all control ops encountered during control method | ||
1128 | * execution. | ||
1129 | * | ||
1130 | ******************************************************************************/ | ||
1131 | |||
1132 | acpi_status | ||
1133 | acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, | ||
1134 | union acpi_parse_object *op) | ||
1135 | { | ||
1136 | acpi_status status = AE_OK; | ||
1137 | union acpi_generic_state *control_state; | ||
1138 | |||
1139 | ACPI_FUNCTION_NAME(ds_exec_begin_control_op); | ||
1140 | |||
1141 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op, | ||
1142 | op->common.aml_opcode, walk_state)); | ||
1143 | |||
1144 | switch (op->common.aml_opcode) { | ||
1145 | case AML_WHILE_OP: | ||
1146 | |||
1147 | /* | ||
1148 | * If this is an additional iteration of a while loop, continue. | ||
1149 | * There is no need to allocate a new control state. | ||
1150 | */ | ||
1151 | if (walk_state->control_state) { | ||
1152 | if (walk_state->control_state->control.aml_predicate_start | ||
1153 | == (walk_state->parser_state.aml - 1)) { | ||
1154 | |||
1155 | /* Reset the state to start-of-loop */ | ||
1156 | |||
1157 | walk_state->control_state->common.state = | ||
1158 | ACPI_CONTROL_CONDITIONAL_EXECUTING; | ||
1159 | break; | ||
1160 | } | ||
1161 | } | ||
1162 | |||
1163 | /*lint -fallthrough */ | ||
1164 | |||
1165 | case AML_IF_OP: | ||
1166 | |||
1167 | /* | ||
1168 | * IF/WHILE: Create a new control state to manage these | ||
1169 | * constructs. We need to manage these as a stack, in order | ||
1170 | * to handle nesting. | ||
1171 | */ | ||
1172 | control_state = acpi_ut_create_control_state(); | ||
1173 | if (!control_state) { | ||
1174 | status = AE_NO_MEMORY; | ||
1175 | break; | ||
1176 | } | ||
1177 | /* | ||
1178 | * Save a pointer to the predicate for multiple executions | ||
1179 | * of a loop | ||
1180 | */ | ||
1181 | control_state->control.aml_predicate_start = | ||
1182 | walk_state->parser_state.aml - 1; | ||
1183 | control_state->control.package_end = | ||
1184 | walk_state->parser_state.pkg_end; | ||
1185 | control_state->control.opcode = op->common.aml_opcode; | ||
1186 | |||
1187 | /* Push the control state on this walk's control stack */ | ||
1188 | |||
1189 | acpi_ut_push_generic_state(&walk_state->control_state, | ||
1190 | control_state); | ||
1191 | break; | ||
1192 | |||
1193 | case AML_ELSE_OP: | ||
1194 | |||
1195 | /* Predicate is in the state object */ | ||
1196 | /* If predicate is true, the IF was executed, ignore ELSE part */ | ||
1197 | |||
1198 | if (walk_state->last_predicate) { | ||
1199 | status = AE_CTRL_TRUE; | ||
1200 | } | ||
1201 | |||
1202 | break; | ||
1203 | |||
1204 | case AML_RETURN_OP: | ||
1205 | |||
1206 | break; | ||
1207 | |||
1208 | default: | ||
1209 | break; | ||
1210 | } | ||
1211 | |||
1212 | return (status); | ||
1213 | } | ||
1214 | |||
1215 | /******************************************************************************* | ||
1216 | * | ||
1217 | * FUNCTION: acpi_ds_exec_end_control_op | ||
1218 | * | ||
1219 | * PARAMETERS: walk_list - The list that owns the walk stack | ||
1220 | * Op - The control Op | ||
1221 | * | ||
1222 | * RETURN: Status | ||
1223 | * | ||
1224 | * DESCRIPTION: Handles all control ops encountered during control method | ||
1225 | * execution. | ||
1226 | * | ||
1227 | ******************************************************************************/ | ||
1228 | |||
1229 | acpi_status | ||
1230 | acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, | ||
1231 | union acpi_parse_object * op) | ||
1232 | { | ||
1233 | acpi_status status = AE_OK; | ||
1234 | union acpi_generic_state *control_state; | ||
1235 | |||
1236 | ACPI_FUNCTION_NAME(ds_exec_end_control_op); | ||
1237 | |||
1238 | switch (op->common.aml_opcode) { | ||
1239 | case AML_IF_OP: | ||
1240 | |||
1241 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[IF_OP] Op=%p\n", op)); | ||
1242 | |||
1243 | /* | ||
1244 | * Save the result of the predicate in case there is an | ||
1245 | * ELSE to come | ||
1246 | */ | ||
1247 | walk_state->last_predicate = | ||
1248 | (u8) walk_state->control_state->common.value; | ||
1249 | |||
1250 | /* | ||
1251 | * Pop the control state that was created at the start | ||
1252 | * of the IF and free it | ||
1253 | */ | ||
1254 | control_state = | ||
1255 | acpi_ut_pop_generic_state(&walk_state->control_state); | ||
1256 | acpi_ut_delete_generic_state(control_state); | ||
1257 | break; | ||
1258 | |||
1259 | case AML_ELSE_OP: | ||
1260 | |||
1261 | break; | ||
1262 | |||
1263 | case AML_WHILE_OP: | ||
1264 | |||
1265 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op)); | ||
1266 | |||
1267 | control_state = walk_state->control_state; | ||
1268 | if (control_state->common.value) { | ||
1269 | |||
1270 | /* Predicate was true, the body of the loop was just executed */ | ||
1271 | |||
1272 | /* | ||
1273 | * This loop counter mechanism allows the interpreter to escape | ||
1274 | * possibly infinite loops. This can occur in poorly written AML | ||
1275 | * when the hardware does not respond within a while loop and the | ||
1276 | * loop does not implement a timeout. | ||
1277 | */ | ||
1278 | control_state->control.loop_count++; | ||
1279 | if (control_state->control.loop_count > | ||
1280 | ACPI_MAX_LOOP_ITERATIONS) { | ||
1281 | status = AE_AML_INFINITE_LOOP; | ||
1282 | break; | ||
1283 | } | ||
1284 | |||
1285 | /* | ||
1286 | * Go back and evaluate the predicate and maybe execute the loop | ||
1287 | * another time | ||
1288 | */ | ||
1289 | status = AE_CTRL_PENDING; | ||
1290 | walk_state->aml_last_while = | ||
1291 | control_state->control.aml_predicate_start; | ||
1292 | break; | ||
1293 | } | ||
1294 | |||
1295 | /* Predicate was false, terminate this while loop */ | ||
1296 | |||
1297 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1298 | "[WHILE_OP] termination! Op=%p\n", op)); | ||
1299 | |||
1300 | /* Pop this control state and free it */ | ||
1301 | |||
1302 | control_state = | ||
1303 | acpi_ut_pop_generic_state(&walk_state->control_state); | ||
1304 | acpi_ut_delete_generic_state(control_state); | ||
1305 | break; | ||
1306 | |||
1307 | case AML_RETURN_OP: | ||
1308 | |||
1309 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1310 | "[RETURN_OP] Op=%p Arg=%p\n", op, | ||
1311 | op->common.value.arg)); | ||
1312 | |||
1313 | /* | ||
1314 | * One optional operand -- the return value | ||
1315 | * It can be either an immediate operand or a result that | ||
1316 | * has been bubbled up the tree | ||
1317 | */ | ||
1318 | if (op->common.value.arg) { | ||
1319 | |||
1320 | /* Since we have a real Return(), delete any implicit return */ | ||
1321 | |||
1322 | acpi_ds_clear_implicit_return(walk_state); | ||
1323 | |||
1324 | /* Return statement has an immediate operand */ | ||
1325 | |||
1326 | status = | ||
1327 | acpi_ds_create_operands(walk_state, | ||
1328 | op->common.value.arg); | ||
1329 | if (ACPI_FAILURE(status)) { | ||
1330 | return (status); | ||
1331 | } | ||
1332 | |||
1333 | /* | ||
1334 | * If value being returned is a Reference (such as | ||
1335 | * an arg or local), resolve it now because it may | ||
1336 | * cease to exist at the end of the method. | ||
1337 | */ | ||
1338 | status = | ||
1339 | acpi_ex_resolve_to_value(&walk_state->operands[0], | ||
1340 | walk_state); | ||
1341 | if (ACPI_FAILURE(status)) { | ||
1342 | return (status); | ||
1343 | } | ||
1344 | |||
1345 | /* | ||
1346 | * Get the return value and save as the last result | ||
1347 | * value. This is the only place where walk_state->return_desc | ||
1348 | * is set to anything other than zero! | ||
1349 | */ | ||
1350 | walk_state->return_desc = walk_state->operands[0]; | ||
1351 | } else if (walk_state->result_count) { | ||
1352 | |||
1353 | /* Since we have a real Return(), delete any implicit return */ | ||
1354 | |||
1355 | acpi_ds_clear_implicit_return(walk_state); | ||
1356 | |||
1357 | /* | ||
1358 | * The return value has come from a previous calculation. | ||
1359 | * | ||
1360 | * If value being returned is a Reference (such as | ||
1361 | * an arg or local), resolve it now because it may | ||
1362 | * cease to exist at the end of the method. | ||
1363 | * | ||
1364 | * Allow references created by the Index operator to return unchanged. | ||
1365 | */ | ||
1366 | if ((ACPI_GET_DESCRIPTOR_TYPE | ||
1367 | (walk_state->results->results.obj_desc[0]) == | ||
1368 | ACPI_DESC_TYPE_OPERAND) | ||
1369 | && ((walk_state->results->results.obj_desc[0])-> | ||
1370 | common.type == ACPI_TYPE_LOCAL_REFERENCE) | ||
1371 | && ((walk_state->results->results.obj_desc[0])-> | ||
1372 | reference.class != ACPI_REFCLASS_INDEX)) { | ||
1373 | status = | ||
1374 | acpi_ex_resolve_to_value(&walk_state-> | ||
1375 | results->results. | ||
1376 | obj_desc[0], | ||
1377 | walk_state); | ||
1378 | if (ACPI_FAILURE(status)) { | ||
1379 | return (status); | ||
1380 | } | ||
1381 | } | ||
1382 | |||
1383 | walk_state->return_desc = | ||
1384 | walk_state->results->results.obj_desc[0]; | ||
1385 | } else { | ||
1386 | /* No return operand */ | ||
1387 | |||
1388 | if (walk_state->num_operands) { | ||
1389 | acpi_ut_remove_reference(walk_state-> | ||
1390 | operands[0]); | ||
1391 | } | ||
1392 | |||
1393 | walk_state->operands[0] = NULL; | ||
1394 | walk_state->num_operands = 0; | ||
1395 | walk_state->return_desc = NULL; | ||
1396 | } | ||
1397 | |||
1398 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1399 | "Completed RETURN_OP State=%p, RetVal=%p\n", | ||
1400 | walk_state, walk_state->return_desc)); | ||
1401 | |||
1402 | /* End the control method execution right now */ | ||
1403 | |||
1404 | status = AE_CTRL_TERMINATE; | ||
1405 | break; | ||
1406 | |||
1407 | case AML_NOOP_OP: | ||
1408 | |||
1409 | /* Just do nothing! */ | ||
1410 | break; | ||
1411 | |||
1412 | case AML_BREAK_POINT_OP: | ||
1413 | |||
1414 | /* | ||
1415 | * Set the single-step flag. This will cause the debugger (if present) | ||
1416 | * to break to the console within the AML debugger at the start of the | ||
1417 | * next AML instruction. | ||
1418 | */ | ||
1419 | ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE); | ||
1420 | ACPI_DEBUGGER_EXEC(acpi_os_printf | ||
1421 | ("**break** Executed AML BreakPoint opcode\n")); | ||
1422 | |||
1423 | /* Call to the OSL in case OS wants a piece of the action */ | ||
1424 | |||
1425 | status = acpi_os_signal(ACPI_SIGNAL_BREAKPOINT, | ||
1426 | "Executed AML Breakpoint opcode"); | ||
1427 | break; | ||
1428 | |||
1429 | case AML_BREAK_OP: | ||
1430 | case AML_CONTINUE_OP: /* ACPI 2.0 */ | ||
1431 | |||
1432 | /* Pop and delete control states until we find a while */ | ||
1433 | |||
1434 | while (walk_state->control_state && | ||
1435 | (walk_state->control_state->control.opcode != | ||
1436 | AML_WHILE_OP)) { | ||
1437 | control_state = | ||
1438 | acpi_ut_pop_generic_state(&walk_state-> | ||
1439 | control_state); | ||
1440 | acpi_ut_delete_generic_state(control_state); | ||
1441 | } | ||
1442 | |||
1443 | /* No while found? */ | ||
1444 | |||
1445 | if (!walk_state->control_state) { | ||
1446 | return (AE_AML_NO_WHILE); | ||
1447 | } | ||
1448 | |||
1449 | /* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */ | ||
1450 | |||
1451 | walk_state->aml_last_while = | ||
1452 | walk_state->control_state->control.package_end; | ||
1453 | |||
1454 | /* Return status depending on opcode */ | ||
1455 | |||
1456 | if (op->common.aml_opcode == AML_BREAK_OP) { | ||
1457 | status = AE_CTRL_BREAK; | ||
1458 | } else { | ||
1459 | status = AE_CTRL_CONTINUE; | ||
1460 | } | ||
1461 | break; | ||
1462 | |||
1463 | default: | ||
1464 | |||
1465 | ACPI_ERROR((AE_INFO, "Unknown control opcode=0x%X Op=%p", | ||
1466 | op->common.aml_opcode, op)); | ||
1467 | |||
1468 | status = AE_AML_BAD_OPCODE; | ||
1469 | break; | ||
1470 | } | ||
1471 | |||
1472 | return (status); | ||
1473 | } | ||
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 52566ff5e903..23a3b1ab20c1 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Module Name: dswload - Dispatcher namespace load callbacks | 3 | * Module Name: dswload - Dispatcher first pass namespace load callbacks |
4 | * | 4 | * |
5 | *****************************************************************************/ | 5 | *****************************************************************************/ |
6 | 6 | ||
@@ -48,7 +48,6 @@ | |||
48 | #include "acdispat.h" | 48 | #include "acdispat.h" |
49 | #include "acinterp.h" | 49 | #include "acinterp.h" |
50 | #include "acnamesp.h" | 50 | #include "acnamesp.h" |
51 | #include "acevents.h" | ||
52 | 51 | ||
53 | #ifdef ACPI_ASL_COMPILER | 52 | #ifdef ACPI_ASL_COMPILER |
54 | #include <acpi/acdisasm.h> | 53 | #include <acpi/acdisasm.h> |
@@ -537,670 +536,3 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) | |||
537 | 536 | ||
538 | return_ACPI_STATUS(status); | 537 | return_ACPI_STATUS(status); |
539 | } | 538 | } |
540 | |||
541 | /******************************************************************************* | ||
542 | * | ||
543 | * FUNCTION: acpi_ds_load2_begin_op | ||
544 | * | ||
545 | * PARAMETERS: walk_state - Current state of the parse tree walk | ||
546 | * out_op - Wher to return op if a new one is created | ||
547 | * | ||
548 | * RETURN: Status | ||
549 | * | ||
550 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. | ||
551 | * | ||
552 | ******************************************************************************/ | ||
553 | |||
554 | acpi_status | ||
555 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | ||
556 | union acpi_parse_object **out_op) | ||
557 | { | ||
558 | union acpi_parse_object *op; | ||
559 | struct acpi_namespace_node *node; | ||
560 | acpi_status status; | ||
561 | acpi_object_type object_type; | ||
562 | char *buffer_ptr; | ||
563 | u32 flags; | ||
564 | |||
565 | ACPI_FUNCTION_TRACE(ds_load2_begin_op); | ||
566 | |||
567 | op = walk_state->op; | ||
568 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | ||
569 | walk_state)); | ||
570 | |||
571 | if (op) { | ||
572 | if ((walk_state->control_state) && | ||
573 | (walk_state->control_state->common.state == | ||
574 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | ||
575 | |||
576 | /* We are executing a while loop outside of a method */ | ||
577 | |||
578 | status = acpi_ds_exec_begin_op(walk_state, out_op); | ||
579 | return_ACPI_STATUS(status); | ||
580 | } | ||
581 | |||
582 | /* We only care about Namespace opcodes here */ | ||
583 | |||
584 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && | ||
585 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | ||
586 | (!(walk_state->op_info->flags & AML_NAMED))) { | ||
587 | return_ACPI_STATUS(AE_OK); | ||
588 | } | ||
589 | |||
590 | /* Get the name we are going to enter or lookup in the namespace */ | ||
591 | |||
592 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | ||
593 | |||
594 | /* For Namepath op, get the path string */ | ||
595 | |||
596 | buffer_ptr = op->common.value.string; | ||
597 | if (!buffer_ptr) { | ||
598 | |||
599 | /* No name, just exit */ | ||
600 | |||
601 | return_ACPI_STATUS(AE_OK); | ||
602 | } | ||
603 | } else { | ||
604 | /* Get name from the op */ | ||
605 | |||
606 | buffer_ptr = ACPI_CAST_PTR(char, &op->named.name); | ||
607 | } | ||
608 | } else { | ||
609 | /* Get the namestring from the raw AML */ | ||
610 | |||
611 | buffer_ptr = | ||
612 | acpi_ps_get_next_namestring(&walk_state->parser_state); | ||
613 | } | ||
614 | |||
615 | /* Map the opcode into an internal object type */ | ||
616 | |||
617 | object_type = walk_state->op_info->object_type; | ||
618 | |||
619 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
620 | "State=%p Op=%p Type=%X\n", walk_state, op, | ||
621 | object_type)); | ||
622 | |||
623 | switch (walk_state->opcode) { | ||
624 | case AML_FIELD_OP: | ||
625 | case AML_BANK_FIELD_OP: | ||
626 | case AML_INDEX_FIELD_OP: | ||
627 | |||
628 | node = NULL; | ||
629 | status = AE_OK; | ||
630 | break; | ||
631 | |||
632 | case AML_INT_NAMEPATH_OP: | ||
633 | /* | ||
634 | * The name_path is an object reference to an existing object. | ||
635 | * Don't enter the name into the namespace, but look it up | ||
636 | * for use later. | ||
637 | */ | ||
638 | status = | ||
639 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | ||
640 | object_type, ACPI_IMODE_EXECUTE, | ||
641 | ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | ||
642 | break; | ||
643 | |||
644 | case AML_SCOPE_OP: | ||
645 | |||
646 | /* Special case for Scope(\) -> refers to the Root node */ | ||
647 | |||
648 | if (op && (op->named.node == acpi_gbl_root_node)) { | ||
649 | node = op->named.node; | ||
650 | |||
651 | status = | ||
652 | acpi_ds_scope_stack_push(node, object_type, | ||
653 | walk_state); | ||
654 | if (ACPI_FAILURE(status)) { | ||
655 | return_ACPI_STATUS(status); | ||
656 | } | ||
657 | } else { | ||
658 | /* | ||
659 | * The Path is an object reference to an existing object. | ||
660 | * Don't enter the name into the namespace, but look it up | ||
661 | * for use later. | ||
662 | */ | ||
663 | status = | ||
664 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | ||
665 | object_type, ACPI_IMODE_EXECUTE, | ||
666 | ACPI_NS_SEARCH_PARENT, walk_state, | ||
667 | &(node)); | ||
668 | if (ACPI_FAILURE(status)) { | ||
669 | #ifdef ACPI_ASL_COMPILER | ||
670 | if (status == AE_NOT_FOUND) { | ||
671 | status = AE_OK; | ||
672 | } else { | ||
673 | ACPI_ERROR_NAMESPACE(buffer_ptr, | ||
674 | status); | ||
675 | } | ||
676 | #else | ||
677 | ACPI_ERROR_NAMESPACE(buffer_ptr, status); | ||
678 | #endif | ||
679 | return_ACPI_STATUS(status); | ||
680 | } | ||
681 | } | ||
682 | |||
683 | /* | ||
684 | * We must check to make sure that the target is | ||
685 | * one of the opcodes that actually opens a scope | ||
686 | */ | ||
687 | switch (node->type) { | ||
688 | case ACPI_TYPE_ANY: | ||
689 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ | ||
690 | case ACPI_TYPE_DEVICE: | ||
691 | case ACPI_TYPE_POWER: | ||
692 | case ACPI_TYPE_PROCESSOR: | ||
693 | case ACPI_TYPE_THERMAL: | ||
694 | |||
695 | /* These are acceptable types */ | ||
696 | break; | ||
697 | |||
698 | case ACPI_TYPE_INTEGER: | ||
699 | case ACPI_TYPE_STRING: | ||
700 | case ACPI_TYPE_BUFFER: | ||
701 | |||
702 | /* | ||
703 | * These types we will allow, but we will change the type. | ||
704 | * This enables some existing code of the form: | ||
705 | * | ||
706 | * Name (DEB, 0) | ||
707 | * Scope (DEB) { ... } | ||
708 | */ | ||
709 | ACPI_WARNING((AE_INFO, | ||
710 | "Type override - [%4.4s] had invalid type (%s) " | ||
711 | "for Scope operator, changed to type ANY\n", | ||
712 | acpi_ut_get_node_name(node), | ||
713 | acpi_ut_get_type_name(node->type))); | ||
714 | |||
715 | node->type = ACPI_TYPE_ANY; | ||
716 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | ||
717 | break; | ||
718 | |||
719 | default: | ||
720 | |||
721 | /* All other types are an error */ | ||
722 | |||
723 | ACPI_ERROR((AE_INFO, | ||
724 | "Invalid type (%s) for target of " | ||
725 | "Scope operator [%4.4s] (Cannot override)", | ||
726 | acpi_ut_get_type_name(node->type), | ||
727 | acpi_ut_get_node_name(node))); | ||
728 | |||
729 | return (AE_AML_OPERAND_TYPE); | ||
730 | } | ||
731 | break; | ||
732 | |||
733 | default: | ||
734 | |||
735 | /* All other opcodes */ | ||
736 | |||
737 | if (op && op->common.node) { | ||
738 | |||
739 | /* This op/node was previously entered into the namespace */ | ||
740 | |||
741 | node = op->common.node; | ||
742 | |||
743 | if (acpi_ns_opens_scope(object_type)) { | ||
744 | status = | ||
745 | acpi_ds_scope_stack_push(node, object_type, | ||
746 | walk_state); | ||
747 | if (ACPI_FAILURE(status)) { | ||
748 | return_ACPI_STATUS(status); | ||
749 | } | ||
750 | } | ||
751 | |||
752 | return_ACPI_STATUS(AE_OK); | ||
753 | } | ||
754 | |||
755 | /* | ||
756 | * Enter the named type into the internal namespace. We enter the name | ||
757 | * as we go downward in the parse tree. Any necessary subobjects that | ||
758 | * involve arguments to the opcode must be created as we go back up the | ||
759 | * parse tree later. | ||
760 | * | ||
761 | * Note: Name may already exist if we are executing a deferred opcode. | ||
762 | */ | ||
763 | if (walk_state->deferred_node) { | ||
764 | |||
765 | /* This name is already in the namespace, get the node */ | ||
766 | |||
767 | node = walk_state->deferred_node; | ||
768 | status = AE_OK; | ||
769 | break; | ||
770 | } | ||
771 | |||
772 | flags = ACPI_NS_NO_UPSEARCH; | ||
773 | if (walk_state->pass_number == ACPI_IMODE_EXECUTE) { | ||
774 | |||
775 | /* Execution mode, node cannot already exist, node is temporary */ | ||
776 | |||
777 | flags |= ACPI_NS_ERROR_IF_FOUND; | ||
778 | |||
779 | if (! | ||
780 | (walk_state-> | ||
781 | parse_flags & ACPI_PARSE_MODULE_LEVEL)) { | ||
782 | flags |= ACPI_NS_TEMPORARY; | ||
783 | } | ||
784 | } | ||
785 | |||
786 | /* Add new entry or lookup existing entry */ | ||
787 | |||
788 | status = | ||
789 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | ||
790 | object_type, ACPI_IMODE_LOAD_PASS2, flags, | ||
791 | walk_state, &node); | ||
792 | |||
793 | if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) { | ||
794 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
795 | "***New Node [%4.4s] %p is temporary\n", | ||
796 | acpi_ut_get_node_name(node), node)); | ||
797 | } | ||
798 | break; | ||
799 | } | ||
800 | |||
801 | if (ACPI_FAILURE(status)) { | ||
802 | ACPI_ERROR_NAMESPACE(buffer_ptr, status); | ||
803 | return_ACPI_STATUS(status); | ||
804 | } | ||
805 | |||
806 | if (!op) { | ||
807 | |||
808 | /* Create a new op */ | ||
809 | |||
810 | op = acpi_ps_alloc_op(walk_state->opcode); | ||
811 | if (!op) { | ||
812 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
813 | } | ||
814 | |||
815 | /* Initialize the new op */ | ||
816 | |||
817 | if (node) { | ||
818 | op->named.name = node->name.integer; | ||
819 | } | ||
820 | *out_op = op; | ||
821 | } | ||
822 | |||
823 | /* | ||
824 | * Put the Node in the "op" object that the parser uses, so we | ||
825 | * can get it again quickly when this scope is closed | ||
826 | */ | ||
827 | op->common.node = node; | ||
828 | return_ACPI_STATUS(status); | ||
829 | } | ||
830 | |||
831 | /******************************************************************************* | ||
832 | * | ||
833 | * FUNCTION: acpi_ds_load2_end_op | ||
834 | * | ||
835 | * PARAMETERS: walk_state - Current state of the parse tree walk | ||
836 | * | ||
837 | * RETURN: Status | ||
838 | * | ||
839 | * DESCRIPTION: Ascending callback used during the loading of the namespace, | ||
840 | * both control methods and everything else. | ||
841 | * | ||
842 | ******************************************************************************/ | ||
843 | |||
844 | acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | ||
845 | { | ||
846 | union acpi_parse_object *op; | ||
847 | acpi_status status = AE_OK; | ||
848 | acpi_object_type object_type; | ||
849 | struct acpi_namespace_node *node; | ||
850 | union acpi_parse_object *arg; | ||
851 | struct acpi_namespace_node *new_node; | ||
852 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
853 | u32 i; | ||
854 | u8 region_space; | ||
855 | #endif | ||
856 | |||
857 | ACPI_FUNCTION_TRACE(ds_load2_end_op); | ||
858 | |||
859 | op = walk_state->op; | ||
860 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | ||
861 | walk_state->op_info->name, op, walk_state)); | ||
862 | |||
863 | /* Check if opcode had an associated namespace object */ | ||
864 | |||
865 | if (!(walk_state->op_info->flags & AML_NSOBJECT)) { | ||
866 | return_ACPI_STATUS(AE_OK); | ||
867 | } | ||
868 | |||
869 | if (op->common.aml_opcode == AML_SCOPE_OP) { | ||
870 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
871 | "Ending scope Op=%p State=%p\n", op, | ||
872 | walk_state)); | ||
873 | } | ||
874 | |||
875 | object_type = walk_state->op_info->object_type; | ||
876 | |||
877 | /* | ||
878 | * Get the Node/name from the earlier lookup | ||
879 | * (It was saved in the *op structure) | ||
880 | */ | ||
881 | node = op->common.node; | ||
882 | |||
883 | /* | ||
884 | * Put the Node on the object stack (Contains the ACPI Name of | ||
885 | * this object) | ||
886 | */ | ||
887 | walk_state->operands[0] = (void *)node; | ||
888 | walk_state->num_operands = 1; | ||
889 | |||
890 | /* Pop the scope stack */ | ||
891 | |||
892 | if (acpi_ns_opens_scope(object_type) && | ||
893 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | ||
894 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
895 | "(%s) Popping scope for Op %p\n", | ||
896 | acpi_ut_get_type_name(object_type), op)); | ||
897 | |||
898 | status = acpi_ds_scope_stack_pop(walk_state); | ||
899 | if (ACPI_FAILURE(status)) { | ||
900 | goto cleanup; | ||
901 | } | ||
902 | } | ||
903 | |||
904 | /* | ||
905 | * Named operations are as follows: | ||
906 | * | ||
907 | * AML_ALIAS | ||
908 | * AML_BANKFIELD | ||
909 | * AML_CREATEBITFIELD | ||
910 | * AML_CREATEBYTEFIELD | ||
911 | * AML_CREATEDWORDFIELD | ||
912 | * AML_CREATEFIELD | ||
913 | * AML_CREATEQWORDFIELD | ||
914 | * AML_CREATEWORDFIELD | ||
915 | * AML_DATA_REGION | ||
916 | * AML_DEVICE | ||
917 | * AML_EVENT | ||
918 | * AML_FIELD | ||
919 | * AML_INDEXFIELD | ||
920 | * AML_METHOD | ||
921 | * AML_METHODCALL | ||
922 | * AML_MUTEX | ||
923 | * AML_NAME | ||
924 | * AML_NAMEDFIELD | ||
925 | * AML_OPREGION | ||
926 | * AML_POWERRES | ||
927 | * AML_PROCESSOR | ||
928 | * AML_SCOPE | ||
929 | * AML_THERMALZONE | ||
930 | */ | ||
931 | |||
932 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
933 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", | ||
934 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
935 | walk_state, op, node)); | ||
936 | |||
937 | /* Decode the opcode */ | ||
938 | |||
939 | arg = op->common.value.arg; | ||
940 | |||
941 | switch (walk_state->op_info->type) { | ||
942 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
943 | |||
944 | case AML_TYPE_CREATE_FIELD: | ||
945 | /* | ||
946 | * Create the field object, but the field buffer and index must | ||
947 | * be evaluated later during the execution phase | ||
948 | */ | ||
949 | status = acpi_ds_create_buffer_field(op, walk_state); | ||
950 | break; | ||
951 | |||
952 | case AML_TYPE_NAMED_FIELD: | ||
953 | /* | ||
954 | * If we are executing a method, initialize the field | ||
955 | */ | ||
956 | if (walk_state->method_node) { | ||
957 | status = acpi_ds_init_field_objects(op, walk_state); | ||
958 | } | ||
959 | |||
960 | switch (op->common.aml_opcode) { | ||
961 | case AML_INDEX_FIELD_OP: | ||
962 | |||
963 | status = | ||
964 | acpi_ds_create_index_field(op, | ||
965 | (acpi_handle) arg-> | ||
966 | common.node, walk_state); | ||
967 | break; | ||
968 | |||
969 | case AML_BANK_FIELD_OP: | ||
970 | |||
971 | status = | ||
972 | acpi_ds_create_bank_field(op, arg->common.node, | ||
973 | walk_state); | ||
974 | break; | ||
975 | |||
976 | case AML_FIELD_OP: | ||
977 | |||
978 | status = | ||
979 | acpi_ds_create_field(op, arg->common.node, | ||
980 | walk_state); | ||
981 | break; | ||
982 | |||
983 | default: | ||
984 | /* All NAMED_FIELD opcodes must be handled above */ | ||
985 | break; | ||
986 | } | ||
987 | break; | ||
988 | |||
989 | case AML_TYPE_NAMED_SIMPLE: | ||
990 | |||
991 | status = acpi_ds_create_operands(walk_state, arg); | ||
992 | if (ACPI_FAILURE(status)) { | ||
993 | goto cleanup; | ||
994 | } | ||
995 | |||
996 | switch (op->common.aml_opcode) { | ||
997 | case AML_PROCESSOR_OP: | ||
998 | |||
999 | status = acpi_ex_create_processor(walk_state); | ||
1000 | break; | ||
1001 | |||
1002 | case AML_POWER_RES_OP: | ||
1003 | |||
1004 | status = acpi_ex_create_power_resource(walk_state); | ||
1005 | break; | ||
1006 | |||
1007 | case AML_MUTEX_OP: | ||
1008 | |||
1009 | status = acpi_ex_create_mutex(walk_state); | ||
1010 | break; | ||
1011 | |||
1012 | case AML_EVENT_OP: | ||
1013 | |||
1014 | status = acpi_ex_create_event(walk_state); | ||
1015 | break; | ||
1016 | |||
1017 | case AML_ALIAS_OP: | ||
1018 | |||
1019 | status = acpi_ex_create_alias(walk_state); | ||
1020 | break; | ||
1021 | |||
1022 | default: | ||
1023 | /* Unknown opcode */ | ||
1024 | |||
1025 | status = AE_OK; | ||
1026 | goto cleanup; | ||
1027 | } | ||
1028 | |||
1029 | /* Delete operands */ | ||
1030 | |||
1031 | for (i = 1; i < walk_state->num_operands; i++) { | ||
1032 | acpi_ut_remove_reference(walk_state->operands[i]); | ||
1033 | walk_state->operands[i] = NULL; | ||
1034 | } | ||
1035 | |||
1036 | break; | ||
1037 | #endif /* ACPI_NO_METHOD_EXECUTION */ | ||
1038 | |||
1039 | case AML_TYPE_NAMED_COMPLEX: | ||
1040 | |||
1041 | switch (op->common.aml_opcode) { | ||
1042 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
1043 | case AML_REGION_OP: | ||
1044 | case AML_DATA_REGION_OP: | ||
1045 | |||
1046 | if (op->common.aml_opcode == AML_REGION_OP) { | ||
1047 | region_space = (acpi_adr_space_type) | ||
1048 | ((op->common.value.arg)->common.value. | ||
1049 | integer); | ||
1050 | } else { | ||
1051 | region_space = REGION_DATA_TABLE; | ||
1052 | } | ||
1053 | |||
1054 | /* | ||
1055 | * The op_region is not fully parsed at this time. The only valid | ||
1056 | * argument is the space_id. (We must save the address of the | ||
1057 | * AML of the address and length operands) | ||
1058 | * | ||
1059 | * If we have a valid region, initialize it. The namespace is | ||
1060 | * unlocked at this point. | ||
1061 | * | ||
1062 | * Need to unlock interpreter if it is locked (if we are running | ||
1063 | * a control method), in order to allow _REG methods to be run | ||
1064 | * during acpi_ev_initialize_region. | ||
1065 | */ | ||
1066 | if (walk_state->method_node) { | ||
1067 | /* | ||
1068 | * Executing a method: initialize the region and unlock | ||
1069 | * the interpreter | ||
1070 | */ | ||
1071 | status = | ||
1072 | acpi_ex_create_region(op->named.data, | ||
1073 | op->named.length, | ||
1074 | region_space, | ||
1075 | walk_state); | ||
1076 | if (ACPI_FAILURE(status)) { | ||
1077 | return (status); | ||
1078 | } | ||
1079 | |||
1080 | acpi_ex_exit_interpreter(); | ||
1081 | } | ||
1082 | |||
1083 | status = | ||
1084 | acpi_ev_initialize_region | ||
1085 | (acpi_ns_get_attached_object(node), FALSE); | ||
1086 | if (walk_state->method_node) { | ||
1087 | acpi_ex_enter_interpreter(); | ||
1088 | } | ||
1089 | |||
1090 | if (ACPI_FAILURE(status)) { | ||
1091 | /* | ||
1092 | * If AE_NOT_EXIST is returned, it is not fatal | ||
1093 | * because many regions get created before a handler | ||
1094 | * is installed for said region. | ||
1095 | */ | ||
1096 | if (AE_NOT_EXIST == status) { | ||
1097 | status = AE_OK; | ||
1098 | } | ||
1099 | } | ||
1100 | break; | ||
1101 | |||
1102 | case AML_NAME_OP: | ||
1103 | |||
1104 | status = acpi_ds_create_node(walk_state, node, op); | ||
1105 | break; | ||
1106 | |||
1107 | case AML_METHOD_OP: | ||
1108 | /* | ||
1109 | * method_op pkg_length name_string method_flags term_list | ||
1110 | * | ||
1111 | * Note: We must create the method node/object pair as soon as we | ||
1112 | * see the method declaration. This allows later pass1 parsing | ||
1113 | * of invocations of the method (need to know the number of | ||
1114 | * arguments.) | ||
1115 | */ | ||
1116 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1117 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", | ||
1118 | walk_state, op, op->named.node)); | ||
1119 | |||
1120 | if (!acpi_ns_get_attached_object(op->named.node)) { | ||
1121 | walk_state->operands[0] = | ||
1122 | ACPI_CAST_PTR(void, op->named.node); | ||
1123 | walk_state->num_operands = 1; | ||
1124 | |||
1125 | status = | ||
1126 | acpi_ds_create_operands(walk_state, | ||
1127 | op->common.value. | ||
1128 | arg); | ||
1129 | if (ACPI_SUCCESS(status)) { | ||
1130 | status = | ||
1131 | acpi_ex_create_method(op->named. | ||
1132 | data, | ||
1133 | op->named. | ||
1134 | length, | ||
1135 | walk_state); | ||
1136 | } | ||
1137 | walk_state->operands[0] = NULL; | ||
1138 | walk_state->num_operands = 0; | ||
1139 | |||
1140 | if (ACPI_FAILURE(status)) { | ||
1141 | return_ACPI_STATUS(status); | ||
1142 | } | ||
1143 | } | ||
1144 | break; | ||
1145 | |||
1146 | #endif /* ACPI_NO_METHOD_EXECUTION */ | ||
1147 | |||
1148 | default: | ||
1149 | /* All NAMED_COMPLEX opcodes must be handled above */ | ||
1150 | break; | ||
1151 | } | ||
1152 | break; | ||
1153 | |||
1154 | case AML_CLASS_INTERNAL: | ||
1155 | |||
1156 | /* case AML_INT_NAMEPATH_OP: */ | ||
1157 | break; | ||
1158 | |||
1159 | case AML_CLASS_METHOD_CALL: | ||
1160 | |||
1161 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
1162 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", | ||
1163 | walk_state, op, node)); | ||
1164 | |||
1165 | /* | ||
1166 | * Lookup the method name and save the Node | ||
1167 | */ | ||
1168 | status = | ||
1169 | acpi_ns_lookup(walk_state->scope_info, | ||
1170 | arg->common.value.string, ACPI_TYPE_ANY, | ||
1171 | ACPI_IMODE_LOAD_PASS2, | ||
1172 | ACPI_NS_SEARCH_PARENT | | ||
1173 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | ||
1174 | &(new_node)); | ||
1175 | if (ACPI_SUCCESS(status)) { | ||
1176 | /* | ||
1177 | * Make sure that what we found is indeed a method | ||
1178 | * We didn't search for a method on purpose, to see if the name | ||
1179 | * would resolve | ||
1180 | */ | ||
1181 | if (new_node->type != ACPI_TYPE_METHOD) { | ||
1182 | status = AE_AML_OPERAND_TYPE; | ||
1183 | } | ||
1184 | |||
1185 | /* We could put the returned object (Node) on the object stack for | ||
1186 | * later, but for now, we will put it in the "op" object that the | ||
1187 | * parser uses, so we can get it again at the end of this scope | ||
1188 | */ | ||
1189 | op->common.node = new_node; | ||
1190 | } else { | ||
1191 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | ||
1192 | } | ||
1193 | break; | ||
1194 | |||
1195 | default: | ||
1196 | break; | ||
1197 | } | ||
1198 | |||
1199 | cleanup: | ||
1200 | |||
1201 | /* Remove the Node pushed at the very beginning */ | ||
1202 | |||
1203 | walk_state->operands[0] = NULL; | ||
1204 | walk_state->num_operands = 0; | ||
1205 | return_ACPI_STATUS(status); | ||
1206 | } | ||
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c new file mode 100644 index 000000000000..4be4e921dfe1 --- /dev/null +++ b/drivers/acpi/acpica/dswload2.c | |||
@@ -0,0 +1,720 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: dswload2 - Dispatcher second pass namespace load callbacks | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2011, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acparser.h" | ||
47 | #include "amlcode.h" | ||
48 | #include "acdispat.h" | ||
49 | #include "acinterp.h" | ||
50 | #include "acnamesp.h" | ||
51 | #include "acevents.h" | ||
52 | |||
53 | #define _COMPONENT ACPI_DISPATCHER | ||
54 | ACPI_MODULE_NAME("dswload2") | ||
55 | |||
56 | /******************************************************************************* | ||
57 | * | ||
58 | * FUNCTION: acpi_ds_load2_begin_op | ||
59 | * | ||
60 | * PARAMETERS: walk_state - Current state of the parse tree walk | ||
61 | * out_op - Wher to return op if a new one is created | ||
62 | * | ||
63 | * RETURN: Status | ||
64 | * | ||
65 | * DESCRIPTION: Descending callback used during the loading of ACPI tables. | ||
66 | * | ||
67 | ******************************************************************************/ | ||
68 | acpi_status | ||
69 | acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state, | ||
70 | union acpi_parse_object **out_op) | ||
71 | { | ||
72 | union acpi_parse_object *op; | ||
73 | struct acpi_namespace_node *node; | ||
74 | acpi_status status; | ||
75 | acpi_object_type object_type; | ||
76 | char *buffer_ptr; | ||
77 | u32 flags; | ||
78 | |||
79 | ACPI_FUNCTION_TRACE(ds_load2_begin_op); | ||
80 | |||
81 | op = walk_state->op; | ||
82 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, | ||
83 | walk_state)); | ||
84 | |||
85 | if (op) { | ||
86 | if ((walk_state->control_state) && | ||
87 | (walk_state->control_state->common.state == | ||
88 | ACPI_CONTROL_CONDITIONAL_EXECUTING)) { | ||
89 | |||
90 | /* We are executing a while loop outside of a method */ | ||
91 | |||
92 | status = acpi_ds_exec_begin_op(walk_state, out_op); | ||
93 | return_ACPI_STATUS(status); | ||
94 | } | ||
95 | |||
96 | /* We only care about Namespace opcodes here */ | ||
97 | |||
98 | if ((!(walk_state->op_info->flags & AML_NSOPCODE) && | ||
99 | (walk_state->opcode != AML_INT_NAMEPATH_OP)) || | ||
100 | (!(walk_state->op_info->flags & AML_NAMED))) { | ||
101 | return_ACPI_STATUS(AE_OK); | ||
102 | } | ||
103 | |||
104 | /* Get the name we are going to enter or lookup in the namespace */ | ||
105 | |||
106 | if (walk_state->opcode == AML_INT_NAMEPATH_OP) { | ||
107 | |||
108 | /* For Namepath op, get the path string */ | ||
109 | |||
110 | buffer_ptr = op->common.value.string; | ||
111 | if (!buffer_ptr) { | ||
112 | |||
113 | /* No name, just exit */ | ||
114 | |||
115 | return_ACPI_STATUS(AE_OK); | ||
116 | } | ||
117 | } else { | ||
118 | /* Get name from the op */ | ||
119 | |||
120 | buffer_ptr = ACPI_CAST_PTR(char, &op->named.name); | ||
121 | } | ||
122 | } else { | ||
123 | /* Get the namestring from the raw AML */ | ||
124 | |||
125 | buffer_ptr = | ||
126 | acpi_ps_get_next_namestring(&walk_state->parser_state); | ||
127 | } | ||
128 | |||
129 | /* Map the opcode into an internal object type */ | ||
130 | |||
131 | object_type = walk_state->op_info->object_type; | ||
132 | |||
133 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
134 | "State=%p Op=%p Type=%X\n", walk_state, op, | ||
135 | object_type)); | ||
136 | |||
137 | switch (walk_state->opcode) { | ||
138 | case AML_FIELD_OP: | ||
139 | case AML_BANK_FIELD_OP: | ||
140 | case AML_INDEX_FIELD_OP: | ||
141 | |||
142 | node = NULL; | ||
143 | status = AE_OK; | ||
144 | break; | ||
145 | |||
146 | case AML_INT_NAMEPATH_OP: | ||
147 | /* | ||
148 | * The name_path is an object reference to an existing object. | ||
149 | * Don't enter the name into the namespace, but look it up | ||
150 | * for use later. | ||
151 | */ | ||
152 | status = | ||
153 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | ||
154 | object_type, ACPI_IMODE_EXECUTE, | ||
155 | ACPI_NS_SEARCH_PARENT, walk_state, &(node)); | ||
156 | break; | ||
157 | |||
158 | case AML_SCOPE_OP: | ||
159 | |||
160 | /* Special case for Scope(\) -> refers to the Root node */ | ||
161 | |||
162 | if (op && (op->named.node == acpi_gbl_root_node)) { | ||
163 | node = op->named.node; | ||
164 | |||
165 | status = | ||
166 | acpi_ds_scope_stack_push(node, object_type, | ||
167 | walk_state); | ||
168 | if (ACPI_FAILURE(status)) { | ||
169 | return_ACPI_STATUS(status); | ||
170 | } | ||
171 | } else { | ||
172 | /* | ||
173 | * The Path is an object reference to an existing object. | ||
174 | * Don't enter the name into the namespace, but look it up | ||
175 | * for use later. | ||
176 | */ | ||
177 | status = | ||
178 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | ||
179 | object_type, ACPI_IMODE_EXECUTE, | ||
180 | ACPI_NS_SEARCH_PARENT, walk_state, | ||
181 | &(node)); | ||
182 | if (ACPI_FAILURE(status)) { | ||
183 | #ifdef ACPI_ASL_COMPILER | ||
184 | if (status == AE_NOT_FOUND) { | ||
185 | status = AE_OK; | ||
186 | } else { | ||
187 | ACPI_ERROR_NAMESPACE(buffer_ptr, | ||
188 | status); | ||
189 | } | ||
190 | #else | ||
191 | ACPI_ERROR_NAMESPACE(buffer_ptr, status); | ||
192 | #endif | ||
193 | return_ACPI_STATUS(status); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | /* | ||
198 | * We must check to make sure that the target is | ||
199 | * one of the opcodes that actually opens a scope | ||
200 | */ | ||
201 | switch (node->type) { | ||
202 | case ACPI_TYPE_ANY: | ||
203 | case ACPI_TYPE_LOCAL_SCOPE: /* Scope */ | ||
204 | case ACPI_TYPE_DEVICE: | ||
205 | case ACPI_TYPE_POWER: | ||
206 | case ACPI_TYPE_PROCESSOR: | ||
207 | case ACPI_TYPE_THERMAL: | ||
208 | |||
209 | /* These are acceptable types */ | ||
210 | break; | ||
211 | |||
212 | case ACPI_TYPE_INTEGER: | ||
213 | case ACPI_TYPE_STRING: | ||
214 | case ACPI_TYPE_BUFFER: | ||
215 | |||
216 | /* | ||
217 | * These types we will allow, but we will change the type. | ||
218 | * This enables some existing code of the form: | ||
219 | * | ||
220 | * Name (DEB, 0) | ||
221 | * Scope (DEB) { ... } | ||
222 | */ | ||
223 | ACPI_WARNING((AE_INFO, | ||
224 | "Type override - [%4.4s] had invalid type (%s) " | ||
225 | "for Scope operator, changed to type ANY\n", | ||
226 | acpi_ut_get_node_name(node), | ||
227 | acpi_ut_get_type_name(node->type))); | ||
228 | |||
229 | node->type = ACPI_TYPE_ANY; | ||
230 | walk_state->scope_info->common.value = ACPI_TYPE_ANY; | ||
231 | break; | ||
232 | |||
233 | default: | ||
234 | |||
235 | /* All other types are an error */ | ||
236 | |||
237 | ACPI_ERROR((AE_INFO, | ||
238 | "Invalid type (%s) for target of " | ||
239 | "Scope operator [%4.4s] (Cannot override)", | ||
240 | acpi_ut_get_type_name(node->type), | ||
241 | acpi_ut_get_node_name(node))); | ||
242 | |||
243 | return (AE_AML_OPERAND_TYPE); | ||
244 | } | ||
245 | break; | ||
246 | |||
247 | default: | ||
248 | |||
249 | /* All other opcodes */ | ||
250 | |||
251 | if (op && op->common.node) { | ||
252 | |||
253 | /* This op/node was previously entered into the namespace */ | ||
254 | |||
255 | node = op->common.node; | ||
256 | |||
257 | if (acpi_ns_opens_scope(object_type)) { | ||
258 | status = | ||
259 | acpi_ds_scope_stack_push(node, object_type, | ||
260 | walk_state); | ||
261 | if (ACPI_FAILURE(status)) { | ||
262 | return_ACPI_STATUS(status); | ||
263 | } | ||
264 | } | ||
265 | |||
266 | return_ACPI_STATUS(AE_OK); | ||
267 | } | ||
268 | |||
269 | /* | ||
270 | * Enter the named type into the internal namespace. We enter the name | ||
271 | * as we go downward in the parse tree. Any necessary subobjects that | ||
272 | * involve arguments to the opcode must be created as we go back up the | ||
273 | * parse tree later. | ||
274 | * | ||
275 | * Note: Name may already exist if we are executing a deferred opcode. | ||
276 | */ | ||
277 | if (walk_state->deferred_node) { | ||
278 | |||
279 | /* This name is already in the namespace, get the node */ | ||
280 | |||
281 | node = walk_state->deferred_node; | ||
282 | status = AE_OK; | ||
283 | break; | ||
284 | } | ||
285 | |||
286 | flags = ACPI_NS_NO_UPSEARCH; | ||
287 | if (walk_state->pass_number == ACPI_IMODE_EXECUTE) { | ||
288 | |||
289 | /* Execution mode, node cannot already exist, node is temporary */ | ||
290 | |||
291 | flags |= ACPI_NS_ERROR_IF_FOUND; | ||
292 | |||
293 | if (! | ||
294 | (walk_state-> | ||
295 | parse_flags & ACPI_PARSE_MODULE_LEVEL)) { | ||
296 | flags |= ACPI_NS_TEMPORARY; | ||
297 | } | ||
298 | } | ||
299 | |||
300 | /* Add new entry or lookup existing entry */ | ||
301 | |||
302 | status = | ||
303 | acpi_ns_lookup(walk_state->scope_info, buffer_ptr, | ||
304 | object_type, ACPI_IMODE_LOAD_PASS2, flags, | ||
305 | walk_state, &node); | ||
306 | |||
307 | if (ACPI_SUCCESS(status) && (flags & ACPI_NS_TEMPORARY)) { | ||
308 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
309 | "***New Node [%4.4s] %p is temporary\n", | ||
310 | acpi_ut_get_node_name(node), node)); | ||
311 | } | ||
312 | break; | ||
313 | } | ||
314 | |||
315 | if (ACPI_FAILURE(status)) { | ||
316 | ACPI_ERROR_NAMESPACE(buffer_ptr, status); | ||
317 | return_ACPI_STATUS(status); | ||
318 | } | ||
319 | |||
320 | if (!op) { | ||
321 | |||
322 | /* Create a new op */ | ||
323 | |||
324 | op = acpi_ps_alloc_op(walk_state->opcode); | ||
325 | if (!op) { | ||
326 | return_ACPI_STATUS(AE_NO_MEMORY); | ||
327 | } | ||
328 | |||
329 | /* Initialize the new op */ | ||
330 | |||
331 | if (node) { | ||
332 | op->named.name = node->name.integer; | ||
333 | } | ||
334 | *out_op = op; | ||
335 | } | ||
336 | |||
337 | /* | ||
338 | * Put the Node in the "op" object that the parser uses, so we | ||
339 | * can get it again quickly when this scope is closed | ||
340 | */ | ||
341 | op->common.node = node; | ||
342 | return_ACPI_STATUS(status); | ||
343 | } | ||
344 | |||
345 | /******************************************************************************* | ||
346 | * | ||
347 | * FUNCTION: acpi_ds_load2_end_op | ||
348 | * | ||
349 | * PARAMETERS: walk_state - Current state of the parse tree walk | ||
350 | * | ||
351 | * RETURN: Status | ||
352 | * | ||
353 | * DESCRIPTION: Ascending callback used during the loading of the namespace, | ||
354 | * both control methods and everything else. | ||
355 | * | ||
356 | ******************************************************************************/ | ||
357 | |||
358 | acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) | ||
359 | { | ||
360 | union acpi_parse_object *op; | ||
361 | acpi_status status = AE_OK; | ||
362 | acpi_object_type object_type; | ||
363 | struct acpi_namespace_node *node; | ||
364 | union acpi_parse_object *arg; | ||
365 | struct acpi_namespace_node *new_node; | ||
366 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
367 | u32 i; | ||
368 | u8 region_space; | ||
369 | #endif | ||
370 | |||
371 | ACPI_FUNCTION_TRACE(ds_load2_end_op); | ||
372 | |||
373 | op = walk_state->op; | ||
374 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n", | ||
375 | walk_state->op_info->name, op, walk_state)); | ||
376 | |||
377 | /* Check if opcode had an associated namespace object */ | ||
378 | |||
379 | if (!(walk_state->op_info->flags & AML_NSOBJECT)) { | ||
380 | return_ACPI_STATUS(AE_OK); | ||
381 | } | ||
382 | |||
383 | if (op->common.aml_opcode == AML_SCOPE_OP) { | ||
384 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
385 | "Ending scope Op=%p State=%p\n", op, | ||
386 | walk_state)); | ||
387 | } | ||
388 | |||
389 | object_type = walk_state->op_info->object_type; | ||
390 | |||
391 | /* | ||
392 | * Get the Node/name from the earlier lookup | ||
393 | * (It was saved in the *op structure) | ||
394 | */ | ||
395 | node = op->common.node; | ||
396 | |||
397 | /* | ||
398 | * Put the Node on the object stack (Contains the ACPI Name of | ||
399 | * this object) | ||
400 | */ | ||
401 | walk_state->operands[0] = (void *)node; | ||
402 | walk_state->num_operands = 1; | ||
403 | |||
404 | /* Pop the scope stack */ | ||
405 | |||
406 | if (acpi_ns_opens_scope(object_type) && | ||
407 | (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { | ||
408 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
409 | "(%s) Popping scope for Op %p\n", | ||
410 | acpi_ut_get_type_name(object_type), op)); | ||
411 | |||
412 | status = acpi_ds_scope_stack_pop(walk_state); | ||
413 | if (ACPI_FAILURE(status)) { | ||
414 | goto cleanup; | ||
415 | } | ||
416 | } | ||
417 | |||
418 | /* | ||
419 | * Named operations are as follows: | ||
420 | * | ||
421 | * AML_ALIAS | ||
422 | * AML_BANKFIELD | ||
423 | * AML_CREATEBITFIELD | ||
424 | * AML_CREATEBYTEFIELD | ||
425 | * AML_CREATEDWORDFIELD | ||
426 | * AML_CREATEFIELD | ||
427 | * AML_CREATEQWORDFIELD | ||
428 | * AML_CREATEWORDFIELD | ||
429 | * AML_DATA_REGION | ||
430 | * AML_DEVICE | ||
431 | * AML_EVENT | ||
432 | * AML_FIELD | ||
433 | * AML_INDEXFIELD | ||
434 | * AML_METHOD | ||
435 | * AML_METHODCALL | ||
436 | * AML_MUTEX | ||
437 | * AML_NAME | ||
438 | * AML_NAMEDFIELD | ||
439 | * AML_OPREGION | ||
440 | * AML_POWERRES | ||
441 | * AML_PROCESSOR | ||
442 | * AML_SCOPE | ||
443 | * AML_THERMALZONE | ||
444 | */ | ||
445 | |||
446 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
447 | "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", | ||
448 | acpi_ps_get_opcode_name(op->common.aml_opcode), | ||
449 | walk_state, op, node)); | ||
450 | |||
451 | /* Decode the opcode */ | ||
452 | |||
453 | arg = op->common.value.arg; | ||
454 | |||
455 | switch (walk_state->op_info->type) { | ||
456 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
457 | |||
458 | case AML_TYPE_CREATE_FIELD: | ||
459 | /* | ||
460 | * Create the field object, but the field buffer and index must | ||
461 | * be evaluated later during the execution phase | ||
462 | */ | ||
463 | status = acpi_ds_create_buffer_field(op, walk_state); | ||
464 | break; | ||
465 | |||
466 | case AML_TYPE_NAMED_FIELD: | ||
467 | /* | ||
468 | * If we are executing a method, initialize the field | ||
469 | */ | ||
470 | if (walk_state->method_node) { | ||
471 | status = acpi_ds_init_field_objects(op, walk_state); | ||
472 | } | ||
473 | |||
474 | switch (op->common.aml_opcode) { | ||
475 | case AML_INDEX_FIELD_OP: | ||
476 | |||
477 | status = | ||
478 | acpi_ds_create_index_field(op, | ||
479 | (acpi_handle) arg-> | ||
480 | common.node, walk_state); | ||
481 | break; | ||
482 | |||
483 | case AML_BANK_FIELD_OP: | ||
484 | |||
485 | status = | ||
486 | acpi_ds_create_bank_field(op, arg->common.node, | ||
487 | walk_state); | ||
488 | break; | ||
489 | |||
490 | case AML_FIELD_OP: | ||
491 | |||
492 | status = | ||
493 | acpi_ds_create_field(op, arg->common.node, | ||
494 | walk_state); | ||
495 | break; | ||
496 | |||
497 | default: | ||
498 | /* All NAMED_FIELD opcodes must be handled above */ | ||
499 | break; | ||
500 | } | ||
501 | break; | ||
502 | |||
503 | case AML_TYPE_NAMED_SIMPLE: | ||
504 | |||
505 | status = acpi_ds_create_operands(walk_state, arg); | ||
506 | if (ACPI_FAILURE(status)) { | ||
507 | goto cleanup; | ||
508 | } | ||
509 | |||
510 | switch (op->common.aml_opcode) { | ||
511 | case AML_PROCESSOR_OP: | ||
512 | |||
513 | status = acpi_ex_create_processor(walk_state); | ||
514 | break; | ||
515 | |||
516 | case AML_POWER_RES_OP: | ||
517 | |||
518 | status = acpi_ex_create_power_resource(walk_state); | ||
519 | break; | ||
520 | |||
521 | case AML_MUTEX_OP: | ||
522 | |||
523 | status = acpi_ex_create_mutex(walk_state); | ||
524 | break; | ||
525 | |||
526 | case AML_EVENT_OP: | ||
527 | |||
528 | status = acpi_ex_create_event(walk_state); | ||
529 | break; | ||
530 | |||
531 | case AML_ALIAS_OP: | ||
532 | |||
533 | status = acpi_ex_create_alias(walk_state); | ||
534 | break; | ||
535 | |||
536 | default: | ||
537 | /* Unknown opcode */ | ||
538 | |||
539 | status = AE_OK; | ||
540 | goto cleanup; | ||
541 | } | ||
542 | |||
543 | /* Delete operands */ | ||
544 | |||
545 | for (i = 1; i < walk_state->num_operands; i++) { | ||
546 | acpi_ut_remove_reference(walk_state->operands[i]); | ||
547 | walk_state->operands[i] = NULL; | ||
548 | } | ||
549 | |||
550 | break; | ||
551 | #endif /* ACPI_NO_METHOD_EXECUTION */ | ||
552 | |||
553 | case AML_TYPE_NAMED_COMPLEX: | ||
554 | |||
555 | switch (op->common.aml_opcode) { | ||
556 | #ifndef ACPI_NO_METHOD_EXECUTION | ||
557 | case AML_REGION_OP: | ||
558 | case AML_DATA_REGION_OP: | ||
559 | |||
560 | if (op->common.aml_opcode == AML_REGION_OP) { | ||
561 | region_space = (acpi_adr_space_type) | ||
562 | ((op->common.value.arg)->common.value. | ||
563 | integer); | ||
564 | } else { | ||
565 | region_space = REGION_DATA_TABLE; | ||
566 | } | ||
567 | |||
568 | /* | ||
569 | * The op_region is not fully parsed at this time. The only valid | ||
570 | * argument is the space_id. (We must save the address of the | ||
571 | * AML of the address and length operands) | ||
572 | * | ||
573 | * If we have a valid region, initialize it. The namespace is | ||
574 | * unlocked at this point. | ||
575 | * | ||
576 | * Need to unlock interpreter if it is locked (if we are running | ||
577 | * a control method), in order to allow _REG methods to be run | ||
578 | * during acpi_ev_initialize_region. | ||
579 | */ | ||
580 | if (walk_state->method_node) { | ||
581 | /* | ||
582 | * Executing a method: initialize the region and unlock | ||
583 | * the interpreter | ||
584 | */ | ||
585 | status = | ||
586 | acpi_ex_create_region(op->named.data, | ||
587 | op->named.length, | ||
588 | region_space, | ||
589 | walk_state); | ||
590 | if (ACPI_FAILURE(status)) { | ||
591 | return (status); | ||
592 | } | ||
593 | |||
594 | acpi_ex_exit_interpreter(); | ||
595 | } | ||
596 | |||
597 | status = | ||
598 | acpi_ev_initialize_region | ||
599 | (acpi_ns_get_attached_object(node), FALSE); | ||
600 | if (walk_state->method_node) { | ||
601 | acpi_ex_enter_interpreter(); | ||
602 | } | ||
603 | |||
604 | if (ACPI_FAILURE(status)) { | ||
605 | /* | ||
606 | * If AE_NOT_EXIST is returned, it is not fatal | ||
607 | * because many regions get created before a handler | ||
608 | * is installed for said region. | ||
609 | */ | ||
610 | if (AE_NOT_EXIST == status) { | ||
611 | status = AE_OK; | ||
612 | } | ||
613 | } | ||
614 | break; | ||
615 | |||
616 | case AML_NAME_OP: | ||
617 | |||
618 | status = acpi_ds_create_node(walk_state, node, op); | ||
619 | break; | ||
620 | |||
621 | case AML_METHOD_OP: | ||
622 | /* | ||
623 | * method_op pkg_length name_string method_flags term_list | ||
624 | * | ||
625 | * Note: We must create the method node/object pair as soon as we | ||
626 | * see the method declaration. This allows later pass1 parsing | ||
627 | * of invocations of the method (need to know the number of | ||
628 | * arguments.) | ||
629 | */ | ||
630 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
631 | "LOADING-Method: State=%p Op=%p NamedObj=%p\n", | ||
632 | walk_state, op, op->named.node)); | ||
633 | |||
634 | if (!acpi_ns_get_attached_object(op->named.node)) { | ||
635 | walk_state->operands[0] = | ||
636 | ACPI_CAST_PTR(void, op->named.node); | ||
637 | walk_state->num_operands = 1; | ||
638 | |||
639 | status = | ||
640 | acpi_ds_create_operands(walk_state, | ||
641 | op->common.value. | ||
642 | arg); | ||
643 | if (ACPI_SUCCESS(status)) { | ||
644 | status = | ||
645 | acpi_ex_create_method(op->named. | ||
646 | data, | ||
647 | op->named. | ||
648 | length, | ||
649 | walk_state); | ||
650 | } | ||
651 | walk_state->operands[0] = NULL; | ||
652 | walk_state->num_operands = 0; | ||
653 | |||
654 | if (ACPI_FAILURE(status)) { | ||
655 | return_ACPI_STATUS(status); | ||
656 | } | ||
657 | } | ||
658 | break; | ||
659 | |||
660 | #endif /* ACPI_NO_METHOD_EXECUTION */ | ||
661 | |||
662 | default: | ||
663 | /* All NAMED_COMPLEX opcodes must be handled above */ | ||
664 | break; | ||
665 | } | ||
666 | break; | ||
667 | |||
668 | case AML_CLASS_INTERNAL: | ||
669 | |||
670 | /* case AML_INT_NAMEPATH_OP: */ | ||
671 | break; | ||
672 | |||
673 | case AML_CLASS_METHOD_CALL: | ||
674 | |||
675 | ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, | ||
676 | "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", | ||
677 | walk_state, op, node)); | ||
678 | |||
679 | /* | ||
680 | * Lookup the method name and save the Node | ||
681 | */ | ||
682 | status = | ||
683 | acpi_ns_lookup(walk_state->scope_info, | ||
684 | arg->common.value.string, ACPI_TYPE_ANY, | ||
685 | ACPI_IMODE_LOAD_PASS2, | ||
686 | ACPI_NS_SEARCH_PARENT | | ||
687 | ACPI_NS_DONT_OPEN_SCOPE, walk_state, | ||
688 | &(new_node)); | ||
689 | if (ACPI_SUCCESS(status)) { | ||
690 | /* | ||
691 | * Make sure that what we found is indeed a method | ||
692 | * We didn't search for a method on purpose, to see if the name | ||
693 | * would resolve | ||
694 | */ | ||
695 | if (new_node->type != ACPI_TYPE_METHOD) { | ||
696 | status = AE_AML_OPERAND_TYPE; | ||
697 | } | ||
698 | |||
699 | /* We could put the returned object (Node) on the object stack for | ||
700 | * later, but for now, we will put it in the "op" object that the | ||
701 | * parser uses, so we can get it again at the end of this scope | ||
702 | */ | ||
703 | op->common.node = new_node; | ||
704 | } else { | ||
705 | ACPI_ERROR_NAMESPACE(arg->common.value.string, status); | ||
706 | } | ||
707 | break; | ||
708 | |||
709 | default: | ||
710 | break; | ||
711 | } | ||
712 | |||
713 | cleanup: | ||
714 | |||
715 | /* Remove the Node pushed at the very beginning */ | ||
716 | |||
717 | walk_state->operands[0] = NULL; | ||
718 | walk_state->num_operands = 0; | ||
719 | return_ACPI_STATUS(status); | ||
720 | } | ||
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index f4725212eb48..65c79add3b19 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -373,6 +373,15 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) | |||
373 | 373 | ||
374 | gpe_register_info = &gpe_block->register_info[i]; | 374 | gpe_register_info = &gpe_block->register_info[i]; |
375 | 375 | ||
376 | /* | ||
377 | * Optimization: If there are no GPEs enabled within this | ||
378 | * register, we can safely ignore the entire register. | ||
379 | */ | ||
380 | if (!(gpe_register_info->enable_for_run | | ||
381 | gpe_register_info->enable_for_wake)) { | ||
382 | continue; | ||
383 | } | ||
384 | |||
376 | /* Read the Status Register */ | 385 | /* Read the Status Register */ |
377 | 386 | ||
378 | status = | 387 | status = |
diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 785a5ee64585..bea7223d7a71 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c | |||
@@ -231,6 +231,8 @@ acpi_status acpi_ev_initialize_op_regions(void) | |||
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | acpi_gbl_reg_methods_executed = TRUE; | ||
235 | |||
234 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 236 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
235 | return_ACPI_STATUS(status); | 237 | return_ACPI_STATUS(status); |
236 | } | 238 | } |
diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index eb7386763712..c85c8c45599d 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c | |||
@@ -110,9 +110,39 @@ acpi_install_address_space_handler(acpi_handle device, | |||
110 | goto unlock_and_exit; | 110 | goto unlock_and_exit; |
111 | } | 111 | } |
112 | 112 | ||
113 | /* Run all _REG methods for this address space */ | 113 | /* |
114 | * For the default space_iDs, (the IDs for which there are default region handlers | ||
115 | * installed) Only execute the _REG methods if the global initialization _REG | ||
116 | * methods have already been run (via acpi_initialize_objects). In other words, | ||
117 | * we will defer the execution of the _REG methods for these space_iDs until | ||
118 | * execution of acpi_initialize_objects. This is done because we need the handlers | ||
119 | * for the default spaces (mem/io/pci/table) to be installed before we can run | ||
120 | * any control methods (or _REG methods). There is known BIOS code that depends | ||
121 | * on this. | ||
122 | * | ||
123 | * For all other space_iDs, we can safely execute the _REG methods immediately. | ||
124 | * This means that for IDs like embedded_controller, this function should be called | ||
125 | * only after acpi_enable_subsystem has been called. | ||
126 | */ | ||
127 | switch (space_id) { | ||
128 | case ACPI_ADR_SPACE_SYSTEM_MEMORY: | ||
129 | case ACPI_ADR_SPACE_SYSTEM_IO: | ||
130 | case ACPI_ADR_SPACE_PCI_CONFIG: | ||
131 | case ACPI_ADR_SPACE_DATA_TABLE: | ||
132 | |||
133 | if (acpi_gbl_reg_methods_executed) { | ||
134 | |||
135 | /* Run all _REG methods for this address space */ | ||
136 | |||
137 | status = acpi_ev_execute_reg_methods(node, space_id); | ||
138 | } | ||
139 | break; | ||
140 | |||
141 | default: | ||
114 | 142 | ||
115 | status = acpi_ev_execute_reg_methods(node, space_id); | 143 | status = acpi_ev_execute_reg_methods(node, space_id); |
144 | break; | ||
145 | } | ||
116 | 146 | ||
117 | unlock_and_exit: | 147 | unlock_and_exit: |
118 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | 148 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); |
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 6c79c29f082d..f915a7f3f921 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c | |||
@@ -280,13 +280,13 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc, | |||
280 | if (ACPI_FAILURE(status)) { | 280 | if (ACPI_FAILURE(status)) { |
281 | if (status == AE_NOT_IMPLEMENTED) { | 281 | if (status == AE_NOT_IMPLEMENTED) { |
282 | ACPI_ERROR((AE_INFO, | 282 | ACPI_ERROR((AE_INFO, |
283 | "Region %s(0x%X) not implemented", | 283 | "Region %s (ID=%u) not implemented", |
284 | acpi_ut_get_region_name(rgn_desc->region. | 284 | acpi_ut_get_region_name(rgn_desc->region. |
285 | space_id), | 285 | space_id), |
286 | rgn_desc->region.space_id)); | 286 | rgn_desc->region.space_id)); |
287 | } else if (status == AE_NOT_EXIST) { | 287 | } else if (status == AE_NOT_EXIST) { |
288 | ACPI_ERROR((AE_INFO, | 288 | ACPI_ERROR((AE_INFO, |
289 | "Region %s(0x%X) has no handler", | 289 | "Region %s (ID=%u) has no handler", |
290 | acpi_ut_get_region_name(rgn_desc->region. | 290 | acpi_ut_get_region_name(rgn_desc->region. |
291 | space_id), | 291 | space_id), |
292 | rgn_desc->region.space_id)); | 292 | rgn_desc->region.space_id)); |
diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index 428d44e2d162..6f5588e62c0a 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c | |||
@@ -384,8 +384,11 @@ static void acpi_tb_convert_fadt(void) | |||
384 | * | 384 | * |
385 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at | 385 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at |
386 | * offset 45, 55, 95, and the word located at offset 109, 110. | 386 | * offset 45, 55, 95, and the word located at offset 109, 110. |
387 | * | ||
388 | * Note: The FADT revision value is unreliable. Only the length can be | ||
389 | * trusted. | ||
387 | */ | 390 | */ |
388 | if (acpi_gbl_FADT.header.revision < FADT2_REVISION_ID) { | 391 | if (acpi_gbl_FADT.header.length <= ACPI_FADT_V2_SIZE) { |
389 | acpi_gbl_FADT.preferred_profile = 0; | 392 | acpi_gbl_FADT.preferred_profile = 0; |
390 | acpi_gbl_FADT.pstate_control = 0; | 393 | acpi_gbl_FADT.pstate_control = 0; |
391 | acpi_gbl_FADT.cst_control = 0; | 394 | acpi_gbl_FADT.cst_control = 0; |
diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c new file mode 100644 index 000000000000..136a814cec69 --- /dev/null +++ b/drivers/acpi/acpica/utdecode.c | |||
@@ -0,0 +1,548 @@ | |||
1 | /****************************************************************************** | ||
2 | * | ||
3 | * Module Name: utdecode - Utility decoding routines (value-to-string) | ||
4 | * | ||
5 | *****************************************************************************/ | ||
6 | |||
7 | /* | ||
8 | * Copyright (C) 2000 - 2011, Intel Corp. | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or without | ||
12 | * modification, are permitted provided that the following conditions | ||
13 | * are met: | ||
14 | * 1. Redistributions of source code must retain the above copyright | ||
15 | * notice, this list of conditions, and the following disclaimer, | ||
16 | * without modification. | ||
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | ||
18 | * substantially similar to the "NO WARRANTY" disclaimer below | ||
19 | * ("Disclaimer") and any redistribution must be conditioned upon | ||
20 | * including a substantially similar Disclaimer requirement for further | ||
21 | * binary redistribution. | ||
22 | * 3. Neither the names of the above-listed copyright holders nor the names | ||
23 | * of any contributors may be used to endorse or promote products derived | ||
24 | * from this software without specific prior written permission. | ||
25 | * | ||
26 | * Alternatively, this software may be distributed under the terms of the | ||
27 | * GNU General Public License ("GPL") version 2 as published by the Free | ||
28 | * Software Foundation. | ||
29 | * | ||
30 | * NO WARRANTY | ||
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | ||
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | ||
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
41 | * POSSIBILITY OF SUCH DAMAGES. | ||
42 | */ | ||
43 | |||
44 | #include <acpi/acpi.h> | ||
45 | #include "accommon.h" | ||
46 | #include "acnamesp.h" | ||
47 | |||
48 | #define _COMPONENT ACPI_UTILITIES | ||
49 | ACPI_MODULE_NAME("utdecode") | ||
50 | |||
51 | /******************************************************************************* | ||
52 | * | ||
53 | * FUNCTION: acpi_format_exception | ||
54 | * | ||
55 | * PARAMETERS: Status - The acpi_status code to be formatted | ||
56 | * | ||
57 | * RETURN: A string containing the exception text. A valid pointer is | ||
58 | * always returned. | ||
59 | * | ||
60 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string | ||
61 | * It is here instead of utxface.c so it is always present. | ||
62 | * | ||
63 | ******************************************************************************/ | ||
64 | const char *acpi_format_exception(acpi_status status) | ||
65 | { | ||
66 | const char *exception = NULL; | ||
67 | |||
68 | ACPI_FUNCTION_ENTRY(); | ||
69 | |||
70 | exception = acpi_ut_validate_exception(status); | ||
71 | if (!exception) { | ||
72 | |||
73 | /* Exception code was not recognized */ | ||
74 | |||
75 | ACPI_ERROR((AE_INFO, | ||
76 | "Unknown exception code: 0x%8.8X", status)); | ||
77 | |||
78 | exception = "UNKNOWN_STATUS_CODE"; | ||
79 | } | ||
80 | |||
81 | return (ACPI_CAST_PTR(const char, exception)); | ||
82 | } | ||
83 | |||
84 | ACPI_EXPORT_SYMBOL(acpi_format_exception) | ||
85 | |||
86 | /* | ||
87 | * Properties of the ACPI Object Types, both internal and external. | ||
88 | * The table is indexed by values of acpi_object_type | ||
89 | */ | ||
90 | const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES] = { | ||
91 | ACPI_NS_NORMAL, /* 00 Any */ | ||
92 | ACPI_NS_NORMAL, /* 01 Number */ | ||
93 | ACPI_NS_NORMAL, /* 02 String */ | ||
94 | ACPI_NS_NORMAL, /* 03 Buffer */ | ||
95 | ACPI_NS_NORMAL, /* 04 Package */ | ||
96 | ACPI_NS_NORMAL, /* 05 field_unit */ | ||
97 | ACPI_NS_NEWSCOPE, /* 06 Device */ | ||
98 | ACPI_NS_NORMAL, /* 07 Event */ | ||
99 | ACPI_NS_NEWSCOPE, /* 08 Method */ | ||
100 | ACPI_NS_NORMAL, /* 09 Mutex */ | ||
101 | ACPI_NS_NORMAL, /* 10 Region */ | ||
102 | ACPI_NS_NEWSCOPE, /* 11 Power */ | ||
103 | ACPI_NS_NEWSCOPE, /* 12 Processor */ | ||
104 | ACPI_NS_NEWSCOPE, /* 13 Thermal */ | ||
105 | ACPI_NS_NORMAL, /* 14 buffer_field */ | ||
106 | ACPI_NS_NORMAL, /* 15 ddb_handle */ | ||
107 | ACPI_NS_NORMAL, /* 16 Debug Object */ | ||
108 | ACPI_NS_NORMAL, /* 17 def_field */ | ||
109 | ACPI_NS_NORMAL, /* 18 bank_field */ | ||
110 | ACPI_NS_NORMAL, /* 19 index_field */ | ||
111 | ACPI_NS_NORMAL, /* 20 Reference */ | ||
112 | ACPI_NS_NORMAL, /* 21 Alias */ | ||
113 | ACPI_NS_NORMAL, /* 22 method_alias */ | ||
114 | ACPI_NS_NORMAL, /* 23 Notify */ | ||
115 | ACPI_NS_NORMAL, /* 24 Address Handler */ | ||
116 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ | ||
117 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ | ||
118 | ACPI_NS_NEWSCOPE, /* 27 Scope */ | ||
119 | ACPI_NS_NORMAL, /* 28 Extra */ | ||
120 | ACPI_NS_NORMAL, /* 29 Data */ | ||
121 | ACPI_NS_NORMAL /* 30 Invalid */ | ||
122 | }; | ||
123 | |||
124 | /******************************************************************************* | ||
125 | * | ||
126 | * FUNCTION: acpi_ut_hex_to_ascii_char | ||
127 | * | ||
128 | * PARAMETERS: Integer - Contains the hex digit | ||
129 | * Position - bit position of the digit within the | ||
130 | * integer (multiple of 4) | ||
131 | * | ||
132 | * RETURN: The converted Ascii character | ||
133 | * | ||
134 | * DESCRIPTION: Convert a hex digit to an Ascii character | ||
135 | * | ||
136 | ******************************************************************************/ | ||
137 | |||
138 | /* Hex to ASCII conversion table */ | ||
139 | |||
140 | static const char acpi_gbl_hex_to_ascii[] = { | ||
141 | '0', '1', '2', '3', '4', '5', '6', '7', | ||
142 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | ||
143 | }; | ||
144 | |||
145 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position) | ||
146 | { | ||
147 | |||
148 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | ||
149 | } | ||
150 | |||
151 | /******************************************************************************* | ||
152 | * | ||
153 | * FUNCTION: acpi_ut_get_region_name | ||
154 | * | ||
155 | * PARAMETERS: Space ID - ID for the region | ||
156 | * | ||
157 | * RETURN: Decoded region space_id name | ||
158 | * | ||
159 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) | ||
160 | * | ||
161 | ******************************************************************************/ | ||
162 | |||
163 | /* Region type decoding */ | ||
164 | |||
165 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | ||
166 | "SystemMemory", | ||
167 | "SystemIO", | ||
168 | "PCI_Config", | ||
169 | "EmbeddedControl", | ||
170 | "SMBus", | ||
171 | "SystemCMOS", | ||
172 | "PCIBARTarget", | ||
173 | "IPMI", | ||
174 | "DataTable" | ||
175 | }; | ||
176 | |||
177 | char *acpi_ut_get_region_name(u8 space_id) | ||
178 | { | ||
179 | |||
180 | if (space_id >= ACPI_USER_REGION_BEGIN) { | ||
181 | return ("UserDefinedRegion"); | ||
182 | } else if (space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) { | ||
183 | return ("FunctionalFixedHW"); | ||
184 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { | ||
185 | return ("InvalidSpaceId"); | ||
186 | } | ||
187 | |||
188 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); | ||
189 | } | ||
190 | |||
191 | /******************************************************************************* | ||
192 | * | ||
193 | * FUNCTION: acpi_ut_get_event_name | ||
194 | * | ||
195 | * PARAMETERS: event_id - Fixed event ID | ||
196 | * | ||
197 | * RETURN: Decoded event ID name | ||
198 | * | ||
199 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) | ||
200 | * | ||
201 | ******************************************************************************/ | ||
202 | |||
203 | /* Event type decoding */ | ||
204 | |||
205 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | ||
206 | "PM_Timer", | ||
207 | "GlobalLock", | ||
208 | "PowerButton", | ||
209 | "SleepButton", | ||
210 | "RealTimeClock", | ||
211 | }; | ||
212 | |||
213 | char *acpi_ut_get_event_name(u32 event_id) | ||
214 | { | ||
215 | |||
216 | if (event_id > ACPI_EVENT_MAX) { | ||
217 | return ("InvalidEventID"); | ||
218 | } | ||
219 | |||
220 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); | ||
221 | } | ||
222 | |||
223 | /******************************************************************************* | ||
224 | * | ||
225 | * FUNCTION: acpi_ut_get_type_name | ||
226 | * | ||
227 | * PARAMETERS: Type - An ACPI object type | ||
228 | * | ||
229 | * RETURN: Decoded ACPI object type name | ||
230 | * | ||
231 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) | ||
232 | * | ||
233 | ******************************************************************************/ | ||
234 | |||
235 | /* | ||
236 | * Elements of acpi_gbl_ns_type_names below must match | ||
237 | * one-to-one with values of acpi_object_type | ||
238 | * | ||
239 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; | ||
240 | * when stored in a table it really means that we have thus far seen no | ||
241 | * evidence to indicate what type is actually going to be stored for this entry. | ||
242 | */ | ||
243 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; | ||
244 | |||
245 | /* Printable names of the ACPI object types */ | ||
246 | |||
247 | static const char *acpi_gbl_ns_type_names[] = { | ||
248 | /* 00 */ "Untyped", | ||
249 | /* 01 */ "Integer", | ||
250 | /* 02 */ "String", | ||
251 | /* 03 */ "Buffer", | ||
252 | /* 04 */ "Package", | ||
253 | /* 05 */ "FieldUnit", | ||
254 | /* 06 */ "Device", | ||
255 | /* 07 */ "Event", | ||
256 | /* 08 */ "Method", | ||
257 | /* 09 */ "Mutex", | ||
258 | /* 10 */ "Region", | ||
259 | /* 11 */ "Power", | ||
260 | /* 12 */ "Processor", | ||
261 | /* 13 */ "Thermal", | ||
262 | /* 14 */ "BufferField", | ||
263 | /* 15 */ "DdbHandle", | ||
264 | /* 16 */ "DebugObject", | ||
265 | /* 17 */ "RegionField", | ||
266 | /* 18 */ "BankField", | ||
267 | /* 19 */ "IndexField", | ||
268 | /* 20 */ "Reference", | ||
269 | /* 21 */ "Alias", | ||
270 | /* 22 */ "MethodAlias", | ||
271 | /* 23 */ "Notify", | ||
272 | /* 24 */ "AddrHandler", | ||
273 | /* 25 */ "ResourceDesc", | ||
274 | /* 26 */ "ResourceFld", | ||
275 | /* 27 */ "Scope", | ||
276 | /* 28 */ "Extra", | ||
277 | /* 29 */ "Data", | ||
278 | /* 30 */ "Invalid" | ||
279 | }; | ||
280 | |||
281 | char *acpi_ut_get_type_name(acpi_object_type type) | ||
282 | { | ||
283 | |||
284 | if (type > ACPI_TYPE_INVALID) { | ||
285 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); | ||
286 | } | ||
287 | |||
288 | return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); | ||
289 | } | ||
290 | |||
291 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) | ||
292 | { | ||
293 | |||
294 | if (!obj_desc) { | ||
295 | return ("[NULL Object Descriptor]"); | ||
296 | } | ||
297 | |||
298 | return (acpi_ut_get_type_name(obj_desc->common.type)); | ||
299 | } | ||
300 | |||
301 | /******************************************************************************* | ||
302 | * | ||
303 | * FUNCTION: acpi_ut_get_node_name | ||
304 | * | ||
305 | * PARAMETERS: Object - A namespace node | ||
306 | * | ||
307 | * RETURN: ASCII name of the node | ||
308 | * | ||
309 | * DESCRIPTION: Validate the node and return the node's ACPI name. | ||
310 | * | ||
311 | ******************************************************************************/ | ||
312 | |||
313 | char *acpi_ut_get_node_name(void *object) | ||
314 | { | ||
315 | struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; | ||
316 | |||
317 | /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ | ||
318 | |||
319 | if (!object) { | ||
320 | return ("NULL"); | ||
321 | } | ||
322 | |||
323 | /* Check for Root node */ | ||
324 | |||
325 | if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) { | ||
326 | return ("\"\\\" "); | ||
327 | } | ||
328 | |||
329 | /* Descriptor must be a namespace node */ | ||
330 | |||
331 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { | ||
332 | return ("####"); | ||
333 | } | ||
334 | |||
335 | /* | ||
336 | * Ensure name is valid. The name was validated/repaired when the node | ||
337 | * was created, but make sure it has not been corrupted. | ||
338 | */ | ||
339 | acpi_ut_repair_name(node->name.ascii); | ||
340 | |||
341 | /* Return the name */ | ||
342 | |||
343 | return (node->name.ascii); | ||
344 | } | ||
345 | |||
346 | /******************************************************************************* | ||
347 | * | ||
348 | * FUNCTION: acpi_ut_get_descriptor_name | ||
349 | * | ||
350 | * PARAMETERS: Object - An ACPI object | ||
351 | * | ||
352 | * RETURN: Decoded name of the descriptor type | ||
353 | * | ||
354 | * DESCRIPTION: Validate object and return the descriptor type | ||
355 | * | ||
356 | ******************************************************************************/ | ||
357 | |||
358 | /* Printable names of object descriptor types */ | ||
359 | |||
360 | static const char *acpi_gbl_desc_type_names[] = { | ||
361 | /* 00 */ "Not a Descriptor", | ||
362 | /* 01 */ "Cached", | ||
363 | /* 02 */ "State-Generic", | ||
364 | /* 03 */ "State-Update", | ||
365 | /* 04 */ "State-Package", | ||
366 | /* 05 */ "State-Control", | ||
367 | /* 06 */ "State-RootParseScope", | ||
368 | /* 07 */ "State-ParseScope", | ||
369 | /* 08 */ "State-WalkScope", | ||
370 | /* 09 */ "State-Result", | ||
371 | /* 10 */ "State-Notify", | ||
372 | /* 11 */ "State-Thread", | ||
373 | /* 12 */ "Walk", | ||
374 | /* 13 */ "Parser", | ||
375 | /* 14 */ "Operand", | ||
376 | /* 15 */ "Node" | ||
377 | }; | ||
378 | |||
379 | char *acpi_ut_get_descriptor_name(void *object) | ||
380 | { | ||
381 | |||
382 | if (!object) { | ||
383 | return ("NULL OBJECT"); | ||
384 | } | ||
385 | |||
386 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { | ||
387 | return ("Not a Descriptor"); | ||
388 | } | ||
389 | |||
390 | return (ACPI_CAST_PTR(char, | ||
391 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE | ||
392 | (object)])); | ||
393 | |||
394 | } | ||
395 | |||
396 | /******************************************************************************* | ||
397 | * | ||
398 | * FUNCTION: acpi_ut_get_reference_name | ||
399 | * | ||
400 | * PARAMETERS: Object - An ACPI reference object | ||
401 | * | ||
402 | * RETURN: Decoded name of the type of reference | ||
403 | * | ||
404 | * DESCRIPTION: Decode a reference object sub-type to a string. | ||
405 | * | ||
406 | ******************************************************************************/ | ||
407 | |||
408 | /* Printable names of reference object sub-types */ | ||
409 | |||
410 | static const char *acpi_gbl_ref_class_names[] = { | ||
411 | /* 00 */ "Local", | ||
412 | /* 01 */ "Argument", | ||
413 | /* 02 */ "RefOf", | ||
414 | /* 03 */ "Index", | ||
415 | /* 04 */ "DdbHandle", | ||
416 | /* 05 */ "Named Object", | ||
417 | /* 06 */ "Debug" | ||
418 | }; | ||
419 | |||
420 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object) | ||
421 | { | ||
422 | |||
423 | if (!object) { | ||
424 | return ("NULL Object"); | ||
425 | } | ||
426 | |||
427 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { | ||
428 | return ("Not an Operand object"); | ||
429 | } | ||
430 | |||
431 | if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE) { | ||
432 | return ("Not a Reference object"); | ||
433 | } | ||
434 | |||
435 | if (object->reference.class > ACPI_REFCLASS_MAX) { | ||
436 | return ("Unknown Reference class"); | ||
437 | } | ||
438 | |||
439 | return (acpi_gbl_ref_class_names[object->reference.class]); | ||
440 | } | ||
441 | |||
442 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
443 | /* | ||
444 | * Strings and procedures used for debug only | ||
445 | */ | ||
446 | |||
447 | /******************************************************************************* | ||
448 | * | ||
449 | * FUNCTION: acpi_ut_get_mutex_name | ||
450 | * | ||
451 | * PARAMETERS: mutex_id - The predefined ID for this mutex. | ||
452 | * | ||
453 | * RETURN: Decoded name of the internal mutex | ||
454 | * | ||
455 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) | ||
456 | * | ||
457 | ******************************************************************************/ | ||
458 | |||
459 | /* Names for internal mutex objects, used for debug output */ | ||
460 | |||
461 | static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { | ||
462 | "ACPI_MTX_Interpreter", | ||
463 | "ACPI_MTX_Namespace", | ||
464 | "ACPI_MTX_Tables", | ||
465 | "ACPI_MTX_Events", | ||
466 | "ACPI_MTX_Caches", | ||
467 | "ACPI_MTX_Memory", | ||
468 | "ACPI_MTX_CommandComplete", | ||
469 | "ACPI_MTX_CommandReady" | ||
470 | }; | ||
471 | |||
472 | char *acpi_ut_get_mutex_name(u32 mutex_id) | ||
473 | { | ||
474 | |||
475 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
476 | return ("Invalid Mutex ID"); | ||
477 | } | ||
478 | |||
479 | return (acpi_gbl_mutex_names[mutex_id]); | ||
480 | } | ||
481 | |||
482 | /******************************************************************************* | ||
483 | * | ||
484 | * FUNCTION: acpi_ut_get_notify_name | ||
485 | * | ||
486 | * PARAMETERS: notify_value - Value from the Notify() request | ||
487 | * | ||
488 | * RETURN: Decoded name for the notify value | ||
489 | * | ||
490 | * DESCRIPTION: Translate a Notify Value to a notify namestring. | ||
491 | * | ||
492 | ******************************************************************************/ | ||
493 | |||
494 | /* Names for Notify() values, used for debug output */ | ||
495 | |||
496 | static const char *acpi_gbl_notify_value_names[] = { | ||
497 | "Bus Check", | ||
498 | "Device Check", | ||
499 | "Device Wake", | ||
500 | "Eject Request", | ||
501 | "Device Check Light", | ||
502 | "Frequency Mismatch", | ||
503 | "Bus Mode Mismatch", | ||
504 | "Power Fault", | ||
505 | "Capabilities Check", | ||
506 | "Device PLD Check", | ||
507 | "Reserved", | ||
508 | "System Locality Update" | ||
509 | }; | ||
510 | |||
511 | const char *acpi_ut_get_notify_name(u32 notify_value) | ||
512 | { | ||
513 | |||
514 | if (notify_value <= ACPI_NOTIFY_MAX) { | ||
515 | return (acpi_gbl_notify_value_names[notify_value]); | ||
516 | } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) { | ||
517 | return ("Reserved"); | ||
518 | } else { /* Greater or equal to 0x80 */ | ||
519 | |||
520 | return ("**Device Specific**"); | ||
521 | } | ||
522 | } | ||
523 | #endif | ||
524 | |||
525 | /******************************************************************************* | ||
526 | * | ||
527 | * FUNCTION: acpi_ut_valid_object_type | ||
528 | * | ||
529 | * PARAMETERS: Type - Object type to be validated | ||
530 | * | ||
531 | * RETURN: TRUE if valid object type, FALSE otherwise | ||
532 | * | ||
533 | * DESCRIPTION: Validate an object type | ||
534 | * | ||
535 | ******************************************************************************/ | ||
536 | |||
537 | u8 acpi_ut_valid_object_type(acpi_object_type type) | ||
538 | { | ||
539 | |||
540 | if (type > ACPI_TYPE_LOCAL_MAX) { | ||
541 | |||
542 | /* Note: Assumes all TYPEs are contiguous (external/local) */ | ||
543 | |||
544 | return (FALSE); | ||
545 | } | ||
546 | |||
547 | return (TRUE); | ||
548 | } | ||
diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 97dd9bbf055a..833a38a9c905 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c | |||
@@ -45,7 +45,6 @@ | |||
45 | 45 | ||
46 | #include <acpi/acpi.h> | 46 | #include <acpi/acpi.h> |
47 | #include "accommon.h" | 47 | #include "accommon.h" |
48 | #include "acnamesp.h" | ||
49 | 48 | ||
50 | #define _COMPONENT ACPI_UTILITIES | 49 | #define _COMPONENT ACPI_UTILITIES |
51 | ACPI_MODULE_NAME("utglobal") | 50 | ACPI_MODULE_NAME("utglobal") |
@@ -107,43 +106,6 @@ const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS] = { | |||
107 | 106 | ||
108 | /******************************************************************************* | 107 | /******************************************************************************* |
109 | * | 108 | * |
110 | * FUNCTION: acpi_format_exception | ||
111 | * | ||
112 | * PARAMETERS: Status - The acpi_status code to be formatted | ||
113 | * | ||
114 | * RETURN: A string containing the exception text. A valid pointer is | ||
115 | * always returned. | ||
116 | * | ||
117 | * DESCRIPTION: This function translates an ACPI exception into an ASCII string | ||
118 | * It is here instead of utxface.c so it is always present. | ||
119 | * | ||
120 | ******************************************************************************/ | ||
121 | |||
122 | const char *acpi_format_exception(acpi_status status) | ||
123 | { | ||
124 | const char *exception = NULL; | ||
125 | |||
126 | ACPI_FUNCTION_ENTRY(); | ||
127 | |||
128 | exception = acpi_ut_validate_exception(status); | ||
129 | if (!exception) { | ||
130 | |||
131 | /* Exception code was not recognized */ | ||
132 | |||
133 | ACPI_ERROR((AE_INFO, | ||
134 | "Unknown exception code: 0x%8.8X", status)); | ||
135 | |||
136 | exception = "UNKNOWN_STATUS_CODE"; | ||
137 | dump_stack(); | ||
138 | } | ||
139 | |||
140 | return (ACPI_CAST_PTR(const char, exception)); | ||
141 | } | ||
142 | |||
143 | ACPI_EXPORT_SYMBOL(acpi_format_exception) | ||
144 | |||
145 | /******************************************************************************* | ||
146 | * | ||
147 | * Namespace globals | 109 | * Namespace globals |
148 | * | 110 | * |
149 | ******************************************************************************/ | 111 | ******************************************************************************/ |
@@ -177,71 +139,6 @@ const struct acpi_predefined_names acpi_gbl_pre_defined_names[] = { | |||
177 | {NULL, ACPI_TYPE_ANY, NULL} | 139 | {NULL, ACPI_TYPE_ANY, NULL} |
178 | }; | 140 | }; |
179 | 141 | ||
180 | /* | ||
181 | * Properties of the ACPI Object Types, both internal and external. | ||
182 | * The table is indexed by values of acpi_object_type | ||
183 | */ | ||
184 | const u8 acpi_gbl_ns_properties[] = { | ||
185 | ACPI_NS_NORMAL, /* 00 Any */ | ||
186 | ACPI_NS_NORMAL, /* 01 Number */ | ||
187 | ACPI_NS_NORMAL, /* 02 String */ | ||
188 | ACPI_NS_NORMAL, /* 03 Buffer */ | ||
189 | ACPI_NS_NORMAL, /* 04 Package */ | ||
190 | ACPI_NS_NORMAL, /* 05 field_unit */ | ||
191 | ACPI_NS_NEWSCOPE, /* 06 Device */ | ||
192 | ACPI_NS_NORMAL, /* 07 Event */ | ||
193 | ACPI_NS_NEWSCOPE, /* 08 Method */ | ||
194 | ACPI_NS_NORMAL, /* 09 Mutex */ | ||
195 | ACPI_NS_NORMAL, /* 10 Region */ | ||
196 | ACPI_NS_NEWSCOPE, /* 11 Power */ | ||
197 | ACPI_NS_NEWSCOPE, /* 12 Processor */ | ||
198 | ACPI_NS_NEWSCOPE, /* 13 Thermal */ | ||
199 | ACPI_NS_NORMAL, /* 14 buffer_field */ | ||
200 | ACPI_NS_NORMAL, /* 15 ddb_handle */ | ||
201 | ACPI_NS_NORMAL, /* 16 Debug Object */ | ||
202 | ACPI_NS_NORMAL, /* 17 def_field */ | ||
203 | ACPI_NS_NORMAL, /* 18 bank_field */ | ||
204 | ACPI_NS_NORMAL, /* 19 index_field */ | ||
205 | ACPI_NS_NORMAL, /* 20 Reference */ | ||
206 | ACPI_NS_NORMAL, /* 21 Alias */ | ||
207 | ACPI_NS_NORMAL, /* 22 method_alias */ | ||
208 | ACPI_NS_NORMAL, /* 23 Notify */ | ||
209 | ACPI_NS_NORMAL, /* 24 Address Handler */ | ||
210 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 25 Resource Desc */ | ||
211 | ACPI_NS_NEWSCOPE | ACPI_NS_LOCAL, /* 26 Resource Field */ | ||
212 | ACPI_NS_NEWSCOPE, /* 27 Scope */ | ||
213 | ACPI_NS_NORMAL, /* 28 Extra */ | ||
214 | ACPI_NS_NORMAL, /* 29 Data */ | ||
215 | ACPI_NS_NORMAL /* 30 Invalid */ | ||
216 | }; | ||
217 | |||
218 | /* Hex to ASCII conversion table */ | ||
219 | |||
220 | static const char acpi_gbl_hex_to_ascii[] = { | ||
221 | '0', '1', '2', '3', '4', '5', '6', '7', | ||
222 | '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' | ||
223 | }; | ||
224 | |||
225 | /******************************************************************************* | ||
226 | * | ||
227 | * FUNCTION: acpi_ut_hex_to_ascii_char | ||
228 | * | ||
229 | * PARAMETERS: Integer - Contains the hex digit | ||
230 | * Position - bit position of the digit within the | ||
231 | * integer (multiple of 4) | ||
232 | * | ||
233 | * RETURN: The converted Ascii character | ||
234 | * | ||
235 | * DESCRIPTION: Convert a hex digit to an Ascii character | ||
236 | * | ||
237 | ******************************************************************************/ | ||
238 | |||
239 | char acpi_ut_hex_to_ascii_char(u64 integer, u32 position) | ||
240 | { | ||
241 | |||
242 | return (acpi_gbl_hex_to_ascii[(integer >> position) & 0xF]); | ||
243 | } | ||
244 | |||
245 | /****************************************************************************** | 142 | /****************************************************************************** |
246 | * | 143 | * |
247 | * Event and Hardware globals | 144 | * Event and Hardware globals |
@@ -341,386 +238,6 @@ struct acpi_fixed_event_info acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS] = | |||
341 | 238 | ||
342 | /******************************************************************************* | 239 | /******************************************************************************* |
343 | * | 240 | * |
344 | * FUNCTION: acpi_ut_get_region_name | ||
345 | * | ||
346 | * PARAMETERS: None. | ||
347 | * | ||
348 | * RETURN: Status | ||
349 | * | ||
350 | * DESCRIPTION: Translate a Space ID into a name string (Debug only) | ||
351 | * | ||
352 | ******************************************************************************/ | ||
353 | |||
354 | /* Region type decoding */ | ||
355 | |||
356 | const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { | ||
357 | "SystemMemory", | ||
358 | "SystemIO", | ||
359 | "PCI_Config", | ||
360 | "EmbeddedControl", | ||
361 | "SMBus", | ||
362 | "SystemCMOS", | ||
363 | "PCIBARTarget", | ||
364 | "IPMI", | ||
365 | "DataTable" | ||
366 | }; | ||
367 | |||
368 | char *acpi_ut_get_region_name(u8 space_id) | ||
369 | { | ||
370 | |||
371 | if (space_id >= ACPI_USER_REGION_BEGIN) { | ||
372 | return ("UserDefinedRegion"); | ||
373 | } else if (space_id >= ACPI_NUM_PREDEFINED_REGIONS) { | ||
374 | return ("InvalidSpaceId"); | ||
375 | } | ||
376 | |||
377 | return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); | ||
378 | } | ||
379 | |||
380 | /******************************************************************************* | ||
381 | * | ||
382 | * FUNCTION: acpi_ut_get_event_name | ||
383 | * | ||
384 | * PARAMETERS: None. | ||
385 | * | ||
386 | * RETURN: Status | ||
387 | * | ||
388 | * DESCRIPTION: Translate a Event ID into a name string (Debug only) | ||
389 | * | ||
390 | ******************************************************************************/ | ||
391 | |||
392 | /* Event type decoding */ | ||
393 | |||
394 | static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { | ||
395 | "PM_Timer", | ||
396 | "GlobalLock", | ||
397 | "PowerButton", | ||
398 | "SleepButton", | ||
399 | "RealTimeClock", | ||
400 | }; | ||
401 | |||
402 | char *acpi_ut_get_event_name(u32 event_id) | ||
403 | { | ||
404 | |||
405 | if (event_id > ACPI_EVENT_MAX) { | ||
406 | return ("InvalidEventID"); | ||
407 | } | ||
408 | |||
409 | return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); | ||
410 | } | ||
411 | |||
412 | /******************************************************************************* | ||
413 | * | ||
414 | * FUNCTION: acpi_ut_get_type_name | ||
415 | * | ||
416 | * PARAMETERS: None. | ||
417 | * | ||
418 | * RETURN: Status | ||
419 | * | ||
420 | * DESCRIPTION: Translate a Type ID into a name string (Debug only) | ||
421 | * | ||
422 | ******************************************************************************/ | ||
423 | |||
424 | /* | ||
425 | * Elements of acpi_gbl_ns_type_names below must match | ||
426 | * one-to-one with values of acpi_object_type | ||
427 | * | ||
428 | * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; | ||
429 | * when stored in a table it really means that we have thus far seen no | ||
430 | * evidence to indicate what type is actually going to be stored for this entry. | ||
431 | */ | ||
432 | static const char acpi_gbl_bad_type[] = "UNDEFINED"; | ||
433 | |||
434 | /* Printable names of the ACPI object types */ | ||
435 | |||
436 | static const char *acpi_gbl_ns_type_names[] = { | ||
437 | /* 00 */ "Untyped", | ||
438 | /* 01 */ "Integer", | ||
439 | /* 02 */ "String", | ||
440 | /* 03 */ "Buffer", | ||
441 | /* 04 */ "Package", | ||
442 | /* 05 */ "FieldUnit", | ||
443 | /* 06 */ "Device", | ||
444 | /* 07 */ "Event", | ||
445 | /* 08 */ "Method", | ||
446 | /* 09 */ "Mutex", | ||
447 | /* 10 */ "Region", | ||
448 | /* 11 */ "Power", | ||
449 | /* 12 */ "Processor", | ||
450 | /* 13 */ "Thermal", | ||
451 | /* 14 */ "BufferField", | ||
452 | /* 15 */ "DdbHandle", | ||
453 | /* 16 */ "DebugObject", | ||
454 | /* 17 */ "RegionField", | ||
455 | /* 18 */ "BankField", | ||
456 | /* 19 */ "IndexField", | ||
457 | /* 20 */ "Reference", | ||
458 | /* 21 */ "Alias", | ||
459 | /* 22 */ "MethodAlias", | ||
460 | /* 23 */ "Notify", | ||
461 | /* 24 */ "AddrHandler", | ||
462 | /* 25 */ "ResourceDesc", | ||
463 | /* 26 */ "ResourceFld", | ||
464 | /* 27 */ "Scope", | ||
465 | /* 28 */ "Extra", | ||
466 | /* 29 */ "Data", | ||
467 | /* 30 */ "Invalid" | ||
468 | }; | ||
469 | |||
470 | char *acpi_ut_get_type_name(acpi_object_type type) | ||
471 | { | ||
472 | |||
473 | if (type > ACPI_TYPE_INVALID) { | ||
474 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); | ||
475 | } | ||
476 | |||
477 | return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); | ||
478 | } | ||
479 | |||
480 | char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) | ||
481 | { | ||
482 | |||
483 | if (!obj_desc) { | ||
484 | return ("[NULL Object Descriptor]"); | ||
485 | } | ||
486 | |||
487 | return (acpi_ut_get_type_name(obj_desc->common.type)); | ||
488 | } | ||
489 | |||
490 | /******************************************************************************* | ||
491 | * | ||
492 | * FUNCTION: acpi_ut_get_node_name | ||
493 | * | ||
494 | * PARAMETERS: Object - A namespace node | ||
495 | * | ||
496 | * RETURN: Pointer to a string | ||
497 | * | ||
498 | * DESCRIPTION: Validate the node and return the node's ACPI name. | ||
499 | * | ||
500 | ******************************************************************************/ | ||
501 | |||
502 | char *acpi_ut_get_node_name(void *object) | ||
503 | { | ||
504 | struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; | ||
505 | |||
506 | /* Must return a string of exactly 4 characters == ACPI_NAME_SIZE */ | ||
507 | |||
508 | if (!object) { | ||
509 | return ("NULL"); | ||
510 | } | ||
511 | |||
512 | /* Check for Root node */ | ||
513 | |||
514 | if ((object == ACPI_ROOT_OBJECT) || (object == acpi_gbl_root_node)) { | ||
515 | return ("\"\\\" "); | ||
516 | } | ||
517 | |||
518 | /* Descriptor must be a namespace node */ | ||
519 | |||
520 | if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { | ||
521 | return ("####"); | ||
522 | } | ||
523 | |||
524 | /* Name must be a valid ACPI name */ | ||
525 | |||
526 | if (!acpi_ut_valid_acpi_name(node->name.integer)) { | ||
527 | node->name.integer = acpi_ut_repair_name(node->name.ascii); | ||
528 | } | ||
529 | |||
530 | /* Return the name */ | ||
531 | |||
532 | return (node->name.ascii); | ||
533 | } | ||
534 | |||
535 | /******************************************************************************* | ||
536 | * | ||
537 | * FUNCTION: acpi_ut_get_descriptor_name | ||
538 | * | ||
539 | * PARAMETERS: Object - An ACPI object | ||
540 | * | ||
541 | * RETURN: Pointer to a string | ||
542 | * | ||
543 | * DESCRIPTION: Validate object and return the descriptor type | ||
544 | * | ||
545 | ******************************************************************************/ | ||
546 | |||
547 | /* Printable names of object descriptor types */ | ||
548 | |||
549 | static const char *acpi_gbl_desc_type_names[] = { | ||
550 | /* 00 */ "Invalid", | ||
551 | /* 01 */ "Cached", | ||
552 | /* 02 */ "State-Generic", | ||
553 | /* 03 */ "State-Update", | ||
554 | /* 04 */ "State-Package", | ||
555 | /* 05 */ "State-Control", | ||
556 | /* 06 */ "State-RootParseScope", | ||
557 | /* 07 */ "State-ParseScope", | ||
558 | /* 08 */ "State-WalkScope", | ||
559 | /* 09 */ "State-Result", | ||
560 | /* 10 */ "State-Notify", | ||
561 | /* 11 */ "State-Thread", | ||
562 | /* 12 */ "Walk", | ||
563 | /* 13 */ "Parser", | ||
564 | /* 14 */ "Operand", | ||
565 | /* 15 */ "Node" | ||
566 | }; | ||
567 | |||
568 | char *acpi_ut_get_descriptor_name(void *object) | ||
569 | { | ||
570 | |||
571 | if (!object) { | ||
572 | return ("NULL OBJECT"); | ||
573 | } | ||
574 | |||
575 | if (ACPI_GET_DESCRIPTOR_TYPE(object) > ACPI_DESC_TYPE_MAX) { | ||
576 | return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); | ||
577 | } | ||
578 | |||
579 | return (ACPI_CAST_PTR(char, | ||
580 | acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE | ||
581 | (object)])); | ||
582 | |||
583 | } | ||
584 | |||
585 | /******************************************************************************* | ||
586 | * | ||
587 | * FUNCTION: acpi_ut_get_reference_name | ||
588 | * | ||
589 | * PARAMETERS: Object - An ACPI reference object | ||
590 | * | ||
591 | * RETURN: Pointer to a string | ||
592 | * | ||
593 | * DESCRIPTION: Decode a reference object sub-type to a string. | ||
594 | * | ||
595 | ******************************************************************************/ | ||
596 | |||
597 | /* Printable names of reference object sub-types */ | ||
598 | |||
599 | static const char *acpi_gbl_ref_class_names[] = { | ||
600 | /* 00 */ "Local", | ||
601 | /* 01 */ "Argument", | ||
602 | /* 02 */ "RefOf", | ||
603 | /* 03 */ "Index", | ||
604 | /* 04 */ "DdbHandle", | ||
605 | /* 05 */ "Named Object", | ||
606 | /* 06 */ "Debug" | ||
607 | }; | ||
608 | |||
609 | const char *acpi_ut_get_reference_name(union acpi_operand_object *object) | ||
610 | { | ||
611 | if (!object) | ||
612 | return "NULL Object"; | ||
613 | |||
614 | if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) | ||
615 | return "Not an Operand object"; | ||
616 | |||
617 | if (object->common.type != ACPI_TYPE_LOCAL_REFERENCE) | ||
618 | return "Not a Reference object"; | ||
619 | |||
620 | if (object->reference.class > ACPI_REFCLASS_MAX) | ||
621 | return "Unknown Reference class"; | ||
622 | |||
623 | return acpi_gbl_ref_class_names[object->reference.class]; | ||
624 | } | ||
625 | |||
626 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | ||
627 | /* | ||
628 | * Strings and procedures used for debug only | ||
629 | */ | ||
630 | |||
631 | /******************************************************************************* | ||
632 | * | ||
633 | * FUNCTION: acpi_ut_get_mutex_name | ||
634 | * | ||
635 | * PARAMETERS: mutex_id - The predefined ID for this mutex. | ||
636 | * | ||
637 | * RETURN: String containing the name of the mutex. Always returns a valid | ||
638 | * pointer. | ||
639 | * | ||
640 | * DESCRIPTION: Translate a mutex ID into a name string (Debug only) | ||
641 | * | ||
642 | ******************************************************************************/ | ||
643 | |||
644 | char *acpi_ut_get_mutex_name(u32 mutex_id) | ||
645 | { | ||
646 | |||
647 | if (mutex_id > ACPI_MAX_MUTEX) { | ||
648 | return ("Invalid Mutex ID"); | ||
649 | } | ||
650 | |||
651 | return (acpi_gbl_mutex_names[mutex_id]); | ||
652 | } | ||
653 | |||
654 | /******************************************************************************* | ||
655 | * | ||
656 | * FUNCTION: acpi_ut_get_notify_name | ||
657 | * | ||
658 | * PARAMETERS: notify_value - Value from the Notify() request | ||
659 | * | ||
660 | * RETURN: String corresponding to the Notify Value. | ||
661 | * | ||
662 | * DESCRIPTION: Translate a Notify Value to a notify namestring. | ||
663 | * | ||
664 | ******************************************************************************/ | ||
665 | |||
666 | /* Names for Notify() values, used for debug output */ | ||
667 | |||
668 | static const char *acpi_gbl_notify_value_names[] = { | ||
669 | "Bus Check", | ||
670 | "Device Check", | ||
671 | "Device Wake", | ||
672 | "Eject Request", | ||
673 | "Device Check Light", | ||
674 | "Frequency Mismatch", | ||
675 | "Bus Mode Mismatch", | ||
676 | "Power Fault", | ||
677 | "Capabilities Check", | ||
678 | "Device PLD Check", | ||
679 | "Reserved", | ||
680 | "System Locality Update" | ||
681 | }; | ||
682 | |||
683 | const char *acpi_ut_get_notify_name(u32 notify_value) | ||
684 | { | ||
685 | |||
686 | if (notify_value <= ACPI_NOTIFY_MAX) { | ||
687 | return (acpi_gbl_notify_value_names[notify_value]); | ||
688 | } else if (notify_value <= ACPI_MAX_SYS_NOTIFY) { | ||
689 | return ("Reserved"); | ||
690 | } else { /* Greater or equal to 0x80 */ | ||
691 | |||
692 | return ("**Device Specific**"); | ||
693 | } | ||
694 | } | ||
695 | #endif | ||
696 | |||
697 | /******************************************************************************* | ||
698 | * | ||
699 | * FUNCTION: acpi_ut_valid_object_type | ||
700 | * | ||
701 | * PARAMETERS: Type - Object type to be validated | ||
702 | * | ||
703 | * RETURN: TRUE if valid object type, FALSE otherwise | ||
704 | * | ||
705 | * DESCRIPTION: Validate an object type | ||
706 | * | ||
707 | ******************************************************************************/ | ||
708 | |||
709 | u8 acpi_ut_valid_object_type(acpi_object_type type) | ||
710 | { | ||
711 | |||
712 | if (type > ACPI_TYPE_LOCAL_MAX) { | ||
713 | |||
714 | /* Note: Assumes all TYPEs are contiguous (external/local) */ | ||
715 | |||
716 | return (FALSE); | ||
717 | } | ||
718 | |||
719 | return (TRUE); | ||
720 | } | ||
721 | |||
722 | /******************************************************************************* | ||
723 | * | ||
724 | * FUNCTION: acpi_ut_init_globals | 241 | * FUNCTION: acpi_ut_init_globals |
725 | * | 242 | * |
726 | * PARAMETERS: None | 243 | * PARAMETERS: None |
@@ -806,6 +323,7 @@ acpi_status acpi_ut_init_globals(void) | |||
806 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; | 323 | acpi_gbl_db_output_flags = ACPI_DB_CONSOLE_OUTPUT; |
807 | acpi_gbl_osi_data = 0; | 324 | acpi_gbl_osi_data = 0; |
808 | acpi_gbl_osi_mutex = NULL; | 325 | acpi_gbl_osi_mutex = NULL; |
326 | acpi_gbl_reg_methods_executed = FALSE; | ||
809 | 327 | ||
810 | /* Hardware oriented */ | 328 | /* Hardware oriented */ |
811 | 329 | ||
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index b9ba04fc2b34..77fc76f8aea9 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3281,7 +3281,7 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g, | |||
3281 | struct block_device *bdev = opened_bdev[cnt]; | 3281 | struct block_device *bdev = opened_bdev[cnt]; |
3282 | if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) | 3282 | if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) |
3283 | continue; | 3283 | continue; |
3284 | __invalidate_device(bdev); | 3284 | __invalidate_device(bdev, true); |
3285 | } | 3285 | } |
3286 | mutex_unlock(&open_lock); | 3286 | mutex_unlock(&open_lock); |
3287 | } else { | 3287 | } else { |
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index c195bfeade11..5feebe2800e9 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -130,6 +130,7 @@ | |||
130 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) | 130 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) |
131 | 131 | ||
132 | #define I915_IFPADDR 0x60 | 132 | #define I915_IFPADDR 0x60 |
133 | #define I830_HIC 0x70 | ||
133 | 134 | ||
134 | /* Intel 965G registers */ | 135 | /* Intel 965G registers */ |
135 | #define I965_MSAC 0x62 | 136 | #define I965_MSAC 0x62 |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index fab3d3265adb..0d09b537bb9a 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/agp_backend.h> | 23 | #include <linux/agp_backend.h> |
24 | #include <linux/delay.h> | ||
24 | #include <asm/smp.h> | 25 | #include <asm/smp.h> |
25 | #include "agp.h" | 26 | #include "agp.h" |
26 | #include "intel-agp.h" | 27 | #include "intel-agp.h" |
@@ -70,12 +71,8 @@ static struct _intel_private { | |||
70 | u32 __iomem *gtt; /* I915G */ | 71 | u32 __iomem *gtt; /* I915G */ |
71 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ | 72 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ |
72 | int num_dcache_entries; | 73 | int num_dcache_entries; |
73 | union { | 74 | void __iomem *i9xx_flush_page; |
74 | void __iomem *i9xx_flush_page; | ||
75 | void *i8xx_flush_page; | ||
76 | }; | ||
77 | char *i81x_gtt_table; | 75 | char *i81x_gtt_table; |
78 | struct page *i8xx_page; | ||
79 | struct resource ifp_resource; | 76 | struct resource ifp_resource; |
80 | int resource_valid; | 77 | int resource_valid; |
81 | struct page *scratch_page; | 78 | struct page *scratch_page; |
@@ -722,28 +719,6 @@ static int intel_fake_agp_fetch_size(void) | |||
722 | 719 | ||
723 | static void i830_cleanup(void) | 720 | static void i830_cleanup(void) |
724 | { | 721 | { |
725 | if (intel_private.i8xx_flush_page) { | ||
726 | kunmap(intel_private.i8xx_flush_page); | ||
727 | intel_private.i8xx_flush_page = NULL; | ||
728 | } | ||
729 | |||
730 | __free_page(intel_private.i8xx_page); | ||
731 | intel_private.i8xx_page = NULL; | ||
732 | } | ||
733 | |||
734 | static void intel_i830_setup_flush(void) | ||
735 | { | ||
736 | /* return if we've already set the flush mechanism up */ | ||
737 | if (intel_private.i8xx_page) | ||
738 | return; | ||
739 | |||
740 | intel_private.i8xx_page = alloc_page(GFP_KERNEL); | ||
741 | if (!intel_private.i8xx_page) | ||
742 | return; | ||
743 | |||
744 | intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page); | ||
745 | if (!intel_private.i8xx_flush_page) | ||
746 | i830_cleanup(); | ||
747 | } | 722 | } |
748 | 723 | ||
749 | /* The chipset_flush interface needs to get data that has already been | 724 | /* The chipset_flush interface needs to get data that has already been |
@@ -758,14 +733,27 @@ static void intel_i830_setup_flush(void) | |||
758 | */ | 733 | */ |
759 | static void i830_chipset_flush(void) | 734 | static void i830_chipset_flush(void) |
760 | { | 735 | { |
761 | unsigned int *pg = intel_private.i8xx_flush_page; | 736 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
737 | |||
738 | /* Forcibly evict everything from the CPU write buffers. | ||
739 | * clflush appears to be insufficient. | ||
740 | */ | ||
741 | wbinvd_on_all_cpus(); | ||
742 | |||
743 | /* Now we've only seen documents for this magic bit on 855GM, | ||
744 | * we hope it exists for the other gen2 chipsets... | ||
745 | * | ||
746 | * Also works as advertised on my 845G. | ||
747 | */ | ||
748 | writel(readl(intel_private.registers+I830_HIC) | (1<<31), | ||
749 | intel_private.registers+I830_HIC); | ||
762 | 750 | ||
763 | memset(pg, 0, 1024); | 751 | while (readl(intel_private.registers+I830_HIC) & (1<<31)) { |
752 | if (time_after(jiffies, timeout)) | ||
753 | break; | ||
764 | 754 | ||
765 | if (cpu_has_clflush) | 755 | udelay(50); |
766 | clflush_cache_range(pg, 1024); | 756 | } |
767 | else if (wbinvd_on_all_cpus() != 0) | ||
768 | printk(KERN_ERR "Timed out waiting for cache flush.\n"); | ||
769 | } | 757 | } |
770 | 758 | ||
771 | static void i830_write_entry(dma_addr_t addr, unsigned int entry, | 759 | static void i830_write_entry(dma_addr_t addr, unsigned int entry, |
@@ -849,8 +837,6 @@ static int i830_setup(void) | |||
849 | 837 | ||
850 | intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; | 838 | intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; |
851 | 839 | ||
852 | intel_i830_setup_flush(); | ||
853 | |||
854 | return 0; | 840 | return 0; |
855 | } | 841 | } |
856 | 842 | ||
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 36e0fa161c2b..1f46f1cd9225 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -364,14 +364,12 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, | |||
364 | tpm_protected_ordinal_duration[ordinal & | 364 | tpm_protected_ordinal_duration[ordinal & |
365 | TPM_PROTECTED_ORDINAL_MASK]; | 365 | TPM_PROTECTED_ORDINAL_MASK]; |
366 | 366 | ||
367 | if (duration_idx != TPM_UNDEFINED) { | 367 | if (duration_idx != TPM_UNDEFINED) |
368 | duration = chip->vendor.duration[duration_idx]; | 368 | duration = chip->vendor.duration[duration_idx]; |
369 | /* if duration is 0, it's because chip->vendor.duration wasn't */ | 369 | if (duration <= 0) |
370 | /* filled yet, so we set the lowest timeout just to give enough */ | ||
371 | /* time for tpm_get_timeouts() to succeed */ | ||
372 | return (duration <= 0 ? HZ : duration); | ||
373 | } else | ||
374 | return 2 * 60 * HZ; | 370 | return 2 * 60 * HZ; |
371 | else | ||
372 | return duration; | ||
375 | } | 373 | } |
376 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); | 374 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
377 | 375 | ||
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 53120a72a48c..28d1d3c24d65 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -1012,7 +1012,8 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, | |||
1012 | struct drm_file *file_priv) | 1012 | struct drm_file *file_priv) |
1013 | { | 1013 | { |
1014 | struct drm_modeset_ctl *modeset = data; | 1014 | struct drm_modeset_ctl *modeset = data; |
1015 | int crtc, ret = 0; | 1015 | int ret = 0; |
1016 | unsigned int crtc; | ||
1016 | 1017 | ||
1017 | /* If drm_vblank_init() hasn't been called yet, just no-op */ | 1018 | /* If drm_vblank_init() hasn't been called yet, just no-op */ |
1018 | if (!dev->num_crtcs) | 1019 | if (!dev->num_crtcs) |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 22a32b9932c5..79a04fde69b5 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -184,7 +184,7 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev) | |||
184 | static bool | 184 | static bool |
185 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | 185 | i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) |
186 | { | 186 | { |
187 | int tile_width; | 187 | int tile_width, tile_height; |
188 | 188 | ||
189 | /* Linear is always fine */ | 189 | /* Linear is always fine */ |
190 | if (tiling_mode == I915_TILING_NONE) | 190 | if (tiling_mode == I915_TILING_NONE) |
@@ -215,6 +215,20 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | if (IS_GEN2(dev) || | ||
219 | (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))) | ||
220 | tile_height = 32; | ||
221 | else | ||
222 | tile_height = 8; | ||
223 | /* i8xx is strange: It has 2 interleaved rows of tiles, so needs an even | ||
224 | * number of tile rows. */ | ||
225 | if (IS_GEN2(dev)) | ||
226 | tile_height *= 2; | ||
227 | |||
228 | /* Size needs to be aligned to a full tile row */ | ||
229 | if (size & (tile_height * stride - 1)) | ||
230 | return false; | ||
231 | |||
218 | /* 965+ just needs multiples of tile width */ | 232 | /* 965+ just needs multiples of tile width */ |
219 | if (INTEL_INFO(dev)->gen >= 4) { | 233 | if (INTEL_INFO(dev)->gen >= 4) { |
220 | if (stride & (tile_width - 1)) | 234 | if (stride & (tile_width - 1)) |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 97f946dcc1aa..8a9e08bf1cf7 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -316,6 +316,8 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
316 | struct drm_mode_config *mode_config = &dev->mode_config; | 316 | struct drm_mode_config *mode_config = &dev->mode_config; |
317 | struct intel_encoder *encoder; | 317 | struct intel_encoder *encoder; |
318 | 318 | ||
319 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); | ||
320 | |||
319 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) | 321 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) |
320 | if (encoder->hot_plug) | 322 | if (encoder->hot_plug) |
321 | encoder->hot_plug(encoder); | 323 | encoder->hot_plug(encoder); |
@@ -1649,9 +1651,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
1649 | } else { | 1651 | } else { |
1650 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | | 1652 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | |
1651 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; | 1653 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; |
1652 | hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; | 1654 | hotplug_mask |= SDE_AUX_MASK; |
1653 | I915_WRITE(FDI_RXA_IMR, 0); | ||
1654 | I915_WRITE(FDI_RXB_IMR, 0); | ||
1655 | } | 1655 | } |
1656 | 1656 | ||
1657 | dev_priv->pch_irq_mask = ~hotplug_mask; | 1657 | dev_priv->pch_irq_mask = ~hotplug_mask; |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b006536b3d2..e79b25bbee6c 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1630,19 +1630,19 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | 1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; |
1631 | 1631 | ||
1632 | wait_event(dev_priv->pending_flip_queue, | 1632 | wait_event(dev_priv->pending_flip_queue, |
1633 | atomic_read(&dev_priv->mm.wedged) || | ||
1633 | atomic_read(&obj->pending_flip) == 0); | 1634 | atomic_read(&obj->pending_flip) == 0); |
1634 | 1635 | ||
1635 | /* Big Hammer, we also need to ensure that any pending | 1636 | /* Big Hammer, we also need to ensure that any pending |
1636 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | 1637 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the |
1637 | * current scanout is retired before unpinning the old | 1638 | * current scanout is retired before unpinning the old |
1638 | * framebuffer. | 1639 | * framebuffer. |
1640 | * | ||
1641 | * This should only fail upon a hung GPU, in which case we | ||
1642 | * can safely continue. | ||
1639 | */ | 1643 | */ |
1640 | ret = i915_gem_object_flush_gpu(obj, false); | 1644 | ret = i915_gem_object_flush_gpu(obj, false); |
1641 | if (ret) { | 1645 | (void) ret; |
1642 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | ||
1643 | mutex_unlock(&dev->struct_mutex); | ||
1644 | return ret; | ||
1645 | } | ||
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
@@ -2045,6 +2045,31 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) | |||
2045 | atomic_read(&obj->pending_flip) == 0); | 2045 | atomic_read(&obj->pending_flip) == 0); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | static bool intel_crtc_driving_pch(struct drm_crtc *crtc) | ||
2049 | { | ||
2050 | struct drm_device *dev = crtc->dev; | ||
2051 | struct drm_mode_config *mode_config = &dev->mode_config; | ||
2052 | struct intel_encoder *encoder; | ||
2053 | |||
2054 | /* | ||
2055 | * If there's a non-PCH eDP on this crtc, it must be DP_A, and that | ||
2056 | * must be driven by its own crtc; no sharing is possible. | ||
2057 | */ | ||
2058 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { | ||
2059 | if (encoder->base.crtc != crtc) | ||
2060 | continue; | ||
2061 | |||
2062 | switch (encoder->type) { | ||
2063 | case INTEL_OUTPUT_EDP: | ||
2064 | if (!intel_encoder_is_pch_edp(&encoder->base)) | ||
2065 | return false; | ||
2066 | continue; | ||
2067 | } | ||
2068 | } | ||
2069 | |||
2070 | return true; | ||
2071 | } | ||
2072 | |||
2048 | static void ironlake_crtc_enable(struct drm_crtc *crtc) | 2073 | static void ironlake_crtc_enable(struct drm_crtc *crtc) |
2049 | { | 2074 | { |
2050 | struct drm_device *dev = crtc->dev; | 2075 | struct drm_device *dev = crtc->dev; |
@@ -2053,6 +2078,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2053 | int pipe = intel_crtc->pipe; | 2078 | int pipe = intel_crtc->pipe; |
2054 | int plane = intel_crtc->plane; | 2079 | int plane = intel_crtc->plane; |
2055 | u32 reg, temp; | 2080 | u32 reg, temp; |
2081 | bool is_pch_port = false; | ||
2056 | 2082 | ||
2057 | if (intel_crtc->active) | 2083 | if (intel_crtc->active) |
2058 | return; | 2084 | return; |
@@ -2066,7 +2092,56 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2066 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); | 2092 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); |
2067 | } | 2093 | } |
2068 | 2094 | ||
2069 | ironlake_fdi_enable(crtc); | 2095 | is_pch_port = intel_crtc_driving_pch(crtc); |
2096 | |||
2097 | if (is_pch_port) | ||
2098 | ironlake_fdi_enable(crtc); | ||
2099 | else { | ||
2100 | /* disable CPU FDI tx and PCH FDI rx */ | ||
2101 | reg = FDI_TX_CTL(pipe); | ||
2102 | temp = I915_READ(reg); | ||
2103 | I915_WRITE(reg, temp & ~FDI_TX_ENABLE); | ||
2104 | POSTING_READ(reg); | ||
2105 | |||
2106 | reg = FDI_RX_CTL(pipe); | ||
2107 | temp = I915_READ(reg); | ||
2108 | temp &= ~(0x7 << 16); | ||
2109 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2110 | I915_WRITE(reg, temp & ~FDI_RX_ENABLE); | ||
2111 | |||
2112 | POSTING_READ(reg); | ||
2113 | udelay(100); | ||
2114 | |||
2115 | /* Ironlake workaround, disable clock pointer after downing FDI */ | ||
2116 | if (HAS_PCH_IBX(dev)) | ||
2117 | I915_WRITE(FDI_RX_CHICKEN(pipe), | ||
2118 | I915_READ(FDI_RX_CHICKEN(pipe) & | ||
2119 | ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); | ||
2120 | |||
2121 | /* still set train pattern 1 */ | ||
2122 | reg = FDI_TX_CTL(pipe); | ||
2123 | temp = I915_READ(reg); | ||
2124 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2125 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2126 | I915_WRITE(reg, temp); | ||
2127 | |||
2128 | reg = FDI_RX_CTL(pipe); | ||
2129 | temp = I915_READ(reg); | ||
2130 | if (HAS_PCH_CPT(dev)) { | ||
2131 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; | ||
2132 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; | ||
2133 | } else { | ||
2134 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2135 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2136 | } | ||
2137 | /* BPC in FDI rx is consistent with that in PIPECONF */ | ||
2138 | temp &= ~(0x07 << 16); | ||
2139 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2140 | I915_WRITE(reg, temp); | ||
2141 | |||
2142 | POSTING_READ(reg); | ||
2143 | udelay(100); | ||
2144 | } | ||
2070 | 2145 | ||
2071 | /* Enable panel fitting for LVDS */ | 2146 | /* Enable panel fitting for LVDS */ |
2072 | if (dev_priv->pch_pf_size && | 2147 | if (dev_priv->pch_pf_size && |
@@ -2100,6 +2175,10 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2100 | intel_flush_display_plane(dev, plane); | 2175 | intel_flush_display_plane(dev, plane); |
2101 | } | 2176 | } |
2102 | 2177 | ||
2178 | /* Skip the PCH stuff if possible */ | ||
2179 | if (!is_pch_port) | ||
2180 | goto done; | ||
2181 | |||
2103 | /* For PCH output, training FDI link */ | 2182 | /* For PCH output, training FDI link */ |
2104 | if (IS_GEN6(dev)) | 2183 | if (IS_GEN6(dev)) |
2105 | gen6_fdi_link_train(crtc); | 2184 | gen6_fdi_link_train(crtc); |
@@ -2184,7 +2263,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2184 | I915_WRITE(reg, temp | TRANS_ENABLE); | 2263 | I915_WRITE(reg, temp | TRANS_ENABLE); |
2185 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) | 2264 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) |
2186 | DRM_ERROR("failed to enable transcoder %d\n", pipe); | 2265 | DRM_ERROR("failed to enable transcoder %d\n", pipe); |
2187 | 2266 | done: | |
2188 | intel_crtc_load_lut(crtc); | 2267 | intel_crtc_load_lut(crtc); |
2189 | intel_update_fbc(dev); | 2268 | intel_update_fbc(dev); |
2190 | intel_crtc_update_cursor(crtc, true); | 2269 | intel_crtc_update_cursor(crtc, true); |
@@ -6496,7 +6575,7 @@ static void ironlake_disable_rc6(struct drm_device *dev) | |||
6496 | POSTING_READ(RSTDBYCTL); | 6575 | POSTING_READ(RSTDBYCTL); |
6497 | } | 6576 | } |
6498 | 6577 | ||
6499 | ironlake_disable_rc6(dev); | 6578 | ironlake_teardown_rc6(dev); |
6500 | } | 6579 | } |
6501 | 6580 | ||
6502 | static int ironlake_setup_rc6(struct drm_device *dev) | 6581 | static int ironlake_setup_rc6(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index d38a4d9f9b0b..a52184007f5f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -49,7 +49,10 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
49 | DRM_ERROR("bo %p still attached to GEM object\n", bo); | 49 | DRM_ERROR("bo %p still attached to GEM object\n", bo); |
50 | 50 | ||
51 | nv10_mem_put_tile_region(dev, nvbo->tile, NULL); | 51 | nv10_mem_put_tile_region(dev, nvbo->tile, NULL); |
52 | nouveau_vm_put(&nvbo->vma); | 52 | if (nvbo->vma.node) { |
53 | nouveau_vm_unmap(&nvbo->vma); | ||
54 | nouveau_vm_put(&nvbo->vma); | ||
55 | } | ||
53 | kfree(nvbo); | 56 | kfree(nvbo); |
54 | } | 57 | } |
55 | 58 | ||
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c index 86d822aa9bbf..d46c0c758ddf 100644 --- a/drivers/hwmon/ad7414.c +++ b/drivers/hwmon/ad7414.c | |||
@@ -242,6 +242,7 @@ static const struct i2c_device_id ad7414_id[] = { | |||
242 | { "ad7414", 0 }, | 242 | { "ad7414", 0 }, |
243 | {} | 243 | {} |
244 | }; | 244 | }; |
245 | MODULE_DEVICE_TABLE(i2c, ad7414_id); | ||
245 | 246 | ||
246 | static struct i2c_driver ad7414_driver = { | 247 | static struct i2c_driver ad7414_driver = { |
247 | .driver = { | 248 | .driver = { |
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c index f13c843a2964..5cc3e3784b42 100644 --- a/drivers/hwmon/adt7411.c +++ b/drivers/hwmon/adt7411.c | |||
@@ -334,6 +334,7 @@ static const struct i2c_device_id adt7411_id[] = { | |||
334 | { "adt7411", 0 }, | 334 | { "adt7411", 0 }, |
335 | { } | 335 | { } |
336 | }; | 336 | }; |
337 | MODULE_DEVICE_TABLE(i2c, adt7411_id); | ||
337 | 338 | ||
338 | static struct i2c_driver adt7411_driver = { | 339 | static struct i2c_driver adt7411_driver = { |
339 | .driver = { | 340 | .driver = { |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 8a2f767f26d8..0ed7f6bc2a7f 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -216,7 +216,6 @@ static int linear_run (mddev_t *mddev) | |||
216 | 216 | ||
217 | if (md_check_no_bitmap(mddev)) | 217 | if (md_check_no_bitmap(mddev)) |
218 | return -EINVAL; | 218 | return -EINVAL; |
219 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
220 | conf = linear_conf(mddev, mddev->raid_disks); | 219 | conf = linear_conf(mddev, mddev->raid_disks); |
221 | 220 | ||
222 | if (!conf) | 221 | if (!conf) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0cc30ecda4c1..818313e277e7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -553,6 +553,9 @@ static mddev_t * mddev_find(dev_t unit) | |||
553 | { | 553 | { |
554 | mddev_t *mddev, *new = NULL; | 554 | mddev_t *mddev, *new = NULL; |
555 | 555 | ||
556 | if (unit && MAJOR(unit) != MD_MAJOR) | ||
557 | unit &= ~((1<<MdpMinorShift)-1); | ||
558 | |||
556 | retry: | 559 | retry: |
557 | spin_lock(&all_mddevs_lock); | 560 | spin_lock(&all_mddevs_lock); |
558 | 561 | ||
@@ -4138,10 +4141,10 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
4138 | } | 4141 | } |
4139 | 4142 | ||
4140 | mddev->array_sectors = sectors; | 4143 | mddev->array_sectors = sectors; |
4141 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4144 | if (mddev->pers) { |
4142 | if (mddev->pers) | 4145 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4143 | revalidate_disk(mddev->gendisk); | 4146 | revalidate_disk(mddev->gendisk); |
4144 | 4147 | } | |
4145 | return len; | 4148 | return len; |
4146 | } | 4149 | } |
4147 | 4150 | ||
@@ -4624,6 +4627,7 @@ static int do_md_run(mddev_t *mddev) | |||
4624 | } | 4627 | } |
4625 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4628 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4626 | revalidate_disk(mddev->gendisk); | 4629 | revalidate_disk(mddev->gendisk); |
4630 | mddev->changed = 1; | ||
4627 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | 4631 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); |
4628 | out: | 4632 | out: |
4629 | return err; | 4633 | return err; |
@@ -4712,6 +4716,7 @@ static void md_clean(mddev_t *mddev) | |||
4712 | mddev->sync_speed_min = mddev->sync_speed_max = 0; | 4716 | mddev->sync_speed_min = mddev->sync_speed_max = 0; |
4713 | mddev->recovery = 0; | 4717 | mddev->recovery = 0; |
4714 | mddev->in_sync = 0; | 4718 | mddev->in_sync = 0; |
4719 | mddev->changed = 0; | ||
4715 | mddev->degraded = 0; | 4720 | mddev->degraded = 0; |
4716 | mddev->safemode = 0; | 4721 | mddev->safemode = 0; |
4717 | mddev->bitmap_info.offset = 0; | 4722 | mddev->bitmap_info.offset = 0; |
@@ -4827,6 +4832,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4827 | 4832 | ||
4828 | set_capacity(disk, 0); | 4833 | set_capacity(disk, 0); |
4829 | mutex_unlock(&mddev->open_mutex); | 4834 | mutex_unlock(&mddev->open_mutex); |
4835 | mddev->changed = 1; | ||
4830 | revalidate_disk(disk); | 4836 | revalidate_disk(disk); |
4831 | 4837 | ||
4832 | if (mddev->ro) | 4838 | if (mddev->ro) |
@@ -6011,7 +6017,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
6011 | atomic_inc(&mddev->openers); | 6017 | atomic_inc(&mddev->openers); |
6012 | mutex_unlock(&mddev->open_mutex); | 6018 | mutex_unlock(&mddev->open_mutex); |
6013 | 6019 | ||
6014 | check_disk_size_change(mddev->gendisk, bdev); | 6020 | check_disk_change(bdev); |
6015 | out: | 6021 | out: |
6016 | return err; | 6022 | return err; |
6017 | } | 6023 | } |
@@ -6026,6 +6032,21 @@ static int md_release(struct gendisk *disk, fmode_t mode) | |||
6026 | 6032 | ||
6027 | return 0; | 6033 | return 0; |
6028 | } | 6034 | } |
6035 | |||
6036 | static int md_media_changed(struct gendisk *disk) | ||
6037 | { | ||
6038 | mddev_t *mddev = disk->private_data; | ||
6039 | |||
6040 | return mddev->changed; | ||
6041 | } | ||
6042 | |||
6043 | static int md_revalidate(struct gendisk *disk) | ||
6044 | { | ||
6045 | mddev_t *mddev = disk->private_data; | ||
6046 | |||
6047 | mddev->changed = 0; | ||
6048 | return 0; | ||
6049 | } | ||
6029 | static const struct block_device_operations md_fops = | 6050 | static const struct block_device_operations md_fops = |
6030 | { | 6051 | { |
6031 | .owner = THIS_MODULE, | 6052 | .owner = THIS_MODULE, |
@@ -6036,6 +6057,8 @@ static const struct block_device_operations md_fops = | |||
6036 | .compat_ioctl = md_compat_ioctl, | 6057 | .compat_ioctl = md_compat_ioctl, |
6037 | #endif | 6058 | #endif |
6038 | .getgeo = md_getgeo, | 6059 | .getgeo = md_getgeo, |
6060 | .media_changed = md_media_changed, | ||
6061 | .revalidate_disk= md_revalidate, | ||
6039 | }; | 6062 | }; |
6040 | 6063 | ||
6041 | static int md_thread(void * arg) | 6064 | static int md_thread(void * arg) |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 7e90b8593b2a..12215d437fcc 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -274,6 +274,8 @@ struct mddev_s | |||
274 | atomic_t active; /* general refcount */ | 274 | atomic_t active; /* general refcount */ |
275 | atomic_t openers; /* number of active opens */ | 275 | atomic_t openers; /* number of active opens */ |
276 | 276 | ||
277 | int changed; /* True if we might need to | ||
278 | * reread partition info */ | ||
277 | int degraded; /* whether md should consider | 279 | int degraded; /* whether md should consider |
278 | * adding a spare | 280 | * adding a spare |
279 | */ | 281 | */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 6d7ddf32ef2e..3a62d440e27b 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -435,7 +435,6 @@ static int multipath_run (mddev_t *mddev) | |||
435 | * bookkeeping area. [whatever we allocate in multipath_run(), | 435 | * bookkeeping area. [whatever we allocate in multipath_run(), |
436 | * should be freed in multipath_stop()] | 436 | * should be freed in multipath_stop()] |
437 | */ | 437 | */ |
438 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
439 | 438 | ||
440 | conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); | 439 | conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); |
441 | mddev->private = conf; | 440 | mddev->private = conf; |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 637a96855edb..c0ac457f1218 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -361,7 +361,6 @@ static int raid0_run(mddev_t *mddev) | |||
361 | if (md_check_no_bitmap(mddev)) | 361 | if (md_check_no_bitmap(mddev)) |
362 | return -EINVAL; | 362 | return -EINVAL; |
363 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); | 363 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); |
364 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
365 | 364 | ||
366 | /* if private is not null, we are here after takeover */ | 365 | /* if private is not null, we are here after takeover */ |
367 | if (mddev->private == NULL) { | 366 | if (mddev->private == NULL) { |
@@ -670,6 +669,7 @@ static void *raid0_takeover_raid1(mddev_t *mddev) | |||
670 | mddev->new_layout = 0; | 669 | mddev->new_layout = 0; |
671 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ | 670 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ |
672 | mddev->delta_disks = 1 - mddev->raid_disks; | 671 | mddev->delta_disks = 1 - mddev->raid_disks; |
672 | mddev->raid_disks = 1; | ||
673 | /* make sure it will be not marked as dirty */ | 673 | /* make sure it will be not marked as dirty */ |
674 | mddev->recovery_cp = MaxSector; | 674 | mddev->recovery_cp = MaxSector; |
675 | 675 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a23ffa397ba9..06cd712807d0 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -593,7 +593,10 @@ static int flush_pending_writes(conf_t *conf) | |||
593 | if (conf->pending_bio_list.head) { | 593 | if (conf->pending_bio_list.head) { |
594 | struct bio *bio; | 594 | struct bio *bio; |
595 | bio = bio_list_get(&conf->pending_bio_list); | 595 | bio = bio_list_get(&conf->pending_bio_list); |
596 | /* Only take the spinlock to quiet a warning */ | ||
597 | spin_lock(conf->mddev->queue->queue_lock); | ||
596 | blk_remove_plug(conf->mddev->queue); | 598 | blk_remove_plug(conf->mddev->queue); |
599 | spin_unlock(conf->mddev->queue->queue_lock); | ||
597 | spin_unlock_irq(&conf->device_lock); | 600 | spin_unlock_irq(&conf->device_lock); |
598 | /* flush any pending bitmap writes to | 601 | /* flush any pending bitmap writes to |
599 | * disk before proceeding w/ I/O */ | 602 | * disk before proceeding w/ I/O */ |
@@ -959,7 +962,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
959 | atomic_inc(&r1_bio->remaining); | 962 | atomic_inc(&r1_bio->remaining); |
960 | spin_lock_irqsave(&conf->device_lock, flags); | 963 | spin_lock_irqsave(&conf->device_lock, flags); |
961 | bio_list_add(&conf->pending_bio_list, mbio); | 964 | bio_list_add(&conf->pending_bio_list, mbio); |
962 | blk_plug_device(mddev->queue); | 965 | blk_plug_device_unlocked(mddev->queue); |
963 | spin_unlock_irqrestore(&conf->device_lock, flags); | 966 | spin_unlock_irqrestore(&conf->device_lock, flags); |
964 | } | 967 | } |
965 | r1_bio_write_done(r1_bio, bio->bi_vcnt, behind_pages, behind_pages != NULL); | 968 | r1_bio_write_done(r1_bio, bio->bi_vcnt, behind_pages, behind_pages != NULL); |
@@ -2021,7 +2024,6 @@ static int run(mddev_t *mddev) | |||
2021 | if (IS_ERR(conf)) | 2024 | if (IS_ERR(conf)) |
2022 | return PTR_ERR(conf); | 2025 | return PTR_ERR(conf); |
2023 | 2026 | ||
2024 | mddev->queue->queue_lock = &conf->device_lock; | ||
2025 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 2027 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
2026 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 2028 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
2027 | rdev->data_offset << 9); | 2029 | rdev->data_offset << 9); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3b607b28741b..747d061d8e05 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -662,7 +662,10 @@ static int flush_pending_writes(conf_t *conf) | |||
662 | if (conf->pending_bio_list.head) { | 662 | if (conf->pending_bio_list.head) { |
663 | struct bio *bio; | 663 | struct bio *bio; |
664 | bio = bio_list_get(&conf->pending_bio_list); | 664 | bio = bio_list_get(&conf->pending_bio_list); |
665 | /* Spinlock only taken to quiet a warning */ | ||
666 | spin_lock(conf->mddev->queue->queue_lock); | ||
665 | blk_remove_plug(conf->mddev->queue); | 667 | blk_remove_plug(conf->mddev->queue); |
668 | spin_unlock(conf->mddev->queue->queue_lock); | ||
666 | spin_unlock_irq(&conf->device_lock); | 669 | spin_unlock_irq(&conf->device_lock); |
667 | /* flush any pending bitmap writes to disk | 670 | /* flush any pending bitmap writes to disk |
668 | * before proceeding w/ I/O */ | 671 | * before proceeding w/ I/O */ |
@@ -971,7 +974,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
971 | atomic_inc(&r10_bio->remaining); | 974 | atomic_inc(&r10_bio->remaining); |
972 | spin_lock_irqsave(&conf->device_lock, flags); | 975 | spin_lock_irqsave(&conf->device_lock, flags); |
973 | bio_list_add(&conf->pending_bio_list, mbio); | 976 | bio_list_add(&conf->pending_bio_list, mbio); |
974 | blk_plug_device(mddev->queue); | 977 | blk_plug_device_unlocked(mddev->queue); |
975 | spin_unlock_irqrestore(&conf->device_lock, flags); | 978 | spin_unlock_irqrestore(&conf->device_lock, flags); |
976 | } | 979 | } |
977 | 980 | ||
@@ -2304,8 +2307,6 @@ static int run(mddev_t *mddev) | |||
2304 | if (!conf) | 2307 | if (!conf) |
2305 | goto out; | 2308 | goto out; |
2306 | 2309 | ||
2307 | mddev->queue->queue_lock = &conf->device_lock; | ||
2308 | |||
2309 | mddev->thread = conf->thread; | 2310 | mddev->thread = conf->thread; |
2310 | conf->thread = NULL; | 2311 | conf->thread = NULL; |
2311 | 2312 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 702812824195..78536fdbd87f 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5204,7 +5204,6 @@ static int run(mddev_t *mddev) | |||
5204 | 5204 | ||
5205 | mddev->queue->backing_dev_info.congested_data = mddev; | 5205 | mddev->queue->backing_dev_info.congested_data = mddev; |
5206 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 5206 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
5207 | mddev->queue->queue_lock = &conf->device_lock; | ||
5208 | mddev->queue->unplug_fn = raid5_unplug_queue; | 5207 | mddev->queue->unplug_fn = raid5_unplug_queue; |
5209 | 5208 | ||
5210 | chunk_size = mddev->chunk_sectors << 9; | 5209 | chunk_size = mddev->chunk_sectors << 9; |
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig index ffedfd492754..ea1580085347 100644 --- a/drivers/nfc/Kconfig +++ b/drivers/nfc/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig NFC_DEVICES | 5 | menuconfig NFC_DEVICES |
6 | bool "NFC devices" | 6 | bool "Near Field Communication (NFC) devices" |
7 | default n | 7 | default n |
8 | ---help--- | 8 | ---help--- |
9 | You'll have to say Y if your computer contains an NFC device that | 9 | You'll have to say Y if your computer contains an NFC device that |
diff --git a/drivers/nfc/pn544.c b/drivers/nfc/pn544.c index bae647264dd6..724f65d8f9e4 100644 --- a/drivers/nfc/pn544.c +++ b/drivers/nfc/pn544.c | |||
@@ -60,7 +60,7 @@ enum pn544_irq { | |||
60 | struct pn544_info { | 60 | struct pn544_info { |
61 | struct miscdevice miscdev; | 61 | struct miscdevice miscdev; |
62 | struct i2c_client *i2c_dev; | 62 | struct i2c_client *i2c_dev; |
63 | struct regulator_bulk_data regs[2]; | 63 | struct regulator_bulk_data regs[3]; |
64 | 64 | ||
65 | enum pn544_state state; | 65 | enum pn544_state state; |
66 | wait_queue_head_t read_wait; | 66 | wait_queue_head_t read_wait; |
@@ -74,6 +74,7 @@ struct pn544_info { | |||
74 | 74 | ||
75 | static const char reg_vdd_io[] = "Vdd_IO"; | 75 | static const char reg_vdd_io[] = "Vdd_IO"; |
76 | static const char reg_vbat[] = "VBat"; | 76 | static const char reg_vbat[] = "VBat"; |
77 | static const char reg_vsim[] = "VSim"; | ||
77 | 78 | ||
78 | /* sysfs interface */ | 79 | /* sysfs interface */ |
79 | static ssize_t pn544_test(struct device *dev, | 80 | static ssize_t pn544_test(struct device *dev, |
@@ -740,6 +741,7 @@ static int __devinit pn544_probe(struct i2c_client *client, | |||
740 | 741 | ||
741 | info->regs[0].supply = reg_vdd_io; | 742 | info->regs[0].supply = reg_vdd_io; |
742 | info->regs[1].supply = reg_vbat; | 743 | info->regs[1].supply = reg_vbat; |
744 | info->regs[2].supply = reg_vsim; | ||
743 | r = regulator_bulk_get(&client->dev, ARRAY_SIZE(info->regs), | 745 | r = regulator_bulk_get(&client->dev, ARRAY_SIZE(info->regs), |
744 | info->regs); | 746 | info->regs); |
745 | if (r < 0) | 747 | if (r < 0) |
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index cba1b43f7519..a4e8eb9fece6 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
@@ -168,7 +168,7 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event, | |||
168 | { | 168 | { |
169 | unsigned long flags; | 169 | unsigned long flags; |
170 | int captured = 0; | 170 | int captured = 0; |
171 | struct pps_ktime ts_real; | 171 | struct pps_ktime ts_real = { .sec = 0, .nsec = 0, .flags = 0 }; |
172 | 172 | ||
173 | /* check event type */ | 173 | /* check event type */ |
174 | BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); | 174 | BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); |
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 76b41853a877..1269fbd2deca 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -77,9 +77,9 @@ rio_read_config(struct file *filp, struct kobject *kobj, | |||
77 | 77 | ||
78 | /* Several chips lock up trying to read undefined config space */ | 78 | /* Several chips lock up trying to read undefined config space */ |
79 | if (capable(CAP_SYS_ADMIN)) | 79 | if (capable(CAP_SYS_ADMIN)) |
80 | size = 0x200000; | 80 | size = RIO_MAINT_SPACE_SZ; |
81 | 81 | ||
82 | if (off > size) | 82 | if (off >= size) |
83 | return 0; | 83 | return 0; |
84 | if (off + count > size) { | 84 | if (off + count > size) { |
85 | size -= off; | 85 | size -= off; |
@@ -147,10 +147,10 @@ rio_write_config(struct file *filp, struct kobject *kobj, | |||
147 | loff_t init_off = off; | 147 | loff_t init_off = off; |
148 | u8 *data = (u8 *) buf; | 148 | u8 *data = (u8 *) buf; |
149 | 149 | ||
150 | if (off > 0x200000) | 150 | if (off >= RIO_MAINT_SPACE_SZ) |
151 | return 0; | 151 | return 0; |
152 | if (off + count > 0x200000) { | 152 | if (off + count > RIO_MAINT_SPACE_SZ) { |
153 | size = 0x200000 - off; | 153 | size = RIO_MAINT_SPACE_SZ - off; |
154 | count = size; | 154 | count = size; |
155 | } | 155 | } |
156 | 156 | ||
@@ -200,7 +200,7 @@ static struct bin_attribute rio_config_attr = { | |||
200 | .name = "config", | 200 | .name = "config", |
201 | .mode = S_IRUGO | S_IWUSR, | 201 | .mode = S_IRUGO | S_IWUSR, |
202 | }, | 202 | }, |
203 | .size = 0x200000, | 203 | .size = RIO_MAINT_SPACE_SZ, |
204 | .read = rio_read_config, | 204 | .read = rio_read_config, |
205 | .write = rio_write_config, | 205 | .write = rio_write_config, |
206 | }; | 206 | }; |
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index f53d31b950d4..2bb5de1f2421 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
@@ -174,7 +174,7 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev) | |||
174 | 174 | ||
175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val); | 175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val); |
176 | 176 | ||
177 | BUG_ON(val < 0 || val > mc13xxx_regulators[id].desc.n_voltages); | 177 | BUG_ON(val > mc13xxx_regulators[id].desc.n_voltages); |
178 | 178 | ||
179 | return mc13xxx_regulators[id].voltages[val]; | 179 | return mc13xxx_regulators[id].voltages[val]; |
180 | } | 180 | } |
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 8b0d2c4bde91..06df898842c0 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -120,6 +120,7 @@ static unsigned int wm831x_dcdc_get_mode(struct regulator_dev *rdev) | |||
120 | return REGULATOR_MODE_IDLE; | 120 | return REGULATOR_MODE_IDLE; |
121 | default: | 121 | default: |
122 | BUG(); | 122 | BUG(); |
123 | return -EINVAL; | ||
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index c36749e4c926..5469c52cba3d 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -309,7 +309,7 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
309 | .read_alarm = at91_rtc_readalarm, | 309 | .read_alarm = at91_rtc_readalarm, |
310 | .set_alarm = at91_rtc_setalarm, | 310 | .set_alarm = at91_rtc_setalarm, |
311 | .proc = at91_rtc_proc, | 311 | .proc = at91_rtc_proc, |
312 | .alarm_irq_enabled = at91_rtc_alarm_irq_enable, | 312 | .alarm_irq_enable = at91_rtc_alarm_irq_enable, |
313 | }; | 313 | }; |
314 | 314 | ||
315 | /* | 315 | /* |
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 23a9ee19764c..950735415a7c 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C | 2 | * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2010 Freescale Semiconductor. | 4 | * Copyright (C) 2009-2011 Freescale Semiconductor. |
5 | * Author: Jack Lan <jack.lan@freescale.com> | 5 | * Author: Jack Lan <jack.lan@freescale.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -141,9 +141,11 @@ static int ds3232_read_time(struct device *dev, struct rtc_time *time) | |||
141 | time->tm_hour = bcd2bin(hour); | 141 | time->tm_hour = bcd2bin(hour); |
142 | } | 142 | } |
143 | 143 | ||
144 | time->tm_wday = bcd2bin(week); | 144 | /* Day of the week in linux range is 0~6 while 1~7 in RTC chip */ |
145 | time->tm_wday = bcd2bin(week) - 1; | ||
145 | time->tm_mday = bcd2bin(day); | 146 | time->tm_mday = bcd2bin(day); |
146 | time->tm_mon = bcd2bin(month & 0x7F); | 147 | /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ |
148 | time->tm_mon = bcd2bin(month & 0x7F) - 1; | ||
147 | if (century) | 149 | if (century) |
148 | add_century = 100; | 150 | add_century = 100; |
149 | 151 | ||
@@ -162,9 +164,11 @@ static int ds3232_set_time(struct device *dev, struct rtc_time *time) | |||
162 | buf[0] = bin2bcd(time->tm_sec); | 164 | buf[0] = bin2bcd(time->tm_sec); |
163 | buf[1] = bin2bcd(time->tm_min); | 165 | buf[1] = bin2bcd(time->tm_min); |
164 | buf[2] = bin2bcd(time->tm_hour); | 166 | buf[2] = bin2bcd(time->tm_hour); |
165 | buf[3] = bin2bcd(time->tm_wday); /* Day of the week */ | 167 | /* Day of the week in linux range is 0~6 while 1~7 in RTC chip */ |
168 | buf[3] = bin2bcd(time->tm_wday + 1); | ||
166 | buf[4] = bin2bcd(time->tm_mday); /* Date */ | 169 | buf[4] = bin2bcd(time->tm_mday); /* Date */ |
167 | buf[5] = bin2bcd(time->tm_mon); | 170 | /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ |
171 | buf[5] = bin2bcd(time->tm_mon + 1); | ||
168 | if (time->tm_year >= 100) { | 172 | if (time->tm_year >= 100) { |
169 | buf[5] |= 0x80; | 173 | buf[5] |= 0x80; |
170 | buf[6] = bin2bcd(time->tm_year - 100); | 174 | buf[6] = bin2bcd(time->tm_year - 100); |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index f7a5dba3ca23..bf7c687519ef 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig THERMAL | 5 | menuconfig THERMAL |
6 | tristate "Generic Thermal sysfs driver" | 6 | tristate "Generic Thermal sysfs driver" |
7 | depends on NET | ||
8 | help | 7 | help |
9 | Generic Thermal Sysfs driver offers a generic mechanism for | 8 | Generic Thermal Sysfs driver offers a generic mechanism for |
10 | thermal management. Usually it's made up of one or more thermal | 9 | thermal management. Usually it's made up of one or more thermal |
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 7d0e63c79280..713b7ea4a607 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c | |||
@@ -62,20 +62,6 @@ static DEFINE_MUTEX(thermal_list_lock); | |||
62 | 62 | ||
63 | static unsigned int thermal_event_seqnum; | 63 | static unsigned int thermal_event_seqnum; |
64 | 64 | ||
65 | static struct genl_family thermal_event_genl_family = { | ||
66 | .id = GENL_ID_GENERATE, | ||
67 | .name = THERMAL_GENL_FAMILY_NAME, | ||
68 | .version = THERMAL_GENL_VERSION, | ||
69 | .maxattr = THERMAL_GENL_ATTR_MAX, | ||
70 | }; | ||
71 | |||
72 | static struct genl_multicast_group thermal_event_mcgrp = { | ||
73 | .name = THERMAL_GENL_MCAST_GROUP_NAME, | ||
74 | }; | ||
75 | |||
76 | static int genetlink_init(void); | ||
77 | static void genetlink_exit(void); | ||
78 | |||
79 | static int get_idr(struct idr *idr, struct mutex *lock, int *id) | 65 | static int get_idr(struct idr *idr, struct mutex *lock, int *id) |
80 | { | 66 | { |
81 | int err; | 67 | int err; |
@@ -1225,6 +1211,18 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) | |||
1225 | 1211 | ||
1226 | EXPORT_SYMBOL(thermal_zone_device_unregister); | 1212 | EXPORT_SYMBOL(thermal_zone_device_unregister); |
1227 | 1213 | ||
1214 | #ifdef CONFIG_NET | ||
1215 | static struct genl_family thermal_event_genl_family = { | ||
1216 | .id = GENL_ID_GENERATE, | ||
1217 | .name = THERMAL_GENL_FAMILY_NAME, | ||
1218 | .version = THERMAL_GENL_VERSION, | ||
1219 | .maxattr = THERMAL_GENL_ATTR_MAX, | ||
1220 | }; | ||
1221 | |||
1222 | static struct genl_multicast_group thermal_event_mcgrp = { | ||
1223 | .name = THERMAL_GENL_MCAST_GROUP_NAME, | ||
1224 | }; | ||
1225 | |||
1228 | int generate_netlink_event(u32 orig, enum events event) | 1226 | int generate_netlink_event(u32 orig, enum events event) |
1229 | { | 1227 | { |
1230 | struct sk_buff *skb; | 1228 | struct sk_buff *skb; |
@@ -1301,6 +1299,15 @@ static int genetlink_init(void) | |||
1301 | return result; | 1299 | return result; |
1302 | } | 1300 | } |
1303 | 1301 | ||
1302 | static void genetlink_exit(void) | ||
1303 | { | ||
1304 | genl_unregister_family(&thermal_event_genl_family); | ||
1305 | } | ||
1306 | #else /* !CONFIG_NET */ | ||
1307 | static inline int genetlink_init(void) { return 0; } | ||
1308 | static inline void genetlink_exit(void) {} | ||
1309 | #endif /* !CONFIG_NET */ | ||
1310 | |||
1304 | static int __init thermal_init(void) | 1311 | static int __init thermal_init(void) |
1305 | { | 1312 | { |
1306 | int result = 0; | 1313 | int result = 0; |
@@ -1316,11 +1323,6 @@ static int __init thermal_init(void) | |||
1316 | return result; | 1323 | return result; |
1317 | } | 1324 | } |
1318 | 1325 | ||
1319 | static void genetlink_exit(void) | ||
1320 | { | ||
1321 | genl_unregister_family(&thermal_event_genl_family); | ||
1322 | } | ||
1323 | |||
1324 | static void __exit thermal_exit(void) | 1326 | static void __exit thermal_exit(void) |
1325 | { | 1327 | { |
1326 | class_unregister(&thermal_class); | 1328 | class_unregister(&thermal_class); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d041c6826e43..0f299b7aad60 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2681,17 +2681,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2681 | 2681 | ||
2682 | mutex_lock(&usb_address0_mutex); | 2682 | mutex_lock(&usb_address0_mutex); |
2683 | 2683 | ||
2684 | if (!udev->config && oldspeed == USB_SPEED_SUPER) { | 2684 | /* Reset the device; full speed may morph to high speed */ |
2685 | /* Don't reset USB 3.0 devices during an initial setup */ | 2685 | /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ |
2686 | usb_set_device_state(udev, USB_STATE_DEFAULT); | 2686 | retval = hub_port_reset(hub, port1, udev, delay); |
2687 | } else { | 2687 | if (retval < 0) /* error or disconnect */ |
2688 | /* Reset the device; full speed may morph to high speed */ | 2688 | goto fail; |
2689 | /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ | 2689 | /* success, speed is known */ |
2690 | retval = hub_port_reset(hub, port1, udev, delay); | 2690 | |
2691 | if (retval < 0) /* error or disconnect */ | ||
2692 | goto fail; | ||
2693 | /* success, speed is known */ | ||
2694 | } | ||
2695 | retval = -ENODEV; | 2691 | retval = -ENODEV; |
2696 | 2692 | ||
2697 | if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) { | 2693 | if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) { |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index fcbf4abbf381..0231814a97a5 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -169,9 +169,10 @@ static void xhci_print_ports(struct xhci_hcd *xhci) | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num) | 172 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num) |
173 | { | 173 | { |
174 | void *addr; | 174 | struct xhci_intr_reg __iomem *ir_set = &xhci->run_regs->ir_set[set_num]; |
175 | void __iomem *addr; | ||
175 | u32 temp; | 176 | u32 temp; |
176 | u64 temp_64; | 177 | u64 temp_64; |
177 | 178 | ||
@@ -449,7 +450,7 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci, | |||
449 | } | 450 | } |
450 | } | 451 | } |
451 | 452 | ||
452 | void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | 453 | static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) |
453 | { | 454 | { |
454 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 455 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
455 | int field_size = 32 / 8; | 456 | int field_size = 32 / 8; |
@@ -488,7 +489,7 @@ void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | |||
488 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); | 489 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); |
489 | } | 490 | } |
490 | 491 | ||
491 | void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, | 492 | static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, |
492 | struct xhci_container_ctx *ctx, | 493 | struct xhci_container_ctx *ctx, |
493 | unsigned int last_ep) | 494 | unsigned int last_ep) |
494 | { | 495 | { |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1d0f45f0e7a6..a9534396e85b 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -307,7 +307,7 @@ struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, | |||
307 | 307 | ||
308 | /***************** Streams structures manipulation *************************/ | 308 | /***************** Streams structures manipulation *************************/ |
309 | 309 | ||
310 | void xhci_free_stream_ctx(struct xhci_hcd *xhci, | 310 | static void xhci_free_stream_ctx(struct xhci_hcd *xhci, |
311 | unsigned int num_stream_ctxs, | 311 | unsigned int num_stream_ctxs, |
312 | struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) | 312 | struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) |
313 | { | 313 | { |
@@ -335,7 +335,7 @@ void xhci_free_stream_ctx(struct xhci_hcd *xhci, | |||
335 | * The stream context array must be a power of 2, and can be as small as | 335 | * The stream context array must be a power of 2, and can be as small as |
336 | * 64 bytes or as large as 1MB. | 336 | * 64 bytes or as large as 1MB. |
337 | */ | 337 | */ |
338 | struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, | 338 | static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, |
339 | unsigned int num_stream_ctxs, dma_addr_t *dma, | 339 | unsigned int num_stream_ctxs, dma_addr_t *dma, |
340 | gfp_t mem_flags) | 340 | gfp_t mem_flags) |
341 | { | 341 | { |
@@ -1900,11 +1900,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1900 | val &= DBOFF_MASK; | 1900 | val &= DBOFF_MASK; |
1901 | xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" | 1901 | xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" |
1902 | " from cap regs base addr\n", val); | 1902 | " from cap regs base addr\n", val); |
1903 | xhci->dba = (void *) xhci->cap_regs + val; | 1903 | xhci->dba = (void __iomem *) xhci->cap_regs + val; |
1904 | xhci_dbg_regs(xhci); | 1904 | xhci_dbg_regs(xhci); |
1905 | xhci_print_run_regs(xhci); | 1905 | xhci_print_run_regs(xhci); |
1906 | /* Set ir_set to interrupt register set 0 */ | 1906 | /* Set ir_set to interrupt register set 0 */ |
1907 | xhci->ir_set = (void *) xhci->run_regs->ir_set; | 1907 | xhci->ir_set = &xhci->run_regs->ir_set[0]; |
1908 | 1908 | ||
1909 | /* | 1909 | /* |
1910 | * Event ring setup: Allocate a normal ring, but also setup | 1910 | * Event ring setup: Allocate a normal ring, but also setup |
@@ -1961,7 +1961,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1961 | /* Set the event ring dequeue address */ | 1961 | /* Set the event ring dequeue address */ |
1962 | xhci_set_hc_event_deq(xhci); | 1962 | xhci_set_hc_event_deq(xhci); |
1963 | xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n"); | 1963 | xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n"); |
1964 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 1964 | xhci_print_ir_set(xhci, 0); |
1965 | 1965 | ||
1966 | /* | 1966 | /* |
1967 | * XXX: Might need to set the Interrupter Moderation Register to | 1967 | * XXX: Might need to set the Interrupter Moderation Register to |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 3e8211c1ce5a..3289bf4832c9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -474,8 +474,11 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
474 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, | 474 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, |
475 | dev->eps[ep_index].stopped_trb, | 475 | dev->eps[ep_index].stopped_trb, |
476 | &state->new_cycle_state); | 476 | &state->new_cycle_state); |
477 | if (!state->new_deq_seg) | 477 | if (!state->new_deq_seg) { |
478 | BUG(); | 478 | WARN_ON(1); |
479 | return; | ||
480 | } | ||
481 | |||
479 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ | 482 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
480 | xhci_dbg(xhci, "Finding endpoint context\n"); | 483 | xhci_dbg(xhci, "Finding endpoint context\n"); |
481 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); | 484 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); |
@@ -486,8 +489,10 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
486 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, | 489 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, |
487 | state->new_deq_ptr, | 490 | state->new_deq_ptr, |
488 | &state->new_cycle_state); | 491 | &state->new_cycle_state); |
489 | if (!state->new_deq_seg) | 492 | if (!state->new_deq_seg) { |
490 | BUG(); | 493 | WARN_ON(1); |
494 | return; | ||
495 | } | ||
491 | 496 | ||
492 | trb = &state->new_deq_ptr->generic; | 497 | trb = &state->new_deq_ptr->generic; |
493 | if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && | 498 | if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && |
@@ -2363,12 +2368,13 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2363 | 2368 | ||
2364 | /* Scatter gather list entries may cross 64KB boundaries */ | 2369 | /* Scatter gather list entries may cross 64KB boundaries */ |
2365 | running_total = TRB_MAX_BUFF_SIZE - | 2370 | running_total = TRB_MAX_BUFF_SIZE - |
2366 | (sg_dma_address(sg) & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2371 | (sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1)); |
2372 | running_total &= TRB_MAX_BUFF_SIZE - 1; | ||
2367 | if (running_total != 0) | 2373 | if (running_total != 0) |
2368 | num_trbs++; | 2374 | num_trbs++; |
2369 | 2375 | ||
2370 | /* How many more 64KB chunks to transfer, how many more TRBs? */ | 2376 | /* How many more 64KB chunks to transfer, how many more TRBs? */ |
2371 | while (running_total < sg_dma_len(sg)) { | 2377 | while (running_total < sg_dma_len(sg) && running_total < temp) { |
2372 | num_trbs++; | 2378 | num_trbs++; |
2373 | running_total += TRB_MAX_BUFF_SIZE; | 2379 | running_total += TRB_MAX_BUFF_SIZE; |
2374 | } | 2380 | } |
@@ -2394,11 +2400,11 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2394 | static void check_trb_math(struct urb *urb, int num_trbs, int running_total) | 2400 | static void check_trb_math(struct urb *urb, int num_trbs, int running_total) |
2395 | { | 2401 | { |
2396 | if (num_trbs != 0) | 2402 | if (num_trbs != 0) |
2397 | dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " | 2403 | dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " |
2398 | "TRBs, %d left\n", __func__, | 2404 | "TRBs, %d left\n", __func__, |
2399 | urb->ep->desc.bEndpointAddress, num_trbs); | 2405 | urb->ep->desc.bEndpointAddress, num_trbs); |
2400 | if (running_total != urb->transfer_buffer_length) | 2406 | if (running_total != urb->transfer_buffer_length) |
2401 | dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " | 2407 | dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " |
2402 | "queued %#x (%d), asked for %#x (%d)\n", | 2408 | "queued %#x (%d), asked for %#x (%d)\n", |
2403 | __func__, | 2409 | __func__, |
2404 | urb->ep->desc.bEndpointAddress, | 2410 | urb->ep->desc.bEndpointAddress, |
@@ -2533,8 +2539,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2533 | sg = urb->sg; | 2539 | sg = urb->sg; |
2534 | addr = (u64) sg_dma_address(sg); | 2540 | addr = (u64) sg_dma_address(sg); |
2535 | this_sg_len = sg_dma_len(sg); | 2541 | this_sg_len = sg_dma_len(sg); |
2536 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2542 | trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2537 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | ||
2538 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); | 2543 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); |
2539 | if (trb_buff_len > urb->transfer_buffer_length) | 2544 | if (trb_buff_len > urb->transfer_buffer_length) |
2540 | trb_buff_len = urb->transfer_buffer_length; | 2545 | trb_buff_len = urb->transfer_buffer_length; |
@@ -2572,7 +2577,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2572 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), | 2577 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), |
2573 | (unsigned int) addr + trb_buff_len); | 2578 | (unsigned int) addr + trb_buff_len); |
2574 | if (TRB_MAX_BUFF_SIZE - | 2579 | if (TRB_MAX_BUFF_SIZE - |
2575 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)) < trb_buff_len) { | 2580 | (addr & (TRB_MAX_BUFF_SIZE - 1)) < trb_buff_len) { |
2576 | xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n"); | 2581 | xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n"); |
2577 | xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n", | 2582 | xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n", |
2578 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), | 2583 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), |
@@ -2616,7 +2621,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2616 | } | 2621 | } |
2617 | 2622 | ||
2618 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2623 | trb_buff_len = TRB_MAX_BUFF_SIZE - |
2619 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2624 | (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2620 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); | 2625 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); |
2621 | if (running_total + trb_buff_len > urb->transfer_buffer_length) | 2626 | if (running_total + trb_buff_len > urb->transfer_buffer_length) |
2622 | trb_buff_len = | 2627 | trb_buff_len = |
@@ -2656,7 +2661,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2656 | num_trbs = 0; | 2661 | num_trbs = 0; |
2657 | /* How much data is (potentially) left before the 64KB boundary? */ | 2662 | /* How much data is (potentially) left before the 64KB boundary? */ |
2658 | running_total = TRB_MAX_BUFF_SIZE - | 2663 | running_total = TRB_MAX_BUFF_SIZE - |
2659 | (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2664 | (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); |
2665 | running_total &= TRB_MAX_BUFF_SIZE - 1; | ||
2660 | 2666 | ||
2661 | /* If there's some data on this 64KB chunk, or we have to send a | 2667 | /* If there's some data on this 64KB chunk, or we have to send a |
2662 | * zero-length transfer, we need at least one TRB | 2668 | * zero-length transfer, we need at least one TRB |
@@ -2700,8 +2706,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2700 | /* How much data is in the first TRB? */ | 2706 | /* How much data is in the first TRB? */ |
2701 | addr = (u64) urb->transfer_dma; | 2707 | addr = (u64) urb->transfer_dma; |
2702 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2708 | trb_buff_len = TRB_MAX_BUFF_SIZE - |
2703 | (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2709 | (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); |
2704 | if (urb->transfer_buffer_length < trb_buff_len) | 2710 | if (trb_buff_len > urb->transfer_buffer_length) |
2705 | trb_buff_len = urb->transfer_buffer_length; | 2711 | trb_buff_len = urb->transfer_buffer_length; |
2706 | 2712 | ||
2707 | first_trb = true; | 2713 | first_trb = true; |
@@ -2879,8 +2885,8 @@ static int count_isoc_trbs_needed(struct xhci_hcd *xhci, | |||
2879 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); | 2885 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); |
2880 | td_len = urb->iso_frame_desc[i].length; | 2886 | td_len = urb->iso_frame_desc[i].length; |
2881 | 2887 | ||
2882 | running_total = TRB_MAX_BUFF_SIZE - | 2888 | running_total = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2883 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2889 | running_total &= TRB_MAX_BUFF_SIZE - 1; |
2884 | if (running_total != 0) | 2890 | if (running_total != 0) |
2885 | num_trbs++; | 2891 | num_trbs++; |
2886 | 2892 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 34cf4e165877..2083fc2179b2 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -109,7 +109,7 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
109 | /* | 109 | /* |
110 | * Set the run bit and wait for the host to be running. | 110 | * Set the run bit and wait for the host to be running. |
111 | */ | 111 | */ |
112 | int xhci_start(struct xhci_hcd *xhci) | 112 | static int xhci_start(struct xhci_hcd *xhci) |
113 | { | 113 | { |
114 | u32 temp; | 114 | u32 temp; |
115 | int ret; | 115 | int ret; |
@@ -329,7 +329,7 @@ int xhci_init(struct usb_hcd *hcd) | |||
329 | 329 | ||
330 | 330 | ||
331 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 331 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
332 | void xhci_event_ring_work(unsigned long arg) | 332 | static void xhci_event_ring_work(unsigned long arg) |
333 | { | 333 | { |
334 | unsigned long flags; | 334 | unsigned long flags; |
335 | int temp; | 335 | int temp; |
@@ -473,7 +473,7 @@ int xhci_run(struct usb_hcd *hcd) | |||
473 | xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); | 473 | xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); |
474 | xhci_writel(xhci, ER_IRQ_ENABLE(temp), | 474 | xhci_writel(xhci, ER_IRQ_ENABLE(temp), |
475 | &xhci->ir_set->irq_pending); | 475 | &xhci->ir_set->irq_pending); |
476 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 476 | xhci_print_ir_set(xhci, 0); |
477 | 477 | ||
478 | if (NUM_TEST_NOOPS > 0) | 478 | if (NUM_TEST_NOOPS > 0) |
479 | doorbell = xhci_setup_one_noop(xhci); | 479 | doorbell = xhci_setup_one_noop(xhci); |
@@ -528,7 +528,7 @@ void xhci_stop(struct usb_hcd *hcd) | |||
528 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 528 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
529 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), | 529 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), |
530 | &xhci->ir_set->irq_pending); | 530 | &xhci->ir_set->irq_pending); |
531 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 531 | xhci_print_ir_set(xhci, 0); |
532 | 532 | ||
533 | xhci_dbg(xhci, "cleaning up memory\n"); | 533 | xhci_dbg(xhci, "cleaning up memory\n"); |
534 | xhci_mem_cleanup(xhci); | 534 | xhci_mem_cleanup(xhci); |
@@ -755,7 +755,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
755 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 755 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
756 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), | 756 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), |
757 | &xhci->ir_set->irq_pending); | 757 | &xhci->ir_set->irq_pending); |
758 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 758 | xhci_print_ir_set(xhci, 0); |
759 | 759 | ||
760 | xhci_dbg(xhci, "cleaning up memory\n"); | 760 | xhci_dbg(xhci, "cleaning up memory\n"); |
761 | xhci_mem_cleanup(xhci); | 761 | xhci_mem_cleanup(xhci); |
@@ -857,7 +857,7 @@ unsigned int xhci_last_valid_endpoint(u32 added_ctxs) | |||
857 | /* Returns 1 if the arguments are OK; | 857 | /* Returns 1 if the arguments are OK; |
858 | * returns 0 this is a root hub; returns -EINVAL for NULL pointers. | 858 | * returns 0 this is a root hub; returns -EINVAL for NULL pointers. |
859 | */ | 859 | */ |
860 | int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, | 860 | static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, |
861 | struct usb_host_endpoint *ep, int check_ep, bool check_virt_dev, | 861 | struct usb_host_endpoint *ep, int check_ep, bool check_virt_dev, |
862 | const char *func) { | 862 | const char *func) { |
863 | struct xhci_hcd *xhci; | 863 | struct xhci_hcd *xhci; |
@@ -1693,7 +1693,7 @@ static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci, | |||
1693 | xhci_dbg_ctx(xhci, in_ctx, xhci_last_valid_endpoint(add_flags)); | 1693 | xhci_dbg_ctx(xhci, in_ctx, xhci_last_valid_endpoint(add_flags)); |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, | 1696 | static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, |
1697 | unsigned int slot_id, unsigned int ep_index, | 1697 | unsigned int slot_id, unsigned int ep_index, |
1698 | struct xhci_dequeue_state *deq_state) | 1698 | struct xhci_dequeue_state *deq_state) |
1699 | { | 1699 | { |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 7f236fd22015..7f127df6dd55 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1348,7 +1348,7 @@ static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci) | |||
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | /* xHCI debugging */ | 1350 | /* xHCI debugging */ |
1351 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num); | 1351 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num); |
1352 | void xhci_print_registers(struct xhci_hcd *xhci); | 1352 | void xhci_print_registers(struct xhci_hcd *xhci); |
1353 | void xhci_dbg_regs(struct xhci_hcd *xhci); | 1353 | void xhci_dbg_regs(struct xhci_hcd *xhci); |
1354 | void xhci_print_run_regs(struct xhci_hcd *xhci); | 1354 | void xhci_print_run_regs(struct xhci_hcd *xhci); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 54a8bd1047d6..c292d5c499e7 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1864,6 +1864,7 @@ allocate_instance(struct device *dev, | |||
1864 | INIT_LIST_HEAD(&musb->out_bulk); | 1864 | INIT_LIST_HEAD(&musb->out_bulk); |
1865 | 1865 | ||
1866 | hcd->uses_new_polling = 1; | 1866 | hcd->uses_new_polling = 1; |
1867 | hcd->has_tt = 1; | ||
1867 | 1868 | ||
1868 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; | 1869 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; |
1869 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; | 1870 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; |
diff --git a/fs/afs/write.c b/fs/afs/write.c index 15690bb1d3b5..789b3afb3423 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -140,6 +140,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, | |||
140 | candidate->first = candidate->last = index; | 140 | candidate->first = candidate->last = index; |
141 | candidate->offset_first = from; | 141 | candidate->offset_first = from; |
142 | candidate->to_last = to; | 142 | candidate->to_last = to; |
143 | INIT_LIST_HEAD(&candidate->link); | ||
143 | candidate->usage = 1; | 144 | candidate->usage = 1; |
144 | candidate->state = AFS_WBACK_PENDING; | 145 | candidate->state = AFS_WBACK_PENDING; |
145 | init_waitqueue_head(&candidate->waitq); | 146 | init_waitqueue_head(&candidate->waitq); |
@@ -239,15 +239,23 @@ static void __put_ioctx(struct kioctx *ctx) | |||
239 | call_rcu(&ctx->rcu_head, ctx_rcu_free); | 239 | call_rcu(&ctx->rcu_head, ctx_rcu_free); |
240 | } | 240 | } |
241 | 241 | ||
242 | #define get_ioctx(kioctx) do { \ | 242 | static inline void get_ioctx(struct kioctx *kioctx) |
243 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | 243 | { |
244 | atomic_inc(&(kioctx)->users); \ | 244 | BUG_ON(atomic_read(&kioctx->users) <= 0); |
245 | } while (0) | 245 | atomic_inc(&kioctx->users); |
246 | #define put_ioctx(kioctx) do { \ | 246 | } |
247 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | 247 | |
248 | if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ | 248 | static inline int try_get_ioctx(struct kioctx *kioctx) |
249 | __put_ioctx(kioctx); \ | 249 | { |
250 | } while (0) | 250 | return atomic_inc_not_zero(&kioctx->users); |
251 | } | ||
252 | |||
253 | static inline void put_ioctx(struct kioctx *kioctx) | ||
254 | { | ||
255 | BUG_ON(atomic_read(&kioctx->users) <= 0); | ||
256 | if (unlikely(atomic_dec_and_test(&kioctx->users))) | ||
257 | __put_ioctx(kioctx); | ||
258 | } | ||
251 | 259 | ||
252 | /* ioctx_alloc | 260 | /* ioctx_alloc |
253 | * Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. | 261 | * Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. |
@@ -601,8 +609,13 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) | |||
601 | rcu_read_lock(); | 609 | rcu_read_lock(); |
602 | 610 | ||
603 | hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) { | 611 | hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) { |
604 | if (ctx->user_id == ctx_id && !ctx->dead) { | 612 | /* |
605 | get_ioctx(ctx); | 613 | * RCU protects us against accessing freed memory but |
614 | * we have to be careful not to get a reference when the | ||
615 | * reference count already dropped to 0 (ctx->dead test | ||
616 | * is unreliable because of races). | ||
617 | */ | ||
618 | if (ctx->user_id == ctx_id && !ctx->dead && try_get_ioctx(ctx)){ | ||
606 | ret = ctx; | 619 | ret = ctx; |
607 | break; | 620 | break; |
608 | } | 621 | } |
@@ -1629,6 +1642,23 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1629 | goto out_put_req; | 1642 | goto out_put_req; |
1630 | 1643 | ||
1631 | spin_lock_irq(&ctx->ctx_lock); | 1644 | spin_lock_irq(&ctx->ctx_lock); |
1645 | /* | ||
1646 | * We could have raced with io_destroy() and are currently holding a | ||
1647 | * reference to ctx which should be destroyed. We cannot submit IO | ||
1648 | * since ctx gets freed as soon as io_submit() puts its reference. The | ||
1649 | * check here is reliable: io_destroy() sets ctx->dead before waiting | ||
1650 | * for outstanding IO and the barrier between these two is realized by | ||
1651 | * unlock of mm->ioctx_lock and lock of ctx->ctx_lock. Analogously we | ||
1652 | * increment ctx->reqs_active before checking for ctx->dead and the | ||
1653 | * barrier is realized by unlock and lock of ctx->ctx_lock. Thus if we | ||
1654 | * don't see ctx->dead set here, io_destroy() waits for our IO to | ||
1655 | * finish. | ||
1656 | */ | ||
1657 | if (ctx->dead) { | ||
1658 | spin_unlock_irq(&ctx->ctx_lock); | ||
1659 | ret = -EINVAL; | ||
1660 | goto out_put_req; | ||
1661 | } | ||
1632 | aio_run_iocb(req); | 1662 | aio_run_iocb(req); |
1633 | if (!list_empty(&ctx->run_list)) { | 1663 | if (!list_empty(&ctx->run_list)) { |
1634 | /* drain the run list */ | 1664 | /* drain the run list */ |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 4fb8a3431531..889287019599 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -873,6 +873,11 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk) | |||
873 | ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); | 873 | ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); |
874 | if (ret) | 874 | if (ret) |
875 | goto out_del; | 875 | goto out_del; |
876 | /* | ||
877 | * bdev could be deleted beneath us which would implicitly destroy | ||
878 | * the holder directory. Hold on to it. | ||
879 | */ | ||
880 | kobject_get(bdev->bd_part->holder_dir); | ||
876 | 881 | ||
877 | list_add(&holder->list, &bdev->bd_holder_disks); | 882 | list_add(&holder->list, &bdev->bd_holder_disks); |
878 | goto out_unlock; | 883 | goto out_unlock; |
@@ -909,6 +914,7 @@ void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk) | |||
909 | del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); | 914 | del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); |
910 | del_symlink(bdev->bd_part->holder_dir, | 915 | del_symlink(bdev->bd_part->holder_dir, |
911 | &disk_to_dev(disk)->kobj); | 916 | &disk_to_dev(disk)->kobj); |
917 | kobject_put(bdev->bd_part->holder_dir); | ||
912 | list_del_init(&holder->list); | 918 | list_del_init(&holder->list); |
913 | kfree(holder); | 919 | kfree(holder); |
914 | } | 920 | } |
@@ -922,14 +928,15 @@ EXPORT_SYMBOL_GPL(bd_unlink_disk_holder); | |||
922 | * flush_disk - invalidates all buffer-cache entries on a disk | 928 | * flush_disk - invalidates all buffer-cache entries on a disk |
923 | * | 929 | * |
924 | * @bdev: struct block device to be flushed | 930 | * @bdev: struct block device to be flushed |
931 | * @kill_dirty: flag to guide handling of dirty inodes | ||
925 | * | 932 | * |
926 | * Invalidates all buffer-cache entries on a disk. It should be called | 933 | * Invalidates all buffer-cache entries on a disk. It should be called |
927 | * when a disk has been changed -- either by a media change or online | 934 | * when a disk has been changed -- either by a media change or online |
928 | * resize. | 935 | * resize. |
929 | */ | 936 | */ |
930 | static void flush_disk(struct block_device *bdev) | 937 | static void flush_disk(struct block_device *bdev, bool kill_dirty) |
931 | { | 938 | { |
932 | if (__invalidate_device(bdev)) { | 939 | if (__invalidate_device(bdev, kill_dirty)) { |
933 | char name[BDEVNAME_SIZE] = ""; | 940 | char name[BDEVNAME_SIZE] = ""; |
934 | 941 | ||
935 | if (bdev->bd_disk) | 942 | if (bdev->bd_disk) |
@@ -966,7 +973,7 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) | |||
966 | "%s: detected capacity change from %lld to %lld\n", | 973 | "%s: detected capacity change from %lld to %lld\n", |
967 | name, bdev_size, disk_size); | 974 | name, bdev_size, disk_size); |
968 | i_size_write(bdev->bd_inode, disk_size); | 975 | i_size_write(bdev->bd_inode, disk_size); |
969 | flush_disk(bdev); | 976 | flush_disk(bdev, false); |
970 | } | 977 | } |
971 | } | 978 | } |
972 | EXPORT_SYMBOL(check_disk_size_change); | 979 | EXPORT_SYMBOL(check_disk_size_change); |
@@ -1019,7 +1026,7 @@ int check_disk_change(struct block_device *bdev) | |||
1019 | if (!(events & DISK_EVENT_MEDIA_CHANGE)) | 1026 | if (!(events & DISK_EVENT_MEDIA_CHANGE)) |
1020 | return 0; | 1027 | return 0; |
1021 | 1028 | ||
1022 | flush_disk(bdev); | 1029 | flush_disk(bdev, true); |
1023 | if (bdops->revalidate_disk) | 1030 | if (bdops->revalidate_disk) |
1024 | bdops->revalidate_disk(bdev->bd_disk); | 1031 | bdops->revalidate_disk(bdev->bd_disk); |
1025 | return 1; | 1032 | return 1; |
@@ -1600,7 +1607,7 @@ fail: | |||
1600 | } | 1607 | } |
1601 | EXPORT_SYMBOL(lookup_bdev); | 1608 | EXPORT_SYMBOL(lookup_bdev); |
1602 | 1609 | ||
1603 | int __invalidate_device(struct block_device *bdev) | 1610 | int __invalidate_device(struct block_device *bdev, bool kill_dirty) |
1604 | { | 1611 | { |
1605 | struct super_block *sb = get_super(bdev); | 1612 | struct super_block *sb = get_super(bdev); |
1606 | int res = 0; | 1613 | int res = 0; |
@@ -1613,7 +1620,7 @@ int __invalidate_device(struct block_device *bdev) | |||
1613 | * hold). | 1620 | * hold). |
1614 | */ | 1621 | */ |
1615 | shrink_dcache_sb(sb); | 1622 | shrink_dcache_sb(sb); |
1616 | res = invalidate_inodes(sb); | 1623 | res = invalidate_inodes(sb, kill_dirty); |
1617 | drop_super(sb); | 1624 | drop_super(sb); |
1618 | } | 1625 | } |
1619 | invalidate_bdev(bdev); | 1626 | invalidate_bdev(bdev); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 2c98b3af6052..6f820fa23df4 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1254,6 +1254,7 @@ struct btrfs_root { | |||
1254 | #define BTRFS_MOUNT_SPACE_CACHE (1 << 12) | 1254 | #define BTRFS_MOUNT_SPACE_CACHE (1 << 12) |
1255 | #define BTRFS_MOUNT_CLEAR_CACHE (1 << 13) | 1255 | #define BTRFS_MOUNT_CLEAR_CACHE (1 << 13) |
1256 | #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) | 1256 | #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) |
1257 | #define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15) | ||
1257 | 1258 | ||
1258 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1259 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1259 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1260 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
@@ -2218,6 +2219,8 @@ int btrfs_error_unpin_extent_range(struct btrfs_root *root, | |||
2218 | u64 start, u64 end); | 2219 | u64 start, u64 end); |
2219 | int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, | 2220 | int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, |
2220 | u64 num_bytes); | 2221 | u64 num_bytes); |
2222 | int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | ||
2223 | struct btrfs_root *root, u64 type); | ||
2221 | 2224 | ||
2222 | /* ctree.c */ | 2225 | /* ctree.c */ |
2223 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, | 2226 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f3c96fc01439..588ff9849873 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5376,7 +5376,7 @@ again: | |||
5376 | num_bytes, data, 1); | 5376 | num_bytes, data, 1); |
5377 | goto again; | 5377 | goto again; |
5378 | } | 5378 | } |
5379 | if (ret == -ENOSPC) { | 5379 | if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) { |
5380 | struct btrfs_space_info *sinfo; | 5380 | struct btrfs_space_info *sinfo; |
5381 | 5381 | ||
5382 | sinfo = __find_space_info(root->fs_info, data); | 5382 | sinfo = __find_space_info(root->fs_info, data); |
@@ -8065,6 +8065,13 @@ out: | |||
8065 | return ret; | 8065 | return ret; |
8066 | } | 8066 | } |
8067 | 8067 | ||
8068 | int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | ||
8069 | struct btrfs_root *root, u64 type) | ||
8070 | { | ||
8071 | u64 alloc_flags = get_alloc_profile(root, type); | ||
8072 | return do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, 1); | ||
8073 | } | ||
8074 | |||
8068 | /* | 8075 | /* |
8069 | * helper to account the unused space of all the readonly block group in the | 8076 | * helper to account the unused space of all the readonly block group in the |
8070 | * list. takes mirrors into account. | 8077 | * list. takes mirrors into account. |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 92ac5192c518..fd3f172e94e6 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1433,12 +1433,13 @@ int extent_clear_unlock_delalloc(struct inode *inode, | |||
1433 | */ | 1433 | */ |
1434 | u64 count_range_bits(struct extent_io_tree *tree, | 1434 | u64 count_range_bits(struct extent_io_tree *tree, |
1435 | u64 *start, u64 search_end, u64 max_bytes, | 1435 | u64 *start, u64 search_end, u64 max_bytes, |
1436 | unsigned long bits) | 1436 | unsigned long bits, int contig) |
1437 | { | 1437 | { |
1438 | struct rb_node *node; | 1438 | struct rb_node *node; |
1439 | struct extent_state *state; | 1439 | struct extent_state *state; |
1440 | u64 cur_start = *start; | 1440 | u64 cur_start = *start; |
1441 | u64 total_bytes = 0; | 1441 | u64 total_bytes = 0; |
1442 | u64 last = 0; | ||
1442 | int found = 0; | 1443 | int found = 0; |
1443 | 1444 | ||
1444 | if (search_end <= cur_start) { | 1445 | if (search_end <= cur_start) { |
@@ -1463,7 +1464,9 @@ u64 count_range_bits(struct extent_io_tree *tree, | |||
1463 | state = rb_entry(node, struct extent_state, rb_node); | 1464 | state = rb_entry(node, struct extent_state, rb_node); |
1464 | if (state->start > search_end) | 1465 | if (state->start > search_end) |
1465 | break; | 1466 | break; |
1466 | if (state->end >= cur_start && (state->state & bits)) { | 1467 | if (contig && found && state->start > last + 1) |
1468 | break; | ||
1469 | if (state->end >= cur_start && (state->state & bits) == bits) { | ||
1467 | total_bytes += min(search_end, state->end) + 1 - | 1470 | total_bytes += min(search_end, state->end) + 1 - |
1468 | max(cur_start, state->start); | 1471 | max(cur_start, state->start); |
1469 | if (total_bytes >= max_bytes) | 1472 | if (total_bytes >= max_bytes) |
@@ -1472,6 +1475,9 @@ u64 count_range_bits(struct extent_io_tree *tree, | |||
1472 | *start = state->start; | 1475 | *start = state->start; |
1473 | found = 1; | 1476 | found = 1; |
1474 | } | 1477 | } |
1478 | last = state->end; | ||
1479 | } else if (contig && found) { | ||
1480 | break; | ||
1475 | } | 1481 | } |
1476 | node = rb_next(node); | 1482 | node = rb_next(node); |
1477 | if (!node) | 1483 | if (!node) |
@@ -2912,6 +2918,46 @@ out: | |||
2912 | return sector; | 2918 | return sector; |
2913 | } | 2919 | } |
2914 | 2920 | ||
2921 | /* | ||
2922 | * helper function for fiemap, which doesn't want to see any holes. | ||
2923 | * This maps until we find something past 'last' | ||
2924 | */ | ||
2925 | static struct extent_map *get_extent_skip_holes(struct inode *inode, | ||
2926 | u64 offset, | ||
2927 | u64 last, | ||
2928 | get_extent_t *get_extent) | ||
2929 | { | ||
2930 | u64 sectorsize = BTRFS_I(inode)->root->sectorsize; | ||
2931 | struct extent_map *em; | ||
2932 | u64 len; | ||
2933 | |||
2934 | if (offset >= last) | ||
2935 | return NULL; | ||
2936 | |||
2937 | while(1) { | ||
2938 | len = last - offset; | ||
2939 | if (len == 0) | ||
2940 | break; | ||
2941 | len = (len + sectorsize - 1) & ~(sectorsize - 1); | ||
2942 | em = get_extent(inode, NULL, 0, offset, len, 0); | ||
2943 | if (!em || IS_ERR(em)) | ||
2944 | return em; | ||
2945 | |||
2946 | /* if this isn't a hole return it */ | ||
2947 | if (!test_bit(EXTENT_FLAG_VACANCY, &em->flags) && | ||
2948 | em->block_start != EXTENT_MAP_HOLE) { | ||
2949 | return em; | ||
2950 | } | ||
2951 | |||
2952 | /* this is a hole, advance to the next extent */ | ||
2953 | offset = extent_map_end(em); | ||
2954 | free_extent_map(em); | ||
2955 | if (offset >= last) | ||
2956 | break; | ||
2957 | } | ||
2958 | return NULL; | ||
2959 | } | ||
2960 | |||
2915 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 2961 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
2916 | __u64 start, __u64 len, get_extent_t *get_extent) | 2962 | __u64 start, __u64 len, get_extent_t *get_extent) |
2917 | { | 2963 | { |
@@ -2921,16 +2967,19 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2921 | u32 flags = 0; | 2967 | u32 flags = 0; |
2922 | u32 found_type; | 2968 | u32 found_type; |
2923 | u64 last; | 2969 | u64 last; |
2970 | u64 last_for_get_extent = 0; | ||
2924 | u64 disko = 0; | 2971 | u64 disko = 0; |
2972 | u64 isize = i_size_read(inode); | ||
2925 | struct btrfs_key found_key; | 2973 | struct btrfs_key found_key; |
2926 | struct extent_map *em = NULL; | 2974 | struct extent_map *em = NULL; |
2927 | struct extent_state *cached_state = NULL; | 2975 | struct extent_state *cached_state = NULL; |
2928 | struct btrfs_path *path; | 2976 | struct btrfs_path *path; |
2929 | struct btrfs_file_extent_item *item; | 2977 | struct btrfs_file_extent_item *item; |
2930 | int end = 0; | 2978 | int end = 0; |
2931 | u64 em_start = 0, em_len = 0; | 2979 | u64 em_start = 0; |
2980 | u64 em_len = 0; | ||
2981 | u64 em_end = 0; | ||
2932 | unsigned long emflags; | 2982 | unsigned long emflags; |
2933 | int hole = 0; | ||
2934 | 2983 | ||
2935 | if (len == 0) | 2984 | if (len == 0) |
2936 | return -EINVAL; | 2985 | return -EINVAL; |
@@ -2940,6 +2989,10 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2940 | return -ENOMEM; | 2989 | return -ENOMEM; |
2941 | path->leave_spinning = 1; | 2990 | path->leave_spinning = 1; |
2942 | 2991 | ||
2992 | /* | ||
2993 | * lookup the last file extent. We're not using i_size here | ||
2994 | * because there might be preallocation past i_size | ||
2995 | */ | ||
2943 | ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root, | 2996 | ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root, |
2944 | path, inode->i_ino, -1, 0); | 2997 | path, inode->i_ino, -1, 0); |
2945 | if (ret < 0) { | 2998 | if (ret < 0) { |
@@ -2953,18 +3006,38 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2953 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); | 3006 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); |
2954 | found_type = btrfs_key_type(&found_key); | 3007 | found_type = btrfs_key_type(&found_key); |
2955 | 3008 | ||
2956 | /* No extents, just return */ | 3009 | /* No extents, but there might be delalloc bits */ |
2957 | if (found_key.objectid != inode->i_ino || | 3010 | if (found_key.objectid != inode->i_ino || |
2958 | found_type != BTRFS_EXTENT_DATA_KEY) { | 3011 | found_type != BTRFS_EXTENT_DATA_KEY) { |
2959 | btrfs_free_path(path); | 3012 | /* have to trust i_size as the end */ |
2960 | return 0; | 3013 | last = (u64)-1; |
3014 | last_for_get_extent = isize; | ||
3015 | } else { | ||
3016 | /* | ||
3017 | * remember the start of the last extent. There are a | ||
3018 | * bunch of different factors that go into the length of the | ||
3019 | * extent, so its much less complex to remember where it started | ||
3020 | */ | ||
3021 | last = found_key.offset; | ||
3022 | last_for_get_extent = last + 1; | ||
2961 | } | 3023 | } |
2962 | last = found_key.offset; | ||
2963 | btrfs_free_path(path); | 3024 | btrfs_free_path(path); |
2964 | 3025 | ||
3026 | /* | ||
3027 | * we might have some extents allocated but more delalloc past those | ||
3028 | * extents. so, we trust isize unless the start of the last extent is | ||
3029 | * beyond isize | ||
3030 | */ | ||
3031 | if (last < isize) { | ||
3032 | last = (u64)-1; | ||
3033 | last_for_get_extent = isize; | ||
3034 | } | ||
3035 | |||
2965 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, | 3036 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, |
2966 | &cached_state, GFP_NOFS); | 3037 | &cached_state, GFP_NOFS); |
2967 | em = get_extent(inode, NULL, 0, off, max - off, 0); | 3038 | |
3039 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | ||
3040 | get_extent); | ||
2968 | if (!em) | 3041 | if (!em) |
2969 | goto out; | 3042 | goto out; |
2970 | if (IS_ERR(em)) { | 3043 | if (IS_ERR(em)) { |
@@ -2973,19 +3046,14 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2973 | } | 3046 | } |
2974 | 3047 | ||
2975 | while (!end) { | 3048 | while (!end) { |
2976 | hole = 0; | 3049 | off = extent_map_end(em); |
2977 | off = em->start + em->len; | ||
2978 | if (off >= max) | 3050 | if (off >= max) |
2979 | end = 1; | 3051 | end = 1; |
2980 | 3052 | ||
2981 | if (em->block_start == EXTENT_MAP_HOLE) { | ||
2982 | hole = 1; | ||
2983 | goto next; | ||
2984 | } | ||
2985 | |||
2986 | em_start = em->start; | 3053 | em_start = em->start; |
2987 | em_len = em->len; | 3054 | em_len = em->len; |
2988 | 3055 | em_end = extent_map_end(em); | |
3056 | emflags = em->flags; | ||
2989 | disko = 0; | 3057 | disko = 0; |
2990 | flags = 0; | 3058 | flags = 0; |
2991 | 3059 | ||
@@ -3004,37 +3072,29 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3004 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) | 3072 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) |
3005 | flags |= FIEMAP_EXTENT_ENCODED; | 3073 | flags |= FIEMAP_EXTENT_ENCODED; |
3006 | 3074 | ||
3007 | next: | ||
3008 | emflags = em->flags; | ||
3009 | free_extent_map(em); | 3075 | free_extent_map(em); |
3010 | em = NULL; | 3076 | em = NULL; |
3011 | if (!end) { | 3077 | if ((em_start >= last) || em_len == (u64)-1 || |
3012 | em = get_extent(inode, NULL, 0, off, max - off, 0); | 3078 | (last == (u64)-1 && isize <= em_end)) { |
3013 | if (!em) | ||
3014 | goto out; | ||
3015 | if (IS_ERR(em)) { | ||
3016 | ret = PTR_ERR(em); | ||
3017 | goto out; | ||
3018 | } | ||
3019 | emflags = em->flags; | ||
3020 | } | ||
3021 | |||
3022 | if (test_bit(EXTENT_FLAG_VACANCY, &emflags)) { | ||
3023 | flags |= FIEMAP_EXTENT_LAST; | 3079 | flags |= FIEMAP_EXTENT_LAST; |
3024 | end = 1; | 3080 | end = 1; |
3025 | } | 3081 | } |
3026 | 3082 | ||
3027 | if (em_start == last) { | 3083 | /* now scan forward to see if this is really the last extent. */ |
3084 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | ||
3085 | get_extent); | ||
3086 | if (IS_ERR(em)) { | ||
3087 | ret = PTR_ERR(em); | ||
3088 | goto out; | ||
3089 | } | ||
3090 | if (!em) { | ||
3028 | flags |= FIEMAP_EXTENT_LAST; | 3091 | flags |= FIEMAP_EXTENT_LAST; |
3029 | end = 1; | 3092 | end = 1; |
3030 | } | 3093 | } |
3031 | 3094 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | |
3032 | if (!hole) { | 3095 | em_len, flags); |
3033 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | 3096 | if (ret) |
3034 | em_len, flags); | 3097 | goto out_free; |
3035 | if (ret) | ||
3036 | goto out_free; | ||
3037 | } | ||
3038 | } | 3098 | } |
3039 | out_free: | 3099 | out_free: |
3040 | free_extent_map(em); | 3100 | free_extent_map(em); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 7083cfafd061..9318dfefd59c 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -191,7 +191,7 @@ void extent_io_exit(void); | |||
191 | 191 | ||
192 | u64 count_range_bits(struct extent_io_tree *tree, | 192 | u64 count_range_bits(struct extent_io_tree *tree, |
193 | u64 *start, u64 search_end, | 193 | u64 *start, u64 search_end, |
194 | u64 max_bytes, unsigned long bits); | 194 | u64 max_bytes, unsigned long bits, int contig); |
195 | 195 | ||
196 | void free_extent_state(struct extent_state *state); | 196 | void free_extent_state(struct extent_state *state); |
197 | int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, | 197 | int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fb9bd7832b6d..0efdb65953c5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1913,7 +1913,7 @@ static int btrfs_clean_io_failures(struct inode *inode, u64 start) | |||
1913 | 1913 | ||
1914 | private = 0; | 1914 | private = 0; |
1915 | if (count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, | 1915 | if (count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, |
1916 | (u64)-1, 1, EXTENT_DIRTY)) { | 1916 | (u64)-1, 1, EXTENT_DIRTY, 0)) { |
1917 | ret = get_state_private(&BTRFS_I(inode)->io_failure_tree, | 1917 | ret = get_state_private(&BTRFS_I(inode)->io_failure_tree, |
1918 | start, &private_failure); | 1918 | start, &private_failure); |
1919 | if (ret == 0) { | 1919 | if (ret == 0) { |
@@ -5280,6 +5280,128 @@ out: | |||
5280 | return em; | 5280 | return em; |
5281 | } | 5281 | } |
5282 | 5282 | ||
5283 | struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *page, | ||
5284 | size_t pg_offset, u64 start, u64 len, | ||
5285 | int create) | ||
5286 | { | ||
5287 | struct extent_map *em; | ||
5288 | struct extent_map *hole_em = NULL; | ||
5289 | u64 range_start = start; | ||
5290 | u64 end; | ||
5291 | u64 found; | ||
5292 | u64 found_end; | ||
5293 | int err = 0; | ||
5294 | |||
5295 | em = btrfs_get_extent(inode, page, pg_offset, start, len, create); | ||
5296 | if (IS_ERR(em)) | ||
5297 | return em; | ||
5298 | if (em) { | ||
5299 | /* | ||
5300 | * if our em maps to a hole, there might | ||
5301 | * actually be delalloc bytes behind it | ||
5302 | */ | ||
5303 | if (em->block_start != EXTENT_MAP_HOLE) | ||
5304 | return em; | ||
5305 | else | ||
5306 | hole_em = em; | ||
5307 | } | ||
5308 | |||
5309 | /* check to see if we've wrapped (len == -1 or similar) */ | ||
5310 | end = start + len; | ||
5311 | if (end < start) | ||
5312 | end = (u64)-1; | ||
5313 | else | ||
5314 | end -= 1; | ||
5315 | |||
5316 | em = NULL; | ||
5317 | |||
5318 | /* ok, we didn't find anything, lets look for delalloc */ | ||
5319 | found = count_range_bits(&BTRFS_I(inode)->io_tree, &range_start, | ||
5320 | end, len, EXTENT_DELALLOC, 1); | ||
5321 | found_end = range_start + found; | ||
5322 | if (found_end < range_start) | ||
5323 | found_end = (u64)-1; | ||
5324 | |||
5325 | /* | ||
5326 | * we didn't find anything useful, return | ||
5327 | * the original results from get_extent() | ||
5328 | */ | ||
5329 | if (range_start > end || found_end <= start) { | ||
5330 | em = hole_em; | ||
5331 | hole_em = NULL; | ||
5332 | goto out; | ||
5333 | } | ||
5334 | |||
5335 | /* adjust the range_start to make sure it doesn't | ||
5336 | * go backwards from the start they passed in | ||
5337 | */ | ||
5338 | range_start = max(start,range_start); | ||
5339 | found = found_end - range_start; | ||
5340 | |||
5341 | if (found > 0) { | ||
5342 | u64 hole_start = start; | ||
5343 | u64 hole_len = len; | ||
5344 | |||
5345 | em = alloc_extent_map(GFP_NOFS); | ||
5346 | if (!em) { | ||
5347 | err = -ENOMEM; | ||
5348 | goto out; | ||
5349 | } | ||
5350 | /* | ||
5351 | * when btrfs_get_extent can't find anything it | ||
5352 | * returns one huge hole | ||
5353 | * | ||
5354 | * make sure what it found really fits our range, and | ||
5355 | * adjust to make sure it is based on the start from | ||
5356 | * the caller | ||
5357 | */ | ||
5358 | if (hole_em) { | ||
5359 | u64 calc_end = extent_map_end(hole_em); | ||
5360 | |||
5361 | if (calc_end <= start || (hole_em->start > end)) { | ||
5362 | free_extent_map(hole_em); | ||
5363 | hole_em = NULL; | ||
5364 | } else { | ||
5365 | hole_start = max(hole_em->start, start); | ||
5366 | hole_len = calc_end - hole_start; | ||
5367 | } | ||
5368 | } | ||
5369 | em->bdev = NULL; | ||
5370 | if (hole_em && range_start > hole_start) { | ||
5371 | /* our hole starts before our delalloc, so we | ||
5372 | * have to return just the parts of the hole | ||
5373 | * that go until the delalloc starts | ||
5374 | */ | ||
5375 | em->len = min(hole_len, | ||
5376 | range_start - hole_start); | ||
5377 | em->start = hole_start; | ||
5378 | em->orig_start = hole_start; | ||
5379 | /* | ||
5380 | * don't adjust block start at all, | ||
5381 | * it is fixed at EXTENT_MAP_HOLE | ||
5382 | */ | ||
5383 | em->block_start = hole_em->block_start; | ||
5384 | em->block_len = hole_len; | ||
5385 | } else { | ||
5386 | em->start = range_start; | ||
5387 | em->len = found; | ||
5388 | em->orig_start = range_start; | ||
5389 | em->block_start = EXTENT_MAP_DELALLOC; | ||
5390 | em->block_len = found; | ||
5391 | } | ||
5392 | } else if (hole_em) { | ||
5393 | return hole_em; | ||
5394 | } | ||
5395 | out: | ||
5396 | |||
5397 | free_extent_map(hole_em); | ||
5398 | if (err) { | ||
5399 | free_extent_map(em); | ||
5400 | return ERR_PTR(err); | ||
5401 | } | ||
5402 | return em; | ||
5403 | } | ||
5404 | |||
5283 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | 5405 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, |
5284 | u64 start, u64 len) | 5406 | u64 start, u64 len) |
5285 | { | 5407 | { |
@@ -6102,7 +6224,7 @@ out: | |||
6102 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 6224 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
6103 | __u64 start, __u64 len) | 6225 | __u64 start, __u64 len) |
6104 | { | 6226 | { |
6105 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent); | 6227 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent_fiemap); |
6106 | } | 6228 | } |
6107 | 6229 | ||
6108 | int btrfs_readpage(struct file *file, struct page *page) | 6230 | int btrfs_readpage(struct file *file, struct page *page) |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index be2d4f6aaa5e..5fdb2abc4fa7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1071,12 +1071,15 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1071 | if (copy_from_user(&flags, arg, sizeof(flags))) | 1071 | if (copy_from_user(&flags, arg, sizeof(flags))) |
1072 | return -EFAULT; | 1072 | return -EFAULT; |
1073 | 1073 | ||
1074 | if (flags & ~BTRFS_SUBVOL_CREATE_ASYNC) | 1074 | if (flags & BTRFS_SUBVOL_CREATE_ASYNC) |
1075 | return -EINVAL; | 1075 | return -EINVAL; |
1076 | 1076 | ||
1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) | 1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) |
1078 | return -EOPNOTSUPP; | 1078 | return -EOPNOTSUPP; |
1079 | 1079 | ||
1080 | if (!is_owner_or_cap(inode)) | ||
1081 | return -EACCES; | ||
1082 | |||
1080 | down_write(&root->fs_info->subvol_sem); | 1083 | down_write(&root->fs_info->subvol_sem); |
1081 | 1084 | ||
1082 | /* nothing to do */ | 1085 | /* nothing to do */ |
@@ -1097,7 +1100,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1097 | goto out_reset; | 1100 | goto out_reset; |
1098 | } | 1101 | } |
1099 | 1102 | ||
1100 | ret = btrfs_update_root(trans, root, | 1103 | ret = btrfs_update_root(trans, root->fs_info->tree_root, |
1101 | &root->root_key, &root->root_item); | 1104 | &root->root_key, &root->root_item); |
1102 | 1105 | ||
1103 | btrfs_commit_transaction(trans, root); | 1106 | btrfs_commit_transaction(trans, root); |
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index cc9b450399df..a178f5ebea78 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c | |||
@@ -280,6 +280,7 @@ static int lzo_decompress_biovec(struct list_head *ws, | |||
280 | unsigned long tot_out; | 280 | unsigned long tot_out; |
281 | unsigned long tot_len; | 281 | unsigned long tot_len; |
282 | char *buf; | 282 | char *buf; |
283 | bool may_late_unmap, need_unmap; | ||
283 | 284 | ||
284 | data_in = kmap(pages_in[0]); | 285 | data_in = kmap(pages_in[0]); |
285 | tot_len = read_compress_length(data_in); | 286 | tot_len = read_compress_length(data_in); |
@@ -300,11 +301,13 @@ static int lzo_decompress_biovec(struct list_head *ws, | |||
300 | 301 | ||
301 | tot_in += in_len; | 302 | tot_in += in_len; |
302 | working_bytes = in_len; | 303 | working_bytes = in_len; |
304 | may_late_unmap = need_unmap = false; | ||
303 | 305 | ||
304 | /* fast path: avoid using the working buffer */ | 306 | /* fast path: avoid using the working buffer */ |
305 | if (in_page_bytes_left >= in_len) { | 307 | if (in_page_bytes_left >= in_len) { |
306 | buf = data_in + in_offset; | 308 | buf = data_in + in_offset; |
307 | bytes = in_len; | 309 | bytes = in_len; |
310 | may_late_unmap = true; | ||
308 | goto cont; | 311 | goto cont; |
309 | } | 312 | } |
310 | 313 | ||
@@ -329,14 +332,17 @@ cont: | |||
329 | if (working_bytes == 0 && tot_in >= tot_len) | 332 | if (working_bytes == 0 && tot_in >= tot_len) |
330 | break; | 333 | break; |
331 | 334 | ||
332 | kunmap(pages_in[page_in_index]); | 335 | if (page_in_index + 1 >= total_pages_in) { |
333 | page_in_index++; | ||
334 | if (page_in_index >= total_pages_in) { | ||
335 | ret = -1; | 336 | ret = -1; |
336 | data_in = NULL; | ||
337 | goto done; | 337 | goto done; |
338 | } | 338 | } |
339 | data_in = kmap(pages_in[page_in_index]); | 339 | |
340 | if (may_late_unmap) | ||
341 | need_unmap = true; | ||
342 | else | ||
343 | kunmap(pages_in[page_in_index]); | ||
344 | |||
345 | data_in = kmap(pages_in[++page_in_index]); | ||
340 | 346 | ||
341 | in_page_bytes_left = PAGE_CACHE_SIZE; | 347 | in_page_bytes_left = PAGE_CACHE_SIZE; |
342 | in_offset = 0; | 348 | in_offset = 0; |
@@ -346,6 +352,8 @@ cont: | |||
346 | out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); | 352 | out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); |
347 | ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, | 353 | ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, |
348 | &out_len); | 354 | &out_len); |
355 | if (need_unmap) | ||
356 | kunmap(pages_in[page_in_index - 1]); | ||
349 | if (ret != LZO_E_OK) { | 357 | if (ret != LZO_E_OK) { |
350 | printk(KERN_WARNING "btrfs decompress failed\n"); | 358 | printk(KERN_WARNING "btrfs decompress failed\n"); |
351 | ret = -1; | 359 | ret = -1; |
@@ -363,8 +371,7 @@ cont: | |||
363 | break; | 371 | break; |
364 | } | 372 | } |
365 | done: | 373 | done: |
366 | if (data_in) | 374 | kunmap(pages_in[page_in_index]); |
367 | kunmap(pages_in[page_in_index]); | ||
368 | return ret; | 375 | return ret; |
369 | } | 376 | } |
370 | 377 | ||
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0825e4ed9447..31ade5802ae8 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3654,6 +3654,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3654 | u32 item_size; | 3654 | u32 item_size; |
3655 | int ret; | 3655 | int ret; |
3656 | int err = 0; | 3656 | int err = 0; |
3657 | int progress = 0; | ||
3657 | 3658 | ||
3658 | path = btrfs_alloc_path(); | 3659 | path = btrfs_alloc_path(); |
3659 | if (!path) | 3660 | if (!path) |
@@ -3666,9 +3667,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3666 | } | 3667 | } |
3667 | 3668 | ||
3668 | while (1) { | 3669 | while (1) { |
3670 | progress++; | ||
3669 | trans = btrfs_start_transaction(rc->extent_root, 0); | 3671 | trans = btrfs_start_transaction(rc->extent_root, 0); |
3670 | BUG_ON(IS_ERR(trans)); | 3672 | BUG_ON(IS_ERR(trans)); |
3671 | 3673 | restart: | |
3672 | if (update_backref_cache(trans, &rc->backref_cache)) { | 3674 | if (update_backref_cache(trans, &rc->backref_cache)) { |
3673 | btrfs_end_transaction(trans, rc->extent_root); | 3675 | btrfs_end_transaction(trans, rc->extent_root); |
3674 | continue; | 3676 | continue; |
@@ -3781,6 +3783,15 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3781 | } | 3783 | } |
3782 | } | 3784 | } |
3783 | } | 3785 | } |
3786 | if (trans && progress && err == -ENOSPC) { | ||
3787 | ret = btrfs_force_chunk_alloc(trans, rc->extent_root, | ||
3788 | rc->block_group->flags); | ||
3789 | if (ret == 0) { | ||
3790 | err = 0; | ||
3791 | progress = 0; | ||
3792 | goto restart; | ||
3793 | } | ||
3794 | } | ||
3784 | 3795 | ||
3785 | btrfs_release_path(rc->extent_root, path); | 3796 | btrfs_release_path(rc->extent_root, path); |
3786 | clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, | 3797 | clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a004008f7d28..d39a9895d932 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -155,7 +155,8 @@ enum { | |||
155 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, | 155 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, |
156 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, | 156 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, |
157 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, | 157 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, |
158 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, Opt_err, | 158 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, |
159 | Opt_enospc_debug, Opt_err, | ||
159 | }; | 160 | }; |
160 | 161 | ||
161 | static match_table_t tokens = { | 162 | static match_table_t tokens = { |
@@ -184,6 +185,7 @@ static match_table_t tokens = { | |||
184 | {Opt_space_cache, "space_cache"}, | 185 | {Opt_space_cache, "space_cache"}, |
185 | {Opt_clear_cache, "clear_cache"}, | 186 | {Opt_clear_cache, "clear_cache"}, |
186 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, | 187 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, |
188 | {Opt_enospc_debug, "enospc_debug"}, | ||
187 | {Opt_err, NULL}, | 189 | {Opt_err, NULL}, |
188 | }; | 190 | }; |
189 | 191 | ||
@@ -358,6 +360,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
358 | case Opt_user_subvol_rm_allowed: | 360 | case Opt_user_subvol_rm_allowed: |
359 | btrfs_set_opt(info->mount_opt, USER_SUBVOL_RM_ALLOWED); | 361 | btrfs_set_opt(info->mount_opt, USER_SUBVOL_RM_ALLOWED); |
360 | break; | 362 | break; |
363 | case Opt_enospc_debug: | ||
364 | btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG); | ||
365 | break; | ||
361 | case Opt_err: | 366 | case Opt_err: |
362 | printk(KERN_INFO "btrfs: unrecognized mount option " | 367 | printk(KERN_INFO "btrfs: unrecognized mount option " |
363 | "'%s'\n", p); | 368 | "'%s'\n", p); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index af7dbca15276..dd13eb81ee40 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1338,11 +1338,11 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1338 | 1338 | ||
1339 | ret = btrfs_shrink_device(device, 0); | 1339 | ret = btrfs_shrink_device(device, 0); |
1340 | if (ret) | 1340 | if (ret) |
1341 | goto error_brelse; | 1341 | goto error_undo; |
1342 | 1342 | ||
1343 | ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); | 1343 | ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); |
1344 | if (ret) | 1344 | if (ret) |
1345 | goto error_brelse; | 1345 | goto error_undo; |
1346 | 1346 | ||
1347 | device->in_fs_metadata = 0; | 1347 | device->in_fs_metadata = 0; |
1348 | 1348 | ||
@@ -1416,6 +1416,13 @@ out: | |||
1416 | mutex_unlock(&root->fs_info->volume_mutex); | 1416 | mutex_unlock(&root->fs_info->volume_mutex); |
1417 | mutex_unlock(&uuid_mutex); | 1417 | mutex_unlock(&uuid_mutex); |
1418 | return ret; | 1418 | return ret; |
1419 | error_undo: | ||
1420 | if (device->writeable) { | ||
1421 | list_add(&device->dev_alloc_list, | ||
1422 | &root->fs_info->fs_devices->alloc_list); | ||
1423 | root->fs_info->fs_devices->rw_devices++; | ||
1424 | } | ||
1425 | goto error_brelse; | ||
1419 | } | 1426 | } |
1420 | 1427 | ||
1421 | /* | 1428 | /* |
@@ -1633,7 +1640,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1633 | device->dev_root = root->fs_info->dev_root; | 1640 | device->dev_root = root->fs_info->dev_root; |
1634 | device->bdev = bdev; | 1641 | device->bdev = bdev; |
1635 | device->in_fs_metadata = 1; | 1642 | device->in_fs_metadata = 1; |
1636 | device->mode = 0; | 1643 | device->mode = FMODE_EXCL; |
1637 | set_blocksize(device->bdev, 4096); | 1644 | set_blocksize(device->bdev, 4096); |
1638 | 1645 | ||
1639 | if (seeding_dev) { | 1646 | if (seeding_dev) { |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 267d0ada4541..4a09af9e9a63 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -63,6 +63,13 @@ | |||
63 | * cleanup path and it is also acquired by eventpoll_release_file() | 63 | * cleanup path and it is also acquired by eventpoll_release_file() |
64 | * if a file has been pushed inside an epoll set and it is then | 64 | * if a file has been pushed inside an epoll set and it is then |
65 | * close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL). | 65 | * close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL). |
66 | * It is also acquired when inserting an epoll fd onto another epoll | ||
67 | * fd. We do this so that we walk the epoll tree and ensure that this | ||
68 | * insertion does not create a cycle of epoll file descriptors, which | ||
69 | * could lead to deadlock. We need a global mutex to prevent two | ||
70 | * simultaneous inserts (A into B and B into A) from racing and | ||
71 | * constructing a cycle without either insert observing that it is | ||
72 | * going to. | ||
66 | * It is possible to drop the "ep->mtx" and to use the global | 73 | * It is possible to drop the "ep->mtx" and to use the global |
67 | * mutex "epmutex" (together with "ep->lock") to have it working, | 74 | * mutex "epmutex" (together with "ep->lock") to have it working, |
68 | * but having "ep->mtx" will make the interface more scalable. | 75 | * but having "ep->mtx" will make the interface more scalable. |
@@ -224,6 +231,9 @@ static long max_user_watches __read_mostly; | |||
224 | */ | 231 | */ |
225 | static DEFINE_MUTEX(epmutex); | 232 | static DEFINE_MUTEX(epmutex); |
226 | 233 | ||
234 | /* Used to check for epoll file descriptor inclusion loops */ | ||
235 | static struct nested_calls poll_loop_ncalls; | ||
236 | |||
227 | /* Used for safe wake up implementation */ | 237 | /* Used for safe wake up implementation */ |
228 | static struct nested_calls poll_safewake_ncalls; | 238 | static struct nested_calls poll_safewake_ncalls; |
229 | 239 | ||
@@ -1198,6 +1208,62 @@ retry: | |||
1198 | return res; | 1208 | return res; |
1199 | } | 1209 | } |
1200 | 1210 | ||
1211 | /** | ||
1212 | * ep_loop_check_proc - Callback function to be passed to the @ep_call_nested() | ||
1213 | * API, to verify that adding an epoll file inside another | ||
1214 | * epoll structure, does not violate the constraints, in | ||
1215 | * terms of closed loops, or too deep chains (which can | ||
1216 | * result in excessive stack usage). | ||
1217 | * | ||
1218 | * @priv: Pointer to the epoll file to be currently checked. | ||
1219 | * @cookie: Original cookie for this call. This is the top-of-the-chain epoll | ||
1220 | * data structure pointer. | ||
1221 | * @call_nests: Current dept of the @ep_call_nested() call stack. | ||
1222 | * | ||
1223 | * Returns: Returns zero if adding the epoll @file inside current epoll | ||
1224 | * structure @ep does not violate the constraints, or -1 otherwise. | ||
1225 | */ | ||
1226 | static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) | ||
1227 | { | ||
1228 | int error = 0; | ||
1229 | struct file *file = priv; | ||
1230 | struct eventpoll *ep = file->private_data; | ||
1231 | struct rb_node *rbp; | ||
1232 | struct epitem *epi; | ||
1233 | |||
1234 | mutex_lock(&ep->mtx); | ||
1235 | for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) { | ||
1236 | epi = rb_entry(rbp, struct epitem, rbn); | ||
1237 | if (unlikely(is_file_epoll(epi->ffd.file))) { | ||
1238 | error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | ||
1239 | ep_loop_check_proc, epi->ffd.file, | ||
1240 | epi->ffd.file->private_data, current); | ||
1241 | if (error != 0) | ||
1242 | break; | ||
1243 | } | ||
1244 | } | ||
1245 | mutex_unlock(&ep->mtx); | ||
1246 | |||
1247 | return error; | ||
1248 | } | ||
1249 | |||
1250 | /** | ||
1251 | * ep_loop_check - Performs a check to verify that adding an epoll file (@file) | ||
1252 | * another epoll file (represented by @ep) does not create | ||
1253 | * closed loops or too deep chains. | ||
1254 | * | ||
1255 | * @ep: Pointer to the epoll private data structure. | ||
1256 | * @file: Pointer to the epoll file to be checked. | ||
1257 | * | ||
1258 | * Returns: Returns zero if adding the epoll @file inside current epoll | ||
1259 | * structure @ep does not violate the constraints, or -1 otherwise. | ||
1260 | */ | ||
1261 | static int ep_loop_check(struct eventpoll *ep, struct file *file) | ||
1262 | { | ||
1263 | return ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | ||
1264 | ep_loop_check_proc, file, ep, current); | ||
1265 | } | ||
1266 | |||
1201 | /* | 1267 | /* |
1202 | * Open an eventpoll file descriptor. | 1268 | * Open an eventpoll file descriptor. |
1203 | */ | 1269 | */ |
@@ -1246,6 +1312,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1246 | struct epoll_event __user *, event) | 1312 | struct epoll_event __user *, event) |
1247 | { | 1313 | { |
1248 | int error; | 1314 | int error; |
1315 | int did_lock_epmutex = 0; | ||
1249 | struct file *file, *tfile; | 1316 | struct file *file, *tfile; |
1250 | struct eventpoll *ep; | 1317 | struct eventpoll *ep; |
1251 | struct epitem *epi; | 1318 | struct epitem *epi; |
@@ -1287,6 +1354,25 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1287 | */ | 1354 | */ |
1288 | ep = file->private_data; | 1355 | ep = file->private_data; |
1289 | 1356 | ||
1357 | /* | ||
1358 | * When we insert an epoll file descriptor, inside another epoll file | ||
1359 | * descriptor, there is the change of creating closed loops, which are | ||
1360 | * better be handled here, than in more critical paths. | ||
1361 | * | ||
1362 | * We hold epmutex across the loop check and the insert in this case, in | ||
1363 | * order to prevent two separate inserts from racing and each doing the | ||
1364 | * insert "at the same time" such that ep_loop_check passes on both | ||
1365 | * before either one does the insert, thereby creating a cycle. | ||
1366 | */ | ||
1367 | if (unlikely(is_file_epoll(tfile) && op == EPOLL_CTL_ADD)) { | ||
1368 | mutex_lock(&epmutex); | ||
1369 | did_lock_epmutex = 1; | ||
1370 | error = -ELOOP; | ||
1371 | if (ep_loop_check(ep, tfile) != 0) | ||
1372 | goto error_tgt_fput; | ||
1373 | } | ||
1374 | |||
1375 | |||
1290 | mutex_lock(&ep->mtx); | 1376 | mutex_lock(&ep->mtx); |
1291 | 1377 | ||
1292 | /* | 1378 | /* |
@@ -1322,6 +1408,9 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1322 | mutex_unlock(&ep->mtx); | 1408 | mutex_unlock(&ep->mtx); |
1323 | 1409 | ||
1324 | error_tgt_fput: | 1410 | error_tgt_fput: |
1411 | if (unlikely(did_lock_epmutex)) | ||
1412 | mutex_unlock(&epmutex); | ||
1413 | |||
1325 | fput(tfile); | 1414 | fput(tfile); |
1326 | error_fput: | 1415 | error_fput: |
1327 | fput(file); | 1416 | fput(file); |
@@ -1441,6 +1530,12 @@ static int __init eventpoll_init(void) | |||
1441 | EP_ITEM_COST; | 1530 | EP_ITEM_COST; |
1442 | BUG_ON(max_user_watches < 0); | 1531 | BUG_ON(max_user_watches < 0); |
1443 | 1532 | ||
1533 | /* | ||
1534 | * Initialize the structure used to perform epoll file descriptor | ||
1535 | * inclusion loops checks. | ||
1536 | */ | ||
1537 | ep_nested_calls_init(&poll_loop_ncalls); | ||
1538 | |||
1444 | /* Initialize the structure used to perform safe poll wait head wake ups */ | 1539 | /* Initialize the structure used to perform safe poll wait head wake ups */ |
1445 | ep_nested_calls_init(&poll_safewake_ncalls); | 1540 | ep_nested_calls_init(&poll_safewake_ncalls); |
1446 | 1541 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index bfed8447ed80..83543b5ff941 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1283,8 +1283,11 @@ static int fuse_do_setattr(struct dentry *entry, struct iattr *attr, | |||
1283 | if (err) | 1283 | if (err) |
1284 | return err; | 1284 | return err; |
1285 | 1285 | ||
1286 | if ((attr->ia_valid & ATTR_OPEN) && fc->atomic_o_trunc) | 1286 | if (attr->ia_valid & ATTR_OPEN) { |
1287 | return 0; | 1287 | if (fc->atomic_o_trunc) |
1288 | return 0; | ||
1289 | file = NULL; | ||
1290 | } | ||
1288 | 1291 | ||
1289 | if (attr->ia_valid & ATTR_SIZE) | 1292 | if (attr->ia_valid & ATTR_SIZE) |
1290 | is_truncate = true; | 1293 | is_truncate = true; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 95da1bc1c826..9e0832dbb1e3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -86,18 +86,52 @@ struct fuse_file *fuse_file_get(struct fuse_file *ff) | |||
86 | return ff; | 86 | return ff; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void fuse_release_async(struct work_struct *work) | ||
90 | { | ||
91 | struct fuse_req *req; | ||
92 | struct fuse_conn *fc; | ||
93 | struct path path; | ||
94 | |||
95 | req = container_of(work, struct fuse_req, misc.release.work); | ||
96 | path = req->misc.release.path; | ||
97 | fc = get_fuse_conn(path.dentry->d_inode); | ||
98 | |||
99 | fuse_put_request(fc, req); | ||
100 | path_put(&path); | ||
101 | } | ||
102 | |||
89 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) | 103 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) |
90 | { | 104 | { |
91 | path_put(&req->misc.release.path); | 105 | if (fc->destroy_req) { |
106 | /* | ||
107 | * If this is a fuseblk mount, then it's possible that | ||
108 | * releasing the path will result in releasing the | ||
109 | * super block and sending the DESTROY request. If | ||
110 | * the server is single threaded, this would hang. | ||
111 | * For this reason do the path_put() in a separate | ||
112 | * thread. | ||
113 | */ | ||
114 | atomic_inc(&req->count); | ||
115 | INIT_WORK(&req->misc.release.work, fuse_release_async); | ||
116 | schedule_work(&req->misc.release.work); | ||
117 | } else { | ||
118 | path_put(&req->misc.release.path); | ||
119 | } | ||
92 | } | 120 | } |
93 | 121 | ||
94 | static void fuse_file_put(struct fuse_file *ff) | 122 | static void fuse_file_put(struct fuse_file *ff, bool sync) |
95 | { | 123 | { |
96 | if (atomic_dec_and_test(&ff->count)) { | 124 | if (atomic_dec_and_test(&ff->count)) { |
97 | struct fuse_req *req = ff->reserved_req; | 125 | struct fuse_req *req = ff->reserved_req; |
98 | 126 | ||
99 | req->end = fuse_release_end; | 127 | if (sync) { |
100 | fuse_request_send_background(ff->fc, req); | 128 | fuse_request_send(ff->fc, req); |
129 | path_put(&req->misc.release.path); | ||
130 | fuse_put_request(ff->fc, req); | ||
131 | } else { | ||
132 | req->end = fuse_release_end; | ||
133 | fuse_request_send_background(ff->fc, req); | ||
134 | } | ||
101 | kfree(ff); | 135 | kfree(ff); |
102 | } | 136 | } |
103 | } | 137 | } |
@@ -219,8 +253,12 @@ void fuse_release_common(struct file *file, int opcode) | |||
219 | * Normally this will send the RELEASE request, however if | 253 | * Normally this will send the RELEASE request, however if |
220 | * some asynchronous READ or WRITE requests are outstanding, | 254 | * some asynchronous READ or WRITE requests are outstanding, |
221 | * the sending will be delayed. | 255 | * the sending will be delayed. |
256 | * | ||
257 | * Make the release synchronous if this is a fuseblk mount, | ||
258 | * synchronous RELEASE is allowed (and desirable) in this case | ||
259 | * because the server can be trusted not to screw up. | ||
222 | */ | 260 | */ |
223 | fuse_file_put(ff); | 261 | fuse_file_put(ff, ff->fc->destroy_req != NULL); |
224 | } | 262 | } |
225 | 263 | ||
226 | static int fuse_open(struct inode *inode, struct file *file) | 264 | static int fuse_open(struct inode *inode, struct file *file) |
@@ -558,7 +596,7 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req) | |||
558 | page_cache_release(page); | 596 | page_cache_release(page); |
559 | } | 597 | } |
560 | if (req->ff) | 598 | if (req->ff) |
561 | fuse_file_put(req->ff); | 599 | fuse_file_put(req->ff, false); |
562 | } | 600 | } |
563 | 601 | ||
564 | static void fuse_send_readpages(struct fuse_req *req, struct file *file) | 602 | static void fuse_send_readpages(struct fuse_req *req, struct file *file) |
@@ -1137,7 +1175,7 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | |||
1137 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) | 1175 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) |
1138 | { | 1176 | { |
1139 | __free_page(req->pages[0]); | 1177 | __free_page(req->pages[0]); |
1140 | fuse_file_put(req->ff); | 1178 | fuse_file_put(req->ff, false); |
1141 | } | 1179 | } |
1142 | 1180 | ||
1143 | static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) | 1181 | static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index ae5744a2f9e9..d4286947bc2c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/rwsem.h> | 21 | #include <linux/rwsem.h> |
22 | #include <linux/rbtree.h> | 22 | #include <linux/rbtree.h> |
23 | #include <linux/poll.h> | 23 | #include <linux/poll.h> |
24 | #include <linux/workqueue.h> | ||
24 | 25 | ||
25 | /** Max number of pages that can be used in a single read request */ | 26 | /** Max number of pages that can be used in a single read request */ |
26 | #define FUSE_MAX_PAGES_PER_REQ 32 | 27 | #define FUSE_MAX_PAGES_PER_REQ 32 |
@@ -262,7 +263,10 @@ struct fuse_req { | |||
262 | /** Data for asynchronous requests */ | 263 | /** Data for asynchronous requests */ |
263 | union { | 264 | union { |
264 | struct { | 265 | struct { |
265 | struct fuse_release_in in; | 266 | union { |
267 | struct fuse_release_in in; | ||
268 | struct work_struct work; | ||
269 | }; | ||
266 | struct path path; | 270 | struct path path; |
267 | } release; | 271 | } release; |
268 | struct fuse_init_in init_in; | 272 | struct fuse_init_in init_in; |
diff --git a/fs/inode.c b/fs/inode.c index 9c2b795ccc93..0647d80accf6 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -548,11 +548,14 @@ void evict_inodes(struct super_block *sb) | |||
548 | /** | 548 | /** |
549 | * invalidate_inodes - attempt to free all inodes on a superblock | 549 | * invalidate_inodes - attempt to free all inodes on a superblock |
550 | * @sb: superblock to operate on | 550 | * @sb: superblock to operate on |
551 | * @kill_dirty: flag to guide handling of dirty inodes | ||
551 | * | 552 | * |
552 | * Attempts to free all inodes for a given superblock. If there were any | 553 | * Attempts to free all inodes for a given superblock. If there were any |
553 | * busy inodes return a non-zero value, else zero. | 554 | * busy inodes return a non-zero value, else zero. |
555 | * If @kill_dirty is set, discard dirty inodes too, otherwise treat | ||
556 | * them as busy. | ||
554 | */ | 557 | */ |
555 | int invalidate_inodes(struct super_block *sb) | 558 | int invalidate_inodes(struct super_block *sb, bool kill_dirty) |
556 | { | 559 | { |
557 | int busy = 0; | 560 | int busy = 0; |
558 | struct inode *inode, *next; | 561 | struct inode *inode, *next; |
@@ -564,6 +567,10 @@ int invalidate_inodes(struct super_block *sb) | |||
564 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { | 567 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { |
565 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) | 568 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) |
566 | continue; | 569 | continue; |
570 | if (inode->i_state & I_DIRTY && !kill_dirty) { | ||
571 | busy = 1; | ||
572 | continue; | ||
573 | } | ||
567 | if (atomic_read(&inode->i_count)) { | 574 | if (atomic_read(&inode->i_count)) { |
568 | busy = 1; | 575 | busy = 1; |
569 | continue; | 576 | continue; |
diff --git a/fs/internal.h b/fs/internal.h index 0663568b1247..9b976b57d7fe 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -112,4 +112,4 @@ extern void release_open_intent(struct nameidata *); | |||
112 | */ | 112 | */ |
113 | extern int get_nr_dirty_inodes(void); | 113 | extern int get_nr_dirty_inodes(void); |
114 | extern void evict_inodes(struct super_block *); | 114 | extern void evict_inodes(struct super_block *); |
115 | extern int invalidate_inodes(struct super_block *); | 115 | extern int invalidate_inodes(struct super_block *, bool); |
diff --git a/fs/namespace.c b/fs/namespace.c index 7b0b95371696..d1edf26025dc 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1244,7 +1244,7 @@ static int do_umount(struct vfsmount *mnt, int flags) | |||
1244 | */ | 1244 | */ |
1245 | br_write_lock(vfsmount_lock); | 1245 | br_write_lock(vfsmount_lock); |
1246 | if (mnt_get_count(mnt) != 2) { | 1246 | if (mnt_get_count(mnt) != 2) { |
1247 | br_write_lock(vfsmount_lock); | 1247 | br_write_unlock(vfsmount_lock); |
1248 | return -EBUSY; | 1248 | return -EBUSY; |
1249 | } | 1249 | } |
1250 | br_write_unlock(vfsmount_lock); | 1250 | br_write_unlock(vfsmount_lock); |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 43e56b97f9c0..6180da1e37e6 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -405,9 +405,9 @@ static inline int ocfs2_remove_extent_credits(struct super_block *sb) | |||
405 | ocfs2_quota_trans_credits(sb); | 405 | ocfs2_quota_trans_credits(sb); |
406 | } | 406 | } |
407 | 407 | ||
408 | /* data block for new dir/symlink, 2 for bitmap updates (bitmap fe + | 408 | /* data block for new dir/symlink, allocation of directory block, dx_root |
409 | * bitmap block for the new bit) dx_root update for free list */ | 409 | * update for free list */ |
410 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2 + 1) | 410 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + OCFS2_SUBALLOC_ALLOC + 1) |
411 | 411 | ||
412 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) | 412 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) |
413 | { | 413 | { |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index b5f9160e93e9..19ebc5aad391 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -3228,7 +3228,7 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3228 | u32 num_clusters, unsigned int e_flags) | 3228 | u32 num_clusters, unsigned int e_flags) |
3229 | { | 3229 | { |
3230 | int ret, delete, index, credits = 0; | 3230 | int ret, delete, index, credits = 0; |
3231 | u32 new_bit, new_len; | 3231 | u32 new_bit, new_len, orig_num_clusters; |
3232 | unsigned int set_len; | 3232 | unsigned int set_len; |
3233 | struct ocfs2_super *osb = OCFS2_SB(sb); | 3233 | struct ocfs2_super *osb = OCFS2_SB(sb); |
3234 | handle_t *handle; | 3234 | handle_t *handle; |
@@ -3261,6 +3261,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3261 | goto out; | 3261 | goto out; |
3262 | } | 3262 | } |
3263 | 3263 | ||
3264 | orig_num_clusters = num_clusters; | ||
3265 | |||
3264 | while (num_clusters) { | 3266 | while (num_clusters) { |
3265 | ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh, | 3267 | ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh, |
3266 | p_cluster, num_clusters, | 3268 | p_cluster, num_clusters, |
@@ -3348,7 +3350,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3348 | * in write-back mode. | 3350 | * in write-back mode. |
3349 | */ | 3351 | */ |
3350 | if (context->get_clusters == ocfs2_di_get_clusters) { | 3352 | if (context->get_clusters == ocfs2_di_get_clusters) { |
3351 | ret = ocfs2_cow_sync_writeback(sb, context, cpos, num_clusters); | 3353 | ret = ocfs2_cow_sync_writeback(sb, context, cpos, |
3354 | orig_num_clusters); | ||
3352 | if (ret) | 3355 | if (ret) |
3353 | mlog_errno(ret); | 3356 | mlog_errno(ret); |
3354 | } | 3357 | } |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 38f986d2447e..36c423fb0635 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1316,7 +1316,7 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1316 | struct mount_options *mopt, | 1316 | struct mount_options *mopt, |
1317 | int is_remount) | 1317 | int is_remount) |
1318 | { | 1318 | { |
1319 | int status; | 1319 | int status, user_stack = 0; |
1320 | char *p; | 1320 | char *p; |
1321 | u32 tmp; | 1321 | u32 tmp; |
1322 | 1322 | ||
@@ -1459,6 +1459,15 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1459 | memcpy(mopt->cluster_stack, args[0].from, | 1459 | memcpy(mopt->cluster_stack, args[0].from, |
1460 | OCFS2_STACK_LABEL_LEN); | 1460 | OCFS2_STACK_LABEL_LEN); |
1461 | mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0'; | 1461 | mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0'; |
1462 | /* | ||
1463 | * Open code the memcmp here as we don't have | ||
1464 | * an osb to pass to | ||
1465 | * ocfs2_userspace_stack(). | ||
1466 | */ | ||
1467 | if (memcmp(mopt->cluster_stack, | ||
1468 | OCFS2_CLASSIC_CLUSTER_STACK, | ||
1469 | OCFS2_STACK_LABEL_LEN)) | ||
1470 | user_stack = 1; | ||
1462 | break; | 1471 | break; |
1463 | case Opt_inode64: | 1472 | case Opt_inode64: |
1464 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; | 1473 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; |
@@ -1514,13 +1523,16 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1514 | } | 1523 | } |
1515 | } | 1524 | } |
1516 | 1525 | ||
1517 | /* Ensure only one heartbeat mode */ | 1526 | if (user_stack == 0) { |
1518 | tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL | | 1527 | /* Ensure only one heartbeat mode */ |
1519 | OCFS2_MOUNT_HB_NONE); | 1528 | tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | |
1520 | if (hweight32(tmp) != 1) { | 1529 | OCFS2_MOUNT_HB_GLOBAL | |
1521 | mlog(ML_ERROR, "Invalid heartbeat mount options\n"); | 1530 | OCFS2_MOUNT_HB_NONE); |
1522 | status = 0; | 1531 | if (hweight32(tmp) != 1) { |
1523 | goto bail; | 1532 | mlog(ML_ERROR, "Invalid heartbeat mount options\n"); |
1533 | status = 0; | ||
1534 | goto bail; | ||
1535 | } | ||
1524 | } | 1536 | } |
1525 | 1537 | ||
1526 | status = 1; | 1538 | status = 1; |
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index 789c625c7aa5..b10e3540d5b7 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -251,6 +251,11 @@ static bool ldm_parse_vmdb (const u8 *data, struct vmdb *vm) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | vm->vblk_size = get_unaligned_be32(data + 0x08); | 253 | vm->vblk_size = get_unaligned_be32(data + 0x08); |
254 | if (vm->vblk_size == 0) { | ||
255 | ldm_error ("Illegal VBLK size"); | ||
256 | return false; | ||
257 | } | ||
258 | |||
254 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); | 259 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); |
255 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); | 260 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); |
256 | 261 | ||
diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index ef1cef77d32b..d7bd661bfae7 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h | |||
@@ -183,13 +183,19 @@ | |||
183 | 183 | ||
184 | #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) | 184 | #if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES) |
185 | /* | 185 | /* |
186 | * Module name is included in both debug and non-debug versions primarily for | 186 | * The module name is used primarily for error and debug messages. |
187 | * error messages. The __FILE__ macro is not very useful for this, because it | 187 | * The __FILE__ macro is not very useful for this, because it |
188 | * often includes the entire pathname to the module | 188 | * usually includes the entire pathname to the module making the |
189 | * debug output difficult to read. | ||
189 | */ | 190 | */ |
190 | #define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; | 191 | #define ACPI_MODULE_NAME(name) static const char ACPI_UNUSED_VAR _acpi_module_name[] = name; |
191 | #else | 192 | #else |
193 | /* | ||
194 | * For the no-debug and no-error-msg cases, we must at least define | ||
195 | * a null module name. | ||
196 | */ | ||
192 | #define ACPI_MODULE_NAME(name) | 197 | #define ACPI_MODULE_NAME(name) |
198 | #define _acpi_module_name "" | ||
193 | #endif | 199 | #endif |
194 | 200 | ||
195 | /* | 201 | /* |
diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index e46ec95a8ada..ec908540d346 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h | |||
@@ -47,7 +47,7 @@ | |||
47 | 47 | ||
48 | /* Current ACPICA subsystem version in YYYYMMDD format */ | 48 | /* Current ACPICA subsystem version in YYYYMMDD format */ |
49 | 49 | ||
50 | #define ACPI_CA_VERSION 0x20110112 | 50 | #define ACPI_CA_VERSION 0x20110211 |
51 | 51 | ||
52 | #include "actypes.h" | 52 | #include "actypes.h" |
53 | #include "actbl.h" | 53 | #include "actbl.h" |
diff --git a/include/acpi/actbl.h b/include/acpi/actbl.h index 7e42bfee0e29..d41c94885211 100644 --- a/include/acpi/actbl.h +++ b/include/acpi/actbl.h | |||
@@ -343,4 +343,20 @@ struct acpi_table_desc { | |||
343 | #include <acpi/actbl1.h> | 343 | #include <acpi/actbl1.h> |
344 | #include <acpi/actbl2.h> | 344 | #include <acpi/actbl2.h> |
345 | 345 | ||
346 | /* | ||
347 | * Sizes of the various flavors of FADT. We need to look closely | ||
348 | * at the FADT length because the version number essentially tells | ||
349 | * us nothing because of many BIOS bugs where the version does not | ||
350 | * match the expected length. In other words, the length of the | ||
351 | * FADT is the bottom line as to what the version really is. | ||
352 | * | ||
353 | * For reference, the values below are as follows: | ||
354 | * FADT V1 size: 0x74 | ||
355 | * FADT V2 size: 0x84 | ||
356 | * FADT V3+ size: 0xF4 | ||
357 | */ | ||
358 | #define ACPI_FADT_V1_SIZE (u32) (ACPI_FADT_OFFSET (flags) + 4) | ||
359 | #define ACPI_FADT_V2_SIZE (u32) (ACPI_FADT_OFFSET (reserved4[0]) + 3) | ||
360 | #define ACPI_FADT_V3_SIZE (u32) (sizeof (struct acpi_table_fadt)) | ||
361 | |||
346 | #endif /* __ACTBL_H__ */ | 362 | #endif /* __ACTBL_H__ */ |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 31b6188df221..b4bfe338ea0e 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #ifdef CONFIG_MMU | 5 | #ifdef CONFIG_MMU |
6 | 6 | ||
7 | #include <linux/mm_types.h> | ||
8 | |||
7 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 9 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
8 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 10 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
9 | unsigned long address, pte_t *ptep, | 11 | unsigned long address, pte_t *ptep, |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fe29aadb129d..348843b80150 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1101,7 +1101,7 @@ struct drm_device { | |||
1101 | struct platform_device *platformdev; /**< Platform device struture */ | 1101 | struct platform_device *platformdev; /**< Platform device struture */ |
1102 | 1102 | ||
1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
1104 | int num_crtcs; /**< Number of CRTCs on this device */ | 1104 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
1105 | void *dev_private; /**< device private data */ | 1105 | void *dev_private; /**< device private data */ |
1106 | void *mm_private; | 1106 | void *mm_private; |
1107 | struct address_space *dev_mapping; | 1107 | struct address_space *dev_mapping; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 97d08d8a7de8..e38b50a4b9d2 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2140,7 +2140,7 @@ extern void check_disk_size_change(struct gendisk *disk, | |||
2140 | struct block_device *bdev); | 2140 | struct block_device *bdev); |
2141 | extern int revalidate_disk(struct gendisk *); | 2141 | extern int revalidate_disk(struct gendisk *); |
2142 | extern int check_disk_change(struct block_device *); | 2142 | extern int check_disk_change(struct block_device *); |
2143 | extern int __invalidate_device(struct block_device *); | 2143 | extern int __invalidate_device(struct block_device *, bool); |
2144 | extern int invalidate_partition(struct gendisk *, int); | 2144 | extern int invalidate_partition(struct gendisk *, int); |
2145 | #endif | 2145 | #endif |
2146 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2146 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
diff --git a/include/linux/pm.h b/include/linux/pm.h index dd9c7ab38270..21415cc91cbb 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -431,6 +431,8 @@ struct dev_pm_info { | |||
431 | struct list_head entry; | 431 | struct list_head entry; |
432 | struct completion completion; | 432 | struct completion completion; |
433 | struct wakeup_source *wakeup; | 433 | struct wakeup_source *wakeup; |
434 | #else | ||
435 | unsigned int should_wakeup:1; | ||
434 | #endif | 436 | #endif |
435 | #ifdef CONFIG_PM_RUNTIME | 437 | #ifdef CONFIG_PM_RUNTIME |
436 | struct timer_list suspend_timer; | 438 | struct timer_list suspend_timer; |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 9cff00dd6b63..03a67db03d01 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -109,11 +109,6 @@ static inline bool device_can_wakeup(struct device *dev) | |||
109 | return dev->power.can_wakeup; | 109 | return dev->power.can_wakeup; |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline bool device_may_wakeup(struct device *dev) | ||
113 | { | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 112 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
118 | { | 113 | { |
119 | return NULL; | 114 | return NULL; |
@@ -134,24 +129,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {} | |||
134 | 129 | ||
135 | static inline int device_wakeup_enable(struct device *dev) | 130 | static inline int device_wakeup_enable(struct device *dev) |
136 | { | 131 | { |
137 | return -EINVAL; | 132 | dev->power.should_wakeup = true; |
133 | return 0; | ||
138 | } | 134 | } |
139 | 135 | ||
140 | static inline int device_wakeup_disable(struct device *dev) | 136 | static inline int device_wakeup_disable(struct device *dev) |
141 | { | 137 | { |
138 | dev->power.should_wakeup = false; | ||
142 | return 0; | 139 | return 0; |
143 | } | 140 | } |
144 | 141 | ||
145 | static inline int device_init_wakeup(struct device *dev, bool val) | 142 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) |
146 | { | 143 | { |
147 | dev->power.can_wakeup = val; | 144 | dev->power.should_wakeup = enable; |
148 | return val ? -EINVAL : 0; | 145 | return 0; |
149 | } | 146 | } |
150 | 147 | ||
148 | static inline int device_init_wakeup(struct device *dev, bool val) | ||
149 | { | ||
150 | device_set_wakeup_capable(dev, val); | ||
151 | device_set_wakeup_enable(dev, val); | ||
152 | return 0; | ||
153 | } | ||
151 | 154 | ||
152 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) | 155 | static inline bool device_may_wakeup(struct device *dev) |
153 | { | 156 | { |
154 | return -EINVAL; | 157 | return dev->power.can_wakeup && dev->power.should_wakeup; |
155 | } | 158 | } |
156 | 159 | ||
157 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} | 160 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} |
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index d63dcbaea169..9026b30238f3 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
@@ -14,10 +14,12 @@ | |||
14 | #define LINUX_RIO_REGS_H | 14 | #define LINUX_RIO_REGS_H |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * In RapidIO, each device has a 2MB configuration space that is | 17 | * In RapidIO, each device has a 16MB configuration space that is |
18 | * accessed via maintenance transactions. Portions of configuration | 18 | * accessed via maintenance transactions. Portions of configuration |
19 | * space are standardized and/or reserved. | 19 | * space are standardized and/or reserved. |
20 | */ | 20 | */ |
21 | #define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */ | ||
22 | |||
21 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ | 23 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ |
22 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ | 24 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ |
23 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ | 25 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 8651556dbd52..d3ec89fb4122 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -172,6 +172,14 @@ void thermal_zone_device_update(struct thermal_zone_device *); | |||
172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
173 | const struct thermal_cooling_device_ops *); | 173 | const struct thermal_cooling_device_ops *); |
174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
175 | |||
176 | #ifdef CONFIG_NET | ||
175 | extern int generate_netlink_event(u32 orig, enum events event); | 177 | extern int generate_netlink_event(u32 orig, enum events event); |
178 | #else | ||
179 | static inline int generate_netlink_event(u32 orig, enum events event) | ||
180 | { | ||
181 | return 0; | ||
182 | } | ||
183 | #endif | ||
176 | 184 | ||
177 | #endif /* __THERMAL_H__ */ | 185 | #endif /* __THERMAL_H__ */ |
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 48b2761b5668..a3b5aff62606 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -600,4 +600,14 @@ int tick_broadcast_oneshot_active(void) | |||
600 | return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; | 600 | return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; |
601 | } | 601 | } |
602 | 602 | ||
603 | /* | ||
604 | * Check whether the broadcast device supports oneshot. | ||
605 | */ | ||
606 | bool tick_broadcast_oneshot_available(void) | ||
607 | { | ||
608 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | ||
609 | |||
610 | return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false; | ||
611 | } | ||
612 | |||
603 | #endif | 613 | #endif |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 051bc80a0c43..ed228ef6f6b8 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -51,7 +51,11 @@ int tick_is_oneshot_available(void) | |||
51 | { | 51 | { |
52 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); | 52 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); |
53 | 53 | ||
54 | return dev && (dev->features & CLOCK_EVT_FEAT_ONESHOT); | 54 | if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) |
55 | return 0; | ||
56 | if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) | ||
57 | return 1; | ||
58 | return tick_broadcast_oneshot_available(); | ||
55 | } | 59 | } |
56 | 60 | ||
57 | /* | 61 | /* |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 290eefbc1f60..f65d3a723a64 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -36,6 +36,7 @@ extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | |||
36 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | 36 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); |
37 | extern int tick_broadcast_oneshot_active(void); | 37 | extern int tick_broadcast_oneshot_active(void); |
38 | extern void tick_check_oneshot_broadcast(int cpu); | 38 | extern void tick_check_oneshot_broadcast(int cpu); |
39 | bool tick_broadcast_oneshot_available(void); | ||
39 | # else /* BROADCAST */ | 40 | # else /* BROADCAST */ |
40 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 41 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
41 | { | 42 | { |
@@ -46,6 +47,7 @@ static inline void tick_broadcast_switch_to_oneshot(void) { } | |||
46 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 47 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
47 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | 48 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
48 | static inline void tick_check_oneshot_broadcast(int cpu) { } | 49 | static inline void tick_check_oneshot_broadcast(int cpu) { } |
50 | static inline bool tick_broadcast_oneshot_available(void) { return true; } | ||
49 | # endif /* !BROADCAST */ | 51 | # endif /* !BROADCAST */ |
50 | 52 | ||
51 | #else /* !ONESHOT */ | 53 | #else /* !ONESHOT */ |
@@ -76,6 +78,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | |||
76 | return 0; | 78 | return 0; |
77 | } | 79 | } |
78 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | 80 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
81 | static inline bool tick_broadcast_oneshot_available(void) { return false; } | ||
79 | #endif /* !TICK_ONESHOT */ | 82 | #endif /* !TICK_ONESHOT */ |
80 | 83 | ||
81 | /* | 84 | /* |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index c47bbe11b804..93ca08b8a451 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -686,8 +686,10 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, | |||
686 | /* | 686 | /* |
687 | * Ensure that the address returned is DMA'ble | 687 | * Ensure that the address returned is DMA'ble |
688 | */ | 688 | */ |
689 | if (!dma_capable(dev, dev_addr, size)) | 689 | if (!dma_capable(dev, dev_addr, size)) { |
690 | panic("map_single: bounce buffer is not DMA'ble"); | 690 | swiotlb_tbl_unmap_single(dev, map, size, dir); |
691 | dev_addr = swiotlb_virt_to_bus(dev, io_tlb_overflow_buffer); | ||
692 | } | ||
691 | 693 | ||
692 | return dev_addr; | 694 | return dev_addr; |
693 | } | 695 | } |
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 368fc9d23610..49355a970be2 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1830,7 +1830,7 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, | |||
1830 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { | 1830 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { |
1831 | unsigned nid; | 1831 | unsigned nid; |
1832 | 1832 | ||
1833 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT); | 1833 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order); |
1834 | mpol_cond_put(pol); | 1834 | mpol_cond_put(pol); |
1835 | page = alloc_page_interleave(gfp, order, nid); | 1835 | page = alloc_page_interleave(gfp, order, nid); |
1836 | put_mems_allowed(); | 1836 | put_mems_allowed(); |
diff --git a/mm/migrate.c b/mm/migrate.c index 766115253807..352de555626c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1287,14 +1287,14 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, | |||
1287 | return -EPERM; | 1287 | return -EPERM; |
1288 | 1288 | ||
1289 | /* Find the mm_struct */ | 1289 | /* Find the mm_struct */ |
1290 | read_lock(&tasklist_lock); | 1290 | rcu_read_lock(); |
1291 | task = pid ? find_task_by_vpid(pid) : current; | 1291 | task = pid ? find_task_by_vpid(pid) : current; |
1292 | if (!task) { | 1292 | if (!task) { |
1293 | read_unlock(&tasklist_lock); | 1293 | rcu_read_unlock(); |
1294 | return -ESRCH; | 1294 | return -ESRCH; |
1295 | } | 1295 | } |
1296 | mm = get_task_mm(task); | 1296 | mm = get_task_mm(task); |
1297 | read_unlock(&tasklist_lock); | 1297 | rcu_read_unlock(); |
1298 | 1298 | ||
1299 | if (!mm) | 1299 | if (!mm) |
1300 | return -EINVAL; | 1300 | return -EINVAL; |
diff --git a/mm/mremap.c b/mm/mremap.c index 9925b6391b80..1de98d492ddc 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -94,9 +94,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, | |||
94 | */ | 94 | */ |
95 | mapping = vma->vm_file->f_mapping; | 95 | mapping = vma->vm_file->f_mapping; |
96 | spin_lock(&mapping->i_mmap_lock); | 96 | spin_lock(&mapping->i_mmap_lock); |
97 | if (new_vma->vm_truncate_count && | 97 | new_vma->vm_truncate_count = 0; |
98 | new_vma->vm_truncate_count != vma->vm_truncate_count) | ||
99 | new_vma->vm_truncate_count = 0; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | /* | 100 | /* |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a873e61e312e..cdef1d4b4e47 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -5376,10 +5376,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count) | |||
5376 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { | 5376 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { |
5377 | unsigned long check = pfn + iter; | 5377 | unsigned long check = pfn + iter; |
5378 | 5378 | ||
5379 | if (!pfn_valid_within(check)) { | 5379 | if (!pfn_valid_within(check)) |
5380 | iter++; | ||
5381 | continue; | 5380 | continue; |
5382 | } | 5381 | |
5383 | page = pfn_to_page(check); | 5382 | page = pfn_to_page(check); |
5384 | if (!page_count(page)) { | 5383 | if (!page_count(page)) { |
5385 | if (PageBuddy(page)) | 5384 | if (PageBuddy(page)) |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 07a458d72fa8..0341c5700e34 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1940,7 +1940,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) | |||
1940 | 1940 | ||
1941 | error = -EINVAL; | 1941 | error = -EINVAL; |
1942 | if (S_ISBLK(inode->i_mode)) { | 1942 | if (S_ISBLK(inode->i_mode)) { |
1943 | bdev = I_BDEV(inode); | 1943 | bdev = bdgrab(I_BDEV(inode)); |
1944 | error = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, | 1944 | error = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, |
1945 | sys_swapon); | 1945 | sys_swapon); |
1946 | if (error < 0) { | 1946 | if (error < 0) { |
diff --git a/mm/truncate.c b/mm/truncate.c index 49feb46e77b8..d64296be00d3 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -225,6 +225,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
225 | next = start; | 225 | next = start; |
226 | while (next <= end && | 226 | while (next <= end && |
227 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { | 227 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { |
228 | mem_cgroup_uncharge_start(); | ||
228 | for (i = 0; i < pagevec_count(&pvec); i++) { | 229 | for (i = 0; i < pagevec_count(&pvec); i++) { |
229 | struct page *page = pvec.pages[i]; | 230 | struct page *page = pvec.pages[i]; |
230 | pgoff_t page_index = page->index; | 231 | pgoff_t page_index = page->index; |
@@ -247,6 +248,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
247 | unlock_page(page); | 248 | unlock_page(page); |
248 | } | 249 | } |
249 | pagevec_release(&pvec); | 250 | pagevec_release(&pvec); |
251 | mem_cgroup_uncharge_end(); | ||
250 | cond_resched(); | 252 | cond_resched(); |
251 | } | 253 | } |
252 | 254 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 17497d0cd8b9..6771ea70bfe7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1841,16 +1841,28 @@ static inline bool should_continue_reclaim(struct zone *zone, | |||
1841 | if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) | 1841 | if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) |
1842 | return false; | 1842 | return false; |
1843 | 1843 | ||
1844 | /* | 1844 | /* Consider stopping depending on scan and reclaim activity */ |
1845 | * If we failed to reclaim and have scanned the full list, stop. | 1845 | if (sc->gfp_mask & __GFP_REPEAT) { |
1846 | * NOTE: Checking just nr_reclaimed would exit reclaim/compaction far | 1846 | /* |
1847 | * faster but obviously would be less likely to succeed | 1847 | * For __GFP_REPEAT allocations, stop reclaiming if the |
1848 | * allocation. If this is desirable, use GFP_REPEAT to decide | 1848 | * full LRU list has been scanned and we are still failing |
1849 | * if both reclaimed and scanned should be checked or just | 1849 | * to reclaim pages. This full LRU scan is potentially |
1850 | * reclaimed | 1850 | * expensive but a __GFP_REPEAT caller really wants to succeed |
1851 | */ | 1851 | */ |
1852 | if (!nr_reclaimed && !nr_scanned) | 1852 | if (!nr_reclaimed && !nr_scanned) |
1853 | return false; | 1853 | return false; |
1854 | } else { | ||
1855 | /* | ||
1856 | * For non-__GFP_REPEAT allocations which can presumably | ||
1857 | * fail without consequence, stop if we failed to reclaim | ||
1858 | * any pages from the last SWAP_CLUSTER_MAX number of | ||
1859 | * pages that were scanned. This will return to the | ||
1860 | * caller faster at the risk reclaim/compaction and | ||
1861 | * the resulting allocation attempt fails | ||
1862 | */ | ||
1863 | if (!nr_reclaimed) | ||
1864 | return false; | ||
1865 | } | ||
1854 | 1866 | ||
1855 | /* | 1867 | /* |
1856 | * If we have not reclaimed enough pages for compaction and the | 1868 | * If we have not reclaimed enough pages for compaction and the |
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c index 5ee16f0353fe..d763793d39de 100644 --- a/net/rxrpc/ar-key.c +++ b/net/rxrpc/ar-key.c | |||
@@ -89,11 +89,11 @@ static int rxrpc_instantiate_xdr_rxkad(struct key *key, const __be32 *xdr, | |||
89 | return ret; | 89 | return ret; |
90 | 90 | ||
91 | plen -= sizeof(*token); | 91 | plen -= sizeof(*token); |
92 | token = kmalloc(sizeof(*token), GFP_KERNEL); | 92 | token = kzalloc(sizeof(*token), GFP_KERNEL); |
93 | if (!token) | 93 | if (!token) |
94 | return -ENOMEM; | 94 | return -ENOMEM; |
95 | 95 | ||
96 | token->kad = kmalloc(plen, GFP_KERNEL); | 96 | token->kad = kzalloc(plen, GFP_KERNEL); |
97 | if (!token->kad) { | 97 | if (!token->kad) { |
98 | kfree(token); | 98 | kfree(token); |
99 | return -ENOMEM; | 99 | return -ENOMEM; |
@@ -731,10 +731,10 @@ static int rxrpc_instantiate(struct key *key, const void *data, size_t datalen) | |||
731 | goto error; | 731 | goto error; |
732 | 732 | ||
733 | ret = -ENOMEM; | 733 | ret = -ENOMEM; |
734 | token = kmalloc(sizeof(*token), GFP_KERNEL); | 734 | token = kzalloc(sizeof(*token), GFP_KERNEL); |
735 | if (!token) | 735 | if (!token) |
736 | goto error; | 736 | goto error; |
737 | token->kad = kmalloc(plen, GFP_KERNEL); | 737 | token->kad = kzalloc(plen, GFP_KERNEL); |
738 | if (!token->kad) | 738 | if (!token->kad) |
739 | goto error_free; | 739 | goto error_free; |
740 | 740 | ||
diff --git a/sound/core/jack.c b/sound/core/jack.c index 4902ae568730..53b53e97c896 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
@@ -141,6 +141,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, | |||
141 | 141 | ||
142 | fail_input: | 142 | fail_input: |
143 | input_free_device(jack->input_dev); | 143 | input_free_device(jack->input_dev); |
144 | kfree(jack->id); | ||
144 | kfree(jack); | 145 | kfree(jack); |
145 | return err; | 146 | return err; |
146 | } | 147 | } |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index dd7c5c12225d..4d5004e693f0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -3114,6 +3114,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3114 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), | 3114 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), |
3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), | 3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
3117 | SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD), | ||
3118 | SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD), | ||
3117 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3119 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
3118 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), | 3120 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), |
3119 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), | 3121 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), |
@@ -3937,6 +3939,8 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = { | |||
3937 | .patch = patch_cxt5066 }, | 3939 | .patch = patch_cxt5066 }, |
3938 | { .id = 0x14f15069, .name = "CX20585", | 3940 | { .id = 0x14f15069, .name = "CX20585", |
3939 | .patch = patch_cxt5066 }, | 3941 | .patch = patch_cxt5066 }, |
3942 | { .id = 0x14f1506e, .name = "CX20590", | ||
3943 | .patch = patch_cxt5066 }, | ||
3940 | { .id = 0x14f15097, .name = "CX20631", | 3944 | { .id = 0x14f15097, .name = "CX20631", |
3941 | .patch = patch_conexant_auto }, | 3945 | .patch = patch_conexant_auto }, |
3942 | { .id = 0x14f15098, .name = "CX20632", | 3946 | { .id = 0x14f15098, .name = "CX20632", |
@@ -3963,6 +3967,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066"); | |||
3963 | MODULE_ALIAS("snd-hda-codec-id:14f15067"); | 3967 | MODULE_ALIAS("snd-hda-codec-id:14f15067"); |
3964 | MODULE_ALIAS("snd-hda-codec-id:14f15068"); | 3968 | MODULE_ALIAS("snd-hda-codec-id:14f15068"); |
3965 | MODULE_ALIAS("snd-hda-codec-id:14f15069"); | 3969 | MODULE_ALIAS("snd-hda-codec-id:14f15069"); |
3970 | MODULE_ALIAS("snd-hda-codec-id:14f1506e"); | ||
3966 | MODULE_ALIAS("snd-hda-codec-id:14f15097"); | 3971 | MODULE_ALIAS("snd-hda-codec-id:14f15097"); |
3967 | MODULE_ALIAS("snd-hda-codec-id:14f15098"); | 3972 | MODULE_ALIAS("snd-hda-codec-id:14f15098"); |
3968 | MODULE_ALIAS("snd-hda-codec-id:14f150a1"); | 3973 | MODULE_ALIAS("snd-hda-codec-id:14f150a1"); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9ea48b425d0b..bd7b123f6440 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -586,7 +586,12 @@ static hda_nid_t stac92hd83xxx_pin_nids[10] = { | |||
586 | 0x0f, 0x10, 0x11, 0x1f, 0x20, | 586 | 0x0f, 0x10, 0x11, 0x1f, 0x20, |
587 | }; | 587 | }; |
588 | 588 | ||
589 | static hda_nid_t stac92hd88xxx_pin_nids[10] = { | 589 | static hda_nid_t stac92hd87xxx_pin_nids[6] = { |
590 | 0x0a, 0x0b, 0x0c, 0x0d, | ||
591 | 0x0f, 0x11, | ||
592 | }; | ||
593 | |||
594 | static hda_nid_t stac92hd88xxx_pin_nids[8] = { | ||
590 | 0x0a, 0x0b, 0x0c, 0x0d, | 595 | 0x0a, 0x0b, 0x0c, 0x0d, |
591 | 0x0f, 0x11, 0x1f, 0x20, | 596 | 0x0f, 0x11, 0x1f, 0x20, |
592 | }; | 597 | }; |
@@ -5430,12 +5435,13 @@ again: | |||
5430 | switch (codec->vendor_id) { | 5435 | switch (codec->vendor_id) { |
5431 | case 0x111d76d1: | 5436 | case 0x111d76d1: |
5432 | case 0x111d76d9: | 5437 | case 0x111d76d9: |
5438 | case 0x111d76e5: | ||
5433 | spec->dmic_nids = stac92hd87b_dmic_nids; | 5439 | spec->dmic_nids = stac92hd87b_dmic_nids; |
5434 | spec->num_dmics = stac92xx_connected_ports(codec, | 5440 | spec->num_dmics = stac92xx_connected_ports(codec, |
5435 | stac92hd87b_dmic_nids, | 5441 | stac92hd87b_dmic_nids, |
5436 | STAC92HD87B_NUM_DMICS); | 5442 | STAC92HD87B_NUM_DMICS); |
5437 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); | 5443 | spec->num_pins = ARRAY_SIZE(stac92hd87xxx_pin_nids); |
5438 | spec->pin_nids = stac92hd88xxx_pin_nids; | 5444 | spec->pin_nids = stac92hd87xxx_pin_nids; |
5439 | spec->mono_nid = 0; | 5445 | spec->mono_nid = 0; |
5440 | spec->num_pwrs = 0; | 5446 | spec->num_pwrs = 0; |
5441 | break; | 5447 | break; |
@@ -5443,6 +5449,7 @@ again: | |||
5443 | case 0x111d7667: | 5449 | case 0x111d7667: |
5444 | case 0x111d7668: | 5450 | case 0x111d7668: |
5445 | case 0x111d7669: | 5451 | case 0x111d7669: |
5452 | case 0x111d76e3: | ||
5446 | spec->num_dmics = stac92xx_connected_ports(codec, | 5453 | spec->num_dmics = stac92xx_connected_ports(codec, |
5447 | stac92hd88xxx_dmic_nids, | 5454 | stac92hd88xxx_dmic_nids, |
5448 | STAC92HD88XXX_NUM_DMICS); | 5455 | STAC92HD88XXX_NUM_DMICS); |
@@ -6387,6 +6394,8 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
6387 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, | 6394 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, |
6388 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, | 6395 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, |
6389 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, | 6396 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, |
6397 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, | ||
6398 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, | ||
6390 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, | 6399 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, |
6391 | {} /* terminator */ | 6400 | {} /* terminator */ |
6392 | }; | 6401 | }; |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index a76c3260d941..63b0054200a8 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -567,7 +567,7 @@ static void via_auto_init_analog_input(struct hda_codec *codec) | |||
567 | hda_nid_t nid = cfg->inputs[i].pin; | 567 | hda_nid_t nid = cfg->inputs[i].pin; |
568 | if (spec->smart51_enabled && is_smart51_pins(spec, nid)) | 568 | if (spec->smart51_enabled && is_smart51_pins(spec, nid)) |
569 | ctl = PIN_OUT; | 569 | ctl = PIN_OUT; |
570 | else if (i == AUTO_PIN_MIC) | 570 | else if (cfg->inputs[i].type == AUTO_PIN_MIC) |
571 | ctl = PIN_VREF50; | 571 | ctl = PIN_VREF50; |
572 | else | 572 | else |
573 | ctl = PIN_IN; | 573 | ctl = PIN_IN; |
diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h index e8490f3edd03..e3ec2433b215 100644 --- a/sound/soc/codecs/wm8903.h +++ b/sound/soc/codecs/wm8903.h | |||
@@ -165,7 +165,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, | |||
165 | 165 | ||
166 | #define WM8903_VMID_RES_50K 2 | 166 | #define WM8903_VMID_RES_50K 2 |
167 | #define WM8903_VMID_RES_250K 3 | 167 | #define WM8903_VMID_RES_250K 3 |
168 | #define WM8903_VMID_RES_5K 4 | 168 | #define WM8903_VMID_RES_5K 6 |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * R8 (0x08) - Analogue DAC 0 | 171 | * R8 (0x08) - Analogue DAC 0 |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index a60b5dbf0154..ebaee5ca7434 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -3000,11 +3000,10 @@ static void wm8958_default_micdet(u16 status, void *data) | |||
3000 | report |= SND_JACK_BTN_5; | 3000 | report |= SND_JACK_BTN_5; |
3001 | 3001 | ||
3002 | done: | 3002 | done: |
3003 | snd_soc_jack_report(wm8994->micdet[0].jack, | 3003 | snd_soc_jack_report(wm8994->micdet[0].jack, report, |
3004 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | | 3004 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | |
3005 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | | 3005 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | |
3006 | SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT, | 3006 | SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT); |
3007 | report); | ||
3008 | } | 3007 | } |
3009 | 3008 | ||
3010 | /** | 3009 | /** |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 613df5db0b32..516892706063 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -674,6 +674,9 @@ SND_SOC_DAPM_OUTPUT("LINEOUT2N"), | |||
674 | }; | 674 | }; |
675 | 675 | ||
676 | static const struct snd_soc_dapm_route analogue_routes[] = { | 676 | static const struct snd_soc_dapm_route analogue_routes[] = { |
677 | { "MICBIAS1", NULL, "CLK_SYS" }, | ||
678 | { "MICBIAS2", NULL, "CLK_SYS" }, | ||
679 | |||
677 | { "IN1L PGA", "IN1LP Switch", "IN1LP" }, | 680 | { "IN1L PGA", "IN1LP Switch", "IN1LP" }, |
678 | { "IN1L PGA", "IN1LN Switch", "IN1LN" }, | 681 | { "IN1L PGA", "IN1LN Switch", "IN1LN" }, |
679 | 682 | ||
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index e20c9e1457c0..1e9bccae4e80 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
@@ -79,7 +79,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { | |||
79 | .name = "tlv320aic23", | 79 | .name = "tlv320aic23", |
80 | .stream_name = "TLV320AIC23", | 80 | .stream_name = "TLV320AIC23", |
81 | .codec_dai_name = "tlv320aic23-hifi", | 81 | .codec_dai_name = "tlv320aic23-hifi", |
82 | .platform_name = "imx-pcm-audio.0", | 82 | .platform_name = "imx-fiq-pcm-audio.0", |
83 | .codec_name = "tlv320aic23-codec.0-001a", | 83 | .codec_name = "tlv320aic23-codec.0-001a", |
84 | .cpu_dai_name = "imx-ssi.0", | 84 | .cpu_dai_name = "imx-ssi.0", |
85 | .ops = &eukrea_tlv320_snd_ops, | 85 | .ops = &eukrea_tlv320_snd_ops, |
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 28333e7d9c50..dc65650a6fa1 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c | |||
@@ -117,7 +117,7 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
117 | { | 117 | { |
118 | .name = "AC97", | 118 | .name = "AC97", |
119 | .stream_name = "AC97 HiFi", | 119 | .stream_name = "AC97 HiFi", |
120 | .cpu_dai_name = "pxa-ac97.0", | 120 | .cpu_dai_name = "pxa2xx-ac97", |
121 | .codec_dai_name = "wm9705-hifi", | 121 | .codec_dai_name = "wm9705-hifi", |
122 | .platform_name = "pxa-pcm-audio", | 122 | .platform_name = "pxa-pcm-audio", |
123 | .codec_name = "wm9705-codec", | 123 | .codec_name = "wm9705-codec", |
@@ -126,7 +126,7 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
126 | { | 126 | { |
127 | .name = "AC97 Aux", | 127 | .name = "AC97 Aux", |
128 | .stream_name = "AC97 Aux", | 128 | .stream_name = "AC97 Aux", |
129 | .cpu_dai_name = "pxa-ac97.1", | 129 | .cpu_dai_name = "pxa2xx-ac97-aux", |
130 | .codec_dai_name = "wm9705-aux", | 130 | .codec_dai_name = "wm9705-aux", |
131 | .platform_name = "pxa-pcm-audio", | 131 | .platform_name = "pxa-pcm-audio", |
132 | .codec_name = "wm9705-codec", | 132 | .codec_name = "wm9705-codec", |
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 01bf31675c55..51897fcd911b 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c | |||
@@ -99,7 +99,7 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
99 | { | 99 | { |
100 | .name = "AC97", | 100 | .name = "AC97", |
101 | .stream_name = "AC97 HiFi", | 101 | .stream_name = "AC97 HiFi", |
102 | .cpu_dai_name = "pxa-ac97.0", | 102 | .cpu_dai_name = "pxa2xx-ac97", |
103 | .codec_dai_name = "wm9705-hifi", | 103 | .codec_dai_name = "wm9705-hifi", |
104 | .platform_name = "pxa-pcm-audio", | 104 | .platform_name = "pxa-pcm-audio", |
105 | .codec_name = "wm9705-codec", | 105 | .codec_name = "wm9705-codec", |
@@ -109,7 +109,7 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
109 | { | 109 | { |
110 | .name = "AC97 Aux", | 110 | .name = "AC97 Aux", |
111 | .stream_name = "AC97 Aux", | 111 | .stream_name = "AC97 Aux", |
112 | .cpu_dai_name = "pxa-ac97.1", | 112 | .cpu_dai_name = "pxa2xx-ac97-aux", |
113 | .codec_dai_name ="wm9705-aux", | 113 | .codec_dai_name ="wm9705-aux", |
114 | .platform_name = "pxa-pcm-audio", | 114 | .platform_name = "pxa-pcm-audio", |
115 | .codec_name = "wm9705-codec", | 115 | .codec_name = "wm9705-codec", |
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index c6a37c6ef23b..053ed208e59f 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c | |||
@@ -89,7 +89,7 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
89 | { | 89 | { |
90 | .name = "AC97", | 90 | .name = "AC97", |
91 | .stream_name = "AC97 HiFi", | 91 | .stream_name = "AC97 HiFi", |
92 | .cpu_dai_name = "pxa-ac97.0", | 92 | .cpu_dai_name = "pxa2xx-ac97", |
93 | .codec_dai_name = "wm9712-hifi", | 93 | .codec_dai_name = "wm9712-hifi", |
94 | .platform_name = "pxa-pcm-audio", | 94 | .platform_name = "pxa-pcm-audio", |
95 | .codec_name = "wm9712-codec", | 95 | .codec_name = "wm9712-codec", |
@@ -98,7 +98,7 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
98 | { | 98 | { |
99 | .name = "AC97 Aux", | 99 | .name = "AC97 Aux", |
100 | .stream_name = "AC97 Aux", | 100 | .stream_name = "AC97 Aux", |
101 | .cpu_dai_name = "pxa-ac97.1", | 101 | .cpu_dai_name = "pxa2xx-ac97-aux", |
102 | .codec_dai_name ="wm9712-aux", | 102 | .codec_dai_name ="wm9712-aux", |
103 | .platform_name = "pxa-pcm-audio", | 103 | .platform_name = "pxa-pcm-audio", |
104 | .codec_name = "wm9712-codec", | 104 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index fc22e6eefc98..b13a4252812d 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c | |||
@@ -37,7 +37,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
37 | { | 37 | { |
38 | .name = "AC97", | 38 | .name = "AC97", |
39 | .stream_name = "AC97 HiFi", | 39 | .stream_name = "AC97 HiFi", |
40 | .cpu_dai_name = "pxa-ac97.0", | 40 | .cpu_dai_name = "pxa2xx-ac97", |
41 | .codec_dai_name = "wm9712-hifi", | 41 | .codec_dai_name = "wm9712-hifi", |
42 | .platform_name = "pxa-pcm-audio", | 42 | .platform_name = "pxa-pcm-audio", |
43 | .codec_name = "wm9712-codec", | 43 | .codec_name = "wm9712-codec", |
@@ -45,7 +45,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
45 | { | 45 | { |
46 | .name = "AC97 Aux", | 46 | .name = "AC97 Aux", |
47 | .stream_name = "AC97 Aux", | 47 | .stream_name = "AC97 Aux", |
48 | .cpu_dai_name = "pxa-ac97.1", | 48 | .cpu_dai_name = "pxa2xx-ac97-aux", |
49 | .codec_dai_name ="wm9712-aux", | 49 | .codec_dai_name ="wm9712-aux", |
50 | .platform_name = "pxa-pcm-audio", | 50 | .platform_name = "pxa-pcm-audio", |
51 | .codec_name = "wm9712-codec", | 51 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 0d70fc8c12bd..38ca6759907e 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c | |||
@@ -162,7 +162,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
162 | { | 162 | { |
163 | .name = "AC97", | 163 | .name = "AC97", |
164 | .stream_name = "AC97 HiFi", | 164 | .stream_name = "AC97 HiFi", |
165 | .cpu_dai_name = "pxa-ac97.0", | 165 | .cpu_dai_name = "pxa2xx-ac97", |
166 | .codec_dai_name = "wm9713-hifi", | 166 | .codec_dai_name = "wm9713-hifi", |
167 | .codec_name = "wm9713-codec", | 167 | .codec_name = "wm9713-codec", |
168 | .init = mioa701_wm9713_init, | 168 | .init = mioa701_wm9713_init, |
@@ -172,7 +172,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
172 | { | 172 | { |
173 | .name = "AC97 Aux", | 173 | .name = "AC97 Aux", |
174 | .stream_name = "AC97 Aux", | 174 | .stream_name = "AC97 Aux", |
175 | .cpu_dai_name = "pxa-ac97.1", | 175 | .cpu_dai_name = "pxa2xx-ac97-aux", |
176 | .codec_dai_name ="wm9713-aux", | 176 | .codec_dai_name ="wm9713-aux", |
177 | .codec_name = "wm9713-codec", | 177 | .codec_name = "wm9713-codec", |
178 | .platform_name = "pxa-pcm-audio", | 178 | .platform_name = "pxa-pcm-audio", |
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 857db96d4a4f..504e4004f004 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c | |||
@@ -132,7 +132,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
132 | { | 132 | { |
133 | .name = "AC97 HiFi", | 133 | .name = "AC97 HiFi", |
134 | .stream_name = "AC97 HiFi", | 134 | .stream_name = "AC97 HiFi", |
135 | .cpu_dai_name = "pxa-ac97.0", | 135 | .cpu_dai_name = "pxa2xx-ac97", |
136 | .codec_dai_name = "wm9712-hifi", | 136 | .codec_dai_name = "wm9712-hifi", |
137 | .codec_name = "wm9712-codec", | 137 | .codec_name = "wm9712-codec", |
138 | .platform_name = "pxa-pcm-audio", | 138 | .platform_name = "pxa-pcm-audio", |
@@ -141,7 +141,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
141 | { | 141 | { |
142 | .name = "AC97 Aux", | 142 | .name = "AC97 Aux", |
143 | .stream_name = "AC97 Aux", | 143 | .stream_name = "AC97 Aux", |
144 | .cpu_dai_name = "pxa-ac97.1", | 144 | .cpu_dai_name = "pxa2xx-ac97-aux", |
145 | .codec_dai_name = "wm9712-aux", | 145 | .codec_dai_name = "wm9712-aux", |
146 | .codec_name = "wm9712-codec", | 146 | .codec_name = "wm9712-codec", |
147 | .platform_name = "pxa-pcm-audio", | 147 | .platform_name = "pxa-pcm-audio", |
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index f75804ef0897..4b6e5d608b42 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
@@ -219,7 +219,7 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
219 | { | 219 | { |
220 | .name = "AC97", | 220 | .name = "AC97", |
221 | .stream_name = "AC97 HiFi", | 221 | .stream_name = "AC97 HiFi", |
222 | .cpu_dai_name = "pxa-ac97.0", | 222 | .cpu_dai_name = "pxa2xx-ac97", |
223 | .codec_dai_name = "wm9712-hifi", | 223 | .codec_dai_name = "wm9712-hifi", |
224 | .platform_name = "pxa-pcm-audio", | 224 | .platform_name = "pxa-pcm-audio", |
225 | .codec_name = "wm9712-codec", | 225 | .codec_name = "wm9712-codec", |
@@ -229,7 +229,7 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
229 | { | 229 | { |
230 | .name = "AC97 Aux", | 230 | .name = "AC97 Aux", |
231 | .stream_name = "AC97 Aux", | 231 | .stream_name = "AC97 Aux", |
232 | .cpu_dai_name = "pxa-ac97.1", | 232 | .cpu_dai_name = "pxa2xx-ac97-aux", |
233 | .codec_dai_name = "wm9712-aux", | 233 | .codec_dai_name = "wm9712-aux", |
234 | .platform_name = "pxa-pcm-audio", | 234 | .platform_name = "pxa-pcm-audio", |
235 | .codec_name = "wm9712-codec", | 235 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c index b222a7d72027..25bba108fea3 100644 --- a/sound/soc/pxa/zylonite.c +++ b/sound/soc/pxa/zylonite.c | |||
@@ -166,7 +166,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
166 | .stream_name = "AC97 HiFi", | 166 | .stream_name = "AC97 HiFi", |
167 | .codec_name = "wm9713-codec", | 167 | .codec_name = "wm9713-codec", |
168 | .platform_name = "pxa-pcm-audio", | 168 | .platform_name = "pxa-pcm-audio", |
169 | .cpu_dai_name = "pxa-ac97.0", | 169 | .cpu_dai_name = "pxa2xx-ac97", |
170 | .codec_name = "wm9713-hifi", | 170 | .codec_name = "wm9713-hifi", |
171 | .init = zylonite_wm9713_init, | 171 | .init = zylonite_wm9713_init, |
172 | }, | 172 | }, |
@@ -175,7 +175,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
175 | .stream_name = "AC97 Aux", | 175 | .stream_name = "AC97 Aux", |
176 | .codec_name = "wm9713-codec", | 176 | .codec_name = "wm9713-codec", |
177 | .platform_name = "pxa-pcm-audio", | 177 | .platform_name = "pxa-pcm-audio", |
178 | .cpu_dai_name = "pxa-ac97.1", | 178 | .cpu_dai_name = "pxa2xx-ac97-aux", |
179 | .codec_name = "wm9713-aux", | 179 | .codec_name = "wm9713-aux", |
180 | }, | 180 | }, |
181 | { | 181 | { |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 800f7cb4f251..c0f8270bc199 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | 325 | ||
326 | mutex_init(&chip->shutdown_mutex); | ||
326 | chip->index = idx; | 327 | chip->index = idx; |
327 | chip->dev = dev; | 328 | chip->dev = dev; |
328 | chip->card = card; | 329 | chip->card = card; |
@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
531 | chip = ptr; | 532 | chip = ptr; |
532 | card = chip->card; | 533 | card = chip->card; |
533 | mutex_lock(®ister_mutex); | 534 | mutex_lock(®ister_mutex); |
535 | mutex_lock(&chip->shutdown_mutex); | ||
534 | chip->shutdown = 1; | 536 | chip->shutdown = 1; |
535 | chip->num_interfaces--; | 537 | chip->num_interfaces--; |
536 | if (chip->num_interfaces <= 0) { | 538 | if (chip->num_interfaces <= 0) { |
@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
548 | snd_usb_mixer_disconnect(p); | 550 | snd_usb_mixer_disconnect(p); |
549 | } | 551 | } |
550 | usb_chip[chip->index] = NULL; | 552 | usb_chip[chip->index] = NULL; |
553 | mutex_unlock(&chip->shutdown_mutex); | ||
551 | mutex_unlock(®ister_mutex); | 554 | mutex_unlock(®ister_mutex); |
552 | snd_card_free_when_closed(card); | 555 | snd_card_free_when_closed(card); |
553 | } else { | 556 | } else { |
557 | mutex_unlock(&chip->shutdown_mutex); | ||
554 | mutex_unlock(®ister_mutex); | 558 | mutex_unlock(®ister_mutex); |
555 | } | 559 | } |
556 | } | 560 | } |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 4132522ac90f..e3f680526cb5 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -361,6 +361,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
361 | } | 361 | } |
362 | 362 | ||
363 | if (changed) { | 363 | if (changed) { |
364 | mutex_lock(&subs->stream->chip->shutdown_mutex); | ||
364 | /* format changed */ | 365 | /* format changed */ |
365 | snd_usb_release_substream_urbs(subs, 0); | 366 | snd_usb_release_substream_urbs(subs, 0); |
366 | /* influenced: period_bytes, channels, rate, format, */ | 367 | /* influenced: period_bytes, channels, rate, format, */ |
@@ -368,6 +369,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
368 | params_rate(hw_params), | 369 | params_rate(hw_params), |
369 | snd_pcm_format_physical_width(params_format(hw_params)) * | 370 | snd_pcm_format_physical_width(params_format(hw_params)) * |
370 | params_channels(hw_params)); | 371 | params_channels(hw_params)); |
372 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
371 | } | 373 | } |
372 | 374 | ||
373 | return ret; | 375 | return ret; |
@@ -385,8 +387,9 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
385 | subs->cur_audiofmt = NULL; | 387 | subs->cur_audiofmt = NULL; |
386 | subs->cur_rate = 0; | 388 | subs->cur_rate = 0; |
387 | subs->period_bytes = 0; | 389 | subs->period_bytes = 0; |
388 | if (!subs->stream->chip->shutdown) | 390 | mutex_lock(&subs->stream->chip->shutdown_mutex); |
389 | snd_usb_release_substream_urbs(subs, 0); | 391 | snd_usb_release_substream_urbs(subs, 0); |
392 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
390 | return snd_pcm_lib_free_vmalloc_buffer(substream); | 393 | return snd_pcm_lib_free_vmalloc_buffer(substream); |
391 | } | 394 | } |
392 | 395 | ||
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index db3eb21627ee..6e66fffe87f5 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -36,6 +36,7 @@ struct snd_usb_audio { | |||
36 | struct snd_card *card; | 36 | struct snd_card *card; |
37 | u32 usb_id; | 37 | u32 usb_id; |
38 | int shutdown; | 38 | int shutdown; |
39 | struct mutex shutdown_mutex; | ||
39 | unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ | 40 | unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ |
40 | int num_interfaces; | 41 | int num_interfaces; |
41 | int num_suspended_intf; | 42 | int num_suspended_intf; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 746cf03cb05d..0ace786e83e0 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -264,9 +264,6 @@ pid_put_sample(int pid, int type, unsigned int cpu, u64 start, u64 end) | |||
264 | c->start_time = start; | 264 | c->start_time = start; |
265 | if (p->start_time == 0 || p->start_time > start) | 265 | if (p->start_time == 0 || p->start_time > start) |
266 | p->start_time = start; | 266 | p->start_time = start; |
267 | |||
268 | if (cpu > numcpus) | ||
269 | numcpus = cpu; | ||
270 | } | 267 | } |
271 | 268 | ||
272 | #define MAX_CPUS 4096 | 269 | #define MAX_CPUS 4096 |
@@ -511,6 +508,9 @@ static int process_sample_event(event_t *event __used, | |||
511 | if (!event_str) | 508 | if (!event_str) |
512 | return 0; | 509 | return 0; |
513 | 510 | ||
511 | if (sample->cpu > numcpus) | ||
512 | numcpus = sample->cpu; | ||
513 | |||
514 | if (strcmp(event_str, "power:cpu_idle") == 0) { | 514 | if (strcmp(event_str, "power:cpu_idle") == 0) { |
515 | struct power_processor_entry *ppe = (void *)te; | 515 | struct power_processor_entry *ppe = (void *)te; |
516 | if (ppe->state == (u32)PWR_EVENT_EXIT) | 516 | if (ppe->state == (u32)PWR_EVENT_EXIT) |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 32f4f1f2f6e4..df51560f16f7 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -585,6 +585,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
585 | { | 585 | { |
586 | struct sort_entry *se; | 586 | struct sort_entry *se; |
587 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; | 587 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; |
588 | u64 nr_events; | ||
588 | const char *sep = symbol_conf.field_sep; | 589 | const char *sep = symbol_conf.field_sep; |
589 | int ret; | 590 | int ret; |
590 | 591 | ||
@@ -593,6 +594,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
593 | 594 | ||
594 | if (pair_hists) { | 595 | if (pair_hists) { |
595 | period = self->pair ? self->pair->period : 0; | 596 | period = self->pair ? self->pair->period : 0; |
597 | nr_events = self->pair ? self->pair->nr_events : 0; | ||
596 | total = pair_hists->stats.total_period; | 598 | total = pair_hists->stats.total_period; |
597 | period_sys = self->pair ? self->pair->period_sys : 0; | 599 | period_sys = self->pair ? self->pair->period_sys : 0; |
598 | period_us = self->pair ? self->pair->period_us : 0; | 600 | period_us = self->pair ? self->pair->period_us : 0; |
@@ -600,6 +602,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
600 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; | 602 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; |
601 | } else { | 603 | } else { |
602 | period = self->period; | 604 | period = self->period; |
605 | nr_events = self->nr_events; | ||
603 | total = session_total; | 606 | total = session_total; |
604 | period_sys = self->period_sys; | 607 | period_sys = self->period_sys; |
605 | period_us = self->period_us; | 608 | period_us = self->period_us; |
@@ -640,9 +643,9 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
640 | 643 | ||
641 | if (symbol_conf.show_nr_samples) { | 644 | if (symbol_conf.show_nr_samples) { |
642 | if (sep) | 645 | if (sep) |
643 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); | 646 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); |
644 | else | 647 | else |
645 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, period); | 648 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); |
646 | } | 649 | } |
647 | 650 | ||
648 | if (pair_hists) { | 651 | if (pair_hists) { |
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index fb737fe9be91..96c866045d60 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
@@ -456,9 +456,9 @@ void svg_legenda(void) | |||
456 | return; | 456 | return; |
457 | 457 | ||
458 | svg_legenda_box(0, "Running", "sample"); | 458 | svg_legenda_box(0, "Running", "sample"); |
459 | svg_legenda_box(100, "Idle","rect.c1"); | 459 | svg_legenda_box(100, "Idle","c1"); |
460 | svg_legenda_box(200, "Deeper Idle", "rect.c3"); | 460 | svg_legenda_box(200, "Deeper Idle", "c3"); |
461 | svg_legenda_box(350, "Deepest Idle", "rect.c6"); | 461 | svg_legenda_box(350, "Deepest Idle", "c6"); |
462 | svg_legenda_box(550, "Sleeping", "process2"); | 462 | svg_legenda_box(550, "Sleeping", "process2"); |
463 | svg_legenda_box(650, "Waiting for cpu", "waiting"); | 463 | svg_legenda_box(650, "Waiting for cpu", "waiting"); |
464 | svg_legenda_box(800, "Blocked on IO", "blocked"); | 464 | svg_legenda_box(800, "Blocked on IO", "blocked"); |