diff options
48 files changed, 1001 insertions, 630 deletions
diff --git a/Documentation/thinkpad-acpi.txt b/Documentation/thinkpad-acpi.txt index ec499265deca..10c041ca13c7 100644 --- a/Documentation/thinkpad-acpi.txt +++ b/Documentation/thinkpad-acpi.txt | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ThinkPad ACPI Extras Driver | 1 | ThinkPad ACPI Extras Driver |
| 2 | 2 | ||
| 3 | Version 0.16 | 3 | Version 0.17 |
| 4 | August 2nd, 2007 | 4 | October 04th, 2007 |
| 5 | 5 | ||
| 6 | Borislav Deianov <borislav@users.sf.net> | 6 | Borislav Deianov <borislav@users.sf.net> |
| 7 | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 7 | Henrique de Moraes Holschuh <hmh@hmh.eng.br> |
| @@ -923,19 +923,34 @@ sysfs backlight device "thinkpad_screen" | |||
| 923 | This feature allows software control of the LCD brightness on ThinkPad | 923 | This feature allows software control of the LCD brightness on ThinkPad |
| 924 | models which don't have a hardware brightness slider. | 924 | models which don't have a hardware brightness slider. |
| 925 | 925 | ||
| 926 | It has some limitations: the LCD backlight cannot be actually turned on or off | 926 | It has some limitations: the LCD backlight cannot be actually turned on or |
| 927 | by this interface, and in many ThinkPad models, the "dim while on battery" | 927 | off by this interface, and in many ThinkPad models, the "dim while on |
| 928 | functionality will be enabled by the BIOS when this interface is used, and | 928 | battery" functionality will be enabled by the BIOS when this interface is |
| 929 | cannot be controlled. | 929 | used, and cannot be controlled. |
| 930 | 930 | ||
| 931 | The backlight control has eight levels, ranging from 0 to 7. Some of the | 931 | On IBM (and some of the earlier Lenovo) ThinkPads, the backlight control |
| 932 | levels may not be distinct. | 932 | has eight brightness levels, ranging from 0 to 7. Some of the levels |
| 933 | 933 | may not be distinct. Later Lenovo models that implement the ACPI | |
| 934 | There are two interfaces to the firmware for brightness control, EC and CMOS. | 934 | display backlight brightness control methods have 16 levels, ranging |
| 935 | To select which one should be used, use the brightness_mode module parameter: | 935 | from 0 to 15. |
| 936 | brightness_mode=1 selects EC mode, brightness_mode=2 selects CMOS mode, | 936 | |
| 937 | brightness_mode=3 selects both EC and CMOS. The driver tries to autodetect | 937 | There are two interfaces to the firmware for direct brightness control, |
| 938 | which interface to use. | 938 | EC and CMOS. To select which one should be used, use the |
| 939 | brightness_mode module parameter: brightness_mode=1 selects EC mode, | ||
| 940 | brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC | ||
| 941 | and CMOS. The driver tries to autodetect which interface to use. | ||
| 942 | |||
| 943 | When display backlight brightness controls are available through the | ||
| 944 | standard ACPI interface, it is best to use it instead of this direct | ||
| 945 | ThinkPad-specific interface. The driver will disable its native | ||
| 946 | backlight brightness control interface if it detects that the standard | ||
| 947 | ACPI interface is available in the ThinkPad. | ||
| 948 | |||
| 949 | The brightness_enable module parameter can be used to control whether | ||
| 950 | the LCD brightness control feature will be enabled when available. | ||
| 951 | brightness_enable=0 forces it to be disabled. brightness_enable=1 | ||
| 952 | forces it to be enabled when available, even if the standard ACPI | ||
| 953 | interface is also available. | ||
| 939 | 954 | ||
| 940 | Procfs notes: | 955 | Procfs notes: |
| 941 | 956 | ||
| @@ -947,11 +962,11 @@ Procfs notes: | |||
| 947 | 962 | ||
| 948 | Sysfs notes: | 963 | Sysfs notes: |
| 949 | 964 | ||
| 950 | The interface is implemented through the backlight sysfs class, which is poorly | 965 | The interface is implemented through the backlight sysfs class, which is |
| 951 | documented at this time. | 966 | poorly documented at this time. |
| 952 | 967 | ||
| 953 | Locate the thinkpad_screen device under /sys/class/backlight, and inside it | 968 | Locate the thinkpad_screen device under /sys/class/backlight, and inside |
| 954 | there will be the following attributes: | 969 | it there will be the following attributes: |
| 955 | 970 | ||
| 956 | max_brightness: | 971 | max_brightness: |
| 957 | Reads the maximum brightness the hardware can be set to. | 972 | Reads the maximum brightness the hardware can be set to. |
| @@ -961,17 +976,19 @@ there will be the following attributes: | |||
| 961 | Reads what brightness the screen is set to at this instant. | 976 | Reads what brightness the screen is set to at this instant. |
| 962 | 977 | ||
| 963 | brightness: | 978 | brightness: |
| 964 | Writes request the driver to change brightness to the given | 979 | Writes request the driver to change brightness to the |
| 965 | value. Reads will tell you what brightness the driver is trying | 980 | given value. Reads will tell you what brightness the |
| 966 | to set the display to when "power" is set to zero and the display | 981 | driver is trying to set the display to when "power" is set |
| 967 | has not been dimmed by a kernel power management event. | 982 | to zero and the display has not been dimmed by a kernel |
| 983 | power management event. | ||
| 968 | 984 | ||
| 969 | power: | 985 | power: |
| 970 | power management mode, where 0 is "display on", and 1 to 3 will | 986 | power management mode, where 0 is "display on", and 1 to 3 |
| 971 | dim the display backlight to brightness level 0 because | 987 | will dim the display backlight to brightness level 0 |
| 972 | thinkpad-acpi cannot really turn the backlight off. Kernel | 988 | because thinkpad-acpi cannot really turn the backlight |
| 973 | power management events can temporarily increase the current | 989 | off. Kernel power management events can temporarily |
| 974 | power management level, i.e. they can dim the display. | 990 | increase the current power management level, i.e. they can |
| 991 | dim the display. | ||
| 975 | 992 | ||
| 976 | 993 | ||
| 977 | Volume control -- /proc/acpi/ibm/volume | 994 | Volume control -- /proc/acpi/ibm/volume |
| @@ -1,7 +1,7 @@ | |||
| 1 | VERSION = 2 | 1 | VERSION = 2 |
| 2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
| 3 | SUBLEVEL = 24 | 3 | SUBLEVEL = 24 |
| 4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc3 |
| 5 | NAME = Arr Matey! A Hairy Bilge Rat! | 5 | NAME = Arr Matey! A Hairy Bilge Rat! |
| 6 | 6 | ||
| 7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
| @@ -200,11 +200,9 @@ SRCARCH := $(ARCH) | |||
| 200 | # Additional ARCH settings for x86 | 200 | # Additional ARCH settings for x86 |
| 201 | ifeq ($(ARCH),i386) | 201 | ifeq ($(ARCH),i386) |
| 202 | SRCARCH := x86 | 202 | SRCARCH := x86 |
| 203 | K64BIT := n | ||
| 204 | endif | 203 | endif |
| 205 | ifeq ($(ARCH),x86_64) | 204 | ifeq ($(ARCH),x86_64) |
| 206 | SRCARCH := x86 | 205 | SRCARCH := x86 |
| 207 | K64BIT := y | ||
| 208 | endif | 206 | endif |
| 209 | 207 | ||
| 210 | KCONFIG_CONFIG ?= .config | 208 | KCONFIG_CONFIG ?= .config |
| @@ -341,7 +339,7 @@ KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null) | |||
| 341 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | 339 | KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) |
| 342 | 340 | ||
| 343 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | 341 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
| 344 | export ARCH SRCARCH K64BIT CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | 342 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
| 345 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE | 343 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE |
| 346 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 344 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
| 347 | 345 | ||
| @@ -1334,12 +1332,7 @@ else | |||
| 1334 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) | 1332 | ALLINCLUDE_ARCHS := $(ALLSOURCE_ARCHS) |
| 1335 | endif | 1333 | endif |
| 1336 | 1334 | ||
| 1337 | # Take care of arch/x86 | 1335 | ALLSOURCE_ARCHS := $(SRCARCH) |
| 1338 | ifeq ($(ARCH), $(SRCARCH)) | ||
| 1339 | ALLSOURCE_ARCHS := $(ARCH) | ||
| 1340 | else | ||
| 1341 | ALLSOURCE_ARCHS := $(ARCH) $(SRCARCH) | ||
| 1342 | endif | ||
| 1343 | 1336 | ||
| 1344 | define find-sources | 1337 | define find-sources |
| 1345 | ( for arch in $(ALLSOURCE_ARCHS) ; do \ | 1338 | ( for arch in $(ALLSOURCE_ARCHS) ; do \ |
| @@ -194,8 +194,6 @@ CONFIGURING the kernel: | |||
| 194 | "make *config" checks for a file named "all{yes/mod/no/random}.config" | 194 | "make *config" checks for a file named "all{yes/mod/no/random}.config" |
| 195 | for symbol values that are to be forced. If this file is not found, | 195 | for symbol values that are to be forced. If this file is not found, |
| 196 | it checks for a file named "all.config" to contain forced values. | 196 | it checks for a file named "all.config" to contain forced values. |
| 197 | Finally it checks the environment variable K64BIT and if found, sets | ||
| 198 | the config symbol "64BIT" to the value of the K64BIT variable. | ||
| 199 | 197 | ||
| 200 | NOTES on "make config": | 198 | NOTES on "make config": |
| 201 | - having unnecessary drivers will make the kernel bigger, and can | 199 | - having unnecessary drivers will make the kernel bigger, and can |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 5da798282a54..61d9c9d69e6b 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
| @@ -150,22 +150,45 @@ static void clk_pxa3xx_cken_disable(struct clk *clk) | |||
| 150 | local_irq_enable(); | 150 | local_irq_enable(); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | static const struct clkops clk_pxa3xx_cken_ops = { | ||
| 154 | .enable = clk_pxa3xx_cken_enable, | ||
| 155 | .disable = clk_pxa3xx_cken_disable, | ||
| 156 | }; | ||
| 157 | |||
| 153 | static const struct clkops clk_pxa3xx_hsio_ops = { | 158 | static const struct clkops clk_pxa3xx_hsio_ops = { |
| 154 | .enable = clk_pxa3xx_cken_enable, | 159 | .enable = clk_pxa3xx_cken_enable, |
| 155 | .disable = clk_pxa3xx_cken_disable, | 160 | .disable = clk_pxa3xx_cken_disable, |
| 156 | .getrate = clk_pxa3xx_hsio_getrate, | 161 | .getrate = clk_pxa3xx_hsio_getrate, |
| 157 | }; | 162 | }; |
| 158 | 163 | ||
| 164 | #define PXA3xx_CKEN(_name, _cken, _rate, _delay, _dev) \ | ||
| 165 | { \ | ||
| 166 | .name = _name, \ | ||
| 167 | .dev = _dev, \ | ||
| 168 | .ops = &clk_pxa3xx_cken_ops, \ | ||
| 169 | .rate = _rate, \ | ||
| 170 | .cken = CKEN_##_cken, \ | ||
| 171 | .delay = _delay, \ | ||
| 172 | } | ||
| 173 | |||
| 174 | #define PXA3xx_CK(_name, _cken, _ops, _dev) \ | ||
| 175 | { \ | ||
| 176 | .name = _name, \ | ||
| 177 | .dev = _dev, \ | ||
| 178 | .ops = _ops, \ | ||
| 179 | .cken = CKEN_##_cken, \ | ||
| 180 | } | ||
| 181 | |||
| 159 | static struct clk pxa3xx_clks[] = { | 182 | static struct clk pxa3xx_clks[] = { |
| 160 | INIT_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), | 183 | PXA3xx_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev), |
| 161 | INIT_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), | 184 | PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL), |
| 162 | 185 | ||
| 163 | INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), | 186 | PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev), |
| 164 | INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), | 187 | PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev), |
| 165 | INIT_CKEN("UARTCLK", STUART, 14857000, 1, NULL), | 188 | PXA3xx_CKEN("UARTCLK", STUART, 14857000, 1, NULL), |
| 166 | 189 | ||
| 167 | INIT_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), | 190 | PXA3xx_CKEN("I2CCLK", I2C, 32842000, 0, &pxa_device_i2c.dev), |
| 168 | INIT_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), | 191 | PXA3xx_CKEN("UDCCLK", UDC, 48000000, 5, &pxa_device_udc.dev), |
| 169 | }; | 192 | }; |
| 170 | 193 | ||
| 171 | void __init pxa3xx_init_irq(void) | 194 | void __init pxa3xx_init_irq(void) |
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c index cefdf2f9f26e..333a82a3717e 100644 --- a/arch/arm/mm/consistent.c +++ b/arch/arm/mm/consistent.c | |||
| @@ -322,7 +322,6 @@ static int dma_mmap(struct device *dev, struct vm_area_struct *vma, | |||
| 322 | 322 | ||
| 323 | if (off < kern_size && | 323 | if (off < kern_size && |
| 324 | user_size <= (kern_size - off)) { | 324 | user_size <= (kern_size - off)) { |
| 325 | vma->vm_flags |= VM_RESERVED; | ||
| 326 | ret = remap_pfn_range(vma, vma->vm_start, | 325 | ret = remap_pfn_range(vma, vma->vm_start, |
| 327 | page_to_pfn(c->vm_pages) + off, | 326 | page_to_pfn(c->vm_pages) + off, |
| 328 | user_size << PAGE_SHIFT, | 327 | user_size << PAGE_SHIFT, |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 1eb59971af5d..368864dfe6eb 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -3,8 +3,8 @@ mainmenu "Linux Kernel Configuration for x86" | |||
| 3 | 3 | ||
| 4 | # Select 32 or 64 bit | 4 | # Select 32 or 64 bit |
| 5 | config 64BIT | 5 | config 64BIT |
| 6 | bool "64-bit kernel" | 6 | bool "64-bit kernel" if ARCH = "x86" |
| 7 | default n | 7 | default ARCH = "x86_64" |
| 8 | help | 8 | help |
| 9 | Say yes to build a 64-bit kernel - formerly known as x86_64 | 9 | Say yes to build a 64-bit kernel - formerly known as x86_64 |
| 10 | Say no to build a 32-bit kernel - formerly known as i386 | 10 | Say no to build a 32-bit kernel - formerly known as i386 |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 289247d974c6..0ca27c7b0e8d 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
| @@ -637,6 +637,38 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table) | |||
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | hpet_address = hpet_tbl->address.address; | 639 | hpet_address = hpet_tbl->address.address; |
| 640 | |||
| 641 | /* | ||
| 642 | * Some broken BIOSes advertise HPET at 0x0. We really do not | ||
| 643 | * want to allocate a resource there. | ||
| 644 | */ | ||
| 645 | if (!hpet_address) { | ||
| 646 | printk(KERN_WARNING PREFIX | ||
| 647 | "HPET id: %#x base: %#lx is invalid\n", | ||
| 648 | hpet_tbl->id, hpet_address); | ||
| 649 | return 0; | ||
| 650 | } | ||
| 651 | #ifdef CONFIG_X86_64 | ||
| 652 | /* | ||
| 653 | * Some even more broken BIOSes advertise HPET at | ||
| 654 | * 0xfed0000000000000 instead of 0xfed00000. Fix it up and add | ||
| 655 | * some noise: | ||
| 656 | */ | ||
| 657 | if (hpet_address == 0xfed0000000000000UL) { | ||
| 658 | if (!hpet_force_user) { | ||
| 659 | printk(KERN_WARNING PREFIX "HPET id: %#x " | ||
| 660 | "base: 0xfed0000000000000 is bogus\n " | ||
| 661 | "try hpet=force on the kernel command line to " | ||
| 662 | "fix it up to 0xfed00000.\n", hpet_tbl->id); | ||
| 663 | hpet_address = 0; | ||
| 664 | return 0; | ||
| 665 | } | ||
| 666 | printk(KERN_WARNING PREFIX | ||
| 667 | "HPET id: %#x base: 0xfed0000000000000 fixed up " | ||
| 668 | "to 0xfed00000.\n", hpet_tbl->id); | ||
| 669 | hpet_address >>= 32; | ||
| 670 | } | ||
| 671 | #endif | ||
| 640 | printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", | 672 | printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", |
| 641 | hpet_tbl->id, hpet_address); | 673 | hpet_tbl->id, hpet_address); |
| 642 | 674 | ||
diff --git a/arch/x86/kernel/acpi/processor.c b/arch/x86/kernel/acpi/processor.c index f63e5ff0aca1..a25db514c719 100644 --- a/arch/x86/kernel/acpi/processor.c +++ b/arch/x86/kernel/acpi/processor.c | |||
| @@ -49,6 +49,9 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) | |||
| 49 | if (cpu_has(c, X86_FEATURE_EST)) | 49 | if (cpu_has(c, X86_FEATURE_EST)) |
| 50 | buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; | 50 | buf[2] |= ACPI_PDC_EST_CAPABILITY_SWSMP; |
| 51 | 51 | ||
| 52 | if (cpu_has(c, X86_FEATURE_ACPI)) | ||
| 53 | buf[2] |= ACPI_PDC_T_FFH; | ||
| 54 | |||
| 52 | obj->type = ACPI_TYPE_BUFFER; | 55 | obj->type = ACPI_TYPE_BUFFER; |
| 53 | obj->buffer.length = 12; | 56 | obj->buffer.length = 12; |
| 54 | obj->buffer.pointer = (u8 *) buf; | 57 | obj->buffer.pointer = (u8 *) buf; |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 9c36a53676b7..99e1ef9939be 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | #define PFX "powernow-k8: " | 47 | #define PFX "powernow-k8: " |
| 48 | #define BFX PFX "BIOS error: " | 48 | #define BFX PFX "BIOS error: " |
| 49 | #define VERSION "version 2.00.00" | 49 | #define VERSION "version 2.20.00" |
| 50 | #include "powernow-k8.h" | 50 | #include "powernow-k8.h" |
| 51 | 51 | ||
| 52 | /* serialize freq changes */ | 52 | /* serialize freq changes */ |
| @@ -73,33 +73,11 @@ static u32 find_khz_freq_from_fid(u32 fid) | |||
| 73 | return 1000 * find_freq_from_fid(fid); | 73 | return 1000 * find_freq_from_fid(fid); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | /* Return a frequency in MHz, given an input fid and did */ | 76 | static u32 find_khz_freq_from_pstate(struct cpufreq_frequency_table *data, u32 pstate) |
| 77 | static u32 find_freq_from_fiddid(u32 fid, u32 did) | ||
| 78 | { | 77 | { |
| 79 | if (current_cpu_data.x86 == 0x10) | 78 | return data[pstate].frequency; |
| 80 | return 100 * (fid + 0x10) >> did; | ||
| 81 | else | ||
| 82 | return 100 * (fid + 0x8) >> did; | ||
| 83 | } | ||
| 84 | |||
| 85 | static u32 find_khz_freq_from_fiddid(u32 fid, u32 did) | ||
| 86 | { | ||
| 87 | return 1000 * find_freq_from_fiddid(fid, did); | ||
| 88 | } | ||
| 89 | |||
| 90 | static u32 find_fid_from_pstate(u32 pstate) | ||
| 91 | { | ||
| 92 | u32 hi, lo; | ||
| 93 | rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi); | ||
| 94 | return lo & HW_PSTATE_FID_MASK; | ||
| 95 | } | 79 | } |
| 96 | 80 | ||
| 97 | static u32 find_did_from_pstate(u32 pstate) | ||
| 98 | { | ||
| 99 | u32 hi, lo; | ||
| 100 | rdmsr(MSR_PSTATE_DEF_BASE + pstate, lo, hi); | ||
| 101 | return (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT; | ||
| 102 | } | ||
| 103 | 81 | ||
| 104 | /* Return the vco fid for an input fid | 82 | /* Return the vco fid for an input fid |
| 105 | * | 83 | * |
| @@ -142,9 +120,7 @@ static int query_current_values_with_pending_wait(struct powernow_k8_data *data) | |||
| 142 | if (cpu_family == CPU_HW_PSTATE) { | 120 | if (cpu_family == CPU_HW_PSTATE) { |
| 143 | rdmsr(MSR_PSTATE_STATUS, lo, hi); | 121 | rdmsr(MSR_PSTATE_STATUS, lo, hi); |
| 144 | i = lo & HW_PSTATE_MASK; | 122 | i = lo & HW_PSTATE_MASK; |
| 145 | rdmsr(MSR_PSTATE_DEF_BASE + i, lo, hi); | 123 | data->currpstate = i; |
| 146 | data->currfid = lo & HW_PSTATE_FID_MASK; | ||
| 147 | data->currdid = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT; | ||
| 148 | return 0; | 124 | return 0; |
| 149 | } | 125 | } |
| 150 | do { | 126 | do { |
| @@ -295,7 +271,7 @@ static int decrease_vid_code_by_step(struct powernow_k8_data *data, u32 reqvid, | |||
| 295 | static int transition_pstate(struct powernow_k8_data *data, u32 pstate) | 271 | static int transition_pstate(struct powernow_k8_data *data, u32 pstate) |
| 296 | { | 272 | { |
| 297 | wrmsr(MSR_PSTATE_CTRL, pstate, 0); | 273 | wrmsr(MSR_PSTATE_CTRL, pstate, 0); |
| 298 | data->currfid = find_fid_from_pstate(pstate); | 274 | data->currpstate = pstate; |
| 299 | return 0; | 275 | return 0; |
| 300 | } | 276 | } |
| 301 | 277 | ||
| @@ -845,17 +821,20 @@ err_out: | |||
| 845 | static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) | 821 | static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table) |
| 846 | { | 822 | { |
| 847 | int i; | 823 | int i; |
| 824 | u32 hi = 0, lo = 0; | ||
| 825 | rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo); | ||
| 826 | data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT; | ||
| 848 | 827 | ||
| 849 | for (i = 0; i < data->acpi_data.state_count; i++) { | 828 | for (i = 0; i < data->acpi_data.state_count; i++) { |
| 850 | u32 index; | 829 | u32 index; |
| 851 | u32 hi = 0, lo = 0; | 830 | u32 hi = 0, lo = 0; |
| 852 | u32 fid; | ||
| 853 | u32 did; | ||
| 854 | 831 | ||
| 855 | index = data->acpi_data.states[i].control & HW_PSTATE_MASK; | 832 | index = data->acpi_data.states[i].control & HW_PSTATE_MASK; |
| 856 | if (index > MAX_HW_PSTATE) { | 833 | if (index > data->max_hw_pstate) { |
| 857 | printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); | 834 | printk(KERN_ERR PFX "invalid pstate %d - bad value %d.\n", i, index); |
| 858 | printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); | 835 | printk(KERN_ERR PFX "Please report to BIOS manufacturer\n"); |
| 836 | powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; | ||
| 837 | continue; | ||
| 859 | } | 838 | } |
| 860 | rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); | 839 | rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); |
| 861 | if (!(hi & HW_PSTATE_VALID_MASK)) { | 840 | if (!(hi & HW_PSTATE_VALID_MASK)) { |
| @@ -864,22 +843,9 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpuf | |||
| 864 | continue; | 843 | continue; |
| 865 | } | 844 | } |
| 866 | 845 | ||
| 867 | fid = lo & HW_PSTATE_FID_MASK; | 846 | powernow_table[i].index = index; |
| 868 | did = (lo & HW_PSTATE_DID_MASK) >> HW_PSTATE_DID_SHIFT; | ||
| 869 | 847 | ||
| 870 | dprintk(" %d : fid 0x%x, did 0x%x\n", index, fid, did); | 848 | powernow_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000; |
| 871 | |||
| 872 | powernow_table[i].index = index | (fid << HW_FID_INDEX_SHIFT) | (did << HW_DID_INDEX_SHIFT); | ||
| 873 | |||
| 874 | powernow_table[i].frequency = find_khz_freq_from_fiddid(fid, did); | ||
| 875 | |||
| 876 | if (powernow_table[i].frequency != (data->acpi_data.states[i].core_frequency * 1000)) { | ||
| 877 | printk(KERN_INFO PFX "invalid freq entries %u kHz vs. %u kHz\n", | ||
| 878 | powernow_table[i].frequency, | ||
| 879 | (unsigned int) (data->acpi_data.states[i].core_frequency * 1000)); | ||
| 880 | powernow_table[i].frequency = CPUFREQ_ENTRY_INVALID; | ||
| 881 | continue; | ||
| 882 | } | ||
| 883 | } | 849 | } |
| 884 | return 0; | 850 | return 0; |
| 885 | } | 851 | } |
| @@ -1020,22 +986,18 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i | |||
| 1020 | /* Take a frequency, and issue the hardware pstate transition command */ | 986 | /* Take a frequency, and issue the hardware pstate transition command */ |
| 1021 | static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index) | 987 | static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned int index) |
| 1022 | { | 988 | { |
| 1023 | u32 fid = 0; | ||
| 1024 | u32 did = 0; | ||
| 1025 | u32 pstate = 0; | 989 | u32 pstate = 0; |
| 1026 | int res, i; | 990 | int res, i; |
| 1027 | struct cpufreq_freqs freqs; | 991 | struct cpufreq_freqs freqs; |
| 1028 | 992 | ||
| 1029 | dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); | 993 | dprintk("cpu %d transition to index %u\n", smp_processor_id(), index); |
| 1030 | 994 | ||
| 1031 | /* get fid did for hardware pstate transition */ | 995 | /* get MSR index for hardware pstate transition */ |
| 1032 | pstate = index & HW_PSTATE_MASK; | 996 | pstate = index & HW_PSTATE_MASK; |
| 1033 | if (pstate > MAX_HW_PSTATE) | 997 | if (pstate > data->max_hw_pstate) |
| 1034 | return 0; | 998 | return 0; |
| 1035 | fid = (index & HW_FID_INDEX_MASK) >> HW_FID_INDEX_SHIFT; | 999 | freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate); |
| 1036 | did = (index & HW_DID_INDEX_MASK) >> HW_DID_INDEX_SHIFT; | 1000 | freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); |
| 1037 | freqs.old = find_khz_freq_from_fiddid(data->currfid, data->currdid); | ||
| 1038 | freqs.new = find_khz_freq_from_fiddid(fid, did); | ||
| 1039 | 1001 | ||
| 1040 | for_each_cpu_mask(i, *(data->available_cores)) { | 1002 | for_each_cpu_mask(i, *(data->available_cores)) { |
| 1041 | freqs.cpu = i; | 1003 | freqs.cpu = i; |
| @@ -1043,9 +1005,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i | |||
| 1043 | } | 1005 | } |
| 1044 | 1006 | ||
| 1045 | res = transition_pstate(data, pstate); | 1007 | res = transition_pstate(data, pstate); |
| 1046 | data->currfid = find_fid_from_pstate(pstate); | 1008 | freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate); |
| 1047 | data->currdid = find_did_from_pstate(pstate); | ||
| 1048 | freqs.new = find_khz_freq_from_fiddid(data->currfid, data->currdid); | ||
| 1049 | 1009 | ||
| 1050 | for_each_cpu_mask(i, *(data->available_cores)) { | 1010 | for_each_cpu_mask(i, *(data->available_cores)) { |
| 1051 | freqs.cpu = i; | 1011 | freqs.cpu = i; |
| @@ -1090,10 +1050,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 1090 | if (query_current_values_with_pending_wait(data)) | 1050 | if (query_current_values_with_pending_wait(data)) |
| 1091 | goto err_out; | 1051 | goto err_out; |
| 1092 | 1052 | ||
| 1093 | if (cpu_family == CPU_HW_PSTATE) | 1053 | if (cpu_family != CPU_HW_PSTATE) { |
| 1094 | dprintk("targ: curr fid 0x%x, did 0x%x\n", | ||
| 1095 | data->currfid, data->currdid); | ||
| 1096 | else { | ||
| 1097 | dprintk("targ: curr fid 0x%x, vid 0x%x\n", | 1054 | dprintk("targ: curr fid 0x%x, vid 0x%x\n", |
| 1098 | data->currfid, data->currvid); | 1055 | data->currfid, data->currvid); |
| 1099 | 1056 | ||
| @@ -1124,7 +1081,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi | |||
| 1124 | mutex_unlock(&fidvid_mutex); | 1081 | mutex_unlock(&fidvid_mutex); |
| 1125 | 1082 | ||
| 1126 | if (cpu_family == CPU_HW_PSTATE) | 1083 | if (cpu_family == CPU_HW_PSTATE) |
| 1127 | pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); | 1084 | pol->cur = find_khz_freq_from_pstate(data->powernow_table, newstate); |
| 1128 | else | 1085 | else |
| 1129 | pol->cur = find_khz_freq_from_fid(data->currfid); | 1086 | pol->cur = find_khz_freq_from_fid(data->currfid); |
| 1130 | ret = 0; | 1087 | ret = 0; |
| @@ -1223,7 +1180,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1223 | + (3 * (1 << data->irt) * 10)) * 1000; | 1180 | + (3 * (1 << data->irt) * 10)) * 1000; |
| 1224 | 1181 | ||
| 1225 | if (cpu_family == CPU_HW_PSTATE) | 1182 | if (cpu_family == CPU_HW_PSTATE) |
| 1226 | pol->cur = find_khz_freq_from_fiddid(data->currfid, data->currdid); | 1183 | pol->cur = find_khz_freq_from_pstate(data->powernow_table, data->currpstate); |
| 1227 | else | 1184 | else |
| 1228 | pol->cur = find_khz_freq_from_fid(data->currfid); | 1185 | pol->cur = find_khz_freq_from_fid(data->currfid); |
| 1229 | dprintk("policy current frequency %d kHz\n", pol->cur); | 1186 | dprintk("policy current frequency %d kHz\n", pol->cur); |
| @@ -1240,8 +1197,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1240 | cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); | 1197 | cpufreq_frequency_table_get_attr(data->powernow_table, pol->cpu); |
| 1241 | 1198 | ||
| 1242 | if (cpu_family == CPU_HW_PSTATE) | 1199 | if (cpu_family == CPU_HW_PSTATE) |
| 1243 | dprintk("cpu_init done, current fid 0x%x, did 0x%x\n", | 1200 | dprintk("cpu_init done, current pstate 0x%x\n", data->currpstate); |
| 1244 | data->currfid, data->currdid); | ||
| 1245 | else | 1201 | else |
| 1246 | dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", | 1202 | dprintk("cpu_init done, current fid 0x%x, vid 0x%x\n", |
| 1247 | data->currfid, data->currvid); | 1203 | data->currfid, data->currvid); |
| @@ -1297,7 +1253,7 @@ static unsigned int powernowk8_get (unsigned int cpu) | |||
| 1297 | goto out; | 1253 | goto out; |
| 1298 | 1254 | ||
| 1299 | if (cpu_family == CPU_HW_PSTATE) | 1255 | if (cpu_family == CPU_HW_PSTATE) |
| 1300 | khz = find_khz_freq_from_fiddid(data->currfid, data->currdid); | 1256 | khz = find_khz_freq_from_pstate(data->powernow_table, data->currpstate); |
| 1301 | else | 1257 | else |
| 1302 | khz = find_khz_freq_from_fid(data->currfid); | 1258 | khz = find_khz_freq_from_fid(data->currfid); |
| 1303 | 1259 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h index 7c4f6e0faed4..afd2b520d35c 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h | |||
| @@ -10,6 +10,7 @@ struct powernow_k8_data { | |||
| 10 | 10 | ||
| 11 | u32 numps; /* number of p-states */ | 11 | u32 numps; /* number of p-states */ |
| 12 | u32 batps; /* number of p-states supported on battery */ | 12 | u32 batps; /* number of p-states supported on battery */ |
| 13 | u32 max_hw_pstate; /* maximum legal hardware pstate */ | ||
| 13 | 14 | ||
| 14 | /* these values are constant when the PSB is used to determine | 15 | /* these values are constant when the PSB is used to determine |
| 15 | * vid/fid pairings, but are modified during the ->target() call | 16 | * vid/fid pairings, but are modified during the ->target() call |
| @@ -21,8 +22,8 @@ struct powernow_k8_data { | |||
| 21 | u32 plllock; /* pll lock time, units 1 us */ | 22 | u32 plllock; /* pll lock time, units 1 us */ |
| 22 | u32 exttype; /* extended interface = 1 */ | 23 | u32 exttype; /* extended interface = 1 */ |
| 23 | 24 | ||
| 24 | /* keep track of the current fid / vid or did */ | 25 | /* keep track of the current fid / vid or pstate */ |
| 25 | u32 currvid, currfid, currdid; | 26 | u32 currvid, currfid, currpstate; |
| 26 | 27 | ||
| 27 | /* the powernow_table includes all frequency and vid/fid pairings: | 28 | /* the powernow_table includes all frequency and vid/fid pairings: |
| 28 | * fid are the lower 8 bits of the index, vid are the upper 8 bits. | 29 | * fid are the lower 8 bits of the index, vid are the upper 8 bits. |
| @@ -87,23 +88,14 @@ struct powernow_k8_data { | |||
| 87 | 88 | ||
| 88 | /* Hardware Pstate _PSS and MSR definitions */ | 89 | /* Hardware Pstate _PSS and MSR definitions */ |
| 89 | #define USE_HW_PSTATE 0x00000080 | 90 | #define USE_HW_PSTATE 0x00000080 |
| 90 | #define HW_PSTATE_FID_MASK 0x0000003f | ||
| 91 | #define HW_PSTATE_DID_MASK 0x000001c0 | ||
| 92 | #define HW_PSTATE_DID_SHIFT 6 | ||
| 93 | #define HW_PSTATE_MASK 0x00000007 | 91 | #define HW_PSTATE_MASK 0x00000007 |
| 94 | #define HW_PSTATE_VALID_MASK 0x80000000 | 92 | #define HW_PSTATE_VALID_MASK 0x80000000 |
| 95 | #define HW_FID_INDEX_SHIFT 8 | 93 | #define HW_PSTATE_MAX_MASK 0x000000f0 |
| 96 | #define HW_FID_INDEX_MASK 0x0000ff00 | 94 | #define HW_PSTATE_MAX_SHIFT 4 |
| 97 | #define HW_DID_INDEX_SHIFT 16 | ||
| 98 | #define HW_DID_INDEX_MASK 0x00ff0000 | ||
| 99 | #define HW_WATTS_MASK 0xff | ||
| 100 | #define HW_PWR_DVR_MASK 0x300 | ||
| 101 | #define HW_PWR_DVR_SHIFT 8 | ||
| 102 | #define HW_PWR_MAX_MULT 3 | ||
| 103 | #define MAX_HW_PSTATE 8 /* hw pstate supports up to 8 */ | ||
| 104 | #define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */ | 95 | #define MSR_PSTATE_DEF_BASE 0xc0010064 /* base of Pstate MSRs */ |
| 105 | #define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */ | 96 | #define MSR_PSTATE_STATUS 0xc0010063 /* Pstate Status MSR */ |
| 106 | #define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */ | 97 | #define MSR_PSTATE_CTRL 0xc0010062 /* Pstate control MSR */ |
| 98 | #define MSR_PSTATE_CUR_LIMIT 0xc0010061 /* pstate current limit MSR */ | ||
| 107 | 99 | ||
| 108 | /* define the two driver architectures */ | 100 | /* define the two driver architectures */ |
| 109 | #define CPU_OPTERON 0 | 101 | #define CPU_OPTERON 0 |
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c index 447b351f1f2a..4b21d29fb5aa 100644 --- a/arch/x86/kernel/cpu/mcheck/mce_64.c +++ b/arch/x86/kernel/cpu/mcheck/mce_64.c | |||
| @@ -810,7 +810,7 @@ static __cpuinit int mce_create_device(unsigned int cpu) | |||
| 810 | int err; | 810 | int err; |
| 811 | int i; | 811 | int i; |
| 812 | 812 | ||
| 813 | if (!mce_available(&cpu_data(cpu))) | 813 | if (!mce_available(&boot_cpu_data)) |
| 814 | return -EIO; | 814 | return -EIO; |
| 815 | 815 | ||
| 816 | memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); | 816 | memset(&per_cpu(device_mce, cpu).kobj, 0, sizeof(struct kobject)); |
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 066f8c6af4df..3900e46d66db 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c | |||
| @@ -89,8 +89,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 89 | int fpu_exception; | 89 | int fpu_exception; |
| 90 | 90 | ||
| 91 | #ifdef CONFIG_SMP | 91 | #ifdef CONFIG_SMP |
| 92 | if (!cpu_online(n)) | ||
| 93 | return 0; | ||
| 94 | n = c->cpu_index; | 92 | n = c->cpu_index; |
| 95 | #endif | 93 | #endif |
| 96 | seq_printf(m, "processor\t: %d\n" | 94 | seq_printf(m, "processor\t: %d\n" |
| @@ -177,14 +175,14 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 177 | static void *c_start(struct seq_file *m, loff_t *pos) | 175 | static void *c_start(struct seq_file *m, loff_t *pos) |
| 178 | { | 176 | { |
| 179 | if (*pos == 0) /* just in case, cpu 0 is not the first */ | 177 | if (*pos == 0) /* just in case, cpu 0 is not the first */ |
| 180 | *pos = first_cpu(cpu_possible_map); | 178 | *pos = first_cpu(cpu_online_map); |
| 181 | if ((*pos) < NR_CPUS && cpu_possible(*pos)) | 179 | if ((*pos) < NR_CPUS && cpu_online(*pos)) |
| 182 | return &cpu_data(*pos); | 180 | return &cpu_data(*pos); |
| 183 | return NULL; | 181 | return NULL; |
| 184 | } | 182 | } |
| 185 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 183 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
| 186 | { | 184 | { |
| 187 | *pos = next_cpu(*pos, cpu_possible_map); | 185 | *pos = next_cpu(*pos, cpu_online_map); |
| 188 | return c_start(m, pos); | 186 | return c_start(m, pos); |
| 189 | } | 187 | } |
| 190 | static void c_stop(struct seq_file *m, void *v) | 188 | static void c_stop(struct seq_file *m, void *v) |
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c index f35c6eb33da9..6bb80ea5f4ee 100644 --- a/arch/x86/kernel/io_apic_32.c +++ b/arch/x86/kernel/io_apic_32.c | |||
| @@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq) | |||
| 962 | #define default_MCA_trigger(idx) (1) | 962 | #define default_MCA_trigger(idx) (1) |
| 963 | #define default_MCA_polarity(idx) (0) | 963 | #define default_MCA_polarity(idx) (0) |
| 964 | 964 | ||
| 965 | static int __init MPBIOS_polarity(int idx) | 965 | static int MPBIOS_polarity(int idx) |
| 966 | { | 966 | { |
| 967 | int bus = mp_irqs[idx].mpc_srcbus; | 967 | int bus = mp_irqs[idx].mpc_srcbus; |
| 968 | int polarity; | 968 | int polarity; |
| @@ -2830,6 +2830,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a | |||
| 2830 | return 0; | 2830 | return 0; |
| 2831 | } | 2831 | } |
| 2832 | 2832 | ||
| 2833 | int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | ||
| 2834 | { | ||
| 2835 | int i; | ||
| 2836 | |||
| 2837 | if (skip_ioapic_setup) | ||
| 2838 | return -1; | ||
| 2839 | |||
| 2840 | for (i = 0; i < mp_irq_entries; i++) | ||
| 2841 | if (mp_irqs[i].mpc_irqtype == mp_INT && | ||
| 2842 | mp_irqs[i].mpc_srcbusirq == bus_irq) | ||
| 2843 | break; | ||
| 2844 | if (i >= mp_irq_entries) | ||
| 2845 | return -1; | ||
| 2846 | |||
| 2847 | *trigger = irq_trigger(i); | ||
| 2848 | *polarity = irq_polarity(i); | ||
| 2849 | return 0; | ||
| 2850 | } | ||
| 2851 | |||
| 2833 | #endif /* CONFIG_ACPI */ | 2852 | #endif /* CONFIG_ACPI */ |
| 2834 | 2853 | ||
| 2835 | static int __init parse_disable_timer_pin_1(char *arg) | 2854 | static int __init parse_disable_timer_pin_1(char *arg) |
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c index 953328b55a30..435a8c9b55f8 100644 --- a/arch/x86/kernel/io_apic_64.c +++ b/arch/x86/kernel/io_apic_64.c | |||
| @@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) | |||
| 546 | #define default_PCI_trigger(idx) (1) | 546 | #define default_PCI_trigger(idx) (1) |
| 547 | #define default_PCI_polarity(idx) (1) | 547 | #define default_PCI_polarity(idx) (1) |
| 548 | 548 | ||
| 549 | static int __init MPBIOS_polarity(int idx) | 549 | static int MPBIOS_polarity(int idx) |
| 550 | { | 550 | { |
| 551 | int bus = mp_irqs[idx].mpc_srcbus; | 551 | int bus = mp_irqs[idx].mpc_srcbus; |
| 552 | int polarity; | 552 | int polarity; |
| @@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p | |||
| 2222 | return 0; | 2222 | return 0; |
| 2223 | } | 2223 | } |
| 2224 | 2224 | ||
| 2225 | #endif /* CONFIG_ACPI */ | ||
| 2226 | 2225 | ||
| 2226 | int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity) | ||
| 2227 | { | ||
| 2228 | int i; | ||
| 2229 | |||
| 2230 | if (skip_ioapic_setup) | ||
| 2231 | return -1; | ||
| 2232 | |||
| 2233 | for (i = 0; i < mp_irq_entries; i++) | ||
| 2234 | if (mp_irqs[i].mpc_irqtype == mp_INT && | ||
| 2235 | mp_irqs[i].mpc_srcbusirq == bus_irq) | ||
| 2236 | break; | ||
| 2237 | if (i >= mp_irq_entries) | ||
| 2238 | return -1; | ||
| 2239 | |||
| 2240 | *trigger = irq_trigger(i); | ||
| 2241 | *polarity = irq_polarity(i); | ||
| 2242 | return 0; | ||
| 2243 | } | ||
| 2244 | |||
| 2245 | #endif /* CONFIG_ACPI */ | ||
| 2227 | 2246 | ||
| 2228 | /* | 2247 | /* |
| 2229 | * This function currently is only a helper for the i386 smp boot process where | 2248 | * This function currently is only a helper for the i386 smp boot process where |
| @@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void) | |||
| 2260 | } | 2279 | } |
| 2261 | } | 2280 | } |
| 2262 | #endif | 2281 | #endif |
| 2282 | |||
diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c index 1a07bbea7be3..f452726c0fe2 100644 --- a/arch/x86/kernel/reboot_fixups_32.c +++ b/arch/x86/kernel/reboot_fixups_32.c | |||
| @@ -39,6 +39,7 @@ struct device_fixup { | |||
| 39 | static struct device_fixup fixups_table[] = { | 39 | static struct device_fixup fixups_table[] = { |
| 40 | { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset }, | 40 | { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, cs5530a_warm_reset }, |
| 41 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset }, | 41 | { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_ISA, cs5536_warm_reset }, |
| 42 | { PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE, cs5530a_warm_reset }, | ||
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 44 | /* | 45 | /* |
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c index 238633d3d09a..30d94d1d5f5f 100644 --- a/arch/x86/kernel/setup_64.c +++ b/arch/x86/kernel/setup_64.c | |||
| @@ -892,7 +892,6 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c) | |||
| 892 | 892 | ||
| 893 | #ifdef CONFIG_SMP | 893 | #ifdef CONFIG_SMP |
| 894 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; | 894 | c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff; |
| 895 | c->cpu_index = 0; | ||
| 896 | #endif | 895 | #endif |
| 897 | } | 896 | } |
| 898 | 897 | ||
| @@ -1078,8 +1077,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 1078 | 1077 | ||
| 1079 | 1078 | ||
| 1080 | #ifdef CONFIG_SMP | 1079 | #ifdef CONFIG_SMP |
| 1081 | if (!cpu_online(c->cpu_index)) | ||
| 1082 | return 0; | ||
| 1083 | cpu = c->cpu_index; | 1080 | cpu = c->cpu_index; |
| 1084 | #endif | 1081 | #endif |
| 1085 | 1082 | ||
| @@ -1171,15 +1168,15 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 1171 | static void *c_start(struct seq_file *m, loff_t *pos) | 1168 | static void *c_start(struct seq_file *m, loff_t *pos) |
| 1172 | { | 1169 | { |
| 1173 | if (*pos == 0) /* just in case, cpu 0 is not the first */ | 1170 | if (*pos == 0) /* just in case, cpu 0 is not the first */ |
| 1174 | *pos = first_cpu(cpu_possible_map); | 1171 | *pos = first_cpu(cpu_online_map); |
| 1175 | if ((*pos) < NR_CPUS && cpu_possible(*pos)) | 1172 | if ((*pos) < NR_CPUS && cpu_online(*pos)) |
| 1176 | return &cpu_data(*pos); | 1173 | return &cpu_data(*pos); |
| 1177 | return NULL; | 1174 | return NULL; |
| 1178 | } | 1175 | } |
| 1179 | 1176 | ||
| 1180 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | 1177 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) |
| 1181 | { | 1178 | { |
| 1182 | *pos = next_cpu(*pos, cpu_possible_map); | 1179 | *pos = next_cpu(*pos, cpu_online_map); |
| 1183 | return c_start(m, pos); | 1180 | return c_start(m, pos); |
| 1184 | } | 1181 | } |
| 1185 | 1182 | ||
diff --git a/arch/x86/kernel/time_64.c b/arch/x86/kernel/time_64.c index c821edc32216..368b1942b39a 100644 --- a/arch/x86/kernel/time_64.c +++ b/arch/x86/kernel/time_64.c | |||
| @@ -82,18 +82,15 @@ static int set_rtc_mmss(unsigned long nowtime) | |||
| 82 | int retval = 0; | 82 | int retval = 0; |
| 83 | int real_seconds, real_minutes, cmos_minutes; | 83 | int real_seconds, real_minutes, cmos_minutes; |
| 84 | unsigned char control, freq_select; | 84 | unsigned char control, freq_select; |
| 85 | unsigned long flags; | ||
| 85 | 86 | ||
| 86 | /* | 87 | /* |
| 87 | * IRQs are disabled when we're called from the timer interrupt, | 88 | * set_rtc_mmss is called when irqs are enabled, so disable irqs here |
| 88 | * no need for spin_lock_irqsave() | ||
| 89 | */ | 89 | */ |
| 90 | 90 | spin_lock_irqsave(&rtc_lock, flags); | |
| 91 | spin_lock(&rtc_lock); | ||
| 92 | |||
| 93 | /* | 91 | /* |
| 94 | * Tell the clock it's being set and stop it. | 92 | * Tell the clock it's being set and stop it. |
| 95 | */ | 93 | */ |
| 96 | |||
| 97 | control = CMOS_READ(RTC_CONTROL); | 94 | control = CMOS_READ(RTC_CONTROL); |
| 98 | CMOS_WRITE(control | RTC_SET, RTC_CONTROL); | 95 | CMOS_WRITE(control | RTC_SET, RTC_CONTROL); |
| 99 | 96 | ||
| @@ -138,7 +135,7 @@ static int set_rtc_mmss(unsigned long nowtime) | |||
| 138 | CMOS_WRITE(control, RTC_CONTROL); | 135 | CMOS_WRITE(control, RTC_CONTROL); |
| 139 | CMOS_WRITE(freq_select, RTC_FREQ_SELECT); | 136 | CMOS_WRITE(freq_select, RTC_FREQ_SELECT); |
| 140 | 137 | ||
| 141 | spin_unlock(&rtc_lock); | 138 | spin_unlock_irqrestore(&rtc_lock, flags); |
| 142 | 139 | ||
| 143 | return retval; | 140 | return retval; |
| 144 | } | 141 | } |
| @@ -164,21 +161,27 @@ unsigned long read_persistent_clock(void) | |||
| 164 | unsigned century = 0; | 161 | unsigned century = 0; |
| 165 | 162 | ||
| 166 | spin_lock_irqsave(&rtc_lock, flags); | 163 | spin_lock_irqsave(&rtc_lock, flags); |
| 164 | /* | ||
| 165 | * if UIP is clear, then we have >= 244 microseconds before RTC | ||
| 166 | * registers will be updated. Spec sheet says that this is the | ||
| 167 | * reliable way to read RTC - registers invalid (off bus) during update | ||
| 168 | */ | ||
| 169 | while ((CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)) | ||
| 170 | cpu_relax(); | ||
| 167 | 171 | ||
| 168 | do { | 172 | |
| 169 | sec = CMOS_READ(RTC_SECONDS); | 173 | /* now read all RTC registers while stable with interrupts disabled */ |
| 170 | min = CMOS_READ(RTC_MINUTES); | 174 | sec = CMOS_READ(RTC_SECONDS); |
| 171 | hour = CMOS_READ(RTC_HOURS); | 175 | min = CMOS_READ(RTC_MINUTES); |
| 172 | day = CMOS_READ(RTC_DAY_OF_MONTH); | 176 | hour = CMOS_READ(RTC_HOURS); |
| 173 | mon = CMOS_READ(RTC_MONTH); | 177 | day = CMOS_READ(RTC_DAY_OF_MONTH); |
| 174 | year = CMOS_READ(RTC_YEAR); | 178 | mon = CMOS_READ(RTC_MONTH); |
| 179 | year = CMOS_READ(RTC_YEAR); | ||
| 175 | #ifdef CONFIG_ACPI | 180 | #ifdef CONFIG_ACPI |
| 176 | if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && | 181 | if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID && |
| 177 | acpi_gbl_FADT.century) | 182 | acpi_gbl_FADT.century) |
| 178 | century = CMOS_READ(acpi_gbl_FADT.century); | 183 | century = CMOS_READ(acpi_gbl_FADT.century); |
| 179 | #endif | 184 | #endif |
| 180 | } while (sec != CMOS_READ(RTC_SECONDS)); | ||
| 181 | |||
| 182 | spin_unlock_irqrestore(&rtc_lock, flags); | 185 | spin_unlock_irqrestore(&rtc_lock, flags); |
| 183 | 186 | ||
| 184 | /* | 187 | /* |
diff --git a/arch/x86/mach-voyager/voyager_cat.c b/arch/x86/mach-voyager/voyager_cat.c index 26a2d4c54b68..2132ca652df1 100644 --- a/arch/x86/mach-voyager/voyager_cat.c +++ b/arch/x86/mach-voyager/voyager_cat.c | |||
| @@ -568,7 +568,7 @@ static voyager_module_t *voyager_initial_module; | |||
| 568 | * boot cpu *after* all memory initialisation has been done (so we can | 568 | * boot cpu *after* all memory initialisation has been done (so we can |
| 569 | * use kmalloc) but before smp initialisation, so we can probe the SMP | 569 | * use kmalloc) but before smp initialisation, so we can probe the SMP |
| 570 | * configuration and pick up necessary information. */ | 570 | * configuration and pick up necessary information. */ |
| 571 | void | 571 | void __init |
| 572 | voyager_cat_init(void) | 572 | voyager_cat_init(void) |
| 573 | { | 573 | { |
| 574 | voyager_module_t **modpp = &voyager_initial_module; | 574 | voyager_module_t **modpp = &voyager_initial_module; |
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c index 69371434b0cf..88124dd35406 100644 --- a/arch/x86/mach-voyager/voyager_smp.c +++ b/arch/x86/mach-voyager/voyager_smp.c | |||
| @@ -1900,7 +1900,7 @@ voyager_smp_prepare_cpus(unsigned int max_cpus) | |||
| 1900 | smp_boot_cpus(); | 1900 | smp_boot_cpus(); |
| 1901 | } | 1901 | } |
| 1902 | 1902 | ||
| 1903 | static void __devinit voyager_smp_prepare_boot_cpu(void) | 1903 | static void __cpuinit voyager_smp_prepare_boot_cpu(void) |
| 1904 | { | 1904 | { |
| 1905 | init_gdt(smp_processor_id()); | 1905 | init_gdt(smp_processor_id()); |
| 1906 | switch_to_new_gdt(); | 1906 | switch_to_new_gdt(); |
| @@ -1911,7 +1911,7 @@ static void __devinit voyager_smp_prepare_boot_cpu(void) | |||
| 1911 | cpu_set(smp_processor_id(), cpu_present_map); | 1911 | cpu_set(smp_processor_id(), cpu_present_map); |
| 1912 | } | 1912 | } |
| 1913 | 1913 | ||
| 1914 | static int __devinit | 1914 | static int __cpuinit |
| 1915 | voyager_cpu_up(unsigned int cpu) | 1915 | voyager_cpu_up(unsigned int cpu) |
| 1916 | { | 1916 | { |
| 1917 | /* This only works at boot for x86. See "rewrite" above. */ | 1917 | /* This only works at boot for x86. See "rewrite" above. */ |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index a7536dcc2acf..0234f2831bf3 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
| @@ -77,6 +77,9 @@ count_resource(struct acpi_resource *acpi_res, void *data) | |||
| 77 | struct acpi_resource_address64 addr; | 77 | struct acpi_resource_address64 addr; |
| 78 | acpi_status status; | 78 | acpi_status status; |
| 79 | 79 | ||
| 80 | if (info->res_num >= PCI_BUS_NUM_RESOURCES) | ||
| 81 | return AE_OK; | ||
| 82 | |||
| 80 | status = resource_to_addr(acpi_res, &addr); | 83 | status = resource_to_addr(acpi_res, &addr); |
| 81 | if (ACPI_SUCCESS(status)) | 84 | if (ACPI_SUCCESS(status)) |
| 82 | info->res_num++; | 85 | info->res_num++; |
| @@ -93,6 +96,9 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
| 93 | unsigned long flags; | 96 | unsigned long flags; |
| 94 | struct resource *root; | 97 | struct resource *root; |
| 95 | 98 | ||
| 99 | if (info->res_num >= PCI_BUS_NUM_RESOURCES) | ||
| 100 | return AE_OK; | ||
| 101 | |||
| 96 | status = resource_to_addr(acpi_res, &addr); | 102 | status = resource_to_addr(acpi_res, &addr); |
| 97 | if (!ACPI_SUCCESS(status)) | 103 | if (!ACPI_SUCCESS(status)) |
| 98 | return AE_OK; | 104 | return AE_OK; |
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c index 91f6e85d0fc2..3b1ae1abfba9 100644 --- a/arch/x86/vdso/vgetcpu.c +++ b/arch/x86/vdso/vgetcpu.c | |||
| @@ -13,32 +13,17 @@ | |||
| 13 | #include <asm/vgtod.h> | 13 | #include <asm/vgtod.h> |
| 14 | #include "vextern.h" | 14 | #include "vextern.h" |
| 15 | 15 | ||
| 16 | long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache) | 16 | long __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) |
| 17 | { | 17 | { |
| 18 | unsigned int dummy, p; | 18 | unsigned int dummy, p; |
| 19 | unsigned long j = 0; | ||
| 20 | 19 | ||
| 21 | /* Fast cache - only recompute value once per jiffies and avoid | 20 | if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) { |
| 22 | relatively costly rdtscp/cpuid otherwise. | ||
| 23 | This works because the scheduler usually keeps the process | ||
| 24 | on the same CPU and this syscall doesn't guarantee its | ||
| 25 | results anyways. | ||
| 26 | We do this here because otherwise user space would do it on | ||
| 27 | its own in a likely inferior way (no access to jiffies). | ||
| 28 | If you don't like it pass NULL. */ | ||
| 29 | if (tcache && tcache->blob[0] == (j = *vdso_jiffies)) { | ||
| 30 | p = tcache->blob[1]; | ||
| 31 | } else if (*vdso_vgetcpu_mode == VGETCPU_RDTSCP) { | ||
| 32 | /* Load per CPU data from RDTSCP */ | 21 | /* Load per CPU data from RDTSCP */ |
| 33 | rdtscp(dummy, dummy, p); | 22 | rdtscp(dummy, dummy, p); |
| 34 | } else { | 23 | } else { |
| 35 | /* Load per CPU data from GDT */ | 24 | /* Load per CPU data from GDT */ |
| 36 | asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); | 25 | asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG)); |
| 37 | } | 26 | } |
| 38 | if (tcache) { | ||
| 39 | tcache->blob[0] = j; | ||
| 40 | tcache->blob[1] = p; | ||
| 41 | } | ||
| 42 | if (cpu) | 27 | if (cpu) |
| 43 | *cpu = p & 0xfff; | 28 | *cpu = p & 0xfff; |
| 44 | if (node) | 29 | if (node) |
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 087a7028ae84..b9f923ef173d 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
| @@ -50,7 +50,6 @@ config ACPI_SLEEP | |||
| 50 | config ACPI_PROCFS | 50 | config ACPI_PROCFS |
| 51 | bool "Deprecated /proc/acpi files" | 51 | bool "Deprecated /proc/acpi files" |
| 52 | depends on PROC_FS | 52 | depends on PROC_FS |
| 53 | default y | ||
| 54 | ---help--- | 53 | ---help--- |
| 55 | For backwards compatibility, this option allows | 54 | For backwards compatibility, this option allows |
| 56 | deprecated /proc/acpi/ files to exist, even when | 55 | deprecated /proc/acpi/ files to exist, even when |
| @@ -61,7 +60,6 @@ config ACPI_PROCFS | |||
| 61 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) | 60 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) |
| 62 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) | 61 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) |
| 63 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | 62 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) |
| 64 | /proc/acpi/battery (/sys/class/power_supply) | ||
| 65 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | 63 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) |
| 66 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) | 64 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) |
| 67 | 65 | ||
| @@ -69,7 +67,21 @@ config ACPI_PROCFS | |||
| 69 | and functions which do not yet exist in /sys. | 67 | and functions which do not yet exist in /sys. |
| 70 | 68 | ||
| 71 | Say N to delete /proc/acpi/ files that have moved to /sys/ | 69 | Say N to delete /proc/acpi/ files that have moved to /sys/ |
| 72 | 70 | config ACPI_PROCFS_POWER | |
| 71 | bool "Deprecated power /proc/acpi folders" | ||
| 72 | depends on PROC_FS | ||
| 73 | default y | ||
| 74 | ---help--- | ||
| 75 | For backwards compatibility, this option allows | ||
| 76 | deprecated power /proc/acpi/ folders to exist, even when | ||
| 77 | they have been replaced by functions in /sys. | ||
| 78 | The deprecated folders (and their replacements) include: | ||
| 79 | /proc/acpi/battery/* (/sys/class/power_supply/*) | ||
| 80 | /proc/acpi/ac_adapter/* (sys/class/power_supply/*) | ||
| 81 | This option has no effect on /proc/acpi/ folders | ||
| 82 | and functions, which do not yet exist in /sys | ||
| 83 | |||
| 84 | Say N to delete power /proc/acpi/ folders that have moved to /sys/ | ||
| 73 | config ACPI_PROC_EVENT | 85 | config ACPI_PROC_EVENT |
| 74 | bool "Deprecated /proc/acpi/event support" | 86 | bool "Deprecated /proc/acpi/event support" |
| 75 | depends on PROC_FS | 87 | depends on PROC_FS |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 54e3ab0e5fc0..456446f90077 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
| @@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o | |||
| 58 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o | 58 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o |
| 59 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o | 59 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o |
| 60 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 60 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
| 61 | obj-y += cm_sbs.o | 61 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
| 62 | obj-$(CONFIG_ACPI_SBS) += sbs.o | 62 | obj-$(CONFIG_ACPI_SBS) += sbs.o |
| 63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 30238f6ff232..76ed4f52bebd 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
| 28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
| 29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
| 30 | #ifdef CONFIG_ACPI_PROCFS | 30 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 31 | #include <linux/proc_fs.h> | 31 | #include <linux/proc_fs.h> |
| 32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
| 33 | #endif | 33 | #endif |
| @@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
| 51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
| 52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
| 53 | 53 | ||
| 54 | #ifdef CONFIG_ACPI_PROCFS | 54 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | 55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); |
| 56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | 56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); |
| 57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | 57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); |
| @@ -86,7 +86,7 @@ struct acpi_ac { | |||
| 86 | 86 | ||
| 87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); | 87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); |
| 88 | 88 | ||
| 89 | #ifdef CONFIG_ACPI_PROCFS | 89 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 90 | static const struct file_operations acpi_ac_fops = { | 90 | static const struct file_operations acpi_ac_fops = { |
| 91 | .open = acpi_ac_open_fs, | 91 | .open = acpi_ac_open_fs, |
| 92 | .read = seq_read, | 92 | .read = seq_read, |
| @@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
| 136 | return 0; | 136 | return 0; |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | #ifdef CONFIG_ACPI_PROCFS | 139 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 140 | /* -------------------------------------------------------------------------- | 140 | /* -------------------------------------------------------------------------- |
| 141 | FS Interface (/proc) | 141 | FS Interface (/proc) |
| 142 | -------------------------------------------------------------------------- */ | 142 | -------------------------------------------------------------------------- */ |
| @@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
| 275 | if (result) | 275 | if (result) |
| 276 | goto end; | 276 | goto end; |
| 277 | 277 | ||
| 278 | #ifdef CONFIG_ACPI_PROCFS | 278 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 279 | result = acpi_ac_add_fs(device); | 279 | result = acpi_ac_add_fs(device); |
| 280 | #endif | 280 | #endif |
| 281 | if (result) | 281 | if (result) |
| @@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
| 300 | 300 | ||
| 301 | end: | 301 | end: |
| 302 | if (result) { | 302 | if (result) { |
| 303 | #ifdef CONFIG_ACPI_PROCFS | 303 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 304 | acpi_ac_remove_fs(device); | 304 | acpi_ac_remove_fs(device); |
| 305 | #endif | 305 | #endif |
| 306 | kfree(ac); | 306 | kfree(ac); |
| @@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
| 339 | ACPI_ALL_NOTIFY, acpi_ac_notify); | 339 | ACPI_ALL_NOTIFY, acpi_ac_notify); |
| 340 | if (ac->charger.dev) | 340 | if (ac->charger.dev) |
| 341 | power_supply_unregister(&ac->charger); | 341 | power_supply_unregister(&ac->charger); |
| 342 | #ifdef CONFIG_ACPI_PROCFS | 342 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 343 | acpi_ac_remove_fs(device); | 343 | acpi_ac_remove_fs(device); |
| 344 | #endif | 344 | #endif |
| 345 | 345 | ||
| @@ -355,7 +355,7 @@ static int __init acpi_ac_init(void) | |||
| 355 | if (acpi_disabled) | 355 | if (acpi_disabled) |
| 356 | return -ENODEV; | 356 | return -ENODEV; |
| 357 | 357 | ||
| 358 | #ifdef CONFIG_ACPI_PROCFS | 358 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 359 | acpi_ac_dir = acpi_lock_ac_dir(); | 359 | acpi_ac_dir = acpi_lock_ac_dir(); |
| 360 | if (!acpi_ac_dir) | 360 | if (!acpi_ac_dir) |
| 361 | return -ENODEV; | 361 | return -ENODEV; |
| @@ -363,7 +363,7 @@ static int __init acpi_ac_init(void) | |||
| 363 | 363 | ||
| 364 | result = acpi_bus_register_driver(&acpi_ac_driver); | 364 | result = acpi_bus_register_driver(&acpi_ac_driver); |
| 365 | if (result < 0) { | 365 | if (result < 0) { |
| 366 | #ifdef CONFIG_ACPI_PROCFS | 366 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 367 | acpi_unlock_ac_dir(acpi_ac_dir); | 367 | acpi_unlock_ac_dir(acpi_ac_dir); |
| 368 | #endif | 368 | #endif |
| 369 | return -ENODEV; | 369 | return -ENODEV; |
| @@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void) | |||
| 377 | 377 | ||
| 378 | acpi_bus_unregister_driver(&acpi_ac_driver); | 378 | acpi_bus_unregister_driver(&acpi_ac_driver); |
| 379 | 379 | ||
| 380 | #ifdef CONFIG_ACPI_PROCFS | 380 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 381 | acpi_unlock_ac_dir(acpi_ac_dir); | 381 | acpi_unlock_ac_dir(acpi_ac_dir); |
| 382 | #endif | 382 | #endif |
| 383 | 383 | ||
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 192c244f6190..7d6be23eff89 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
| @@ -31,7 +31,7 @@ | |||
| 31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
| 32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
| 33 | 33 | ||
| 34 | #ifdef CONFIG_ACPI_PROCFS | 34 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
| 36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
| 37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
| @@ -63,7 +63,7 @@ static unsigned int cache_time = 1000; | |||
| 63 | module_param(cache_time, uint, 0644); | 63 | module_param(cache_time, uint, 0644); |
| 64 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 64 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
| 65 | 65 | ||
| 66 | #ifdef CONFIG_ACPI_PROCFS | 66 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 67 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); | 67 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
| 68 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); | 68 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
| 69 | 69 | ||
| @@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
| 153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
| 154 | else if (battery->state == 0) | 154 | else if (battery->state == 0) |
| 155 | val->intval = POWER_SUPPLY_STATUS_FULL; | 155 | val->intval = POWER_SUPPLY_STATUS_FULL; |
| 156 | else | ||
| 157 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
| 156 | break; | 158 | break; |
| 157 | case POWER_SUPPLY_PROP_PRESENT: | 159 | case POWER_SUPPLY_PROP_PRESENT: |
| 158 | val->intval = acpi_battery_present(battery); | 160 | val->intval = acpi_battery_present(battery); |
| @@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = { | |||
| 221 | POWER_SUPPLY_PROP_MANUFACTURER, | 223 | POWER_SUPPLY_PROP_MANUFACTURER, |
| 222 | }; | 224 | }; |
| 223 | 225 | ||
| 224 | #ifdef CONFIG_ACPI_PROCFS | 226 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 225 | inline char *acpi_battery_units(struct acpi_battery *battery) | 227 | inline char *acpi_battery_units(struct acpi_battery *battery) |
| 226 | { | 228 | { |
| 227 | return (battery->power_unit)?"mA":"mW"; | 229 | return (battery->power_unit)?"mA":"mW"; |
| @@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
| 479 | FS Interface (/proc) | 481 | FS Interface (/proc) |
| 480 | -------------------------------------------------------------------------- */ | 482 | -------------------------------------------------------------------------- */ |
| 481 | 483 | ||
| 482 | #ifdef CONFIG_ACPI_PROCFS | 484 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 483 | static struct proc_dir_entry *acpi_battery_dir; | 485 | static struct proc_dir_entry *acpi_battery_dir; |
| 484 | 486 | ||
| 485 | static int acpi_battery_print_info(struct seq_file *seq, int result) | 487 | static int acpi_battery_print_info(struct seq_file *seq, int result) |
| @@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
| 786 | acpi_driver_data(device) = battery; | 788 | acpi_driver_data(device) = battery; |
| 787 | mutex_init(&battery->lock); | 789 | mutex_init(&battery->lock); |
| 788 | acpi_battery_update(battery); | 790 | acpi_battery_update(battery); |
| 789 | #ifdef CONFIG_ACPI_PROCFS | 791 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 790 | result = acpi_battery_add_fs(device); | 792 | result = acpi_battery_add_fs(device); |
| 791 | if (result) | 793 | if (result) |
| 792 | goto end; | 794 | goto end; |
| @@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
| 804 | device->status.battery_present ? "present" : "absent"); | 806 | device->status.battery_present ? "present" : "absent"); |
| 805 | end: | 807 | end: |
| 806 | if (result) { | 808 | if (result) { |
| 807 | #ifdef CONFIG_ACPI_PROCFS | 809 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 808 | acpi_battery_remove_fs(device); | 810 | acpi_battery_remove_fs(device); |
| 809 | #endif | 811 | #endif |
| 810 | kfree(battery); | 812 | kfree(battery); |
| @@ -823,7 +825,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
| 823 | status = acpi_remove_notify_handler(device->handle, | 825 | status = acpi_remove_notify_handler(device->handle, |
| 824 | ACPI_ALL_NOTIFY, | 826 | ACPI_ALL_NOTIFY, |
| 825 | acpi_battery_notify); | 827 | acpi_battery_notify); |
| 826 | #ifdef CONFIG_ACPI_PROCFS | 828 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 827 | acpi_battery_remove_fs(device); | 829 | acpi_battery_remove_fs(device); |
| 828 | #endif | 830 | #endif |
| 829 | sysfs_remove_battery(battery); | 831 | sysfs_remove_battery(battery); |
| @@ -859,13 +861,13 @@ static int __init acpi_battery_init(void) | |||
| 859 | { | 861 | { |
| 860 | if (acpi_disabled) | 862 | if (acpi_disabled) |
| 861 | return -ENODEV; | 863 | return -ENODEV; |
| 862 | #ifdef CONFIG_ACPI_PROCFS | 864 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 863 | acpi_battery_dir = acpi_lock_battery_dir(); | 865 | acpi_battery_dir = acpi_lock_battery_dir(); |
| 864 | if (!acpi_battery_dir) | 866 | if (!acpi_battery_dir) |
| 865 | return -ENODEV; | 867 | return -ENODEV; |
| 866 | #endif | 868 | #endif |
| 867 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { | 869 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { |
| 868 | #ifdef CONFIG_ACPI_PROCFS | 870 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 869 | acpi_unlock_battery_dir(acpi_battery_dir); | 871 | acpi_unlock_battery_dir(acpi_battery_dir); |
| 870 | #endif | 872 | #endif |
| 871 | return -ENODEV; | 873 | return -ENODEV; |
| @@ -876,7 +878,7 @@ static int __init acpi_battery_init(void) | |||
| 876 | static void __exit acpi_battery_exit(void) | 878 | static void __exit acpi_battery_exit(void) |
| 877 | { | 879 | { |
| 878 | acpi_bus_unregister_driver(&acpi_battery_driver); | 880 | acpi_bus_unregister_driver(&acpi_battery_driver); |
| 879 | #ifdef CONFIG_ACPI_PROCFS | 881 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 880 | acpi_unlock_battery_dir(acpi_battery_dir); | 882 | acpi_unlock_battery_dir(acpi_battery_dir); |
| 881 | #endif | 883 | #endif |
| 882 | } | 884 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index cb09e5e03400..c5028568058b 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
| @@ -75,7 +75,8 @@ enum { | |||
| 75 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ | 75 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
| 76 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 76 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
| 77 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ | 77 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
| 78 | EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */ | 78 | EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */ |
| 79 | EC_FLAGS_ADDRESS, /* Address is being written */ | ||
| 79 | }; | 80 | }; |
| 80 | 81 | ||
| 81 | static int acpi_ec_remove(struct acpi_device *device, int type); | 82 | static int acpi_ec_remove(struct acpi_device *device, int type); |
| @@ -166,38 +167,45 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
| 166 | 167 | ||
| 167 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | 168 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
| 168 | { | 169 | { |
| 170 | int ret = 0; | ||
| 171 | if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) && | ||
| 172 | test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags))) | ||
| 173 | force_poll = 1; | ||
| 169 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && | 174 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
| 170 | likely(!force_poll)) { | 175 | likely(!force_poll)) { |
| 171 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | 176 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), |
| 172 | msecs_to_jiffies(ACPI_EC_DELAY))) | 177 | msecs_to_jiffies(ACPI_EC_DELAY))) |
| 173 | return 0; | 178 | goto end; |
| 174 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 179 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 175 | if (acpi_ec_check_status(ec, event)) { | 180 | if (acpi_ec_check_status(ec, event)) { |
| 176 | if (event == ACPI_EC_EVENT_OBF_1) { | 181 | if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { |
| 177 | /* miss OBF = 1 GPE, don't expect it anymore */ | 182 | /* miss address GPE, don't expect it anymore */ |
| 178 | printk(KERN_INFO PREFIX "missing OBF_1 confirmation, " | 183 | printk(KERN_INFO PREFIX "missing address confirmation, " |
| 179 | "switching to degraded mode.\n"); | 184 | "don't expect it any longer.\n"); |
| 180 | set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags); | 185 | set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags); |
| 181 | } else { | 186 | } else { |
| 182 | /* missing GPEs, switch back to poll mode */ | 187 | /* missing GPEs, switch back to poll mode */ |
| 183 | printk(KERN_INFO PREFIX "missing IBF_1 confirmations, " | 188 | printk(KERN_INFO PREFIX "missing confirmations, " |
| 184 | "switch off interrupt mode.\n"); | 189 | "switch off interrupt mode.\n"); |
| 185 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 190 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
| 186 | } | 191 | } |
| 187 | return 0; | 192 | goto end; |
| 188 | } | 193 | } |
| 189 | } else { | 194 | } else { |
| 190 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 195 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
| 191 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 196 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 192 | while (time_before(jiffies, delay)) { | 197 | while (time_before(jiffies, delay)) { |
| 193 | if (acpi_ec_check_status(ec, event)) | 198 | if (acpi_ec_check_status(ec, event)) |
| 194 | return 0; | 199 | goto end; |
| 195 | } | 200 | } |
| 196 | } | 201 | } |
| 197 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 202 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," |
| 198 | " status = %d, expect_event = %d\n", | 203 | " status = %d, expect_event = %d\n", |
| 199 | acpi_ec_read_status(ec), event); | 204 | acpi_ec_read_status(ec), event); |
| 200 | return -ETIME; | 205 | ret = -ETIME; |
| 206 | end: | ||
| 207 | clear_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
| 208 | return ret; | ||
| 201 | } | 209 | } |
| 202 | 210 | ||
| 203 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 211 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
| @@ -216,6 +224,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 216 | "write_cmd timeout, command = %d\n", command); | 224 | "write_cmd timeout, command = %d\n", command); |
| 217 | goto end; | 225 | goto end; |
| 218 | } | 226 | } |
| 227 | /* mark the address byte written to EC */ | ||
| 228 | if (rdata_len + wdata_len > 1) | ||
| 229 | set_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
| 219 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 230 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
| 220 | acpi_ec_write_data(ec, *(wdata++)); | 231 | acpi_ec_write_data(ec, *(wdata++)); |
| 221 | } | 232 | } |
| @@ -231,8 +242,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
| 231 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 242 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
| 232 | 243 | ||
| 233 | for (; rdata_len > 0; --rdata_len) { | 244 | for (; rdata_len > 0; --rdata_len) { |
| 234 | if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags)) | ||
| 235 | force_poll = 1; | ||
| 236 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); | 245 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); |
| 237 | if (result) { | 246 | if (result) { |
| 238 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 247 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", |
| @@ -881,12 +890,20 @@ int __init acpi_ec_ecdt_probe(void) | |||
| 881 | boot_ec->gpe = ecdt_ptr->gpe; | 890 | boot_ec->gpe = ecdt_ptr->gpe; |
| 882 | boot_ec->handle = ACPI_ROOT_OBJECT; | 891 | boot_ec->handle = ACPI_ROOT_OBJECT; |
| 883 | } else { | 892 | } else { |
| 893 | /* This workaround is needed only on some broken machines, | ||
| 894 | * which require early EC, but fail to provide ECDT */ | ||
| 895 | acpi_handle x; | ||
| 884 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); | 896 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
| 885 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, | 897 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, |
| 886 | boot_ec, NULL); | 898 | boot_ec, NULL); |
| 887 | /* Check that acpi_get_devices actually find something */ | 899 | /* Check that acpi_get_devices actually find something */ |
| 888 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 900 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
| 889 | goto error; | 901 | goto error; |
| 902 | /* We really need to limit this workaround, the only ASUS, | ||
| 903 | * which needs it, has fake EC._INI method, so use it as flag. | ||
| 904 | */ | ||
| 905 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) | ||
| 906 | goto error; | ||
| 890 | } | 907 | } |
| 891 | 908 | ||
| 892 | ret = ec_install_handlers(boot_ec); | 909 | ret = ec_install_handlers(boot_ec); |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index aabc6ca4a81c..e3a673a00845 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
| @@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) | |||
| 387 | if (!value) | 387 | if (!value) |
| 388 | value = &dummy; | 388 | value = &dummy; |
| 389 | 389 | ||
| 390 | switch (width) { | 390 | *value = 0; |
| 391 | case 8: | 391 | if (width <= 8) { |
| 392 | *(u8 *) value = inb(port); | 392 | *(u8 *) value = inb(port); |
| 393 | break; | 393 | } else if (width <= 16) { |
| 394 | case 16: | ||
| 395 | *(u16 *) value = inw(port); | 394 | *(u16 *) value = inw(port); |
| 396 | break; | 395 | } else if (width <= 32) { |
| 397 | case 32: | ||
| 398 | *(u32 *) value = inl(port); | 396 | *(u32 *) value = inl(port); |
| 399 | break; | 397 | } else { |
| 400 | default: | ||
| 401 | BUG(); | 398 | BUG(); |
| 402 | } | 399 | } |
| 403 | 400 | ||
| @@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port); | |||
| 408 | 405 | ||
| 409 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) | 406 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) |
| 410 | { | 407 | { |
| 411 | switch (width) { | 408 | if (width <= 8) { |
| 412 | case 8: | ||
| 413 | outb(value, port); | 409 | outb(value, port); |
| 414 | break; | 410 | } else if (width <= 16) { |
| 415 | case 16: | ||
| 416 | outw(value, port); | 411 | outw(value, port); |
| 417 | break; | 412 | } else if (width <= 32) { |
| 418 | case 32: | ||
| 419 | outl(value, port); | 413 | outl(value, port); |
| 420 | break; | 414 | } else { |
| 421 | default: | ||
| 422 | BUG(); | 415 | BUG(); |
| 423 | } | 416 | } |
| 424 | 417 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 44156e73de61..949ba0395901 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
| @@ -612,12 +612,6 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
| 612 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); | 612 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); |
| 613 | } | 613 | } |
| 614 | 614 | ||
| 615 | #ifdef CONFIG_CPU_FREQ | ||
| 616 | acpi_processor_ppc_has_changed(pr); | ||
| 617 | #endif | ||
| 618 | acpi_processor_get_throttling_info(pr); | ||
| 619 | acpi_processor_get_limit_info(pr); | ||
| 620 | |||
| 621 | return 0; | 615 | return 0; |
| 622 | } | 616 | } |
| 623 | 617 | ||
| @@ -665,6 +659,12 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
| 665 | /* _PDC call should be done before doing anything else (if reqd.). */ | 659 | /* _PDC call should be done before doing anything else (if reqd.). */ |
| 666 | arch_acpi_processor_init_pdc(pr); | 660 | arch_acpi_processor_init_pdc(pr); |
| 667 | acpi_processor_set_pdc(pr); | 661 | acpi_processor_set_pdc(pr); |
| 662 | #ifdef CONFIG_CPU_FREQ | ||
| 663 | acpi_processor_ppc_has_changed(pr); | ||
| 664 | #endif | ||
| 665 | acpi_processor_get_throttling_info(pr); | ||
| 666 | acpi_processor_get_limit_info(pr); | ||
| 667 | |||
| 668 | 668 | ||
| 669 | acpi_processor_power_init(pr, device); | 669 | acpi_processor_power_init(pr, device); |
| 670 | 670 | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f996d0e37689..7b6c20eeeaff 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
| @@ -197,6 +197,19 @@ static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2) | |||
| 197 | return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); | 197 | return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | static void acpi_safe_halt(void) | ||
| 201 | { | ||
| 202 | current_thread_info()->status &= ~TS_POLLING; | ||
| 203 | /* | ||
| 204 | * TS_POLLING-cleared state must be visible before we | ||
| 205 | * test NEED_RESCHED: | ||
| 206 | */ | ||
| 207 | smp_mb(); | ||
| 208 | if (!need_resched()) | ||
| 209 | safe_halt(); | ||
| 210 | current_thread_info()->status |= TS_POLLING; | ||
| 211 | } | ||
| 212 | |||
| 200 | #ifndef CONFIG_CPU_IDLE | 213 | #ifndef CONFIG_CPU_IDLE |
| 201 | 214 | ||
| 202 | static void | 215 | static void |
| @@ -239,19 +252,6 @@ acpi_processor_power_activate(struct acpi_processor *pr, | |||
| 239 | return; | 252 | return; |
| 240 | } | 253 | } |
| 241 | 254 | ||
| 242 | static void acpi_safe_halt(void) | ||
| 243 | { | ||
| 244 | current_thread_info()->status &= ~TS_POLLING; | ||
| 245 | /* | ||
| 246 | * TS_POLLING-cleared state must be visible before we | ||
| 247 | * test NEED_RESCHED: | ||
| 248 | */ | ||
| 249 | smp_mb(); | ||
| 250 | if (!need_resched()) | ||
| 251 | safe_halt(); | ||
| 252 | current_thread_info()->status |= TS_POLLING; | ||
| 253 | } | ||
| 254 | |||
| 255 | static atomic_t c3_cpu_count; | 255 | static atomic_t c3_cpu_count; |
| 256 | 256 | ||
| 257 | /* Common C-state entry for C2, C3, .. */ | 257 | /* Common C-state entry for C2, C3, .. */ |
| @@ -1373,15 +1373,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
| 1373 | if (pr->flags.bm_check) | 1373 | if (pr->flags.bm_check) |
| 1374 | acpi_idle_update_bm_rld(pr, cx); | 1374 | acpi_idle_update_bm_rld(pr, cx); |
| 1375 | 1375 | ||
| 1376 | current_thread_info()->status &= ~TS_POLLING; | 1376 | acpi_safe_halt(); |
| 1377 | /* | ||
| 1378 | * TS_POLLING-cleared state must be visible before we test | ||
| 1379 | * NEED_RESCHED: | ||
| 1380 | */ | ||
| 1381 | smp_mb(); | ||
| 1382 | if (!need_resched()) | ||
| 1383 | safe_halt(); | ||
| 1384 | current_thread_info()->status |= TS_POLLING; | ||
| 1385 | 1377 | ||
| 1386 | cx->usage++; | 1378 | cx->usage++; |
| 1387 | 1379 | ||
| @@ -1399,6 +1391,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 1399 | struct acpi_processor *pr; | 1391 | struct acpi_processor *pr; |
| 1400 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1392 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
| 1401 | u32 t1, t2; | 1393 | u32 t1, t2; |
| 1394 | int sleep_ticks = 0; | ||
| 1395 | |||
| 1402 | pr = processors[smp_processor_id()]; | 1396 | pr = processors[smp_processor_id()]; |
| 1403 | 1397 | ||
| 1404 | if (unlikely(!pr)) | 1398 | if (unlikely(!pr)) |
| @@ -1428,6 +1422,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 1428 | ACPI_FLUSH_CPU_CACHE(); | 1422 | ACPI_FLUSH_CPU_CACHE(); |
| 1429 | 1423 | ||
| 1430 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1424 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
| 1425 | /* Tell the scheduler that we are going deep-idle: */ | ||
| 1426 | sched_clock_idle_sleep_event(); | ||
| 1431 | acpi_state_timer_broadcast(pr, cx, 1); | 1427 | acpi_state_timer_broadcast(pr, cx, 1); |
| 1432 | acpi_idle_do_entry(cx); | 1428 | acpi_idle_do_entry(cx); |
| 1433 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1429 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
| @@ -1436,6 +1432,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 1436 | /* TSC could halt in idle, so notify users */ | 1432 | /* TSC could halt in idle, so notify users */ |
| 1437 | mark_tsc_unstable("TSC halts in idle");; | 1433 | mark_tsc_unstable("TSC halts in idle");; |
| 1438 | #endif | 1434 | #endif |
| 1435 | sleep_ticks = ticks_elapsed(t1, t2); | ||
| 1436 | |||
| 1437 | /* Tell the scheduler how much we idled: */ | ||
| 1438 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
| 1439 | 1439 | ||
| 1440 | local_irq_enable(); | 1440 | local_irq_enable(); |
| 1441 | current_thread_info()->status |= TS_POLLING; | 1441 | current_thread_info()->status |= TS_POLLING; |
| @@ -1443,7 +1443,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
| 1443 | cx->usage++; | 1443 | cx->usage++; |
| 1444 | 1444 | ||
| 1445 | acpi_state_timer_broadcast(pr, cx, 0); | 1445 | acpi_state_timer_broadcast(pr, cx, 0); |
| 1446 | cx->time += ticks_elapsed(t1, t2); | 1446 | cx->time += sleep_ticks; |
| 1447 | return ticks_elapsed_in_us(t1, t2); | 1447 | return ticks_elapsed_in_us(t1, t2); |
| 1448 | } | 1448 | } |
| 1449 | 1449 | ||
| @@ -1463,6 +1463,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 1463 | struct acpi_processor *pr; | 1463 | struct acpi_processor *pr; |
| 1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
| 1465 | u32 t1, t2; | 1465 | u32 t1, t2; |
| 1466 | int sleep_ticks = 0; | ||
| 1467 | |||
| 1466 | pr = processors[smp_processor_id()]; | 1468 | pr = processors[smp_processor_id()]; |
| 1467 | 1469 | ||
| 1468 | if (unlikely(!pr)) | 1470 | if (unlikely(!pr)) |
| @@ -1471,6 +1473,15 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 1471 | if (acpi_idle_suspend) | 1473 | if (acpi_idle_suspend) |
| 1472 | return(acpi_idle_enter_c1(dev, state)); | 1474 | return(acpi_idle_enter_c1(dev, state)); |
| 1473 | 1475 | ||
| 1476 | if (acpi_idle_bm_check()) { | ||
| 1477 | if (dev->safe_state) { | ||
| 1478 | return dev->safe_state->enter(dev, dev->safe_state); | ||
| 1479 | } else { | ||
| 1480 | acpi_safe_halt(); | ||
| 1481 | return 0; | ||
| 1482 | } | ||
| 1483 | } | ||
| 1484 | |||
| 1474 | local_irq_disable(); | 1485 | local_irq_disable(); |
| 1475 | current_thread_info()->status &= ~TS_POLLING; | 1486 | current_thread_info()->status &= ~TS_POLLING; |
| 1476 | /* | 1487 | /* |
| @@ -1485,38 +1496,45 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 1485 | return 0; | 1496 | return 0; |
| 1486 | } | 1497 | } |
| 1487 | 1498 | ||
| 1499 | /* Tell the scheduler that we are going deep-idle: */ | ||
| 1500 | sched_clock_idle_sleep_event(); | ||
| 1488 | /* | 1501 | /* |
| 1489 | * Must be done before busmaster disable as we might need to | 1502 | * Must be done before busmaster disable as we might need to |
| 1490 | * access HPET ! | 1503 | * access HPET ! |
| 1491 | */ | 1504 | */ |
| 1492 | acpi_state_timer_broadcast(pr, cx, 1); | 1505 | acpi_state_timer_broadcast(pr, cx, 1); |
| 1493 | 1506 | ||
| 1494 | if (acpi_idle_bm_check()) { | 1507 | acpi_idle_update_bm_rld(pr, cx); |
| 1495 | cx = pr->power.bm_state; | ||
| 1496 | |||
| 1497 | acpi_idle_update_bm_rld(pr, cx); | ||
| 1498 | |||
| 1499 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 1500 | acpi_idle_do_entry(cx); | ||
| 1501 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
| 1502 | } else { | ||
| 1503 | acpi_idle_update_bm_rld(pr, cx); | ||
| 1504 | 1508 | ||
| 1509 | /* | ||
| 1510 | * disable bus master | ||
| 1511 | * bm_check implies we need ARB_DIS | ||
| 1512 | * !bm_check implies we need cache flush | ||
| 1513 | * bm_control implies whether we can do ARB_DIS | ||
| 1514 | * | ||
| 1515 | * That leaves a case where bm_check is set and bm_control is | ||
| 1516 | * not set. In that case we cannot do much, we enter C3 | ||
| 1517 | * without doing anything. | ||
| 1518 | */ | ||
| 1519 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
| 1505 | spin_lock(&c3_lock); | 1520 | spin_lock(&c3_lock); |
| 1506 | c3_cpu_count++; | 1521 | c3_cpu_count++; |
| 1507 | /* Disable bus master arbitration when all CPUs are in C3 */ | 1522 | /* Disable bus master arbitration when all CPUs are in C3 */ |
| 1508 | if (c3_cpu_count == num_online_cpus()) | 1523 | if (c3_cpu_count == num_online_cpus()) |
| 1509 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); | 1524 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); |
| 1510 | spin_unlock(&c3_lock); | 1525 | spin_unlock(&c3_lock); |
| 1526 | } else if (!pr->flags.bm_check) { | ||
| 1527 | ACPI_FLUSH_CPU_CACHE(); | ||
| 1528 | } | ||
| 1511 | 1529 | ||
| 1512 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1530 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
| 1513 | acpi_idle_do_entry(cx); | 1531 | acpi_idle_do_entry(cx); |
| 1514 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1532 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
| 1515 | 1533 | ||
| 1534 | /* Re-enable bus master arbitration */ | ||
| 1535 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
| 1516 | spin_lock(&c3_lock); | 1536 | spin_lock(&c3_lock); |
| 1517 | /* Re-enable bus master arbitration */ | 1537 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); |
| 1518 | if (c3_cpu_count == num_online_cpus()) | ||
| 1519 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); | ||
| 1520 | c3_cpu_count--; | 1538 | c3_cpu_count--; |
| 1521 | spin_unlock(&c3_lock); | 1539 | spin_unlock(&c3_lock); |
| 1522 | } | 1540 | } |
| @@ -1525,6 +1543,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 1525 | /* TSC could halt in idle, so notify users */ | 1543 | /* TSC could halt in idle, so notify users */ |
| 1526 | mark_tsc_unstable("TSC halts in idle"); | 1544 | mark_tsc_unstable("TSC halts in idle"); |
| 1527 | #endif | 1545 | #endif |
| 1546 | sleep_ticks = ticks_elapsed(t1, t2); | ||
| 1547 | /* Tell the scheduler how much we idled: */ | ||
| 1548 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
| 1528 | 1549 | ||
| 1529 | local_irq_enable(); | 1550 | local_irq_enable(); |
| 1530 | current_thread_info()->status |= TS_POLLING; | 1551 | current_thread_info()->status |= TS_POLLING; |
| @@ -1532,7 +1553,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
| 1532 | cx->usage++; | 1553 | cx->usage++; |
| 1533 | 1554 | ||
| 1534 | acpi_state_timer_broadcast(pr, cx, 0); | 1555 | acpi_state_timer_broadcast(pr, cx, 0); |
| 1535 | cx->time += ticks_elapsed(t1, t2); | 1556 | cx->time += sleep_ticks; |
| 1536 | return ticks_elapsed_in_us(t1, t2); | 1557 | return ticks_elapsed_in_us(t1, t2); |
| 1537 | } | 1558 | } |
| 1538 | 1559 | ||
| @@ -1584,12 +1605,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
| 1584 | case ACPI_STATE_C1: | 1605 | case ACPI_STATE_C1: |
| 1585 | state->flags |= CPUIDLE_FLAG_SHALLOW; | 1606 | state->flags |= CPUIDLE_FLAG_SHALLOW; |
| 1586 | state->enter = acpi_idle_enter_c1; | 1607 | state->enter = acpi_idle_enter_c1; |
| 1608 | dev->safe_state = state; | ||
| 1587 | break; | 1609 | break; |
| 1588 | 1610 | ||
| 1589 | case ACPI_STATE_C2: | 1611 | case ACPI_STATE_C2: |
| 1590 | state->flags |= CPUIDLE_FLAG_BALANCED; | 1612 | state->flags |= CPUIDLE_FLAG_BALANCED; |
| 1591 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | 1613 | state->flags |= CPUIDLE_FLAG_TIME_VALID; |
| 1592 | state->enter = acpi_idle_enter_simple; | 1614 | state->enter = acpi_idle_enter_simple; |
| 1615 | dev->safe_state = state; | ||
| 1593 | break; | 1616 | break; |
| 1594 | 1617 | ||
| 1595 | case ACPI_STATE_C3: | 1618 | case ACPI_STATE_C3: |
| @@ -1610,14 +1633,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
| 1610 | if (!count) | 1633 | if (!count) |
| 1611 | return -EINVAL; | 1634 | return -EINVAL; |
| 1612 | 1635 | ||
| 1613 | /* find the deepest state that can handle active BM */ | ||
| 1614 | if (pr->flags.bm_check) { | ||
| 1615 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) | ||
| 1616 | if (pr->power.states[i].type == ACPI_STATE_C3) | ||
| 1617 | break; | ||
| 1618 | pr->power.bm_state = &pr->power.states[i-1]; | ||
| 1619 | } | ||
| 1620 | |||
| 1621 | return 0; | 1636 | return 0; |
| 1622 | } | 1637 | } |
| 1623 | 1638 | ||
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 0b8204e7082a..c26c61fb36c3 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
| @@ -70,7 +70,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
| 70 | 70 | ||
| 71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | 71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) |
| 72 | { | 72 | { |
| 73 | return acpi_processor_get_platform_limit(pr); | 73 | int result = 0; |
| 74 | int throttling_limit; | ||
| 75 | int current_state; | ||
| 76 | struct acpi_processor_limit *limit; | ||
| 77 | int target_state; | ||
| 78 | |||
| 79 | result = acpi_processor_get_platform_limit(pr); | ||
| 80 | if (result) { | ||
| 81 | /* Throttling Limit is unsupported */ | ||
| 82 | return result; | ||
| 83 | } | ||
| 84 | |||
| 85 | throttling_limit = pr->throttling_platform_limit; | ||
| 86 | if (throttling_limit >= pr->throttling.state_count) { | ||
| 87 | /* Uncorrect Throttling Limit */ | ||
| 88 | return -EINVAL; | ||
| 89 | } | ||
| 90 | |||
| 91 | current_state = pr->throttling.state; | ||
| 92 | if (current_state > throttling_limit) { | ||
| 93 | /* | ||
| 94 | * The current state can meet the requirement of | ||
| 95 | * _TPC limit. But it is reasonable that OSPM changes | ||
| 96 | * t-states from high to low for better performance. | ||
| 97 | * Of course the limit condition of thermal | ||
| 98 | * and user should be considered. | ||
| 99 | */ | ||
| 100 | limit = &pr->limit; | ||
| 101 | target_state = throttling_limit; | ||
| 102 | if (limit->thermal.tx > target_state) | ||
| 103 | target_state = limit->thermal.tx; | ||
| 104 | if (limit->user.tx > target_state) | ||
| 105 | target_state = limit->user.tx; | ||
| 106 | } else if (current_state == throttling_limit) { | ||
| 107 | /* | ||
| 108 | * Unnecessary to change the throttling state | ||
| 109 | */ | ||
| 110 | return 0; | ||
| 111 | } else { | ||
| 112 | /* | ||
| 113 | * If the current state is lower than the limit of _TPC, it | ||
| 114 | * will be forced to switch to the throttling state defined | ||
| 115 | * by throttling_platfor_limit. | ||
| 116 | * Because the previous state meets with the limit condition | ||
| 117 | * of thermal and user, it is unnecessary to check it again. | ||
| 118 | */ | ||
| 119 | target_state = throttling_limit; | ||
| 120 | } | ||
| 121 | return acpi_processor_set_throttling(pr, target_state); | ||
| 74 | } | 122 | } |
| 75 | 123 | ||
| 76 | /* | 124 | /* |
| @@ -83,6 +131,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
| 83 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 131 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 84 | union acpi_object *ptc = NULL; | 132 | union acpi_object *ptc = NULL; |
| 85 | union acpi_object obj = { 0 }; | 133 | union acpi_object obj = { 0 }; |
| 134 | struct acpi_processor_throttling *throttling; | ||
| 86 | 135 | ||
| 87 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); | 136 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); |
| 88 | if (ACPI_FAILURE(status)) { | 137 | if (ACPI_FAILURE(status)) { |
| @@ -134,6 +183,22 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
| 134 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, | 183 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, |
| 135 | sizeof(struct acpi_ptc_register)); | 184 | sizeof(struct acpi_ptc_register)); |
| 136 | 185 | ||
| 186 | throttling = &pr->throttling; | ||
| 187 | |||
| 188 | if ((throttling->control_register.bit_width + | ||
| 189 | throttling->control_register.bit_offset) > 32) { | ||
| 190 | printk(KERN_ERR PREFIX "Invalid _PTC control register\n"); | ||
| 191 | result = -EFAULT; | ||
| 192 | goto end; | ||
| 193 | } | ||
| 194 | |||
| 195 | if ((throttling->status_register.bit_width + | ||
| 196 | throttling->status_register.bit_offset) > 32) { | ||
| 197 | printk(KERN_ERR PREFIX "Invalid _PTC status register\n"); | ||
| 198 | result = -EFAULT; | ||
| 199 | goto end; | ||
| 200 | } | ||
| 201 | |||
| 137 | end: | 202 | end: |
| 138 | kfree(buffer.pointer); | 203 | kfree(buffer.pointer); |
| 139 | 204 | ||
| @@ -328,44 +393,132 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
| 328 | return 0; | 393 | return 0; |
| 329 | } | 394 | } |
| 330 | 395 | ||
| 331 | static int acpi_read_throttling_status(struct acpi_processor_throttling | 396 | #ifdef CONFIG_X86 |
| 332 | *throttling) | 397 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
| 398 | acpi_integer * value) | ||
| 333 | { | 399 | { |
| 334 | int value = -1; | 400 | struct cpuinfo_x86 *c; |
| 401 | u64 msr_high, msr_low; | ||
| 402 | unsigned int cpu; | ||
| 403 | u64 msr = 0; | ||
| 404 | int ret = -1; | ||
| 405 | |||
| 406 | cpu = pr->id; | ||
| 407 | c = &cpu_data(cpu); | ||
| 408 | |||
| 409 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
| 410 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
| 411 | printk(KERN_ERR PREFIX | ||
| 412 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 413 | } else { | ||
| 414 | msr_low = 0; | ||
| 415 | msr_high = 0; | ||
| 416 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
| 417 | (u32 *)&msr_low , (u32 *) &msr_high); | ||
| 418 | msr = (msr_high << 32) | msr_low; | ||
| 419 | *value = (acpi_integer) msr; | ||
| 420 | ret = 0; | ||
| 421 | } | ||
| 422 | return ret; | ||
| 423 | } | ||
| 424 | |||
| 425 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
| 426 | { | ||
| 427 | struct cpuinfo_x86 *c; | ||
| 428 | unsigned int cpu; | ||
| 429 | int ret = -1; | ||
| 430 | u64 msr; | ||
| 431 | |||
| 432 | cpu = pr->id; | ||
| 433 | c = &cpu_data(cpu); | ||
| 434 | |||
| 435 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
| 436 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
| 437 | printk(KERN_ERR PREFIX | ||
| 438 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 439 | } else { | ||
| 440 | msr = value; | ||
| 441 | wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
| 442 | msr & 0xffffffff, msr >> 32); | ||
| 443 | ret = 0; | ||
| 444 | } | ||
| 445 | return ret; | ||
| 446 | } | ||
| 447 | #else | ||
| 448 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | ||
| 449 | acpi_integer * value) | ||
| 450 | { | ||
| 451 | printk(KERN_ERR PREFIX | ||
| 452 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 453 | return -1; | ||
| 454 | } | ||
| 455 | |||
| 456 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
| 457 | { | ||
| 458 | printk(KERN_ERR PREFIX | ||
| 459 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 460 | return -1; | ||
| 461 | } | ||
| 462 | #endif | ||
| 463 | |||
| 464 | static int acpi_read_throttling_status(struct acpi_processor *pr, | ||
| 465 | acpi_integer *value) | ||
| 466 | { | ||
| 467 | u32 bit_width, bit_offset; | ||
| 468 | u64 ptc_value; | ||
| 469 | u64 ptc_mask; | ||
| 470 | struct acpi_processor_throttling *throttling; | ||
| 471 | int ret = -1; | ||
| 472 | |||
| 473 | throttling = &pr->throttling; | ||
| 335 | switch (throttling->status_register.space_id) { | 474 | switch (throttling->status_register.space_id) { |
| 336 | case ACPI_ADR_SPACE_SYSTEM_IO: | 475 | case ACPI_ADR_SPACE_SYSTEM_IO: |
| 476 | ptc_value = 0; | ||
| 477 | bit_width = throttling->status_register.bit_width; | ||
| 478 | bit_offset = throttling->status_register.bit_offset; | ||
| 479 | |||
| 337 | acpi_os_read_port((acpi_io_address) throttling->status_register. | 480 | acpi_os_read_port((acpi_io_address) throttling->status_register. |
| 338 | address, &value, | 481 | address, (u32 *) &ptc_value, |
| 339 | (u32) throttling->status_register.bit_width * | 482 | (u32) (bit_width + bit_offset)); |
| 340 | 8); | 483 | ptc_mask = (1 << bit_width) - 1; |
| 484 | *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask); | ||
| 485 | ret = 0; | ||
| 341 | break; | 486 | break; |
| 342 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 487 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
| 343 | printk(KERN_ERR PREFIX | 488 | ret = acpi_throttling_rdmsr(pr, value); |
| 344 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 345 | break; | 489 | break; |
| 346 | default: | 490 | default: |
| 347 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 491 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
| 348 | (u32) (throttling->status_register.space_id)); | 492 | (u32) (throttling->status_register.space_id)); |
| 349 | } | 493 | } |
| 350 | return value; | 494 | return ret; |
| 351 | } | 495 | } |
| 352 | 496 | ||
| 353 | static int acpi_write_throttling_state(struct acpi_processor_throttling | 497 | static int acpi_write_throttling_state(struct acpi_processor *pr, |
| 354 | *throttling, int value) | 498 | acpi_integer value) |
| 355 | { | 499 | { |
| 500 | u32 bit_width, bit_offset; | ||
| 501 | u64 ptc_value; | ||
| 502 | u64 ptc_mask; | ||
| 503 | struct acpi_processor_throttling *throttling; | ||
| 356 | int ret = -1; | 504 | int ret = -1; |
| 357 | 505 | ||
| 506 | throttling = &pr->throttling; | ||
| 358 | switch (throttling->control_register.space_id) { | 507 | switch (throttling->control_register.space_id) { |
| 359 | case ACPI_ADR_SPACE_SYSTEM_IO: | 508 | case ACPI_ADR_SPACE_SYSTEM_IO: |
| 509 | bit_width = throttling->control_register.bit_width; | ||
| 510 | bit_offset = throttling->control_register.bit_offset; | ||
| 511 | ptc_mask = (1 << bit_width) - 1; | ||
| 512 | ptc_value = value & ptc_mask; | ||
| 513 | |||
| 360 | acpi_os_write_port((acpi_io_address) throttling-> | 514 | acpi_os_write_port((acpi_io_address) throttling-> |
| 361 | control_register.address, value, | 515 | control_register.address, |
| 362 | (u32) throttling->control_register. | 516 | (u32) (ptc_value << bit_offset), |
| 363 | bit_width * 8); | 517 | (u32) (bit_width + bit_offset)); |
| 364 | ret = 0; | 518 | ret = 0; |
| 365 | break; | 519 | break; |
| 366 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 520 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
| 367 | printk(KERN_ERR PREFIX | 521 | ret = acpi_throttling_wrmsr(pr, value); |
| 368 | "HARDWARE addr space,NOT supported yet\n"); | ||
| 369 | break; | 522 | break; |
| 370 | default: | 523 | default: |
| 371 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 524 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
| @@ -374,7 +527,8 @@ static int acpi_write_throttling_state(struct acpi_processor_throttling | |||
| 374 | return ret; | 527 | return ret; |
| 375 | } | 528 | } |
| 376 | 529 | ||
| 377 | static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | 530 | static int acpi_get_throttling_state(struct acpi_processor *pr, |
| 531 | acpi_integer value) | ||
| 378 | { | 532 | { |
| 379 | int i; | 533 | int i; |
| 380 | 534 | ||
| @@ -390,22 +544,26 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | |||
| 390 | return i; | 544 | return i; |
| 391 | } | 545 | } |
| 392 | 546 | ||
| 393 | static int acpi_get_throttling_value(struct acpi_processor *pr, int state) | 547 | static int acpi_get_throttling_value(struct acpi_processor *pr, |
| 548 | int state, acpi_integer *value) | ||
| 394 | { | 549 | { |
| 395 | int value = -1; | 550 | int ret = -1; |
| 551 | |||
| 396 | if (state >= 0 && state <= pr->throttling.state_count) { | 552 | if (state >= 0 && state <= pr->throttling.state_count) { |
| 397 | struct acpi_processor_tx_tss *tx = | 553 | struct acpi_processor_tx_tss *tx = |
| 398 | (struct acpi_processor_tx_tss *)&(pr->throttling. | 554 | (struct acpi_processor_tx_tss *)&(pr->throttling. |
| 399 | states_tss[state]); | 555 | states_tss[state]); |
| 400 | value = tx->control; | 556 | *value = tx->control; |
| 557 | ret = 0; | ||
| 401 | } | 558 | } |
| 402 | return value; | 559 | return ret; |
| 403 | } | 560 | } |
| 404 | 561 | ||
| 405 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | 562 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) |
| 406 | { | 563 | { |
| 407 | int state = 0; | 564 | int state = 0; |
| 408 | u32 value = 0; | 565 | int ret; |
| 566 | acpi_integer value; | ||
| 409 | 567 | ||
| 410 | if (!pr) | 568 | if (!pr) |
| 411 | return -EINVAL; | 569 | return -EINVAL; |
| @@ -415,8 +573,9 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
| 415 | 573 | ||
| 416 | pr->throttling.state = 0; | 574 | pr->throttling.state = 0; |
| 417 | local_irq_disable(); | 575 | local_irq_disable(); |
| 418 | value = acpi_read_throttling_status(&pr->throttling); | 576 | value = 0; |
| 419 | if (value >= 0) { | 577 | ret = acpi_read_throttling_status(pr, &value); |
| 578 | if (ret >= 0) { | ||
| 420 | state = acpi_get_throttling_state(pr, value); | 579 | state = acpi_get_throttling_state(pr, value); |
| 421 | pr->throttling.state = state; | 580 | pr->throttling.state = state; |
| 422 | } | 581 | } |
| @@ -430,6 +589,40 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) | |||
| 430 | return pr->throttling.acpi_processor_get_throttling(pr); | 589 | return pr->throttling.acpi_processor_get_throttling(pr); |
| 431 | } | 590 | } |
| 432 | 591 | ||
| 592 | static int acpi_processor_get_fadt_info(struct acpi_processor *pr) | ||
| 593 | { | ||
| 594 | int i, step; | ||
| 595 | |||
| 596 | if (!pr->throttling.address) { | ||
| 597 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
| 598 | return -EINVAL; | ||
| 599 | } else if (!pr->throttling.duty_width) { | ||
| 600 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
| 601 | return -EINVAL; | ||
| 602 | } | ||
| 603 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
| 604 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
| 605 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
| 606 | return -EINVAL; | ||
| 607 | } | ||
| 608 | |||
| 609 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
| 610 | |||
| 611 | /* | ||
| 612 | * Compute state values. Note that throttling displays a linear power | ||
| 613 | * performance relationship (at 50% performance the CPU will consume | ||
| 614 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
| 615 | */ | ||
| 616 | |||
| 617 | step = (1000 / pr->throttling.state_count); | ||
| 618 | |||
| 619 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
| 620 | pr->throttling.states[i].performance = 1000 - step * i; | ||
| 621 | pr->throttling.states[i].power = 1000 - step * i; | ||
| 622 | } | ||
| 623 | return 0; | ||
| 624 | } | ||
| 625 | |||
| 433 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | 626 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, |
| 434 | int state) | 627 | int state) |
| 435 | { | 628 | { |
| @@ -506,7 +699,8 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | |||
| 506 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | 699 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, |
| 507 | int state) | 700 | int state) |
| 508 | { | 701 | { |
| 509 | u32 value = 0; | 702 | int ret; |
| 703 | acpi_integer value; | ||
| 510 | 704 | ||
| 511 | if (!pr) | 705 | if (!pr) |
| 512 | return -EINVAL; | 706 | return -EINVAL; |
| @@ -524,10 +718,10 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
| 524 | return -EPERM; | 718 | return -EPERM; |
| 525 | 719 | ||
| 526 | local_irq_disable(); | 720 | local_irq_disable(); |
| 527 | 721 | value = 0; | |
| 528 | value = acpi_get_throttling_value(pr, state); | 722 | ret = acpi_get_throttling_value(pr, state, &value); |
| 529 | if (value >= 0) { | 723 | if (ret >= 0) { |
| 530 | acpi_write_throttling_state(&pr->throttling, value); | 724 | acpi_write_throttling_state(pr, value); |
| 531 | pr->throttling.state = state; | 725 | pr->throttling.state = state; |
| 532 | } | 726 | } |
| 533 | local_irq_enable(); | 727 | local_irq_enable(); |
| @@ -543,8 +737,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
| 543 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) | 737 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |
| 544 | { | 738 | { |
| 545 | int result = 0; | 739 | int result = 0; |
| 546 | int step = 0; | ||
| 547 | int i = 0; | ||
| 548 | 740 | ||
| 549 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 741 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 550 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 742 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
| @@ -563,6 +755,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
| 563 | acpi_processor_get_throttling_states(pr) || | 755 | acpi_processor_get_throttling_states(pr) || |
| 564 | acpi_processor_get_platform_limit(pr)) | 756 | acpi_processor_get_platform_limit(pr)) |
| 565 | { | 757 | { |
| 758 | if (acpi_processor_get_fadt_info(pr)) | ||
| 759 | return 0; | ||
| 566 | pr->throttling.acpi_processor_get_throttling = | 760 | pr->throttling.acpi_processor_get_throttling = |
| 567 | &acpi_processor_get_throttling_fadt; | 761 | &acpi_processor_get_throttling_fadt; |
| 568 | pr->throttling.acpi_processor_set_throttling = | 762 | pr->throttling.acpi_processor_set_throttling = |
| @@ -576,19 +770,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
| 576 | 770 | ||
| 577 | acpi_processor_get_tsd(pr); | 771 | acpi_processor_get_tsd(pr); |
| 578 | 772 | ||
| 579 | if (!pr->throttling.address) { | ||
| 580 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
| 581 | return 0; | ||
| 582 | } else if (!pr->throttling.duty_width) { | ||
| 583 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
| 584 | return 0; | ||
| 585 | } | ||
| 586 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
| 587 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
| 588 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
| 589 | return 0; | ||
| 590 | } | ||
| 591 | |||
| 592 | /* | 773 | /* |
| 593 | * PIIX4 Errata: We don't support throttling on the original PIIX4. | 774 | * PIIX4 Errata: We don't support throttling on the original PIIX4. |
| 594 | * This shouldn't be an issue as few (if any) mobile systems ever | 775 | * This shouldn't be an issue as few (if any) mobile systems ever |
| @@ -600,21 +781,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
| 600 | return 0; | 781 | return 0; |
| 601 | } | 782 | } |
| 602 | 783 | ||
| 603 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
| 604 | |||
| 605 | /* | ||
| 606 | * Compute state values. Note that throttling displays a linear power/ | ||
| 607 | * performance relationship (at 50% performance the CPU will consume | ||
| 608 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
| 609 | */ | ||
| 610 | |||
| 611 | step = (1000 / pr->throttling.state_count); | ||
| 612 | |||
| 613 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
| 614 | pr->throttling.states[i].performance = step * i; | ||
| 615 | pr->throttling.states[i].power = step * i; | ||
| 616 | } | ||
| 617 | |||
| 618 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", | 784 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", |
| 619 | pr->throttling.state_count)); | 785 | pr->throttling.state_count)); |
| 620 | 786 | ||
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 90fd09c65f95..6045cdbe176b 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
| 30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
| 31 | 31 | ||
| 32 | #ifdef CONFIG_ACPI_PROCFS | 32 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
| 34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
| 35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
| @@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | |||
| 88 | struct acpi_battery { | 88 | struct acpi_battery { |
| 89 | struct power_supply bat; | 89 | struct power_supply bat; |
| 90 | struct acpi_sbs *sbs; | 90 | struct acpi_sbs *sbs; |
| 91 | #ifdef CONFIG_ACPI_PROCFS | 91 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 92 | struct proc_dir_entry *proc_entry; | 92 | struct proc_dir_entry *proc_entry; |
| 93 | #endif | 93 | #endif |
| 94 | unsigned long update_time; | 94 | unsigned long update_time; |
| @@ -113,6 +113,7 @@ struct acpi_battery { | |||
| 113 | u16 spec; | 113 | u16 spec; |
| 114 | u8 id; | 114 | u8 id; |
| 115 | u8 present:1; | 115 | u8 present:1; |
| 116 | u8 have_sysfs_alarm:1; | ||
| 116 | }; | 117 | }; |
| 117 | 118 | ||
| 118 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 119 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
| @@ -122,7 +123,7 @@ struct acpi_sbs { | |||
| 122 | struct acpi_device *device; | 123 | struct acpi_device *device; |
| 123 | struct acpi_smb_hc *hc; | 124 | struct acpi_smb_hc *hc; |
| 124 | struct mutex lock; | 125 | struct mutex lock; |
| 125 | #ifdef CONFIG_ACPI_PROCFS | 126 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 126 | struct proc_dir_entry *charger_entry; | 127 | struct proc_dir_entry *charger_entry; |
| 127 | #endif | 128 | #endif |
| 128 | struct acpi_battery battery[MAX_SBS_BAT]; | 129 | struct acpi_battery battery[MAX_SBS_BAT]; |
| @@ -468,7 +469,7 @@ static struct device_attribute alarm_attr = { | |||
| 468 | FS Interface (/proc/acpi) | 469 | FS Interface (/proc/acpi) |
| 469 | -------------------------------------------------------------------------- */ | 470 | -------------------------------------------------------------------------- */ |
| 470 | 471 | ||
| 471 | #ifdef CONFIG_ACPI_PROCFS | 472 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 472 | /* Generic Routines */ | 473 | /* Generic Routines */ |
| 473 | static int | 474 | static int |
| 474 | acpi_sbs_add_fs(struct proc_dir_entry **dir, | 475 | acpi_sbs_add_fs(struct proc_dir_entry **dir, |
| @@ -789,7 +790,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
| 789 | return result; | 790 | return result; |
| 790 | 791 | ||
| 791 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); | 792 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); |
| 792 | #ifdef CONFIG_ACPI_PROCFS | 793 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 793 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, | 794 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, |
| 794 | battery->name, &acpi_battery_info_fops, | 795 | battery->name, &acpi_battery_info_fops, |
| 795 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, | 796 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, |
| @@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
| 808 | } | 809 | } |
| 809 | battery->bat.get_property = acpi_sbs_battery_get_property; | 810 | battery->bat.get_property = acpi_sbs_battery_get_property; |
| 810 | result = power_supply_register(&sbs->device->dev, &battery->bat); | 811 | result = power_supply_register(&sbs->device->dev, &battery->bat); |
| 811 | device_create_file(battery->bat.dev, &alarm_attr); | 812 | if (result) |
| 813 | goto end; | ||
| 814 | result = device_create_file(battery->bat.dev, &alarm_attr); | ||
| 815 | if (result) | ||
| 816 | goto end; | ||
| 817 | battery->have_sysfs_alarm = 1; | ||
| 818 | end: | ||
| 812 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 819 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
| 813 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 820 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
| 814 | battery->name, sbs->battery->present ? "present" : "absent"); | 821 | battery->name, sbs->battery->present ? "present" : "absent"); |
| @@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
| 817 | 824 | ||
| 818 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 825 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
| 819 | { | 826 | { |
| 820 | if (sbs->battery[id].bat.dev) | 827 | struct acpi_battery *battery = &sbs->battery[id]; |
| 821 | device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); | 828 | |
| 822 | power_supply_unregister(&sbs->battery[id].bat); | 829 | if (battery->bat.dev) { |
| 823 | #ifdef CONFIG_ACPI_PROCFS | 830 | if (battery->have_sysfs_alarm) |
| 824 | if (sbs->battery[id].proc_entry) { | 831 | device_remove_file(battery->bat.dev, &alarm_attr); |
| 825 | acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), | 832 | power_supply_unregister(&battery->bat); |
| 826 | acpi_battery_dir); | ||
| 827 | } | 833 | } |
| 834 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
| 835 | if (battery->proc_entry) | ||
| 836 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | ||
| 828 | #endif | 837 | #endif |
| 829 | } | 838 | } |
| 830 | 839 | ||
| @@ -835,7 +844,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
| 835 | result = acpi_ac_get_present(sbs); | 844 | result = acpi_ac_get_present(sbs); |
| 836 | if (result) | 845 | if (result) |
| 837 | goto end; | 846 | goto end; |
| 838 | #ifdef CONFIG_ACPI_PROCFS | 847 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 839 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, | 848 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, |
| 840 | ACPI_AC_DIR_NAME, NULL, | 849 | ACPI_AC_DIR_NAME, NULL, |
| 841 | &acpi_ac_state_fops, NULL, sbs); | 850 | &acpi_ac_state_fops, NULL, sbs); |
| @@ -859,7 +868,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs) | |||
| 859 | { | 868 | { |
| 860 | if (sbs->charger.dev) | 869 | if (sbs->charger.dev) |
| 861 | power_supply_unregister(&sbs->charger); | 870 | power_supply_unregister(&sbs->charger); |
| 862 | #ifdef CONFIG_ACPI_PROCFS | 871 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 863 | if (sbs->charger_entry) | 872 | if (sbs->charger_entry) |
| 864 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 873 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); |
| 865 | #endif | 874 | #endif |
| @@ -965,7 +974,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type) | |||
| 965 | 974 | ||
| 966 | static void acpi_sbs_rmdirs(void) | 975 | static void acpi_sbs_rmdirs(void) |
| 967 | { | 976 | { |
| 968 | #ifdef CONFIG_ACPI_PROCFS | 977 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 969 | if (acpi_ac_dir) { | 978 | if (acpi_ac_dir) { |
| 970 | acpi_unlock_ac_dir(acpi_ac_dir); | 979 | acpi_unlock_ac_dir(acpi_ac_dir); |
| 971 | acpi_ac_dir = NULL; | 980 | acpi_ac_dir = NULL; |
| @@ -1004,7 +1013,7 @@ static int __init acpi_sbs_init(void) | |||
| 1004 | 1013 | ||
| 1005 | if (acpi_disabled) | 1014 | if (acpi_disabled) |
| 1006 | return -ENODEV; | 1015 | return -ENODEV; |
| 1007 | #ifdef CONFIG_ACPI_PROCFS | 1016 | #ifdef CONFIG_ACPI_PROCFS_POWER |
| 1008 | acpi_ac_dir = acpi_lock_ac_dir(); | 1017 | acpi_ac_dir = acpi_lock_ac_dir(); |
| 1009 | if (!acpi_ac_dir) | 1018 | if (!acpi_ac_dir) |
| 1010 | return -ENODEV; | 1019 | return -ENODEV; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bac956b30c57..44a0d9ba9bd6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
| 30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
| 31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
| 32 | #include <linux/mutex.h> | ||
| 32 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
| 33 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
| 34 | #include <linux/input.h> | 35 | #include <linux/input.h> |
| @@ -135,8 +136,8 @@ struct acpi_video_bus { | |||
| 135 | u8 attached_count; | 136 | u8 attached_count; |
| 136 | struct acpi_video_bus_cap cap; | 137 | struct acpi_video_bus_cap cap; |
| 137 | struct acpi_video_bus_flags flags; | 138 | struct acpi_video_bus_flags flags; |
| 138 | struct semaphore sem; | ||
| 139 | struct list_head video_device_list; | 139 | struct list_head video_device_list; |
| 140 | struct mutex device_list_lock; /* protects video_device_list */ | ||
| 140 | struct proc_dir_entry *dir; | 141 | struct proc_dir_entry *dir; |
| 141 | struct input_dev *input; | 142 | struct input_dev *input; |
| 142 | char phys[32]; /* for input device */ | 143 | char phys[32]; /* for input device */ |
| @@ -896,7 +897,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
| 896 | { | 897 | { |
| 897 | struct seq_file *m = file->private_data; | 898 | struct seq_file *m = file->private_data; |
| 898 | struct acpi_video_device *dev = m->private; | 899 | struct acpi_video_device *dev = m->private; |
| 899 | char str[4] = { 0 }; | 900 | char str[5] = { 0 }; |
| 900 | unsigned int level = 0; | 901 | unsigned int level = 0; |
| 901 | int i; | 902 | int i; |
| 902 | 903 | ||
| @@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
| 1436 | return -ENODEV; | 1437 | return -ENODEV; |
| 1437 | } | 1438 | } |
| 1438 | 1439 | ||
| 1439 | down(&video->sem); | 1440 | mutex_lock(&video->device_list_lock); |
| 1440 | list_add_tail(&data->entry, &video->video_device_list); | 1441 | list_add_tail(&data->entry, &video->video_device_list); |
| 1441 | up(&video->sem); | 1442 | mutex_unlock(&video->device_list_lock); |
| 1442 | 1443 | ||
| 1443 | acpi_video_device_add_fs(device); | 1444 | acpi_video_device_add_fs(device); |
| 1444 | 1445 | ||
| @@ -1462,12 +1463,14 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
| 1462 | 1463 | ||
| 1463 | static void acpi_video_device_rebind(struct acpi_video_bus *video) | 1464 | static void acpi_video_device_rebind(struct acpi_video_bus *video) |
| 1464 | { | 1465 | { |
| 1465 | struct list_head *node, *next; | 1466 | struct acpi_video_device *dev; |
| 1466 | list_for_each_safe(node, next, &video->video_device_list) { | 1467 | |
| 1467 | struct acpi_video_device *dev = | 1468 | mutex_lock(&video->device_list_lock); |
| 1468 | container_of(node, struct acpi_video_device, entry); | 1469 | |
| 1470 | list_for_each_entry(dev, &video->video_device_list, entry) | ||
| 1469 | acpi_video_device_bind(video, dev); | 1471 | acpi_video_device_bind(video, dev); |
| 1470 | } | 1472 | |
| 1473 | mutex_unlock(&video->device_list_lock); | ||
| 1471 | } | 1474 | } |
| 1472 | 1475 | ||
| 1473 | /* | 1476 | /* |
| @@ -1592,30 +1595,33 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
| 1592 | 1595 | ||
| 1593 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) | 1596 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) |
| 1594 | { | 1597 | { |
| 1595 | struct list_head *node, *next; | 1598 | struct list_head *node; |
| 1596 | struct acpi_video_device *dev = NULL; | 1599 | struct acpi_video_device *dev = NULL; |
| 1597 | struct acpi_video_device *dev_next = NULL; | 1600 | struct acpi_video_device *dev_next = NULL; |
| 1598 | struct acpi_video_device *dev_prev = NULL; | 1601 | struct acpi_video_device *dev_prev = NULL; |
| 1599 | unsigned long state; | 1602 | unsigned long state; |
| 1600 | int status = 0; | 1603 | int status = 0; |
| 1601 | 1604 | ||
| 1605 | mutex_lock(&video->device_list_lock); | ||
| 1602 | 1606 | ||
| 1603 | list_for_each_safe(node, next, &video->video_device_list) { | 1607 | list_for_each(node, &video->video_device_list) { |
| 1604 | dev = container_of(node, struct acpi_video_device, entry); | 1608 | dev = container_of(node, struct acpi_video_device, entry); |
| 1605 | status = acpi_video_device_get_state(dev, &state); | 1609 | status = acpi_video_device_get_state(dev, &state); |
| 1606 | if (state & 0x2) { | 1610 | if (state & 0x2) { |
| 1607 | dev_next = | 1611 | dev_next = container_of(node->next, |
| 1608 | container_of(node->next, struct acpi_video_device, | 1612 | struct acpi_video_device, entry); |
| 1609 | entry); | 1613 | dev_prev = container_of(node->prev, |
| 1610 | dev_prev = | 1614 | struct acpi_video_device, entry); |
| 1611 | container_of(node->prev, struct acpi_video_device, | ||
| 1612 | entry); | ||
| 1613 | goto out; | 1615 | goto out; |
| 1614 | } | 1616 | } |
| 1615 | } | 1617 | } |
| 1618 | |||
| 1616 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1619 | dev_next = container_of(node->next, struct acpi_video_device, entry); |
| 1617 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); | 1620 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); |
| 1618 | out: | 1621 | |
| 1622 | out: | ||
| 1623 | mutex_unlock(&video->device_list_lock); | ||
| 1624 | |||
| 1619 | switch (event) { | 1625 | switch (event) { |
| 1620 | case ACPI_VIDEO_NOTIFY_CYCLE: | 1626 | case ACPI_VIDEO_NOTIFY_CYCLE: |
| 1621 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: | 1627 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: |
| @@ -1691,24 +1697,17 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
| 1691 | struct acpi_device *device) | 1697 | struct acpi_device *device) |
| 1692 | { | 1698 | { |
| 1693 | int status = 0; | 1699 | int status = 0; |
| 1694 | struct list_head *node, *next; | 1700 | struct acpi_device *dev; |
| 1695 | |||
| 1696 | 1701 | ||
| 1697 | acpi_video_device_enumerate(video); | 1702 | acpi_video_device_enumerate(video); |
| 1698 | 1703 | ||
| 1699 | list_for_each_safe(node, next, &device->children) { | 1704 | list_for_each_entry(dev, &device->children, node) { |
| 1700 | struct acpi_device *dev = | ||
| 1701 | list_entry(node, struct acpi_device, node); | ||
| 1702 | |||
| 1703 | if (!dev) | ||
| 1704 | continue; | ||
| 1705 | 1705 | ||
| 1706 | status = acpi_video_bus_get_one_device(dev, video); | 1706 | status = acpi_video_bus_get_one_device(dev, video); |
| 1707 | if (ACPI_FAILURE(status)) { | 1707 | if (ACPI_FAILURE(status)) { |
| 1708 | ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); | 1708 | ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); |
| 1709 | continue; | 1709 | continue; |
| 1710 | } | 1710 | } |
| 1711 | |||
| 1712 | } | 1711 | } |
| 1713 | return status; | 1712 | return status; |
| 1714 | } | 1713 | } |
| @@ -1724,9 +1723,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
| 1724 | 1723 | ||
| 1725 | video = device->video; | 1724 | video = device->video; |
| 1726 | 1725 | ||
| 1727 | down(&video->sem); | ||
| 1728 | list_del(&device->entry); | ||
| 1729 | up(&video->sem); | ||
| 1730 | acpi_video_device_remove_fs(device->dev); | 1726 | acpi_video_device_remove_fs(device->dev); |
| 1731 | 1727 | ||
| 1732 | status = acpi_remove_notify_handler(device->dev->handle, | 1728 | status = acpi_remove_notify_handler(device->dev->handle, |
| @@ -1734,32 +1730,34 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
| 1734 | acpi_video_device_notify); | 1730 | acpi_video_device_notify); |
| 1735 | backlight_device_unregister(device->backlight); | 1731 | backlight_device_unregister(device->backlight); |
| 1736 | video_output_unregister(device->output_dev); | 1732 | video_output_unregister(device->output_dev); |
| 1733 | |||
| 1737 | return 0; | 1734 | return 0; |
| 1738 | } | 1735 | } |
| 1739 | 1736 | ||
| 1740 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | 1737 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) |
| 1741 | { | 1738 | { |
| 1742 | int status; | 1739 | int status; |
| 1743 | struct list_head *node, *next; | 1740 | struct acpi_video_device *dev, *next; |
| 1744 | 1741 | ||
| 1742 | mutex_lock(&video->device_list_lock); | ||
| 1745 | 1743 | ||
| 1746 | list_for_each_safe(node, next, &video->video_device_list) { | 1744 | list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { |
| 1747 | struct acpi_video_device *data = | ||
| 1748 | list_entry(node, struct acpi_video_device, entry); | ||
| 1749 | if (!data) | ||
| 1750 | continue; | ||
| 1751 | 1745 | ||
| 1752 | status = acpi_video_bus_put_one_device(data); | 1746 | status = acpi_video_bus_put_one_device(dev); |
| 1753 | if (ACPI_FAILURE(status)) | 1747 | if (ACPI_FAILURE(status)) |
| 1754 | printk(KERN_WARNING PREFIX | 1748 | printk(KERN_WARNING PREFIX |
| 1755 | "hhuuhhuu bug in acpi video driver.\n"); | 1749 | "hhuuhhuu bug in acpi video driver.\n"); |
| 1756 | 1750 | ||
| 1757 | if (data->brightness) | 1751 | if (dev->brightness) { |
| 1758 | kfree(data->brightness->levels); | 1752 | kfree(dev->brightness->levels); |
| 1759 | kfree(data->brightness); | 1753 | kfree(dev->brightness); |
| 1760 | kfree(data); | 1754 | } |
| 1755 | list_del(&dev->entry); | ||
| 1756 | kfree(dev); | ||
| 1761 | } | 1757 | } |
| 1762 | 1758 | ||
| 1759 | mutex_unlock(&video->device_list_lock); | ||
| 1760 | |||
| 1763 | return 0; | 1761 | return 0; |
| 1764 | } | 1762 | } |
| 1765 | 1763 | ||
| @@ -1782,9 +1780,6 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
| 1782 | struct input_dev *input; | 1780 | struct input_dev *input; |
| 1783 | int keycode; | 1781 | int keycode; |
| 1784 | 1782 | ||
| 1785 | |||
| 1786 | printk("video bus notify\n"); | ||
| 1787 | |||
| 1788 | if (!video) | 1783 | if (!video) |
| 1789 | return; | 1784 | return; |
| 1790 | 1785 | ||
| @@ -1897,14 +1892,10 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 1897 | static int instance; | 1892 | static int instance; |
| 1898 | static int acpi_video_bus_add(struct acpi_device *device) | 1893 | static int acpi_video_bus_add(struct acpi_device *device) |
| 1899 | { | 1894 | { |
| 1900 | int result = 0; | 1895 | acpi_status status; |
| 1901 | acpi_status status = 0; | 1896 | struct acpi_video_bus *video; |
| 1902 | struct acpi_video_bus *video = NULL; | ||
| 1903 | struct input_dev *input; | 1897 | struct input_dev *input; |
| 1904 | 1898 | int error; | |
| 1905 | |||
| 1906 | if (!device) | ||
| 1907 | return -EINVAL; | ||
| 1908 | 1899 | ||
| 1909 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 1900 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
| 1910 | if (!video) | 1901 | if (!video) |
| @@ -1923,15 +1914,15 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1923 | acpi_driver_data(device) = video; | 1914 | acpi_driver_data(device) = video; |
| 1924 | 1915 | ||
| 1925 | acpi_video_bus_find_cap(video); | 1916 | acpi_video_bus_find_cap(video); |
| 1926 | result = acpi_video_bus_check(video); | 1917 | error = acpi_video_bus_check(video); |
| 1927 | if (result) | 1918 | if (error) |
| 1928 | goto end; | 1919 | goto err_free_video; |
| 1929 | 1920 | ||
| 1930 | result = acpi_video_bus_add_fs(device); | 1921 | error = acpi_video_bus_add_fs(device); |
| 1931 | if (result) | 1922 | if (error) |
| 1932 | goto end; | 1923 | goto err_free_video; |
| 1933 | 1924 | ||
| 1934 | init_MUTEX(&video->sem); | 1925 | mutex_init(&video->device_list_lock); |
| 1935 | INIT_LIST_HEAD(&video->video_device_list); | 1926 | INIT_LIST_HEAD(&video->video_device_list); |
| 1936 | 1927 | ||
| 1937 | acpi_video_bus_get_devices(video, device); | 1928 | acpi_video_bus_get_devices(video, device); |
| @@ -1943,16 +1934,15 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1943 | if (ACPI_FAILURE(status)) { | 1934 | if (ACPI_FAILURE(status)) { |
| 1944 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1935 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 1945 | "Error installing notify handler\n")); | 1936 | "Error installing notify handler\n")); |
| 1946 | acpi_video_bus_stop_devices(video); | 1937 | error = -ENODEV; |
| 1947 | acpi_video_bus_put_devices(video); | 1938 | goto err_stop_video; |
| 1948 | kfree(video->attached_array); | ||
| 1949 | acpi_video_bus_remove_fs(device); | ||
| 1950 | result = -ENODEV; | ||
| 1951 | goto end; | ||
| 1952 | } | 1939 | } |
| 1953 | 1940 | ||
| 1954 | |||
| 1955 | video->input = input = input_allocate_device(); | 1941 | video->input = input = input_allocate_device(); |
| 1942 | if (!input) { | ||
| 1943 | error = -ENOMEM; | ||
| 1944 | goto err_uninstall_notify; | ||
| 1945 | } | ||
| 1956 | 1946 | ||
| 1957 | snprintf(video->phys, sizeof(video->phys), | 1947 | snprintf(video->phys, sizeof(video->phys), |
| 1958 | "%s/video/input0", acpi_device_hid(video->device)); | 1948 | "%s/video/input0", acpi_device_hid(video->device)); |
| @@ -1961,6 +1951,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1961 | input->phys = video->phys; | 1951 | input->phys = video->phys; |
| 1962 | input->id.bustype = BUS_HOST; | 1952 | input->id.bustype = BUS_HOST; |
| 1963 | input->id.product = 0x06; | 1953 | input->id.product = 0x06; |
| 1954 | input->dev.parent = &device->dev; | ||
| 1964 | input->evbit[0] = BIT(EV_KEY); | 1955 | input->evbit[0] = BIT(EV_KEY); |
| 1965 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); | 1956 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); |
| 1966 | set_bit(KEY_VIDEO_NEXT, input->keybit); | 1957 | set_bit(KEY_VIDEO_NEXT, input->keybit); |
| @@ -1971,18 +1962,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1971 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 1962 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
| 1972 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 1963 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
| 1973 | set_bit(KEY_UNKNOWN, input->keybit); | 1964 | set_bit(KEY_UNKNOWN, input->keybit); |
| 1974 | result = input_register_device(input); | ||
| 1975 | if (result) { | ||
| 1976 | acpi_remove_notify_handler(video->device->handle, | ||
| 1977 | ACPI_DEVICE_NOTIFY, | ||
| 1978 | acpi_video_bus_notify); | ||
| 1979 | acpi_video_bus_stop_devices(video); | ||
| 1980 | acpi_video_bus_put_devices(video); | ||
| 1981 | kfree(video->attached_array); | ||
| 1982 | acpi_video_bus_remove_fs(device); | ||
| 1983 | goto end; | ||
| 1984 | } | ||
| 1985 | 1965 | ||
| 1966 | error = input_register_device(input); | ||
| 1967 | if (error) | ||
| 1968 | goto err_free_input_dev; | ||
| 1986 | 1969 | ||
| 1987 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1970 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
| 1988 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1971 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
| @@ -1990,11 +1973,23 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
| 1990 | video->flags.rom ? "yes" : "no", | 1973 | video->flags.rom ? "yes" : "no", |
| 1991 | video->flags.post ? "yes" : "no"); | 1974 | video->flags.post ? "yes" : "no"); |
| 1992 | 1975 | ||
| 1993 | end: | 1976 | return 0; |
| 1994 | if (result) | 1977 | |
| 1995 | kfree(video); | 1978 | err_free_input_dev: |
| 1979 | input_free_device(input); | ||
| 1980 | err_uninstall_notify: | ||
| 1981 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
| 1982 | acpi_video_bus_notify); | ||
| 1983 | err_stop_video: | ||
| 1984 | acpi_video_bus_stop_devices(video); | ||
| 1985 | acpi_video_bus_put_devices(video); | ||
| 1986 | kfree(video->attached_array); | ||
| 1987 | acpi_video_bus_remove_fs(device); | ||
| 1988 | err_free_video: | ||
| 1989 | kfree(video); | ||
| 1990 | acpi_driver_data(device) = NULL; | ||
| 1996 | 1991 | ||
| 1997 | return result; | 1992 | return error; |
| 1998 | } | 1993 | } |
| 1999 | 1994 | ||
| 2000 | static int acpi_video_bus_remove(struct acpi_device *device, int type) | 1995 | static int acpi_video_bus_remove(struct acpi_device *device, int type) |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 4bd33ce8a6f3..1bba99747f5b 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
| @@ -37,17 +37,17 @@ | |||
| 37 | #define DEF_FREQUENCY_UP_THRESHOLD (80) | 37 | #define DEF_FREQUENCY_UP_THRESHOLD (80) |
| 38 | #define DEF_FREQUENCY_DOWN_THRESHOLD (20) | 38 | #define DEF_FREQUENCY_DOWN_THRESHOLD (20) |
| 39 | 39 | ||
| 40 | /* | 40 | /* |
| 41 | * The polling frequency of this governor depends on the capability of | 41 | * The polling frequency of this governor depends on the capability of |
| 42 | * the processor. Default polling frequency is 1000 times the transition | 42 | * the processor. Default polling frequency is 1000 times the transition |
| 43 | * latency of the processor. The governor will work on any processor with | 43 | * latency of the processor. The governor will work on any processor with |
| 44 | * transition latency <= 10mS, using appropriate sampling | 44 | * transition latency <= 10mS, using appropriate sampling |
| 45 | * rate. | 45 | * rate. |
| 46 | * For CPUs with transition latency > 10mS (mostly drivers | 46 | * For CPUs with transition latency > 10mS (mostly drivers |
| 47 | * with CPUFREQ_ETERNAL), this governor will not work. | 47 | * with CPUFREQ_ETERNAL), this governor will not work. |
| 48 | * All times here are in uS. | 48 | * All times here are in uS. |
| 49 | */ | 49 | */ |
| 50 | static unsigned int def_sampling_rate; | 50 | static unsigned int def_sampling_rate; |
| 51 | #define MIN_SAMPLING_RATE_RATIO (2) | 51 | #define MIN_SAMPLING_RATE_RATIO (2) |
| 52 | /* for correct statistics, we need at least 10 ticks between each measure */ | 52 | /* for correct statistics, we need at least 10 ticks between each measure */ |
| 53 | #define MIN_STAT_SAMPLING_RATE \ | 53 | #define MIN_STAT_SAMPLING_RATE \ |
| @@ -63,12 +63,12 @@ static unsigned int def_sampling_rate; | |||
| 63 | static void do_dbs_timer(struct work_struct *work); | 63 | static void do_dbs_timer(struct work_struct *work); |
| 64 | 64 | ||
| 65 | struct cpu_dbs_info_s { | 65 | struct cpu_dbs_info_s { |
| 66 | struct cpufreq_policy *cur_policy; | 66 | struct cpufreq_policy *cur_policy; |
| 67 | unsigned int prev_cpu_idle_up; | 67 | unsigned int prev_cpu_idle_up; |
| 68 | unsigned int prev_cpu_idle_down; | 68 | unsigned int prev_cpu_idle_down; |
| 69 | unsigned int enable; | 69 | unsigned int enable; |
| 70 | unsigned int down_skip; | 70 | unsigned int down_skip; |
| 71 | unsigned int requested_freq; | 71 | unsigned int requested_freq; |
| 72 | }; | 72 | }; |
| 73 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 73 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
| 74 | 74 | ||
| @@ -82,24 +82,24 @@ static unsigned int dbs_enable; /* number of CPUs using this policy */ | |||
| 82 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | 82 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock |
| 83 | * is recursive for the same process. -Venki | 83 | * is recursive for the same process. -Venki |
| 84 | */ | 84 | */ |
| 85 | static DEFINE_MUTEX (dbs_mutex); | 85 | static DEFINE_MUTEX (dbs_mutex); |
| 86 | static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer); | 86 | static DECLARE_DELAYED_WORK(dbs_work, do_dbs_timer); |
| 87 | 87 | ||
| 88 | struct dbs_tuners { | 88 | struct dbs_tuners { |
| 89 | unsigned int sampling_rate; | 89 | unsigned int sampling_rate; |
| 90 | unsigned int sampling_down_factor; | 90 | unsigned int sampling_down_factor; |
| 91 | unsigned int up_threshold; | 91 | unsigned int up_threshold; |
| 92 | unsigned int down_threshold; | 92 | unsigned int down_threshold; |
| 93 | unsigned int ignore_nice; | 93 | unsigned int ignore_nice; |
| 94 | unsigned int freq_step; | 94 | unsigned int freq_step; |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | static struct dbs_tuners dbs_tuners_ins = { | 97 | static struct dbs_tuners dbs_tuners_ins = { |
| 98 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, | 98 | .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, |
| 99 | .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, | 99 | .down_threshold = DEF_FREQUENCY_DOWN_THRESHOLD, |
| 100 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, | 100 | .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, |
| 101 | .ignore_nice = 0, | 101 | .ignore_nice = 0, |
| 102 | .freq_step = 5, | 102 | .freq_step = 5, |
| 103 | }; | 103 | }; |
| 104 | 104 | ||
| 105 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) | 105 | static inline unsigned int get_cpu_idle_time(unsigned int cpu) |
| @@ -109,13 +109,34 @@ static inline unsigned int get_cpu_idle_time(unsigned int cpu) | |||
| 109 | if (dbs_tuners_ins.ignore_nice) | 109 | if (dbs_tuners_ins.ignore_nice) |
| 110 | add_nice = kstat_cpu(cpu).cpustat.nice; | 110 | add_nice = kstat_cpu(cpu).cpustat.nice; |
| 111 | 111 | ||
| 112 | ret = kstat_cpu(cpu).cpustat.idle + | 112 | ret = kstat_cpu(cpu).cpustat.idle + |
| 113 | kstat_cpu(cpu).cpustat.iowait + | 113 | kstat_cpu(cpu).cpustat.iowait + |
| 114 | add_nice; | 114 | add_nice; |
| 115 | 115 | ||
| 116 | return ret; | 116 | return ret; |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | /* keep track of frequency transitions */ | ||
| 120 | static int | ||
| 121 | dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | ||
| 122 | void *data) | ||
| 123 | { | ||
| 124 | struct cpufreq_freqs *freq = data; | ||
| 125 | struct cpu_dbs_info_s *this_dbs_info = &per_cpu(cpu_dbs_info, | ||
| 126 | freq->cpu); | ||
| 127 | |||
| 128 | if (!this_dbs_info->enable) | ||
| 129 | return 0; | ||
| 130 | |||
| 131 | this_dbs_info->requested_freq = freq->new; | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | static struct notifier_block dbs_cpufreq_notifier_block = { | ||
| 137 | .notifier_call = dbs_cpufreq_notifier | ||
| 138 | }; | ||
| 139 | |||
| 119 | /************************** sysfs interface ************************/ | 140 | /************************** sysfs interface ************************/ |
| 120 | static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) | 141 | static ssize_t show_sampling_rate_max(struct cpufreq_policy *policy, char *buf) |
| 121 | { | 142 | { |
| @@ -127,8 +148,8 @@ static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf) | |||
| 127 | return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); | 148 | return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); |
| 128 | } | 149 | } |
| 129 | 150 | ||
| 130 | #define define_one_ro(_name) \ | 151 | #define define_one_ro(_name) \ |
| 131 | static struct freq_attr _name = \ | 152 | static struct freq_attr _name = \ |
| 132 | __ATTR(_name, 0444, show_##_name, NULL) | 153 | __ATTR(_name, 0444, show_##_name, NULL) |
| 133 | 154 | ||
| 134 | define_one_ro(sampling_rate_max); | 155 | define_one_ro(sampling_rate_max); |
| @@ -148,7 +169,7 @@ show_one(down_threshold, down_threshold); | |||
| 148 | show_one(ignore_nice_load, ignore_nice); | 169 | show_one(ignore_nice_load, ignore_nice); |
| 149 | show_one(freq_step, freq_step); | 170 | show_one(freq_step, freq_step); |
| 150 | 171 | ||
| 151 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | 172 | static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, |
| 152 | const char *buf, size_t count) | 173 | const char *buf, size_t count) |
| 153 | { | 174 | { |
| 154 | unsigned int input; | 175 | unsigned int input; |
| @@ -164,7 +185,7 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, | |||
| 164 | return count; | 185 | return count; |
| 165 | } | 186 | } |
| 166 | 187 | ||
| 167 | static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | 188 | static ssize_t store_sampling_rate(struct cpufreq_policy *unused, |
| 168 | const char *buf, size_t count) | 189 | const char *buf, size_t count) |
| 169 | { | 190 | { |
| 170 | unsigned int input; | 191 | unsigned int input; |
| @@ -183,7 +204,7 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
| 183 | return count; | 204 | return count; |
| 184 | } | 205 | } |
| 185 | 206 | ||
| 186 | static ssize_t store_up_threshold(struct cpufreq_policy *unused, | 207 | static ssize_t store_up_threshold(struct cpufreq_policy *unused, |
| 187 | const char *buf, size_t count) | 208 | const char *buf, size_t count) |
| 188 | { | 209 | { |
| 189 | unsigned int input; | 210 | unsigned int input; |
| @@ -202,7 +223,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
| 202 | return count; | 223 | return count; |
| 203 | } | 224 | } |
| 204 | 225 | ||
| 205 | static ssize_t store_down_threshold(struct cpufreq_policy *unused, | 226 | static ssize_t store_down_threshold(struct cpufreq_policy *unused, |
| 206 | const char *buf, size_t count) | 227 | const char *buf, size_t count) |
| 207 | { | 228 | { |
| 208 | unsigned int input; | 229 | unsigned int input; |
| @@ -228,16 +249,16 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy, | |||
| 228 | int ret; | 249 | int ret; |
| 229 | 250 | ||
| 230 | unsigned int j; | 251 | unsigned int j; |
| 231 | 252 | ||
| 232 | ret = sscanf (buf, "%u", &input); | 253 | ret = sscanf(buf, "%u", &input); |
| 233 | if ( ret != 1 ) | 254 | if (ret != 1) |
| 234 | return -EINVAL; | 255 | return -EINVAL; |
| 235 | 256 | ||
| 236 | if ( input > 1 ) | 257 | if (input > 1) |
| 237 | input = 1; | 258 | input = 1; |
| 238 | 259 | ||
| 239 | mutex_lock(&dbs_mutex); | 260 | mutex_lock(&dbs_mutex); |
| 240 | if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ | 261 | if (input == dbs_tuners_ins.ignore_nice) { /* nothing to do */ |
| 241 | mutex_unlock(&dbs_mutex); | 262 | mutex_unlock(&dbs_mutex); |
| 242 | return count; | 263 | return count; |
| 243 | } | 264 | } |
| @@ -261,14 +282,14 @@ static ssize_t store_freq_step(struct cpufreq_policy *policy, | |||
| 261 | unsigned int input; | 282 | unsigned int input; |
| 262 | int ret; | 283 | int ret; |
| 263 | 284 | ||
| 264 | ret = sscanf (buf, "%u", &input); | 285 | ret = sscanf(buf, "%u", &input); |
| 265 | 286 | ||
| 266 | if ( ret != 1 ) | 287 | if (ret != 1) |
| 267 | return -EINVAL; | 288 | return -EINVAL; |
| 268 | 289 | ||
| 269 | if ( input > 100 ) | 290 | if (input > 100) |
| 270 | input = 100; | 291 | input = 100; |
| 271 | 292 | ||
| 272 | /* no need to test here if freq_step is zero as the user might actually | 293 | /* no need to test here if freq_step is zero as the user might actually |
| 273 | * want this, they would be crazy though :) */ | 294 | * want this, they would be crazy though :) */ |
| 274 | mutex_lock(&dbs_mutex); | 295 | mutex_lock(&dbs_mutex); |
| @@ -322,18 +343,18 @@ static void dbs_check_cpu(int cpu) | |||
| 322 | 343 | ||
| 323 | policy = this_dbs_info->cur_policy; | 344 | policy = this_dbs_info->cur_policy; |
| 324 | 345 | ||
| 325 | /* | 346 | /* |
| 326 | * The default safe range is 20% to 80% | 347 | * The default safe range is 20% to 80% |
| 327 | * Every sampling_rate, we check | 348 | * Every sampling_rate, we check |
| 328 | * - If current idle time is less than 20%, then we try to | 349 | * - If current idle time is less than 20%, then we try to |
| 329 | * increase frequency | 350 | * increase frequency |
| 330 | * Every sampling_rate*sampling_down_factor, we check | 351 | * Every sampling_rate*sampling_down_factor, we check |
| 331 | * - If current idle time is more than 80%, then we try to | 352 | * - If current idle time is more than 80%, then we try to |
| 332 | * decrease frequency | 353 | * decrease frequency |
| 333 | * | 354 | * |
| 334 | * Any frequency increase takes it to the maximum frequency. | 355 | * Any frequency increase takes it to the maximum frequency. |
| 335 | * Frequency reduction happens at minimum steps of | 356 | * Frequency reduction happens at minimum steps of |
| 336 | * 5% (default) of max_frequency | 357 | * 5% (default) of max_frequency |
| 337 | */ | 358 | */ |
| 338 | 359 | ||
| 339 | /* Check for frequency increase */ | 360 | /* Check for frequency increase */ |
| @@ -361,13 +382,13 @@ static void dbs_check_cpu(int cpu) | |||
| 361 | /* if we are already at full speed then break out early */ | 382 | /* if we are already at full speed then break out early */ |
| 362 | if (this_dbs_info->requested_freq == policy->max) | 383 | if (this_dbs_info->requested_freq == policy->max) |
| 363 | return; | 384 | return; |
| 364 | 385 | ||
| 365 | freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; | 386 | freq_step = (dbs_tuners_ins.freq_step * policy->max) / 100; |
| 366 | 387 | ||
| 367 | /* max freq cannot be less than 100. But who knows.... */ | 388 | /* max freq cannot be less than 100. But who knows.... */ |
| 368 | if (unlikely(freq_step == 0)) | 389 | if (unlikely(freq_step == 0)) |
| 369 | freq_step = 5; | 390 | freq_step = 5; |
| 370 | 391 | ||
| 371 | this_dbs_info->requested_freq += freq_step; | 392 | this_dbs_info->requested_freq += freq_step; |
| 372 | if (this_dbs_info->requested_freq > policy->max) | 393 | if (this_dbs_info->requested_freq > policy->max) |
| 373 | this_dbs_info->requested_freq = policy->max; | 394 | this_dbs_info->requested_freq = policy->max; |
| @@ -427,15 +448,15 @@ static void dbs_check_cpu(int cpu) | |||
| 427 | } | 448 | } |
| 428 | 449 | ||
| 429 | static void do_dbs_timer(struct work_struct *work) | 450 | static void do_dbs_timer(struct work_struct *work) |
| 430 | { | 451 | { |
| 431 | int i; | 452 | int i; |
| 432 | mutex_lock(&dbs_mutex); | 453 | mutex_lock(&dbs_mutex); |
| 433 | for_each_online_cpu(i) | 454 | for_each_online_cpu(i) |
| 434 | dbs_check_cpu(i); | 455 | dbs_check_cpu(i); |
| 435 | schedule_delayed_work(&dbs_work, | 456 | schedule_delayed_work(&dbs_work, |
| 436 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | 457 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); |
| 437 | mutex_unlock(&dbs_mutex); | 458 | mutex_unlock(&dbs_mutex); |
| 438 | } | 459 | } |
| 439 | 460 | ||
| 440 | static inline void dbs_timer_init(void) | 461 | static inline void dbs_timer_init(void) |
| 441 | { | 462 | { |
| @@ -462,13 +483,12 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 462 | 483 | ||
| 463 | switch (event) { | 484 | switch (event) { |
| 464 | case CPUFREQ_GOV_START: | 485 | case CPUFREQ_GOV_START: |
| 465 | if ((!cpu_online(cpu)) || | 486 | if ((!cpu_online(cpu)) || (!policy->cur)) |
| 466 | (!policy->cur)) | ||
| 467 | return -EINVAL; | 487 | return -EINVAL; |
| 468 | 488 | ||
| 469 | if (this_dbs_info->enable) /* Already enabled */ | 489 | if (this_dbs_info->enable) /* Already enabled */ |
| 470 | break; | 490 | break; |
| 471 | 491 | ||
| 472 | mutex_lock(&dbs_mutex); | 492 | mutex_lock(&dbs_mutex); |
| 473 | 493 | ||
| 474 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | 494 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); |
| @@ -481,7 +501,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 481 | struct cpu_dbs_info_s *j_dbs_info; | 501 | struct cpu_dbs_info_s *j_dbs_info; |
| 482 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 502 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
| 483 | j_dbs_info->cur_policy = policy; | 503 | j_dbs_info->cur_policy = policy; |
| 484 | 504 | ||
| 485 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu); | 505 | j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(cpu); |
| 486 | j_dbs_info->prev_cpu_idle_down | 506 | j_dbs_info->prev_cpu_idle_down |
| 487 | = j_dbs_info->prev_cpu_idle_up; | 507 | = j_dbs_info->prev_cpu_idle_up; |
| @@ -511,8 +531,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 511 | dbs_tuners_ins.sampling_rate = def_sampling_rate; | 531 | dbs_tuners_ins.sampling_rate = def_sampling_rate; |
| 512 | 532 | ||
| 513 | dbs_timer_init(); | 533 | dbs_timer_init(); |
| 534 | cpufreq_register_notifier( | ||
| 535 | &dbs_cpufreq_notifier_block, | ||
| 536 | CPUFREQ_TRANSITION_NOTIFIER); | ||
| 514 | } | 537 | } |
| 515 | 538 | ||
| 516 | mutex_unlock(&dbs_mutex); | 539 | mutex_unlock(&dbs_mutex); |
| 517 | break; | 540 | break; |
| 518 | 541 | ||
| @@ -525,9 +548,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 525 | * Stop the timerschedule work, when this governor | 548 | * Stop the timerschedule work, when this governor |
| 526 | * is used for first time | 549 | * is used for first time |
| 527 | */ | 550 | */ |
| 528 | if (dbs_enable == 0) | 551 | if (dbs_enable == 0) { |
| 529 | dbs_timer_exit(); | 552 | dbs_timer_exit(); |
| 530 | 553 | cpufreq_unregister_notifier( | |
| 554 | &dbs_cpufreq_notifier_block, | ||
| 555 | CPUFREQ_TRANSITION_NOTIFIER); | ||
| 556 | } | ||
| 557 | |||
| 531 | mutex_unlock(&dbs_mutex); | 558 | mutex_unlock(&dbs_mutex); |
| 532 | 559 | ||
| 533 | break; | 560 | break; |
| @@ -537,11 +564,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 537 | if (policy->max < this_dbs_info->cur_policy->cur) | 564 | if (policy->max < this_dbs_info->cur_policy->cur) |
| 538 | __cpufreq_driver_target( | 565 | __cpufreq_driver_target( |
| 539 | this_dbs_info->cur_policy, | 566 | this_dbs_info->cur_policy, |
| 540 | policy->max, CPUFREQ_RELATION_H); | 567 | policy->max, CPUFREQ_RELATION_H); |
| 541 | else if (policy->min > this_dbs_info->cur_policy->cur) | 568 | else if (policy->min > this_dbs_info->cur_policy->cur) |
| 542 | __cpufreq_driver_target( | 569 | __cpufreq_driver_target( |
| 543 | this_dbs_info->cur_policy, | 570 | this_dbs_info->cur_policy, |
| 544 | policy->min, CPUFREQ_RELATION_L); | 571 | policy->min, CPUFREQ_RELATION_L); |
| 545 | mutex_unlock(&dbs_mutex); | 572 | mutex_unlock(&dbs_mutex); |
| 546 | break; | 573 | break; |
| 547 | } | 574 | } |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index e953276664a0..ab23a3221585 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
| 22 | */ | 22 | */ |
| 23 | 23 | ||
| 24 | #define IBM_VERSION "0.16" | 24 | #define IBM_VERSION "0.17" |
| 25 | #define TPACPI_SYSFS_VERSION 0x020000 | 25 | #define TPACPI_SYSFS_VERSION 0x020000 |
| 26 | 26 | ||
| 27 | /* | 27 | /* |
| @@ -964,15 +964,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 964 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ | 964 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ |
| 965 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ | 965 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ |
| 966 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ | 966 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ |
| 967 | KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ | 967 | KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ |
| 968 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ | 968 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ |
| 969 | KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ | 969 | KEY_RESERVED, /* 0x10: FN+END (brightness down) */ |
| 970 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ | 970 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ |
| 971 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ | 971 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ |
| 972 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ | 972 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ |
| 973 | KEY_VOLUMEUP, /* 0x14: VOLUME UP */ | 973 | KEY_RESERVED, /* 0x14: VOLUME UP */ |
| 974 | KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ | 974 | KEY_RESERVED, /* 0x15: VOLUME DOWN */ |
| 975 | KEY_MUTE, /* 0x16: MUTE */ | 975 | KEY_RESERVED, /* 0x16: MUTE */ |
| 976 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ | 976 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ |
| 977 | /* (assignments unknown, please report if found) */ | 977 | /* (assignments unknown, please report if found) */ |
| 978 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, | 978 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, |
| @@ -993,9 +993,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
| 993 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ | 993 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ |
| 994 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ | 994 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ |
| 995 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ | 995 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ |
| 996 | KEY_VOLUMEUP, /* 0x14: VOLUME UP */ | 996 | KEY_RESERVED, /* 0x14: VOLUME UP */ |
| 997 | KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ | 997 | KEY_RESERVED, /* 0x15: VOLUME DOWN */ |
| 998 | KEY_MUTE, /* 0x16: MUTE */ | 998 | KEY_RESERVED, /* 0x16: MUTE */ |
| 999 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ | 999 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ |
| 1000 | /* (assignments unknown, please report if found) */ | 1000 | /* (assignments unknown, please report if found) */ |
| 1001 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, | 1001 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, |
| @@ -1342,9 +1342,8 @@ static int hotkey_read(char *p) | |||
| 1342 | return len; | 1342 | return len; |
| 1343 | } | 1343 | } |
| 1344 | 1344 | ||
| 1345 | res = mutex_lock_interruptible(&hotkey_mutex); | 1345 | if (mutex_lock_interruptible(&hotkey_mutex)) |
| 1346 | if (res < 0) | 1346 | return -ERESTARTSYS; |
| 1347 | return res; | ||
| 1348 | res = hotkey_get(&status, &mask); | 1347 | res = hotkey_get(&status, &mask); |
| 1349 | mutex_unlock(&hotkey_mutex); | 1348 | mutex_unlock(&hotkey_mutex); |
| 1350 | if (res) | 1349 | if (res) |
| @@ -1373,9 +1372,8 @@ static int hotkey_write(char *buf) | |||
| 1373 | if (!tp_features.hotkey) | 1372 | if (!tp_features.hotkey) |
| 1374 | return -ENODEV; | 1373 | return -ENODEV; |
| 1375 | 1374 | ||
| 1376 | res = mutex_lock_interruptible(&hotkey_mutex); | 1375 | if (mutex_lock_interruptible(&hotkey_mutex)) |
| 1377 | if (res < 0) | 1376 | return -ERESTARTSYS; |
| 1378 | return res; | ||
| 1379 | 1377 | ||
| 1380 | res = hotkey_get(&status, &mask); | 1378 | res = hotkey_get(&status, &mask); |
| 1381 | if (res) | 1379 | if (res) |
| @@ -3114,6 +3112,99 @@ static struct backlight_ops ibm_backlight_data = { | |||
| 3114 | 3112 | ||
| 3115 | static struct mutex brightness_mutex; | 3113 | static struct mutex brightness_mutex; |
| 3116 | 3114 | ||
| 3115 | static int __init tpacpi_query_bcll_levels(acpi_handle handle) | ||
| 3116 | { | ||
| 3117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
| 3118 | union acpi_object *obj; | ||
| 3119 | int rc; | ||
| 3120 | |||
| 3121 | if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) { | ||
| 3122 | obj = (union acpi_object *)buffer.pointer; | ||
| 3123 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { | ||
| 3124 | printk(IBM_ERR "Unknown BCLL data, " | ||
| 3125 | "please report this to %s\n", IBM_MAIL); | ||
| 3126 | rc = 0; | ||
| 3127 | } else { | ||
| 3128 | rc = obj->package.count; | ||
| 3129 | } | ||
| 3130 | } else { | ||
| 3131 | return 0; | ||
| 3132 | } | ||
| 3133 | |||
| 3134 | kfree(buffer.pointer); | ||
| 3135 | return rc; | ||
| 3136 | } | ||
| 3137 | |||
| 3138 | static acpi_status __init brightness_find_bcll(acpi_handle handle, u32 lvl, | ||
| 3139 | void *context, void **rv) | ||
| 3140 | { | ||
| 3141 | char name[ACPI_PATH_SEGMENT_LENGTH]; | ||
| 3142 | struct acpi_buffer buffer = { sizeof(name), &name }; | ||
| 3143 | |||
| 3144 | if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && | ||
| 3145 | !strncmp("BCLL", name, sizeof(name) - 1)) { | ||
| 3146 | if (tpacpi_query_bcll_levels(handle) == 16) { | ||
| 3147 | *rv = handle; | ||
| 3148 | return AE_CTRL_TERMINATE; | ||
| 3149 | } else { | ||
| 3150 | return AE_OK; | ||
| 3151 | } | ||
| 3152 | } else { | ||
| 3153 | return AE_OK; | ||
| 3154 | } | ||
| 3155 | } | ||
| 3156 | |||
| 3157 | static int __init brightness_check_levels(void) | ||
| 3158 | { | ||
| 3159 | int status; | ||
| 3160 | void *found_node = NULL; | ||
| 3161 | |||
| 3162 | if (!vid_handle) { | ||
| 3163 | IBM_ACPIHANDLE_INIT(vid); | ||
| 3164 | } | ||
| 3165 | if (!vid_handle) | ||
| 3166 | return 0; | ||
| 3167 | |||
| 3168 | /* Search for a BCLL package with 16 levels */ | ||
| 3169 | status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3, | ||
| 3170 | brightness_find_bcll, NULL, &found_node); | ||
| 3171 | |||
| 3172 | return (ACPI_SUCCESS(status) && found_node != NULL); | ||
| 3173 | } | ||
| 3174 | |||
| 3175 | static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl, | ||
| 3176 | void *context, void **rv) | ||
| 3177 | { | ||
| 3178 | char name[ACPI_PATH_SEGMENT_LENGTH]; | ||
| 3179 | struct acpi_buffer buffer = { sizeof(name), &name }; | ||
| 3180 | |||
| 3181 | if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && | ||
| 3182 | !strncmp("_BCL", name, sizeof(name) - 1)) { | ||
| 3183 | *rv = handle; | ||
| 3184 | return AE_CTRL_TERMINATE; | ||
| 3185 | } else { | ||
| 3186 | return AE_OK; | ||
| 3187 | } | ||
| 3188 | } | ||
| 3189 | |||
| 3190 | static int __init brightness_check_std_acpi_support(void) | ||
| 3191 | { | ||
| 3192 | int status; | ||
| 3193 | void *found_node = NULL; | ||
| 3194 | |||
| 3195 | if (!vid_handle) { | ||
| 3196 | IBM_ACPIHANDLE_INIT(vid); | ||
| 3197 | } | ||
| 3198 | if (!vid_handle) | ||
| 3199 | return 0; | ||
| 3200 | |||
| 3201 | /* Search for a _BCL method, but don't execute it */ | ||
| 3202 | status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, | ||
| 3203 | brightness_find_bcl, NULL, &found_node); | ||
| 3204 | |||
| 3205 | return (ACPI_SUCCESS(status) && found_node != NULL); | ||
| 3206 | } | ||
| 3207 | |||
| 3117 | static int __init brightness_init(struct ibm_init_struct *iibm) | 3208 | static int __init brightness_init(struct ibm_init_struct *iibm) |
| 3118 | { | 3209 | { |
| 3119 | int b; | 3210 | int b; |
| @@ -3122,6 +3213,18 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
| 3122 | 3213 | ||
| 3123 | mutex_init(&brightness_mutex); | 3214 | mutex_init(&brightness_mutex); |
| 3124 | 3215 | ||
| 3216 | if (!brightness_enable) { | ||
| 3217 | dbg_printk(TPACPI_DBG_INIT, | ||
| 3218 | "brightness support disabled by module parameter\n"); | ||
| 3219 | return 1; | ||
| 3220 | } else if (brightness_enable > 1) { | ||
| 3221 | if (brightness_check_std_acpi_support()) { | ||
| 3222 | printk(IBM_NOTICE | ||
| 3223 | "standard ACPI backlight interface available, not loading native one...\n"); | ||
| 3224 | return 1; | ||
| 3225 | } | ||
| 3226 | } | ||
| 3227 | |||
| 3125 | if (!brightness_mode) { | 3228 | if (!brightness_mode) { |
| 3126 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) | 3229 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) |
| 3127 | brightness_mode = 2; | 3230 | brightness_mode = 2; |
| @@ -3135,10 +3238,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
| 3135 | if (brightness_mode > 3) | 3238 | if (brightness_mode > 3) |
| 3136 | return -EINVAL; | 3239 | return -EINVAL; |
| 3137 | 3240 | ||
| 3241 | tp_features.bright_16levels = | ||
| 3242 | thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO && | ||
| 3243 | brightness_check_levels(); | ||
| 3244 | |||
| 3138 | b = brightness_get(NULL); | 3245 | b = brightness_get(NULL); |
| 3139 | if (b < 0) | 3246 | if (b < 0) |
| 3140 | return 1; | 3247 | return 1; |
| 3141 | 3248 | ||
| 3249 | if (tp_features.bright_16levels) | ||
| 3250 | printk(IBM_INFO "detected a 16-level brightness capable ThinkPad\n"); | ||
| 3251 | |||
| 3142 | ibm_backlight_device = backlight_device_register( | 3252 | ibm_backlight_device = backlight_device_register( |
| 3143 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, | 3253 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, |
| 3144 | &ibm_backlight_data); | 3254 | &ibm_backlight_data); |
| @@ -3148,7 +3258,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
| 3148 | } | 3258 | } |
| 3149 | vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); | 3259 | vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); |
| 3150 | 3260 | ||
| 3151 | ibm_backlight_device->props.max_brightness = 7; | 3261 | ibm_backlight_device->props.max_brightness = |
| 3262 | (tp_features.bright_16levels)? 15 : 7; | ||
| 3152 | ibm_backlight_device->props.brightness = b; | 3263 | ibm_backlight_device->props.brightness = b; |
| 3153 | backlight_update_status(ibm_backlight_device); | 3264 | backlight_update_status(ibm_backlight_device); |
| 3154 | 3265 | ||
| @@ -3167,6 +3278,8 @@ static void brightness_exit(void) | |||
| 3167 | 3278 | ||
| 3168 | static int brightness_update_status(struct backlight_device *bd) | 3279 | static int brightness_update_status(struct backlight_device *bd) |
| 3169 | { | 3280 | { |
| 3281 | /* it is the backlight class's job (caller) to handle | ||
| 3282 | * EINTR and other errors properly */ | ||
| 3170 | return brightness_set( | 3283 | return brightness_set( |
| 3171 | (bd->props.fb_blank == FB_BLANK_UNBLANK && | 3284 | (bd->props.fb_blank == FB_BLANK_UNBLANK && |
| 3172 | bd->props.power == FB_BLANK_UNBLANK) ? | 3285 | bd->props.power == FB_BLANK_UNBLANK) ? |
| @@ -3184,13 +3297,14 @@ static int brightness_get(struct backlight_device *bd) | |||
| 3184 | if (brightness_mode & 1) { | 3297 | if (brightness_mode & 1) { |
| 3185 | if (!acpi_ec_read(brightness_offset, &lec)) | 3298 | if (!acpi_ec_read(brightness_offset, &lec)) |
| 3186 | return -EIO; | 3299 | return -EIO; |
| 3187 | lec &= 7; | 3300 | lec &= (tp_features.bright_16levels)? 0x0f : 0x07; |
| 3188 | level = lec; | 3301 | level = lec; |
| 3189 | }; | 3302 | }; |
| 3190 | if (brightness_mode & 2) { | 3303 | if (brightness_mode & 2) { |
| 3191 | lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) | 3304 | lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) |
| 3192 | & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) | 3305 | & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) |
| 3193 | >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; | 3306 | >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; |
| 3307 | lcmos &= (tp_features.bright_16levels)? 0x0f : 0x07; | ||
| 3194 | level = lcmos; | 3308 | level = lcmos; |
| 3195 | } | 3309 | } |
| 3196 | 3310 | ||
| @@ -3206,12 +3320,13 @@ static int brightness_get(struct backlight_device *bd) | |||
| 3206 | return level; | 3320 | return level; |
| 3207 | } | 3321 | } |
| 3208 | 3322 | ||
| 3323 | /* May return EINTR which can always be mapped to ERESTARTSYS */ | ||
| 3209 | static int brightness_set(int value) | 3324 | static int brightness_set(int value) |
| 3210 | { | 3325 | { |
| 3211 | int cmos_cmd, inc, i, res; | 3326 | int cmos_cmd, inc, i, res; |
| 3212 | int current_value; | 3327 | int current_value; |
| 3213 | 3328 | ||
| 3214 | if (value > 7) | 3329 | if (value > ((tp_features.bright_16levels)? 15 : 7)) |
| 3215 | return -EINVAL; | 3330 | return -EINVAL; |
| 3216 | 3331 | ||
| 3217 | res = mutex_lock_interruptible(&brightness_mutex); | 3332 | res = mutex_lock_interruptible(&brightness_mutex); |
| @@ -3227,7 +3342,7 @@ static int brightness_set(int value) | |||
| 3227 | cmos_cmd = value > current_value ? | 3342 | cmos_cmd = value > current_value ? |
| 3228 | TP_CMOS_BRIGHTNESS_UP : | 3343 | TP_CMOS_BRIGHTNESS_UP : |
| 3229 | TP_CMOS_BRIGHTNESS_DOWN; | 3344 | TP_CMOS_BRIGHTNESS_DOWN; |
| 3230 | inc = value > current_value ? 1 : -1; | 3345 | inc = (value > current_value)? 1 : -1; |
| 3231 | 3346 | ||
| 3232 | res = 0; | 3347 | res = 0; |
| 3233 | for (i = current_value; i != value; i += inc) { | 3348 | for (i = current_value; i != value; i += inc) { |
| @@ -3256,10 +3371,11 @@ static int brightness_read(char *p) | |||
| 3256 | if ((level = brightness_get(NULL)) < 0) { | 3371 | if ((level = brightness_get(NULL)) < 0) { |
| 3257 | len += sprintf(p + len, "level:\t\tunreadable\n"); | 3372 | len += sprintf(p + len, "level:\t\tunreadable\n"); |
| 3258 | } else { | 3373 | } else { |
| 3259 | len += sprintf(p + len, "level:\t\t%d\n", level & 0x7); | 3374 | len += sprintf(p + len, "level:\t\t%d\n", level); |
| 3260 | len += sprintf(p + len, "commands:\tup, down\n"); | 3375 | len += sprintf(p + len, "commands:\tup, down\n"); |
| 3261 | len += sprintf(p + len, "commands:\tlevel <level>" | 3376 | len += sprintf(p + len, "commands:\tlevel <level>" |
| 3262 | " (<level> is 0-7)\n"); | 3377 | " (<level> is 0-%d)\n", |
| 3378 | (tp_features.bright_16levels) ? 15 : 7); | ||
| 3263 | } | 3379 | } |
| 3264 | 3380 | ||
| 3265 | return len; | 3381 | return len; |
| @@ -3268,28 +3384,34 @@ static int brightness_read(char *p) | |||
| 3268 | static int brightness_write(char *buf) | 3384 | static int brightness_write(char *buf) |
| 3269 | { | 3385 | { |
| 3270 | int level; | 3386 | int level; |
| 3271 | int new_level; | 3387 | int rc; |
| 3272 | char *cmd; | 3388 | char *cmd; |
| 3389 | int max_level = (tp_features.bright_16levels) ? 15 : 7; | ||
| 3273 | 3390 | ||
| 3274 | while ((cmd = next_cmd(&buf))) { | 3391 | level = brightness_get(NULL); |
| 3275 | if ((level = brightness_get(NULL)) < 0) | 3392 | if (level < 0) |
| 3276 | return level; | 3393 | return level; |
| 3277 | level &= 7; | ||
| 3278 | 3394 | ||
| 3395 | while ((cmd = next_cmd(&buf))) { | ||
| 3279 | if (strlencmp(cmd, "up") == 0) { | 3396 | if (strlencmp(cmd, "up") == 0) { |
| 3280 | new_level = level == 7 ? 7 : level + 1; | 3397 | if (level < max_level) |
| 3398 | level++; | ||
| 3281 | } else if (strlencmp(cmd, "down") == 0) { | 3399 | } else if (strlencmp(cmd, "down") == 0) { |
| 3282 | new_level = level == 0 ? 0 : level - 1; | 3400 | if (level > 0) |
| 3283 | } else if (sscanf(cmd, "level %d", &new_level) == 1 && | 3401 | level--; |
| 3284 | new_level >= 0 && new_level <= 7) { | 3402 | } else if (sscanf(cmd, "level %d", &level) == 1 && |
| 3285 | /* new_level set */ | 3403 | level >= 0 && level <= max_level) { |
| 3404 | /* new level set */ | ||
| 3286 | } else | 3405 | } else |
| 3287 | return -EINVAL; | 3406 | return -EINVAL; |
| 3288 | |||
| 3289 | brightness_set(new_level); | ||
| 3290 | } | 3407 | } |
| 3291 | 3408 | ||
| 3292 | return 0; | 3409 | /* |
| 3410 | * Now we know what the final level should be, so we try to set it. | ||
| 3411 | * Doing it this way makes the syscall restartable in case of EINTR | ||
| 3412 | */ | ||
| 3413 | rc = brightness_set(level); | ||
| 3414 | return (rc == -EINTR)? ERESTARTSYS : rc; | ||
| 3293 | } | 3415 | } |
| 3294 | 3416 | ||
| 3295 | static struct ibm_struct brightness_driver_data = { | 3417 | static struct ibm_struct brightness_driver_data = { |
| @@ -3652,9 +3774,8 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
| 3652 | /* scale down from 0-255 to 0-7 */ | 3774 | /* scale down from 0-255 to 0-7 */ |
| 3653 | newlevel = (s >> 5) & 0x07; | 3775 | newlevel = (s >> 5) & 0x07; |
| 3654 | 3776 | ||
| 3655 | rc = mutex_lock_interruptible(&fan_mutex); | 3777 | if (mutex_lock_interruptible(&fan_mutex)) |
| 3656 | if (rc < 0) | 3778 | return -ERESTARTSYS; |
| 3657 | return rc; | ||
| 3658 | 3779 | ||
| 3659 | rc = fan_get_status(&status); | 3780 | rc = fan_get_status(&status); |
| 3660 | if (!rc && (status & | 3781 | if (!rc && (status & |
| @@ -3904,9 +4025,8 @@ static int fan_get_status_safe(u8 *status) | |||
| 3904 | int rc; | 4025 | int rc; |
| 3905 | u8 s; | 4026 | u8 s; |
| 3906 | 4027 | ||
| 3907 | rc = mutex_lock_interruptible(&fan_mutex); | 4028 | if (mutex_lock_interruptible(&fan_mutex)) |
| 3908 | if (rc < 0) | 4029 | return -ERESTARTSYS; |
| 3909 | return rc; | ||
| 3910 | rc = fan_get_status(&s); | 4030 | rc = fan_get_status(&s); |
| 3911 | if (!rc) | 4031 | if (!rc) |
| 3912 | fan_update_desired_level(s); | 4032 | fan_update_desired_level(s); |
| @@ -4040,9 +4160,8 @@ static int fan_set_level_safe(int level) | |||
| 4040 | if (!fan_control_allowed) | 4160 | if (!fan_control_allowed) |
| 4041 | return -EPERM; | 4161 | return -EPERM; |
| 4042 | 4162 | ||
| 4043 | rc = mutex_lock_interruptible(&fan_mutex); | 4163 | if (mutex_lock_interruptible(&fan_mutex)) |
| 4044 | if (rc < 0) | 4164 | return -ERESTARTSYS; |
| 4045 | return rc; | ||
| 4046 | 4165 | ||
| 4047 | if (level == TPACPI_FAN_LAST_LEVEL) | 4166 | if (level == TPACPI_FAN_LAST_LEVEL) |
| 4048 | level = fan_control_desired_level; | 4167 | level = fan_control_desired_level; |
| @@ -4063,9 +4182,8 @@ static int fan_set_enable(void) | |||
| 4063 | if (!fan_control_allowed) | 4182 | if (!fan_control_allowed) |
| 4064 | return -EPERM; | 4183 | return -EPERM; |
| 4065 | 4184 | ||
| 4066 | rc = mutex_lock_interruptible(&fan_mutex); | 4185 | if (mutex_lock_interruptible(&fan_mutex)) |
| 4067 | if (rc < 0) | 4186 | return -ERESTARTSYS; |
| 4068 | return rc; | ||
| 4069 | 4187 | ||
| 4070 | switch (fan_control_access_mode) { | 4188 | switch (fan_control_access_mode) { |
| 4071 | case TPACPI_FAN_WR_ACPI_FANS: | 4189 | case TPACPI_FAN_WR_ACPI_FANS: |
| @@ -4119,9 +4237,8 @@ static int fan_set_disable(void) | |||
| 4119 | if (!fan_control_allowed) | 4237 | if (!fan_control_allowed) |
| 4120 | return -EPERM; | 4238 | return -EPERM; |
| 4121 | 4239 | ||
| 4122 | rc = mutex_lock_interruptible(&fan_mutex); | 4240 | if (mutex_lock_interruptible(&fan_mutex)) |
| 4123 | if (rc < 0) | 4241 | return -ERESTARTSYS; |
| 4124 | return rc; | ||
| 4125 | 4242 | ||
| 4126 | rc = 0; | 4243 | rc = 0; |
| 4127 | switch (fan_control_access_mode) { | 4244 | switch (fan_control_access_mode) { |
| @@ -4158,9 +4275,8 @@ static int fan_set_speed(int speed) | |||
| 4158 | if (!fan_control_allowed) | 4275 | if (!fan_control_allowed) |
| 4159 | return -EPERM; | 4276 | return -EPERM; |
| 4160 | 4277 | ||
| 4161 | rc = mutex_lock_interruptible(&fan_mutex); | 4278 | if (mutex_lock_interruptible(&fan_mutex)) |
| 4162 | if (rc < 0) | 4279 | return -ERESTARTSYS; |
| 4163 | return rc; | ||
| 4164 | 4280 | ||
| 4165 | rc = 0; | 4281 | rc = 0; |
| 4166 | switch (fan_control_access_mode) { | 4282 | switch (fan_control_access_mode) { |
| @@ -4701,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp) | |||
| 4701 | unsigned int i; | 4817 | unsigned int i; |
| 4702 | struct ibm_struct *ibm; | 4818 | struct ibm_struct *ibm; |
| 4703 | 4819 | ||
| 4820 | if (!kp || !kp->name || !val) | ||
| 4821 | return -EINVAL; | ||
| 4822 | |||
| 4704 | for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { | 4823 | for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { |
| 4705 | ibm = ibms_init[i].data; | 4824 | ibm = ibms_init[i].data; |
| 4706 | BUG_ON(ibm == NULL); | 4825 | WARN_ON(ibm == NULL); |
| 4826 | |||
| 4827 | if (!ibm || !ibm->name) | ||
| 4828 | continue; | ||
| 4707 | 4829 | ||
| 4708 | if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { | 4830 | if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { |
| 4709 | if (strlen(val) > sizeof(ibms_init[i].param) - 2) | 4831 | if (strlen(val) > sizeof(ibms_init[i].param) - 2) |
| @@ -4732,6 +4854,9 @@ module_param_named(fan_control, fan_control_allowed, bool, 0); | |||
| 4732 | static int brightness_mode; | 4854 | static int brightness_mode; |
| 4733 | module_param_named(brightness_mode, brightness_mode, int, 0); | 4855 | module_param_named(brightness_mode, brightness_mode, int, 0); |
| 4734 | 4856 | ||
| 4857 | static unsigned int brightness_enable = 2; /* 2 = auto, 0 = no, 1 = yes */ | ||
| 4858 | module_param(brightness_enable, uint, 0); | ||
| 4859 | |||
| 4735 | static unsigned int hotkey_report_mode; | 4860 | static unsigned int hotkey_report_mode; |
| 4736 | module_param(hotkey_report_mode, uint, 0); | 4861 | module_param(hotkey_report_mode, uint, 0); |
| 4737 | 4862 | ||
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 3abcc8120634..8fba2bbe345e 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
| @@ -84,7 +84,7 @@ | |||
| 84 | 84 | ||
| 85 | /* ThinkPad CMOS NVRAM constants */ | 85 | /* ThinkPad CMOS NVRAM constants */ |
| 86 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e | 86 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e |
| 87 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07 | 87 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x0f |
| 88 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 | 88 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 |
| 89 | 89 | ||
| 90 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") | 90 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") |
| @@ -246,6 +246,7 @@ static struct { | |||
| 246 | u32 hotkey_wlsw:1; | 246 | u32 hotkey_wlsw:1; |
| 247 | u32 light:1; | 247 | u32 light:1; |
| 248 | u32 light_status:1; | 248 | u32 light_status:1; |
| 249 | u32 bright_16levels:1; | ||
| 249 | u32 wan:1; | 250 | u32 wan:1; |
| 250 | u32 fan_ctrl_status_undef:1; | 251 | u32 fan_ctrl_status_undef:1; |
| 251 | u32 input_device_registered:1; | 252 | u32 input_device_registered:1; |
| @@ -338,6 +339,7 @@ static int bluetooth_write(char *buf); | |||
| 338 | static struct backlight_device *ibm_backlight_device; | 339 | static struct backlight_device *ibm_backlight_device; |
| 339 | static int brightness_offset = 0x31; | 340 | static int brightness_offset = 0x31; |
| 340 | static int brightness_mode; | 341 | static int brightness_mode; |
| 342 | static unsigned int brightness_enable; /* 0 = no, 1 = yes, 2 = auto */ | ||
| 341 | 343 | ||
| 342 | static int brightness_init(struct ibm_init_struct *iibm); | 344 | static int brightness_init(struct ibm_init_struct *iibm); |
| 343 | static void brightness_exit(void); | 345 | static void brightness_exit(void); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index cd0a204d96d1..11adab13f2b7 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
| @@ -75,6 +75,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
| 75 | { | 75 | { |
| 76 | int i = 0; | 76 | int i = 0; |
| 77 | int irq; | 77 | int irq; |
| 78 | int p, t; | ||
| 78 | 79 | ||
| 79 | if (!valid_IRQ(gsi)) | 80 | if (!valid_IRQ(gsi)) |
| 80 | return; | 81 | return; |
| @@ -85,15 +86,22 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
| 85 | if (i >= PNP_MAX_IRQ) | 86 | if (i >= PNP_MAX_IRQ) |
| 86 | return; | 87 | return; |
| 87 | 88 | ||
| 88 | #ifdef CONFIG_X86 | 89 | /* |
| 89 | if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE || | 90 | * in IO-APIC mode, use overrided attribute. Two reasons: |
| 90 | polarity != ACPI_ACTIVE_HIGH)) { | 91 | * 1. BIOS bug in DSDT |
| 91 | pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, " | 92 | * 2. BIOS uses IO-APIC mode Interrupt Source Override |
| 92 | "active high", gsi); | 93 | */ |
| 93 | triggering = ACPI_EDGE_SENSITIVE; | 94 | if (!acpi_get_override_irq(gsi, &t, &p)) { |
| 94 | polarity = ACPI_ACTIVE_HIGH; | 95 | t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; |
| 96 | p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; | ||
| 97 | |||
| 98 | if (triggering != t || polarity != p) { | ||
| 99 | pnp_warn("IRQ %d override to %s, %s", | ||
| 100 | gsi, t ? "edge":"level", p ? "low":"high"); | ||
| 101 | triggering = t; | ||
| 102 | polarity = p; | ||
| 103 | } | ||
| 95 | } | 104 | } |
| 96 | #endif | ||
| 97 | 105 | ||
| 98 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 106 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
| 99 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | 107 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); |
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 26d79f6db8a0..76411b1fc4fd 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
| @@ -78,7 +78,6 @@ struct acpi_processor_cx { | |||
| 78 | struct acpi_processor_power { | 78 | struct acpi_processor_power { |
| 79 | struct cpuidle_device dev; | 79 | struct cpuidle_device dev; |
| 80 | struct acpi_processor_cx *state; | 80 | struct acpi_processor_cx *state; |
| 81 | struct acpi_processor_cx *bm_state; | ||
| 82 | unsigned long bm_check_timestamp; | 81 | unsigned long bm_check_timestamp; |
| 83 | u32 default_state; | 82 | u32 default_state; |
| 84 | u32 bm_activity; | 83 | u32 bm_activity; |
diff --git a/include/asm-x86/mach-default/mach_reboot.h b/include/asm-x86/mach-default/mach_reboot.h index e23fd9fbebb3..6adee6a97dec 100644 --- a/include/asm-x86/mach-default/mach_reboot.h +++ b/include/asm-x86/mach-default/mach_reboot.h | |||
| @@ -49,7 +49,7 @@ static inline void mach_reboot(void) | |||
| 49 | udelay(50); | 49 | udelay(50); |
| 50 | kb_wait(); | 50 | kb_wait(); |
| 51 | udelay(50); | 51 | udelay(50); |
| 52 | outb(cmd | 0x04, 0x60); /* set "System flag" */ | 52 | outb(cmd | 0x14, 0x60); /* set "System flag" and "Keyboard Disabled" */ |
| 53 | udelay(50); | 53 | udelay(50); |
| 54 | kb_wait(); | 54 | kb_wait(); |
| 55 | udelay(50); | 55 | udelay(50); |
diff --git a/include/asm-x86/mach-es7000/mach_mpparse.h b/include/asm-x86/mach-es7000/mach_mpparse.h index 8aa10547b4b1..52ee75cd0fe1 100644 --- a/include/asm-x86/mach-es7000/mach_mpparse.h +++ b/include/asm-x86/mach-es7000/mach_mpparse.h | |||
| @@ -29,9 +29,9 @@ extern int mps_oem_check(struct mp_config_table *mpc, char *oem, | |||
| 29 | static inline int es7000_check_dsdt(void) | 29 | static inline int es7000_check_dsdt(void) |
| 30 | { | 30 | { |
| 31 | struct acpi_table_header header; | 31 | struct acpi_table_header header; |
| 32 | memcpy(&header, 0, sizeof(struct acpi_table_header)); | 32 | |
| 33 | acpi_get_table_header(ACPI_SIG_DSDT, 0, &header); | 33 | if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) && |
| 34 | if (!strncmp(header.oem_id, "UNISYS", 6)) | 34 | !strncmp(header.oem_id, "UNISYS", 6)) |
| 35 | return 1; | 35 | return 1; |
| 36 | return 0; | 36 | return 0; |
| 37 | } | 37 | } |
diff --git a/include/asm-x86/mach-voyager/setup_arch.h b/include/asm-x86/mach-voyager/setup_arch.h index 1710ae10eb67..71729ca05cd7 100644 --- a/include/asm-x86/mach-voyager/setup_arch.h +++ b/include/asm-x86/mach-voyager/setup_arch.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #include <asm/voyager.h> | 1 | #include <asm/voyager.h> |
| 2 | #include <asm/setup_32.h> | 2 | #include <asm/setup.h> |
| 3 | #define VOYAGER_BIOS_INFO ((struct voyager_bios_info *) \ | 3 | #define VOYAGER_BIOS_INFO ((struct voyager_bios_info *) \ |
| 4 | (&boot_params.apm_bios_info)) | 4 | (&boot_params.apm_bios_info)) |
| 5 | 5 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 8ccedf7a0a5a..e3c16c981e46 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -132,6 +132,11 @@ extern unsigned long acpi_realmode_flags; | |||
| 132 | int acpi_register_gsi (u32 gsi, int triggering, int polarity); | 132 | int acpi_register_gsi (u32 gsi, int triggering, int polarity); |
| 133 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); | 133 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); |
| 134 | 134 | ||
| 135 | #ifdef CONFIG_X86_IO_APIC | ||
| 136 | extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity); | ||
| 137 | #else | ||
| 138 | #define acpi_get_override_irq(bus, trigger, polarity) (-1) | ||
| 139 | #endif | ||
| 135 | /* | 140 | /* |
| 136 | * This function undoes the effect of one call to acpi_register_gsi(). | 141 | * This function undoes the effect of one call to acpi_register_gsi(). |
| 137 | * If this matches the last registration, any IRQ resources for gsi | 142 | * If this matches the last registration, any IRQ resources for gsi |
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 16a51546db44..c4e00161a247 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h | |||
| @@ -92,6 +92,7 @@ struct cpuidle_device { | |||
| 92 | struct kobject kobj; | 92 | struct kobject kobj; |
| 93 | struct completion kobj_unregister; | 93 | struct completion kobj_unregister; |
| 94 | void *governor_data; | 94 | void *governor_data; |
| 95 | struct cpuidle_state *safe_state; | ||
| 95 | }; | 96 | }; |
| 96 | 97 | ||
| 97 | DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); | 98 | DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); |
diff --git a/include/linux/selinux.h b/include/linux/selinux.h index d1b7ca6c1c57..6080f73fc85f 100644 --- a/include/linux/selinux.h +++ b/include/linux/selinux.h | |||
| @@ -136,7 +136,7 @@ static inline int selinux_audit_rule_init(u32 field, u32 op, | |||
| 136 | char *rulestr, | 136 | char *rulestr, |
| 137 | struct selinux_audit_rule **rule) | 137 | struct selinux_audit_rule **rule) |
| 138 | { | 138 | { |
| 139 | return -ENOTSUPP; | 139 | return -EOPNOTSUPP; |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule) | 142 | static inline void selinux_audit_rule_free(struct selinux_audit_rule *rule) |
diff --git a/kernel/sys.c b/kernel/sys.c index 304b5410d746..d1fe71eb4546 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1750,7 +1750,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
| 1750 | } | 1750 | } |
| 1751 | 1751 | ||
| 1752 | asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, | 1752 | asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, |
| 1753 | struct getcpu_cache __user *cache) | 1753 | struct getcpu_cache __user *unused) |
| 1754 | { | 1754 | { |
| 1755 | int err = 0; | 1755 | int err = 0; |
| 1756 | int cpu = raw_smp_processor_id(); | 1756 | int cpu = raw_smp_processor_id(); |
| @@ -1758,24 +1758,6 @@ asmlinkage long sys_getcpu(unsigned __user *cpup, unsigned __user *nodep, | |||
| 1758 | err |= put_user(cpu, cpup); | 1758 | err |= put_user(cpu, cpup); |
| 1759 | if (nodep) | 1759 | if (nodep) |
| 1760 | err |= put_user(cpu_to_node(cpu), nodep); | 1760 | err |= put_user(cpu_to_node(cpu), nodep); |
| 1761 | if (cache) { | ||
| 1762 | /* | ||
| 1763 | * The cache is not needed for this implementation, | ||
| 1764 | * but make sure user programs pass something | ||
| 1765 | * valid. vsyscall implementations can instead make | ||
| 1766 | * good use of the cache. Only use t0 and t1 because | ||
| 1767 | * these are available in both 32bit and 64bit ABI (no | ||
| 1768 | * need for a compat_getcpu). 32bit has enough | ||
| 1769 | * padding | ||
| 1770 | */ | ||
| 1771 | unsigned long t0, t1; | ||
| 1772 | get_user(t0, &cache->blob[0]); | ||
| 1773 | get_user(t1, &cache->blob[1]); | ||
| 1774 | t0++; | ||
| 1775 | t1++; | ||
| 1776 | put_user(t0, &cache->blob[0]); | ||
| 1777 | put_user(t1, &cache->blob[1]); | ||
| 1778 | } | ||
| 1779 | return err ? -EFAULT : 0; | 1761 | return err ? -EFAULT : 0; |
| 1780 | } | 1762 | } |
| 1781 | 1763 | ||
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index de6a2d6b3ebb..14a2ecf2b318 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
| @@ -205,7 +205,7 @@ static void sync_cmos_clock(unsigned long dummy) | |||
| 205 | return; | 205 | return; |
| 206 | 206 | ||
| 207 | getnstimeofday(&now); | 207 | getnstimeofday(&now); |
| 208 | if (abs(xtime.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) | 208 | if (abs(now.tv_nsec - (NSEC_PER_SEC / 2)) <= tick_nsec / 2) |
| 209 | fail = update_persistent_clock(now); | 209 | fail = update_persistent_clock(now); |
| 210 | 210 | ||
| 211 | next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec; | 211 | next.tv_nsec = (NSEC_PER_SEC / 2) - now.tv_nsec; |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index c6bee85c3962..a38787a881ea 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
| @@ -591,7 +591,6 @@ int main(int ac, char **av) | |||
| 591 | conf_read_simple(name, S_DEF_USER); | 591 | conf_read_simple(name, S_DEF_USER); |
| 592 | else if (!stat("all.config", &tmpstat)) | 592 | else if (!stat("all.config", &tmpstat)) |
| 593 | conf_read_simple("all.config", S_DEF_USER); | 593 | conf_read_simple("all.config", S_DEF_USER); |
| 594 | conf_set_env_sym("K64BIT", "64BIT", S_DEF_USER); | ||
| 595 | break; | 594 | break; |
| 596 | default: | 595 | default: |
| 597 | break; | 596 | break; |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index e4fa3f302541..e0f402f3b75d 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -145,33 +145,6 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
| 145 | return 0; | 145 | return 0; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | /* Read an environment variable and assign the value to the symbol */ | ||
| 149 | int conf_set_env_sym(const char *env, const char *symname, int def) | ||
| 150 | { | ||
| 151 | struct symbol *sym; | ||
| 152 | char *p; | ||
| 153 | int def_flags; | ||
| 154 | |||
| 155 | p = getenv(env); | ||
| 156 | if (p) { | ||
| 157 | char warning[200]; | ||
| 158 | sprintf(warning, "Environment variable (%s = \"%s\")", env, p); | ||
| 159 | conf_filename = warning; | ||
| 160 | def_flags = SYMBOL_DEF << def; | ||
| 161 | if (def == S_DEF_USER) { | ||
| 162 | sym = sym_find(symname); | ||
| 163 | if (!sym) | ||
| 164 | return 1; | ||
| 165 | } else { | ||
| 166 | sym = sym_lookup(symname, 0); | ||
| 167 | if (sym->type == S_UNKNOWN) | ||
| 168 | sym->type = S_OTHER; | ||
| 169 | } | ||
| 170 | conf_set_sym_val(sym, def, def_flags, p); | ||
| 171 | } | ||
| 172 | return 0; | ||
| 173 | } | ||
| 174 | |||
| 175 | int conf_read_simple(const char *name, int def) | 148 | int conf_read_simple(const char *name, int def) |
| 176 | { | 149 | { |
| 177 | FILE *in = NULL; | 150 | FILE *in = NULL; |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index dca294e90cc3..4d09f6ddefe3 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | /* confdata.c */ | 2 | /* confdata.c */ |
| 3 | P(conf_parse,void,(const char *name)); | 3 | P(conf_parse,void,(const char *name)); |
| 4 | P(conf_set_env_sym,int,(const char *envname, const char *symname, int def)); | ||
| 5 | P(conf_read,int,(const char *name)); | 4 | P(conf_read,int,(const char *name)); |
| 6 | P(conf_read_simple,int,(const char *name, int)); | 5 | P(conf_read_simple,int,(const char *name, int)); |
| 7 | P(conf_write,int,(const char *name)); | 6 | P(conf_write,int,(const char *name)); |
