Commit 5028770a authored by Len Brown's avatar Len Brown

[ACPI] merge acpi-2.6.12 branch into latest Linux 2.6.13-rc...

Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parents 9f02d6b7 d8683a0c
driver/acpi/hotkey.c implement:
1. /proc/acpi/hotkey/event_config
(event based hotkey or event config interface):
a. add a event based hotkey(event) :
echo "0:bus::action:method:num:num" > event_config
b. delete a event based hotkey(event):
echo "1:::::num:num" > event_config
c. modify a event based hotkey(event):
echo "2:bus::action:method:num:num" > event_config
2. /proc/acpi/hotkey/poll_config
(polling based hotkey or event config interface):
a.add a polling based hotkey(event) :
echo "0:bus:method:action:method:num" > poll_config
this adding command will create a proc file
/proc/acpi/hotkey/method, which is used to get
result of polling.
b.delete a polling based hotkey(event):
echo "1:::::num" > event_config
c.modify a polling based hotkey(event):
echo "2:bus:method:action:method:num" > poll_config
3./proc/acpi/hotkey/action
(interface to call aml method associated with a
specific hotkey(event))
echo "event_num:event_type:event_argument" >
/proc/acpi/hotkey/action.
The result of the execution of this aml method is
attached to /proc/acpi/hotkey/poll_method, which is dnyamically
created. Please use command "cat /proc/acpi/hotkey/polling_method"
to retrieve it.
......@@ -60,7 +60,7 @@ void __init pcibios_fixup_irqs(void)
}
}
void __init pcibios_penalize_isa_irq(int irq)
void __init pcibios_penalize_isa_irq(int irq, int active)
{
}
......
......@@ -2,3 +2,7 @@ obj-$(CONFIG_ACPI_BOOT) := boot.o
obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += cstate.o
endif
/*
* arch/i386/kernel/acpi/cstate.c
*
* Copyright (C) 2005 Intel Corporation
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
* - Added _PDC for SMP C-states on Intel CPUs
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <acpi/processor.h>
#include <asm/acpi.h>
static void acpi_processor_power_init_intel_pdc(struct acpi_processor_power
*pow)
{
struct acpi_object_list *obj_list;
union acpi_object *obj;
u32 *buf;
/* allocate and initialize pdc. It will be used later. */
obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
if (!obj_list) {
printk(KERN_ERR "Memory allocation error\n");
return;
}
obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
if (!obj) {
printk(KERN_ERR "Memory allocation error\n");
kfree(obj_list);
return;
}
buf = kmalloc(12, GFP_KERNEL);
if (!buf) {
printk(KERN_ERR "Memory allocation error\n");
kfree(obj);
kfree(obj_list);
return;
}
buf[0] = ACPI_PDC_REVISION_ID;
buf[1] = 1;
buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
obj->type = ACPI_TYPE_BUFFER;
obj->buffer.length = 12;
obj->buffer.pointer = (u8 *) buf;
obj_list->count = 1;
obj_list->pointer = obj;
pow->pdc = obj_list;
return;
}
/* Initialize _PDC data based on the CPU vendor */
void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
unsigned int cpu)
{
struct cpuinfo_x86 *c = cpu_data + cpu;
pow->pdc = NULL;
if (c->x86_vendor == X86_VENDOR_INTEL)
acpi_processor_power_init_intel_pdc(pow);
return;
}
EXPORT_SYMBOL(acpi_processor_power_init_pdc);
/*
* Initialize bm_flags based on the CPU cache properties
* On SMP it depends on cache configuration
* - When cache is not shared among all CPUs, we flush cache
* before entering C3.
* - When cache is shared among all CPUs, we use bm_check
* mechanism as in UP case
*
* This routine is called only after all the CPUs are online
*/
void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
unsigned int cpu)
{
struct cpuinfo_x86 *c = cpu_data + cpu;
flags->bm_check = 0;
if (num_online_cpus() == 1)
flags->bm_check = 1;
else if (c->x86_vendor == X86_VENDOR_INTEL) {
/*
* Today all CPUs that support C3 share cache.
* TBD: This needs to look at cache shared map, once
* multi-core detection patch makes to the base.
*/
flags->bm_check = 1;
}
}
EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
......@@ -74,8 +74,9 @@ wakeup_code:
movw %ax,%fs
movw $0x0e00 + 'i', %fs:(0x12)
# need a gdt
lgdt real_save_gdt - wakeup_code
# need a gdt -- use lgdtl to force 32-bit operands, in case
# the GDT is located past 16 megabytes.
lgdtl real_save_gdt - wakeup_code
movl real_save_cr0 - wakeup_code, %eax
movl %eax, %cr0
......
......@@ -375,7 +375,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
arg0.buffer.pointer = (u8 *) arg0_buf;
arg0_buf[0] = ACPI_PDC_REVISION_ID;
arg0_buf[1] = 1;
arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP | ACPI_PDC_EST_CAPABILITY_MSR;
arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR;
p.pdc = &arg_list;
......
......@@ -1051,24 +1051,28 @@ static int __init pcibios_irq_init(void)
subsys_initcall(pcibios_irq_init);
static void pirq_penalize_isa_irq(int irq)
static void pirq_penalize_isa_irq(int irq, int active)
{
/*
* If any ISAPnP device reports an IRQ in its list of possible
* IRQ's, we try to avoid assigning it to PCI devices.
*/
if (irq < 16)
pirq_penalty[irq] += 100;
if (irq < 16) {
if (active)
pirq_penalty[irq] += 1000;
else
pirq_penalty[irq] += 100;
}
}
void pcibios_penalize_isa_irq(int irq)
void pcibios_penalize_isa_irq(int irq, int active)
{
#ifdef CONFIG_ACPI_PCI
if (!acpi_noirq)
acpi_penalize_isa_irq(irq);
acpi_penalize_isa_irq(irq, active);
else
#endif
pirq_penalize_isa_irq(irq);
pirq_penalize_isa_irq(irq, active);
}
static int pirq_enable_irq(struct pci_dev *dev)
......
......@@ -21,7 +21,7 @@ static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq;
void __init pcibios_penalize_isa_irq(int irq) {}
void __init pcibios_penalize_isa_irq(int irq, int active) {}
unsigned int pci_bus0, pci_bus1;
......
......@@ -11,6 +11,7 @@
* Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com>
* Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
* Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
* Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
......@@ -67,6 +68,11 @@ EXPORT_SYMBOL(pm_power_off);
unsigned char acpi_kbd_controller_present = 1;
unsigned char acpi_legacy_devices;
static unsigned int __initdata acpi_madt_rev;
unsigned int acpi_cpei_override;
unsigned int acpi_cpei_phys_cpuid;
#define MAX_SAPICS 256
u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
{ [0 ... MAX_SAPICS - 1] = -1 };
......@@ -265,10 +271,56 @@ acpi_parse_plat_int_src (
(plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
platform_intr_list[plintsrc->type] = vector;
if (acpi_madt_rev > 1) {
acpi_cpei_override = plintsrc->plint_flags.cpei_override_flag;
}
/*
* Save the physical id, so we can check when its being removed
*/
acpi_cpei_phys_cpuid = ((plintsrc->id << 8) | (plintsrc->eid)) & 0xffff;
return 0;
}
unsigned int can_cpei_retarget(void)
{
extern int cpe_vector;
/*
* Only if CPEI is supported and the override flag
* is present, otherwise return that its re-targettable
* if we are in polling mode.
*/
if (cpe_vector > 0 && !acpi_cpei_override)
return 0;
else
return 1;
}
unsigned int is_cpu_cpei_target(unsigned int cpu)
{
unsigned int logical_id;
logical_id = cpu_logical_id(acpi_cpei_phys_cpuid);
if (logical_id == cpu)
return 1;
else
return 0;
}
void set_cpei_target_cpu(unsigned int cpu)
{
acpi_cpei_phys_cpuid = cpu_physical_id(cpu);
}
unsigned int get_cpei_target_cpu(void)
{
return acpi_cpei_phys_cpuid;
}
static int __init
acpi_parse_int_src_ovr (
acpi_table_entry_header *header, const unsigned long end)
......@@ -326,6 +378,8 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
acpi_madt_rev = acpi_madt->header.revision;
/* remember the value for reference after free_initmem() */
#ifdef CONFIG_ITANIUM
has_8259 = 1; /* Firmware on old Itanium systems is broken */
......
......@@ -271,7 +271,7 @@ ia64_mca_log_sal_error_record(int sal_info_type)
#ifdef CONFIG_ACPI
static int cpe_vector = -1;
int cpe_vector = -1;
static irqreturn_t
ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
......
......@@ -196,6 +196,7 @@ update_pal_halt_status(int status)
void
default_idle (void)
{
local_irq_enable();
while (!need_resched())
if (can_do_pal_halt)
safe_halt();
......
......@@ -40,6 +40,8 @@
#include <linux/serial_core.h>
#include <linux/efi.h>
#include <linux/initrd.h>
#include <linux/platform.h>
#include <linux/pm.h>
#include <asm/ia32.h>
#include <asm/machvec.h>
......@@ -783,6 +785,7 @@ cpu_init (void)
/* size of physical stacked register partition plus 8 bytes: */
__get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
platform_cpu_init();
pm_idle = default_idle;
}
void
......
......@@ -36,6 +36,13 @@ int arch_register_cpu(int num)
parent = &sysfs_nodes[cpu_to_node(num)];
#endif /* CONFIG_NUMA */
/*
* If CPEI cannot be re-targetted, and this is
* CPEI target, then dont create the control file
*/
if (!can_cpei_retarget() && is_cpu_cpei_target(num))
sysfs_cpus[num].cpu.no_control = 1;
return register_cpu(&sysfs_cpus[num].cpu, num, parent);
}
......
......@@ -3,6 +3,7 @@
#
menu "ACPI (Advanced Configuration and Power Interface) Support"
depends on PM
depends on !X86_VISWS
depends on !IA64_HP_SIM
depends on IA64 || X86
......@@ -48,7 +49,6 @@ config ACPI_BOOT
config ACPI_INTERPRETER
bool
depends on !IA64_SGI_SN
default y
if ACPI_INTERPRETER
......@@ -79,6 +79,14 @@ config ACPI_SLEEP_PROC_FS
depends on ACPI_SLEEP && PROC_FS
default y
config ACPI_SLEEP_PROC_SLEEP
bool "/proc/acpi/sleep (deprecated)"
depends on ACPI_SLEEP_PROC_FS
default n
---help---
Create /proc/acpi/sleep
Deprecated by /sys/power/state
config ACPI_AC
tristate "AC Adapter"
depends on X86
......@@ -99,7 +107,6 @@ config ACPI_BATTERY
config ACPI_BUTTON
tristate "Button"
depends on !IA64_SGI_SN
default m
help
This driver registers for events based on buttons, such as the
......@@ -111,7 +118,6 @@ config ACPI_BUTTON
config ACPI_VIDEO
tristate "Video"
depends on EXPERIMENTAL
depends on !IA64_SGI_SN
default m
help
This driver implement the ACPI Extensions For Display Adapters
......@@ -122,9 +128,17 @@ config ACPI_VIDEO
Note that this is an ref. implementation only. It may or may not work
for your integrated video device.
config ACPI_HOTKEY
tristate "Generic Hotkey"
depends on ACPI_INTERPRETER
depends on EXPERIMENTAL
depends on !IA64_SGI_SN
default m
help
ACPI generic hotkey
config ACPI_FAN
tristate "Fan"
depends on !IA64_SGI_SN
default m
help
This driver adds support for ACPI fan devices, allowing user-mode
......@@ -132,7 +146,6 @@ config ACPI_FAN
config ACPI_PROCESSOR
tristate "Processor"
depends on !IA64_SGI_SN
default m
help
This driver installs ACPI as the idle handler for Linux, and uses
......@@ -142,7 +155,6 @@ config ACPI_PROCESSOR
config ACPI_HOTPLUG_CPU
bool "Processor Hotplug (EXPERIMENTAL)"
depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL
depends on !IA64_SGI_SN
select ACPI_CONTAINER
default n
---help---
......@@ -262,7 +274,6 @@ config ACPI_BLACKLIST_YEAR
config ACPI_DEBUG
bool "Debug Statements"
depends on !IA64_SGI_SN
default n
help
The ACPI driver can optionally report errors with a great deal
......@@ -271,7 +282,6 @@ config ACPI_DEBUG
config ACPI_BUS
bool
depends on !IA64_SGI_SN
default y
config ACPI_EC
......@@ -285,17 +295,14 @@ config ACPI_EC
config ACPI_POWER
bool
depends on !IA64_SGI_SN
default y
config ACPI_PCI
bool
depends on !IA64_SGI_SN
default PCI
config ACPI_SYSTEM
bool
depends on !IA64_SGI_SN
default y
help
This driver will enable your system to shut down using ACPI, and
......@@ -327,8 +334,13 @@ config ACPI_CONTAINER
depends on EXPERIMENTAL
default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO)
---help---
This is the ACPI generic container driver which supports
ACPI0004, PNP0A05 and PNP0A06 devices
This allows _physical_ insertion and removal of CPUs and memory.
This can be useful, for example, on NUMA machines that support
ACPI based physical hotplug of nodes, or non-NUMA machines that
support physical cpu/memory hot-plug.
If one selects "m", this driver can be loaded with
"modprobe acpi_container".
config ACPI_HOTPLUG_MEMORY
tristate "Memory Hotplug"
......
......@@ -36,13 +36,14 @@ processor-objs += processor_perflib.o
endif
obj-$(CONFIG_ACPI_BUS) += sleep/
obj-$(CONFIG_ACPI_BUS) += bus.o
obj-$(CONFIG_ACPI_BUS) += bus.o glue.o
obj-$(CONFIG_ACPI_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o
obj-$(CONFIG_ACPI_EC) += ec.o
obj-$(CONFIG_ACPI_FAN) += fan.o
obj-$(CONFIG_ACPI_VIDEO) += video.o
obj-$(CONFIG_ACPI_VIDEO) += video.o
obj-$(CONFIG_ACPI_HOTKEY) += hotkey.o
obj-$(CONFIG_ACPI_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o
obj-$(CONFIG_ACPI_POWER) += power.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o
......
......@@ -1204,6 +1204,10 @@ static int __init asus_acpi_init(void)
if (acpi_disabled)
return -ENODEV;
if (!acpi_specific_hotkey_enabled){
printk(KERN_ERR "Using generic hotkey driver\n");
return -ENODEV;
}
asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir);
if (!asus_proc_dir) {
printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n");
......
......@@ -212,6 +212,12 @@ acpi_bus_set_power (
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
return_VALUE(-ENODEV);
}
/*
* Get device's current power state if it's unknown
* This means device power state isn't initialized or previous setting failed
*/
if (device->power.state == ACPI_STATE_UNKNOWN)
acpi_bus_get_power(device->handle, &device->power.state);
if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
return_VALUE(0);
......@@ -231,7 +237,7 @@ acpi_bus_set_power (
* On transitions to a high-powered state we first apply power (via
* power resources) then evalute _PSx. Conversly for transitions to
* a lower-powered state.
*/
*/
if (state < device->power.state) {
if (device->power.flags.power_resources) {
result = acpi_power_transition(device, state);
......
......@@ -26,9 +26,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
......@@ -36,9 +33,6 @@
#define ACPI_BUTTON_COMPONENT 0x00080000
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_CLASS "button"
#define ACPI_BUTTON_FILE_INFO "info"
#define ACPI_BUTTON_FILE_STATE "state"
#define ACPI_BUTTON_TYPE_UNKNOWN 0x00
#define ACPI_BUTTON_NOTIFY_STATUS 0x80
#define ACPI_BUTTON_SUBCLASS_POWER "power"
......@@ -70,8 +64,6 @@ MODULE_LICENSE("GPL");
static int acpi_button_add (struct acpi_device *device);
static int acpi_button_remove (struct acpi_device *device, int type);
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
static struct acpi_driver acpi_button_driver = {
.name = ACPI_BUTTON_DRIVER_NAME,
......@@ -90,187 +82,6 @@ struct acpi_button {
unsigned long pushed;
};
static struct file_operations acpi_button_info_fops = {
.open = acpi_button_info_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static struct file_operations acpi_button_state_fops = {
.open = acpi_button_state_open_fs,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
static struct proc_dir_entry *acpi_button_dir;
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) seq->private;
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
if (!button || !button->device)
return_VALUE(0);
seq_printf(seq, "type: %s\n",
acpi_device_name(button->device));
return_VALUE(0);
}
static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_button_info_seq_show, PDE(inode)->data);
}
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
{
struct acpi_button *button = (struct acpi_button *) seq->private;
acpi_status status;
unsigned long state;
ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
if (!button || !button->device)
return_VALUE(0);
status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
if (ACPI_FAILURE(status)) {
seq_printf(seq, "state: unsupported\n");
}
else{
seq_printf(seq, "state: %s\n", (state ? "open" : "closed"));
}
return_VALUE(0);
}
static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
{
return single_open(file, acpi_button_state_seq_show, PDE(inode)->data);
}
static int
acpi_button_add_fs (
struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
if (!device || !acpi_driver_data(device))
return_VALUE(-EINVAL);
button = acpi_driver_data(device);
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_LID:
entry = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
break;
}
if (!entry)
return_VALUE(-ENODEV);
entry->owner = THIS_MODULE;
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry);
if (!acpi_device_dir(device))
return_VALUE(-ENODEV);
acpi_device_dir(device)->owner = THIS_MODULE;
/* 'info' [R] */
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
S_IRUGO, acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else {
entry->proc_fops = &acpi_button_info_fops;
entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
}
/* show lid state [R] */
if (button->type == ACPI_BUTTON_TYPE_LID) {
entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
S_IRUGO, acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
ACPI_BUTTON_FILE_INFO));
else {
entry->proc_fops = &acpi_button_state_fops;
entry->data = acpi_driver_data(device);
entry->owner = THIS_MODULE;
}
}
return_VALUE(0);
}
static int
acpi_button_remove_fs (
struct acpi_device *device)
{
struct acpi_button *button = NULL;
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
button = acpi_driver_data(device);
if (acpi_device_dir(device)) {
if (button->type == ACPI_BUTTON_TYPE_LID)
remove_proc_entry(ACPI_BUTTON_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_BUTTON_FILE_INFO,
acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device),
acpi_device_dir(device)->parent);
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP,
acpi_button_dir);
break;
case ACPI_BUTTON_TYPE_LID:
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID,
acpi_button_dir);
break;
}
acpi_device_dir(device) = NULL;
}
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
......@@ -310,8 +121,7 @@ acpi_button_notify_fixed (
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
if (!button)
return_ACPI_STATUS(AE_BAD_PARAMETER);
BUG_ON(!button);
acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
......@@ -327,10 +137,6 @@ acpi_button_add (
acpi_status status = AE_OK;
struct acpi_button *button = NULL;
static struct acpi_device *power_button;
static struct acpi_device *sleep_button;
static struct acpi_device *lid_button;
ACPI_FUNCTION_TRACE("acpi_button_add");
if (!device)
......@@ -391,42 +197,6 @@ acpi_button_add (
goto end;
}
/*
* Ensure only one button of each type is used.
*/
switch (button->type) {
case ACPI_BUTTON_TYPE_POWER:
case ACPI_BUTTON_TYPE_POWERF:
if (!power_button)
power_button = device;
else {
kfree(button);
return_VALUE(-ENODEV);
}
break;
case ACPI_BUTTON_TYPE_SLEEP:
case ACPI_BUTTON_TYPE_SLEEPF:
if (!sleep_button)
sleep_button = device;
else {
kfree(button);
return_VALUE(-ENODEV);
}
break;
case ACPI_BUTTON_TYPE_LID:
if (!lid_button)
lid_button = device;
else {
kfree(button);
return_VALUE(-ENODEV);
}
break;
}
result = acpi_button_add_fs(device);
if (result)
goto end;
switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF:
status = acpi_install_fixed_event_handler (
......@@ -470,7 +240,6 @@ acpi_button_add (
end:
if (result) {
acpi_button_remove_fs(device);
kfree(button);
}
......@@ -511,8 +280,6 @@ acpi_button_remove (struct acpi_device *device, int type)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n"));
acpi_button_remove_fs(device);
kfree(button);
return_VALUE(0);
......@@ -526,21 +293,14 @@ acpi_button_init (void)
ACPI_FUNCTION_TRACE("acpi_button_init");
acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
if (!acpi_button_dir)
return_VALUE(-ENODEV);
acpi_button_dir->owner = THIS_MODULE;
result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VALUE(-ENODEV);
}
return_VALUE(0);
}
static void __exit
acpi_button_exit (void)
{
......@@ -548,11 +308,8 @@ acpi_button_exit (void)
acpi_bus_unregister_driver(&acpi_button_driver);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VOID;
}
module_init(acpi_button_init);
module_exit(acpi_button_exit);
......@@ -53,13 +53,20 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsfield")
/* Local prototypes */
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg);
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_buffer_field
*
* PARAMETERS: Opcode - The opcode to be executed
* Operands - List of operands for the opcode
* PARAMETERS: Op - Current parse op (create_xXField)
* walk_state - Current state
*
* RETURN: Status
......@@ -70,7 +77,7 @@
* create_word_field_op,
* create_dword_field_op,
* create_qword_field_op,
* create_field_op (all of which define fields in buffers)
* create_field_op (all of which define a field in a buffer)
*
******************************************************************************/
......@@ -119,7 +126,8 @@ acpi_ds_create_buffer_field (
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
}
else {
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND;
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
}
/*
......@@ -134,16 +142,16 @@ acpi_ds_create_buffer_field (
}
}
/* We could put the returned object (Node) on the object stack for later, but
* for now, we will put it in the "op" object that the parser uses, so we
* can get it again at the end of this scope
/* We could put the returned object (Node) on the object stack for later,
* but for now, we will put it in the "op" object that the parser uses,
* so we can get it again at the end of this scope
*/
op->common.node = node;
/*
* If there is no object attached to the node, this node was just created and
* we need to create the field object. Otherwise, this was a lookup of an
* existing node and we don't want to create the field object again.
* If there is no object attached to the node, this node was just created
* and we need to create the field object. Otherwise, this was a lookup
* of an existing node and we don't want to create the field object again.
*/
obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) {
......@@ -205,7 +213,7 @@ acpi_ds_create_buffer_field (
*
******************************************************************************/
acpi_status
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
......@@ -238,7 +246,8 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n"));
ACPI_REPORT_ERROR ((
"Bit offset within field too large (> 0xFFFFFFFF)\n"));
return_ACPI_STATUS (AE_SUPPORT);
}
......@@ -250,12 +259,15 @@ acpi_ds_get_field_names (
/*
* Get a new access_type and access_attribute -- to be used for all
* field units that follow, until field end or another access_as keyword.
* field units that follow, until field end or another access_as
* keyword.
*
* In field_flags, preserve the flag bits other than the ACCESS_TYPE bits
* In field_flags, preserve the flag bits other than the
* ACCESS_TYPE bits
*/
info->field_flags = (u8) ((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8)));
info->field_flags = (u8)
((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8)));
info->attribute = (u8) (arg->common.value.integer);
break;
......@@ -267,7 +279,8 @@ acpi_ds_get_field_names (
status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name,
info->field_type, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
info->field_type, ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
......@@ -295,8 +308,9 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
(char *) &info->field_node->name));
ACPI_REPORT_ERROR ((
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
(char *) &info->field_node->name));
return_ACPI_STATUS (AE_SUPPORT);
}
......@@ -306,7 +320,8 @@ acpi_ds_get_field_names (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Invalid opcode in field list: %X\n",
arg->common.aml_opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
......@@ -435,7 +450,8 @@ acpi_ds_init_field_objects (
status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name,
type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND,
walk_state, &node);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
......
......@@ -49,12 +49,21 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit")
/* Local prototypes */
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_one_object
*
* PARAMETERS: obj_handle - Node
* PARAMETERS: obj_handle - Node for the object
* Level - Current nesting level
* Context - Points to a init info struct
* return_value - Not used
......@@ -70,7 +79,7 @@
*
******************************************************************************/
acpi_status
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
......@@ -105,7 +114,8 @@ acpi_ds_init_one_object (
status = acpi_ds_initialize_region (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Region %p [%4.4s] - Init failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status)));
}
......@@ -118,8 +128,10 @@ acpi_ds_init_one_object (
info->method_count++;
/* Print a dot for each method unless we are going to print the entire pathname */
/*
* Print a dot for each method unless we are going to print
* the entire pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
}
......@@ -140,7 +152,8 @@ acpi_ds_init_one_object (
*/
status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Method %p [%4.4s] - parse failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status)));
......@@ -154,7 +167,8 @@ acpi_ds_init_one_object (
* for every execution since there isn't much overhead
*/
acpi_ns_delete_namespace_subtree (obj_handle);
acpi_ns_delete_namespace_by_owner (((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
acpi_ns_delete_namespace_by_owner (
((struct acpi_namespace_node *) obj_handle)->object->method.owning_id);
break;
......
......@@ -153,12 +153,11 @@ acpi_ds_parse_method (
/*
* Parse the method, first pass
*
* The first pass load is where newly declared named objects are
* added into the namespace. Actual evaluation of
* the named objects (what would be called a "second
* pass") happens during the actual execution of the
* method so that operands to the named objects can
* take on dynamic run-time values.
* The first pass load is where newly declared named objects are added into
* the namespace. Actual evaluation of the named objects (what would be
* called a "second pass") happens during the actual execution of the
* method so that operands to the named objects can take on dynamic
* run-time values.
*/
status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) {
......
This diff is collapsed.
......@@ -52,9 +52,15 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject")
static acpi_status
acpi_ds_build_internal_object (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
union acpi_operand_object **obj_desc_ptr);
#ifndef ACPI_NO_METHOD_EXECUTION
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: acpi_ds_build_internal_object
*
......@@ -67,9 +73,9 @@
* DESCRIPTION: Translate a parser Op object to the equivalent namespace object
* Simple objects are any objects other than a package object!
*
****************************************************************************/
******************************************************************************/
acpi_status
static acpi_status
acpi_ds_build_internal_object (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
......@@ -90,9 +96,11 @@ acpi_ds_build_internal_object (
* Otherwise, go ahead and look it up now
*/
if (!op->common.node) {
status = acpi_ns_lookup (walk_state->scope_info, op->common.value.string,
status = acpi_ns_lookup (walk_state->scope_info,
op->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL,
(struct acpi_namespace_node **) &(op->common.node));
if (ACPI_FAILURE (status)) {
......@@ -104,12 +112,14 @@ acpi_ds_build_internal_object (
/* Create and init the internal ACPI object */
obj_desc = acpi_ut_create_internal_object ((acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
obj_desc = acpi_ut_create_internal_object (
(acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode, &obj_desc);
status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
&obj_desc);
if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status);
......@@ -120,7 +130,7 @@ acpi_ds_build_internal_object (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: acpi_ds_build_internal_buffer_obj
*
......@@ -134,7 +144,7 @@ acpi_ds_build_internal_object (
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
****************************************************************************/
******************************************************************************/
acpi_status
acpi_ds_build_internal_buffer_obj (
......@@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: acpi_ds_build_internal_package_obj
*
......@@ -243,7 +253,7 @@ acpi_ds_build_internal_buffer_obj (
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
****************************************************************************/
******************************************************************************/
acpi_status
acpi_ds_build_internal_package_obj (
......@@ -331,11 +341,12 @@ acpi_ds_build_internal_package_obj (
if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
/* Object (package or buffer) is already built */
obj_desc->package.elements[i] = ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
obj_desc->package.elements[i] =
ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
}
else {
status = acpi_ds_build_internal_object (walk_state, arg,
&obj_desc->package.elements[i]);
&obj_desc->package.elements[i]);
}
i++;
......@@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj (
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_node
*
......@@ -360,7 +371,7 @@ acpi_ds_build_internal_package_obj (
*
* DESCRIPTION: Create the object to be associated with a namespace node
*
****************************************************************************/
******************************************************************************/
acpi_status
acpi_ds_create_node (
......@@ -392,7 +403,8 @@ acpi_ds_create_node (
/* Build an internal object for the argument(s) */
status = acpi_ds_build_internal_object (walk_state, op->common.value.arg, &obj_desc);
status = acpi_ds_build_internal_object (walk_state, op->common.value.arg,
&obj_desc);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -414,7 +426,7 @@ acpi_ds_create_node (
#endif /* ACPI_NO_METHOD_EXECUTION */
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_object_from_op
*
......@@ -429,7 +441,7 @@ acpi_ds_create_node (
* associated arguments. The namespace object is a more compact
* representation of the Op and its arguments.
*
****************************************************************************/
******************************************************************************/
acpi_status
acpi_ds_init_object_from_op (
......@@ -462,7 +474,8 @@ acpi_ds_init_object_from_op (
/*
* Defer evaluation of Buffer term_arg operand
*/
obj_desc->buffer.node = (struct acpi_namespace_node *) walk_state->operands[0];
obj_desc->buffer.node = (struct acpi_namespace_node *)
walk_state->operands[0];
obj_desc->buffer.aml_start = op->named.data;
obj_desc->buffer.aml_length = op->named.length;
break;
......@@ -473,7 +486,8 @@ acpi_ds_init_object_from_op (
/*
* Defer evaluation of Package term_arg operand
*/
obj_desc->package.node = (struct acpi_namespace_node *) walk_state->operands[0];
obj_desc->package.node = (struct acpi_namespace_node *)
walk_state->operands[0];
obj_desc->package.aml_start = op->named.data;
obj_desc->package.aml_length = op->named.length;
break;
......@@ -486,9 +500,10 @@ acpi_ds_init_object_from_op (
/*
* Resolve AML Constants here - AND ONLY HERE!
* All constants are integers.
* We mark the integer with a flag that indicates that it started life
* as a constant -- so that stores to constants will perform as expected (noop).
* (zero_op is used as a placeholder for optional target operands.)
* We mark the integer with a flag that indicates that it started
* life as a constant -- so that stores to constants will perform
* as expected (noop). zero_op is used as a placeholder for optional
* target operands.
*/
obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
......@@ -521,7 +536,8 @@ acpi_ds_init_object_from_op (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", opcode));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown constant opcode %X\n", opcode));
status = AE_AML_OPERAND_TYPE;
break;
}
......@@ -535,7 +551,8 @@ acpi_ds_init_object_from_op (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", op_info->type));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
......@@ -570,8 +587,10 @@ acpi_ds_init_object_from_op (
obj_desc->reference.offset = opcode - AML_LOCAL_OP;
#ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset,
walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object);
status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
obj_desc->reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
#endif
break;
......@@ -584,8 +603,10 @@ acpi_ds_init_object_from_op (
obj_desc->reference.offset = opcode - AML_ARG_OP;
#ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset,
walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object);
status = acpi_ds_method_data_get_node (AML_ARG_OP,
obj_desc->reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
#endif
break;
......
This diff is collapsed.
......@@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return (
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: acpi_ds_do_implicit_return
......@@ -205,7 +204,7 @@ acpi_ds_is_result_used (
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
(void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
/*
* Now determine if the parent will use the result
......@@ -219,8 +218,9 @@ acpi_ds_is_result_used (
(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
/* No parent, the return value cannot possibly be used */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name (op->common.aml_opcode)));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name (op->common.aml_opcode)));
return_VALUE (FALSE);
}
......@@ -228,7 +228,8 @@ acpi_ds_is_result_used (
parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", op));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown parent opcode. Op=%p\n", op));
return_VALUE (FALSE);
}
......@@ -309,17 +310,19 @@ acpi_ds_is_result_used (
result_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result of [%s] used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (TRUE);
result_not_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Result of [%s] not used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name (op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
return_VALUE (FALSE);
}
......@@ -522,7 +525,8 @@ acpi_ds_create_operand (
if ((walk_state->deferred_node) &&
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
(arg_index != 0)) {
obj_desc = ACPI_CAST_PTR (union acpi_operand_object, walk_state->deferred_node);
obj_desc = ACPI_CAST_PTR (
union acpi_operand_object, walk_state->deferred_node);
status = AE_OK;
}
else /* All other opcodes */ {
......@@ -565,7 +569,8 @@ acpi_ds_create_operand (
* indicate this to the interpreter, set the
* object to the root
*/
obj_desc = ACPI_CAST_PTR (union acpi_operand_object, acpi_gbl_root_node);
obj_desc = ACPI_CAST_PTR (
union acpi_operand_object, acpi_gbl_root_node);
status = AE_OK;
}
else {
......@@ -612,7 +617,8 @@ acpi_ds_create_operand (
*/
opcode = AML_ZERO_OP; /* Has no arguments! */
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", arg));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Null namepath: Arg=%p\n", arg));
}
else {
opcode = arg->common.aml_opcode;
......@@ -642,7 +648,8 @@ acpi_ds_create_operand (
* Only error is underflow, and this indicates
* a missing or null operand!
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Missing or null operand, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status);
}
......@@ -657,8 +664,8 @@ acpi_ds_create_operand (
/* Initialize the new object */
status = acpi_ds_init_object_from_op (walk_state, arg,
opcode, &obj_desc);
status = acpi_ds_init_object_from_op (
walk_state, arg, opcode, &obj_desc);
if (ACPI_FAILURE (status)) {
acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status);
......
......@@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_3A_1T_1R,
acpi_ex_opcode_6A_0T_1R};
/*****************************************************************************
*
* FUNCTION: acpi_ds_get_predicate_value
*
* PARAMETERS: walk_state - Current state of the parse tree walk
* result_obj - if non-zero, pop result from result stack
*
* RETURN: Status
*
......@@ -124,7 +126,8 @@ acpi_ds_get_predicate_value (
}
if (!obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate obj_desc=%p State=%p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No predicate obj_desc=%p State=%p\n",
obj_desc, walk_state));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
......@@ -197,7 +200,7 @@ acpi_ds_get_predicate_value (
* FUNCTION: acpi_ds_exec_begin_op
*
* PARAMETERS: walk_state - Current state of the parse tree walk
* out_op - Return op if a new one is created
* out_op - Where to return op if a new one is created
*
* RETURN: Status
*
......@@ -233,7 +236,8 @@ acpi_ds_exec_begin_op (
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (acpi_ns_opens_scope (walk_state->op_info->object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name (walk_state->op_info->object_type), op));
status = acpi_ds_scope_stack_pop (walk_state);
......@@ -297,11 +301,10 @@ acpi_ds_exec_begin_op (
if (walk_state->walk_type == ACPI_WALK_METHOD) {
/*
* Found a named object declaration during method
* execution; we must enter this object into the
* namespace. The created object is temporary and
* will be deleted upon completion of the execution
* of this method.
* Found a named object declaration during method execution;
* we must enter this object into the namespace. The created
* object is temporary and will be deleted upon completion of
* the execution of this method.
*/
status = acpi_ds_load2_begin_op (walk_state, NULL);
}
......@@ -338,8 +341,6 @@ acpi_ds_exec_begin_op (
* FUNCTION: acpi_ds_exec_end_op
*
* PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been completed in the
* walk; Arguments have now been evaluated.
*
* RETURN: Status
*
......@@ -389,7 +390,7 @@ acpi_ds_exec_end_op (
/* Decode the Opcode Class */
switch (op_class) {
case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
break;
......@@ -417,12 +418,12 @@ acpi_ds_exec_end_op (
/* Resolve all operands */
status = acpi_ex_resolve_operands (walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
if (ACPI_SUCCESS (status)) {
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name (walk_state->opcode),
walk_state->num_operands, "after ex_resolve_operands");
acpi_ps_get_opcode_name (walk_state->opcode),
walk_state->num_operands, "after ex_resolve_operands");
}
}
......@@ -506,7 +507,8 @@ acpi_ds_exec_end_op (
if ((op->asl.parent) &&
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
(op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method Reference in a Package, Op=%p\n", op));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"Method Reference in a Package, Op=%p\n", op));
op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
return_ACPI_STATUS (AE_OK);
......@@ -583,13 +585,15 @@ acpi_ds_exec_end_op (
case AML_NAME_OP:
/*
* Put the Node on the object stack (Contains the ACPI Name of
* this object)
* Put the Node on the object stack (Contains the ACPI Name
* of this object)
*/
walk_state->operands[0] = (void *) op->common.parent->common.node;
walk_state->num_operands = 1;
status = acpi_ds_create_node (walk_state, op->common.parent->common.node, op->common.parent);
status = acpi_ds_create_node (walk_state,
op->common.parent->common.node,
op->common.parent);
if (ACPI_FAILURE (status)) {
break;
}
......@@ -600,7 +604,7 @@ acpi_ds_exec_end_op (
case AML_INT_EVAL_SUBTREE_OP:
status = acpi_ds_eval_data_object_operands (walk_state, op,
acpi_ns_get_attached_object (op->common.parent->common.node));
acpi_ns_get_attached_object (op->common.parent->common.node));
break;
default:
......@@ -609,7 +613,7 @@ acpi_ds_exec_end_op (
break;
}
/* Done with this result state (Now that operand stack is built) */
/* Done with result state (Now that operand stack is built) */
status = acpi_ds_result_stack_pop (walk_state);
if (ACPI_FAILURE (status)) {
......@@ -620,8 +624,7 @@ acpi_ds_exec_end_op (
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (status) &&
walk_state->result_obj) {
if (walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state);
}
break;
......@@ -654,7 +657,8 @@ acpi_ds_exec_end_op (
case AML_TYPE_UNDEFINED:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", op));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Undefined opcode type Op=%p\n", op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
......@@ -709,13 +713,14 @@ acpi_ds_exec_end_op (
status = acpi_gbl_exception_handler (status,
walk_state->method_node->name.integer, walk_state->opcode,
walk_state->aml_offset, NULL);
acpi_ex_enter_interpreter ();
(void) acpi_ex_enter_interpreter ();
}
if (walk_state->result_obj) {
/* Break to debugger to display result */
ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj, walk_state));
ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
walk_state));
/*
* Delete the result op if and only if:
......
This diff is collapsed.
......@@ -50,14 +50,13 @@
ACPI_MODULE_NAME ("dswscope")
#define STACK_POP(head) head
/****************************************************************************
*
* FUNCTION: acpi_ds_scope_stack_clear
*
* PARAMETERS: None
* PARAMETERS: walk_state - Current state
*
* RETURN: None
*
* DESCRIPTION: Pop (and free) everything on the scope stack except the
* root scope object (which remains at the stack top.)
......@@ -80,7 +79,8 @@ acpi_ds_scope_stack_clear (
walk_state->scope_info = scope_info->scope.next;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Popped object type (%s)\n", acpi_ut_get_type_name (scope_info->common.value)));
"Popped object type (%s)\n",
acpi_ut_get_type_name (scope_info->common.value)));
acpi_ut_delete_generic_state (scope_info);
}
}
......@@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear (
*
* FUNCTION: acpi_ds_scope_stack_push
*
* PARAMETERS: *Node, - Name to be made current
* Type, - Type of frame being pushed
* PARAMETERS: Node - Name to be made current
* Type - Type of frame being pushed
* walk_state - Current state
*
* RETURN: Status
*
* DESCRIPTION: Push the current scope on the scope stack, and make the
* passed Node current.
......@@ -121,7 +124,8 @@ acpi_ds_scope_stack_push (
/* Make sure object type is valid */
if (!acpi_ut_valid_object_type (type)) {
ACPI_REPORT_WARNING (("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
ACPI_REPORT_WARNING ((
"ds_scope_stack_push: Invalid object type: 0x%X\n", type));
}
/* Allocate a new scope object */
......@@ -170,16 +174,11 @@ acpi_ds_scope_stack_push (
*
* FUNCTION: acpi_ds_scope_stack_pop
*
* PARAMETERS: Type - The type of frame to be found
* PARAMETERS: walk_state - Current state
*
* DESCRIPTION: Pop the scope stack until a frame of the requested type
* is found.
* RETURN: Status
*
* RETURN: Count of frames popped. If no frame of the requested type
* was found, the count is returned as a negative number and
* the scope stack is emptied (which sets the current scope
* to the root). If the scope stack was empty at entry, the
* function is a no-op and returns 0.
* DESCRIPTION: Pop the scope stack once.
*
***************************************************************************/
......
This diff is collapsed.
This diff is collapsed.
......@@ -47,6 +47,16 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evevent")
/* Local prototypes */
static acpi_status
acpi_ev_fixed_event_initialize (
void);
static u32
acpi_ev_fixed_event_dispatch (
u32 event);
/*******************************************************************************
*
......@@ -56,7 +66,7 @@
*
* RETURN: Status
*
* DESCRIPTION: Initialize global data structures for events.
* DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE)
*
******************************************************************************/
......@@ -78,9 +88,9 @@ acpi_ev_initialize_events (
}
/*
* Initialize the Fixed and General Purpose Events. This is
* done prior to enabling SCIs to prevent interrupts from
* occurring before handers are installed.
* Initialize the Fixed and General Purpose Events. This is done prior to
* enabling SCIs to prevent interrupts from occurring before the handlers are
* installed.
*/
status = acpi_ev_fixed_event_initialize ();
if (ACPI_FAILURE (status)) {
......@@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers (
*
******************************************************************************/
acpi_status
static acpi_status
acpi_ev_fixed_event_initialize (
void)
{
......@@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize (
/* Enable the fixed event */
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
status = acpi_set_register (acpi_gbl_fixed_event_info[i].enable_register_id,
status = acpi_set_register (
acpi_gbl_fixed_event_info[i].enable_register_id,
0, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) {
return (status);
......@@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize (
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
* DESCRIPTION: Checks the PM status register for fixed events
* DESCRIPTION: Checks the PM status register for active fixed events
*
******************************************************************************/
......@@ -221,8 +232,10 @@ acpi_ev_fixed_event_detect (
* Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here.
*/
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &fixed_status);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
&fixed_status);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
&fixed_enable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
......@@ -259,7 +272,7 @@ acpi_ev_fixed_event_detect (
*
******************************************************************************/
u32
static u32
acpi_ev_fixed_event_dispatch (
u32 event)
{
......
......@@ -48,6 +48,12 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpe")
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context);
/*******************************************************************************
*
......@@ -335,8 +341,10 @@ acpi_ev_get_gpe_event_info (
gpe_block = acpi_gbl_gpe_fadt_blocks[i];
if (gpe_block) {
if ((gpe_number >= gpe_block->block_base_number) &&
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]);
(gpe_number < gpe_block->block_base_number +
(gpe_block->register_count * 8))) {
return (&gpe_block->event_info[gpe_number -
gpe_block->block_base_number]);
}
}
}
......@@ -437,7 +445,7 @@ acpi_ev_gpe_detect (
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
gpe_register_info->base_gpe_number, status_reg, enable_reg));
/* First check if there is anything active at all in this register */
/* Check if there is anything active at all in this register */
enabled_status_byte = (u8) (status_reg & enable_reg);
if (!enabled_status_byte) {
......@@ -457,8 +465,8 @@ acpi_ev_gpe_detect (
* or method.
*/
int_status |= acpi_ev_gpe_dispatch (
&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
(u32) j + gpe_register_info->base_gpe_number);
&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
(u32) j + gpe_register_info->base_gpe_number);
}
}
}
......@@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method (
* Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with remove_handler/remove_block.
*/
ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info, sizeof (struct acpi_gpe_event_info));
ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
sizeof (struct acpi_gpe_event_info));
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) {
......@@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method (
* Must check for control method type dispatch one more
* time to avoid race with ev_gpe_install_handler
*/
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) {
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD) {
/*
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
* control method that corresponds to this GPE
......@@ -553,7 +563,8 @@ acpi_ev_asynch_execute_gpe_method (
}
}
if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) {
if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED) {
/*
* GPE is level-triggered, we clear the GPE status bit after
* handling the event.
......@@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method (
*
* FUNCTION: acpi_ev_gpe_dispatch
*
* PARAMETERS: gpe_event_info - info for this GPE
* PARAMETERS: gpe_event_info - Info for this GPE
* gpe_number - Number relative to the parent GPE block
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
......@@ -602,10 +613,12 @@ acpi_ev_gpe_dispatch (
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED) {
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
ACPI_REPORT_ERROR ((
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
acpi_format_exception (status), gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
}
......@@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch (
/* It is now safe to clear level-triggered events. */
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED) {
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
ACPI_GPE_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR ((
......@@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch (
#ifdef ACPI_GPE_NOTIFY_CHECK
/*******************************************************************************
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
*
......
......@@ -48,6 +48,39 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeblk")
/* Local prototypes */
static acpi_status
acpi_ev_save_method_info (
acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value);
static acpi_status
acpi_ev_match_prw_and_gpe (
acpi_handle obj_handle,
u32 level,
void *info,
void **return_value);
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
u32 interrupt_level);
static acpi_status
acpi_ev_delete_gpe_xrupt (
struct acpi_gpe_xrupt_info *gpe_xrupt);
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
u32 interrupt_level);
static acpi_status
acpi_ev_create_gpe_info_blocks (
struct acpi_gpe_block_info *gpe_block);
/*******************************************************************************
*
......@@ -155,7 +188,7 @@ acpi_ev_walk_gpe_list (
}
/******************************************************************************
/*******************************************************************************
*
* FUNCTION: acpi_ev_delete_gpe_handlers
*
......@@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) {
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) {
ACPI_MEM_FREE (gpe_event_info->dispatch.handler);
gpe_event_info->dispatch.handler = NULL;
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;
......@@ -471,7 +505,7 @@ acpi_ev_get_gpe_xrupt_block (
ACPI_FUNCTION_TRACE ("ev_get_gpe_xrupt_block");
/* No need for spin lock since we are not changing any list elements here */
/* No need for lock since we are not changing any list elements here */
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt) {
......@@ -619,7 +653,7 @@ acpi_ev_install_gpe_block (
goto unlock_and_exit;
}
/* Install the new block at the end of the list for this interrupt with lock */
/* Install the new block at the end of the list with lock */
acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
if (gpe_xrupt_block->gpe_block_list_head) {
......@@ -756,10 +790,12 @@ acpi_ev_create_gpe_info_blocks (
* per register. Initialization to zeros is sufficient.
*/
gpe_event_info = ACPI_MEM_CALLOCATE (
((acpi_size) gpe_block->register_count * ACPI_GPE_REGISTER_WIDTH) *
((acpi_size) gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH) *
sizeof (struct acpi_gpe_event_info));
if (!gpe_event_info) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the gpe_event_info table\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not allocate the gpe_event_info table\n"));
status = AE_NO_MEMORY;
goto error_exit;
}
......@@ -899,7 +935,8 @@ acpi_ev_create_gpe_block (
gpe_block->block_base_number = gpe_block_base_number;
gpe_block->node = gpe_device;
ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address, sizeof (struct acpi_generic_address));
ACPI_MEMCPY (&gpe_block->block_address, gpe_block_address,
sizeof (struct acpi_generic_address));
/* Create the register_info and event_info sub-structures */
......@@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize (
/* Install GPE Block 0 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe0_blk,
register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
&acpi_gbl_FADT->xgpe0_blk, register_count0, 0,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR ((
......@@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize (
else {
/* Install GPE Block 1 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe1_blk,
register_count1, acpi_gbl_FADT->gpe1_base,
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
&acpi_gbl_FADT->xgpe1_blk, register_count1,
acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]);
if (ACPI_FAILURE (status)) {
......@@ -1109,7 +1148,7 @@ acpi_ev_gpe_initialize (
* space. However, GPE0 always starts at GPE number zero.
*/
gpe_number_max = acpi_gbl_FADT->gpe1_base +
((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
}
}
......
......@@ -50,6 +50,35 @@
ACPI_MODULE_NAME ("evmisc")
#ifdef ACPI_DEBUG_OUTPUT
static const char *acpi_notify_value_names[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault"
};
#endif
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context);
static void ACPI_SYSTEM_XFACE
acpi_ev_global_lock_thread (
void *context);
static u32
acpi_ev_global_lock_handler (
void *context);
/*******************************************************************************
*
* FUNCTION: acpi_ev_is_notify_object
......@@ -98,20 +127,6 @@ acpi_ev_is_notify_object (
*
******************************************************************************/
#ifdef ACPI_DEBUG_OUTPUT
static const char *acpi_notify_value_names[] =
{
"Bus Check",
"Device Check",
"Device Wake",
"Eject request",
"Device Check Light",
"Frequency Mismatch",
"Bus Mode Mismatch",
"Power Fault"
};
#endif
acpi_status
acpi_ev_queue_notify_request (
struct acpi_namespace_node *node,
......@@ -128,9 +143,10 @@ acpi_ev_queue_notify_request (
/*
* For value 3 (Ejection Request), some device method may need to be run.
* For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run.
* For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
* to be run.
* For value 0x80 (Status Change) on the power button or sleep button,
* initiate soft-off or sleep operation?
* initiate soft-off or sleep operation?
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Dispatching Notify(%X) on node %p\n", notify_value, node));
......@@ -140,8 +156,9 @@ acpi_ev_queue_notify_request (
acpi_notify_value_names[notify_value]));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n",
notify_value));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Notify value: 0x%2.2X **Device Specific**\n",
notify_value));
}
/* Get the notify object attached to the NS Node */
......@@ -210,7 +227,7 @@ acpi_ev_queue_notify_request (
*
* FUNCTION: acpi_ev_notify_dispatch
*
* PARAMETERS: Context - To be passsed to the notify handler
* PARAMETERS: Context - To be passed to the notify handler
*
* RETURN: None.
*
......@@ -219,7 +236,7 @@ acpi_ev_queue_notify_request (
*
******************************************************************************/
void ACPI_SYSTEM_XFACE
static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context)
{
......@@ -234,7 +251,8 @@ acpi_ev_notify_dispatch (
/*
* We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached to the device.
* This is done _before_ we invoke the per-device handler attached
* to the device.
*/
if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
/* Global system notification handler */
......@@ -256,15 +274,17 @@ acpi_ev_notify_dispatch (
/* Invoke the system handler first, if present */
if (global_handler) {
global_handler (notify_info->notify.node, notify_info->notify.value, global_context);
global_handler (notify_info->notify.node, notify_info->notify.value,
global_context);
}
/* Now invoke the per-device handler, if present */
handler_obj = notify_info->notify.handler_obj;
if (handler_obj) {
handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value,
handler_obj->notify.context);
handler_obj->notify.handler (notify_info->notify.node,
notify_info->notify.value,
handler_obj->notify.context);
}
/* All done with the info object */
......@@ -370,7 +390,8 @@ acpi_ev_global_lock_handler (
******************************************************************************/
acpi_status
acpi_ev_init_global_lock_handler (void)
acpi_ev_init_global_lock_handler (
void)
{
acpi_status status;
......@@ -380,7 +401,7 @@ acpi_ev_init_global_lock_handler (void)
acpi_gbl_global_lock_present = TRUE;
status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
acpi_ev_global_lock_handler, NULL);
acpi_ev_global_lock_handler, NULL);
/*
* If the global lock does not exist on this platform, the attempt
......@@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock (
acpi_gbl_global_lock_thread_count++;
/* If we (OS side vs. BIOS side) have the hardware lock already, we are done */
/*
* If we (OS side vs. BIOS side) have the hardware lock already,
* we are done
*/
if (acpi_gbl_global_lock_acquired) {
return_ACPI_STATUS (AE_OK);
}
......@@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock (
******************************************************************************/
acpi_status
acpi_ev_release_global_lock (void)
acpi_ev_release_global_lock (
void)
{
u8 pending = FALSE;
acpi_status status = AE_OK;
......@@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void)
if (!acpi_gbl_global_lock_thread_count) {
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
ACPI_REPORT_WARNING((
"Cannot release HW Global Lock, it has not been acquired\n"));
return_ACPI_STATUS (AE_NOT_ACQUIRED);
}
......@@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void)
* register
*/
if (pending) {
status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
1, ACPI_MTX_LOCK);
}
return_ACPI_STATUS (status);
......@@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void)
******************************************************************************/
void
acpi_ev_terminate (void)
acpi_ev_terminate (
void)
{
acpi_native_uint i;
acpi_status status;
......@@ -555,7 +582,8 @@ acpi_ev_terminate (void)
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
status = acpi_disable_event ((u32) i, 0);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (u32) i));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not disable fixed event %d\n", (u32) i));
}
}
......@@ -567,7 +595,8 @@ acpi_ev_terminate (void)
status = acpi_ev_remove_sci_handler ();
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not remove SCI handler\n"));
}
}
......
......@@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE};
/* Local prototypes */
static acpi_status
acpi_ev_reg_run (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
static acpi_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
/*******************************************************************************
*
......@@ -179,8 +195,8 @@ acpi_ev_initialize_op_regions (
*
* FUNCTION: acpi_ev_execute_reg_method
*
* PARAMETERS: region_obj - Object structure
* Function - Passed to _REG: On (1) or Off (0)
* PARAMETERS: region_obj - Region object
* Function - Passed to _REG: On (1) or Off (0)
*
* RETURN: Status
*
......@@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch (
if (!region_setup) {
/* No initialization routine, exit with error */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n",
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No init routine for region(%p) [%s]\n",
region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
return_ACPI_STATUS (AE_NOT_EXIST);
}
/*
* We must exit the interpreter because the region setup will potentially
* execute control methods (e.g., _REG method for this region)
* We must exit the interpreter because the region
* setup will potentially execute control methods
* (e.g., _REG method for this region)
*/
acpi_ex_exit_interpreter ();
......@@ -621,7 +639,7 @@ acpi_ev_attach_region (
*
******************************************************************************/
acpi_status
static acpi_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
......@@ -848,7 +866,8 @@ acpi_ev_install_space_handler (
if (handler_obj->address_space.handler == handler) {
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen with PCI_Config space.
* handler twice. This can easily happen
* with PCI_Config space.
*/
status = AE_SAME_HANDLER;
goto unlock_and_exit;
......@@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods (
*
******************************************************************************/
acpi_status
static acpi_status
acpi_ev_reg_run (
acpi_handle obj_handle,
u32 level,
......
......@@ -61,7 +61,7 @@
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling, a nop for now
* DESCRIPTION: Setup a system_memory operation region
*
******************************************************************************/
......@@ -115,7 +115,7 @@ acpi_ev_system_memory_region_setup (
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
* DESCRIPTION: Setup a IO operation region
*
******************************************************************************/
......@@ -144,14 +144,14 @@ acpi_ev_io_space_region_setup (
*
* FUNCTION: acpi_ev_pci_config_region_setup
*
* PARAMETERS: Handle - Region we are interested in
* PARAMETERS: Handle - Region we are interested in
* Function - Start or stop
* handler_context - Address space handler context
* region_context - Region specific context
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
* DESCRIPTION: Setup a PCI_Config operation region
*
* MUTEX: Assumes namespace is not locked
*
......@@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup (
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
* DESCRIPTION: Setup a pci_bAR operation region
*
* MUTEX: Assumes namespace is not locked
*
......@@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup (
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
* DESCRIPTION: Setup a CMOS operation region
*
* MUTEX: Assumes namespace is not locked
*
......@@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup (
*
* RETURN: Status
*
* DESCRIPTION: Do any prep work for region handling
* DESCRIPTION: Default region initialization
*
******************************************************************************/
......
......@@ -49,6 +49,12 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evsci")
/* Local prototypes */
static u32 ACPI_SYSTEM_XFACE
acpi_ev_sci_xrupt_handler (
void *context);
/*******************************************************************************
*
......@@ -146,7 +152,8 @@ acpi_ev_gpe_xrupt_handler (
******************************************************************************/
u32
acpi_ev_install_sci_handler (void)
acpi_ev_install_sci_handler (
void)
{
u32 status = AE_OK;
......@@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void)
******************************************************************************/
acpi_status
acpi_ev_remove_sci_handler (void)
acpi_ev_remove_sci_handler (
void)
{
acpi_status status;
......
......@@ -64,6 +64,7 @@
* DESCRIPTION: Saves the pointer to the handler function
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_install_exception_handler (
......@@ -457,7 +458,8 @@ acpi_remove_notify_handler (
/* Root Object */
if (device == ACPI_ROOT_OBJECT) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Removing notify handler for ROOT object.\n"));
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
!acpi_gbl_system_notify.handler) ||
......@@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
*
* FUNCTION: acpi_install_gpe_handler
*
* PARAMETERS: gpe_number - The GPE number within the GPE block
* gpe_block - GPE block (NULL == FADT GPEs)
* PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
* defined GPEs)
* gpe_number - The GPE number within the GPE block
* Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt.
* Address - Address of the handler
......@@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
*
* FUNCTION: acpi_remove_gpe_handler
*
* PARAMETERS: gpe_number - The event to remove a handler
* gpe_block - GPE block (NULL == FADT GPEs)
* PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
* defined GPEs)
* gpe_number - The event to remove a handler
* Address - Address of the handler
*
* RETURN: Status
......@@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
* FUNCTION: acpi_acquire_global_lock
*
* PARAMETERS: Timeout - How long the caller is willing to wait
* out_handle - A handle to the lock if acquired
* Handle - Where the handle to the lock is returned
* (if acquired)
*
* RETURN: Status
*
......@@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
*
* RETURN: Status
*
* DESCRIPTION: Release the ACPI Global Lock
* DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
*
******************************************************************************/
......
......@@ -64,7 +64,8 @@
******************************************************************************/
acpi_status
acpi_enable (void)
acpi_enable (
void)
{
acpi_status status = AE_OK;
......@@ -91,7 +92,8 @@ acpi_enable (void)
return_ACPI_STATUS (status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Transition to ACPI mode successful\n"));
}
return_ACPI_STATUS (status);
......@@ -106,12 +108,13 @@ acpi_enable (void)
*
* RETURN: Status
*
* DESCRIPTION: Transfers the system into LEGACY mode.
* DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
*
******************************************************************************/
acpi_status
acpi_disable (void)
acpi_disable (
void)
{
acpi_status status = AE_OK;
......@@ -125,7 +128,8 @@ acpi_disable (void)
}
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"System is already in legacy (non-ACPI) mode\n"));
}
else {
/* Transition to LEGACY mode */
......@@ -133,7 +137,8 @@ acpi_disable (void)
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode"));
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS (status);
}
......@@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event);
*
* RETURN: Status
*
* DESCRIPTION: Enable an ACPI event (general purpose)
* DESCRIPTION: Set the type of an individual GPE
*
******************************************************************************/
......@@ -519,13 +524,12 @@ acpi_clear_gpe (
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
* FUNCTION: acpi_get_event_status
*
* PARAMETERS: Event - The fixed event
* Event Status - Where the current status of the event will
* event_status - Where the current status of the event will
* be returned
*
* RETURN: Status
......@@ -571,7 +575,7 @@ acpi_get_event_status (
* PARAMETERS: gpe_device - Parent GPE Device
* gpe_number - GPE level within the GPE block
* Flags - Called from an ISR or not
* Event Status - Where the current status of the event will
* event_status - Where the current status of the event will
* be returned
*
* RETURN: Status
......@@ -775,4 +779,5 @@ acpi_remove_gpe_block (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status);
}
EXPORT_SYMBOL(acpi_remove_gpe_block);
......@@ -54,6 +54,14 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconfig")
/* Local prototypes */
static acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
union acpi_operand_object **ddb_handle);
/*******************************************************************************
*
......@@ -70,7 +78,7 @@
*
******************************************************************************/
acpi_status
static acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
......@@ -95,10 +103,10 @@ acpi_ex_add_table (
ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
table_info.type = ACPI_TABLE_SSDT;
table_info.pointer = table;
table_info.length = (acpi_size) table->length;
table_info.allocation = ACPI_MEM_ALLOCATED;
table_info.type = ACPI_TABLE_SSDT;
table_info.pointer = table;
table_info.length = (acpi_size) table->length;
table_info.allocation = ACPI_MEM_ALLOCATED;
status = acpi_tb_install_table (&table_info);
if (ACPI_FAILURE (status)) {
......@@ -226,11 +234,10 @@ acpi_ex_load_table_op (
start_node = parent_node;
}
/*
* Find the node referenced by the parameter_path_string
*/
/* Find the node referenced by the parameter_path_string */
status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
ACPI_NS_SEARCH_PARENT, &parameter_node);
ACPI_NS_SEARCH_PARENT, &parameter_node);
if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status);
}
......@@ -248,7 +255,8 @@ acpi_ex_load_table_op (
if (parameter_node) {
/* Store the parameter data into the optional parameter object */
status = acpi_ex_store (operand[5], ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
status = acpi_ex_store (operand[5],
ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
walk_state);
if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle);
......@@ -371,7 +379,8 @@ acpi_ex_load_op (
goto cleanup;
}
table_ptr = ACPI_CAST_PTR (struct acpi_table_header, buffer_desc->buffer.pointer);
table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
buffer_desc->buffer.pointer);
/* Sanity check the table length */
......
......@@ -50,6 +50,15 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconvrt")
/* Local prototypes */
static u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u16 base,
u8 *string,
u8 max_length);
/*******************************************************************************
*
......@@ -115,9 +124,8 @@ acpi_ex_convert_to_integer (
*/
result = 0;
/*
* String conversion is different than Buffer conversion
*/
/* String conversion is different than Buffer conversion */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_STRING:
......@@ -168,9 +176,8 @@ acpi_ex_convert_to_integer (
break;
}
/*
* Create a new integer
*/
/* Create a new integer */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
......@@ -251,7 +258,8 @@ acpi_ex_convert_to_buffer (
* ASL/AML code that depends on the null being transferred to the new
* buffer.
*/
return_desc = acpi_ut_create_buffer_object ((acpi_size) obj_desc->string.length + 1);
return_desc = acpi_ut_create_buffer_object (
(acpi_size) obj_desc->string.length + 1);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
}
......@@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer (
*
******************************************************************************/
u32
static u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u16 base,
......@@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii (
case 16:
hex_length = ACPI_MUL_2 (data_width); /* 2 ascii hex chars per data byte */
/* hex_length: 2 ascii hex chars per data byte */
hex_length = ACPI_MUL_2 (data_width);
for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */
......@@ -475,7 +484,7 @@ acpi_ex_convert_to_string (
/* Setup string length, base, and separator */
switch (type) {
case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string operator */
case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
/*
* From ACPI: "If Data is a buffer, it is converted to a string of
* decimal values separated by commas."
......@@ -509,7 +518,7 @@ acpi_ex_convert_to_string (
string_length = (obj_desc->buffer.length * 3);
break;
case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string operator */
case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
/*
* From ACPI: "If Data is a buffer, it is converted to a string of
* hexadecimal values separated by commas."
......@@ -530,9 +539,8 @@ acpi_ex_convert_to_string (
return_ACPI_STATUS (AE_AML_STRING_LIMIT);
}
/*
* Create a new string object and string buffer
*/
/* Create a new string object and string buffer */
return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY);
......@@ -551,8 +559,10 @@ acpi_ex_convert_to_string (
*new_buf++ = separator; /* each separated by a comma or space */
}
/* Null terminate the string (overwrites final comma/space from above) */
/*
* Null terminate the string
* (overwrites final comma/space from above)
*/
new_buf--;
*new_buf = 0;
break;
......@@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type (
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
......@@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type (
case ACPI_TYPE_BUFFER:
/*
* The operand must be a Buffer. We can convert an
* Integer or String if necessary
......
This diff is collapsed.
This diff is collapsed.
......@@ -120,8 +120,8 @@ acpi_ex_read_data_from_field (
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
status = acpi_ex_access_region (obj_desc, 0,
ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
ACPI_READ | (obj_desc->field.attribute << 16));
ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
ACPI_READ | (obj_desc->field.attribute << 16));
acpi_ex_release_global_lock (locked);
goto exit;
}
......@@ -196,6 +196,7 @@ acpi_ex_read_data_from_field (
*
* PARAMETERS: source_desc - Contains data to write
* obj_desc - The named field
* result_desc - Where the return value is returned, if any
*
* RETURN: Status
*
......@@ -250,12 +251,15 @@ acpi_ex_write_data_to_field (
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n",
ACPI_REPORT_ERROR ((
"SMBus write requires Buffer of length %X, found length %X\n",
ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
......@@ -265,14 +269,16 @@ acpi_ex_write_data_to_field (
}
buffer = buffer_desc->buffer.pointer;
ACPI_MEMCPY (buffer, source_desc->buffer.pointer, ACPI_SMBUS_BUFFER_SIZE);
ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
ACPI_SMBUS_BUFFER_SIZE);
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
/*
* Perform the write (returns status and perhaps data in the same buffer)
* Perform the write (returns status and perhaps data in the
* same buffer)
* Note: SMBus protocol type is passed in upper 16-bits of Function.
*/
status = acpi_ex_access_region (obj_desc, 0,
......@@ -284,9 +290,8 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS (status);
}
/*
* Get a pointer to the data to be written
*/
/* Get a pointer to the data to be written */
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value;
......@@ -314,7 +319,8 @@ acpi_ex_write_data_to_field (
* the ACPI specification.
*/
new_buffer = NULL;
required_length = ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->common_field.bit_length);
required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.bit_length);
if (length < required_length) {
/* We need to create a new buffer */
......@@ -338,6 +344,7 @@ acpi_ex_write_data_to_field (
"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
......
This diff is collapsed.
......@@ -139,8 +139,9 @@ acpi_ex_get_object_reference (
reference_obj->reference.object = referenced_obj;
*return_desc = reference_obj;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Object %p Type [%s], returning Reference %p\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
return_ACPI_STATUS (AE_OK);
}
......@@ -456,7 +457,7 @@ acpi_ex_do_math_op (
return (integer0 * integer1);
case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/
return (integer0 << integer1);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -97,11 +97,12 @@ acpi_ex_opcode_3A_0T_0R (
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode));
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) {
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
......@@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R (
fatal->argument = (u32) operand[2]->integer.value;
}
/*
* Always signal the OS!
*/
/* Always signal the OS! */
status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
/* Might return while OS is shutting down, just continue */
......@@ -162,21 +162,23 @@ acpi_ex_opcode_3A_1T_1R (
union acpi_operand_object *return_desc = NULL;
char *buffer;
acpi_status status = AE_OK;
acpi_native_uint index;
acpi_integer index;
acpi_size length;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode));
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) {
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
/*
* Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type.
*/
return_desc = acpi_ut_create_internal_object (ACPI_GET_OBJECT_TYPE (operand[0]));
return_desc = acpi_ut_create_internal_object (
ACPI_GET_OBJECT_TYPE (operand[0]));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
......@@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R (
/* Get the Integer values from the objects */
index = (acpi_native_uint) operand[1]->integer.value;
index = operand[1]->integer.value;
length = (acpi_size) operand[2]->integer.value;
/*
......@@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R (
if ((index + length) >
operand[0]->string.length) {
length = (acpi_size) operand[0]->string.length - index;
length = (acpi_size) operand[0]->string.length -
(acpi_size) index;
}
/* Allocate a new buffer for the String/Buffer */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -56,7 +56,7 @@
*
* PARAMETERS: Type - Type of node to be searched for
* parent_node - Parent node whose children we are
* getting
* getting
* child_node - Previous child that was found.
* The NEXT child will be returned
*
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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