Commit 0c26d7cc authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (72 commits)
  asus-laptop: remove EXPERIMENTAL dependency
  asus-laptop: use pr_fmt and pr_<level>
  eeepc-laptop: cpufv updates
  eeepc-laptop: sync eeepc-laptop with asus_acpi
  asus_acpi: Deprecate in favor of asus-laptop
  acpi4asus: update MAINTAINER and KConfig links
  asus-laptop: platform dev as parent for led and backlight
  eeepc-laptop: enable camera by default
  ACPI: Rename ACPI processor device bus ID
  acerhdf: Acer Aspire One fan control
  ACPI: video: DMI workaround broken Acer 7720 BIOS enabling display brightness
  ACPI: run ACPI device hot removal in kacpi_hotplug_wq
  ACPI: Add the reference count to avoid unloading ACPI video bus twice
  ACPI: DMI to disable Vista compatibility on some Sony laptops
  ACPI: fix a deadlock in hotplug case
  Show the physical device node of backlight class device.
  ACPI: pdc init related memory leak with physical CPU hotplug
  ACPI: pci_root: remove unused dev/fn information
  ACPI: pci_root: simplify list traversals
  ACPI: pci_root: use driver data rather than list lookup
  ...
parents 936940a9 21ab01e2
...@@ -229,14 +229,6 @@ and is between 256 and 4096 characters. It is defined in the file ...@@ -229,14 +229,6 @@ and is between 256 and 4096 characters. It is defined in the file
to assume that this machine's pmtimer latches its value to assume that this machine's pmtimer latches its value
and always returns good values. and always returns good values.
acpi.power_nocheck= [HW,ACPI]
Format: 1/0 enable/disable the check of power state.
On some bogus BIOS the _PSC object/_STA object of
power resource can't return the correct device power
state. In such case it is unneccessary to check its
power state again in power transition.
1 : disable the power state check
acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode
Format: { level | edge | high | low } Format: { level | edge | high | low }
......
...@@ -920,7 +920,7 @@ The available commands are: ...@@ -920,7 +920,7 @@ The available commands are:
echo '<LED number> off' >/proc/acpi/ibm/led echo '<LED number> off' >/proc/acpi/ibm/led
echo '<LED number> blink' >/proc/acpi/ibm/led echo '<LED number> blink' >/proc/acpi/ibm/led
The <LED number> range is 0 to 7. The set of LEDs that can be The <LED number> range is 0 to 15. The set of LEDs that can be
controlled varies from model to model. Here is the common ThinkPad controlled varies from model to model. Here is the common ThinkPad
mapping: mapping:
...@@ -932,6 +932,11 @@ mapping: ...@@ -932,6 +932,11 @@ mapping:
5 - UltraBase battery slot 5 - UltraBase battery slot
6 - (unknown) 6 - (unknown)
7 - standby 7 - standby
8 - dock status 1
9 - dock status 2
10, 11 - (unknown)
12 - thinkvantage
13, 14, 15 - (unknown)
All of the above can be turned on and off and can be made to blink. All of the above can be turned on and off and can be made to blink.
...@@ -940,10 +945,12 @@ sysfs notes: ...@@ -940,10 +945,12 @@ sysfs notes:
The ThinkPad LED sysfs interface is described in detail by the LED class The ThinkPad LED sysfs interface is described in detail by the LED class
documentation, in Documentation/leds-class.txt. documentation, in Documentation/leds-class.txt.
The leds are named (in LED ID order, from 0 to 7): The LEDs are named (in LED ID order, from 0 to 12):
"tpacpi::power", "tpacpi:orange:batt", "tpacpi:green:batt", "tpacpi::power", "tpacpi:orange:batt", "tpacpi:green:batt",
"tpacpi::dock_active", "tpacpi::bay_active", "tpacpi::dock_batt", "tpacpi::dock_active", "tpacpi::bay_active", "tpacpi::dock_batt",
"tpacpi::unknown_led", "tpacpi::standby". "tpacpi::unknown_led", "tpacpi::standby", "tpacpi::dock_status1",
"tpacpi::dock_status2", "tpacpi::unknown_led2", "tpacpi::unknown_led3",
"tpacpi::thinkvantage".
Due to limitations in the sysfs LED class, if the status of the LED Due to limitations in the sysfs LED class, if the status of the LED
indicators cannot be read due to an error, thinkpad-acpi will report it as indicators cannot be read due to an error, thinkpad-acpi will report it as
...@@ -958,6 +965,12 @@ ThinkPad indicator LED should blink in hardware accelerated mode, use the ...@@ -958,6 +965,12 @@ ThinkPad indicator LED should blink in hardware accelerated mode, use the
"timer" trigger, and leave the delay_on and delay_off parameters set to "timer" trigger, and leave the delay_on and delay_off parameters set to
zero (to request hardware acceleration autodetection). zero (to request hardware acceleration autodetection).
LEDs that are known not to exist in a given ThinkPad model are not
made available through the sysfs interface. If you have a dock and you
notice there are LEDs listed for your ThinkPad that do not exist (and
are not in the dock), or if you notice that there are missing LEDs,
a report to ibm-acpi-devel@lists.sourceforge.net is appreciated.
ACPI sounds -- /proc/acpi/ibm/beep ACPI sounds -- /proc/acpi/ibm/beep
---------------------------------- ----------------------------------
...@@ -1156,17 +1169,19 @@ may not be distinct. Later Lenovo models that implement the ACPI ...@@ -1156,17 +1169,19 @@ may not be distinct. Later Lenovo models that implement the ACPI
display backlight brightness control methods have 16 levels, ranging display backlight brightness control methods have 16 levels, ranging
from 0 to 15. from 0 to 15.
There are two interfaces to the firmware for direct brightness control, For IBM ThinkPads, there are two interfaces to the firmware for direct
EC and UCMS (or CMOS). To select which one should be used, use the brightness control, EC and UCMS (or CMOS). To select which one should be
brightness_mode module parameter: brightness_mode=1 selects EC mode, used, use the brightness_mode module parameter: brightness_mode=1 selects
brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC EC mode, brightness_mode=2 selects UCMS mode, brightness_mode=3 selects EC
mode with NVRAM backing (so that brightness changes are remembered mode with NVRAM backing (so that brightness changes are remembered across
across shutdown/reboot). shutdown/reboot).
The driver tries to select which interface to use from a table of The driver tries to select which interface to use from a table of
defaults for each ThinkPad model. If it makes a wrong choice, please defaults for each ThinkPad model. If it makes a wrong choice, please
report this as a bug, so that we can fix it. report this as a bug, so that we can fix it.
Lenovo ThinkPads only support brightness_mode=2 (UCMS).
When display backlight brightness controls are available through the When display backlight brightness controls are available through the
standard ACPI interface, it is best to use it instead of this direct standard ACPI interface, it is best to use it instead of this direct
ThinkPad-specific interface. The driver will disable its native ThinkPad-specific interface. The driver will disable its native
...@@ -1254,7 +1269,7 @@ Fan control and monitoring: fan speed, fan enable/disable ...@@ -1254,7 +1269,7 @@ Fan control and monitoring: fan speed, fan enable/disable
procfs: /proc/acpi/ibm/fan procfs: /proc/acpi/ibm/fan
sysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1, sysfs device attributes: (hwmon "thinkpad") fan1_input, pwm1,
pwm1_enable pwm1_enable, fan2_input
sysfs hwmon driver attributes: fan_watchdog sysfs hwmon driver attributes: fan_watchdog
NOTE NOTE NOTE: fan control operations are disabled by default for NOTE NOTE NOTE: fan control operations are disabled by default for
...@@ -1267,6 +1282,9 @@ from the hardware registers of the embedded controller. This is known ...@@ -1267,6 +1282,9 @@ from the hardware registers of the embedded controller. This is known
to work on later R, T, X and Z series ThinkPads but may show a bogus to work on later R, T, X and Z series ThinkPads but may show a bogus
value on other models. value on other models.
Some Lenovo ThinkPads support a secondary fan. This fan cannot be
controlled separately, it shares the main fan control.
Fan levels: Fan levels:
Most ThinkPad fans work in "levels" at the firmware interface. Level 0 Most ThinkPad fans work in "levels" at the firmware interface. Level 0
...@@ -1397,6 +1415,11 @@ hwmon device attribute fan1_input: ...@@ -1397,6 +1415,11 @@ hwmon device attribute fan1_input:
which can take up to two minutes. May return rubbish on older which can take up to two minutes. May return rubbish on older
ThinkPads. ThinkPads.
hwmon device attribute fan2_input:
Fan tachometer reading, in RPM, for the secondary fan.
Available only on some ThinkPads. If the secondary fan is
not installed, will always read 0.
hwmon driver attribute fan_watchdog: hwmon driver attribute fan_watchdog:
Fan safety watchdog timer interval, in seconds. Minimum is Fan safety watchdog timer interval, in seconds. Minimum is
1 second, maximum is 120 seconds. 0 disables the watchdog. 1 second, maximum is 120 seconds. 0 disables the watchdog.
...@@ -1555,3 +1578,7 @@ Sysfs interface changelog: ...@@ -1555,3 +1578,7 @@ Sysfs interface changelog:
0x020300: hotkey enable/disable support removed, attributes 0x020300: hotkey enable/disable support removed, attributes
hotkey_bios_enabled and hotkey_enable deprecated and hotkey_bios_enabled and hotkey_enable deprecated and
marked for removal. marked for removal.
0x020400: Marker for 16 LEDs support. Also, LEDs that are known
to not exist in a given model are not registered with
the LED sysfs class anymore.
...@@ -230,6 +230,13 @@ L: linux-acenic@sunsite.dk ...@@ -230,6 +230,13 @@ L: linux-acenic@sunsite.dk
S: Maintained S: Maintained
F: drivers/net/acenic* F: drivers/net/acenic*
ACER ASPIRE ONE TEMPERATURE AND FAN DRIVER
P: Peter Feuerer
M: peter@piie.net
W: http://piie.net/?section=acerhdf
S: Maintained
F: drivers/platform/x86/acerhdf.c
ACER WMI LAPTOP EXTRAS ACER WMI LAPTOP EXTRAS
P: Carlos Corbacho P: Carlos Corbacho
M: carlos@strangeworlds.co.uk M: carlos@strangeworlds.co.uk
...@@ -913,8 +920,7 @@ M: corentincj@iksaif.net ...@@ -913,8 +920,7 @@ M: corentincj@iksaif.net
P: Karol Kozimor P: Karol Kozimor
M: sziwan@users.sourceforge.net M: sziwan@users.sourceforge.net
L: acpi4asus-user@lists.sourceforge.net L: acpi4asus-user@lists.sourceforge.net
W: http://sourceforge.net/projects/acpi4asus W: http://acpi4asus.sf.net
W: http://xf.iksaif.net/acpi4asus
S: Maintained S: Maintained
F: arch/x86/kernel/acpi/boot.c F: arch/x86/kernel/acpi/boot.c
F: drivers/platform/x86/asus_acpi.c F: drivers/platform/x86/asus_acpi.c
...@@ -930,8 +936,7 @@ ASUS LAPTOP EXTRAS DRIVER ...@@ -930,8 +936,7 @@ ASUS LAPTOP EXTRAS DRIVER
P: Corentin Chary P: Corentin Chary
M: corentincj@iksaif.net M: corentincj@iksaif.net
L: acpi4asus-user@lists.sourceforge.net L: acpi4asus-user@lists.sourceforge.net
W: http://sourceforge.net/projects/acpi4asus W: http://acpi4asus.sf.net
W: http://xf.iksaif.net/acpi4asus
S: Maintained S: Maintained
F: drivers/platform/x86/asus-laptop.c F: drivers/platform/x86/asus-laptop.c
...@@ -2110,7 +2115,7 @@ EEEPC LAPTOP EXTRAS DRIVER ...@@ -2110,7 +2115,7 @@ EEEPC LAPTOP EXTRAS DRIVER
P: Corentin Chary P: Corentin Chary
M: corentincj@iksaif.net M: corentincj@iksaif.net
L: acpi4asus-user@lists.sourceforge.net L: acpi4asus-user@lists.sourceforge.net
W: http://sourceforge.net/projects/acpi4asus W: http://acpi4asus.sf.net
S: Maintained S: Maintained
F: drivers/platform/x86/eeepc-laptop.c F: drivers/platform/x86/eeepc-laptop.c
......
...@@ -71,3 +71,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) ...@@ -71,3 +71,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
} }
EXPORT_SYMBOL(arch_acpi_processor_init_pdc); EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
{
if (pr->pdc) {
kfree(pr->pdc->pointer->buffer.pointer);
kfree(pr->pdc->pointer);
kfree(pr->pdc);
pr->pdc = NULL;
}
}
EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
...@@ -144,6 +144,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate) ...@@ -144,6 +144,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
#else /* !CONFIG_ACPI */ #else /* !CONFIG_ACPI */
#define acpi_disabled 1
#define acpi_lapic 0 #define acpi_lapic 0
#define acpi_ioapic 0 #define acpi_ioapic 0
static inline void acpi_noirq_set(void) { } static inline void acpi_noirq_set(void) { }
......
...@@ -121,6 +121,9 @@ extern int __init pcibios_init(void); ...@@ -121,6 +121,9 @@ extern int __init pcibios_init(void);
extern int __init pci_mmcfg_arch_init(void); extern int __init pci_mmcfg_arch_init(void);
extern void __init pci_mmcfg_arch_free(void); extern void __init pci_mmcfg_arch_free(void);
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
extern int pci_mmcfg_config_num;
/* /*
* AMD Fam10h CPUs are buggy, and cannot access MMIO config space * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
* on their northbrige except through the * %eax register. As such, you MUST * on their northbrige except through the * %eax register. As such, you MUST
......
...@@ -44,11 +44,7 @@ ...@@ -44,11 +44,7 @@
static int __initdata acpi_force = 0; static int __initdata acpi_force = 0;
u32 acpi_rsdt_forced; u32 acpi_rsdt_forced;
#ifdef CONFIG_ACPI int acpi_disabled;
int acpi_disabled = 0;
#else
int acpi_disabled = 1;
#endif
EXPORT_SYMBOL(acpi_disabled); EXPORT_SYMBOL(acpi_disabled);
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
...@@ -122,72 +118,6 @@ void __init __acpi_unmap_table(char *map, unsigned long size) ...@@ -122,72 +118,6 @@ void __init __acpi_unmap_table(char *map, unsigned long size)
early_iounmap(map, size); early_iounmap(map, size);
} }
#ifdef CONFIG_PCI_MMCONFIG
static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
struct acpi_mcfg_allocation *pci_mmcfg_config;
int pci_mmcfg_config_num;
static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
{
if (!strcmp(mcfg->header.oem_id, "SGI"))
acpi_mcfg_64bit_base_addr = TRUE;
return 0;
}
int __init acpi_parse_mcfg(struct acpi_table_header *header)
{
struct acpi_table_mcfg *mcfg;
unsigned long i;
int config_size;
if (!header)
return -EINVAL;
mcfg = (struct acpi_table_mcfg *)header;
/* how many config structures do we have */
pci_mmcfg_config_num = 0;
i = header->length - sizeof(struct acpi_table_mcfg);
while (i >= sizeof(struct acpi_mcfg_allocation)) {
++pci_mmcfg_config_num;
i -= sizeof(struct acpi_mcfg_allocation);
};
if (pci_mmcfg_config_num == 0) {
printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
return -ENODEV;
}
config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config);
pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL);
if (!pci_mmcfg_config) {
printk(KERN_WARNING PREFIX
"No memory for MCFG config tables\n");
return -ENOMEM;
}
memcpy(pci_mmcfg_config, &mcfg[1], config_size);
acpi_mcfg_oem_check(mcfg);
for (i = 0; i < pci_mmcfg_config_num; ++i) {
if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) &&
!acpi_mcfg_64bit_base_addr) {
printk(KERN_ERR PREFIX
"MMCONFIG not in low 4GB of memory\n");
kfree(pci_mmcfg_config);
pci_mmcfg_config_num = 0;
return -ENODEV;
}
}
return 0;
}
#endif /* CONFIG_PCI_MMCONFIG */
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
static int __init acpi_parse_madt(struct acpi_table_header *table) static int __init acpi_parse_madt(struct acpi_table_header *table)
{ {
...@@ -1517,14 +1447,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = { ...@@ -1517,14 +1447,6 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"), DMI_MATCH(DMI_PRODUCT_NAME, "Workstation W8000"),
}, },
}, },
{
.callback = force_acpi_ht,
.ident = "ASUS P4B266",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_BOARD_NAME, "P4B266"),
},
},
{ {
.callback = force_acpi_ht, .callback = force_acpi_ht,
.ident = "ASUS P2B-DS", .ident = "ASUS P2B-DS",
......
...@@ -34,12 +34,22 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, ...@@ -34,12 +34,22 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
flags->bm_check = 1; flags->bm_check = 1;
else if (c->x86_vendor == X86_VENDOR_INTEL) { else if (c->x86_vendor == X86_VENDOR_INTEL) {
/* /*
* Today all CPUs that support C3 share cache. * Today all MP CPUs that support C3 share cache.
* TBD: This needs to look at cache shared map, once * And caches should not be flushed by software while
* multi-core detection patch makes to the base. * entering C3 type state.
*/ */
flags->bm_check = 1; flags->bm_check = 1;
} }
/*
* On all recent Intel platforms, ARB_DISABLE is a nop.
* So, set bm_control to zero to indicate that ARB_DISABLE
* is not required while entering C3 type state on
* P4, Core and beyond CPUs
*/
if (c->x86_vendor == X86_VENDOR_INTEL &&
(c->x86 > 0x6 || (c->x86 == 6 && c->x86_model >= 14)))
flags->bm_control = 0;
} }
EXPORT_SYMBOL(acpi_processor_power_init_bm_check); EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
......
...@@ -72,6 +72,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c) ...@@ -72,6 +72,7 @@ static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
return; return;
} }
/* Initialize _PDC data based on the CPU vendor */ /* Initialize _PDC data based on the CPU vendor */
void arch_acpi_processor_init_pdc(struct acpi_processor *pr) void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
{ {
...@@ -85,3 +86,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr) ...@@ -85,3 +86,15 @@ void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
} }
EXPORT_SYMBOL(arch_acpi_processor_init_pdc); EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr)
{
if (pr->pdc) {
kfree(pr->pdc->pointer->buffer.pointer);
kfree(pr->pdc->pointer);
kfree(pr->pdc);
pr->pdc = NULL;
}
}
EXPORT_SYMBOL(arch_acpi_processor_cleanup_pdc);
...@@ -523,6 +523,69 @@ static void __init pci_mmcfg_reject_broken(int early) ...@@ -523,6 +523,69 @@ static void __init pci_mmcfg_reject_broken(int early)
static int __initdata known_bridge; static int __initdata known_bridge;
static int acpi_mcfg_64bit_base_addr __initdata = FALSE;
/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */
struct acpi_mcfg_allocation *pci_mmcfg_config;
int pci_mmcfg_config_num;
static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
{
if (!strcmp(mcfg->header.oem_id, "SGI"))
acpi_mcfg_64bit_base_addr = TRUE;
return 0;
}
static int __init pci_parse_mcfg(struct acpi_table_header *header)
{
struct acpi_table_mcfg *mcfg;
unsigned long i;
int config_size;
if (!header)
return -EINVAL;
mcfg = (struct acpi_table_mcfg *)header;
/* how many config structures do we have */
pci_mmcfg_config_num = 0;
i = header->length - sizeof(struct acpi_table_mcfg);
while (i >= sizeof(struct acpi_mcfg_allocation)) {
++pci_mmcfg_config_num;
i -= sizeof(struct acpi_mcfg_allocation);
};
if (pci_mmcfg_config_num == 0) {
printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
return -ENODEV;
}
config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config);
pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL);
if (!pci_mmcfg_config) {
printk(KERN_WARNING PREFIX
"No memory for MCFG config tables\n");
return -ENOMEM;
}
memcpy(pci_mmcfg_config, &mcfg[1], config_size);
acpi_mcfg_oem_check(mcfg);
for (i = 0; i < pci_mmcfg_config_num; ++i) {
if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) &&
!acpi_mcfg_64bit_base_addr) {
printk(KERN_ERR PREFIX
"MMCONFIG not in low 4GB of memory\n");
kfree(pci_mmcfg_config);
pci_mmcfg_config_num = 0;
return -ENODEV;
}
}
return 0;
}
static void __init __pci_mmcfg_init(int early) static void __init __pci_mmcfg_init(int early)
{ {
/* MMCONFIG disabled */ /* MMCONFIG disabled */
...@@ -543,7 +606,7 @@ static void __init __pci_mmcfg_init(int early) ...@@ -543,7 +606,7 @@ static void __init __pci_mmcfg_init(int early)
} }
if (!known_bridge) if (!known_bridge)
acpi_table_parse(ACPI_SIG_MCFG, acpi_parse_mcfg); acpi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
pci_mmcfg_reject_broken(early); pci_mmcfg_reject_broken(early);
......
...@@ -61,6 +61,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file); ...@@ -61,6 +61,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
static int acpi_ac_add(struct acpi_device *device); static int acpi_ac_add(struct acpi_device *device);
static int acpi_ac_remove(struct acpi_device *device, int type); static int acpi_ac_remove(struct acpi_device *device, int type);
static int acpi_ac_resume(struct acpi_device *device); static int acpi_ac_resume(struct acpi_device *device);
static void acpi_ac_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id ac_device_ids[] = { static const struct acpi_device_id ac_device_ids[] = {
{"ACPI0003", 0}, {"ACPI0003", 0},
...@@ -72,10 +73,12 @@ static struct acpi_driver acpi_ac_driver = { ...@@ -72,10 +73,12 @@ static struct acpi_driver acpi_ac_driver = {
.name = "ac", .name = "ac",
.class = ACPI_AC_CLASS, .class = ACPI_AC_CLASS,
.ids = ac_device_ids, .ids = ac_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = { .ops = {
.add = acpi_ac_add, .add = acpi_ac_add,
.remove = acpi_ac_remove, .remove = acpi_ac_remove,
.resume = acpi_ac_resume, .resume = acpi_ac_resume,
.notify = acpi_ac_notify,
}, },
}; };
...@@ -220,16 +223,14 @@ static int acpi_ac_remove_fs(struct acpi_device *device) ...@@ -220,16 +223,14 @@ static int acpi_ac_remove_fs(struct acpi_device *device)
Driver Model Driver Model
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) static void acpi_ac_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_ac *ac = data; struct acpi_ac *ac = acpi_driver_data(device);
struct acpi_device *device = NULL;
if (!ac) if (!ac)
return; return;
device = ac->device;
switch (event) { switch (event) {
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
...@@ -253,7 +254,6 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data) ...@@ -253,7 +254,6 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
static int acpi_ac_add(struct acpi_device *device) static int acpi_ac_add(struct acpi_device *device)
{ {
int result = 0; int result = 0;
acpi_status status = AE_OK;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
...@@ -286,13 +286,6 @@ static int acpi_ac_add(struct acpi_device *device) ...@@ -286,13 +286,6 @@ static int acpi_ac_add(struct acpi_device *device)
ac->charger.get_property = get_ac_property; ac->charger.get_property = get_ac_property;
power_supply_register(&ac->device->dev, &ac->charger); power_supply_register(&ac->device->dev, &ac->charger);
#endif #endif
status = acpi_install_notify_handler(device->handle,
ACPI_ALL_NOTIFY, acpi_ac_notify,
ac);
if (ACPI_FAILURE(status)) {
result = -ENODEV;
goto end;
}
printk(KERN_INFO PREFIX "%s [%s] (%s)\n", printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
...@@ -328,7 +321,6 @@ static int acpi_ac_resume(struct acpi_device *device) ...@@ -328,7 +321,6 @@ static int acpi_ac_resume(struct acpi_device *device)
static int acpi_ac_remove(struct acpi_device *device, int type) static int acpi_ac_remove(struct acpi_device *device, int type)
{ {
acpi_status status = AE_OK;
struct acpi_ac *ac = NULL; struct acpi_ac *ac = NULL;
...@@ -337,8 +329,6 @@ static int acpi_ac_remove(struct acpi_device *device, int type) ...@@ -337,8 +329,6 @@ static int acpi_ac_remove(struct acpi_device *device, int type)
ac = acpi_driver_data(device); ac = acpi_driver_data(device);
status = acpi_remove_notify_handler(device->handle,
ACPI_ALL_NOTIFY, acpi_ac_notify);
#ifdef CONFIG_ACPI_SYSFS_POWER #ifdef CONFIG_ACPI_SYSFS_POWER
if (ac->charger.dev) if (ac->charger.dev)
power_supply_unregister(&ac->charger); power_supply_unregister(&ac->charger);
......
...@@ -796,13 +796,12 @@ static void acpi_battery_remove_fs(struct acpi_device *device) ...@@ -796,13 +796,12 @@ static void acpi_battery_remove_fs(struct acpi_device *device)
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) static void acpi_battery_notify(struct acpi_device *device, u32 event)
{ {
struct acpi_battery *battery = data; struct acpi_battery *battery = acpi_driver_data(device);
struct acpi_device *device;
if (!battery) if (!battery)
return; return;
device = battery->device;
acpi_battery_update(battery); acpi_battery_update(battery);
acpi_bus_generate_proc_event(device, event, acpi_bus_generate_proc_event(device, event,
acpi_battery_present(battery)); acpi_battery_present(battery));
...@@ -819,7 +818,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data) ...@@ -819,7 +818,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
static int acpi_battery_add(struct acpi_device *device) static int acpi_battery_add(struct acpi_device *device)
{ {
int result = 0; int result = 0;
acpi_status status = 0;
struct acpi_battery *battery = NULL; struct acpi_battery *battery = NULL;
if (!device) if (!device)
return -EINVAL; return -EINVAL;
...@@ -834,22 +832,12 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -834,22 +832,12 @@ static int acpi_battery_add(struct acpi_device *device)
acpi_battery_update(battery); acpi_battery_update(battery);
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
result = acpi_battery_add_fs(device); result = acpi_battery_add_fs(device);
if (result)
goto end;
#endif #endif
status = acpi_install_notify_handler(device->handle, if (!result) {
ACPI_ALL_NOTIFY,
acpi_battery_notify, battery);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "Installing notify handler"));
result = -ENODEV;
goto end;
}
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n", printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device), ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
device->status.battery_present ? "present" : "absent"); device->status.battery_present ? "present" : "absent");
end: } else {
if (result) {
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device); acpi_battery_remove_fs(device);
#endif #endif
...@@ -860,15 +848,11 @@ static int acpi_battery_add(struct acpi_device *device) ...@@ -860,15 +848,11 @@ static int acpi_battery_add(struct acpi_device *device)
static int acpi_battery_remove(struct acpi_device *device, int type) static int acpi_battery_remove(struct acpi_device *device, int type)
{ {
acpi_status status = 0;
struct acpi_battery *battery = NULL; struct acpi_battery *battery = NULL;
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return -EINVAL; return -EINVAL;
battery = acpi_driver_data(device); battery = acpi_driver_data(device);
status = acpi_remove_notify_handler(device->handle,
ACPI_ALL_NOTIFY,
acpi_battery_notify);
#ifdef CONFIG_ACPI_PROCFS_POWER #ifdef CONFIG_ACPI_PROCFS_POWER
acpi_battery_remove_fs(device); acpi_battery_remove_fs(device);
#endif #endif
...@@ -896,10 +880,12 @@ static struct acpi_driver acpi_battery_driver = { ...@@ -896,10 +880,12 @@ static struct acpi_driver acpi_battery_driver = {
.name = "battery", .name = "battery",
.class = ACPI_BATTERY_CLASS, .class = ACPI_BATTERY_CLASS,
.ids = battery_device_ids, .ids = battery_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = { .ops = {
.add = acpi_battery_add, .add = acpi_battery_add,
.resume = acpi_battery_resume, .resume = acpi_battery_resume,
.remove = acpi_battery_remove, .remove = acpi_battery_remove,
.notify = acpi_battery_notify,
}, },
}; };
......
...@@ -192,6 +192,22 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { ...@@ -192,6 +192,22 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"), DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile V5505"),
}, },
}, },
{
.callback = dmi_disable_osi_vista,
.ident = "Sony VGN-NS10J_S",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NS10J_S"),
},
},
{
.callback = dmi_disable_osi_vista,
.ident = "Sony VGN-SR290J",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "Sony VGN-SR290J"),
},
},
/* /*
* BIOS invocation of _OSI(Linux) is almost always a BIOS bug. * BIOS invocation of _OSI(Linux) is almost always a BIOS bug.
......
...@@ -450,18 +450,16 @@ int acpi_bus_receive_event(struct acpi_bus_event *event) ...@@ -450,18 +450,16 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
Notification Handling Notification Handling
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static int static void acpi_bus_check_device(acpi_handle handle)
acpi_bus_check_device(struct acpi_device *device, int *status_changed)
{ {
acpi_status status = 0; struct acpi_device *device;
acpi_status status;
struct acpi_device_status old_status; struct acpi_device_status old_status;
if (acpi_bus_get_device(handle, &device))
return;
if (!device) if (!device)
return -EINVAL; return;
if (status_changed)
*status_changed = 0;
old_status = device->status; old_status = device->status;
...@@ -471,22 +469,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) ...@@ -471,22 +469,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
*/ */
if (device->parent && !device->parent->status.present) { if (device->parent && !device->parent->status.present) {
device->status = device->parent->status; device->status = device->parent->status;
if (STRUCT_TO_INT(old_status) != STRUCT_TO_INT(device->status)) { return;
if (status_changed)
*status_changed = 1;
}
return 0;
} }
status = acpi_bus_get_status(device); status = acpi_bus_get_status(device);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return;
if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status)) if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
return 0; return;
if (status_changed)
*status_changed = 1;
/* /*
* Device Insertion/Removal * Device Insertion/Removal
...@@ -498,33 +489,17 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed) ...@@ -498,33 +489,17 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n")); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
/* TBD: Handle device removal */ /* TBD: Handle device removal */
} }
return 0;
} }
static int acpi_bus_check_scope(struct acpi_device *device) static void acpi_bus_check_scope(acpi_handle handle)
{ {
int result = 0;
int status_changed = 0;
if (!device)
return -EINVAL;
/* Status Change? */ /* Status Change? */
result = acpi_bus_check_device(device, &status_changed); acpi_bus_check_device(handle);
if (result)
return result;
if (!status_changed)
return 0;
/* /*
* TBD: Enumerate child devices within this device's scope and * TBD: Enumerate child devices within this device's scope and
* run acpi_bus_check_device()'s on them. * run acpi_bus_check_device()'s on them.
*/ */
return 0;
} }
static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list); static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list);
...@@ -547,22 +522,19 @@ EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier); ...@@ -547,22 +522,19 @@ EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier);
*/ */
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
{ {
int result = 0;
struct acpi_device *device = NULL; struct acpi_device *device = NULL;
struct acpi_driver *driver;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n",
type, handle));
blocking_notifier_call_chain(&acpi_bus_notify_list, blocking_notifier_call_chain(&acpi_bus_notify_list,
type, (void *)handle); type, (void *)handle);
if (acpi_bus_get_device(handle, &device))
return;
switch (type) { switch (type) {
case ACPI_NOTIFY_BUS_CHECK: case ACPI_NOTIFY_BUS_CHECK:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, acpi_bus_check_scope(handle);
"Received BUS CHECK notification for device [%s]\n",
device->pnp.bus_id));
result = acpi_bus_check_scope(device);
/* /*
* TBD: We'll need to outsource certain events to non-ACPI * TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c). * drivers via the device manager (device.c).
...@@ -570,10 +542,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -570,10 +542,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break; break;
case ACPI_NOTIFY_DEVICE_CHECK: case ACPI_NOTIFY_DEVICE_CHECK:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, acpi_bus_check_device(handle);
"Received DEVICE CHECK notification for device [%s]\n",
device->pnp.bus_id));
result = acpi_bus_check_device(device, NULL);
/* /*
* TBD: We'll need to outsource certain events to non-ACPI * TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c). * drivers via the device manager (device.c).
...@@ -581,44 +550,26 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -581,44 +550,26 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break; break;
case ACPI_NOTIFY_DEVICE_WAKE: case ACPI_NOTIFY_DEVICE_WAKE:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE WAKE notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */ /* TBD */
break; break;
case ACPI_NOTIFY_EJECT_REQUEST: case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received EJECT REQUEST notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */ /* TBD */
break; break;
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT: case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE CHECK LIGHT notification for device [%s]\n",
device->pnp.bus_id));
/* TBD: Exactly what does 'light' mean? */ /* TBD: Exactly what does 'light' mean? */
break; break;
case ACPI_NOTIFY_FREQUENCY_MISMATCH: case ACPI_NOTIFY_FREQUENCY_MISMATCH:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received FREQUENCY MISMATCH notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */ /* TBD */
break; break;
case ACPI_NOTIFY_BUS_MODE_MISMATCH: case ACPI_NOTIFY_BUS_MODE_MISMATCH:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received BUS MODE MISMATCH notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */ /* TBD */
break; break;
case ACPI_NOTIFY_POWER_FAULT: case ACPI_NOTIFY_POWER_FAULT:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received POWER FAULT notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */ /* TBD */
break; break;
...@@ -629,7 +580,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) ...@@ -629,7 +580,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break; break;
} }
return; acpi_bus_get_device(handle, &device);
if (device) {
driver = device->driver;
if (driver && driver->ops.notify &&
(driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
driver->ops.notify(device, type);
}
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
......
...@@ -140,46 +140,6 @@ struct device *acpi_get_physical_device(acpi_handle handle) ...@@ -140,46 +140,6 @@ struct device *acpi_get_physical_device(acpi_handle handle)
EXPORT_SYMBOL(acpi_get_physical_device); EXPORT_SYMBOL(acpi_get_physical_device);
/* ToDo: When a PCI bridge is found, return the PCI device behind the bridge
* This should work in general, but did not on a Lenovo T61 for the
* graphics card. But this must be fixed when the PCI device is
* bound and the kernel device struct is attached to the acpi device
* Note: A success call will increase reference count by one
* Do call put_device(dev) on the returned device then
*/
struct device *acpi_get_physical_pci_device(acpi_handle handle)
{
struct device *dev;
long long device_id;
acpi_status status;
status =
acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
if (ACPI_FAILURE(status))
return NULL;
/* We need to attempt to determine whether the _ADR refers to a
PCI device or not. There's no terribly good way to do this,
so the best we can hope for is to assume that there'll never
be a device in the host bridge */
if (device_id >= 0x10000) {
/* It looks like a PCI device. Does it exist? */
dev = acpi_get_physical_device(handle);
} else {
/* It doesn't look like a PCI device. Does its parent
exist? */
acpi_handle phandle;
if (acpi_get_parent(handle, &phandle))
return NULL;
dev = acpi_get_physical_device(phandle);
}
if (!dev)
return NULL;
return dev;
}
EXPORT_SYMBOL(acpi_get_physical_pci_device);
static int acpi_bind_one(struct device *dev, acpi_handle handle) static int acpi_bind_one(struct device *dev, acpi_handle handle)
{ {
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
......
...@@ -79,6 +79,7 @@ static acpi_osd_handler acpi_irq_handler; ...@@ -79,6 +79,7 @@ static acpi_osd_handler acpi_irq_handler;
static void *acpi_irq_context; static void *acpi_irq_context;
static struct workqueue_struct *kacpid_wq; static struct workqueue_struct *kacpid_wq;
static struct workqueue_struct *kacpi_notify_wq; static struct workqueue_struct *kacpi_notify_wq;
static struct workqueue_struct *kacpi_hotplug_wq;
struct acpi_res_list { struct acpi_res_list {
resource_size_t start; resource_size_t start;
...@@ -192,8 +193,10 @@ acpi_status acpi_os_initialize1(void) ...@@ -192,8 +193,10 @@ acpi_status acpi_os_initialize1(void)
{ {
kacpid_wq = create_singlethread_workqueue("kacpid"); kacpid_wq = create_singlethread_workqueue("kacpid");
kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify");
kacpi_hotplug_wq = create_singlethread_workqueue("kacpi_hotplug");
BUG_ON(!kacpid_wq); BUG_ON(!kacpid_wq);
BUG_ON(!kacpi_notify_wq); BUG_ON(!kacpi_notify_wq);
BUG_ON(!kacpi_hotplug_wq);
return AE_OK; return AE_OK;
} }
...@@ -206,6 +209,7 @@ acpi_status acpi_os_terminate(void) ...@@ -206,6 +209,7 @@ acpi_status acpi_os_terminate(void)
destroy_workqueue(kacpid_wq); destroy_workqueue(kacpid_wq);
destroy_workqueue(kacpi_notify_wq); destroy_workqueue(kacpi_notify_wq);
destroy_workqueue(kacpi_hotplug_wq);
return AE_OK; return AE_OK;
} }
...@@ -716,6 +720,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, ...@@ -716,6 +720,7 @@ static acpi_status __acpi_os_execute(acpi_execute_type type,
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_os_dpc *dpc; struct acpi_os_dpc *dpc;
struct workqueue_struct *queue; struct workqueue_struct *queue;
work_func_t func;
int ret; int ret;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Scheduling function [%p(%p)] for deferred execution.\n", "Scheduling function [%p(%p)] for deferred execution.\n",
...@@ -740,15 +745,17 @@ static acpi_status __acpi_os_execute(acpi_execute_type type, ...@@ -740,15 +745,17 @@ static acpi_status __acpi_os_execute(acpi_execute_type type,
dpc->function = function; dpc->function = function;
dpc->context = context; dpc->context = context;
if (!hp) { /*
INIT_WORK(&dpc->work, acpi_os_execute_deferred); * We can't run hotplug code in keventd_wq/kacpid_wq/kacpid_notify_wq
queue = (type == OSL_NOTIFY_HANDLER) ? * because the hotplug code may call driver .remove() functions,
kacpi_notify_wq : kacpid_wq; * which invoke flush_scheduled_work/acpi_os_wait_events_complete
* to flush these workqueues.
*/
queue = hp ? kacpi_hotplug_wq :
(type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq);
func = hp ? acpi_os_execute_hp_deferred : acpi_os_execute_deferred;
INIT_WORK(&dpc->work, func);
ret = queue_work(queue, &dpc->work); ret = queue_work(queue, &dpc->work);
} else {
INIT_WORK(&dpc->work, acpi_os_execute_hp_deferred);
ret = schedule_work(&dpc->work);
}
if (!ret) { if (!ret) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
......
...@@ -24,12 +24,7 @@ ...@@ -24,12 +24,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/pm.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
...@@ -38,310 +33,76 @@ ...@@ -38,310 +33,76 @@
#define _COMPONENT ACPI_PCI_COMPONENT #define _COMPONENT ACPI_PCI_COMPONENT
ACPI_MODULE_NAME("pci_bind"); ACPI_MODULE_NAME("pci_bind");
struct acpi_pci_data { static int acpi_pci_unbind(struct acpi_device *device)
struct acpi_pci_id id;
struct pci_bus *bus;
struct pci_dev *dev;
};
static int acpi_pci_unbind(struct acpi_device *device);
static void acpi_pci_data_handler(acpi_handle handle, u32 function,
void *context)
{
/* TBD: Anything we need to do here? */
return;
}
/**
* acpi_get_pci_id
* ------------------
* This function is used by the ACPI Interpreter (a.k.a. Core Subsystem)
* to resolve PCI information for ACPI-PCI devices defined in the namespace.
* This typically occurs when resolving PCI operation region information.
*/
acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
{ {
int result = 0; struct pci_dev *dev;
acpi_status status = AE_OK;
struct acpi_device *device = NULL;
struct acpi_pci_data *data = NULL;
if (!id)
return AE_BAD_PARAMETER;
result = acpi_bus_get_device(handle, &device);
if (result) {
printk(KERN_ERR PREFIX
"Invalid ACPI Bus context for device %s\n",
acpi_device_bid(device));
return AE_NOT_EXIST;
}
status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
if (ACPI_FAILURE(status) || !data) {
ACPI_EXCEPTION((AE_INFO, status,
"Invalid ACPI-PCI context for device %s",
acpi_device_bid(device)));
return status;
}
*id = data->id; dev = acpi_get_pci_dev(device->handle);
if (!dev || !dev->subordinate)
goto out;
/* acpi_pci_irq_del_prt(dev->subordinate);
id->segment = data->id.segment;
id->bus = data->id.bus;
id->device = data->id.device;
id->function = data->id.function;
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO, device->ops.bind = NULL;
"Device %s has PCI address %04x:%02x:%02x.%d\n", device->ops.unbind = NULL;
acpi_device_bid(device), id->segment, id->bus,
id->device, id->function));
return AE_OK; out:
pci_dev_put(dev);
return 0;
} }
EXPORT_SYMBOL(acpi_get_pci_id); static int acpi_pci_bind(struct acpi_device *device)
int acpi_pci_bind(struct acpi_device *device)
{ {
int result = 0;
acpi_status status; acpi_status status;
struct acpi_pci_data *data;
struct acpi_pci_data *pdata;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_handle handle; acpi_handle handle;
struct pci_bus *bus;
struct pci_dev *dev;
if (!device || !device->parent) dev = acpi_get_pci_dev(device->handle);
return -EINVAL; if (!dev)
return 0;
data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
if (ACPI_FAILURE(status)) {
kfree(data);
return -ENODEV;
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
(char *)buffer.pointer));
/*
* Segment & Bus
* -------------
* These are obtained via the parent device's ACPI-PCI context.
*/
status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
(void **)&pdata);
if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
ACPI_EXCEPTION((AE_INFO, status,
"Invalid ACPI-PCI context for parent device %s",
acpi_device_bid(device->parent)));
result = -ENODEV;
goto end;
}
data->id.segment = pdata->id.segment;
data->id.bus = pdata->bus->number;
/*
* Device & Function
* -----------------
* These are simply obtained from the device's _ADR method. Note
* that a value of zero is valid.
*/
data->id.device = device->pnp.bus_address >> 16;
data->id.function = device->pnp.bus_address & 0xFFFF;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %04x:%02x:%02x.%d\n",
data->id.segment, data->id.bus, data->id.device,
data->id.function));
/*
* TBD: Support slot devices (e.g. function=0xFFFF).
*/
/*
* Locate PCI Device
* -----------------
* Locate matching device in PCI namespace. If it doesn't exist
* this typically means that the device isn't currently inserted
* (e.g. docking station, port replicator, etc.).
*/
data->dev = pci_get_slot(pdata->bus,
PCI_DEVFN(data->id.device, data->id.function));
if (!data->dev) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Device %04x:%02x:%02x.%d not present in PCI namespace\n",
data->id.segment, data->id.bus,
data->id.device, data->id.function));
result = -ENODEV;
goto end;
}
if (!data->dev->bus) {
printk(KERN_ERR PREFIX
"Device %04x:%02x:%02x.%d has invalid 'bus' field\n",
data->id.segment, data->id.bus,
data->id.device, data->id.function);
result = -ENODEV;
goto end;
}
/* /*
* PCI Bridge? * Install the 'bind' function to facilitate callbacks for
* ----------- * children of the P2P bridge.
* If so, set the 'bus' field and install the 'bind' function to
* facilitate callbacks for all of its children.
*/ */
if (data->dev->subordinate) { if (dev->subordinate) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Device %04x:%02x:%02x.%d is a PCI bridge\n", "Device %04x:%02x:%02x.%d is a PCI bridge\n",
data->id.segment, data->id.bus, pci_domain_nr(dev->bus), dev->bus->number,
data->id.device, data->id.function)); PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)));
data->bus = data->dev->subordinate;
device->ops.bind = acpi_pci_bind; device->ops.bind = acpi_pci_bind;
device->ops.unbind = acpi_pci_unbind; device->ops.unbind = acpi_pci_unbind;
} }
/* /*
* Attach ACPI-PCI Context * Evaluate and parse _PRT, if exists. This code allows parsing of
* ----------------------- * _PRT objects within the scope of non-bridge devices. Note that
* Thus binding the ACPI and PCI devices. * _PRTs within the scope of a PCI bridge assume the bridge's
*/ * subordinate bus number.
status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Unable to attach ACPI-PCI context to device %s",
acpi_device_bid(device)));
result = -ENODEV;
goto end;
}
/*
* PCI Routing Table
* -----------------
* Evaluate and parse _PRT, if exists. This code is independent of
* PCI bridges (above) to allow parsing of _PRT objects within the
* scope of non-bridge devices. Note that _PRTs within the scope of
* a PCI bridge assume the bridge's subordinate bus number.
* *
* TBD: Can _PRTs exist within the scope of non-bridge PCI devices? * TBD: Can _PRTs exist within the scope of non-bridge PCI devices?
*/ */
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle); status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
if (ACPI_SUCCESS(status)) {
if (data->bus) /* PCI-PCI bridge */
acpi_pci_irq_add_prt(device->handle, data->id.segment,
data->bus->number);
else /* non-bridge PCI device */
acpi_pci_irq_add_prt(device->handle, data->id.segment,
data->id.bus);
}
end:
kfree(buffer.pointer);
if (result) {
pci_dev_put(data->dev);
kfree(data);
}
return result;
}
static int acpi_pci_unbind(struct acpi_device *device)
{
int result = 0;
acpi_status status;
struct acpi_pci_data *data;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
if (!device || !device->parent)
return -EINVAL;
status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; goto out;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n", if (dev->subordinate)
(char *) buffer.pointer)); bus = dev->subordinate;
kfree(buffer.pointer); else
bus = dev->bus;
status = acpi_pci_irq_add_prt(device->handle, bus);
acpi_get_data(device->handle, acpi_pci_data_handler,
(void **)&data);
if (ACPI_FAILURE(status)) {
result = -ENODEV;
goto end;
}
status = acpi_detach_data(device->handle, acpi_pci_data_handler); out:
if (ACPI_FAILURE(status)) { pci_dev_put(dev);
ACPI_EXCEPTION((AE_INFO, status, return 0;
"Unable to detach data from device %s",
acpi_device_bid(device)));
result = -ENODEV;
goto end;
}
if (data->dev->subordinate) {
acpi_pci_irq_del_prt(data->id.segment, data->bus->number);
}
pci_dev_put(data->dev);
kfree(data);
end:
return result;
} }
int int acpi_pci_bind_root(struct acpi_device *device)
acpi_pci_bind_root(struct acpi_device *device,
struct acpi_pci_id *id, struct pci_bus *bus)
{ {
int result = 0;
acpi_status status;
struct acpi_pci_data *data = NULL;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
if (!device || !id || !bus) {
return -EINVAL;
}
data = kzalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->id = *id;
data->bus = bus;
device->ops.bind = acpi_pci_bind; device->ops.bind = acpi_pci_bind;
device->ops.unbind = acpi_pci_unbind; device->ops.unbind = acpi_pci_unbind;
status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer); return 0;
if (ACPI_FAILURE(status)) {
kfree (data);
return -ENODEV;
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to "
"%04x:%02x\n", (char *)buffer.pointer,
id->segment, id->bus));
status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status,
"Unable to attach ACPI-PCI context to device %s",
(char *)buffer.pointer));
result = -ENODEV;
goto end;
}
end:
kfree(buffer.pointer);
if (result != 0)
kfree(data);
return result;
} }
...@@ -182,7 +182,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, ...@@ -182,7 +182,7 @@ static void do_prt_fixups(struct acpi_prt_entry *entry,
} }
} }
static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, static int acpi_pci_irq_add_entry(acpi_handle handle, struct pci_bus *bus,
struct acpi_pci_routing_table *prt) struct acpi_pci_routing_table *prt)
{ {
struct acpi_prt_entry *entry; struct acpi_prt_entry *entry;
...@@ -196,8 +196,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, ...@@ -196,8 +196,8 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus,
* 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert * 1=INTA, 2=INTB. We use the PCI encoding throughout, so convert
* it here. * it here.
*/ */
entry->id.segment = segment; entry->id.segment = pci_domain_nr(bus);
entry->id.bus = bus; entry->id.bus = bus->number;
entry->id.device = (prt->address >> 16) & 0xFFFF; entry->id.device = (prt->address >> 16) & 0xFFFF;
entry->pin = prt->pin + 1; entry->pin = prt->pin + 1;
...@@ -242,7 +242,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus, ...@@ -242,7 +242,7 @@ static int acpi_pci_irq_add_entry(acpi_handle handle, int segment, int bus,
return 0; return 0;
} }
int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus)
{ {
acpi_status status; acpi_status status;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
...@@ -271,7 +271,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) ...@@ -271,7 +271,7 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
entry = buffer.pointer; entry = buffer.pointer;
while (entry && (entry->length > 0)) { while (entry && (entry->length > 0)) {
acpi_pci_irq_add_entry(handle, segment, bus, entry); acpi_pci_irq_add_entry(handle, bus, entry);
entry = (struct acpi_pci_routing_table *) entry = (struct acpi_pci_routing_table *)
((unsigned long)entry + entry->length); ((unsigned long)entry + entry->length);
} }
...@@ -280,16 +280,17 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus) ...@@ -280,16 +280,17 @@ int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
return 0; return 0;
} }
void acpi_pci_irq_del_prt(int segment, int bus) void acpi_pci_irq_del_prt(struct pci_bus *bus)
{ {
struct acpi_prt_entry *entry, *tmp; struct acpi_prt_entry *entry, *tmp;
printk(KERN_DEBUG printk(KERN_DEBUG
"ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n", "ACPI: Delete PCI Interrupt Routing Table for %04x:%02x\n",
segment, bus); pci_domain_nr(bus), bus->number);
spin_lock(&acpi_prt_lock); spin_lock(&acpi_prt_lock);
list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) { list_for_each_entry_safe(entry, tmp, &acpi_prt_list, list) {
if (segment == entry->id.segment && bus == entry->id.bus) { if (pci_domain_nr(bus) == entry->id.segment
&& bus->number == entry->id.bus) {
list_del(&entry->list); list_del(&entry->list);
kfree(entry); kfree(entry);
} }
......
This diff is collapsed.
...@@ -194,7 +194,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) ...@@ -194,7 +194,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state)
static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
{ {
int result = 0, state; int result = 0;
int found = 0; int found = 0;
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
...@@ -236,18 +236,6 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) ...@@ -236,18 +236,6 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
if (!acpi_power_nocheck) {
/*
* If acpi_power_nocheck is set, it is unnecessary to check
* the power state after power transition.
*/
result = acpi_power_get_state(resource->device->handle,
&state);
if (result)
return result;
if (state != ACPI_POWER_RESOURCE_STATE_ON)
return -ENOEXEC;
}
/* Update the power resource's _device_ power state */ /* Update the power resource's _device_ power state */
resource->device->power.state = ACPI_STATE_D0; resource->device->power.state = ACPI_STATE_D0;
...@@ -258,7 +246,7 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev) ...@@ -258,7 +246,7 @@ static int acpi_power_on(acpi_handle handle, struct acpi_device *dev)
static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
{ {
int result = 0, state; int result = 0;
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_power_resource *resource = NULL; struct acpi_power_resource *resource = NULL;
struct list_head *node, *next; struct list_head *node, *next;
...@@ -293,18 +281,6 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev) ...@@ -293,18 +281,6 @@ static int acpi_power_off_device(acpi_handle handle, struct acpi_device *dev)
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; return -ENODEV;
if (!acpi_power_nocheck) {
/*
* If acpi_power_nocheck is set, it is unnecessary to check
* the power state after power transition.
*/
result = acpi_power_get_state(handle, &state);
if (result)
return result;
if (state != ACPI_POWER_RESOURCE_STATE_OFF)
return -ENOEXEC;
}
/* Update the power resource's _device_ power state */ /* Update the power resource's _device_ power state */
resource->device->power.state = ACPI_STATE_D3; resource->device->power.state = ACPI_STATE_D3;
......
...@@ -89,7 +89,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr); ...@@ -89,7 +89,7 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr);
static const struct acpi_device_id processor_device_ids[] = { static const struct acpi_device_id processor_device_ids[] = {
{ACPI_PROCESSOR_OBJECT_HID, 0}, {ACPI_PROCESSOR_OBJECT_HID, 0},
{ACPI_PROCESSOR_HID, 0}, {"ACPI0007", 0},
{"", 0}, {"", 0},
}; };
MODULE_DEVICE_TABLE(acpi, processor_device_ids); MODULE_DEVICE_TABLE(acpi, processor_device_ids);
...@@ -596,7 +596,21 @@ static int acpi_processor_get_info(struct acpi_device *device) ...@@ -596,7 +596,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"No bus mastering arbitration control\n")); "No bus mastering arbitration control\n"));
if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_HID)) { if (!strcmp(acpi_device_hid(device), ACPI_PROCESSOR_OBJECT_HID)) {
/* Declared with "Processor" statement; match ProcessorID */
status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Evaluating processor object\n");
return -ENODEV;
}
/*
* TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
* >>> 'acpi_get_processor_id(acpi_id, &id)' in
* arch/xxx/acpi.c
*/
pr->acpi_id = object.processor.proc_id;
} else {
/* /*
* Declared with "Device" statement; match _UID. * Declared with "Device" statement; match _UID.
* Note that we don't handle string _UIDs yet. * Note that we don't handle string _UIDs yet.
...@@ -611,20 +625,6 @@ static int acpi_processor_get_info(struct acpi_device *device) ...@@ -611,20 +625,6 @@ static int acpi_processor_get_info(struct acpi_device *device)
} }
device_declaration = 1; device_declaration = 1;
pr->acpi_id = value; pr->acpi_id = value;
} else {
/* Declared with "Processor" statement; match ProcessorID */
status = acpi_evaluate_object(pr->handle, NULL, NULL, &buffer);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Evaluating processor object\n");
return -ENODEV;
}
/*
* TBD: Synch processor ID (via LAPIC/LSAPIC structures) on SMP.
* >>> 'acpi_get_processor_id(acpi_id, &id)' in
* arch/xxx/acpi.c
*/
pr->acpi_id = object.processor.proc_id;
} }
cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id); cpu_index = get_cpu_id(pr->handle, device_declaration, pr->acpi_id);
...@@ -649,7 +649,16 @@ static int acpi_processor_get_info(struct acpi_device *device) ...@@ -649,7 +649,16 @@ static int acpi_processor_get_info(struct acpi_device *device)
return -ENODEV; return -ENODEV;
} }
} }
/*
* On some boxes several processors use the same processor bus id.
* But they are located in different scope. For example:
* \_SB.SCK0.CPU0
* \_SB.SCK1.CPU0
* Rename the processor device bus id. And the new bus id will be
* generated as the following format:
* CPU+CPU ID.
*/
sprintf(acpi_device_bid(device), "CPU%X", pr->id);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id, ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Processor [%d:%d]\n", pr->id,
pr->acpi_id)); pr->acpi_id));
...@@ -731,6 +740,8 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) ...@@ -731,6 +740,8 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device)
/* _PDC call should be done before doing anything else (if reqd.). */ /* _PDC call should be done before doing anything else (if reqd.). */
arch_acpi_processor_init_pdc(pr); arch_acpi_processor_init_pdc(pr);
acpi_processor_set_pdc(pr); acpi_processor_set_pdc(pr);
arch_acpi_processor_cleanup_pdc(pr);
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
acpi_processor_ppc_has_changed(pr); acpi_processor_ppc_has_changed(pr);
#endif #endif
......
...@@ -139,7 +139,7 @@ static void acpi_safe_halt(void) ...@@ -139,7 +139,7 @@ static void acpi_safe_halt(void)
* are affected too. We pick the most conservative approach: we assume * are affected too. We pick the most conservative approach: we assume
* that the local APIC stops in both C2 and C3. * that the local APIC stops in both C2 and C3.
*/ */
static void acpi_timer_check_state(int state, struct acpi_processor *pr, static void lapic_timer_check_state(int state, struct acpi_processor *pr,
struct acpi_processor_cx *cx) struct acpi_processor_cx *cx)
{ {
struct acpi_processor_power *pwr = &pr->power; struct acpi_processor_power *pwr = &pr->power;
...@@ -162,7 +162,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr, ...@@ -162,7 +162,7 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
pr->power.timer_broadcast_on_state = state; pr->power.timer_broadcast_on_state = state;
} }
static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) static void lapic_timer_propagate_broadcast(struct acpi_processor *pr)
{ {
unsigned long reason; unsigned long reason;
...@@ -173,7 +173,7 @@ static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) ...@@ -173,7 +173,7 @@ static void acpi_propagate_timer_broadcast(struct acpi_processor *pr)
} }
/* Power(C) State timer broadcast control */ /* Power(C) State timer broadcast control */
static void acpi_state_timer_broadcast(struct acpi_processor *pr, static void lapic_timer_state_broadcast(struct acpi_processor *pr,
struct acpi_processor_cx *cx, struct acpi_processor_cx *cx,
int broadcast) int broadcast)
{ {
...@@ -190,10 +190,10 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr, ...@@ -190,10 +190,10 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
#else #else
static void acpi_timer_check_state(int state, struct acpi_processor *pr, static void lapic_timer_check_state(int state, struct acpi_processor *pr,
struct acpi_processor_cx *cstate) { } struct acpi_processor_cx *cstate) { }
static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) { } static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
static void acpi_state_timer_broadcast(struct acpi_processor *pr, static void lapic_timer_state_broadcast(struct acpi_processor *pr,
struct acpi_processor_cx *cx, struct acpi_processor_cx *cx,
int broadcast) int broadcast)
{ {
...@@ -515,7 +515,8 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) ...@@ -515,7 +515,8 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
static void acpi_processor_power_verify_c3(struct acpi_processor *pr, static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
struct acpi_processor_cx *cx) struct acpi_processor_cx *cx)
{ {
static int bm_check_flag; static int bm_check_flag = -1;
static int bm_control_flag = -1;
if (!cx->address) if (!cx->address)
...@@ -545,12 +546,14 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr, ...@@ -545,12 +546,14 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
} }
/* All the logic here assumes flags.bm_check is same across all CPUs */ /* All the logic here assumes flags.bm_check is same across all CPUs */
if (!bm_check_flag) { if (bm_check_flag == -1) {
/* Determine whether bm_check is needed based on CPU */ /* Determine whether bm_check is needed based on CPU */
acpi_processor_power_init_bm_check(&(pr->flags), pr->id); acpi_processor_power_init_bm_check(&(pr->flags), pr->id);
bm_check_flag = pr->flags.bm_check; bm_check_flag = pr->flags.bm_check;
bm_control_flag = pr->flags.bm_control;
} else { } else {
pr->flags.bm_check = bm_check_flag; pr->flags.bm_check = bm_check_flag;
pr->flags.bm_control = bm_control_flag;
} }
if (pr->flags.bm_check) { if (pr->flags.bm_check) {
...@@ -614,29 +617,25 @@ static int acpi_processor_power_verify(struct acpi_processor *pr) ...@@ -614,29 +617,25 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
switch (cx->type) { switch (cx->type) {
case ACPI_STATE_C1: case ACPI_STATE_C1:
cx->valid = 1; cx->valid = 1;
acpi_timer_check_state(i, pr, cx);
break; break;
case ACPI_STATE_C2: case ACPI_STATE_C2:
acpi_processor_power_verify_c2(cx); acpi_processor_power_verify_c2(cx);
if (cx->valid)
acpi_timer_check_state(i, pr, cx);
break; break;
case ACPI_STATE_C3: case ACPI_STATE_C3:
acpi_processor_power_verify_c3(pr, cx); acpi_processor_power_verify_c3(pr, cx);
if (cx->valid)
acpi_timer_check_state(i, pr, cx);
break; break;
} }
if (cx->valid) if (!cx->valid)
tsc_check_state(cx->type); continue;
if (cx->valid) lapic_timer_check_state(i, pr, cx);
tsc_check_state(cx->type);
working++; working++;
} }
acpi_propagate_timer_broadcast(pr); lapic_timer_propagate_broadcast(pr);
return (working); return (working);
} }
...@@ -839,7 +838,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, ...@@ -839,7 +838,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
return 0; return 0;
} }
acpi_state_timer_broadcast(pr, cx, 1); lapic_timer_state_broadcast(pr, cx, 1);
kt1 = ktime_get_real(); kt1 = ktime_get_real();
acpi_idle_do_entry(cx); acpi_idle_do_entry(cx);
kt2 = ktime_get_real(); kt2 = ktime_get_real();
...@@ -847,7 +846,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, ...@@ -847,7 +846,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
local_irq_enable(); local_irq_enable();
cx->usage++; cx->usage++;
acpi_state_timer_broadcast(pr, cx, 0); lapic_timer_state_broadcast(pr, cx, 0);
return idle_time; return idle_time;
} }
...@@ -892,7 +891,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, ...@@ -892,7 +891,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
* Must be done before busmaster disable as we might need to * Must be done before busmaster disable as we might need to
* access HPET ! * access HPET !
*/ */
acpi_state_timer_broadcast(pr, cx, 1); lapic_timer_state_broadcast(pr, cx, 1);
if (cx->type == ACPI_STATE_C3) if (cx->type == ACPI_STATE_C3)
ACPI_FLUSH_CPU_CACHE(); ACPI_FLUSH_CPU_CACHE();
...@@ -914,7 +913,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, ...@@ -914,7 +913,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
cx->usage++; cx->usage++;
acpi_state_timer_broadcast(pr, cx, 0); lapic_timer_state_broadcast(pr, cx, 0);
cx->time += sleep_ticks; cx->time += sleep_ticks;
return idle_time; return idle_time;
} }
...@@ -981,7 +980,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, ...@@ -981,7 +980,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
* Must be done before busmaster disable as we might need to * Must be done before busmaster disable as we might need to
* access HPET ! * access HPET !
*/ */
acpi_state_timer_broadcast(pr, cx, 1); lapic_timer_state_broadcast(pr, cx, 1);
kt1 = ktime_get_real(); kt1 = ktime_get_real();
/* /*
...@@ -1026,7 +1025,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, ...@@ -1026,7 +1025,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
cx->usage++; cx->usage++;
acpi_state_timer_broadcast(pr, cx, 0); lapic_timer_state_broadcast(pr, cx, 0);
cx->time += sleep_ticks; cx->time += sleep_ticks;
return idle_time; return idle_time;
} }
......
...@@ -95,7 +95,7 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha ...@@ -95,7 +95,7 @@ acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, cha
} }
static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL);
static int acpi_bus_hot_remove_device(void *context) static void acpi_bus_hot_remove_device(void *context)
{ {
struct acpi_device *device; struct acpi_device *device;
acpi_handle handle = context; acpi_handle handle = context;
...@@ -104,10 +104,10 @@ static int acpi_bus_hot_remove_device(void *context) ...@@ -104,10 +104,10 @@ static int acpi_bus_hot_remove_device(void *context)
acpi_status status = AE_OK; acpi_status status = AE_OK;
if (acpi_bus_get_device(handle, &device)) if (acpi_bus_get_device(handle, &device))
return 0; return;
if (!device) if (!device)
return 0; return;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Hot-removing device %s...\n", dev_name(&device->dev))); "Hot-removing device %s...\n", dev_name(&device->dev)));
...@@ -115,7 +115,7 @@ static int acpi_bus_hot_remove_device(void *context) ...@@ -115,7 +115,7 @@ static int acpi_bus_hot_remove_device(void *context)
if (acpi_bus_trim(device, 1)) { if (acpi_bus_trim(device, 1)) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Removing device failed\n"); "Removing device failed\n");
return -1; return;
} }
/* power off device */ /* power off device */
...@@ -142,9 +142,10 @@ static int acpi_bus_hot_remove_device(void *context) ...@@ -142,9 +142,10 @@ static int acpi_bus_hot_remove_device(void *context)
*/ */
status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL); status = acpi_evaluate_object(handle, "_EJ0", &arg_list, NULL);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -ENODEV; printk(KERN_WARNING PREFIX
"Eject device failed\n");
return 0; return;
} }
static ssize_t static ssize_t
...@@ -155,7 +156,6 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, ...@@ -155,7 +156,6 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
acpi_status status; acpi_status status;
acpi_object_type type = 0; acpi_object_type type = 0;
struct acpi_device *acpi_device = to_acpi_device(d); struct acpi_device *acpi_device = to_acpi_device(d);
struct task_struct *task;
if ((!count) || (buf[0] != '1')) { if ((!count) || (buf[0] != '1')) {
return -EINVAL; return -EINVAL;
...@@ -172,11 +172,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr, ...@@ -172,11 +172,7 @@ acpi_eject_store(struct device *d, struct device_attribute *attr,
goto err; goto err;
} }
/* remove the device in another thread to fix the deadlock issue */ acpi_os_hotplug_execute(acpi_bus_hot_remove_device, acpi_device->handle);
task = kthread_run(acpi_bus_hot_remove_device,
acpi_device->handle, "acpi_hot_remove_device");
if (IS_ERR(task))
ret = PTR_ERR(task);
err: err:
return ret; return ret;
} }
...@@ -198,12 +194,12 @@ acpi_device_path_show(struct device *dev, struct device_attribute *attr, char *b ...@@ -198,12 +194,12 @@ acpi_device_path_show(struct device *dev, struct device_attribute *attr, char *b
int result; int result;
result = acpi_get_name(acpi_dev->handle, ACPI_FULL_PATHNAME, &path); result = acpi_get_name(acpi_dev->handle, ACPI_FULL_PATHNAME, &path);
if(result) if (result)
goto end; goto end;
result = sprintf(buf, "%s\n", (char*)path.pointer); result = sprintf(buf, "%s\n", (char*)path.pointer);
kfree(path.pointer); kfree(path.pointer);
end: end:
return result; return result;
} }
static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL); static DEVICE_ATTR(path, 0444, acpi_device_path_show, NULL);
...@@ -217,21 +213,21 @@ static int acpi_device_setup_files(struct acpi_device *dev) ...@@ -217,21 +213,21 @@ static int acpi_device_setup_files(struct acpi_device *dev)
/* /*
* Devices gotten from FADT don't have a "path" attribute * Devices gotten from FADT don't have a "path" attribute
*/ */
if(dev->handle) { if (dev->handle) {
result = device_create_file(&dev->dev, &dev_attr_path); result = device_create_file(&dev->dev, &dev_attr_path);
if(result) if (result)
goto end; goto end;
} }
if(dev->flags.hardware_id) { if (dev->flags.hardware_id) {
result = device_create_file(&dev->dev, &dev_attr_hid); result = device_create_file(&dev->dev, &dev_attr_hid);
if(result) if (result)
goto end; goto end;
} }
if (dev->flags.hardware_id || dev->flags.compatible_ids){ if (dev->flags.hardware_id || dev->flags.compatible_ids) {
result = device_create_file(&dev->dev, &dev_attr_modalias); result = device_create_file(&dev->dev, &dev_attr_modalias);
if(result) if (result)
goto end; goto end;
} }
...@@ -242,7 +238,7 @@ static int acpi_device_setup_files(struct acpi_device *dev) ...@@ -242,7 +238,7 @@ static int acpi_device_setup_files(struct acpi_device *dev)
status = acpi_get_handle(dev->handle, "_EJ0", &temp); status = acpi_get_handle(dev->handle, "_EJ0", &temp);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
result = device_create_file(&dev->dev, &dev_attr_eject); result = device_create_file(&dev->dev, &dev_attr_eject);
end: end:
return result; return result;
} }
...@@ -262,9 +258,9 @@ static void acpi_device_remove_files(struct acpi_device *dev) ...@@ -262,9 +258,9 @@ static void acpi_device_remove_files(struct acpi_device *dev)
if (dev->flags.hardware_id || dev->flags.compatible_ids) if (dev->flags.hardware_id || dev->flags.compatible_ids)
device_remove_file(&dev->dev, &dev_attr_modalias); device_remove_file(&dev->dev, &dev_attr_modalias);
if(dev->flags.hardware_id) if (dev->flags.hardware_id)
device_remove_file(&dev->dev, &dev_attr_hid); device_remove_file(&dev->dev, &dev_attr_hid);
if(dev->handle) if (dev->handle)
device_remove_file(&dev->dev, &dev_attr_path); device_remove_file(&dev->dev, &dev_attr_path);
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
...@@ -512,7 +508,7 @@ static int acpi_device_register(struct acpi_device *device, ...@@ -512,7 +508,7 @@ static int acpi_device_register(struct acpi_device *device,
break; break;
} }
} }
if(!found) { if (!found) {
acpi_device_bus_id = new_bus_id; acpi_device_bus_id = new_bus_id;
strcpy(acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id : "device"); strcpy(acpi_device_bus_id->bus_id, device->flags.hardware_id ? device->pnp.hardware_id : "device");
acpi_device_bus_id->instance_no = 0; acpi_device_bus_id->instance_no = 0;
...@@ -530,22 +526,21 @@ static int acpi_device_register(struct acpi_device *device, ...@@ -530,22 +526,21 @@ static int acpi_device_register(struct acpi_device *device,
if (device->parent) if (device->parent)
device->dev.parent = &parent->dev; device->dev.parent = &parent->dev;
device->dev.bus = &acpi_bus_type; device->dev.bus = &acpi_bus_type;
device_initialize(&device->dev);
device->dev.release = &acpi_device_release; device->dev.release = &acpi_device_release;
result = device_add(&device->dev); result = device_register(&device->dev);
if(result) { if (result) {
dev_err(&device->dev, "Error adding device\n"); dev_err(&device->dev, "Error registering device\n");
goto end; goto end;
} }
result = acpi_device_setup_files(device); result = acpi_device_setup_files(device);
if(result) if (result)
printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n", printk(KERN_ERR PREFIX "Error creating sysfs interface for device %s\n",
dev_name(&device->dev)); dev_name(&device->dev));
device->removal_type = ACPI_BUS_REMOVAL_NORMAL; device->removal_type = ACPI_BUS_REMOVAL_NORMAL;
return 0; return 0;
end: end:
mutex_lock(&acpi_device_lock); mutex_lock(&acpi_device_lock);
if (device->parent) if (device->parent)
list_del(&device->node); list_del(&device->node);
...@@ -585,7 +580,6 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver) ...@@ -585,7 +580,6 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
{ {
int result = 0; int result = 0;
if (!device || !driver) if (!device || !driver)
return -EINVAL; return -EINVAL;
...@@ -802,7 +796,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) ...@@ -802,7 +796,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
if (!acpi_match_device_ids(device, button_device_ids)) if (!acpi_match_device_ids(device, button_device_ids))
device->wakeup.flags.run_wake = 1; device->wakeup.flags.run_wake = 1;
end: end:
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
device->flags.wake_capable = 0; device->flags.wake_capable = 0;
return 0; return 0;
...@@ -1320,7 +1314,7 @@ acpi_add_single_object(struct acpi_device **child, ...@@ -1320,7 +1314,7 @@ acpi_add_single_object(struct acpi_device **child,
device->parent->ops.bind(device); device->parent->ops.bind(device);
} }
end: end:
if (!result) if (!result)
*child = device; *child = device;
else { else {
...@@ -1464,7 +1458,6 @@ acpi_bus_add(struct acpi_device **child, ...@@ -1464,7 +1458,6 @@ acpi_bus_add(struct acpi_device **child,
return result; return result;
} }
EXPORT_SYMBOL(acpi_bus_add); EXPORT_SYMBOL(acpi_bus_add);
int acpi_bus_start(struct acpi_device *device) int acpi_bus_start(struct acpi_device *device)
...@@ -1484,7 +1477,6 @@ int acpi_bus_start(struct acpi_device *device) ...@@ -1484,7 +1477,6 @@ int acpi_bus_start(struct acpi_device *device)
} }
return result; return result;
} }
EXPORT_SYMBOL(acpi_bus_start); EXPORT_SYMBOL(acpi_bus_start);
int acpi_bus_trim(struct acpi_device *start, int rmdevice) int acpi_bus_trim(struct acpi_device *start, int rmdevice)
...@@ -1542,7 +1534,6 @@ int acpi_bus_trim(struct acpi_device *start, int rmdevice) ...@@ -1542,7 +1534,6 @@ int acpi_bus_trim(struct acpi_device *start, int rmdevice)
} }
EXPORT_SYMBOL_GPL(acpi_bus_trim); EXPORT_SYMBOL_GPL(acpi_bus_trim);
static int acpi_bus_scan_fixed(struct acpi_device *root) static int acpi_bus_scan_fixed(struct acpi_device *root)
{ {
int result = 0; int result = 0;
...@@ -1610,6 +1601,6 @@ int __init acpi_scan_init(void) ...@@ -1610,6 +1601,6 @@ int __init acpi_scan_init(void)
if (result) if (result)
acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
Done: Done:
return result; return result;
} }
...@@ -76,6 +76,7 @@ MODULE_LICENSE("GPL"); ...@@ -76,6 +76,7 @@ MODULE_LICENSE("GPL");
static int brightness_switch_enabled = 1; static int brightness_switch_enabled = 1;
module_param(brightness_switch_enabled, bool, 0644); module_param(brightness_switch_enabled, bool, 0644);
static int register_count = 0;
static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_add(struct acpi_device *device);
static int acpi_video_bus_remove(struct acpi_device *device, int type); static int acpi_video_bus_remove(struct acpi_device *device, int type);
static int acpi_video_resume(struct acpi_device *device); static int acpi_video_resume(struct acpi_device *device);
...@@ -586,6 +587,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = { ...@@ -586,6 +587,14 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"), DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5315"),
}, },
}, },
{
.callback = video_set_bqc_offset,
.ident = "Acer Aspire 7720",
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Acer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
},
},
{} {}
}; };
...@@ -976,6 +985,11 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) ...@@ -976,6 +985,11 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
device->backlight->props.max_brightness = device->brightness->count-3; device->backlight->props.max_brightness = device->brightness->count-3;
kfree(name); kfree(name);
result = sysfs_create_link(&device->backlight->dev.kobj,
&device->dev->dev.kobj, "device");
if (result)
printk(KERN_ERR PREFIX "Create sysfs link\n");
device->cdev = thermal_cooling_device_register("LCD", device->cdev = thermal_cooling_device_register("LCD",
device->dev, &video_cooling_ops); device->dev, &video_cooling_ops);
if (IS_ERR(device->cdev)) if (IS_ERR(device->cdev))
...@@ -1054,15 +1068,15 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video) ...@@ -1054,15 +1068,15 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
static int acpi_video_bus_check(struct acpi_video_bus *video) static int acpi_video_bus_check(struct acpi_video_bus *video)
{ {
acpi_status status = -ENOENT; acpi_status status = -ENOENT;
struct device *dev; struct pci_dev *dev;
if (!video) if (!video)
return -EINVAL; return -EINVAL;
dev = acpi_get_physical_pci_device(video->device->handle); dev = acpi_get_pci_dev(video->device->handle);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
put_device(dev); pci_dev_put(dev);
/* Since there is no HID, CID and so on for VGA driver, we have /* Since there is no HID, CID and so on for VGA driver, we have
* to check well known required nodes. * to check well known required nodes.
...@@ -1990,6 +2004,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) ...@@ -1990,6 +2004,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
status = acpi_remove_notify_handler(device->dev->handle, status = acpi_remove_notify_handler(device->dev->handle,
ACPI_DEVICE_NOTIFY, ACPI_DEVICE_NOTIFY,
acpi_video_device_notify); acpi_video_device_notify);
sysfs_remove_link(&device->backlight->dev.kobj, "device");
backlight_device_unregister(device->backlight); backlight_device_unregister(device->backlight);
if (device->cdev) { if (device->cdev) {
sysfs_remove_link(&device->dev->dev.kobj, sysfs_remove_link(&device->dev->dev.kobj,
...@@ -2318,6 +2333,13 @@ static int __init intel_opregion_present(void) ...@@ -2318,6 +2333,13 @@ static int __init intel_opregion_present(void)
int acpi_video_register(void) int acpi_video_register(void)
{ {
int result = 0; int result = 0;
if (register_count) {
/*
* if the function of acpi_video_register is already called,
* don't register the acpi_vide_bus again and return no error.
*/
return 0;
}
acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir); acpi_video_dir = proc_mkdir(ACPI_VIDEO_CLASS, acpi_root_dir);
if (!acpi_video_dir) if (!acpi_video_dir)
...@@ -2329,10 +2351,35 @@ int acpi_video_register(void) ...@@ -2329,10 +2351,35 @@ int acpi_video_register(void)
return -ENODEV; return -ENODEV;
} }
/*
* When the acpi_video_bus is loaded successfully, increase
* the counter reference.
*/
register_count = 1;
return 0; return 0;
} }
EXPORT_SYMBOL(acpi_video_register); EXPORT_SYMBOL(acpi_video_register);
void acpi_video_unregister(void)
{
if (!register_count) {
/*
* If the acpi video bus is already unloaded, don't
* unload it again and return directly.
*/
return;
}
acpi_bus_unregister_driver(&acpi_video_bus);
remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
register_count = 0;
return;
}
EXPORT_SYMBOL(acpi_video_unregister);
/* /*
* This is kind of nasty. Hardware using Intel chipsets may require * This is kind of nasty. Hardware using Intel chipsets may require
* the video opregion code to be run first in order to initialise * the video opregion code to be run first in order to initialise
...@@ -2350,16 +2397,12 @@ static int __init acpi_video_init(void) ...@@ -2350,16 +2397,12 @@ static int __init acpi_video_init(void)
return acpi_video_register(); return acpi_video_register();
} }
void acpi_video_exit(void) static void __exit acpi_video_exit(void)
{ {
acpi_video_unregister();
acpi_bus_unregister_driver(&acpi_video_bus);
remove_proc_entry(ACPI_VIDEO_CLASS, acpi_root_dir);
return; return;
} }
EXPORT_SYMBOL(acpi_video_exit);
module_init(acpi_video_init); module_init(acpi_video_init);
module_exit(acpi_video_exit); module_exit(acpi_video_exit);
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* assinged * assinged
* *
* After PCI devices are glued with ACPI devices * After PCI devices are glued with ACPI devices
* acpi_get_physical_pci_device() can be called to identify ACPI graphics * acpi_get_pci_dev() can be called to identify ACPI graphics
* devices for which a real graphics card is plugged in * devices for which a real graphics card is plugged in
* *
* Now acpi_video_get_capabilities() can be called to check which * Now acpi_video_get_capabilities() can be called to check which
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/pci.h>
ACPI_MODULE_NAME("video"); ACPI_MODULE_NAME("video");
#define _COMPONENT ACPI_VIDEO_COMPONENT #define _COMPONENT ACPI_VIDEO_COMPONENT
...@@ -109,7 +110,7 @@ static acpi_status ...@@ -109,7 +110,7 @@ static acpi_status
find_video(acpi_handle handle, u32 lvl, void *context, void **rv) find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
{ {
long *cap = context; long *cap = context;
struct device *dev; struct pci_dev *dev;
struct acpi_device *acpi_dev; struct acpi_device *acpi_dev;
const struct acpi_device_id video_ids[] = { const struct acpi_device_id video_ids[] = {
...@@ -120,10 +121,10 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -120,10 +121,10 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
return AE_OK; return AE_OK;
if (!acpi_match_device_ids(acpi_dev, video_ids)) { if (!acpi_match_device_ids(acpi_dev, video_ids)) {
dev = acpi_get_physical_pci_device(handle); dev = acpi_get_pci_dev(handle);
if (!dev) if (!dev)
return AE_OK; return AE_OK;
put_device(dev); pci_dev_put(dev);
*cap |= acpi_is_video_device(acpi_dev); *cap |= acpi_is_video_device(acpi_dev);
} }
return AE_OK; return AE_OK;
......
...@@ -419,7 +419,7 @@ void intel_opregion_free(struct drm_device *dev, int suspend) ...@@ -419,7 +419,7 @@ void intel_opregion_free(struct drm_device *dev, int suspend)
return; return;
if (!suspend) if (!suspend)
acpi_video_exit(); acpi_video_unregister();
opregion->acpi->drdy = 0; opregion->acpi->drdy = 0;
......
...@@ -354,7 +354,7 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, ...@@ -354,7 +354,7 @@ acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
status = acpi_run_hpp(handle, hpp); status = acpi_run_hpp(handle, hpp);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
break; break;
if (acpi_root_bridge(handle)) if (acpi_is_root_bridge(handle))
break; break;
status = acpi_get_parent(handle, &phandle); status = acpi_get_parent(handle, &phandle);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
...@@ -428,7 +428,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) ...@@ -428,7 +428,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
status = acpi_run_oshp(handle); status = acpi_run_oshp(handle);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
goto got_one; goto got_one;
if (acpi_root_bridge(handle)) if (acpi_is_root_bridge(handle))
break; break;
chandle = handle; chandle = handle;
status = acpi_get_parent(chandle, &handle); status = acpi_get_parent(chandle, &handle);
...@@ -449,42 +449,6 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags) ...@@ -449,42 +449,6 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
} }
EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware); EXPORT_SYMBOL(acpi_get_hp_hw_control_from_firmware);
/* acpi_root_bridge - check to see if this acpi object is a root bridge
*
* @handle - the acpi object in question.
*/
int acpi_root_bridge(acpi_handle handle)
{
acpi_status status;
struct acpi_device_info *info;
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
int i;
status = acpi_get_object_info(handle, &buffer);
if (ACPI_SUCCESS(status)) {
info = buffer.pointer;
if ((info->valid & ACPI_VALID_HID) &&
!strcmp(PCI_ROOT_HID_STRING,
info->hardware_id.value)) {
kfree(buffer.pointer);
return 1;
}
if (info->valid & ACPI_VALID_CID) {
for (i=0; i < info->compatibility_id.count; i++) {
if (!strcmp(PCI_ROOT_HID_STRING,
info->compatibility_id.id[i].value)) {
kfree(buffer.pointer);
return 1;
}
}
}
kfree(buffer.pointer);
}
return 0;
}
EXPORT_SYMBOL_GPL(acpi_root_bridge);
static int is_ejectable(acpi_handle handle) static int is_ejectable(acpi_handle handle)
{ {
acpi_status status; acpi_status status;
......
...@@ -678,18 +678,9 @@ static void remove_bridge(acpi_handle handle) ...@@ -678,18 +678,9 @@ static void remove_bridge(acpi_handle handle)
static struct pci_dev * get_apic_pci_info(acpi_handle handle) static struct pci_dev * get_apic_pci_info(acpi_handle handle)
{ {
struct acpi_pci_id id;
struct pci_bus *bus;
struct pci_dev *dev; struct pci_dev *dev;
if (ACPI_FAILURE(acpi_get_pci_id(handle, &id))) dev = acpi_get_pci_dev(handle);
return NULL;
bus = pci_find_bus(id.segment, id.bus);
if (!bus)
return NULL;
dev = pci_get_slot(bus, PCI_DEVFN(id.device, id.function));
if (!dev) if (!dev)
return NULL; return NULL;
...@@ -1396,19 +1387,16 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus) ...@@ -1396,19 +1387,16 @@ static void acpiphp_sanitize_bus(struct pci_bus *bus)
/* Program resources in newly inserted bridge */ /* Program resources in newly inserted bridge */
static int acpiphp_configure_bridge (acpi_handle handle) static int acpiphp_configure_bridge (acpi_handle handle)
{ {
struct acpi_pci_id pci_id; struct pci_dev *dev;
struct pci_bus *bus; struct pci_bus *bus;
if (ACPI_FAILURE(acpi_get_pci_id(handle, &pci_id))) { dev = acpi_get_pci_dev(handle);
if (!dev) {
err("cannot get PCI domain and bus number for bridge\n"); err("cannot get PCI domain and bus number for bridge\n");
return -EINVAL; return -EINVAL;
} }
bus = pci_find_bus(pci_id.segment, pci_id.bus);
if (!bus) { bus = dev->bus;
err("cannot find bus %d:%d\n",
pci_id.segment, pci_id.bus);
return -EINVAL;
}
pci_bus_size_bridges(bus); pci_bus_size_bridges(bus);
pci_bus_assign_resources(bus); pci_bus_assign_resources(bus);
...@@ -1416,6 +1404,7 @@ static int acpiphp_configure_bridge (acpi_handle handle) ...@@ -1416,6 +1404,7 @@ static int acpiphp_configure_bridge (acpi_handle handle)
acpiphp_set_hpp_values(handle, bus); acpiphp_set_hpp_values(handle, bus);
pci_enable_bridges(bus); pci_enable_bridges(bus);
acpiphp_configure_ioapics(handle); acpiphp_configure_ioapics(handle);
pci_dev_put(dev);
return 0; return 0;
} }
...@@ -1631,7 +1620,7 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) ...@@ -1631,7 +1620,7 @@ find_root_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
{ {
int *count = (int *)context; int *count = (int *)context;
if (acpi_root_bridge(handle)) { if (acpi_is_root_bridge(handle)) {
acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
handle_hotplug_event_bridge, NULL); handle_hotplug_event_bridge, NULL);
(*count)++; (*count)++;
......
...@@ -34,10 +34,27 @@ config ACER_WMI ...@@ -34,10 +34,27 @@ config ACER_WMI
If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M If you have an ACPI-WMI compatible Acer/ Wistron laptop, say Y or M
here. here.
config ACERHDF
tristate "Acer Aspire One temperature and fan driver"
depends on THERMAL && THERMAL_HWMON && ACPI
---help---
This is a driver for Acer Aspire One netbooks. It allows to access
the temperature sensor and to control the fan.
After loading this driver the BIOS is still in control of the fan.
To let the kernel handle the fan, do:
echo -n enabled > /sys/class/thermal/thermal_zone0/mode
For more information about this driver see
<http://piie.net/files/acerhdf_README.txt>
If you have an Acer Aspire One netbook, say Y or M
here.
config ASUS_LAPTOP config ASUS_LAPTOP
tristate "Asus Laptop Extras (EXPERIMENTAL)" tristate "Asus Laptop Extras"
depends on ACPI depends on ACPI
depends on EXPERIMENTAL && !ACPI_ASUS depends on !ACPI_ASUS
select LEDS_CLASS select LEDS_CLASS
select NEW_LEDS select NEW_LEDS
select BACKLIGHT_CLASS_DEVICE select BACKLIGHT_CLASS_DEVICE
...@@ -45,12 +62,12 @@ config ASUS_LAPTOP ...@@ -45,12 +62,12 @@ config ASUS_LAPTOP
---help--- ---help---
This is the new Linux driver for Asus laptops. It may also support some This is the new Linux driver for Asus laptops. It may also support some
MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
standard ACPI events that go through /proc/acpi/events. It also adds standard ACPI events and input events. It also adds
support for video output switching, LCD backlight control, Bluetooth and support for video output switching, LCD backlight control, Bluetooth and
Wlan control, and most importantly, allows you to blink those fancy LEDs. Wlan control, and most importantly, allows you to blink those fancy LEDs.
For more information and a userspace daemon for handling the extra For more information and a userspace daemon for handling the extra
buttons see <http://acpi4asus.sf.net/>. buttons see <http://acpi4asus.sf.net>.
If you have an ACPI-compatible ASUS laptop, say Y or M here. If you have an ACPI-compatible ASUS laptop, say Y or M here.
...@@ -342,7 +359,10 @@ config EEEPC_LAPTOP ...@@ -342,7 +359,10 @@ config EEEPC_LAPTOP
select HWMON select HWMON
---help--- ---help---
This driver supports the Fn-Fx keys on Eee PC laptops. This driver supports the Fn-Fx keys on Eee PC laptops.
It also adds the ability to switch camera/wlan on/off.
It also gives access to some extra laptop functionalities like
Bluetooth, backlight and allows powering on/off some other
devices.
If you have an Eee PC laptop, say Y or M here. If you have an Eee PC laptop, say Y or M here.
...@@ -369,7 +389,7 @@ config ACPI_WMI ...@@ -369,7 +389,7 @@ config ACPI_WMI
any ACPI-WMI devices. any ACPI-WMI devices.
config ACPI_ASUS config ACPI_ASUS
tristate "ASUS/Medion Laptop Extras" tristate "ASUS/Medion Laptop Extras (DEPRECATED)"
depends on ACPI depends on ACPI
select BACKLIGHT_CLASS_DEVICE select BACKLIGHT_CLASS_DEVICE
---help--- ---help---
...@@ -390,7 +410,7 @@ config ACPI_ASUS ...@@ -390,7 +410,7 @@ config ACPI_ASUS
parameters. parameters.
More information and a userspace daemon for handling the extra buttons More information and a userspace daemon for handling the extra buttons
at <http://sourceforge.net/projects/acpi4asus/>. at <http://acpi4asus.sf.net>.
If you have an ACPI-compatible ASUS laptop, say Y or M here. This If you have an ACPI-compatible ASUS laptop, say Y or M here. This
driver is still under development, so if your laptop is unsupported or driver is still under development, so if your laptop is unsupported or
......
...@@ -9,6 +9,7 @@ obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o ...@@ -9,6 +9,7 @@ obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o
obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o obj-$(CONFIG_DELL_LAPTOP) += dell-laptop.o
obj-$(CONFIG_DELL_WMI) += dell-wmi.o obj-$(CONFIG_DELL_WMI) += dell-wmi.o
obj-$(CONFIG_ACER_WMI) += acer-wmi.o obj-$(CONFIG_ACER_WMI) += acer-wmi.o
obj-$(CONFIG_ACERHDF) += acerhdf.o
obj-$(CONFIG_HP_WMI) += hp-wmi.o obj-$(CONFIG_HP_WMI) += hp-wmi.o
obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o
......
This diff is collapsed.
This diff is collapsed.
...@@ -455,6 +455,8 @@ static struct asus_hotk *hotk; ...@@ -455,6 +455,8 @@ static struct asus_hotk *hotk;
*/ */
static int asus_hotk_add(struct acpi_device *device); static int asus_hotk_add(struct acpi_device *device);
static int asus_hotk_remove(struct acpi_device *device, int type); static int asus_hotk_remove(struct acpi_device *device, int type);
static void asus_hotk_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id asus_device_ids[] = { static const struct acpi_device_id asus_device_ids[] = {
{"ATK0100", 0}, {"ATK0100", 0},
{"", 0}, {"", 0},
...@@ -465,9 +467,11 @@ static struct acpi_driver asus_hotk_driver = { ...@@ -465,9 +467,11 @@ static struct acpi_driver asus_hotk_driver = {
.name = "asus_acpi", .name = "asus_acpi",
.class = ACPI_HOTK_CLASS, .class = ACPI_HOTK_CLASS,
.ids = asus_device_ids, .ids = asus_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = { .ops = {
.add = asus_hotk_add, .add = asus_hotk_add,
.remove = asus_hotk_remove, .remove = asus_hotk_remove,
.notify = asus_hotk_notify,
}, },
}; };
...@@ -1101,12 +1105,20 @@ static int asus_hotk_remove_fs(struct acpi_device *device) ...@@ -1101,12 +1105,20 @@ static int asus_hotk_remove_fs(struct acpi_device *device)
return 0; return 0;
} }
static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) static void asus_hotk_notify(struct acpi_device *device, u32 event)
{ {
/* TODO Find a better way to handle events count. */ /* TODO Find a better way to handle events count. */
if (!hotk) if (!hotk)
return; return;
/*
* The BIOS *should* be sending us device events, but apparently
* Asus uses system events instead, so just ignore any device
* events we get.
*/
if (event > ACPI_MAX_SYS_NOTIFY)
return;
if ((event & ~((u32) BR_UP)) < 16) if ((event & ~((u32) BR_UP)) < 16)
hotk->brightness = (event & ~((u32) BR_UP)); hotk->brightness = (event & ~((u32) BR_UP));
else if ((event & ~((u32) BR_DOWN)) < 16) else if ((event & ~((u32) BR_DOWN)) < 16)
...@@ -1346,15 +1358,6 @@ static int asus_hotk_add(struct acpi_device *device) ...@@ -1346,15 +1358,6 @@ static int asus_hotk_add(struct acpi_device *device)
if (result) if (result)
goto end; goto end;
/*
* We install the handler, it will receive the hotk in parameter, so, we
* could add other data to the hotk struct
*/
status = acpi_install_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY,
asus_hotk_notify, hotk);
if (ACPI_FAILURE(status))
printk(KERN_ERR " Error installing notify handler\n");
/* For laptops without GPLV: init the hotk->brightness value */ /* For laptops without GPLV: init the hotk->brightness value */
if ((!hotk->methods->brightness_get) if ((!hotk->methods->brightness_get)
&& (!hotk->methods->brightness_status) && (!hotk->methods->brightness_status)
...@@ -1389,16 +1392,9 @@ static int asus_hotk_add(struct acpi_device *device) ...@@ -1389,16 +1392,9 @@ static int asus_hotk_add(struct acpi_device *device)
static int asus_hotk_remove(struct acpi_device *device, int type) static int asus_hotk_remove(struct acpi_device *device, int type)
{ {
acpi_status status = 0;
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return -EINVAL; return -EINVAL;
status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY,
asus_hotk_notify);
if (ACPI_FAILURE(status))
printk(KERN_ERR "Asus ACPI: Error removing notify handler\n");
asus_hotk_remove_fs(device); asus_hotk_remove_fs(device);
kfree(hotk); kfree(hotk);
......
...@@ -46,10 +46,53 @@ struct key_entry { ...@@ -46,10 +46,53 @@ struct key_entry {
u16 keycode; u16 keycode;
}; };
enum { KE_KEY, KE_SW, KE_END }; enum { KE_KEY, KE_SW, KE_IGNORE, KE_END };
/*
* Certain keys are flagged as KE_IGNORE. All of these are either
* notifications (rather than requests for change) or are also sent
* via the keyboard controller so should not be sent again.
*/
static struct key_entry dell_wmi_keymap[] = { static struct key_entry dell_wmi_keymap[] = {
{KE_KEY, 0xe045, KEY_PROG1}, {KE_KEY, 0xe045, KEY_PROG1},
{KE_KEY, 0xe009, KEY_EJECTCD},
/* These also contain the brightness level at offset 6 */
{KE_KEY, 0xe006, KEY_BRIGHTNESSUP},
{KE_KEY, 0xe005, KEY_BRIGHTNESSDOWN},
/* Battery health status button */
{KE_KEY, 0xe007, KEY_BATTERY},
/* This is actually for all radios. Although physically a
* switch, the notification does not provide an indication of
* state and so it should be reported as a key */
{KE_KEY, 0xe008, KEY_WLAN},
/* The next device is at offset 6, the active devices are at
offset 8 and the attached devices at offset 10 */
{KE_KEY, 0xe00b, KEY_DISPLAYTOGGLE},
{KE_IGNORE, 0xe00c, KEY_KBDILLUMTOGGLE},
/* BIOS error detected */
{KE_IGNORE, 0xe00d, KEY_RESERVED},
/* Wifi Catcher */
{KE_KEY, 0xe011, KEY_PROG2},
/* Ambient light sensor toggle */
{KE_IGNORE, 0xe013, KEY_RESERVED},
{KE_IGNORE, 0xe020, KEY_MUTE},
{KE_IGNORE, 0xe02e, KEY_VOLUMEDOWN},
{KE_IGNORE, 0xe030, KEY_VOLUMEUP},
{KE_IGNORE, 0xe033, KEY_KBDILLUMUP},
{KE_IGNORE, 0xe034, KEY_KBDILLUMDOWN},
{KE_IGNORE, 0xe03a, KEY_CAPSLOCK},
{KE_IGNORE, 0xe045, KEY_NUMLOCK},
{KE_IGNORE, 0xe046, KEY_SCROLLLOCK},
{KE_END, 0} {KE_END, 0}
}; };
...@@ -122,15 +165,20 @@ static void dell_wmi_notify(u32 value, void *context) ...@@ -122,15 +165,20 @@ static void dell_wmi_notify(u32 value, void *context)
if (obj && obj->type == ACPI_TYPE_BUFFER) { if (obj && obj->type == ACPI_TYPE_BUFFER) {
int *buffer = (int *)obj->buffer.pointer; int *buffer = (int *)obj->buffer.pointer;
key = dell_wmi_get_entry_by_scancode(buffer[1]); /*
* The upper bytes of the event may contain
* additional information, so mask them off for the
* scancode lookup
*/
key = dell_wmi_get_entry_by_scancode(buffer[1] & 0xFFFF);
if (key) { if (key) {
input_report_key(dell_wmi_input_dev, key->keycode, 1); input_report_key(dell_wmi_input_dev, key->keycode, 1);
input_sync(dell_wmi_input_dev); input_sync(dell_wmi_input_dev);
input_report_key(dell_wmi_input_dev, key->keycode, 0); input_report_key(dell_wmi_input_dev, key->keycode, 0);
input_sync(dell_wmi_input_dev); input_sync(dell_wmi_input_dev);
} else } else if (buffer[1] & 0xFFFF)
printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n", printk(KERN_INFO "dell-wmi: Unknown key %x pressed\n",
buffer[1]); buffer[1] & 0xFFFF);
} }
} }
......
...@@ -62,7 +62,10 @@ enum { ...@@ -62,7 +62,10 @@ enum {
DISABLE_ASL_GPS = 0x0020, DISABLE_ASL_GPS = 0x0020,
DISABLE_ASL_DISPLAYSWITCH = 0x0040, DISABLE_ASL_DISPLAYSWITCH = 0x0040,
DISABLE_ASL_MODEM = 0x0080, DISABLE_ASL_MODEM = 0x0080,
DISABLE_ASL_CARDREADER = 0x0100 DISABLE_ASL_CARDREADER = 0x0100,
DISABLE_ASL_3G = 0x0200,
DISABLE_ASL_WIMAX = 0x0400,
DISABLE_ASL_HWCF = 0x0800
}; };
enum { enum {
...@@ -87,7 +90,13 @@ enum { ...@@ -87,7 +90,13 @@ enum {
CM_ASL_USBPORT3, CM_ASL_USBPORT3,
CM_ASL_MODEM, CM_ASL_MODEM,
CM_ASL_CARDREADER, CM_ASL_CARDREADER,
CM_ASL_LID CM_ASL_3G,
CM_ASL_WIMAX,
CM_ASL_HWCF,
CM_ASL_LID,
CM_ASL_TYPE,
CM_ASL_PANELPOWER, /*P901*/
CM_ASL_TPD
}; };
static const char *cm_getv[] = { static const char *cm_getv[] = {
...@@ -96,7 +105,8 @@ static const char *cm_getv[] = { ...@@ -96,7 +105,8 @@ static const char *cm_getv[] = {
NULL, "PBLG", NULL, NULL, NULL, "PBLG", NULL, NULL,
"CFVG", NULL, NULL, NULL, "CFVG", NULL, NULL, NULL,
"USBG", NULL, NULL, "MODG", "USBG", NULL, NULL, "MODG",
"CRDG", "LIDG" "CRDG", "M3GG", "WIMG", "HWCF",
"LIDG", "TYPE", "PBPG", "TPDG"
}; };
static const char *cm_setv[] = { static const char *cm_setv[] = {
...@@ -105,7 +115,8 @@ static const char *cm_setv[] = { ...@@ -105,7 +115,8 @@ static const char *cm_setv[] = {
"SDSP", "PBLS", "HDPS", NULL, "SDSP", "PBLS", "HDPS", NULL,
"CFVS", NULL, NULL, NULL, "CFVS", NULL, NULL, NULL,
"USBG", NULL, NULL, "MODS", "USBG", NULL, NULL, "MODS",
"CRDS", NULL "CRDS", "M3GS", "WIMS", NULL,
NULL, NULL, "PBPS", "TPDS"
}; };
#define EEEPC_EC "\\_SB.PCI0.SBRG.EC0." #define EEEPC_EC "\\_SB.PCI0.SBRG.EC0."
...@@ -181,6 +192,7 @@ static struct key_entry eeepc_keymap[] = { ...@@ -181,6 +192,7 @@ static struct key_entry eeepc_keymap[] = {
static int eeepc_hotk_add(struct acpi_device *device); static int eeepc_hotk_add(struct acpi_device *device);
static int eeepc_hotk_remove(struct acpi_device *device, int type); static int eeepc_hotk_remove(struct acpi_device *device, int type);
static int eeepc_hotk_resume(struct acpi_device *device); static int eeepc_hotk_resume(struct acpi_device *device);
static void eeepc_hotk_notify(struct acpi_device *device, u32 event);
static const struct acpi_device_id eeepc_device_ids[] = { static const struct acpi_device_id eeepc_device_ids[] = {
{EEEPC_HOTK_HID, 0}, {EEEPC_HOTK_HID, 0},
...@@ -192,10 +204,12 @@ static struct acpi_driver eeepc_hotk_driver = { ...@@ -192,10 +204,12 @@ static struct acpi_driver eeepc_hotk_driver = {
.name = EEEPC_HOTK_NAME, .name = EEEPC_HOTK_NAME,
.class = EEEPC_HOTK_CLASS, .class = EEEPC_HOTK_CLASS,
.ids = eeepc_device_ids, .ids = eeepc_device_ids,
.flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
.ops = { .ops = {
.add = eeepc_hotk_add, .add = eeepc_hotk_add,
.remove = eeepc_hotk_remove, .remove = eeepc_hotk_remove,
.resume = eeepc_hotk_resume, .resume = eeepc_hotk_resume,
.notify = eeepc_hotk_notify,
}, },
}; };
...@@ -318,6 +332,15 @@ static const struct rfkill_ops eeepc_rfkill_ops = { ...@@ -318,6 +332,15 @@ static const struct rfkill_ops eeepc_rfkill_ops = {
.set_block = eeepc_rfkill_set, .set_block = eeepc_rfkill_set,
}; };
static void __init eeepc_enable_camera(void)
{
/*
* If the following call to set_acpi() fails, it's because there's no
* camera so we can ignore the error.
*/
set_acpi(CM_ASL_CAMERA, 1);
}
/* /*
* Sys helpers * Sys helpers
*/ */
...@@ -369,13 +392,88 @@ static ssize_t show_sys_acpi(int cm, char *buf) ...@@ -369,13 +392,88 @@ static ssize_t show_sys_acpi(int cm, char *buf)
EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA); EEEPC_CREATE_DEVICE_ATTR(camera, CM_ASL_CAMERA);
EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER); EEEPC_CREATE_DEVICE_ATTR(cardr, CM_ASL_CARDREADER);
EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH); EEEPC_CREATE_DEVICE_ATTR(disp, CM_ASL_DISPLAYSWITCH);
EEEPC_CREATE_DEVICE_ATTR(cpufv, CM_ASL_CPUFV);
struct eeepc_cpufv {
int num;
int cur;
};
static int get_cpufv(struct eeepc_cpufv *c)
{
c->cur = get_acpi(CM_ASL_CPUFV);
c->num = (c->cur >> 8) & 0xff;
c->cur &= 0xff;
if (c->cur < 0 || c->num <= 0 || c->num > 12)
return -ENODEV;
return 0;
}
static ssize_t show_available_cpufv(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct eeepc_cpufv c;
int i;
ssize_t len = 0;
if (get_cpufv(&c))
return -ENODEV;
for (i = 0; i < c.num; i++)
len += sprintf(buf + len, "%d ", i);
len += sprintf(buf + len, "\n");
return len;
}
static ssize_t show_cpufv(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct eeepc_cpufv c;
if (get_cpufv(&c))
return -ENODEV;
return sprintf(buf, "%#x\n", (c.num << 8) | c.cur);
}
static ssize_t store_cpufv(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct eeepc_cpufv c;
int rv, value;
if (get_cpufv(&c))
return -ENODEV;
rv = parse_arg(buf, count, &value);
if (rv < 0)
return rv;
if (!rv || value < 0 || value >= c.num)
return -EINVAL;
set_acpi(CM_ASL_CPUFV, value);
return rv;
}
static struct device_attribute dev_attr_cpufv = {
.attr = {
.name = "cpufv",
.mode = 0644 },
.show = show_cpufv,
.store = store_cpufv
};
static struct device_attribute dev_attr_available_cpufv = {
.attr = {
.name = "available_cpufv",
.mode = 0444 },
.show = show_available_cpufv
};
static struct attribute *platform_attributes[] = { static struct attribute *platform_attributes[] = {
&dev_attr_camera.attr, &dev_attr_camera.attr,
&dev_attr_cardr.attr, &dev_attr_cardr.attr,
&dev_attr_disp.attr, &dev_attr_disp.attr,
&dev_attr_cpufv.attr, &dev_attr_cpufv.attr,
&dev_attr_available_cpufv.attr,
NULL NULL
}; };
...@@ -558,7 +656,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) ...@@ -558,7 +656,7 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
eeepc_rfkill_hotplug(); eeepc_rfkill_hotplug();
} }
static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
{ {
static struct key_entry *key; static struct key_entry *key;
u16 count; u16 count;
...@@ -566,6 +664,8 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) ...@@ -566,6 +664,8 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
if (!ehotk) if (!ehotk)
return; return;
if (event > ACPI_MAX_SYS_NOTIFY)
return;
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
brn = notify_brn(); brn = notify_brn();
count = ehotk->event_count[event % 128]++; count = ehotk->event_count[event % 128]++;
...@@ -646,7 +746,6 @@ static void eeepc_unregister_rfkill_notifier(char *node) ...@@ -646,7 +746,6 @@ static void eeepc_unregister_rfkill_notifier(char *node)
static int eeepc_hotk_add(struct acpi_device *device) static int eeepc_hotk_add(struct acpi_device *device)
{ {
acpi_status status = AE_OK;
int result; int result;
if (!device) if (!device)
...@@ -664,10 +763,6 @@ static int eeepc_hotk_add(struct acpi_device *device) ...@@ -664,10 +763,6 @@ static int eeepc_hotk_add(struct acpi_device *device)
result = eeepc_hotk_check(); result = eeepc_hotk_check();
if (result) if (result)
goto ehotk_fail; goto ehotk_fail;
status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
eeepc_hotk_notify, ehotk);
if (ACPI_FAILURE(status))
printk(EEEPC_ERR "Error installing notify handler\n");
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6"); eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7"); eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
...@@ -725,14 +820,8 @@ static int eeepc_hotk_add(struct acpi_device *device) ...@@ -725,14 +820,8 @@ static int eeepc_hotk_add(struct acpi_device *device)
static int eeepc_hotk_remove(struct acpi_device *device, int type) static int eeepc_hotk_remove(struct acpi_device *device, int type)
{ {
acpi_status status = 0;
if (!device || !acpi_driver_data(device)) if (!device || !acpi_driver_data(device))
return -EINVAL; return -EINVAL;
status = acpi_remove_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
eeepc_hotk_notify);
if (ACPI_FAILURE(status))
printk(EEEPC_ERR "Error removing notify handler\n");
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
...@@ -989,6 +1078,9 @@ static int __init eeepc_laptop_init(void) ...@@ -989,6 +1078,9 @@ static int __init eeepc_laptop_init(void)
result = eeepc_hwmon_init(dev); result = eeepc_hwmon_init(dev);
if (result) if (result)
goto fail_hwmon; goto fail_hwmon;
eeepc_enable_camera();
/* Register platform stuff */ /* Register platform stuff */
result = platform_driver_register(&platform_driver); result = platform_driver_register(&platform_driver);
if (result) if (result)
......
...@@ -47,7 +47,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4"); ...@@ -47,7 +47,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
#define HPWMI_DISPLAY_QUERY 0x1 #define HPWMI_DISPLAY_QUERY 0x1
#define HPWMI_HDDTEMP_QUERY 0x2 #define HPWMI_HDDTEMP_QUERY 0x2
#define HPWMI_ALS_QUERY 0x3 #define HPWMI_ALS_QUERY 0x3
#define HPWMI_DOCK_QUERY 0x4 #define HPWMI_HARDWARE_QUERY 0x4
#define HPWMI_WIRELESS_QUERY 0x5 #define HPWMI_WIRELESS_QUERY 0x5
#define HPWMI_HOTKEY_QUERY 0xc #define HPWMI_HOTKEY_QUERY 0xc
...@@ -75,10 +75,9 @@ struct key_entry { ...@@ -75,10 +75,9 @@ struct key_entry {
u16 keycode; u16 keycode;
}; };
enum { KE_KEY, KE_SW, KE_END }; enum { KE_KEY, KE_END };
static struct key_entry hp_wmi_keymap[] = { static struct key_entry hp_wmi_keymap[] = {
{KE_SW, 0x01, SW_DOCK},
{KE_KEY, 0x02, KEY_BRIGHTNESSUP}, {KE_KEY, 0x02, KEY_BRIGHTNESSUP},
{KE_KEY, 0x03, KEY_BRIGHTNESSDOWN}, {KE_KEY, 0x03, KEY_BRIGHTNESSDOWN},
{KE_KEY, 0x20e6, KEY_PROG1}, {KE_KEY, 0x20e6, KEY_PROG1},
...@@ -151,7 +150,22 @@ static int hp_wmi_als_state(void) ...@@ -151,7 +150,22 @@ static int hp_wmi_als_state(void)
static int hp_wmi_dock_state(void) static int hp_wmi_dock_state(void)
{ {
return hp_wmi_perform_query(HPWMI_DOCK_QUERY, 0, 0); int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0);
if (ret < 0)
return ret;
return ret & 0x1;
}
static int hp_wmi_tablet_state(void)
{
int ret = hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, 0, 0);
if (ret < 0)
return ret;
return (ret & 0x4) ? 1 : 0;
} }
static int hp_wmi_set_block(void *data, bool blocked) static int hp_wmi_set_block(void *data, bool blocked)
...@@ -232,6 +246,15 @@ static ssize_t show_dock(struct device *dev, struct device_attribute *attr, ...@@ -232,6 +246,15 @@ static ssize_t show_dock(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%d\n", value); return sprintf(buf, "%d\n", value);
} }
static ssize_t show_tablet(struct device *dev, struct device_attribute *attr,
char *buf)
{
int value = hp_wmi_tablet_state();
if (value < 0)
return -EINVAL;
return sprintf(buf, "%d\n", value);
}
static ssize_t set_als(struct device *dev, struct device_attribute *attr, static ssize_t set_als(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
...@@ -244,6 +267,7 @@ static DEVICE_ATTR(display, S_IRUGO, show_display, NULL); ...@@ -244,6 +267,7 @@ static DEVICE_ATTR(display, S_IRUGO, show_display, NULL);
static DEVICE_ATTR(hddtemp, S_IRUGO, show_hddtemp, NULL); static DEVICE_ATTR(hddtemp, S_IRUGO, show_hddtemp, NULL);
static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als); static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als);
static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL);
static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL);
static struct key_entry *hp_wmi_get_entry_by_scancode(int code) static struct key_entry *hp_wmi_get_entry_by_scancode(int code)
{ {
...@@ -326,13 +350,13 @@ static void hp_wmi_notify(u32 value, void *context) ...@@ -326,13 +350,13 @@ static void hp_wmi_notify(u32 value, void *context)
key->keycode, 0); key->keycode, 0);
input_sync(hp_wmi_input_dev); input_sync(hp_wmi_input_dev);
break; break;
case KE_SW: }
input_report_switch(hp_wmi_input_dev, } else if (eventcode == 0x1) {
key->keycode, input_report_switch(hp_wmi_input_dev, SW_DOCK,
hp_wmi_dock_state()); hp_wmi_dock_state());
input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
hp_wmi_tablet_state());
input_sync(hp_wmi_input_dev); input_sync(hp_wmi_input_dev);
break;
}
} else if (eventcode == 0x5) { } else if (eventcode == 0x5) {
if (wifi_rfkill) if (wifi_rfkill)
rfkill_set_sw_state(wifi_rfkill, rfkill_set_sw_state(wifi_rfkill,
...@@ -369,17 +393,18 @@ static int __init hp_wmi_input_setup(void) ...@@ -369,17 +393,18 @@ static int __init hp_wmi_input_setup(void)
set_bit(EV_KEY, hp_wmi_input_dev->evbit); set_bit(EV_KEY, hp_wmi_input_dev->evbit);
set_bit(key->keycode, hp_wmi_input_dev->keybit); set_bit(key->keycode, hp_wmi_input_dev->keybit);
break; break;
case KE_SW: }
}
set_bit(EV_SW, hp_wmi_input_dev->evbit); set_bit(EV_SW, hp_wmi_input_dev->evbit);
set_bit(key->keycode, hp_wmi_input_dev->swbit); set_bit(SW_DOCK, hp_wmi_input_dev->swbit);
set_bit(SW_TABLET_MODE, hp_wmi_input_dev->swbit);
/* Set initial dock state */ /* Set initial hardware state */
input_report_switch(hp_wmi_input_dev, key->keycode, input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state());
hp_wmi_dock_state()); input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
hp_wmi_tablet_state());
input_sync(hp_wmi_input_dev); input_sync(hp_wmi_input_dev);
break;
}
}
err = input_register_device(hp_wmi_input_dev); err = input_register_device(hp_wmi_input_dev);
...@@ -397,6 +422,7 @@ static void cleanup_sysfs(struct platform_device *device) ...@@ -397,6 +422,7 @@ static void cleanup_sysfs(struct platform_device *device)
device_remove_file(&device->dev, &dev_attr_hddtemp); device_remove_file(&device->dev, &dev_attr_hddtemp);
device_remove_file(&device->dev, &dev_attr_als); device_remove_file(&device->dev, &dev_attr_als);
device_remove_file(&device->dev, &dev_attr_dock); device_remove_file(&device->dev, &dev_attr_dock);
device_remove_file(&device->dev, &dev_attr_tablet);
} }
static int __init hp_wmi_bios_setup(struct platform_device *device) static int __init hp_wmi_bios_setup(struct platform_device *device)
...@@ -414,6 +440,9 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) ...@@ -414,6 +440,9 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
if (err) if (err)
goto add_sysfs_error; goto add_sysfs_error;
err = device_create_file(&device->dev, &dev_attr_dock); err = device_create_file(&device->dev, &dev_attr_dock);
if (err)
goto add_sysfs_error;
err = device_create_file(&device->dev, &dev_attr_tablet);
if (err) if (err)
goto add_sysfs_error; goto add_sysfs_error;
...@@ -485,23 +514,17 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device) ...@@ -485,23 +514,17 @@ static int __exit hp_wmi_bios_remove(struct platform_device *device)
static int hp_wmi_resume_handler(struct platform_device *device) static int hp_wmi_resume_handler(struct platform_device *device)
{ {
struct key_entry *key;
/* /*
* Docking state may have changed while suspended, so trigger * Hardware state may have changed while suspended, so trigger
* an input event for the current state. As this is a switch, * input events for the current state. As this is a switch,
* the input layer will only actually pass it on if the state * the input layer will only actually pass it on if the state
* changed. * changed.
*/ */
for (key = hp_wmi_keymap; key->type != KE_END; key++) {
switch (key->type) { input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state());
case KE_SW: input_report_switch(hp_wmi_input_dev, SW_TABLET_MODE,
input_report_switch(hp_wmi_input_dev, key->keycode, hp_wmi_tablet_state());
hp_wmi_dock_state());
input_sync(hp_wmi_input_dev); input_sync(hp_wmi_input_dev);
break;
}
}
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -287,6 +287,25 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev, ...@@ -287,6 +287,25 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_dev *dev,
ACPI_DECODE_16); ACPI_DECODE_16);
} }
static void pnpacpi_parse_allocated_ext_address_space(struct pnp_dev *dev,
struct acpi_resource *res)
{
struct acpi_resource_extended_address64 *p = &res->data.ext_address64;
if (p->producer_consumer == ACPI_PRODUCER)
return;
if (p->resource_type == ACPI_MEMORY_RANGE)
pnpacpi_parse_allocated_memresource(dev,
p->minimum, p->address_length,
p->info.mem.write_protect);
else if (p->resource_type == ACPI_IO_RANGE)
pnpacpi_parse_allocated_ioresource(dev,
p->minimum, p->address_length,
p->granularity == 0xfff ? ACPI_DECODE_10 :
ACPI_DECODE_16);
}
static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
void *data) void *data)
{ {
...@@ -400,8 +419,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, ...@@ -400,8 +419,7 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
if (res->data.ext_address64.producer_consumer == ACPI_PRODUCER) pnpacpi_parse_allocated_ext_address_space(dev, res);
return AE_OK;
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
...@@ -630,6 +648,28 @@ static __init void pnpacpi_parse_address_option(struct pnp_dev *dev, ...@@ -630,6 +648,28 @@ static __init void pnpacpi_parse_address_option(struct pnp_dev *dev,
IORESOURCE_IO_FIXED); IORESOURCE_IO_FIXED);
} }
static __init void pnpacpi_parse_ext_address_option(struct pnp_dev *dev,
unsigned int option_flags,
struct acpi_resource *r)
{
struct acpi_resource_extended_address64 *p = &r->data.ext_address64;
unsigned char flags = 0;
if (p->address_length == 0)
return;
if (p->resource_type == ACPI_MEMORY_RANGE) {
if (p->info.mem.write_protect == ACPI_READ_WRITE_MEMORY)
flags = IORESOURCE_MEM_WRITEABLE;
pnp_register_mem_resource(dev, option_flags, p->minimum,
p->minimum, 0, p->address_length,
flags);
} else if (p->resource_type == ACPI_IO_RANGE)
pnp_register_port_resource(dev, option_flags, p->minimum,
p->minimum, 0, p->address_length,
IORESOURCE_IO_FIXED);
}
struct acpipnp_parse_option_s { struct acpipnp_parse_option_s {
struct pnp_dev *dev; struct pnp_dev *dev;
unsigned int option_flags; unsigned int option_flags;
...@@ -711,6 +751,7 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res, ...@@ -711,6 +751,7 @@ static __init acpi_status pnpacpi_option_resource(struct acpi_resource *res,
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
pnpacpi_parse_ext_address_option(dev, option_flags, res);
break; break;
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
...@@ -765,6 +806,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res) ...@@ -765,6 +806,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res)
case ACPI_RESOURCE_TYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS16:
case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS32:
case ACPI_RESOURCE_TYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_ADDRESS64:
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
return 1; return 1;
} }
......
...@@ -114,10 +114,13 @@ struct acpi_device_ops { ...@@ -114,10 +114,13 @@ struct acpi_device_ops {
acpi_op_notify notify; acpi_op_notify notify;
}; };
#define ACPI_DRIVER_ALL_NOTIFY_EVENTS 0x1 /* system AND device events */
struct acpi_driver { struct acpi_driver {
char name[80]; char name[80];
char class[80]; char class[80];
const struct acpi_device_id *ids; /* Supported Hardware IDs */ const struct acpi_device_id *ids; /* Supported Hardware IDs */
unsigned int flags;
struct acpi_device_ops ops; struct acpi_device_ops ops;
struct device_driver drv; struct device_driver drv;
struct module *owner; struct module *owner;
...@@ -168,7 +171,7 @@ struct acpi_device_dir { ...@@ -168,7 +171,7 @@ struct acpi_device_dir {
/* Plug and Play */ /* Plug and Play */
typedef char acpi_bus_id[5]; typedef char acpi_bus_id[8];
typedef unsigned long acpi_bus_address; typedef unsigned long acpi_bus_address;
typedef char acpi_hardware_id[15]; typedef char acpi_hardware_id[15];
typedef char acpi_unique_id[9]; typedef char acpi_unique_id[9];
...@@ -365,10 +368,10 @@ struct acpi_bus_type { ...@@ -365,10 +368,10 @@ struct acpi_bus_type {
int register_acpi_bus_type(struct acpi_bus_type *); int register_acpi_bus_type(struct acpi_bus_type *);
int unregister_acpi_bus_type(struct acpi_bus_type *); int unregister_acpi_bus_type(struct acpi_bus_type *);
struct device *acpi_get_physical_device(acpi_handle); struct device *acpi_get_physical_device(acpi_handle);
struct device *acpi_get_physical_pci_device(acpi_handle);
/* helper */ /* helper */
acpi_handle acpi_get_child(acpi_handle, acpi_integer); acpi_handle acpi_get_child(acpi_handle, acpi_integer);
int acpi_is_root_bridge(acpi_handle);
acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int); acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle)) #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
......
...@@ -57,8 +57,7 @@ ...@@ -57,8 +57,7 @@
*/ */
#define ACPI_POWER_HID "LNXPOWER" #define ACPI_POWER_HID "LNXPOWER"
#define ACPI_PROCESSOR_OBJECT_HID "ACPI_CPU" #define ACPI_PROCESSOR_OBJECT_HID "LNXCPU"
#define ACPI_PROCESSOR_HID "ACPI0007"
#define ACPI_SYSTEM_HID "LNXSYSTM" #define ACPI_SYSTEM_HID "LNXSYSTM"
#define ACPI_THERMAL_HID "LNXTHERM" #define ACPI_THERMAL_HID "LNXTHERM"
#define ACPI_BUTTON_HID_POWERF "LNXPWRBN" #define ACPI_BUTTON_HID_POWERF "LNXPWRBN"
...@@ -91,17 +90,15 @@ int acpi_pci_link_free_irq(acpi_handle handle); ...@@ -91,17 +90,15 @@ int acpi_pci_link_free_irq(acpi_handle handle);
/* ACPI PCI Interrupt Routing (pci_irq.c) */ /* ACPI PCI Interrupt Routing (pci_irq.c) */
int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus); int acpi_pci_irq_add_prt(acpi_handle handle, struct pci_bus *bus);
void acpi_pci_irq_del_prt(int segment, int bus); void acpi_pci_irq_del_prt(struct pci_bus *bus);
/* ACPI PCI Device Binding (pci_bind.c) */ /* ACPI PCI Device Binding (pci_bind.c) */
struct pci_bus; struct pci_bus;
acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id); struct pci_dev *acpi_get_pci_dev(acpi_handle);
int acpi_pci_bind(struct acpi_device *device); int acpi_pci_bind_root(struct acpi_device *device);
int acpi_pci_bind_root(struct acpi_device *device, struct acpi_pci_id *id,
struct pci_bus *bus);
/* Arch-defined function to add a bus to the system */ /* Arch-defined function to add a bus to the system */
......
...@@ -258,6 +258,7 @@ DECLARE_PER_CPU(struct acpi_processor *, processors); ...@@ -258,6 +258,7 @@ DECLARE_PER_CPU(struct acpi_processor *, processors);
extern struct acpi_processor_errata errata; extern struct acpi_processor_errata errata;
void arch_acpi_processor_init_pdc(struct acpi_processor *pr); void arch_acpi_processor_init_pdc(struct acpi_processor *pr);
void arch_acpi_processor_cleanup_pdc(struct acpi_processor *pr);
#ifdef ARCH_HAS_POWER_INIT #ifdef ARCH_HAS_POWER_INIT
void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags, void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE) #if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
extern int acpi_video_register(void); extern int acpi_video_register(void);
extern int acpi_video_exit(void); extern void acpi_video_unregister(void);
#else #else
static inline int acpi_video_register(void) { return 0; } static inline int acpi_video_register(void) { return 0; }
static inline void acpi_video_exit(void) { return; } static inline void acpi_video_unregister(void) { return; }
#endif #endif
#endif #endif
......
...@@ -113,9 +113,6 @@ void acpi_irq_stats_init(void); ...@@ -113,9 +113,6 @@ void acpi_irq_stats_init(void);
extern u32 acpi_irq_handled; extern u32 acpi_irq_handled;
extern u32 acpi_irq_not_handled; extern u32 acpi_irq_not_handled;
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
extern int pci_mmcfg_config_num;
extern int sbf_port; extern int sbf_port;
extern unsigned long acpi_realmode_flags; extern unsigned long acpi_realmode_flags;
...@@ -293,7 +290,10 @@ void __init acpi_s4_no_nvs(void); ...@@ -293,7 +290,10 @@ void __init acpi_s4_no_nvs(void);
OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL) OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags); extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags);
extern void acpi_early_init(void);
#else /* CONFIG_ACPI */ #else /* CONFIG_ACPI */
static inline void acpi_early_init(void) { }
static inline int early_acpi_boot_init(void) static inline int early_acpi_boot_init(void)
{ {
......
...@@ -229,7 +229,6 @@ struct hotplug_params { ...@@ -229,7 +229,6 @@ struct hotplug_params {
extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus, extern acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,
struct hotplug_params *hpp); struct hotplug_params *hpp);
int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags); int acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev, u32 flags);
int acpi_root_bridge(acpi_handle handle);
int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle); int acpi_pci_check_ejectable(struct pci_bus *pbus, acpi_handle handle);
int acpi_pci_detect_ejectable(struct pci_bus *pbus); int acpi_pci_detect_ejectable(struct pci_bus *pbus);
#endif #endif
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/acpi.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/percpu.h> #include <linux/percpu.h>
...@@ -88,11 +89,6 @@ extern void sbus_init(void); ...@@ -88,11 +89,6 @@ extern void sbus_init(void);
extern void prio_tree_init(void); extern void prio_tree_init(void);
extern void radix_tree_init(void); extern void radix_tree_init(void);
extern void free_initmem(void); extern void free_initmem(void);
#ifdef CONFIG_ACPI
extern void acpi_early_init(void);
#else
static inline void acpi_early_init(void) { }
#endif
#ifndef CONFIG_DEBUG_RODATA #ifndef CONFIG_DEBUG_RODATA
static inline void mark_rodata_ro(void) { } static inline void mark_rodata_ro(void) { }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment