Merge master.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-2.6

This commit is contained in:
Linus Torvalds 2005-07-12 16:04:50 -07:00
commit 3f603ed319
198 changed files with 7796 additions and 5469 deletions

View File

@ -0,0 +1,35 @@
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.

View File

@ -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)
{ {
} }

View File

@ -2,3 +2,7 @@ obj-$(CONFIG_ACPI_BOOT) := boot.o
obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += cstate.o
endif

View File

@ -0,0 +1,103 @@
/*
* 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);

View File

@ -74,8 +74,9 @@ wakeup_code:
movw %ax,%fs movw %ax,%fs
movw $0x0e00 + 'i', %fs:(0x12) movw $0x0e00 + 'i', %fs:(0x12)
# need a gdt # need a gdt -- use lgdtl to force 32-bit operands, in case
lgdt real_save_gdt - wakeup_code # the GDT is located past 16 megabytes.
lgdtl real_save_gdt - wakeup_code
movl real_save_cr0 - wakeup_code, %eax movl real_save_cr0 - wakeup_code, %eax
movl %eax, %cr0 movl %eax, %cr0

View File

@ -375,7 +375,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
arg0.buffer.pointer = (u8 *) arg0_buf; arg0.buffer.pointer = (u8 *) arg0_buf;
arg0_buf[0] = ACPI_PDC_REVISION_ID; arg0_buf[0] = ACPI_PDC_REVISION_ID;
arg0_buf[1] = 1; 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; p.pdc = &arg_list;

View File

@ -1051,24 +1051,28 @@ static int __init pcibios_irq_init(void)
subsys_initcall(pcibios_irq_init); 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 * If any ISAPnP device reports an IRQ in its list of possible
* IRQ's, we try to avoid assigning it to PCI devices. * IRQ's, we try to avoid assigning it to PCI devices.
*/ */
if (irq < 16) if (irq < 16) {
if (active)
pirq_penalty[irq] += 1000;
else
pirq_penalty[irq] += 100; pirq_penalty[irq] += 100;
} }
}
void pcibios_penalize_isa_irq(int irq) void pcibios_penalize_isa_irq(int irq, int active)
{ {
#ifdef CONFIG_ACPI_PCI #ifdef CONFIG_ACPI_PCI
if (!acpi_noirq) if (!acpi_noirq)
acpi_penalize_isa_irq(irq); acpi_penalize_isa_irq(irq, active);
else else
#endif #endif
pirq_penalize_isa_irq(irq); pirq_penalize_isa_irq(irq, active);
} }
static int pirq_enable_irq(struct pci_dev *dev) static int pirq_enable_irq(struct pci_dev *dev)

View File

@ -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; 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; unsigned int pci_bus0, pci_bus1;

View File

@ -11,6 +11,7 @@
* Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com> * Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com>
* Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com> * Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
* Copyright (C) 2002 Erich Focht <efocht@ess.nec.de> * 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_kbd_controller_present = 1;
unsigned char acpi_legacy_devices; 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 #define MAX_SAPICS 256
u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
{ [0 ... MAX_SAPICS - 1] = -1 }; { [0 ... MAX_SAPICS - 1] = -1 };
@ -265,10 +271,56 @@ acpi_parse_plat_int_src (
(plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
platform_intr_list[plintsrc->type] = vector; 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; 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 static int __init
acpi_parse_int_src_ovr ( acpi_parse_int_src_ovr (
acpi_table_entry_header *header, const unsigned long end) 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 = (struct acpi_table_madt *) __va(phys_addr);
acpi_madt_rev = acpi_madt->header.revision;
/* remember the value for reference after free_initmem() */ /* remember the value for reference after free_initmem() */
#ifdef CONFIG_ITANIUM #ifdef CONFIG_ITANIUM
has_8259 = 1; /* Firmware on old Itanium systems is broken */ has_8259 = 1; /* Firmware on old Itanium systems is broken */

View File

@ -271,7 +271,7 @@ ia64_mca_log_sal_error_record(int sal_info_type)
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
static int cpe_vector = -1; int cpe_vector = -1;
static irqreturn_t static irqreturn_t
ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs) ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)

View File

@ -196,6 +196,7 @@ update_pal_halt_status(int status)
void void
default_idle (void) default_idle (void)
{ {
local_irq_enable();
while (!need_resched()) while (!need_resched())
if (can_do_pal_halt) if (can_do_pal_halt)
safe_halt(); safe_halt();

View File

@ -40,6 +40,8 @@
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/efi.h> #include <linux/efi.h>
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/platform.h>
#include <linux/pm.h>
#include <asm/ia32.h> #include <asm/ia32.h>
#include <asm/machvec.h> #include <asm/machvec.h>
@ -783,6 +785,7 @@ cpu_init (void)
/* size of physical stacked register partition plus 8 bytes: */ /* size of physical stacked register partition plus 8 bytes: */
__get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8; __get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
platform_cpu_init(); platform_cpu_init();
pm_idle = default_idle;
} }
void void

View File

@ -36,6 +36,13 @@ int arch_register_cpu(int num)
parent = &sysfs_nodes[cpu_to_node(num)]; parent = &sysfs_nodes[cpu_to_node(num)];
#endif /* CONFIG_NUMA */ #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); return register_cpu(&sysfs_cpus[num].cpu, num, parent);
} }

View File

@ -3,6 +3,7 @@
# #
menu "ACPI (Advanced Configuration and Power Interface) Support" menu "ACPI (Advanced Configuration and Power Interface) Support"
depends on PM
depends on !X86_VISWS depends on !X86_VISWS
depends on !IA64_HP_SIM depends on !IA64_HP_SIM
depends on IA64 || X86 depends on IA64 || X86
@ -48,7 +49,6 @@ config ACPI_BOOT
config ACPI_INTERPRETER config ACPI_INTERPRETER
bool bool
depends on !IA64_SGI_SN
default y default y
if ACPI_INTERPRETER if ACPI_INTERPRETER
@ -79,6 +79,14 @@ config ACPI_SLEEP_PROC_FS
depends on ACPI_SLEEP && PROC_FS depends on ACPI_SLEEP && PROC_FS
default y 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 config ACPI_AC
tristate "AC Adapter" tristate "AC Adapter"
depends on X86 depends on X86
@ -99,7 +107,6 @@ config ACPI_BATTERY
config ACPI_BUTTON config ACPI_BUTTON
tristate "Button" tristate "Button"
depends on !IA64_SGI_SN
default m default m
help help
This driver registers for events based on buttons, such as the This driver registers for events based on buttons, such as the
@ -111,7 +118,6 @@ config ACPI_BUTTON
config ACPI_VIDEO config ACPI_VIDEO
tristate "Video" tristate "Video"
depends on EXPERIMENTAL depends on EXPERIMENTAL
depends on !IA64_SGI_SN
default m default m
help help
This driver implement the ACPI Extensions For Display Adapters 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 Note that this is an ref. implementation only. It may or may not work
for your integrated video device. 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 config ACPI_FAN
tristate "Fan" tristate "Fan"
depends on !IA64_SGI_SN
default m default m
help help
This driver adds support for ACPI fan devices, allowing user-mode This driver adds support for ACPI fan devices, allowing user-mode
@ -132,7 +146,6 @@ config ACPI_FAN
config ACPI_PROCESSOR config ACPI_PROCESSOR
tristate "Processor" tristate "Processor"
depends on !IA64_SGI_SN
default m default m
help help
This driver installs ACPI as the idle handler for Linux, and uses This driver installs ACPI as the idle handler for Linux, and uses
@ -142,7 +155,6 @@ config ACPI_PROCESSOR
config ACPI_HOTPLUG_CPU config ACPI_HOTPLUG_CPU
bool "Processor Hotplug (EXPERIMENTAL)" bool "Processor Hotplug (EXPERIMENTAL)"
depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL depends on ACPI_PROCESSOR && HOTPLUG_CPU && EXPERIMENTAL
depends on !IA64_SGI_SN
select ACPI_CONTAINER select ACPI_CONTAINER
default n default n
---help--- ---help---
@ -262,7 +274,6 @@ config ACPI_BLACKLIST_YEAR
config ACPI_DEBUG config ACPI_DEBUG
bool "Debug Statements" bool "Debug Statements"
depends on !IA64_SGI_SN
default n default n
help help
The ACPI driver can optionally report errors with a great deal The ACPI driver can optionally report errors with a great deal
@ -271,7 +282,6 @@ config ACPI_DEBUG
config ACPI_BUS config ACPI_BUS
bool bool
depends on !IA64_SGI_SN
default y default y
config ACPI_EC config ACPI_EC
@ -285,17 +295,14 @@ config ACPI_EC
config ACPI_POWER config ACPI_POWER
bool bool
depends on !IA64_SGI_SN
default y default y
config ACPI_PCI config ACPI_PCI
bool bool
depends on !IA64_SGI_SN
default PCI default PCI
config ACPI_SYSTEM config ACPI_SYSTEM
bool bool
depends on !IA64_SGI_SN
default y default y
help help
This driver will enable your system to shut down using ACPI, and This driver will enable your system to shut down using ACPI, and
@ -327,8 +334,13 @@ config ACPI_CONTAINER
depends on EXPERIMENTAL depends on EXPERIMENTAL
default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO) default (ACPI_HOTPLUG_MEMORY || ACPI_HOTPLUG_CPU || ACPI_HOTPLUG_IO)
---help--- ---help---
This is the ACPI generic container driver which supports This allows _physical_ insertion and removal of CPUs and memory.
ACPI0004, PNP0A05 and PNP0A06 devices 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 config ACPI_HOTPLUG_MEMORY
tristate "Memory Hotplug" tristate "Memory Hotplug"

View File

@ -36,13 +36,14 @@ processor-objs += processor_perflib.o
endif endif
obj-$(CONFIG_ACPI_BUS) += sleep/ 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_AC) += ac.o
obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_BATTERY) += battery.o
obj-$(CONFIG_ACPI_BUTTON) += button.o obj-$(CONFIG_ACPI_BUTTON) += button.o
obj-$(CONFIG_ACPI_EC) += ec.o obj-$(CONFIG_ACPI_EC) += ec.o
obj-$(CONFIG_ACPI_FAN) += fan.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_PCI) += pci_root.o pci_link.o pci_irq.o pci_bind.o
obj-$(CONFIG_ACPI_POWER) += power.o obj-$(CONFIG_ACPI_POWER) += power.o
obj-$(CONFIG_ACPI_PROCESSOR) += processor.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o

View File

@ -1204,6 +1204,10 @@ static int __init asus_acpi_init(void)
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; 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); asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir);
if (!asus_proc_dir) { if (!asus_proc_dir) {
printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n"); printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n");

View File

@ -212,6 +212,12 @@ acpi_bus_set_power (
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n")); ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
return_VALUE(-ENODEV); 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) { if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
return_VALUE(0); return_VALUE(0);

View File

@ -26,9 +26,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.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_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
@ -36,9 +33,6 @@
#define ACPI_BUTTON_COMPONENT 0x00080000 #define ACPI_BUTTON_COMPONENT 0x00080000
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_CLASS "button" #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_NOTIFY_STATUS 0x80
#define ACPI_BUTTON_SUBCLASS_POWER "power" #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_add (struct acpi_device *device);
static int acpi_button_remove (struct acpi_device *device, int type); 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 = { static struct acpi_driver acpi_button_driver = {
.name = ACPI_BUTTON_DRIVER_NAME, .name = ACPI_BUTTON_DRIVER_NAME,
@ -90,187 +82,6 @@ struct acpi_button {
unsigned long pushed; 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 Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
@ -310,8 +121,7 @@ acpi_button_notify_fixed (
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
if (!button) BUG_ON(!button);
return_ACPI_STATUS(AE_BAD_PARAMETER);
acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
@ -327,10 +137,6 @@ acpi_button_add (
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_button *button = NULL; 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"); ACPI_FUNCTION_TRACE("acpi_button_add");
if (!device) if (!device)
@ -391,42 +197,6 @@ acpi_button_add (
goto end; 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) { switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF: case ACPI_BUTTON_TYPE_POWERF:
status = acpi_install_fixed_event_handler ( status = acpi_install_fixed_event_handler (
@ -470,7 +240,6 @@ acpi_button_add (
end: end:
if (result) { if (result) {
acpi_button_remove_fs(device);
kfree(button); kfree(button);
} }
@ -511,8 +280,6 @@ acpi_button_remove (struct acpi_device *device, int type)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n")); "Error removing notify handler\n"));
acpi_button_remove_fs(device);
kfree(button); kfree(button);
return_VALUE(0); return_VALUE(0);
@ -526,21 +293,14 @@ acpi_button_init (void)
ACPI_FUNCTION_TRACE("acpi_button_init"); 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); result = acpi_bus_register_driver(&acpi_button_driver);
if (result < 0) { if (result < 0) {
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
return_VALUE(0); return_VALUE(0);
} }
static void __exit static void __exit
acpi_button_exit (void) acpi_button_exit (void)
{ {
@ -548,11 +308,8 @@ acpi_button_exit (void)
acpi_bus_unregister_driver(&acpi_button_driver); acpi_bus_unregister_driver(&acpi_button_driver);
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
return_VOID; return_VOID;
} }
module_init(acpi_button_init); module_init(acpi_button_init);
module_exit(acpi_button_exit); module_exit(acpi_button_exit);

View File

@ -53,13 +53,20 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsfield") 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 * FUNCTION: acpi_ds_create_buffer_field
* *
* PARAMETERS: Opcode - The opcode to be executed * PARAMETERS: Op - Current parse op (create_xXField)
* Operands - List of operands for the opcode
* walk_state - Current state * walk_state - Current state
* *
* RETURN: Status * RETURN: Status
@ -70,7 +77,7 @@
* create_word_field_op, * create_word_field_op,
* create_dword_field_op, * create_dword_field_op,
* create_qword_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; flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
} }
else { 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 /* We could put the returned object (Node) on the object stack for later,
* for now, we will put it in the "op" object that the parser uses, so we * but for now, we will put it in the "op" object that the parser uses,
* can get it again at the end of this scope * so we can get it again at the end of this scope
*/ */
op->common.node = node; op->common.node = node;
/* /*
* If there is no object attached to the node, this node was just created and * If there is no object attached to the node, this node was just created
* we need to create the field object. Otherwise, this was a lookup of an * and we need to create the field object. Otherwise, this was a lookup
* existing node and we don't want to create the field object again. * of an existing node and we don't want to create the field object again.
*/ */
obj_desc = acpi_ns_get_attached_object (node); obj_desc = acpi_ns_get_attached_object (node);
if (obj_desc) { if (obj_desc) {
@ -205,7 +213,7 @@ cleanup:
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_get_field_names ( acpi_ds_get_field_names (
struct acpi_create_field_info *info, struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
@ -238,7 +246,8 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size; + (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) { 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); return_ACPI_STATUS (AE_SUPPORT);
} }
@ -250,11 +259,14 @@ acpi_ds_get_field_names (
/* /*
* Get a new access_type and access_attribute -- to be used for all * 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)) | info->field_flags = (u8)
((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8))); ((u8) ((u32) arg->common.value.integer >> 8)));
info->attribute = (u8) (arg->common.value.integer); info->attribute = (u8) (arg->common.value.integer);
@ -267,7 +279,8 @@ acpi_ds_get_field_names (
status = acpi_ns_lookup (walk_state->scope_info, status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name, (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); walk_state, &info->field_node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
@ -295,7 +308,8 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size; + (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) { if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", ACPI_REPORT_ERROR ((
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
(char *) &info->field_node->name)); (char *) &info->field_node->name));
return_ACPI_STATUS (AE_SUPPORT); return_ACPI_STATUS (AE_SUPPORT);
} }
@ -306,7 +320,8 @@ acpi_ds_get_field_names (
default: 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)); arg->common.aml_opcode));
return_ACPI_STATUS (AE_AML_BAD_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, status = acpi_ns_lookup (walk_state->scope_info,
(char *) &arg->named.name, (char *) &arg->named.name,
type, ACPI_IMODE_LOAD_PASS1, 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); walk_state, &node);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status); ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);

View File

@ -49,12 +49,21 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit") 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 * FUNCTION: acpi_ds_init_one_object
* *
* PARAMETERS: obj_handle - Node * PARAMETERS: obj_handle - Node for the object
* Level - Current nesting level * Level - Current nesting level
* Context - Points to a init info struct * Context - Points to a init info struct
* return_value - Not used * return_value - Not used
@ -70,7 +79,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_init_one_object ( acpi_ds_init_one_object (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
@ -105,7 +114,8 @@ acpi_ds_init_one_object (
status = acpi_ds_initialize_region (obj_handle); status = acpi_ds_initialize_region (obj_handle);
if (ACPI_FAILURE (status)) { 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), obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status))); acpi_format_exception (status)));
} }
@ -118,8 +128,10 @@ acpi_ds_init_one_object (
info->method_count++; 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)) { if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, ".")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
} }
@ -140,7 +152,8 @@ acpi_ds_init_one_object (
*/ */
status = acpi_ds_parse_method (obj_handle); status = acpi_ds_parse_method (obj_handle);
if (ACPI_FAILURE (status)) { 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), obj_handle, acpi_ut_get_node_name (obj_handle),
acpi_format_exception (status))); acpi_format_exception (status)));
@ -154,7 +167,8 @@ acpi_ds_init_one_object (
* for every execution since there isn't much overhead * for every execution since there isn't much overhead
*/ */
acpi_ns_delete_namespace_subtree (obj_handle); 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; break;

View File

@ -153,12 +153,11 @@ acpi_ds_parse_method (
/* /*
* Parse the method, first pass * Parse the method, first pass
* *
* The first pass load is where newly declared named objects are * The first pass load is where newly declared named objects are added into
* added into the namespace. Actual evaluation of * the namespace. Actual evaluation of the named objects (what would be
* the named objects (what would be called a "second * called a "second pass") happens during the actual execution of the
* pass") happens during the actual execution of the * method so that operands to the named objects can take on dynamic
* method so that operands to the named objects can * run-time values.
* take on dynamic run-time values.
*/ */
status = acpi_ps_parse_aml (walk_state); status = acpi_ps_parse_aml (walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {

View File

@ -52,6 +52,29 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsmthdat") ACPI_MODULE_NAME ("dsmthdat")
/* Local prototypes */
static void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
static acpi_status
acpi_ds_method_data_set_value (
u16 opcode,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state);
#ifdef ACPI_OBSOLETE_FUNCTIONS
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
#endif
/******************************************************************************* /*******************************************************************************
* *
@ -62,8 +85,8 @@
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Initialize the data structures that hold the method's arguments * DESCRIPTION: Initialize the data structures that hold the method's arguments
* and locals. The data struct is an array of NTEs for each. * and locals. The data struct is an array of namespace nodes for
* This allows ref_of and de_ref_of to work properly for these * each - this allows ref_of and de_ref_of to work properly for these
* special data types. * special data types.
* *
* NOTES: walk_state fields are initialized to zero by the * NOTES: walk_state fields are initialized to zero by the
@ -92,7 +115,8 @@ acpi_ds_method_data_init (
walk_state->arguments[i].name.integer |= (i << 24); walk_state->arguments[i].name.integer |= (i << 24);
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->arguments[i].type = ACPI_TYPE_ANY; walk_state->arguments[i].type = ACPI_TYPE_ANY;
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG; walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_ARG;
} }
/* Init the method locals */ /* Init the method locals */
@ -104,7 +128,8 @@ acpi_ds_method_data_init (
walk_state->local_variables[i].name.integer |= (i << 24); walk_state->local_variables[i].name.integer |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED; walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY; walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_LOCAL;
} }
return_VOID; return_VOID;
@ -200,13 +225,16 @@ acpi_ds_method_data_init_args (
/* Copy passed parameters into the new method stack frame */ /* Copy passed parameters into the new method stack frame */
while ((index < ACPI_METHOD_NUM_ARGS) && (index < max_param_count) && params[index]) { while ((index < ACPI_METHOD_NUM_ARGS) &&
(index < max_param_count) &&
params[index]) {
/* /*
* A valid parameter. * A valid parameter.
* Store the argument in the method/walk descriptor. * Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference * Do not copy the arg in order to implement call by reference
*/ */
status = acpi_ds_method_data_set_value (AML_ARG_OP, index, params[index], walk_state); status = acpi_ds_method_data_set_value (AML_ARG_OP, index,
params[index], walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -224,11 +252,13 @@ acpi_ds_method_data_init_args (
* FUNCTION: acpi_ds_method_data_get_node * FUNCTION: acpi_ds_method_data_get_node
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument whose type * Index - Which Local or Arg whose type to get
* to get
* walk_state - Current walk state object * walk_state - Current walk state object
* Node - Where the node is returned.
* *
* RETURN: Get the Node associated with a local or arg. * RETURN: Status and node
*
* DESCRIPTION: Get the Node associated with a local or arg.
* *
******************************************************************************/ ******************************************************************************/
@ -249,7 +279,8 @@ acpi_ds_method_data_get_node (
case AML_LOCAL_OP: case AML_LOCAL_OP:
if (index > ACPI_METHOD_MAX_LOCAL) { if (index > ACPI_METHOD_MAX_LOCAL) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Local index %d is invalid (max %d)\n",
index, ACPI_METHOD_MAX_LOCAL)); index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX); return_ACPI_STATUS (AE_AML_INVALID_INDEX);
} }
@ -262,7 +293,8 @@ acpi_ds_method_data_get_node (
case AML_ARG_OP: case AML_ARG_OP:
if (index > ACPI_METHOD_MAX_ARG) { if (index > ACPI_METHOD_MAX_ARG) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Arg index %d is invalid (max %d)\n",
index, ACPI_METHOD_MAX_ARG)); index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX); return_ACPI_STATUS (AE_AML_INVALID_INDEX);
} }
@ -286,7 +318,7 @@ acpi_ds_method_data_get_node (
* FUNCTION: acpi_ds_method_data_set_value * FUNCTION: acpi_ds_method_data_set_value
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument to get * Index - Which Local or Arg to get
* Object - Object to be inserted into the stack entry * Object - Object to be inserted into the stack entry
* walk_state - Current walk state object * walk_state - Current walk state object
* *
@ -297,7 +329,7 @@ acpi_ds_method_data_get_node (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_method_data_set_value ( acpi_ds_method_data_set_value (
u16 opcode, u16 opcode,
u32 index, u32 index,
@ -338,56 +370,6 @@ acpi_ds_method_data_set_value (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_get_type
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument whose type
* to get
* walk_state - Current walk state object
*
* RETURN: Data type of current value of the selected Arg or Local
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state)
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
/* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_VALUE ((ACPI_TYPE_NOT_FOUND));
}
/* Get the object */
object = acpi_ns_get_attached_object (node);
if (!object) {
/* Uninitialized local/arg, return TYPE_ANY */
return_VALUE (ACPI_TYPE_ANY);
}
/* Get the object type */
return_VALUE (ACPI_GET_OBJECT_TYPE (object));
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_method_data_get_value * FUNCTION: acpi_ds_method_data_get_value
@ -395,13 +377,11 @@ acpi_ds_method_data_get_type (
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument to get * Index - which local_var or argument to get
* walk_state - Current walk state object * walk_state - Current walk state object
* *dest_desc - Ptr to Descriptor into which selected Arg * dest_desc - Where Arg or Local value is returned
* or Local value should be copied
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Retrieve value of selected Arg or Local from the method frame * DESCRIPTION: Retrieve value of selected Arg or Local for this method
* at the current top of the method stack.
* Used only in acpi_ex_resolve_to_value(). * Used only in acpi_ex_resolve_to_value().
* *
******************************************************************************/ ******************************************************************************/
@ -467,14 +447,16 @@ acpi_ds_method_data_get_value (
else switch (opcode) { else switch (opcode) {
case AML_ARG_OP: case AML_ARG_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Uninitialized Arg[%d] at node %p\n",
index, node)); index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP: case AML_LOCAL_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Uninitialized Local[%d] at node %p\n",
index, node)); index, node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
@ -506,12 +488,12 @@ acpi_ds_method_data_get_value (
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts * DESCRIPTION: Delete the entry at Opcode:Index. Inserts
* a null into the stack slot after the object is deleted. * a null into the stack slot after the object is deleted.
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ds_method_data_delete_value ( acpi_ds_method_data_delete_value (
u16 opcode, u16 opcode,
u32 index, u32 index,
@ -562,7 +544,7 @@ acpi_ds_method_data_delete_value (
* FUNCTION: acpi_ds_store_object_to_local * FUNCTION: acpi_ds_store_object_to_local
* *
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - which local_var or argument to set * Index - Which Local or Arg to set
* obj_desc - Value to be stored * obj_desc - Value to be stored
* walk_state - Current walk state * walk_state - Current walk state
* *
@ -651,19 +633,20 @@ acpi_ds_store_object_to_local (
*/ */
if (opcode == AML_ARG_OP) { if (opcode == AML_ARG_OP) {
/* /*
* Make sure that the object is the correct type. This may be overkill, but * Make sure that the object is the correct type. This may be
* it is here because references were NS nodes in the past. Now they are * overkill, butit is here because references were NS nodes in
* operand objects of type Reference. * the past. Now they are operand objects of type Reference.
*/ */
if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) { if (ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n", ACPI_REPORT_ERROR ((
"Invalid descriptor type while storing to method arg: [%s]\n",
acpi_ut_get_descriptor_name (current_obj_desc))); acpi_ut_get_descriptor_name (current_obj_desc)));
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
/* /*
* If we have a valid reference object that came from ref_of(), do the * If we have a valid reference object that came from ref_of(),
* indirect store * do the indirect store
*/ */
if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) && if ((current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) { (current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
@ -713,3 +696,55 @@ acpi_ds_store_object_to_local (
} }
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_get_type
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - Which Local or Arg whose type to get
* walk_state - Current walk state object
*
* RETURN: Data type of current value of the selected Arg or Local
*
* DESCRIPTION: Get the type of the object stored in the Local or Arg
*
******************************************************************************/
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state)
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
/* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
if (ACPI_FAILURE (status)) {
return_VALUE ((ACPI_TYPE_NOT_FOUND));
}
/* Get the object */
object = acpi_ns_get_attached_object (node);
if (!object) {
/* Uninitialized local/arg, return TYPE_ANY */
return_VALUE (ACPI_TYPE_ANY);
}
/* Get the object type */
return_VALUE (ACPI_GET_OBJECT_TYPE (object));
}
#endif

View File

@ -52,9 +52,15 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject") 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 #ifndef ACPI_NO_METHOD_EXECUTION
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_build_internal_object * FUNCTION: acpi_ds_build_internal_object
* *
@ -67,9 +73,9 @@
* DESCRIPTION: Translate a parser Op object to the equivalent namespace object * DESCRIPTION: Translate a parser Op object to the equivalent namespace object
* Simple objects are any objects other than a package object! * Simple objects are any objects other than a package object!
* *
****************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_build_internal_object ( acpi_ds_build_internal_object (
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
union acpi_parse_object *op, union acpi_parse_object *op,
@ -90,9 +96,11 @@ acpi_ds_build_internal_object (
* Otherwise, go ahead and look it up now * Otherwise, go ahead and look it up now
*/ */
if (!op->common.node) { 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_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)); (struct acpi_namespace_node **) &(op->common.node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -104,12 +112,14 @@ acpi_ds_build_internal_object (
/* Create and init the internal ACPI 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) { if (!obj_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); 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)) { if (ACPI_FAILURE (status)) {
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
@ -120,7 +130,7 @@ acpi_ds_build_internal_object (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_build_internal_buffer_obj * 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 * DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object * namespace object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_build_internal_buffer_obj ( acpi_ds_build_internal_buffer_obj (
@ -229,7 +239,7 @@ acpi_ds_build_internal_buffer_obj (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_build_internal_package_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 * DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object * namespace object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_build_internal_package_obj ( acpi_ds_build_internal_package_obj (
@ -331,7 +341,8 @@ acpi_ds_build_internal_package_obj (
if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { if (arg->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
/* Object (package or buffer) is already built */ /* 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 { else {
status = acpi_ds_build_internal_object (walk_state, arg, status = acpi_ds_build_internal_object (walk_state, arg,
@ -348,7 +359,7 @@ acpi_ds_build_internal_package_obj (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_create_node * 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 * DESCRIPTION: Create the object to be associated with a namespace node
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_create_node ( acpi_ds_create_node (
@ -392,7 +403,8 @@ acpi_ds_create_node (
/* Build an internal object for the argument(s) */ /* 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)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -414,7 +426,7 @@ acpi_ds_create_node (
#endif /* ACPI_NO_METHOD_EXECUTION */ #endif /* ACPI_NO_METHOD_EXECUTION */
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_init_object_from_op * FUNCTION: acpi_ds_init_object_from_op
* *
@ -429,7 +441,7 @@ acpi_ds_create_node (
* associated arguments. The namespace object is a more compact * associated arguments. The namespace object is a more compact
* representation of the Op and its arguments. * representation of the Op and its arguments.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_init_object_from_op ( acpi_ds_init_object_from_op (
@ -462,7 +474,8 @@ acpi_ds_init_object_from_op (
/* /*
* Defer evaluation of Buffer term_arg operand * 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_start = op->named.data;
obj_desc->buffer.aml_length = op->named.length; obj_desc->buffer.aml_length = op->named.length;
break; break;
@ -473,7 +486,8 @@ acpi_ds_init_object_from_op (
/* /*
* Defer evaluation of Package term_arg operand * 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_start = op->named.data;
obj_desc->package.aml_length = op->named.length; obj_desc->package.aml_length = op->named.length;
break; break;
@ -486,9 +500,10 @@ acpi_ds_init_object_from_op (
/* /*
* Resolve AML Constants here - AND ONLY HERE! * Resolve AML Constants here - AND ONLY HERE!
* All constants are integers. * All constants are integers.
* We mark the integer with a flag that indicates that it started life * We mark the integer with a flag that indicates that it started
* as a constant -- so that stores to constants will perform as expected (noop). * life as a constant -- so that stores to constants will perform
* (zero_op is used as a placeholder for optional target operands.) * as expected (noop). zero_op is used as a placeholder for optional
* target operands.
*/ */
obj_desc->common.flags = AOPOBJ_AML_CONSTANT; obj_desc->common.flags = AOPOBJ_AML_CONSTANT;
@ -521,7 +536,8 @@ acpi_ds_init_object_from_op (
default: 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; status = AE_AML_OPERAND_TYPE;
break; break;
} }
@ -535,7 +551,8 @@ acpi_ds_init_object_from_op (
default: 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; status = AE_AML_OPERAND_TYPE;
break; break;
} }
@ -570,8 +587,10 @@ acpi_ds_init_object_from_op (
obj_desc->reference.offset = opcode - AML_LOCAL_OP; obj_desc->reference.offset = opcode - AML_LOCAL_OP;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node (AML_LOCAL_OP, obj_desc->reference.offset, status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); obj_desc->reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
#endif #endif
break; break;
@ -584,8 +603,10 @@ acpi_ds_init_object_from_op (
obj_desc->reference.offset = opcode - AML_ARG_OP; obj_desc->reference.offset = opcode - AML_ARG_OP;
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node (AML_ARG_OP, obj_desc->reference.offset, status = acpi_ds_method_data_get_node (AML_ARG_OP,
walk_state, (struct acpi_namespace_node **) &obj_desc->reference.object); obj_desc->reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
#endif #endif
break; break;

View File

@ -54,12 +54,31 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode") ACPI_MODULE_NAME ("dsopcode")
/* Local prototypes */
/***************************************************************************** static acpi_status
acpi_ds_execute_arguments (
struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start);
static acpi_status
acpi_ds_init_buffer_field (
u16 aml_opcode,
union acpi_operand_object *obj_desc,
union acpi_operand_object *buffer_desc,
union acpi_operand_object *offset_desc,
union acpi_operand_object *length_desc,
union acpi_operand_object *result_desc);
/*******************************************************************************
* *
* FUNCTION: acpi_ds_execute_arguments * FUNCTION: acpi_ds_execute_arguments
* *
* PARAMETERS: Node - Parent NS node * PARAMETERS: Node - Object NS node
* scope_node - Parent NS node
* aml_length - Length of executable AML * aml_length - Length of executable AML
* aml_start - Pointer to the AML * aml_start - Pointer to the AML
* *
@ -67,9 +86,9 @@
* *
* DESCRIPTION: Late (deferred) execution of region or field arguments * DESCRIPTION: Late (deferred) execution of region or field arguments
* *
****************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_execute_arguments ( acpi_ds_execute_arguments (
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node, struct acpi_namespace_node *scope_node,
@ -162,7 +181,7 @@ acpi_ds_execute_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_buffer_field_arguments * FUNCTION: acpi_ds_get_buffer_field_arguments
* *
@ -173,7 +192,7 @@ acpi_ds_execute_arguments (
* DESCRIPTION: Get buffer_field Buffer and Index. This implements the late * DESCRIPTION: Get buffer_field Buffer and Index. This implements the late
* evaluation of these field attributes. * evaluation of these field attributes.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_get_buffer_field_arguments ( acpi_ds_get_buffer_field_arguments (
@ -208,7 +227,7 @@ acpi_ds_get_buffer_field_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_buffer_arguments * FUNCTION: acpi_ds_get_buffer_arguments
* *
@ -219,7 +238,7 @@ acpi_ds_get_buffer_field_arguments (
* DESCRIPTION: Get Buffer length and initializer byte list. This implements * DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes. * the late evaluation of these attributes.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_get_buffer_arguments ( acpi_ds_get_buffer_arguments (
@ -255,7 +274,7 @@ acpi_ds_get_buffer_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_package_arguments * FUNCTION: acpi_ds_get_package_arguments
* *
@ -266,7 +285,7 @@ acpi_ds_get_buffer_arguments (
* DESCRIPTION: Get Package length and initializer byte list. This implements * DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes. * the late evaluation of these attributes.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_get_package_arguments ( acpi_ds_get_package_arguments (
@ -353,17 +372,17 @@ acpi_ds_get_region_arguments (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_initialize_region * FUNCTION: acpi_ds_initialize_region
* *
* PARAMETERS: Op - A valid region Op object * PARAMETERS: obj_handle - Region namespace node
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Front end to ev_initialize_region * DESCRIPTION: Front end to ev_initialize_region
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_initialize_region ( acpi_ds_initialize_region (
@ -382,7 +401,7 @@ acpi_ds_initialize_region (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_init_buffer_field * FUNCTION: acpi_ds_init_buffer_field
* *
@ -390,16 +409,16 @@ acpi_ds_initialize_region (
* obj_desc - buffer_field object * obj_desc - buffer_field object
* buffer_desc - Host Buffer * buffer_desc - Host Buffer
* offset_desc - Offset into buffer * offset_desc - Offset into buffer
* Length - Length of field (CREATE_FIELD_OP only) * length_desc - Length of field (CREATE_FIELD_OP only)
* Result - Where to store the result * result_desc - Where to store the result
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Perform actual initialization of a buffer field * DESCRIPTION: Perform actual initialization of a buffer field
* *
****************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ds_init_buffer_field ( acpi_ds_init_buffer_field (
u16 aml_opcode, u16 aml_opcode,
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
@ -435,8 +454,10 @@ acpi_ds_init_buffer_field (
* after resolution in acpi_ex_resolve_operands(). * after resolution in acpi_ex_resolve_operands().
*/ */
if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE (result_desc) != ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
acpi_ps_get_opcode_name (aml_opcode), acpi_ut_get_descriptor_name (result_desc))); "(%s) destination not a NS Node [%s]\n",
acpi_ps_get_opcode_name (aml_opcode),
acpi_ut_get_descriptor_name (result_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
@ -452,9 +473,18 @@ acpi_ds_init_buffer_field (
/* Offset is in bits, count is in bits */ /* Offset is in bits, count is in bits */
field_flags = AML_FIELD_ACCESS_BYTE;
bit_offset = offset; bit_offset = offset;
bit_count = (u32) length_desc->integer.value; bit_count = (u32) length_desc->integer.value;
field_flags = AML_FIELD_ACCESS_BYTE;
/* Must have a valid (>0) bit count */
if (bit_count == 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Attempt to create_field of length 0\n"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
break; break;
case AML_CREATE_BIT_FIELD_OP: case AML_CREATE_BIT_FIELD_OP:
@ -527,7 +557,8 @@ acpi_ds_init_buffer_field (
/* /*
* Initialize areas of the field object that are common to all fields * Initialize areas of the field object that are common to all fields
* For field_flags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) * For field_flags, use LOCK_RULE = 0 (NO_LOCK),
* UPDATE_RULE = 0 (UPDATE_PRESERVE)
*/ */
status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0, status = acpi_ex_prep_common_field_object (obj_desc, field_flags, 0,
bit_offset, bit_count); bit_offset, bit_count);
@ -539,8 +570,8 @@ acpi_ds_init_buffer_field (
/* Reference count for buffer_desc inherits obj_desc count */ /* Reference count for buffer_desc inherits obj_desc count */
buffer_desc->common.reference_count = (u16) (buffer_desc->common.reference_count + buffer_desc->common.reference_count = (u16)
obj_desc->common.reference_count); (buffer_desc->common.reference_count + obj_desc->common.reference_count);
cleanup: cleanup:
@ -569,7 +600,7 @@ cleanup:
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_eval_buffer_field_operands * FUNCTION: acpi_ds_eval_buffer_field_operands
* *
@ -581,7 +612,7 @@ cleanup:
* DESCRIPTION: Get buffer_field Buffer and Index * DESCRIPTION: Get buffer_field Buffer and Index
* Called from acpi_ds_exec_end_op during buffer_field parse tree walk * Called from acpi_ds_exec_end_op during buffer_field parse tree walk
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_eval_buffer_field_operands ( acpi_ds_eval_buffer_field_operands (
@ -656,7 +687,7 @@ acpi_ds_eval_buffer_field_operands (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_eval_region_operands * FUNCTION: acpi_ds_eval_region_operands
* *
@ -668,7 +699,7 @@ acpi_ds_eval_buffer_field_operands (
* DESCRIPTION: Get region address and length * DESCRIPTION: Get region address and length
* Called from acpi_ds_exec_end_op during op_region parse tree walk * Called from acpi_ds_exec_end_op during op_region parse tree walk
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_eval_region_operands ( acpi_ds_eval_region_operands (
@ -686,7 +717,8 @@ acpi_ds_eval_region_operands (
/* /*
* This is where we evaluate the address and length fields of the op_region declaration * This is where we evaluate the address and length fields of the
* op_region declaration
*/ */
node = op->common.node; node = op->common.node;
@ -707,7 +739,8 @@ acpi_ds_eval_region_operands (
/* Resolve the length and address operands to numbers */ /* Resolve the length and address operands to numbers */
status = acpi_ex_resolve_operands (op->common.aml_opcode, ACPI_WALK_OPERANDS, walk_state); status = acpi_ex_resolve_operands (op->common.aml_opcode,
ACPI_WALK_OPERANDS, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -736,7 +769,8 @@ acpi_ds_eval_region_operands (
*/ */
operand_desc = walk_state->operands[walk_state->num_operands - 2]; operand_desc = walk_state->operands[walk_state->num_operands - 2];
obj_desc->region.address = (acpi_physical_address) operand_desc->integer.value; obj_desc->region.address = (acpi_physical_address)
operand_desc->integer.value;
acpi_ut_remove_reference (operand_desc); acpi_ut_remove_reference (operand_desc);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "rgn_obj %p Addr %8.8X%8.8X Len %X\n",
@ -752,7 +786,7 @@ acpi_ds_eval_region_operands (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ds_eval_data_object_operands * FUNCTION: acpi_ds_eval_data_object_operands
* *
@ -765,7 +799,7 @@ acpi_ds_eval_region_operands (
* DESCRIPTION: Get the operands and complete the following data object types: * DESCRIPTION: Get the operands and complete the following data object types:
* Buffer, Package. * Buffer, Package.
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_eval_data_object_operands ( acpi_ds_eval_data_object_operands (
@ -830,7 +864,7 @@ acpi_ds_eval_data_object_operands (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* /*
* Return the object in the walk_state, unless the parent is a package -- * Return the object in the walk_state, unless the parent is a package -
* in this case, the return object will be stored in the parse tree * in this case, the return object will be stored in the parse tree
* for the package. * for the package.
*/ */
@ -988,7 +1022,8 @@ acpi_ds_exec_end_control_op (
status = AE_CTRL_PENDING; status = AE_CTRL_PENDING;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", op)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[WHILE_OP] termination! Op=%p\n",op));
/* Pop this control state and free it */ /* Pop this control state and free it */

View File

@ -100,7 +100,6 @@ acpi_ds_clear_implicit_return (
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_do_implicit_return * 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 * NOTE: this is optional because the ASL language does not actually
* support this behavior. * 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 * Now determine if the parent will use the result
@ -219,7 +218,8 @@ acpi_ds_is_result_used (
(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) { (op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
/* No parent, the return value cannot possibly be used */ /* 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_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name (op->common.aml_opcode))); acpi_ps_get_opcode_name (op->common.aml_opcode)));
return_VALUE (FALSE); 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); parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) { 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); return_VALUE (FALSE);
} }
@ -309,7 +310,8 @@ acpi_ds_is_result_used (
result_used: result_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", 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.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
@ -317,7 +319,8 @@ result_used:
result_not_used: result_not_used:
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", 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.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op)); acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
@ -522,7 +525,8 @@ acpi_ds_create_operand (
if ((walk_state->deferred_node) && if ((walk_state->deferred_node) &&
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) && (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
(arg_index != 0)) { (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; status = AE_OK;
} }
else /* All other opcodes */ { else /* All other opcodes */ {
@ -565,7 +569,8 @@ acpi_ds_create_operand (
* indicate this to the interpreter, set the * indicate this to the interpreter, set the
* object to the root * 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; status = AE_OK;
} }
else { else {
@ -612,7 +617,8 @@ acpi_ds_create_operand (
*/ */
opcode = AML_ZERO_OP; /* Has no arguments! */ 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 { else {
opcode = arg->common.aml_opcode; opcode = arg->common.aml_opcode;
@ -642,7 +648,8 @@ acpi_ds_create_operand (
* Only error is underflow, and this indicates * Only error is underflow, and this indicates
* a missing or null operand! * 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))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -657,8 +664,8 @@ acpi_ds_create_operand (
/* Initialize the new object */ /* Initialize the new object */
status = acpi_ds_init_object_from_op (walk_state, arg, status = acpi_ds_init_object_from_op (
opcode, &obj_desc); walk_state, arg, opcode, &obj_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
acpi_ut_delete_object_desc (obj_desc); acpi_ut_delete_object_desc (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);

View File

@ -73,11 +73,13 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_3A_1T_1R, acpi_ex_opcode_3A_1T_1R,
acpi_ex_opcode_6A_0T_1R}; acpi_ex_opcode_6A_0T_1R};
/***************************************************************************** /*****************************************************************************
* *
* FUNCTION: acpi_ds_get_predicate_value * FUNCTION: acpi_ds_get_predicate_value
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* result_obj - if non-zero, pop result from result stack
* *
* RETURN: Status * RETURN: Status
* *
@ -124,7 +126,8 @@ acpi_ds_get_predicate_value (
} }
if (!obj_desc) { 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)); obj_desc, walk_state));
return_ACPI_STATUS (AE_AML_NO_OPERAND); return_ACPI_STATUS (AE_AML_NO_OPERAND);
@ -197,7 +200,7 @@ cleanup:
* FUNCTION: acpi_ds_exec_begin_op * FUNCTION: acpi_ds_exec_begin_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * 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 * RETURN: Status
* *
@ -233,7 +236,8 @@ acpi_ds_exec_begin_op (
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (acpi_ns_opens_scope (walk_state->op_info->object_type)) { 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)); acpi_ut_get_type_name (walk_state->op_info->object_type), op));
status = acpi_ds_scope_stack_pop (walk_state); 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) { if (walk_state->walk_type == ACPI_WALK_METHOD) {
/* /*
* Found a named object declaration during method * Found a named object declaration during method execution;
* execution; we must enter this object into the * we must enter this object into the namespace. The created
* namespace. The created object is temporary and * object is temporary and will be deleted upon completion of
* will be deleted upon completion of the execution * the execution of this method.
* of this method.
*/ */
status = acpi_ds_load2_begin_op (walk_state, NULL); status = acpi_ds_load2_begin_op (walk_state, NULL);
} }
@ -338,8 +341,6 @@ acpi_ds_exec_begin_op (
* FUNCTION: acpi_ds_exec_end_op * FUNCTION: acpi_ds_exec_end_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * 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 * RETURN: Status
* *
@ -389,7 +390,7 @@ acpi_ds_exec_end_op (
/* Decode the Opcode Class */ /* Decode the Opcode Class */
switch (op_class) { switch (op_class) {
case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */ case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
break; break;
@ -506,7 +507,8 @@ acpi_ds_exec_end_op (
if ((op->asl.parent) && if ((op->asl.parent) &&
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) || ((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
(op->asl.parent->asl.aml_opcode == AML_VAR_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; 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); acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
@ -583,13 +585,15 @@ acpi_ds_exec_end_op (
case AML_NAME_OP: case AML_NAME_OP:
/* /*
* Put the Node on the object stack (Contains the ACPI Name of * Put the Node on the object stack (Contains the ACPI Name
* this object) * of this object)
*/ */
walk_state->operands[0] = (void *) op->common.parent->common.node; walk_state->operands[0] = (void *) op->common.parent->common.node;
walk_state->num_operands = 1; 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)) { if (ACPI_FAILURE (status)) {
break; break;
} }
@ -609,7 +613,7 @@ acpi_ds_exec_end_op (
break; 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); status = acpi_ds_result_stack_pop (walk_state);
if (ACPI_FAILURE (status)) { 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 * If a result object was returned from above, push it on the
* current result stack * current result stack
*/ */
if (ACPI_SUCCESS (status) && if (walk_state->result_obj) {
walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state); status = acpi_ds_result_push (walk_state->result_obj, walk_state);
} }
break; break;
@ -654,7 +657,8 @@ acpi_ds_exec_end_op (
case AML_TYPE_UNDEFINED: 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); return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
@ -709,13 +713,14 @@ cleanup:
status = acpi_gbl_exception_handler (status, status = acpi_gbl_exception_handler (status,
walk_state->method_node->name.integer, walk_state->opcode, walk_state->method_node->name.integer, walk_state->opcode,
walk_state->aml_offset, NULL); walk_state->aml_offset, NULL);
acpi_ex_enter_interpreter (); (void) acpi_ex_enter_interpreter ();
} }
if (walk_state->result_obj) { if (walk_state->result_obj) {
/* Break to debugger to display result */ /* 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: * Delete the result op if and only if:

View File

@ -79,20 +79,23 @@ acpi_ds_init_callbacks (
switch (pass_number) { switch (pass_number) {
case 1: case 1:
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_load1_begin_op; walk_state->descending_callback = acpi_ds_load1_begin_op;
walk_state->ascending_callback = acpi_ds_load1_end_op; walk_state->ascending_callback = acpi_ds_load1_end_op;
break; break;
case 2: case 2:
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_load2_begin_op; walk_state->descending_callback = acpi_ds_load2_begin_op;
walk_state->ascending_callback = acpi_ds_load2_end_op; walk_state->ascending_callback = acpi_ds_load2_end_op;
break; break;
case 3: case 3:
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
walk_state->parse_flags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
ACPI_PARSE_DELETE_TREE;
walk_state->descending_callback = acpi_ds_exec_begin_op; walk_state->descending_callback = acpi_ds_exec_begin_op;
walk_state->ascending_callback = acpi_ds_exec_end_op; walk_state->ascending_callback = acpi_ds_exec_end_op;
#endif #endif
@ -111,8 +114,7 @@ acpi_ds_init_callbacks (
* FUNCTION: acpi_ds_load1_begin_op * FUNCTION: acpi_ds_load1_begin_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been reached in the * out_op - Where to return op if a new one is created
* walk; Arguments have not been evaluated yet.
* *
* RETURN: Status * RETURN: Status
* *
@ -146,7 +148,8 @@ acpi_ds_load1_begin_op (
#if 0 #if 0
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) || if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) { (walk_state->op_info->class == AML_CLASS_CONTROL)) {
acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n", walk_state->op_info->name); acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
walk_state->op_info->name);
*out_op = op; *out_op = op;
return (AE_CTRL_SKIP); return (AE_CTRL_SKIP);
} }
@ -191,7 +194,8 @@ acpi_ds_load1_begin_op (
*/ */
acpi_dm_add_to_external_list (path); acpi_dm_add_to_external_list (path);
status = acpi_ns_lookup (walk_state->scope_info, path, object_type, status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
} }
#endif #endif
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -224,10 +228,12 @@ acpi_ds_load1_begin_op (
* Name (DEB, 0) * Name (DEB, 0)
* Scope (DEB) { ... } * Scope (DEB) { ... }
* *
* Note: silently change the type here. On the second pass, we will report a warning * Note: silently change the type here. On the second pass, we will report
* a warning
*/ */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
path, acpi_ut_get_type_name (node->type))); path, acpi_ut_get_type_name (node->type)));
node->type = ACPI_TYPE_ANY; node->type = ACPI_TYPE_ANY;
@ -238,7 +244,8 @@ acpi_ds_load1_begin_op (
/* All other types are an error */ /* All other types are an error */
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", ACPI_REPORT_ERROR ((
"Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
acpi_ut_get_type_name (node->type), path)); acpi_ut_get_type_name (node->type), path));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
@ -249,7 +256,8 @@ acpi_ds_load1_begin_op (
default: default:
/* /*
* For all other named opcodes, we will enter the name into the namespace. * For all other named opcodes, we will enter the name into
* the namespace.
* *
* Setup the search flags. * Setup the search flags.
* Since we are entering a name into the namespace, we do not want to * Since we are entering a name into the namespace, we do not want to
@ -279,14 +287,16 @@ acpi_ds_load1_begin_op (
acpi_ut_get_type_name (object_type))); acpi_ut_get_type_name (object_type)));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n", ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"[%s] Both Find or Create allowed\n",
acpi_ut_get_type_name (object_type))); acpi_ut_get_type_name (object_type)));
} }
/* /*
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve * as we go downward in the parse tree. Any necessary subobjects that
* arguments to the opcode must be created as we go back up the parse tree later. * involve arguments to the opcode must be created as we go back up the
* parse tree later.
*/ */
status = acpi_ns_lookup (walk_state->scope_info, path, object_type, status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node)); ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
@ -335,8 +345,6 @@ acpi_ds_load1_begin_op (
* FUNCTION: acpi_ds_load1_end_op * FUNCTION: acpi_ds_load1_end_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * 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 * RETURN: Status
* *
@ -383,7 +391,9 @@ acpi_ds_load1_end_op (
if (op->common.aml_opcode == AML_REGION_OP) { if (op->common.aml_opcode == AML_REGION_OP) {
status = acpi_ex_create_region (op->named.data, op->named.length, status = acpi_ex_create_region (op->named.data, op->named.length,
(acpi_adr_space_type) ((op->common.value.arg)->common.value.integer), walk_state); (acpi_adr_space_type)
((op->common.value.arg)->common.value.integer),
walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
} }
@ -394,7 +404,8 @@ acpi_ds_load1_end_op (
/* For Name opcode, get the object type from the argument */ /* For Name opcode, get the object type from the argument */
if (op->common.value.arg) { if (op->common.value.arg) {
object_type = (acpi_ps_get_opcode_info ((op->common.value.arg)->common.aml_opcode))->object_type; object_type = (acpi_ps_get_opcode_info (
(op->common.value.arg)->common.aml_opcode))->object_type;
op->common.node->type = (u8) object_type; op->common.node->type = (u8) object_type;
} }
} }
@ -448,8 +459,7 @@ acpi_ds_load1_end_op (
* FUNCTION: acpi_ds_load2_begin_op * FUNCTION: acpi_ds_load2_begin_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * PARAMETERS: walk_state - Current state of the parse tree walk
* Op - Op that has been just been reached in the * out_op - Wher to return op if a new one is created
* walk; Arguments have not been evaluated yet.
* *
* RETURN: Status * RETURN: Status
* *
@ -478,14 +488,20 @@ acpi_ds_load2_begin_op (
if (op) { if (op) {
/* We only care about Namespace opcodes here */ /* We only care about Namespace opcodes here */
if ((!(walk_state->op_info->flags & AML_NSOPCODE) && (walk_state->opcode != AML_INT_NAMEPATH_OP)) || if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
(walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
(!(walk_state->op_info->flags & AML_NAMED))) { (!(walk_state->op_info->flags & AML_NAMED))) {
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_REPORT_WARNING ((
"Encountered executable code at module level, [%s]\n",
acpi_ps_get_opcode_name (walk_state->opcode)));
}
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/* /* Get the name we are going to enter or lookup in the namespace */
* Get the name we are going to enter or lookup in the namespace
*/
if (walk_state->opcode == AML_INT_NAMEPATH_OP) { if (walk_state->opcode == AML_INT_NAMEPATH_OP) {
/* For Namepath op, get the path string */ /* For Namepath op, get the path string */
@ -528,21 +544,25 @@ acpi_ds_load2_begin_op (
case AML_INT_NAMEPATH_OP: case AML_INT_NAMEPATH_OP:
/* /*
* The name_path is an object reference to an existing object. Don't enter the * The name_path is an object reference to an existing object.
* name into the namespace, but look it up for use later * Don't enter the name into the namespace, but look it up
* for use later.
*/ */
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
break; break;
case AML_SCOPE_OP: case AML_SCOPE_OP:
/* /*
* The Path is an object reference to an existing object. Don't enter the * The Path is an object reference to an existing object.
* name into the namespace, but look it up for use later * Don't enter the name into the namespace, but look it up
* for use later.
*/ */
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
#ifdef _ACPI_ASL_COMPILER #ifdef _ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
@ -582,7 +602,8 @@ acpi_ds_load2_begin_op (
* Scope (DEB) { ... } * Scope (DEB) { ... }
*/ */
ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n", ACPI_REPORT_WARNING ((
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
buffer_ptr, acpi_ut_get_type_name (node->type))); buffer_ptr, acpi_ut_get_type_name (node->type)));
node->type = ACPI_TYPE_ANY; node->type = ACPI_TYPE_ANY;
@ -593,7 +614,8 @@ acpi_ds_load2_begin_op (
/* All other types are an error */ /* All other types are an error */
ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n", ACPI_REPORT_ERROR ((
"Invalid type (%s) for target of Scope operator [%4.4s]\n",
acpi_ut_get_type_name (node->type), buffer_ptr)); acpi_ut_get_type_name (node->type), buffer_ptr));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
@ -621,8 +643,9 @@ acpi_ds_load2_begin_op (
/* /*
* Enter the named type into the internal namespace. We enter the name * Enter the named type into the internal namespace. We enter the name
* as we go downward in the parse tree. Any necessary subobjects that involve * as we go downward in the parse tree. Any necessary subobjects that
* arguments to the opcode must be created as we go back up the parse tree later. * involve arguments to the opcode must be created as we go back up the
* parse tree later.
* *
* Note: Name may already exist if we are executing a deferred opcode. * Note: Name may already exist if we are executing a deferred opcode.
*/ */
@ -635,7 +658,8 @@ acpi_ds_load2_begin_op (
} }
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type, status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, walk_state, &(node)); ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
walk_state, &(node));
break; break;
} }
@ -678,8 +702,6 @@ acpi_ds_load2_begin_op (
* FUNCTION: acpi_ds_load2_end_op * FUNCTION: acpi_ds_load2_end_op
* *
* PARAMETERS: walk_state - Current state of the parse tree walk * 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 * RETURN: Status
* *
@ -738,7 +760,8 @@ acpi_ds_load2_end_op (
/* Pop the scope stack */ /* Pop the scope stack */
if (acpi_ns_opens_scope (object_type) && (op->common.aml_opcode != AML_INT_METHODCALL_OP)) { if (acpi_ns_opens_scope (object_type) &&
(op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
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 (object_type), op)); acpi_ut_get_type_name (object_type), op));
@ -884,14 +907,16 @@ acpi_ds_load2_end_op (
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP: case AML_REGION_OP:
/* /*
* The op_region is not fully parsed at this time. Only valid argument is the space_id. * The op_region is not fully parsed at this time. Only valid
* (We must save the address of the AML of the address and length operands) * argument is the space_id. (We must save the address of the
* AML of the address and length operands)
*/ */
/* /*
* If we have a valid region, initialize it * If we have a valid region, initialize it
* Namespace is NOT locked at this point. * Namespace is NOT locked at this point.
*/ */
status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node), FALSE); status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
FALSE);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* /*
* If AE_NOT_EXIST is returned, it is not fatal * If AE_NOT_EXIST is returned, it is not fatal
@ -942,15 +967,16 @@ acpi_ds_load2_end_op (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* /*
* Make sure that what we found is indeed a method * Make sure that what we found is indeed a method
* We didn't search for a method on purpose, to see if the name would resolve * We didn't search for a method on purpose, to see if the name
* would resolve
*/ */
if (new_node->type != ACPI_TYPE_METHOD) { if (new_node->type != ACPI_TYPE_METHOD) {
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
/* We could put the returned object (Node) on the object stack for later, but /* We could put the returned object (Node) on the object stack for
* for now, we will put it in the "op" object that the parser uses, so we * later, but for now, we will put it in the "op" object that the
* can get it again at the end of this scope * parser uses, so we can get it again at the end of this scope
*/ */
op->common.node = new_node; op->common.node = new_node;
} }

View File

@ -50,14 +50,13 @@
ACPI_MODULE_NAME ("dswscope") ACPI_MODULE_NAME ("dswscope")
#define STACK_POP(head) head
/**************************************************************************** /****************************************************************************
* *
* FUNCTION: acpi_ds_scope_stack_clear * 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 * DESCRIPTION: Pop (and free) everything on the scope stack except the
* root scope object (which remains at the stack top.) * 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; walk_state->scope_info = scope_info->scope.next;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 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); acpi_ut_delete_generic_state (scope_info);
} }
} }
@ -90,8 +90,11 @@ acpi_ds_scope_stack_clear (
* *
* FUNCTION: acpi_ds_scope_stack_push * FUNCTION: acpi_ds_scope_stack_push
* *
* PARAMETERS: *Node, - Name to be made current * PARAMETERS: Node - Name to be made current
* Type, - Type of frame being pushed * Type - Type of frame being pushed
* walk_state - Current state
*
* RETURN: Status
* *
* DESCRIPTION: Push the current scope on the scope stack, and make the * DESCRIPTION: Push the current scope on the scope stack, and make the
* passed Node current. * passed Node current.
@ -121,7 +124,8 @@ acpi_ds_scope_stack_push (
/* Make sure object type is valid */ /* Make sure object type is valid */
if (!acpi_ut_valid_object_type (type)) { 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 */ /* Allocate a new scope object */
@ -170,16 +174,11 @@ acpi_ds_scope_stack_push (
* *
* FUNCTION: acpi_ds_scope_stack_pop * 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 * RETURN: Status
* is found.
* *
* RETURN: Count of frames popped. If no frame of the requested type * DESCRIPTION: Pop the scope stack once.
* 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.
* *
***************************************************************************/ ***************************************************************************/

View File

@ -50,67 +50,31 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dswstate") ACPI_MODULE_NAME ("dswstate")
/* Local prototypes */
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_insert
*
* PARAMETERS: Object - Object to push
* Index - Where to insert the object
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Insert an object onto this walk's result stack
*
******************************************************************************/
acpi_status acpi_status
acpi_ds_result_insert ( acpi_ds_result_insert (
void *object, void *object,
u32 index, u32 index,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state);
{
union acpi_generic_state *state;
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state);
ACPI_FUNCTION_NAME ("ds_result_insert"); acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state);
#endif
state = walk_state->results; #ifdef ACPI_FUTURE_USAGE
if (!state) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null Object! Index=%X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
state->results.obj_desc [index] = object;
state->results.num_results++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result));
return (AE_OK);
}
/******************************************************************************* /*******************************************************************************
* *
@ -178,7 +142,6 @@ acpi_ds_result_remove (
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_result_pop * FUNCTION: acpi_ds_result_pop
@ -227,15 +190,18 @@ acpi_ds_result_pop (
*object = state->results.obj_desc [index -1]; *object = state->results.obj_desc [index -1];
state->results.obj_desc [index -1] = NULL; state->results.obj_desc [index -1] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL", "Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object,
(*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
(u32) index -1, walk_state, state->results.num_results)); (u32) index -1, walk_state, state->results.num_results));
return (AE_OK); return (AE_OK);
} }
} }
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No result objects! State=%p\n", walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -274,7 +240,8 @@ acpi_ds_result_pop_from_bottom (
} }
if (!state->results.num_results) { if (!state->results.num_results) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n",
walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -293,7 +260,8 @@ acpi_ds_result_pop_from_bottom (
/* Check for a valid result object */ /* Check for a valid result object */
if (!*object) { if (!*object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X, Index=%X\n",
walk_state, state->results.num_results, (u32) index)); walk_state, state->results.num_results, (u32) index));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -344,7 +312,8 @@ acpi_ds_result_push (
} }
if (!object) { if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null Object! Obj=%p State=%p Num=%X\n",
object, walk_state, state->results.num_results)); object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
@ -437,43 +406,6 @@ acpi_ds_result_stack_pop (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_delete_all
*
* PARAMETERS: walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Clear the object stack by deleting all objects that are on it.
* Should be used with great care, if at all!
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
/* The stack size is configurable, but fixed */
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
if (walk_state->operands[i]) {
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
}
return_ACPI_STATUS (AE_OK);
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_obj_stack_push * FUNCTION: acpi_ds_obj_stack_push
@ -517,67 +449,6 @@ acpi_ds_obj_stack_push (
} }
#if 0
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop_object
*
* PARAMETERS: pop_count - Number of objects/entries to pop
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
* deleted by this routine.
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Missing operand/stack empty! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Pop the stack */
walk_state->num_operands--;
/* Check for a valid operand */
if (!walk_state->operands [walk_state->num_operands]) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Get operand and set stack entry to null */
*object = walk_state->operands [walk_state->num_operands];
walk_state->operands [walk_state->num_operands] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
*object, acpi_ut_get_object_type_name (*object),
walk_state, walk_state->num_operands));
return (AE_OK);
}
#endif
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_obj_stack_pop * FUNCTION: acpi_ds_obj_stack_pop
@ -678,48 +549,6 @@ acpi_ds_obj_stack_pop_and_delete (
} }
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_get_value
*
* PARAMETERS: Index - Stack index whose value is desired. Based
* on the top of the stack (index=0 == top)
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Retrieve an object from this walk's object stack. Index must
* be within the range of the current stack pointer.
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
/* Can't do it if the stack is empty */
if (walk_state->num_operands == 0) {
return_PTR (NULL);
}
/* or if the index is past the top of the stack */
if (index > (walk_state->num_operands - (u32) 1)) {
return_PTR (NULL);
}
return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
index]);
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_get_current_walk_state * FUNCTION: acpi_ds_get_current_walk_state
@ -757,11 +586,11 @@ acpi_ds_get_current_walk_state (
* FUNCTION: acpi_ds_push_walk_state * FUNCTION: acpi_ds_push_walk_state
* *
* PARAMETERS: walk_state - State to push * PARAMETERS: walk_state - State to push
* walk_list - The list that owns the walk stack * Thread - Thread state object
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Place the walk_state at the head of the state list. * DESCRIPTION: Place the Thread state at the head of the state list.
* *
******************************************************************************/ ******************************************************************************/
@ -784,9 +613,9 @@ acpi_ds_push_walk_state (
* *
* FUNCTION: acpi_ds_pop_walk_state * FUNCTION: acpi_ds_pop_walk_state
* *
* PARAMETERS: walk_list - The list that owns the walk stack * PARAMETERS: Thread - Current thread state
* *
* RETURN: A walk_state object popped from the stack * RETURN: A walk_state object popped from the thread's stack
* *
* DESCRIPTION: Remove and return the walkstate object that is at the head of * DESCRIPTION: Remove and return the walkstate object that is at the head of
* the walk stack for the given walk list. NULL indicates that * the walk stack for the given walk list. NULL indicates that
@ -814,7 +643,7 @@ acpi_ds_pop_walk_state (
/* /*
* Don't clear the NEXT field, this serves as an indicator * Don't clear the NEXT field, this serves as an indicator
* that there is a parent WALK STATE * that there is a parent WALK STATE
* NO: walk_state->Next = NULL; * Do Not: walk_state->Next = NULL;
*/ */
} }
@ -826,7 +655,9 @@ acpi_ds_pop_walk_state (
* *
* FUNCTION: acpi_ds_create_walk_state * FUNCTION: acpi_ds_create_walk_state
* *
* PARAMETERS: Origin - Starting point for this walk * PARAMETERS: owner_id - ID for object creation
* Origin - Starting point for this walk
* mth_desc - Method object
* Thread - Current thread state * Thread - Current thread state
* *
* RETURN: Pointer to the new walk state. * RETURN: Pointer to the new walk state.
@ -896,8 +727,7 @@ acpi_ds_create_walk_state (
* method_node - Control method NS node, if any * method_node - Control method NS node, if any
* aml_start - Start of AML * aml_start - Start of AML
* aml_length - Length of AML * aml_length - Length of AML
* Params - Method args, if any * Info - Method info block (params, etc.)
* return_obj_desc - Where to store a return object, if any
* pass_number - 1, 2, or 3 * pass_number - 1, 2, or 3
* *
* RETURN: Status * RETURN: Status
@ -964,7 +794,8 @@ acpi_ds_init_aml_walk (
/* Init the method arguments */ /* Init the method arguments */
status = acpi_ds_method_data_init_args (walk_state->params, ACPI_METHOD_NUM_ARGS, walk_state); status = acpi_ds_method_data_init_args (walk_state->params,
ACPI_METHOD_NUM_ARGS, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -1031,12 +862,14 @@ acpi_ds_delete_walk_state (
} }
if (walk_state->data_type != ACPI_DESC_TYPE_WALK) { if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n",
walk_state));
return; return;
} }
if (walk_state->parser_state.scope) { if (walk_state->parser_state.scope) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n",
walk_state));
} }
/* Always must free any linked control states */ /* Always must free any linked control states */
@ -1078,7 +911,7 @@ acpi_ds_delete_walk_state (
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Purge the global state object cache. Used during subsystem * DESCRIPTION: Purge the global state object cache. Used during subsystem
* termination. * termination.
@ -1098,3 +931,200 @@ acpi_ds_delete_walk_state_cache (
#endif #endif
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_insert
*
* PARAMETERS: Object - Object to push
* Index - Where to insert the object
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Insert an object onto this walk's result stack
*
******************************************************************************/
acpi_status
acpi_ds_result_insert (
void *object,
u32 index,
struct acpi_walk_state *walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME ("ds_result_insert");
state = walk_state->results;
if (!state) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
if (!object) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null Object! Index=%X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
return (AE_BAD_PARAMETER);
}
state->results.obj_desc [index] = object;
state->results.num_results++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_delete_all
*
* PARAMETERS: walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Clear the object stack by deleting all objects that are on it.
* Should be used with great care, if at all!
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_delete_all", walk_state);
/* The stack size is configurable, but fixed */
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
if (walk_state->operands[i]) {
acpi_ut_remove_reference (walk_state->operands[i]);
walk_state->operands[i] = NULL;
}
}
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop_object
*
* PARAMETERS: Object - Where to return the popped object
* walk_state - Current Walk state
*
* RETURN: Status
*
* DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
* deleted by this routine.
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_NAME ("ds_obj_stack_pop_object");
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Missing operand/stack empty! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Pop the stack */
walk_state->num_operands--;
/* Check for a valid operand */
if (!walk_state->operands [walk_state->num_operands]) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X\n",
walk_state, walk_state->num_operands));
*object = NULL;
return (AE_AML_NO_OPERAND);
}
/* Get operand and set stack entry to null */
*object = walk_state->operands [walk_state->num_operands];
walk_state->operands [walk_state->num_operands] = NULL;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
*object, acpi_ut_get_object_type_name (*object),
walk_state, walk_state->num_operands));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_get_value
*
* PARAMETERS: Index - Stack index whose value is desired. Based
* on the top of the stack (index=0 == top)
* walk_state - Current Walk state
*
* RETURN: Pointer to the requested operand
*
* DESCRIPTION: Retrieve an object from this walk's operand stack. Index must
* be within the range of the current stack pointer.
*
******************************************************************************/
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_TRACE_PTR ("ds_obj_stack_get_value", walk_state);
/* Can't do it if the stack is empty */
if (walk_state->num_operands == 0) {
return_PTR (NULL);
}
/* or if the index is past the top of the stack */
if (index > (walk_state->num_operands - (u32) 1)) {
return_PTR (NULL);
}
return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
index]);
}
#endif

View File

@ -31,6 +31,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/interrupt.h>
#include <asm/io.h> #include <asm/io.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h> #include <acpi/acpi_drivers.h>
@ -49,17 +50,19 @@ ACPI_MODULE_NAME ("acpi_ec")
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
#define ACPI_EC_FLAG_BURST 0x10 /* burst mode */
#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */ #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
#define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */ #define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */
#define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */ #define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */
#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */
#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */
#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
#define ACPI_EC_COMMAND_READ 0x80 #define ACPI_EC_COMMAND_READ 0x80
#define ACPI_EC_COMMAND_WRITE 0x81 #define ACPI_EC_COMMAND_WRITE 0x81
#define ACPI_EC_BURST_ENABLE 0x82
#define ACPI_EC_BURST_DISABLE 0x83
#define ACPI_EC_COMMAND_QUERY 0x84 #define ACPI_EC_COMMAND_QUERY 0x84
static int acpi_ec_add (struct acpi_device *device); static int acpi_ec_add (struct acpi_device *device);
@ -87,7 +90,11 @@ struct acpi_ec {
struct acpi_generic_address command_addr; struct acpi_generic_address command_addr;
struct acpi_generic_address data_addr; struct acpi_generic_address data_addr;
unsigned long global_lock; unsigned long global_lock;
spinlock_t lock; unsigned int expect_event;
atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/
atomic_t pending_gpe;
struct semaphore sem;
wait_queue_head_t wait;
}; };
/* If we find an EC via the ECDT, we need to keep a ptr to its context */ /* If we find an EC via the ECDT, we need to keep a ptr to its context */
@ -100,59 +107,138 @@ static struct acpi_device *first_ec;
Transaction Management Transaction Management
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static int static inline u32 acpi_ec_read_status(struct acpi_ec *ec)
acpi_ec_wait (
struct acpi_ec *ec,
u8 event)
{ {
u32 acpi_ec_status = 0; u32 status = 0;
u32 i = ACPI_EC_UDELAY_COUNT;
if (!ec) acpi_hw_low_level_read(8, &status, &ec->status_addr);
return -EINVAL; return status;
}
/* Poll the EC status register waiting for the event to occur. */ static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event)
{
int result = 0;
ACPI_FUNCTION_TRACE("acpi_ec_wait");
ec->expect_event = event;
smp_mb();
result = wait_event_interruptible_timeout(ec->wait,
!ec->expect_event,
msecs_to_jiffies(ACPI_EC_DELAY));
ec->expect_event = 0;
smp_mb();
if (result < 0){
ACPI_DEBUG_PRINT((ACPI_DB_ERROR," result = %d ", result));
return_VALUE(result);
}
/*
* Verify that the event in question has actually happened by
* querying EC status. Do the check even if operation timed-out
* to make sure that we did not miss interrupt.
*/
switch (event) { switch (event) {
case ACPI_EC_EVENT_OBF: case ACPI_EC_EVENT_OBF:
do { if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr); return_VALUE(0);
if (acpi_ec_status & ACPI_EC_FLAG_OBF)
return 0;
udelay(ACPI_EC_UDELAY);
} while (--i>0);
break; break;
case ACPI_EC_EVENT_IBE: case ACPI_EC_EVENT_IBE:
do { if (~acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF)
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->status_addr); return_VALUE(0);
if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
return 0;
udelay(ACPI_EC_UDELAY);
} while (--i>0);
break; break;
default:
return -EINVAL;
} }
return -ETIME; return_VALUE(-ETIME);
} }
static int
acpi_ec_enter_burst_mode (
struct acpi_ec *ec)
{
u32 tmp = 0;
int status = 0;
ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode");
status = acpi_ec_read_status(ec);
if (status != -EINVAL &&
!(status & ACPI_EC_FLAG_BURST)){
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"entering burst mode \n"));
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status){
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR," status = %d\n", status));
return_VALUE(-EINVAL);
}
acpi_hw_low_level_read(8, &tmp, &ec->data_addr);
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
if(tmp != 0x90 ) {/* Burst ACK byte*/
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"Ack failed \n"));
return_VALUE(-EINVAL);
}
} else
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"already be in burst mode \n"));
atomic_set(&ec->leaving_burst , 0);
return_VALUE(0);
}
static int
acpi_ec_leave_burst_mode (
struct acpi_ec *ec)
{
int status =0;
ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
atomic_set(&ec->leaving_burst , 1);
status = acpi_ec_read_status(ec);
if (status != -EINVAL &&
(status & ACPI_EC_FLAG_BURST)){
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"leaving burst mode\n"));
acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->command_addr);
status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
if (status){
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n"));
return_VALUE(-EINVAL);
}
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
status = acpi_ec_read_status(ec);
if (status != -EINVAL &&
(status & ACPI_EC_FLAG_BURST)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->status fail\n"));
return_VALUE(-EINVAL);
}
}else
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"already be in Non-burst mode \n"));
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"leaving burst mode\n"));
return_VALUE(0);
}
static int static int
acpi_ec_read ( acpi_ec_read (
struct acpi_ec *ec, struct acpi_ec *ec,
u8 address, u8 address,
u32 *data) u32 *data)
{ {
acpi_status status = AE_OK; int status = 0;
int result = 0; u32 glk;
unsigned long flags = 0;
u32 glk = 0;
ACPI_FUNCTION_TRACE("acpi_ec_read"); ACPI_FUNCTION_TRACE("acpi_ec_read");
if (!ec || !data) if (!ec || !data)
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
retry:
*data = 0; *data = 0;
if (ec->global_lock) { if (ec->global_lock) {
@ -161,31 +247,49 @@ acpi_ec_read (
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
spin_lock_irqsave(&ec->lock, flags); WARN_ON(in_interrupt());
down(&ec->sem);
if(acpi_ec_enter_burst_mode(ec))
goto end;
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
if (status) {
goto end; goto end;
}
acpi_hw_low_level_write(8, address, &ec->data_addr); acpi_hw_low_level_write(8, address, &ec->data_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result) if (status){
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
goto end; goto end;
}
acpi_hw_low_level_read(8, data, &ec->data_addr); acpi_hw_low_level_read(8, data, &ec->data_addr);
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n",
*data, address)); *data, address));
end: end:
spin_unlock_irqrestore(&ec->lock, flags); acpi_ec_leave_burst_mode(ec);
up(&ec->sem);
if (ec->global_lock) if (ec->global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); if(atomic_read(&ec->leaving_burst) == 2){
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
while(atomic_read(&ec->pending_gpe)){
msleep(1);
}
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
goto retry;
}
return_VALUE(status);
} }
@ -195,49 +299,80 @@ acpi_ec_write (
u8 address, u8 address,
u8 data) u8 data)
{ {
int result = 0; int status = 0;
acpi_status status = AE_OK; u32 glk;
unsigned long flags = 0; u32 tmp;
u32 glk = 0;
ACPI_FUNCTION_TRACE("acpi_ec_write"); ACPI_FUNCTION_TRACE("acpi_ec_write");
if (!ec) if (!ec)
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
retry:
if (ec->global_lock) { if (ec->global_lock) {
status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
spin_lock_irqsave(&ec->lock, flags); WARN_ON(in_interrupt());
down(&ec->sem);
if(acpi_ec_enter_burst_mode(ec))
goto end;
status = acpi_ec_read_status(ec);
if (status != -EINVAL &&
!(status & ACPI_EC_FLAG_BURST)){
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status)
goto end;
acpi_hw_low_level_read(8, &tmp, &ec->data_addr);
if(tmp != 0x90 ) /* Burst ACK byte*/
goto end;
}
/*Now we are in burst mode*/
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
if (status){
goto end; goto end;
}
acpi_hw_low_level_write(8, address, &ec->data_addr); acpi_hw_low_level_write(8, address, &ec->data_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) if (status){
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
goto end; goto end;
}
acpi_hw_low_level_write(8, data, &ec->data_addr); acpi_hw_low_level_write(8, data, &ec->data_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result) acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
if (status)
goto end; goto end;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n",
data, address)); data, address));
end: end:
spin_unlock_irqrestore(&ec->lock, flags); acpi_ec_leave_burst_mode(ec);
up(&ec->sem);
if (ec->global_lock) if (ec->global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); if(atomic_read(&ec->leaving_burst) == 2){
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
while(atomic_read(&ec->pending_gpe)){
msleep(1);
}
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
goto retry;
}
return_VALUE(status);
} }
/* /*
@ -289,16 +424,13 @@ acpi_ec_query (
struct acpi_ec *ec, struct acpi_ec *ec,
u32 *data) u32 *data)
{ {
int result = 0; int status = 0;
acpi_status status = AE_OK; u32 glk;
unsigned long flags = 0;
u32 glk = 0;
ACPI_FUNCTION_TRACE("acpi_ec_query"); ACPI_FUNCTION_TRACE("acpi_ec_query");
if (!ec || !data) if (!ec || !data)
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
*data = 0; *data = 0;
if (ec->global_lock) { if (ec->global_lock) {
@ -307,29 +439,39 @@ acpi_ec_query (
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
down(&ec->sem);
if(acpi_ec_enter_burst_mode(ec))
goto end;
/* /*
* Query the EC to find out which _Qxx method we need to evaluate. * Query the EC to find out which _Qxx method we need to evaluate.
* Note that successful completion of the query causes the ACPI_EC_SCI * Note that successful completion of the query causes the ACPI_EC_SCI
* bit to be cleared (and thus clearing the interrupt source). * bit to be cleared (and thus clearing the interrupt source).
*/ */
spin_lock_irqsave(&ec->lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result) if (status){
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
goto end; goto end;
}
acpi_hw_low_level_read(8, data, &ec->data_addr); acpi_hw_low_level_read(8, data, &ec->data_addr);
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
if (!*data) if (!*data)
result = -ENODATA; status = -ENODATA;
end: end:
spin_unlock_irqrestore(&ec->lock, flags); acpi_ec_leave_burst_mode(ec);
up(&ec->sem);
if (ec->global_lock) if (ec->global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); if(atomic_read(&ec->leaving_burst) == 2){
ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n"));
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
status = -ENODATA;
}
return_VALUE(status);
} }
@ -347,31 +489,18 @@ acpi_ec_gpe_query (
void *ec_cxt) void *ec_cxt)
{ {
struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; struct acpi_ec *ec = (struct acpi_ec *) ec_cxt;
u32 value = 0; u32 value;
unsigned long flags = 0; int result = -ENODATA;
static char object_name[5] = {'_','Q','0','0','\0'}; static char object_name[5] = {'_','Q','0','0','\0'};
const char hex[] = {'0','1','2','3','4','5','6','7', const char hex[] = {'0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F'}; '8','9','A','B','C','D','E','F'};
ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
if (!ec_cxt) if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI)
goto end; result = acpi_ec_query(ec, &value);
spin_lock_irqsave(&ec->lock, flags); if (result)
acpi_hw_low_level_read(8, &value, &ec->command_addr);
spin_unlock_irqrestore(&ec->lock, flags);
/* TBD: Implement asynch events!
* NOTE: All we care about are EC-SCI's. Other EC events are
* handled via polling (yuck!). This is because some systems
* treat EC-SCIs as level (versus EDGE!) triggered, preventing
* a purely interrupt-driven approach (grumble, grumble).
*/
if (!(value & ACPI_EC_FLAG_SCI))
goto end;
if (acpi_ec_query(ec, &value))
goto end; goto end;
object_name[2] = hex[((value >> 4) & 0x0F)]; object_name[2] = hex[((value >> 4) & 0x0F)];
@ -380,9 +509,9 @@ acpi_ec_gpe_query (
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name));
acpi_evaluate_object(ec->handle, object_name, NULL, NULL); acpi_evaluate_object(ec->handle, object_name, NULL, NULL);
end: end:
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); atomic_dec(&ec->pending_gpe);
return;
} }
static u32 static u32
@ -390,6 +519,7 @@ acpi_ec_gpe_handler (
void *data) void *data)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 value;
struct acpi_ec *ec = (struct acpi_ec *) data; struct acpi_ec *ec = (struct acpi_ec *) data;
if (!ec) if (!ec)
@ -397,13 +527,41 @@ acpi_ec_gpe_handler (
acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR);
value = acpi_ec_read_status(ec);
if((value & ACPI_EC_FLAG_IBF) &&
!(value & ACPI_EC_FLAG_BURST) &&
(atomic_read(&ec->leaving_burst) == 0)) {
/*
* the embedded controller disables
* burst mode for any reason other
* than the burst disable command
* to process critical event.
*/
atomic_set(&ec->leaving_burst , 2); /* block current pending transaction
and retry */
wake_up(&ec->wait);
}else {
if ((ec->expect_event == ACPI_EC_EVENT_OBF &&
(value & ACPI_EC_FLAG_OBF)) ||
(ec->expect_event == ACPI_EC_EVENT_IBE &&
!(value & ACPI_EC_FLAG_IBF))) {
ec->expect_event = 0;
wake_up(&ec->wait);
return ACPI_INTERRUPT_HANDLED;
}
}
if (value & ACPI_EC_FLAG_SCI){
atomic_add(1, &ec->pending_gpe) ;
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
acpi_ec_gpe_query, ec); acpi_ec_gpe_query, ec);
return status == AE_OK ?
if (status == AE_OK) ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
return ACPI_INTERRUPT_HANDLED; }
else acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR);
return ACPI_INTERRUPT_NOT_HANDLED; return status == AE_OK ?
ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
} }
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
@ -421,10 +579,8 @@ acpi_ec_space_setup (
* The EC object is in the handler context and is needed * The EC object is in the handler context and is needed
* when calling the acpi_ec_space_handler. * when calling the acpi_ec_space_handler.
*/ */
if(function == ACPI_REGION_DEACTIVATE) *return_context = (function != ACPI_REGION_DEACTIVATE) ?
*return_context = NULL; handler_context : NULL;
else
*return_context = handler_context;
return AE_OK; return AE_OK;
} }
@ -441,7 +597,7 @@ acpi_ec_space_handler (
{ {
int result = 0; int result = 0;
struct acpi_ec *ec = NULL; struct acpi_ec *ec = NULL;
u32 temp = 0; u64 temp = *value;
acpi_integer f_v = 0; acpi_integer f_v = 0;
int i = 0; int i = 0;
@ -450,9 +606,8 @@ acpi_ec_space_handler (
if ((address > 0xFF) || !value || !handler_context) if ((address > 0xFF) || !value || !handler_context)
return_VALUE(AE_BAD_PARAMETER); return_VALUE(AE_BAD_PARAMETER);
if(bit_width != 8) { if (bit_width != 8 && acpi_strict) {
printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n"); printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n");
if (acpi_strict)
return_VALUE(AE_BAD_PARAMETER); return_VALUE(AE_BAD_PARAMETER);
} }
@ -461,11 +616,11 @@ acpi_ec_space_handler (
next_byte: next_byte:
switch (function) { switch (function) {
case ACPI_READ: case ACPI_READ:
result = acpi_ec_read(ec, (u8) address, &temp); temp = 0;
*value = (acpi_integer) temp; result = acpi_ec_read(ec, (u8) address, (u32 *)&temp);
break; break;
case ACPI_WRITE: case ACPI_WRITE:
result = acpi_ec_write(ec, (u8) address, (u8) *value); result = acpi_ec_write(ec, (u8) address, (u8) temp);
break; break;
default: default:
result = -EINVAL; result = -EINVAL;
@ -475,18 +630,17 @@ next_byte:
bit_width -= 8; bit_width -= 8;
if (bit_width) { if (bit_width) {
if (function == ACPI_READ) if (function == ACPI_READ)
f_v |= (acpi_integer) (*value) << 8*i; f_v |= temp << 8 * i;
if (function == ACPI_WRITE) if (function == ACPI_WRITE)
(*value) >>=8; temp >>= 8;
i++; i++;
address++;
goto next_byte; goto next_byte;
} }
if (function == ACPI_READ) { if (function == ACPI_READ) {
f_v |= (acpi_integer) (*value) << 8*i; f_v |= temp << 8 * i;
*value = f_v; *value = f_v;
} }
@ -505,8 +659,6 @@ out:
default: default:
return_VALUE(AE_OK); return_VALUE(AE_OK);
} }
} }
@ -533,6 +685,7 @@ acpi_ec_read_info (struct seq_file *seq, void *offset)
(u32) ec->status_addr.address, (u32) ec->data_addr.address); (u32) ec->status_addr.address, (u32) ec->data_addr.address);
seq_printf(seq, "use global lock: %s\n", seq_printf(seq, "use global lock: %s\n",
ec->global_lock?"yes":"no"); ec->global_lock?"yes":"no");
acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR);
end: end:
return_VALUE(0); return_VALUE(0);
@ -555,7 +708,7 @@ static int
acpi_ec_add_fs ( acpi_ec_add_fs (
struct acpi_device *device) struct acpi_device *device)
{ {
struct proc_dir_entry *entry = NULL; struct proc_dir_entry *entry;
ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); ACPI_FUNCTION_TRACE("acpi_ec_add_fs");
@ -606,9 +759,9 @@ static int
acpi_ec_add ( acpi_ec_add (
struct acpi_device *device) struct acpi_device *device)
{ {
int result = 0; int result;
acpi_status status = AE_OK; acpi_status status;
struct acpi_ec *ec = NULL; struct acpi_ec *ec;
unsigned long uid; unsigned long uid;
ACPI_FUNCTION_TRACE("acpi_ec_add"); ACPI_FUNCTION_TRACE("acpi_ec_add");
@ -623,7 +776,10 @@ acpi_ec_add (
ec->handle = device->handle; ec->handle = device->handle;
ec->uid = -1; ec->uid = -1;
spin_lock_init(&ec->lock); atomic_set(&ec->pending_gpe, 0);
atomic_set(&ec->leaving_burst , 1);
init_MUTEX(&ec->sem);
init_waitqueue_head(&ec->wait);
strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_EC_CLASS); strcpy(acpi_device_class(device), ACPI_EC_CLASS);
acpi_driver_data(device) = ec; acpi_driver_data(device) = ec;
@ -677,7 +833,7 @@ acpi_ec_remove (
struct acpi_device *device, struct acpi_device *device,
int type) int type)
{ {
struct acpi_ec *ec = NULL; struct acpi_ec *ec;
ACPI_FUNCTION_TRACE("acpi_ec_remove"); ACPI_FUNCTION_TRACE("acpi_ec_remove");
@ -732,8 +888,8 @@ static int
acpi_ec_start ( acpi_ec_start (
struct acpi_device *device) struct acpi_device *device)
{ {
acpi_status status = AE_OK; acpi_status status;
struct acpi_ec *ec = NULL; struct acpi_ec *ec;
ACPI_FUNCTION_TRACE("acpi_ec_start"); ACPI_FUNCTION_TRACE("acpi_ec_start");
@ -789,8 +945,8 @@ acpi_ec_stop (
struct acpi_device *device, struct acpi_device *device,
int type) int type)
{ {
acpi_status status = AE_OK; acpi_status status;
struct acpi_ec *ec = NULL; struct acpi_ec *ec;
ACPI_FUNCTION_TRACE("acpi_ec_stop"); ACPI_FUNCTION_TRACE("acpi_ec_stop");
@ -832,7 +988,6 @@ acpi_fake_ecdt_callback (
status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return status; return status;
spin_lock_init(&ec_ecdt->lock);
ec_ecdt->global_lock = TRUE; ec_ecdt->global_lock = TRUE;
ec_ecdt->handle = handle; ec_ecdt->handle = handle;
@ -905,11 +1060,12 @@ acpi_ec_get_real_ecdt(void)
return -ENOMEM; return -ENOMEM;
memset(ec_ecdt, 0, sizeof(struct acpi_ec)); memset(ec_ecdt, 0, sizeof(struct acpi_ec));
init_MUTEX(&ec_ecdt->sem);
init_waitqueue_head(&ec_ecdt->wait);
ec_ecdt->command_addr = ecdt_ptr->ec_control; ec_ecdt->command_addr = ecdt_ptr->ec_control;
ec_ecdt->status_addr = ecdt_ptr->ec_control; ec_ecdt->status_addr = ecdt_ptr->ec_control;
ec_ecdt->data_addr = ecdt_ptr->ec_data; ec_ecdt->data_addr = ecdt_ptr->ec_data;
ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit;
spin_lock_init(&ec_ecdt->lock);
/* use the GL just to be safe */ /* use the GL just to be safe */
ec_ecdt->global_lock = TRUE; ec_ecdt->global_lock = TRUE;
ec_ecdt->uid = ecdt_ptr->uid; ec_ecdt->uid = ecdt_ptr->uid;
@ -978,7 +1134,7 @@ error:
static int __init acpi_ec_init (void) static int __init acpi_ec_init (void)
{ {
int result = 0; int result;
ACPI_FUNCTION_TRACE("acpi_ec_init"); ACPI_FUNCTION_TRACE("acpi_ec_init");

View File

@ -47,6 +47,16 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evevent") 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 * 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 * Initialize the Fixed and General Purpose Events. This is done prior to
* done prior to enabling SCIs to prevent interrupts from * enabling SCIs to prevent interrupts from occurring before the handlers are
* occurring before handers are installed. * installed.
*/ */
status = acpi_ev_fixed_event_initialize (); status = acpi_ev_fixed_event_initialize ();
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -161,7 +171,7 @@ acpi_ev_install_xrupt_handlers (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ev_fixed_event_initialize ( acpi_ev_fixed_event_initialize (
void) void)
{ {
@ -180,7 +190,8 @@ acpi_ev_fixed_event_initialize (
/* Enable the fixed event */ /* Enable the fixed event */
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) { 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); 0, ACPI_MTX_LOCK);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
@ -200,7 +211,7 @@ acpi_ev_fixed_event_initialize (
* *
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * 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 * Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here. * 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_STATUS,
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &fixed_enable); &fixed_status);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
&fixed_enable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n", "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 ( acpi_ev_fixed_event_dispatch (
u32 event) u32 event)
{ {

View File

@ -48,6 +48,12 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpe") 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]; gpe_block = acpi_gbl_gpe_fadt_blocks[i];
if (gpe_block) { if (gpe_block) {
if ((gpe_number >= gpe_block->block_base_number) && if ((gpe_number >= gpe_block->block_base_number) &&
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) { (gpe_number < gpe_block->block_base_number +
return (&gpe_block->event_info[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", "Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
gpe_register_info->base_gpe_number, status_reg, enable_reg)); 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); enabled_status_byte = (u8) (status_reg & enable_reg);
if (!enabled_status_byte) { if (!enabled_status_byte) {
@ -523,7 +531,8 @@ acpi_ev_asynch_execute_gpe_method (
* Take a snapshot of the GPE info for this level - we copy the * Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with remove_handler/remove_block. * 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); status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -534,7 +543,8 @@ acpi_ev_asynch_execute_gpe_method (
* Must check for control method type dispatch one more * Must check for control method type dispatch one more
* time to avoid race with ev_gpe_install_handler * 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 * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
* control method that corresponds to this GPE * 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 * GPE is level-triggered, we clear the GPE status bit after
* handling the event. * handling the event.
@ -575,7 +586,7 @@ acpi_ev_asynch_execute_gpe_method (
* *
* FUNCTION: acpi_ev_gpe_dispatch * 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 * gpe_number - Number relative to the parent GPE block
* *
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED * 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 * If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced. * 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); status = acpi_hw_clear_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) { 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)); acpi_format_exception (status), gpe_number));
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
} }
@ -639,7 +652,8 @@ acpi_ev_gpe_dispatch (
/* It is now safe to clear level-triggered events. */ /* 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); status = acpi_hw_clear_gpe (gpe_event_info);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
@ -704,7 +718,6 @@ acpi_ev_gpe_dispatch (
#ifdef ACPI_GPE_NOTIFY_CHECK #ifdef ACPI_GPE_NOTIFY_CHECK
/******************************************************************************* /*******************************************************************************
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
* *

View File

@ -48,6 +48,39 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeblk") 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 @@ unlock_and_exit:
} }
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ev_delete_gpe_handlers * FUNCTION: acpi_ev_delete_gpe_handlers
* *
@ -190,7 +223,8 @@ acpi_ev_delete_gpe_handlers (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_event_info = &gpe_block->event_info[(i * 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); ACPI_MEM_FREE (gpe_event_info->dispatch.handler);
gpe_event_info->dispatch.handler = NULL; gpe_event_info->dispatch.handler = NULL;
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; 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"); 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; next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
while (next_gpe_xrupt) { while (next_gpe_xrupt) {
@ -619,7 +653,7 @@ acpi_ev_install_gpe_block (
goto unlock_and_exit; 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); acpi_os_acquire_lock (acpi_gbl_gpe_lock, ACPI_NOT_ISR);
if (gpe_xrupt_block->gpe_block_list_head) { 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. * per register. Initialization to zeros is sufficient.
*/ */
gpe_event_info = ACPI_MEM_CALLOCATE ( 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)); sizeof (struct acpi_gpe_event_info));
if (!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; status = AE_NO_MEMORY;
goto error_exit; goto error_exit;
} }
@ -899,7 +935,8 @@ acpi_ev_create_gpe_block (
gpe_block->block_base_number = gpe_block_base_number; gpe_block->block_base_number = gpe_block_base_number;
gpe_block->node = gpe_device; 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 */ /* Create the register_info and event_info sub-structures */
@ -1061,8 +1098,9 @@ acpi_ev_gpe_initialize (
/* Install GPE Block 0 */ /* Install GPE Block 0 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe0_blk, status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
register_count0, 0, acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]); &acpi_gbl_FADT->xgpe0_blk, register_count0, 0,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (( ACPI_REPORT_ERROR ((
@ -1094,8 +1132,9 @@ acpi_ev_gpe_initialize (
else { else {
/* Install GPE Block 1 */ /* Install GPE Block 1 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device, &acpi_gbl_FADT->xgpe1_blk, status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
register_count1, acpi_gbl_FADT->gpe1_base, &acpi_gbl_FADT->xgpe1_blk, register_count1,
acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]); acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {

View File

@ -50,6 +50,35 @@
ACPI_MODULE_NAME ("evmisc") 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 * 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_status
acpi_ev_queue_notify_request ( acpi_ev_queue_notify_request (
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
@ -128,7 +143,8 @@ acpi_ev_queue_notify_request (
/* /*
* For value 3 (Ejection Request), some device method may need to be run. * 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, * For value 0x80 (Status Change) on the power button or sleep button,
* initiate soft-off or sleep operation? * initiate soft-off or sleep operation?
*/ */
@ -140,7 +156,8 @@ acpi_ev_queue_notify_request (
acpi_notify_value_names[notify_value])); acpi_notify_value_names[notify_value]));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Notify value: 0x%2.2X **Device Specific**\n",
notify_value)); notify_value));
} }
@ -210,7 +227,7 @@ acpi_ev_queue_notify_request (
* *
* FUNCTION: acpi_ev_notify_dispatch * 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. * RETURN: None.
* *
@ -219,7 +236,7 @@ acpi_ev_queue_notify_request (
* *
******************************************************************************/ ******************************************************************************/
void ACPI_SYSTEM_XFACE static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch ( acpi_ev_notify_dispatch (
void *context) void *context)
{ {
@ -234,7 +251,8 @@ acpi_ev_notify_dispatch (
/* /*
* We will invoke a global notify handler if installed. * 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) { if (notify_info->notify.value <= ACPI_MAX_SYS_NOTIFY) {
/* Global system notification handler */ /* Global system notification handler */
@ -256,14 +274,16 @@ acpi_ev_notify_dispatch (
/* Invoke the system handler first, if present */ /* Invoke the system handler first, if present */
if (global_handler) { 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 */ /* Now invoke the per-device handler, if present */
handler_obj = notify_info->notify.handler_obj; handler_obj = notify_info->notify.handler_obj;
if (handler_obj) { if (handler_obj) {
handler_obj->notify.handler (notify_info->notify.node, notify_info->notify.value, handler_obj->notify.handler (notify_info->notify.node,
notify_info->notify.value,
handler_obj->notify.context); handler_obj->notify.context);
} }
@ -370,7 +390,8 @@ acpi_ev_global_lock_handler (
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_init_global_lock_handler (void) acpi_ev_init_global_lock_handler (
void)
{ {
acpi_status status; acpi_status status;
@ -433,8 +454,10 @@ acpi_ev_acquire_global_lock (
acpi_gbl_global_lock_thread_count++; 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) { if (acpi_gbl_global_lock_acquired) {
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -480,7 +503,8 @@ acpi_ev_acquire_global_lock (
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_release_global_lock (void) acpi_ev_release_global_lock (
void)
{ {
u8 pending = FALSE; u8 pending = FALSE;
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -490,7 +514,8 @@ acpi_ev_release_global_lock (void)
if (!acpi_gbl_global_lock_thread_count) { 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); return_ACPI_STATUS (AE_NOT_ACQUIRED);
} }
@ -515,7 +540,8 @@ acpi_ev_release_global_lock (void)
* register * register
*/ */
if (pending) { 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); return_ACPI_STATUS (status);
@ -535,7 +561,8 @@ acpi_ev_release_global_lock (void)
******************************************************************************/ ******************************************************************************/
void void
acpi_ev_terminate (void) acpi_ev_terminate (
void)
{ {
acpi_native_uint i; acpi_native_uint i;
acpi_status status; acpi_status status;
@ -555,7 +582,8 @@ acpi_ev_terminate (void)
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
status = acpi_disable_event ((u32) i, 0); status = acpi_disable_event ((u32) i, 0);
if (ACPI_FAILURE (status)) { 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 (); status = acpi_ev_remove_sci_handler ();
if (ACPI_FAILURE(status)) { 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"));
} }
} }

View File

@ -58,6 +58,22 @@ static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPA
ACPI_ADR_SPACE_PCI_CONFIG, ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE}; 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,7 +195,7 @@ acpi_ev_initialize_op_regions (
* *
* FUNCTION: acpi_ev_execute_reg_method * FUNCTION: acpi_ev_execute_reg_method
* *
* PARAMETERS: region_obj - Object structure * PARAMETERS: region_obj - Region object
* Function - Passed to _REG: On (1) or Off (0) * Function - Passed to _REG: On (1) or Off (0)
* *
* RETURN: Status * RETURN: Status
@ -323,14 +339,16 @@ acpi_ev_address_space_dispatch (
if (!region_setup) { if (!region_setup) {
/* No initialization routine, exit with error */ /* 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))); region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
return_ACPI_STATUS (AE_NOT_EXIST); return_ACPI_STATUS (AE_NOT_EXIST);
} }
/* /*
* We must exit the interpreter because the region setup will potentially * We must exit the interpreter because the region
* execute control methods (e.g., _REG method for this region) * setup will potentially execute control methods
* (e.g., _REG method for this region)
*/ */
acpi_ex_exit_interpreter (); acpi_ex_exit_interpreter ();
@ -621,7 +639,7 @@ acpi_ev_attach_region (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ev_install_handler ( acpi_ev_install_handler (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
@ -848,7 +866,8 @@ acpi_ev_install_space_handler (
if (handler_obj->address_space.handler == handler) { if (handler_obj->address_space.handler == handler) {
/* /*
* It is (relatively) OK to attempt to install the SAME * 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; status = AE_SAME_HANDLER;
goto unlock_and_exit; goto unlock_and_exit;
@ -1011,7 +1030,7 @@ acpi_ev_execute_reg_methods (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ev_reg_run ( acpi_ev_reg_run (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,

View File

@ -61,7 +61,7 @@
* *
* RETURN: Status * 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 * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a IO operation region
* *
******************************************************************************/ ******************************************************************************/
@ -151,7 +151,7 @@ acpi_ev_io_space_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a PCI_Config operation region
* *
* MUTEX: Assumes namespace is not locked * MUTEX: Assumes namespace is not locked
* *
@ -324,7 +324,7 @@ acpi_ev_pci_config_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a pci_bAR operation region
* *
* MUTEX: Assumes namespace is not locked * MUTEX: Assumes namespace is not locked
* *
@ -355,7 +355,7 @@ acpi_ev_pci_bar_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Setup a CMOS operation region
* *
* MUTEX: Assumes namespace is not locked * MUTEX: Assumes namespace is not locked
* *
@ -386,7 +386,7 @@ acpi_ev_cmos_region_setup (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Do any prep work for region handling * DESCRIPTION: Default region initialization
* *
******************************************************************************/ ******************************************************************************/

View File

@ -49,6 +49,12 @@
#define _COMPONENT ACPI_EVENTS #define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evsci") 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 u32
acpi_ev_install_sci_handler (void) acpi_ev_install_sci_handler (
void)
{ {
u32 status = AE_OK; u32 status = AE_OK;
@ -180,7 +187,8 @@ acpi_ev_install_sci_handler (void)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ev_remove_sci_handler (void) acpi_ev_remove_sci_handler (
void)
{ {
acpi_status status; acpi_status status;

View File

@ -64,6 +64,7 @@
* DESCRIPTION: Saves the pointer to the handler function * DESCRIPTION: Saves the pointer to the handler function
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
acpi_status acpi_status
acpi_install_exception_handler ( acpi_install_exception_handler (
@ -457,7 +458,8 @@ acpi_remove_notify_handler (
/* Root Object */ /* Root Object */
if (device == ACPI_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) && if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
!acpi_gbl_system_notify.handler) || !acpi_gbl_system_notify.handler) ||
@ -564,8 +566,9 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
* *
* FUNCTION: acpi_install_gpe_handler * FUNCTION: acpi_install_gpe_handler
* *
* PARAMETERS: gpe_number - The GPE number within the GPE block * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
* gpe_block - GPE block (NULL == FADT GPEs) * defined GPEs)
* gpe_number - The GPE number within the GPE block
* Type - Whether this GPE should be treated as an * Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt. * edge- or level-triggered interrupt.
* Address - Address of the handler * Address - Address of the handler
@ -662,8 +665,9 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
* *
* FUNCTION: acpi_remove_gpe_handler * FUNCTION: acpi_remove_gpe_handler
* *
* PARAMETERS: gpe_number - The event to remove a handler * PARAMETERS: gpe_device - Namespace node for the GPE (NULL for FADT
* gpe_block - GPE block (NULL == FADT GPEs) * defined GPEs)
* gpe_number - The event to remove a handler
* Address - Address of the handler * Address - Address of the handler
* *
* RETURN: Status * RETURN: Status
@ -766,7 +770,8 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
* FUNCTION: acpi_acquire_global_lock * FUNCTION: acpi_acquire_global_lock
* *
* PARAMETERS: Timeout - How long the caller is willing to wait * 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 * RETURN: Status
* *
@ -812,7 +817,7 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Release the ACPI Global Lock * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
* *
******************************************************************************/ ******************************************************************************/

View File

@ -64,7 +64,8 @@
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_enable (void) acpi_enable (
void)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -91,7 +92,8 @@ acpi_enable (void)
return_ACPI_STATUS (status); 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); return_ACPI_STATUS (status);
@ -106,12 +108,13 @@ acpi_enable (void)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Transfers the system into LEGACY mode. * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_disable (void) acpi_disable (
void)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -125,7 +128,8 @@ acpi_disable (void)
} }
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) { 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 { else {
/* Transition to LEGACY mode */ /* Transition to LEGACY mode */
@ -133,7 +137,8 @@ acpi_disable (void)
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY); status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
if (ACPI_FAILURE (status)) { 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); return_ACPI_STATUS (status);
} }
@ -214,7 +219,7 @@ EXPORT_SYMBOL(acpi_enable_event);
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable an ACPI event (general purpose) * DESCRIPTION: Set the type of an individual GPE
* *
******************************************************************************/ ******************************************************************************/
@ -519,13 +524,12 @@ unlock_and_exit:
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_get_event_status * FUNCTION: acpi_get_event_status
* *
* PARAMETERS: Event - The fixed event * 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 * be returned
* *
* RETURN: Status * RETURN: Status
@ -571,7 +575,7 @@ acpi_get_event_status (
* PARAMETERS: gpe_device - Parent GPE Device * PARAMETERS: gpe_device - Parent GPE Device
* gpe_number - GPE level within the GPE block * gpe_number - GPE level within the GPE block
* Flags - Called from an ISR or not * 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 * be returned
* *
* RETURN: Status * RETURN: Status
@ -775,4 +779,5 @@ unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
EXPORT_SYMBOL(acpi_remove_gpe_block); EXPORT_SYMBOL(acpi_remove_gpe_block);

View File

@ -54,6 +54,14 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconfig") 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 ( acpi_ex_add_table (
struct acpi_table_header *table, struct acpi_table_header *table,
struct acpi_namespace_node *parent_node, struct acpi_namespace_node *parent_node,
@ -226,9 +234,8 @@ acpi_ex_load_table_op (
start_node = parent_node; 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, 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)) { if (ACPI_FAILURE (status)) {
@ -248,7 +255,8 @@ acpi_ex_load_table_op (
if (parameter_node) { if (parameter_node) {
/* Store the parameter data into the optional parameter object */ /* 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); walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
(void) acpi_ex_unload_table (ddb_handle); (void) acpi_ex_unload_table (ddb_handle);
@ -371,7 +379,8 @@ acpi_ex_load_op (
goto cleanup; 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 */ /* Sanity check the table length */

View File

@ -50,6 +50,15 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconvrt") 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; result = 0;
/* /* String conversion is different than Buffer conversion */
* String conversion is different than Buffer conversion
*/
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
@ -168,9 +176,8 @@ acpi_ex_convert_to_integer (
break; break;
} }
/* /* Create a new integer */
* Create a new integer
*/
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); 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 * ASL/AML code that depends on the null being transferred to the new
* buffer. * 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) { if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
@ -291,7 +299,7 @@ acpi_ex_convert_to_buffer (
* *
******************************************************************************/ ******************************************************************************/
u32 static u32
acpi_ex_convert_to_ascii ( acpi_ex_convert_to_ascii (
acpi_integer integer, acpi_integer integer,
u16 base, u16 base,
@ -357,8 +365,9 @@ acpi_ex_convert_to_ascii (
case 16: 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--) { for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */ /* Get one hex digit, most significant digits first */
@ -475,7 +484,7 @@ acpi_ex_convert_to_string (
/* Setup string length, base, and separator */ /* Setup string length, base, and separator */
switch (type) { 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 * From ACPI: "If Data is a buffer, it is converted to a string of
* decimal values separated by commas." * decimal values separated by commas."
@ -509,7 +518,7 @@ acpi_ex_convert_to_string (
string_length = (obj_desc->buffer.length * 3); string_length = (obj_desc->buffer.length * 3);
break; 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 * From ACPI: "If Data is a buffer, it is converted to a string of
* hexadecimal values separated by commas." * hexadecimal values separated by commas."
@ -530,9 +539,8 @@ acpi_ex_convert_to_string (
return_ACPI_STATUS (AE_AML_STRING_LIMIT); 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); return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS (AE_NO_MEMORY); 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 */ *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--;
*new_buf = 0; *new_buf = 0;
break; break;
@ -645,7 +655,6 @@ acpi_ex_convert_to_target_type (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
* The operand must be a String. We can convert an * The operand must be a String. We can convert an
* Integer or Buffer if necessary * Integer or Buffer if necessary
@ -656,7 +665,6 @@ acpi_ex_convert_to_target_type (
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
/* /*
* The operand must be a Buffer. We can convert an * The operand must be a Buffer. We can convert an
* Integer or String if necessary * Integer or String if necessary

View File

@ -55,7 +55,7 @@
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_alias * FUNCTION: acpi_ex_create_alias
* *
@ -65,7 +65,7 @@
* *
* DESCRIPTION: Create a new named alias * DESCRIPTION: Create a new named alias
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_alias ( acpi_ex_create_alias (
@ -140,8 +140,7 @@ acpi_ex_create_alias (
* target node or the alias Node * target node or the alias Node
*/ */
status = acpi_ns_attach_object (alias_node, status = acpi_ns_attach_object (alias_node,
acpi_ns_get_attached_object (target_node), acpi_ns_get_attached_object (target_node), target_node->type);
target_node->type);
break; break;
} }
@ -151,7 +150,7 @@ acpi_ex_create_alias (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_event * FUNCTION: acpi_ex_create_event
* *
@ -161,7 +160,7 @@ acpi_ex_create_alias (
* *
* DESCRIPTION: Create a new event object * DESCRIPTION: Create a new event object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_event ( acpi_ex_create_event (
@ -205,7 +204,7 @@ cleanup:
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_mutex * FUNCTION: acpi_ex_create_mutex
* *
@ -217,7 +216,7 @@ cleanup:
* *
* Mutex (Name[0], sync_level[1]) * Mutex (Name[0], sync_level[1])
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_mutex ( acpi_ex_create_mutex (
@ -267,20 +266,20 @@ cleanup:
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_region * FUNCTION: acpi_ex_create_region
* *
* PARAMETERS: aml_start - Pointer to the region declaration AML * PARAMETERS: aml_start - Pointer to the region declaration AML
* aml_length - Max length of the declaration AML * aml_length - Max length of the declaration AML
* Operands - List of operands for the opcode * region_space - space_iD for the region
* walk_state - Current state * walk_state - Current state
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Create a new operation region object * DESCRIPTION: Create a new operation region object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_region ( acpi_ex_create_region (
@ -360,7 +359,7 @@ cleanup:
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_table_region * FUNCTION: acpi_ex_create_table_region
* *
@ -370,7 +369,7 @@ cleanup:
* *
* DESCRIPTION: Create a new data_table_region object * DESCRIPTION: Create a new data_table_region object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_table_region ( acpi_ex_create_table_region (
@ -455,7 +454,7 @@ cleanup:
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_processor * FUNCTION: acpi_ex_create_processor
* *
@ -467,7 +466,7 @@ cleanup:
* *
* Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3]) * Processor (Name[0], cpu_iD[1], pblock_addr[2], pblock_length[3])
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_processor ( acpi_ex_create_processor (
@ -488,9 +487,8 @@ acpi_ex_create_processor (
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }
/* /* Initialize the processor object from the operands */
* Initialize the processor object from the operands
*/
obj_desc->processor.proc_id = (u8) operand[1]->integer.value; obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value; obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
obj_desc->processor.length = (u8) operand[3]->integer.value; obj_desc->processor.length = (u8) operand[3]->integer.value;
@ -507,7 +505,7 @@ acpi_ex_create_processor (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_create_power_resource * FUNCTION: acpi_ex_create_power_resource
* *
@ -519,7 +517,7 @@ acpi_ex_create_processor (
* *
* power_resource (Name[0], system_level[1], resource_order[2]) * power_resource (Name[0], system_level[1], resource_order[2])
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_power_resource ( acpi_ex_create_power_resource (
@ -555,10 +553,10 @@ acpi_ex_create_power_resource (
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif #endif
/*****************************************************************************
/*******************************************************************************
* *
* FUNCTION: acpi_ex_create_method * FUNCTION: acpi_ex_create_method
* *
@ -570,7 +568,7 @@ acpi_ex_create_power_resource (
* *
* DESCRIPTION: Create a new method object * DESCRIPTION: Create a new method object
* *
****************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_create_method ( acpi_ex_create_method (

View File

@ -51,23 +51,48 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump") ACPI_MODULE_NAME ("exdump")
/* Local prototypes */
#ifdef ACPI_FUTURE_USAGE
static void
acpi_ex_out_string (
char *title,
char *value);
static void
acpi_ex_out_pointer (
char *title,
void *value);
static void
acpi_ex_out_integer (
char *title,
u32 value);
static void
acpi_ex_out_address (
char *title,
acpi_physical_address value);
#endif /* ACPI_FUTURE_USAGE */
/* /*
* The following routines are used for debug output only * The following routines are used for debug output only
*/ */
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_operand * FUNCTION: acpi_ex_dump_operand
* *
* PARAMETERS: *obj_desc - Pointer to entry to be dumped * PARAMETERS: *obj_desc - Pointer to entry to be dumped
* Depth - Current nesting depth
* *
* RETURN: None * RETURN: None
* *
* DESCRIPTION: Dump an operand object * DESCRIPTION: Dump an operand object
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_operand ( acpi_ex_dump_operand (
@ -86,9 +111,8 @@ acpi_ex_dump_operand (
} }
if (!obj_desc) { if (!obj_desc) {
/* /* This could be a null element of a package */
* This could be a null element of a package
*/
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
return; return;
} }
@ -117,6 +141,8 @@ acpi_ex_dump_operand (
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc)); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", obj_desc));
} }
/* Decode object type */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
@ -274,7 +300,9 @@ acpi_ex_dump_operand (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
acpi_os_printf ("String length %X @ %p ", acpi_os_printf ("String length %X @ %p ",
obj_desc->string.length, obj_desc->string.pointer); obj_desc->string.length,
obj_desc->string.pointer);
acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX); acpi_ut_print_string (obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf ("\n"); acpi_os_printf ("\n");
break; break;
@ -290,10 +318,13 @@ acpi_ex_dump_operand (
acpi_os_printf ( acpi_os_printf (
"region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", "region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
obj_desc->field.bit_length, obj_desc->field.access_byte_width, obj_desc->field.bit_length,
obj_desc->field.access_byte_width,
obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK,
obj_desc->field.base_byte_offset, obj_desc->field.start_field_bit_offset); obj_desc->field.base_byte_offset,
obj_desc->field.start_field_bit_offset);
acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1); acpi_ex_dump_operand (obj_desc->field.region_obj, depth+1);
break; break;
@ -308,13 +339,15 @@ acpi_ex_dump_operand (
acpi_os_printf ( acpi_os_printf (
"buffer_field: %X bits at byte %X bit %X of \n", "buffer_field: %X bits at byte %X bit %X of \n",
obj_desc->buffer_field.bit_length, obj_desc->buffer_field.base_byte_offset, obj_desc->buffer_field.bit_length,
obj_desc->buffer_field.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset); obj_desc->buffer_field.start_field_bit_offset);
if (!obj_desc->buffer_field.buffer_obj) { if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
} }
else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) != ACPI_TYPE_BUFFER) { else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) !=
ACPI_TYPE_BUFFER) {
acpi_os_printf ("*not a Buffer* \n"); acpi_os_printf ("*not a Buffer* \n");
} }
else { else {
@ -331,10 +364,10 @@ acpi_ex_dump_operand (
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
acpi_os_printf ( acpi_os_printf ("Method(%X) @ %p:%X\n",
"Method(%X) @ %p:%X\n",
obj_desc->method.param_count, obj_desc->method.param_count,
obj_desc->method.aml_start, obj_desc->method.aml_length); obj_desc->method.aml_start,
obj_desc->method.aml_length);
break; break;
@ -379,7 +412,7 @@ acpi_ex_dump_operand (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_operands * FUNCTION: acpi_ex_dump_operands
* *
@ -393,7 +426,7 @@ acpi_ex_dump_operand (
* *
* DESCRIPTION: Dump the object stack * DESCRIPTION: Dump the object stack
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_operands ( acpi_ex_dump_operands (
@ -441,10 +474,9 @@ acpi_ex_dump_operands (
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
/*****************************************************************************
* *
* FUNCTION: acpi_ex_out* * FUNCTION: acpi_ex_out* functions
* *
* PARAMETERS: Title - Descriptive text * PARAMETERS: Title - Descriptive text
* Value - Value to be displayed * Value - Value to be displayed
@ -453,9 +485,9 @@ acpi_ex_dump_operands (
* reduce the number of format strings required and keeps them * reduce the number of format strings required and keeps them
* all in one place for easy modification. * all in one place for easy modification.
* *
****************************************************************************/ ******************************************************************************/
void static void
acpi_ex_out_string ( acpi_ex_out_string (
char *title, char *title,
char *value) char *value)
@ -463,7 +495,7 @@ acpi_ex_out_string (
acpi_os_printf ("%20s : %s\n", title, value); acpi_os_printf ("%20s : %s\n", title, value);
} }
void static void
acpi_ex_out_pointer ( acpi_ex_out_pointer (
char *title, char *title,
void *value) void *value)
@ -471,7 +503,7 @@ acpi_ex_out_pointer (
acpi_os_printf ("%20s : %p\n", title, value); acpi_os_printf ("%20s : %p\n", title, value);
} }
void static void
acpi_ex_out_integer ( acpi_ex_out_integer (
char *title, char *title,
u32 value) u32 value)
@ -479,7 +511,7 @@ acpi_ex_out_integer (
acpi_os_printf ("%20s : %X\n", title, value); acpi_os_printf ("%20s : %X\n", title, value);
} }
void static void
acpi_ex_out_address ( acpi_ex_out_address (
char *title, char *title,
acpi_physical_address value) acpi_physical_address value)
@ -493,16 +525,16 @@ acpi_ex_out_address (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_node * FUNCTION: acpi_ex_dump_node
* *
* PARAMETERS: *Node - Descriptor to dump * PARAMETERS: *Node - Descriptor to dump
* Flags - Force display * Flags - Force display if TRUE
* *
* DESCRIPTION: Dumps the members of the given.Node * DESCRIPTION: Dumps the members of the given.Node
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_node ( acpi_ex_dump_node (
@ -531,16 +563,16 @@ acpi_ex_dump_node (
} }
/***************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_object_descriptor * FUNCTION: acpi_ex_dump_object_descriptor
* *
* PARAMETERS: *Object - Descriptor to dump * PARAMETERS: *Object - Descriptor to dump
* Flags - Force display * Flags - Force display if TRUE
* *
* DESCRIPTION: Dumps the members of the object descriptor given. * DESCRIPTION: Dumps the members of the object descriptor given.
* *
****************************************************************************/ ******************************************************************************/
void void
acpi_ex_dump_object_descriptor ( acpi_ex_dump_object_descriptor (
@ -553,6 +585,10 @@ acpi_ex_dump_object_descriptor (
ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor"); ACPI_FUNCTION_TRACE ("ex_dump_object_descriptor");
if (!obj_desc) {
return_VOID;
}
if (!flags) { if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) { if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
return_VOID; return_VOID;
@ -747,11 +783,17 @@ acpi_ex_dump_object_descriptor (
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_ex_out_integer ("target_type", obj_desc->reference.target_type); acpi_ex_out_integer ("target_type", obj_desc->reference.target_type);
acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name); acpi_ex_out_string ("Opcode", (acpi_ps_get_opcode_info (
obj_desc->reference.opcode))->name);
acpi_ex_out_integer ("Offset", obj_desc->reference.offset); acpi_ex_out_integer ("Offset", obj_desc->reference.offset);
acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object); acpi_ex_out_pointer ("obj_desc", obj_desc->reference.object);
acpi_ex_out_pointer ("Node", obj_desc->reference.node); acpi_ex_out_pointer ("Node", obj_desc->reference.node);
acpi_ex_out_pointer ("Where", obj_desc->reference.where); acpi_ex_out_pointer ("Where", obj_desc->reference.where);
if (obj_desc->reference.object) {
acpi_os_printf ("\nReferenced Object:\n");
acpi_ex_dump_object_descriptor (obj_desc->reference.object, flags);
}
break; break;
@ -788,6 +830,5 @@ acpi_ex_dump_object_descriptor (
} }
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */
#endif #endif

View File

@ -196,6 +196,7 @@ exit:
* *
* PARAMETERS: source_desc - Contains data to write * PARAMETERS: source_desc - Contains data to write
* obj_desc - The named field * obj_desc - The named field
* result_desc - Where the return value is returned, if any
* *
* RETURN: Status * RETURN: Status
* *
@ -250,12 +251,15 @@ acpi_ex_write_data_to_field (
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) { if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n", ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
acpi_ut_get_object_type_name (source_desc))); acpi_ut_get_object_type_name (source_desc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) { 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)); ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
} }
@ -265,14 +269,16 @@ acpi_ex_write_data_to_field (
} }
buffer = buffer_desc->buffer.pointer; 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 */ /* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags); 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. * Note: SMBus protocol type is passed in upper 16-bits of Function.
*/ */
status = acpi_ex_access_region (obj_desc, 0, status = acpi_ex_access_region (obj_desc, 0,
@ -284,9 +290,8 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS (status); 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)) { switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value; buffer = &source_desc->integer.value;
@ -314,7 +319,8 @@ acpi_ex_write_data_to_field (
* the ACPI specification. * the ACPI specification.
*/ */
new_buffer = NULL; 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) { if (length < required_length) {
/* We need to create a new buffer */ /* 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", "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)), source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
ACPI_GET_OBJECT_TYPE (source_desc), buffer, length)); ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n", "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)), obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),

View File

@ -52,12 +52,31 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exfldio") ACPI_MODULE_NAME ("exfldio")
/* Local prototypes */
static acpi_status
acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write);
static u8
acpi_ex_register_overflow (
union acpi_operand_object *obj_desc,
acpi_integer value);
static acpi_status
acpi_ex_setup_region (
union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_setup_region * FUNCTION: acpi_ex_setup_region
* *
* PARAMETERS: *obj_desc - Field to be read or written * PARAMETERS: obj_desc - Field to be read or written
* field_datum_byte_offset - Byte offset of this datum within the * field_datum_byte_offset - Byte offset of this datum within the
* parent field * parent field
* *
@ -69,7 +88,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_setup_region ( acpi_ex_setup_region (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset) u32 field_datum_byte_offset)
@ -127,9 +146,9 @@ acpi_ex_setup_region (
* length of one field datum (access width) must fit within the region. * length of one field datum (access width) must fit within the region.
* (Region length is specified in bytes) * (Region length is specified in bytes)
*/ */
if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
+ field_datum_byte_offset field_datum_byte_offset +
+ obj_desc->common_field.access_byte_width)) { obj_desc->common_field.access_byte_width)) {
if (acpi_gbl_enable_interpreter_slack) { if (acpi_gbl_enable_interpreter_slack) {
/* /*
* Slack mode only: We will go ahead and allow access to this * Slack mode only: We will go ahead and allow access to this
@ -155,7 +174,8 @@ acpi_ex_setup_region (
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
acpi_ut_get_node_name (obj_desc->common_field.node), acpi_ut_get_node_name (obj_desc->common_field.node),
obj_desc->common_field.access_byte_width, obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); acpi_ut_get_node_name (rgn_desc->region.node),
rgn_desc->region.length));
} }
/* /*
@ -167,7 +187,8 @@ acpi_ex_setup_region (
acpi_ut_get_node_name (obj_desc->common_field.node), acpi_ut_get_node_name (obj_desc->common_field.node),
obj_desc->common_field.base_byte_offset, obj_desc->common_field.base_byte_offset,
field_datum_byte_offset, obj_desc->common_field.access_byte_width, field_datum_byte_offset, obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name (rgn_desc->region.node), rgn_desc->region.length)); acpi_ut_get_node_name (rgn_desc->region.node),
rgn_desc->region.length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT); return_ACPI_STATUS (AE_AML_REGION_LIMIT);
} }
@ -180,10 +201,10 @@ acpi_ex_setup_region (
* *
* FUNCTION: acpi_ex_access_region * FUNCTION: acpi_ex_access_region
* *
* PARAMETERS: *obj_desc - Field to be read * PARAMETERS: obj_desc - Field to be read
* field_datum_byte_offset - Byte offset of this datum within the * field_datum_byte_offset - Byte offset of this datum within the
* parent field * parent field
* *Value - Where to store value (must at least * Value - Where to store value (must at least
* the size of acpi_integer) * the size of acpi_integer)
* Function - Read or Write flag plus other region- * Function - Read or Write flag plus other region-
* dependent flags * dependent flags
@ -226,9 +247,9 @@ acpi_ex_access_region (
* 3) The current offset into the field * 3) The current offset into the field
*/ */
rgn_desc = obj_desc->common_field.region_obj; rgn_desc = obj_desc->common_field.region_obj;
address = rgn_desc->region.address address = rgn_desc->region.address +
+ obj_desc->common_field.base_byte_offset obj_desc->common_field.base_byte_offset +
+ field_datum_byte_offset; field_datum_byte_offset;
if ((function & ACPI_IO_MASK) == ACPI_READ) { if ((function & ACPI_IO_MASK) == ACPI_READ) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]")); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "[READ]"));
@ -249,7 +270,8 @@ acpi_ex_access_region (
/* Invoke the appropriate address_space/op_region handler */ /* Invoke the appropriate address_space/op_region handler */
status = acpi_ev_address_space_dispatch (rgn_desc, function, status = acpi_ev_address_space_dispatch (rgn_desc, function,
address, ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value); address,
ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
if (status == AE_NOT_IMPLEMENTED) { if (status == AE_NOT_IMPLEMENTED) {
@ -274,7 +296,7 @@ acpi_ex_access_region (
* *
* FUNCTION: acpi_ex_register_overflow * FUNCTION: acpi_ex_register_overflow
* *
* PARAMETERS: *obj_desc - Register(Field) to be written * PARAMETERS: obj_desc - Register(Field) to be written
* Value - Value to be stored * Value - Value to be stored
* *
* RETURN: TRUE if value overflows the field, FALSE otherwise * RETURN: TRUE if value overflows the field, FALSE otherwise
@ -287,7 +309,7 @@ acpi_ex_access_region (
* *
******************************************************************************/ ******************************************************************************/
u8 static u8
acpi_ex_register_overflow ( acpi_ex_register_overflow (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
acpi_integer value) acpi_integer value)
@ -319,10 +341,10 @@ acpi_ex_register_overflow (
* *
* FUNCTION: acpi_ex_field_datum_io * FUNCTION: acpi_ex_field_datum_io
* *
* PARAMETERS: *obj_desc - Field to be read * PARAMETERS: obj_desc - Field to be read
* field_datum_byte_offset - Byte offset of this datum within the * field_datum_byte_offset - Byte offset of this datum within the
* parent field * parent field
* *Value - Where to store value (must be 64 bits) * Value - Where to store value (must be 64 bits)
* read_write - Read or Write flag * read_write - Read or Write flag
* *
* RETURN: Status * RETURN: Status
@ -333,7 +355,7 @@ acpi_ex_register_overflow (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_field_datum_io ( acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset, u32 field_datum_byte_offset,
@ -350,7 +372,9 @@ acpi_ex_field_datum_io (
if (read_write == ACPI_READ) { if (read_write == ACPI_READ) {
if (!value) { if (!value) {
local_value = 0; local_value = 0;
value = &local_value; /* To support reads without saving return value */
/* To support reads without saving return value */
value = &local_value;
} }
/* Clear the entire return buffer first, [Very Important!] */ /* Clear the entire return buffer first, [Very Important!] */
@ -363,8 +387,10 @@ acpi_ex_field_datum_io (
* *
* buffer_field - Read/write from/to a Buffer * buffer_field - Read/write from/to a Buffer
* region_field - Read/write from/to a Operation Region. * region_field - Read/write from/to a Operation Region.
* bank_field - Write to a Bank Register, then read/write from/to an op_region * bank_field - Write to a Bank Register, then read/write from/to an
* index_field - Write to an Index Register, then read/write from/to a Data Register * operation_region
* index_field - Write to an Index Register, then read/write from/to a
* Data Register
*/ */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
@ -384,9 +410,10 @@ acpi_ex_field_datum_io (
* Copy the data from the source buffer. * Copy the data from the source buffer.
* Length is the field width in bytes. * Length is the field width in bytes.
*/ */
ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer ACPI_MEMCPY (value,
+ obj_desc->buffer_field.base_byte_offset (obj_desc->buffer_field.buffer_obj)->buffer.pointer +
+ field_datum_byte_offset, obj_desc->buffer_field.base_byte_offset +
field_datum_byte_offset,
obj_desc->common_field.access_byte_width); obj_desc->common_field.access_byte_width);
} }
else { else {
@ -394,9 +421,9 @@ acpi_ex_field_datum_io (
* Copy the data to the target buffer. * Copy the data to the target buffer.
* Length is the field width in bytes. * Length is the field width in bytes.
*/ */
ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
+ obj_desc->buffer_field.base_byte_offset obj_desc->buffer_field.base_byte_offset +
+ field_datum_byte_offset, field_datum_byte_offset,
value, obj_desc->common_field.access_byte_width); value, obj_desc->common_field.access_byte_width);
} }
@ -406,8 +433,10 @@ acpi_ex_field_datum_io (
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
/* Ensure that the bank_value is not beyond the capacity of the register */ /*
* Ensure that the bank_value is not beyond the capacity of
* the register
*/
if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj, if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,
(acpi_integer) obj_desc->bank_field.value)) { (acpi_integer) obj_desc->bank_field.value)) {
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
@ -445,8 +474,10 @@ acpi_ex_field_datum_io (
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Ensure that the index_value is not beyond the capacity of the register */ /*
* Ensure that the index_value is not beyond the capacity of
* the register
*/
if (acpi_ex_register_overflow (obj_desc->index_field.index_obj, if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,
(acpi_integer) obj_desc->index_field.value)) { (acpi_integer) obj_desc->index_field.value)) {
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
@ -496,12 +527,14 @@ acpi_ex_field_datum_io (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
if (read_write == ACPI_READ) { if (read_write == ACPI_READ) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Value Read %8.8X%8.8X, Width %d\n",
ACPI_FORMAT_UINT64 (*value), ACPI_FORMAT_UINT64 (*value),
obj_desc->common_field.access_byte_width)); obj_desc->common_field.access_byte_width));
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Value Written %8.8X%8.8X, Width %d\n",
ACPI_FORMAT_UINT64 (*value), ACPI_FORMAT_UINT64 (*value),
obj_desc->common_field.access_byte_width)); obj_desc->common_field.access_byte_width));
} }
@ -515,8 +548,10 @@ acpi_ex_field_datum_io (
* *
* FUNCTION: acpi_ex_write_with_update_rule * FUNCTION: acpi_ex_write_with_update_rule
* *
* PARAMETERS: *obj_desc - Field to be set * PARAMETERS: obj_desc - Field to be written
* Value - Value to store * Mask - bitmask within field datum
* field_value - Value to write
* field_datum_byte_offset - Offset of datum within field
* *
* RETURN: Status * RETURN: Status
* *
@ -689,7 +724,8 @@ acpi_ex_extract_from_field (
/* Merge with previous datum if necessary */ /* Merge with previous datum if necessary */
merged_datum |= raw_datum << merged_datum |= raw_datum <<
(obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); (obj_desc->common_field.access_bit_width -
obj_desc->common_field.start_field_bit_offset);
if (i == datum_count) { if (i == datum_count) {
break; break;
@ -707,7 +743,8 @@ acpi_ex_extract_from_field (
/* Mask off any extra bits in the last datum */ /* Mask off any extra bits in the last datum */
buffer_tail_bits = obj_desc->common_field.bit_length % obj_desc->common_field.access_bit_width; buffer_tail_bits = obj_desc->common_field.bit_length %
obj_desc->common_field.access_bit_width;
if (buffer_tail_bits) { if (buffer_tail_bits) {
merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); merged_datum &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
} }
@ -791,7 +828,8 @@ acpi_ex_insert_into_field (
/* Write merged datum to the target field */ /* Write merged datum to the target field */
merged_datum &= mask; merged_datum &= mask;
status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); status = acpi_ex_write_with_update_rule (obj_desc, mask,
merged_datum, field_offset);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -800,7 +838,8 @@ acpi_ex_insert_into_field (
field_offset += obj_desc->common_field.access_byte_width; field_offset += obj_desc->common_field.access_byte_width;
merged_datum = raw_datum >> merged_datum = raw_datum >>
(obj_desc->common_field.access_bit_width - obj_desc->common_field.start_field_bit_offset); (obj_desc->common_field.access_bit_width -
obj_desc->common_field.start_field_bit_offset);
mask = ACPI_INTEGER_MAX; mask = ACPI_INTEGER_MAX;
if (i == datum_count) { if (i == datum_count) {
@ -819,7 +858,8 @@ acpi_ex_insert_into_field (
/* Mask off any extra bits in the last datum */ /* Mask off any extra bits in the last datum */
buffer_tail_bits = (obj_desc->common_field.bit_length + buffer_tail_bits = (obj_desc->common_field.bit_length +
obj_desc->common_field.start_field_bit_offset) % obj_desc->common_field.access_bit_width; obj_desc->common_field.start_field_bit_offset) %
obj_desc->common_field.access_bit_width;
if (buffer_tail_bits) { if (buffer_tail_bits) {
mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits); mask &= ACPI_MASK_BITS_ABOVE (buffer_tail_bits);
} }
@ -827,7 +867,8 @@ acpi_ex_insert_into_field (
/* Write the last datum to the field */ /* Write the last datum to the field */
merged_datum &= mask; merged_datum &= mask;
status = acpi_ex_write_with_update_rule (obj_desc, mask, merged_datum, field_offset); status = acpi_ex_write_with_update_rule (obj_desc,
mask, merged_datum, field_offset);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }

View File

@ -139,7 +139,8 @@ acpi_ex_get_object_reference (
reference_obj->reference.object = referenced_obj; reference_obj->reference.object = referenced_obj;
*return_desc = reference_obj; *return_desc = reference_obj;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n", 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)); obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);

View File

@ -49,6 +49,13 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exmutex") ACPI_MODULE_NAME ("exmutex")
/* Local prototypes */
static void
acpi_ex_link_mutex (
union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread);
/******************************************************************************* /*******************************************************************************
* *
@ -56,7 +63,7 @@
* *
* PARAMETERS: obj_desc - The mutex to be unlinked * PARAMETERS: obj_desc - The mutex to be unlinked
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Remove a mutex from the "acquired_mutex" list * DESCRIPTION: Remove a mutex from the "acquired_mutex" list
* *
@ -93,15 +100,15 @@ acpi_ex_unlink_mutex (
* FUNCTION: acpi_ex_link_mutex * FUNCTION: acpi_ex_link_mutex
* *
* PARAMETERS: obj_desc - The mutex to be linked * PARAMETERS: obj_desc - The mutex to be linked
* list_head - head of the "acquired_mutex" list * Thread - Current executing thread object
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk * DESCRIPTION: Add a mutex to the "acquired_mutex" list for this walk
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ex_link_mutex ( acpi_ex_link_mutex (
union acpi_operand_object *obj_desc, union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread) struct acpi_thread_state *thread)
@ -132,8 +139,9 @@ acpi_ex_link_mutex (
* *
* FUNCTION: acpi_ex_acquire_mutex * FUNCTION: acpi_ex_acquire_mutex
* *
* PARAMETERS: time_desc - The 'time to delay' object descriptor * PARAMETERS: time_desc - Timeout integer
* obj_desc - The object descriptor for this op * obj_desc - Mutex object
* walk_state - Current method execution state
* *
* RETURN: Status * RETURN: Status
* *
@ -170,7 +178,8 @@ acpi_ex_acquire_mutex (
* mutex. This mechanism provides some deadlock prevention * mutex. This mechanism provides some deadlock prevention
*/ */
if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", ACPI_REPORT_ERROR ((
"Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
acpi_ut_get_node_name (obj_desc->mutex.node))); acpi_ut_get_node_name (obj_desc->mutex.node)));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER); return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
} }
@ -180,8 +189,10 @@ acpi_ex_acquire_mutex (
if (obj_desc->mutex.owner_thread) { if (obj_desc->mutex.owner_thread) {
/* Special case for Global Lock, allow all threads */ /* Special case for Global Lock, allow all threads */
if ((obj_desc->mutex.owner_thread->thread_id == walk_state->thread->thread_id) || if ((obj_desc->mutex.owner_thread->thread_id ==
(obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore)) { walk_state->thread->thread_id) ||
(obj_desc->mutex.semaphore ==
acpi_gbl_global_lock_semaphore)) {
/* /*
* The mutex is already owned by this thread, * The mutex is already owned by this thread,
* just increment the acquisition depth * just increment the acquisition depth
@ -221,6 +232,7 @@ acpi_ex_acquire_mutex (
* FUNCTION: acpi_ex_release_mutex * FUNCTION: acpi_ex_release_mutex
* *
* PARAMETERS: obj_desc - The object descriptor for this op * PARAMETERS: obj_desc - The object descriptor for this op
* walk_state - Current method execution state
* *
* RETURN: Status * RETURN: Status
* *
@ -278,7 +290,8 @@ acpi_ex_release_mutex (
* equal to the current sync level * equal to the current sync level
*/ */
if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) { if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect sync_level\n", ACPI_REPORT_ERROR ((
"Cannot release Mutex [%4.4s], incorrect sync_level\n",
acpi_ut_get_node_name (obj_desc->mutex.node))); acpi_ut_get_node_name (obj_desc->mutex.node)));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER); return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
} }
@ -313,11 +326,11 @@ acpi_ex_release_mutex (
* *
* FUNCTION: acpi_ex_release_all_mutexes * FUNCTION: acpi_ex_release_all_mutexes
* *
* PARAMETERS: mutex_list - Head of the mutex list * PARAMETERS: Thread - Current executing thread object
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Release all mutexes in the list * DESCRIPTION: Release all mutexes held by this thread
* *
******************************************************************************/ ******************************************************************************/

View File

@ -50,13 +50,17 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exnames") ACPI_MODULE_NAME ("exnames")
/* Local prototypes */
/* AML Package Length encodings */ static char *
acpi_ex_allocate_name_string (
u32 prefix_count,
u32 num_name_segs);
#define ACPI_AML_PACKAGE_TYPE1 0x40 static acpi_status
#define ACPI_AML_PACKAGE_TYPE2 0x4000 acpi_ex_name_segment (
#define ACPI_AML_PACKAGE_TYPE3 0x400000 u8 **in_aml_address,
#define ACPI_AML_PACKAGE_TYPE4 0x40000000 char *name_string);
/******************************************************************************* /*******************************************************************************
@ -64,7 +68,7 @@
* FUNCTION: acpi_ex_allocate_name_string * FUNCTION: acpi_ex_allocate_name_string
* *
* PARAMETERS: prefix_count - Count of parent levels. Special cases: * PARAMETERS: prefix_count - Count of parent levels. Special cases:
* (-1) = root, 0 = none * (-1)==root, 0==none
* num_name_segs - count of 4-character name segments * num_name_segs - count of 4-character name segments
* *
* RETURN: A pointer to the allocated string segment. This segment must * RETURN: A pointer to the allocated string segment. This segment must
@ -75,7 +79,7 @@
* *
******************************************************************************/ ******************************************************************************/
char * static char *
acpi_ex_allocate_name_string ( acpi_ex_allocate_name_string (
u32 prefix_count, u32 prefix_count,
u32 num_name_segs) u32 num_name_segs)
@ -88,7 +92,7 @@ acpi_ex_allocate_name_string (
/* /*
* Allow room for all \ and ^ prefixes, all segments, and a multi_name_prefix. * Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
* Also, one byte for the null terminator. * Also, one byte for the null terminator.
* This may actually be somewhat longer than needed. * This may actually be somewhat longer than needed.
*/ */
@ -107,7 +111,8 @@ acpi_ex_allocate_name_string (
*/ */
name_string = ACPI_MEM_ALLOCATE (size_needed); name_string = ACPI_MEM_ALLOCATE (size_needed);
if (!name_string) { if (!name_string) {
ACPI_REPORT_ERROR (("ex_allocate_name_string: Could not allocate size %d\n", size_needed)); ACPI_REPORT_ERROR ((
"ex_allocate_name_string: Could not allocate size %d\n", size_needed));
return_PTR (NULL); return_PTR (NULL);
} }
@ -152,15 +157,17 @@ acpi_ex_allocate_name_string (
* *
* FUNCTION: acpi_ex_name_segment * FUNCTION: acpi_ex_name_segment
* *
* PARAMETERS: interpreter_mode - Current running mode (load1/Load2/Exec) * PARAMETERS: in_aml_address - Pointer to the name in the AML code
* name_string - Where to return the name. The name is appended
* to any existing string to form a namepath
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Execute a name segment (4 bytes) * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_name_segment ( acpi_ex_name_segment (
u8 **in_aml_address, u8 **in_aml_address,
char *name_string) char *name_string)
@ -223,10 +230,13 @@ acpi_ex_name_segment (
status = AE_CTRL_PENDING; status = AE_CTRL_PENDING;
} }
else { else {
/* Segment started with one or more valid characters, but fewer than 4 */ /*
* Segment started with one or more valid characters, but fewer than
* the required 4
*/
status = AE_AML_BAD_NAME; status = AE_AML_BAD_NAME;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad character %02x in name, at %p\n",
*aml_address, aml_address)); *aml_address, aml_address));
} }
@ -239,11 +249,16 @@ acpi_ex_name_segment (
* *
* FUNCTION: acpi_ex_get_name_string * FUNCTION: acpi_ex_get_name_string
* *
* PARAMETERS: data_type - Data type to be associated with this name * PARAMETERS: data_type - Object type to be associated with this
* name
* in_aml_address - Pointer to the namestring in the AML code
* out_name_string - Where the namestring is returned
* out_name_length - Length of the returned string
* *
* RETURN: Status * RETURN: Status, namestring and length
* *
* DESCRIPTION: Get a name, including any prefixes. * DESCRIPTION: Extract a full namepath from the AML byte stream,
* including any prefixes.
* *
******************************************************************************/ ******************************************************************************/
@ -286,7 +301,8 @@ acpi_ex_get_name_string (
switch (*aml_address) { switch (*aml_address) {
case AML_ROOT_PREFIX: case AML_ROOT_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
aml_address));
/* /*
* Remember that we have a root_prefix -- * Remember that we have a root_prefix --
@ -303,7 +319,8 @@ acpi_ex_get_name_string (
/* Increment past possibly multiple parent prefixes */ /* Increment past possibly multiple parent prefixes */
do { do {
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
aml_address));
aml_address++; aml_address++;
prefix_count++; prefix_count++;
@ -321,13 +338,13 @@ acpi_ex_get_name_string (
break; break;
} }
/* Examine first character of name for name segment prefix operator */ /* Examine first character of name for name segment prefix operator */
switch (*aml_address) { switch (*aml_address) {
case AML_DUAL_NAME_PREFIX: case AML_DUAL_NAME_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
aml_address));
aml_address++; aml_address++;
name_string = acpi_ex_allocate_name_string (prefix_count, 2); name_string = acpi_ex_allocate_name_string (prefix_count, 2);
@ -349,7 +366,8 @@ acpi_ex_get_name_string (
case AML_MULTI_NAME_PREFIX_OP: case AML_MULTI_NAME_PREFIX_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n", aml_address)); ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
aml_address));
/* Fetch count of segments remaining in name path */ /* Fetch count of segments remaining in name path */
@ -368,7 +386,8 @@ acpi_ex_get_name_string (
has_prefix = TRUE; has_prefix = TRUE;
while (num_segments && while (num_segments &&
(status = acpi_ex_name_segment (&aml_address, name_string)) == AE_OK) { (status = acpi_ex_name_segment (&aml_address, name_string)) ==
AE_OK) {
num_segments--; num_segments--;
} }
@ -380,7 +399,8 @@ acpi_ex_get_name_string (
/* null_name valid as of 8-12-98 ASL/AML Grammar Update */ /* null_name valid as of 8-12-98 ASL/AML Grammar Update */
if (prefix_count == ACPI_UINT32_MAX) { if (prefix_count == ACPI_UINT32_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "name_seg is \"\\\" followed by NULL\n")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"name_seg is \"\\\" followed by NULL\n"));
} }
/* Consume the NULL byte */ /* Consume the NULL byte */

View File

@ -97,7 +97,8 @@ acpi_ex_opcode_0A_0T_1R (
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_0A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
@ -161,7 +162,8 @@ acpi_ex_opcode_1A_0T_0R (
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
@ -236,7 +238,8 @@ acpi_ex_opcode_1A_1T_0R (
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_0R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
@ -289,7 +292,8 @@ acpi_ex_opcode_1A_1T_1R (
acpi_integer digit; acpi_integer digit;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_1T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
@ -409,8 +413,10 @@ acpi_ex_opcode_1A_1T_1R (
for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) { for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
(void) acpi_ut_short_divide (digit, 10, &digit, &temp32); (void) acpi_ut_short_divide (digit, 10, &digit, &temp32);
/* Insert the BCD digit that resides in the remainder from above */ /*
* Insert the BCD digit that resides in the
* remainder from above
*/
return_desc->integer.value |= (((acpi_integer) temp32) << return_desc->integer.value |= (((acpi_integer) temp32) <<
ACPI_MUL_4 (i)); ACPI_MUL_4 (i));
} }
@ -445,7 +451,8 @@ acpi_ex_opcode_1A_1T_1R (
/* Get the object reference, store it, and remove our reference */ /* Get the object reference, store it, and remove our reference */
status = acpi_ex_get_object_reference (operand[0], &return_desc2, walk_state); status = acpi_ex_get_object_reference (operand[0],
&return_desc2, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
@ -482,10 +489,10 @@ acpi_ex_opcode_1A_1T_1R (
if (!walk_state->result_obj) { if (!walk_state->result_obj) {
/* /*
* Normally, we would remove a reference on the Operand[0] parameter; * Normally, we would remove a reference on the Operand[0]
* But since it is being used as the internal return object * parameter; But since it is being used as the internal return
* (meaning we would normally increment it), the two cancel out, * object (meaning we would normally increment it), the two
* and we simply don't do anything. * cancel out, and we simply don't do anything.
*/ */
walk_state->result_obj = operand[0]; walk_state->result_obj = operand[0];
walk_state->operands[0] = NULL; /* Prevent deletion */ walk_state->operands[0] = NULL; /* Prevent deletion */
@ -549,9 +556,8 @@ acpi_ex_opcode_1A_1T_1R (
case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */ case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */
case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */ case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
/* /* These are two obsolete opcodes */
* These are two obsolete opcodes
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s is obsolete and not implemented\n", "%s is obsolete and not implemented\n",
acpi_ps_get_opcode_name (walk_state->opcode))); acpi_ps_get_opcode_name (walk_state->opcode)));
@ -568,9 +574,8 @@ acpi_ex_opcode_1A_1T_1R (
} }
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* /* Store the return value computed above into the target object */
* Store the return value computed above into the target object
*/
status = acpi_ex_store (return_desc, operand[1], walk_state); status = acpi_ex_store (return_desc, operand[1], walk_state);
} }
@ -615,7 +620,8 @@ acpi_ex_opcode_1A_0T_1R (
acpi_integer value; acpi_integer value;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
/* Examine the AML opcode */ /* Examine the AML opcode */
@ -706,9 +712,9 @@ acpi_ex_opcode_1A_0T_1R (
/* /*
* Note: The operand is not resolved at this point because we want to * Note: The operand is not resolved at this point because we want to
* get the associated object, not its value. For example, we don't want * get the associated object, not its value. For example, we don't
* to resolve a field_unit to its value, we want the actual field_unit * want to resolve a field_unit to its value, we want the actual
* object. * field_unit object.
*/ */
/* Get the type of the base object */ /* Get the type of the base object */
@ -738,7 +744,8 @@ acpi_ex_opcode_1A_0T_1R (
/* Get the base object */ /* Get the base object */
status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc); status = acpi_ex_resolve_multiple (walk_state,
operand[0], &type, &temp_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
@ -818,8 +825,10 @@ acpi_ex_opcode_1A_0T_1R (
/* Set Operand[0] to the value of the local/arg */ /* Set Operand[0] to the value of the local/arg */
status = acpi_ds_method_data_get_value (operand[0]->reference.opcode, status = acpi_ds_method_data_get_value (
operand[0]->reference.offset, walk_state, &temp_desc); operand[0]->reference.opcode,
operand[0]->reference.offset,
walk_state, &temp_desc);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
@ -852,21 +861,26 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
/* /*
* This is a deref_of (String). The string is a reference to a named ACPI object. * This is a deref_of (String). The string is a reference
* to a named ACPI object.
* *
* 1) Find the owning Node * 1) Find the owning Node
* 2) Dereference the node to an actual object. Could be a Field, so we nee * 2) Dereference the node to an actual object. Could be a
* to resolve the node to a value. * Field, so we need to resolve the node to a value.
*/ */
status = acpi_ns_get_node_by_path (operand[0]->string.pointer, status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT, walk_state->scope_info->scope.node,
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc)); ACPI_NS_SEARCH_PARENT,
ACPI_CAST_INDIRECT_PTR (
struct acpi_namespace_node, &return_desc));
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto cleanup; goto cleanup;
} }
status = acpi_ex_resolve_node_to_value ( status = acpi_ex_resolve_node_to_value (
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state); ACPI_CAST_INDIRECT_PTR (
struct acpi_namespace_node, &return_desc),
walk_state);
goto cleanup; goto cleanup;
@ -883,14 +897,16 @@ acpi_ex_opcode_1A_0T_1R (
/* /*
* This is a deref_of (object_reference) * This is a deref_of (object_reference)
* Get the actual object from the Node (This is the dereference). * Get the actual object from the Node (This is the dereference).
* -- This case may only happen when a local_x or arg_x is dereferenced above. * This case may only happen when a local_x or arg_x is
* dereferenced above.
*/ */
return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]); return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) operand[0]);
} }
else { else {
/* /*
* This must be a reference object produced by either the Index() or * This must be a reference object produced by either the
* ref_of() operator * Index() or ref_of() operator
*/ */
switch (operand[0]->reference.opcode) { switch (operand[0]->reference.opcode) {
case AML_INDEX_OP: case AML_INDEX_OP:
@ -931,8 +947,8 @@ acpi_ex_opcode_1A_0T_1R (
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
/* /*
* Return the referenced element of the package. We must add * Return the referenced element of the package. We must
* another reference to the referenced object, however. * add another reference to the referenced object, however.
*/ */
return_desc = *(operand[0]->reference.where); return_desc = *(operand[0]->reference.where);
if (!return_desc) { if (!return_desc) {
@ -967,9 +983,11 @@ acpi_ex_opcode_1A_0T_1R (
return_desc = operand[0]->reference.object; return_desc = operand[0]->reference.object;
if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) ==
ACPI_DESC_TYPE_NAMED) {
return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc); return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) return_desc);
} }
/* Add another reference to the object! */ /* Add another reference to the object! */

View File

@ -118,7 +118,7 @@ acpi_ex_opcode_2A_0T_0R (
value = (u32) operand[1]->integer.value; value = (u32) operand[1]->integer.value;
/* Notifies allowed on this object? */ /* Are notifies allowed on this object? */
if (!acpi_ev_is_notify_object (node)) { if (!acpi_ev_is_notify_object (node)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
@ -203,11 +203,12 @@ acpi_ex_opcode_2A_2T_1R (
acpi_ps_get_opcode_name (walk_state->opcode)); acpi_ps_get_opcode_name (walk_state->opcode));
/* /* Execute the opcode */
* Execute the opcode
*/
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, remainder_result quotient_result) */ case AML_DIVIDE_OP:
/* Divide (Dividend, Divisor, remainder_result quotient_result) */
return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER); return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
if (!return_desc1) { if (!return_desc1) {
@ -241,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
goto cleanup; goto cleanup;
} }
/* Store the results to the target reference operands */ /* Store the results to the target reference operands */
status = acpi_ex_store (return_desc2, operand[2], walk_state); status = acpi_ex_store (return_desc2, operand[2], walk_state);
@ -295,7 +295,7 @@ acpi_ex_opcode_2A_1T_1R (
{ {
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
u32 index; acpi_integer index;
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_size length; acpi_size length;
@ -304,9 +304,8 @@ acpi_ex_opcode_2A_1T_1R (
acpi_ps_get_opcode_name (walk_state->opcode)); acpi_ps_get_opcode_name (walk_state->opcode));
/* /* Execute the opcode */
* Execute the opcode
*/
if (walk_state->op_info->flags & AML_MATH) { if (walk_state->op_info->flags & AML_MATH) {
/* All simple math opcodes (add, etc.) */ /* All simple math opcodes (add, etc.) */
@ -322,7 +321,6 @@ acpi_ex_opcode_2A_1T_1R (
goto store_result_to_target; goto store_result_to_target;
} }
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */ case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
@ -352,7 +350,8 @@ acpi_ex_opcode_2A_1T_1R (
/* /*
* Input object is guaranteed to be a buffer at this point (it may have * Input object is guaranteed to be a buffer at this point (it may have
* been converted.) Copy the raw buffer data to a new object of type String. * been converted.) Copy the raw buffer data to a new object of
* type String.
*/ */
/* /*
@ -383,14 +382,16 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup; goto cleanup;
} }
/* Copy the raw buffer data with no transform. NULL terminated already. */ /* Copy the raw buffer data with no transform. NULL terminated already*/
ACPI_MEMCPY (return_desc->string.pointer, ACPI_MEMCPY (return_desc->string.pointer,
operand[0]->buffer.pointer, length); operand[0]->buffer.pointer, length);
break; break;
case AML_CONCAT_RES_OP: /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ case AML_CONCAT_RES_OP:
/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
status = acpi_ex_concat_template (operand[0], operand[1], status = acpi_ex_concat_template (operand[0], operand[1],
&return_desc, walk_state); &return_desc, walk_state);
@ -407,33 +408,33 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup; goto cleanup;
} }
index = (u32) operand[1]->integer.value; index = operand[1]->integer.value;
/* At this point, the Source operand is a Package, Buffer, or String */
/*
* At this point, the Source operand is a Package, Buffer, or String
*/
if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
/* Object to be indexed is a Package */ /* Object to be indexed is a Package */
if (index >= operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index value (%X) beyond package end (%X)\n", "Index value (%X%8.8X) beyond package end (%X)\n",
index, operand[0]->package.count)); ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
} }
return_desc->reference.target_type = ACPI_TYPE_PACKAGE; return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
return_desc->reference.object = operand[0]; return_desc->reference.object = operand[0];
return_desc->reference.where = &operand[0]->package.elements [index]; return_desc->reference.where = &operand[0]->package.elements [
index];
} }
else { else {
/* Object to be indexed is a Buffer/String */ /* Object to be indexed is a Buffer/String */
if (index >= operand[0]->buffer.length) { if (index >= operand[0]->buffer.length) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index value (%X) beyond end of buffer (%X)\n", "Index value (%X%8.8X) beyond end of buffer (%X)\n",
index, operand[0]->buffer.length)); ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT; status = AE_AML_BUFFER_LIMIT;
goto cleanup; goto cleanup;
} }
@ -451,7 +452,7 @@ acpi_ex_opcode_2A_1T_1R (
/* Complete the Index reference object */ /* Complete the Index reference object */
return_desc->reference.opcode = AML_INDEX_OP; return_desc->reference.opcode = AML_INDEX_OP;
return_desc->reference.offset = index; return_desc->reference.offset = (u32) index;
/* Store the reference to the Target */ /* Store the reference to the Target */
@ -536,22 +537,24 @@ acpi_ex_opcode_2A_0T_1R (
goto cleanup; goto cleanup;
} }
/* /* Execute the Opcode */
* Execute the Opcode
*/ if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) /* logical_op (Operand0, Operand1) */ { /* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_numeric_op (walk_state->opcode, status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
operand[0]->integer.value, operand[1]->integer.value, operand[0]->integer.value, operand[1]->integer.value,
&logical_result); &logical_result);
goto store_logical_result; goto store_logical_result;
} }
else if (walk_state->op_info->flags & AML_LOGICAL) /* logical_op (Operand0, Operand1) */ { else if (walk_state->op_info->flags & AML_LOGICAL) {
/* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_op (walk_state->opcode, operand[0], status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
operand[1], &logical_result); operand[1], &logical_result);
goto store_logical_result; goto store_logical_result;
} }
switch (walk_state->opcode) { switch (walk_state->opcode) {
case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */ case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */

View File

@ -97,7 +97,8 @@ acpi_ex_opcode_3A_0T_0R (
acpi_status status = AE_OK; 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) { switch (walk_state->opcode) {
@ -116,9 +117,8 @@ acpi_ex_opcode_3A_0T_0R (
fatal->argument = (u32) operand[2]->integer.value; fatal->argument = (u32) operand[2]->integer.value;
} }
/* /* Always signal the OS! */
* Always signal the OS!
*/
status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal); status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
/* Might return while OS is shutting down, just continue */ /* Might return while OS is shutting down, just continue */
@ -162,11 +162,12 @@ acpi_ex_opcode_3A_1T_1R (
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
char *buffer; char *buffer;
acpi_status status = AE_OK; acpi_status status = AE_OK;
acpi_native_uint index; acpi_integer index;
acpi_size length; 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) { switch (walk_state->opcode) {
@ -176,7 +177,8 @@ acpi_ex_opcode_3A_1T_1R (
* Create the return object. The Source operand is guaranteed to be * Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type. * 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) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
@ -184,7 +186,7 @@ acpi_ex_opcode_3A_1T_1R (
/* Get the Integer values from the objects */ /* 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; length = (acpi_size) operand[2]->integer.value;
/* /*
@ -197,7 +199,8 @@ acpi_ex_opcode_3A_1T_1R (
if ((index + length) > if ((index + length) >
operand[0]->string.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 */ /* Allocate a new buffer for the String/Buffer */

View File

@ -75,6 +75,14 @@
* fully resolved operands. * fully resolved operands.
!*/ !*/
/* Local prototypes */
static u8
acpi_ex_do_match (
u32 match_op,
union acpi_operand_object *package_obj,
union acpi_operand_object *match_obj);
/******************************************************************************* /*******************************************************************************
* *
@ -92,7 +100,7 @@
* *
******************************************************************************/ ******************************************************************************/
u8 static u8
acpi_ex_do_match ( acpi_ex_do_match (
u32 match_op, u32 match_op,
union acpi_operand_object *package_obj, union acpi_operand_object *package_obj,
@ -216,11 +224,12 @@ acpi_ex_opcode_6A_0T_1R (
union acpi_operand_object **operand = &walk_state->operands[0]; union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL; union acpi_operand_object *return_desc = NULL;
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 index; acpi_integer index;
union acpi_operand_object *this_element; union acpi_operand_object *this_element;
ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode)); ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
acpi_ps_get_opcode_name (walk_state->opcode));
switch (walk_state->opcode) { switch (walk_state->opcode) {
@ -241,9 +250,11 @@ acpi_ex_opcode_6A_0T_1R (
/* Get the package start_index, validate against the package length */ /* Get the package start_index, validate against the package length */
index = (u32) operand[5]->integer.value; index = operand[5]->integer.value;
if (index >= (u32) operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Index (%X%8.8X) beyond package end (%X)\n",
ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
} }
@ -314,13 +325,12 @@ acpi_ex_opcode_6A_0T_1R (
default: default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
walk_state->opcode)); walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
walk_state->result_obj = return_desc; walk_state->result_obj = return_desc;

View File

@ -52,8 +52,23 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exprep") ACPI_MODULE_NAME ("exprep")
/* Local prototypes */
static u32
acpi_ex_decode_field_access (
union acpi_operand_object *obj_desc,
u8 field_flags,
u32 *return_byte_alignment);
#ifdef ACPI_UNDER_DEVELOPMENT #ifdef ACPI_UNDER_DEVELOPMENT
static u32
acpi_ex_generate_access (
u32 field_bit_offset,
u32 field_bit_length,
u32 region_length);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_generate_access * FUNCTION: acpi_ex_generate_access
@ -99,12 +114,14 @@ acpi_ex_generate_access (
/* Round Field start offset and length to "minimal" byte boundaries */ /* Round Field start offset and length to "minimal" byte boundaries */
field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8)); field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length + field_bit_offset, 8)); field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length +
field_bit_offset, 8));
field_byte_length = field_byte_end_offset - field_byte_offset; field_byte_length = field_byte_end_offset - field_byte_offset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bit length %d, Bit offset %d\n", "Bit length %d, Bit offset %d\n",
field_bit_length, field_bit_offset)); field_bit_length, field_bit_offset));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Byte Length %d, Byte Offset %d, End Offset %d\n", "Byte Length %d, Byte Offset %d, End Offset %d\n",
field_byte_length, field_byte_offset, field_byte_end_offset)); field_byte_length, field_byte_offset, field_byte_end_offset));
@ -117,20 +134,26 @@ acpi_ex_generate_access (
*/ */
for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) { for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
/* /*
* 1) Round end offset up to next access boundary and make sure that this * 1) Round end offset up to next access boundary and make sure that
* does not go beyond the end of the parent region. * this does not go beyond the end of the parent region.
* 2) When the Access width is greater than the field_byte_length, we are done. * 2) When the Access width is greater than the field_byte_length, we
* (This does not optimize for the perfectly aligned case yet). * are done. (This does not optimize for the perfectly aligned
* case yet).
*/ */
if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) { if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
field_start_offset = ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) / field_start_offset =
ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
access_byte_width; access_byte_width;
field_end_offset = ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
field_end_offset =
ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
access_byte_width) / access_byte_width; access_byte_width) / access_byte_width;
accesses = field_end_offset - field_start_offset; accesses = field_end_offset - field_start_offset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"access_width %d end is within region\n", access_byte_width)); "access_width %d end is within region\n", access_byte_width));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field Start %d, Field End %d -- requires %d accesses\n", "Field Start %d, Field End %d -- requires %d accesses\n",
field_start_offset, field_end_offset, accesses)); field_start_offset, field_end_offset, accesses));
@ -159,11 +182,16 @@ acpi_ex_generate_access (
if (access_byte_width == 1) { if (access_byte_width == 1) {
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field goes beyond end-of-region!\n")); "Field goes beyond end-of-region!\n"));
return_VALUE (0); /* Field does not fit in the region at all */
/* Field does not fit in the region at all */
return_VALUE (0);
} }
/* This width goes beyond the end-of-region, back off to previous access */ /*
* This width goes beyond the end-of-region, back off to
* previous access
*/
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Backing off to previous optimal access width of %d\n", "Backing off to previous optimal access width of %d\n",
minimum_access_width)); minimum_access_width));
@ -171,8 +199,10 @@ acpi_ex_generate_access (
} }
} }
/* Could not read/write field with one operation, just use max access width */ /*
* Could not read/write field with one operation,
* just use max access width
*/
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Cannot access field in one operation, using width 8\n")); "Cannot access field in one operation, using width 8\n"));
return_VALUE (8); return_VALUE (8);
@ -184,8 +214,9 @@ acpi_ex_generate_access (
* *
* FUNCTION: acpi_ex_decode_field_access * FUNCTION: acpi_ex_decode_field_access
* *
* PARAMETERS: Access - Encoded field access bits * PARAMETERS: obj_desc - Field object
* Length - Field length. * field_flags - Encoded fieldflags (contains access bits)
* return_byte_alignment - Where the byte alignment is returned
* *
* RETURN: Field granularity (8, 16, 32 or 64) and * RETURN: Field granularity (8, 16, 32 or 64) and
* byte_alignment (1, 2, 3, or 4) * byte_alignment (1, 2, 3, or 4)
@ -214,9 +245,10 @@ acpi_ex_decode_field_access (
case AML_FIELD_ACCESS_ANY: case AML_FIELD_ACCESS_ANY:
#ifdef ACPI_UNDER_DEVELOPMENT #ifdef ACPI_UNDER_DEVELOPMENT
byte_alignment = acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset, byte_alignment =
acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length,
0xFFFFFFFF /* Temp until we pass region_length as param */); 0xFFFFFFFF /* Temp until we pass region_length as parameter */);
bit_length = byte_alignment * 8; bit_length = byte_alignment * 8;
#endif #endif
@ -276,6 +308,7 @@ acpi_ex_decode_field_access (
* field_flags - Access, lock_rule, and update_rule. * field_flags - Access, lock_rule, and update_rule.
* The format of a field_flag is described * The format of a field_flag is described
* in the ACPI specification * in the ACPI specification
* field_attribute - Special attributes (not used)
* field_bit_position - Field start position * field_bit_position - Field start position
* field_bit_length - Field length in number of bits * field_bit_length - Field length in number of bits
* *
@ -380,11 +413,7 @@ acpi_ex_prep_common_field_object (
* *
* FUNCTION: acpi_ex_prep_field_value * FUNCTION: acpi_ex_prep_field_value
* *
* PARAMETERS: Node - Owning Node * PARAMETERS: Info - Contains all field creation info
* region_node - Region in which field is being defined
* field_flags - Access, lock_rule, and update_rule.
* field_bit_position - Field start position
* field_bit_length - Field length in number of bits
* *
* RETURN: Status * RETURN: Status
* *
@ -461,8 +490,10 @@ acpi_ex_prep_field_value (
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
obj_desc->bank_field.value = info->bank_value; obj_desc->bank_field.value = info->bank_value;
obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (info->region_node); obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (info->register_node); info->region_node);
obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
info->register_node);
/* An additional reference for the attached objects */ /* An additional reference for the attached objects */
@ -481,10 +512,13 @@ acpi_ex_prep_field_value (
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
obj_desc->index_field.index_obj = acpi_ns_get_attached_object (info->register_node); obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (info->data_register_node); info->register_node);
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
info->data_register_node);
obj_desc->index_field.value = (u32) obj_desc->index_field.value = (u32)
(info->field_bit_position / ACPI_MUL_8 (obj_desc->field.access_byte_width)); (info->field_bit_position / ACPI_MUL_8 (
obj_desc->field.access_byte_width));
if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) { if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
ACPI_REPORT_ERROR (("Null Index Object during field prep\n")); ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));

View File

@ -115,7 +115,6 @@ acpi_ex_system_memory_space_handler (
return_ACPI_STATUS (AE_AML_OPERAND_VALUE); return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
} }
#ifndef ACPI_MISALIGNED_TRANSFERS #ifndef ACPI_MISALIGNED_TRANSFERS
/* /*
* Hardware does not support non-aligned data transfers, we must verify * Hardware does not support non-aligned data transfers, we must verify
@ -134,7 +133,8 @@ acpi_ex_system_memory_space_handler (
*/ */
if ((address < mem_info->mapped_physical_address) || if ((address < mem_info->mapped_physical_address) ||
(((acpi_integer) address + length) > (((acpi_integer) address + length) >
((acpi_integer) mem_info->mapped_physical_address + mem_info->mapped_length))) { ((acpi_integer)
mem_info->mapped_physical_address + mem_info->mapped_length))) {
/* /*
* The request cannot be resolved by the current memory mapping; * The request cannot be resolved by the current memory mapping;
* Delete the existing mapping and create a new one. * Delete the existing mapping and create a new one.
@ -150,7 +150,9 @@ acpi_ex_system_memory_space_handler (
* Don't attempt to map memory beyond the end of the region, and * Don't attempt to map memory beyond the end of the region, and
* constrain the maximum mapping size to something reasonable. * constrain the maximum mapping size to something reasonable.
*/ */
window_size = (acpi_size) ((mem_info->address + mem_info->length) - address); window_size = (acpi_size)
((mem_info->address + mem_info->length) - address);
if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) { if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE; window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
} }
@ -160,7 +162,8 @@ acpi_ex_system_memory_space_handler (
status = acpi_os_map_memory (address, window_size, status = acpi_os_map_memory (address, window_size,
(void **) &mem_info->mapped_logical_address); (void **) &mem_info->mapped_logical_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not map memory at %8.8X%8.8X, size %X\n",
ACPI_FORMAT_UINT64 (address), (u32) window_size)); ACPI_FORMAT_UINT64 (address), (u32) window_size));
mem_info->mapped_length = 0; mem_info->mapped_length = 0;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
@ -177,10 +180,12 @@ acpi_ex_system_memory_space_handler (
* access * access
*/ */
logical_addr_ptr = mem_info->mapped_logical_address + logical_addr_ptr = mem_info->mapped_logical_address +
((acpi_integer) address - (acpi_integer) mem_info->mapped_physical_address); ((acpi_integer) address -
(acpi_integer) mem_info->mapped_physical_address);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"system_memory %d (%d width) Address=%8.8X%8.8X\n", function, bit_width, "system_memory %d (%d width) Address=%8.8X%8.8X\n",
function, bit_width,
ACPI_FORMAT_UINT64 (address))); ACPI_FORMAT_UINT64 (address)));
/* /*
@ -298,13 +303,15 @@ acpi_ex_system_io_space_handler (
switch (function) { switch (function) {
case ACPI_READ: case ACPI_READ:
status = acpi_os_read_port ((acpi_io_address) address, &value32, bit_width); status = acpi_os_read_port ((acpi_io_address) address,
&value32, bit_width);
*value = value32; *value = value32;
break; break;
case ACPI_WRITE: case ACPI_WRITE:
status = acpi_os_write_port ((acpi_io_address) address, (u32) *value, bit_width); status = acpi_os_write_port ((acpi_io_address) address,
(u32) *value, bit_width);
break; break;
default: default:
@ -375,12 +382,14 @@ acpi_ex_pci_config_space_handler (
case ACPI_READ: case ACPI_READ:
*value = 0; *value = 0;
status = acpi_os_read_pci_configuration (pci_id, pci_register, value, bit_width); status = acpi_os_read_pci_configuration (pci_id, pci_register,
value, bit_width);
break; break;
case ACPI_WRITE: case ACPI_WRITE:
status = acpi_os_write_pci_configuration (pci_id, pci_register, *value, bit_width); status = acpi_os_write_pci_configuration (pci_id, pci_register,
*value, bit_width);
break; break;
default: default:
@ -505,7 +514,6 @@ acpi_ex_data_table_space_handler (
logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address); logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
/* Perform the memory read or write */ /* Perform the memory read or write */
switch (function) { switch (function) {

View File

@ -210,15 +210,15 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read Node=%p source_desc=%p Type=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"field_read Node=%p source_desc=%p Type=%X\n",
node, source_desc, entry_type)); node, source_desc, entry_type));
status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc); status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
break; break;
/* /* For these objects, just return the object attached to the Node */
* For these objects, just return the object attached to the Node
*/
case ACPI_TYPE_MUTEX: case ACPI_TYPE_MUTEX:
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER: case ACPI_TYPE_POWER:
@ -233,12 +233,12 @@ acpi_ex_resolve_node_to_value (
acpi_ut_add_reference (obj_desc); acpi_ut_add_reference (obj_desc);
break; break;
/* TYPE_ANY is untyped, and thus there is no object associated with it */ /* TYPE_ANY is untyped, and thus there is no object associated with it */
case ACPI_TYPE_ANY: case ACPI_TYPE_ANY:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Untyped entry %p, no attached object!\n",
node)); node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
@ -259,7 +259,8 @@ acpi_ex_resolve_node_to_value (
default: default:
/* No named references are allowed here */ /* No named references are allowed here */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unsupported Reference opcode %X (%s)\n",
source_desc->reference.opcode, source_desc->reference.opcode,
acpi_ps_get_opcode_name (source_desc->reference.opcode))); acpi_ps_get_opcode_name (source_desc->reference.opcode)));
@ -268,11 +269,12 @@ acpi_ex_resolve_node_to_value (
break; break;
/* Default case is for unknown types */
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n", /* Default case is for unknown types */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Node %p - Unknown object type %X\n",
node, entry_type)); node, entry_type));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@ -280,7 +282,7 @@ acpi_ex_resolve_node_to_value (
} /* switch (entry_type) */ } /* switch (entry_type) */
/* Put the object descriptor on the stack */ /* Return the object descriptor */
*object_ptr = (void *) obj_desc; *object_ptr = (void *) obj_desc;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);

View File

@ -54,6 +54,13 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exresolv") ACPI_MODULE_NAME ("exresolv")
/* Local prototypes */
static acpi_status
acpi_ex_resolve_object_to_value (
union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
/******************************************************************************* /*******************************************************************************
* *
@ -96,6 +103,11 @@ acpi_ex_resolve_to_value (
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (!*stack_ptr) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
} }
/* /*
@ -120,8 +132,7 @@ acpi_ex_resolve_to_value (
* *
* FUNCTION: acpi_ex_resolve_object_to_value * FUNCTION: acpi_ex_resolve_object_to_value
* *
* PARAMETERS: stack_ptr - Pointer to a stack location that contains a * PARAMETERS: stack_ptr - Pointer to an internal object
* ptr to an internal object.
* walk_state - Current method state * walk_state - Current method state
* *
* RETURN: Status * RETURN: Status
@ -131,7 +142,7 @@ acpi_ex_resolve_to_value (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_resolve_object_to_value ( acpi_ex_resolve_object_to_value (
union acpi_operand_object **stack_ptr, union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state)
@ -159,7 +170,7 @@ acpi_ex_resolve_object_to_value (
case AML_NAME_OP: case AML_NAME_OP:
/* /*
* Convert indirect name ptr to a direct name ptr. * Convert name reference to a namespace node
* Then, acpi_ex_resolve_node_to_value can be used to get the value * Then, acpi_ex_resolve_node_to_value can be used to get the value
*/ */
temp_node = stack_desc->reference.object; temp_node = stack_desc->reference.object;
@ -168,7 +179,7 @@ acpi_ex_resolve_object_to_value (
acpi_ut_remove_reference (stack_desc); acpi_ut_remove_reference (stack_desc);
/* Put direct name pointer onto stack and exit */ /* Return the namespace node */
(*stack_ptr) = temp_node; (*stack_ptr) = temp_node;
break; break;
@ -255,10 +266,19 @@ acpi_ex_resolve_object_to_value (
break; break;
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
/* Get the object pointed to by the namespace node */
*stack_ptr = (stack_desc->reference.node)->object;
acpi_ut_add_reference (*stack_ptr);
acpi_ut_remove_reference (stack_desc);
break;
default: default:
ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n", ACPI_REPORT_ERROR ((
"During resolve, Unknown Reference opcode %X (%s) in %p\n",
opcode, acpi_ps_get_opcode_name (opcode), stack_desc)); opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
@ -278,9 +298,8 @@ acpi_ex_resolve_object_to_value (
break; break;
/* /* These cases may never happen here, but just in case.. */
* These cases may never happen here, but just in case..
*/
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
@ -333,9 +352,8 @@ acpi_ex_resolve_multiple (
ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple"); ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple");
/* /* Operand can be either a namespace node or an operand descriptor */
* Operand can be either a namespace node or an operand descriptor
*/
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
type = obj_desc->common.type; type = obj_desc->common.type;
@ -357,10 +375,8 @@ acpi_ex_resolve_multiple (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
/* If type is anything other than a reference, we are done */
/*
* If type is anything other than a reference, we are done
*/
if (type != ACPI_TYPE_LOCAL_REFERENCE) { if (type != ACPI_TYPE_LOCAL_REFERENCE) {
goto exit; goto exit;
} }
@ -382,7 +398,8 @@ acpi_ex_resolve_multiple (
/* All "References" point to a NS node */ /* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", ACPI_REPORT_ERROR ((
"acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
node, acpi_ut_get_descriptor_name (node))); node, acpi_ut_get_descriptor_name (node)));
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
@ -440,7 +457,8 @@ acpi_ex_resolve_multiple (
/* All "References" point to a NS node */ /* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", ACPI_REPORT_ERROR ((
"acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
node, acpi_ut_get_descriptor_name (node))); node, acpi_ut_get_descriptor_name (node)));
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
@ -500,7 +518,8 @@ acpi_ex_resolve_multiple (
default: default:
ACPI_REPORT_ERROR (("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", ACPI_REPORT_ERROR ((
"acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
obj_desc->reference.opcode)); obj_desc->reference.opcode));
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }

View File

@ -52,6 +52,14 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exresop") ACPI_MODULE_NAME ("exresop")
/* Local prototypes */
static acpi_status
acpi_ex_check_object_type (
acpi_object_type type_needed,
acpi_object_type this_type,
void *object);
/******************************************************************************* /*******************************************************************************
* *
@ -67,7 +75,7 @@
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_check_object_type ( acpi_ex_check_object_type (
acpi_object_type type_needed, acpi_object_type type_needed,
acpi_object_type this_type, acpi_object_type this_type,
@ -142,6 +150,7 @@ acpi_ex_resolve_operands (
const struct acpi_opcode_info *op_info; const struct acpi_opcode_info *op_info;
u32 this_arg_type; u32 this_arg_type;
acpi_object_type type_needed; acpi_object_type type_needed;
u16 target_op = 0;
ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode); ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode);
@ -160,7 +169,8 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (AE_AML_INTERNAL); return_ACPI_STATUS (AE_AML_INTERNAL);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] required_operand_types=%8.8X \n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Opcode %X [%s] required_operand_types=%8.8X \n",
opcode, op_info->name, arg_types)); opcode, op_info->name, arg_types));
/* /*
@ -187,7 +197,7 @@ acpi_ex_resolve_operands (
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) { switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
case ACPI_DESC_TYPE_NAMED: case ACPI_DESC_TYPE_NAMED:
/* Node */ /* Namespace Node */
object_type = ((struct acpi_namespace_node *) obj_desc)->type; object_type = ((struct acpi_namespace_node *) obj_desc)->type;
break; break;
@ -202,16 +212,16 @@ acpi_ex_resolve_operands (
/* Check for bad acpi_object_type */ /* Check for bad acpi_object_type */
if (!acpi_ut_valid_object_type (object_type)) { if (!acpi_ut_valid_object_type (object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Bad operand object type [%X]\n",
object_type)); object_type));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
/* /* Decode the Reference */
* Decode the Reference
*/
op_info = acpi_ps_get_opcode_info (opcode); op_info = acpi_ps_get_opcode_info (opcode);
if (op_info->class == AML_CLASS_UNKNOWN) { if (op_info->class == AML_CLASS_UNKNOWN) {
return_ACPI_STATUS (AE_AML_BAD_OPCODE); return_ACPI_STATUS (AE_AML_BAD_OPCODE);
@ -219,12 +229,17 @@ acpi_ex_resolve_operands (
switch (obj_desc->reference.opcode) { switch (obj_desc->reference.opcode) {
case AML_DEBUG_OP: case AML_DEBUG_OP:
target_op = AML_DEBUG_OP;
/*lint -fallthrough */
case AML_NAME_OP: case AML_NAME_OP:
case AML_INDEX_OP: case AML_INDEX_OP:
case AML_REF_OF_OP: case AML_REF_OF_OP:
case AML_ARG_OP: case AML_ARG_OP:
case AML_LOCAL_OP: case AML_LOCAL_OP:
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, ref_opcode [%s]\n", "Operand is a Reference, ref_opcode [%s]\n",
@ -254,10 +269,8 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
} }
/* Get one argument type, point to the next */
/*
* Get one argument type, point to the next
*/
this_arg_type = GET_CURRENT_ARG_TYPE (arg_types); this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
INCREMENT_ARG_LIST (arg_types); INCREMENT_ARG_LIST (arg_types);
@ -271,13 +284,16 @@ acpi_ex_resolve_operands (
if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) && if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) { (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
/* /*
* String found - the string references a named object and must be * String found - the string references a named object and
* resolved to a node * must be resolved to a node
*/ */
goto next_operand; goto next_operand;
} }
/* Else not a string - fall through to the normal Reference case below */ /*
* Else not a string - fall through to the normal Reference
* case below
*/
/*lint -fallthrough */ /*lint -fallthrough */
case ARGI_REFERENCE: /* References: */ case ARGI_REFERENCE: /* References: */
@ -288,9 +304,11 @@ acpi_ex_resolve_operands (
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
/* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */ /*
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */ { * A Namespace Node is OK as-is
*/
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
goto next_operand; goto next_operand;
} }
@ -300,11 +318,9 @@ acpi_ex_resolve_operands (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (AML_NAME_OP == obj_desc->reference.opcode) { if (obj_desc->reference.opcode == AML_NAME_OP) {
/* /* Convert a named reference to the actual named object */
* Convert an indirect name ptr to direct name ptr and put
* it on the stack
*/
temp_node = obj_desc->reference.object; temp_node = obj_desc->reference.object;
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
(*stack_ptr) = temp_node; (*stack_ptr) = temp_node;
@ -332,7 +348,6 @@ acpi_ex_resolve_operands (
break; break;
} }
/* /*
* Resolve this object to a value * Resolve this object to a value
*/ */
@ -392,7 +407,7 @@ acpi_ex_resolve_operands (
/* /*
* The more complex cases allow multiple resolved object types * The more complex cases allow multiple resolved object types
*/ */
case ARGI_INTEGER: /* Number */ case ARGI_INTEGER:
/* /*
* Need an operand of type ACPI_TYPE_INTEGER, * Need an operand of type ACPI_TYPE_INTEGER,
@ -563,7 +578,7 @@ acpi_ex_resolve_operands (
case ARGI_REGION_OR_FIELD: case ARGI_REGION_OR_FIELD:
/* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */ /* Need an operand of type REGION or a FIELD in a region */
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_REGION: case ACPI_TYPE_REGION:
@ -614,6 +629,12 @@ acpi_ex_resolve_operands (
break; break;
} }
if (target_op == AML_DEBUG_OP) {
/* Allow store of any object to the Debug object */
break;
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc)); acpi_ut_get_object_type_name (obj_desc), obj_desc));
@ -652,8 +673,7 @@ next_operand:
if (GET_CURRENT_ARG_TYPE (arg_types)) { if (GET_CURRENT_ARG_TYPE (arg_types)) {
stack_ptr--; stack_ptr--;
} }
}
} /* while (*Types) */
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }

View File

@ -48,11 +48,171 @@
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exstore") ACPI_MODULE_NAME ("exstore")
/* Local prototypes */
static void
acpi_ex_do_debug_object (
union acpi_operand_object *source_desc,
u32 level,
u32 index);
static acpi_status
acpi_ex_store_object_to_index (
union acpi_operand_object *val_desc,
union acpi_operand_object *dest_desc,
struct acpi_walk_state *walk_state);
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_debug_object
*
* PARAMETERS: source_desc - Value to be stored
* Level - Indentation level (used for packages)
* Index - Current package element, zero if not pkg
*
* RETURN: None
*
* DESCRIPTION: Handles stores to the Debug Object.
*
******************************************************************************/
static void
acpi_ex_do_debug_object (
union acpi_operand_object *source_desc,
u32 level,
u32 index)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
level, " "));
/* Display index for package output only */
if (index > 0) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
"(%.2u) ", index -1));
}
if (!source_desc) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
acpi_ut_get_object_type_name (source_desc)));
if (!acpi_ut_valid_internal_object (source_desc)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
"%p, Invalid Internal Object!\n", source_desc));
return_VOID;
}
}
else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
source_desc));
return_VOID;
}
else {
return_VOID;
}
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER:
/* Output correct integer width */
if (acpi_gbl_integer_byte_width == 4) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
(u32) source_desc->integer.value));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (source_desc->integer.value)));
}
break;
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
(u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
break;
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
source_desc->string.length, source_desc->string.pointer));
break;
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
source_desc->package.count));
/* Output the entire contents of the package */
for (i = 0; i < source_desc->package.count; i++) {
acpi_ex_do_debug_object (source_desc->package.elements[i],
level+4, i+1);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
if (source_desc->reference.opcode == AML_INDEX_OP) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
acpi_ps_get_opcode_name (source_desc->reference.opcode),
source_desc->reference.offset));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
}
if (source_desc->reference.object) {
if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
ACPI_DESC_TYPE_NAMED) {
acpi_ex_do_debug_object (((struct acpi_namespace_node *)
source_desc->reference.object)->object,
level+4, 0);
}
else {
acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
}
}
else if (source_desc->reference.node) {
acpi_ex_do_debug_object ((source_desc->reference.node)->object,
level+4, 0);
}
break;
default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
source_desc, acpi_ut_get_object_type_name (source_desc)));
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
return_VOID;
}
/******************************************************************************* /*******************************************************************************
* *
@ -154,7 +314,8 @@ acpi_ex_store (
/* Storing an object into a Name "container" */ /* Storing an object into a Name "container" */
status = acpi_ex_store_object_to_node (source_desc, ref_desc->reference.object, status = acpi_ex_store_object_to_node (source_desc,
ref_desc->reference.object,
walk_state, ACPI_IMPLICIT_CONVERSION); walk_state, ACPI_IMPLICIT_CONVERSION);
break; break;
@ -187,60 +348,7 @@ acpi_ex_store (
"**** Write to Debug Object: Object %p %s ****:\n\n", "**** Write to Debug Object: Object %p %s ****:\n\n",
source_desc, acpi_ut_get_object_type_name (source_desc))); source_desc, acpi_ut_get_object_type_name (source_desc)));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", acpi_ex_do_debug_object (source_desc, 0, 0);
acpi_ut_get_object_type_name (source_desc)));
if (!acpi_ut_valid_internal_object (source_desc)) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
"%p, Invalid Internal Object!\n", source_desc));
break;
}
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
case ACPI_TYPE_INTEGER:
if (acpi_gbl_integer_byte_width == 4) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
(u32) source_desc->integer.value));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (source_desc->integer.value)));
}
break;
case ACPI_TYPE_BUFFER:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
(u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
break;
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
source_desc->string.length, source_desc->string.pointer));
break;
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
source_desc->package.count, source_desc->package.elements));
break;
default:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
source_desc));
break;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
break; break;
@ -272,7 +380,7 @@ acpi_ex_store (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ex_store_object_to_index ( acpi_ex_store_object_to_index (
union acpi_operand_object *source_desc, union acpi_operand_object *source_desc,
union acpi_operand_object *index_desc, union acpi_operand_object *index_desc,
@ -313,16 +421,22 @@ acpi_ex_store_object_to_index (
if (obj_desc) { if (obj_desc) {
/* Decrement reference count by the ref count of the parent package */ /* Decrement reference count by the ref count of the parent package */
for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { for (i = 0;
i < ((union acpi_operand_object *)
index_desc->reference.object)->common.reference_count;
i++) {
acpi_ut_remove_reference (obj_desc); acpi_ut_remove_reference (obj_desc);
} }
} }
*(index_desc->reference.where) = new_desc; *(index_desc->reference.where) = new_desc;
/* Increment reference count by the ref count of the parent package -1 */ /* Increment ref count by the ref count of the parent package-1 */
for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) { for (i = 1;
i < ((union acpi_operand_object *)
index_desc->reference.object)->common.reference_count;
i++) {
acpi_ut_add_reference (new_desc); acpi_ut_add_reference (new_desc);
} }
@ -440,9 +554,8 @@ acpi_ex_store_object_to_node (
ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc); ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
/* /* Get current type of the node, and object attached to Node */
* Get current type of the node, and object attached to Node
*/
target_type = acpi_ns_get_type (node); target_type = acpi_ns_get_type (node);
target_desc = acpi_ns_get_attached_object (node); target_desc = acpi_ns_get_attached_object (node);
@ -467,19 +580,18 @@ acpi_ex_store_object_to_node (
target_type = ACPI_TYPE_ANY; target_type = ACPI_TYPE_ANY;
} }
/* /* Do the actual store operation */
* Do the actual store operation
*/
switch (target_type) { switch (target_type) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* /* For fields, copy the source data to the target field. */
* For fields, copy the source data to the target field.
*/ status = acpi_ex_write_data_to_field (source_desc, target_desc,
status = acpi_ex_write_data_to_field (source_desc, target_desc, &walk_state->result_obj); &walk_state->result_obj);
break; break;
@ -493,7 +605,8 @@ acpi_ex_store_object_to_node (
* *
* Copy and/or convert the source object to a new target object * Copy and/or convert the source object to a new target object
*/ */
status = acpi_ex_store_object_to_object (source_desc, target_desc, &new_desc, walk_state); status = acpi_ex_store_object_to_object (source_desc, target_desc,
&new_desc, walk_state);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -526,7 +639,8 @@ acpi_ex_store_object_to_node (
/* No conversions for all other types. Just attach the source object */ /* No conversions for all other types. Just attach the source object */
status = acpi_ns_attach_object (node, source_desc, ACPI_GET_OBJECT_TYPE (source_desc)); status = acpi_ns_attach_object (node, source_desc,
ACPI_GET_OBJECT_TYPE (source_desc));
break; break;
} }

View File

@ -81,9 +81,8 @@ acpi_ex_resolve_object (
ACPI_FUNCTION_TRACE ("ex_resolve_object"); ACPI_FUNCTION_TRACE ("ex_resolve_object");
/* /* Ensure we have a Target that can be stored to */
* Ensure we have a Target that can be stored to
*/
switch (target_type) { switch (target_type) {
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD: case ACPI_TYPE_LOCAL_REGION_FIELD:
@ -118,16 +117,14 @@ acpi_ex_resolve_object (
break; break;
} }
/* /* Must have a Integer, Buffer, or String */
* Must have a Integer, Buffer, or String
*/
if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) && if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) && (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) && (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) { !((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
/* /* Conversion successful but still not a valid type */
* Conversion successful but still not a valid type
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Cannot assign type %s to %s (must be type Int/Str/Buf)\n", "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
acpi_ut_get_object_type_name (source_desc), acpi_ut_get_object_type_name (source_desc),
@ -140,9 +137,8 @@ acpi_ex_resolve_object (
case ACPI_TYPE_LOCAL_ALIAS: case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS: case ACPI_TYPE_LOCAL_METHOD_ALIAS:
/* /* Aliases are resolved by acpi_ex_prep_operands */
* Aliases are resolved by acpi_ex_prep_operands
*/
ACPI_REPORT_ERROR (("Store into Alias - should never happen\n")); ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;

View File

@ -128,7 +128,8 @@ acpi_ex_store_buffer_to_buffer (
else { else {
/* Truncate the source, copy only what will fit */ /* Truncate the source, copy only what will fit */
ACPI_MEMCPY (target_desc->buffer.pointer, buffer, target_desc->buffer.length); ACPI_MEMCPY (target_desc->buffer.pointer, buffer,
target_desc->buffer.length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Truncating source buffer from %X to %X\n", "Truncating source buffer from %X to %X\n",
@ -183,7 +184,8 @@ acpi_ex_store_string_to_string (
* String will fit in existing non-static buffer. * String will fit in existing non-static buffer.
* Clear old string and copy in the new one * Clear old string and copy in the new one
*/ */
ACPI_MEMSET (target_desc->string.pointer, 0, (acpi_size) target_desc->string.length + 1); ACPI_MEMSET (target_desc->string.pointer, 0,
(acpi_size) target_desc->string.length + 1);
ACPI_MEMCPY (target_desc->string.pointer, buffer, length); ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
} }
else { else {
@ -198,7 +200,8 @@ acpi_ex_store_string_to_string (
ACPI_MEM_FREE (target_desc->string.pointer); ACPI_MEM_FREE (target_desc->string.pointer);
} }
target_desc->string.pointer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1); target_desc->string.pointer = ACPI_MEM_CALLOCATE (
(acpi_size) length + 1);
if (!target_desc->string.pointer) { if (!target_desc->string.pointer) {
return_ACPI_STATUS (AE_NO_MEMORY); return_ACPI_STATUS (AE_NO_MEMORY);
} }

View File

@ -55,7 +55,7 @@
* *
* FUNCTION: acpi_ex_system_wait_semaphore * FUNCTION: acpi_ex_system_wait_semaphore
* *
* PARAMETERS: Semaphore - OSD semaphore to wait on * PARAMETERS: Semaphore - Semaphore to wait on
* Timeout - Max time to wait * Timeout - Max time to wait
* *
* RETURN: Status * RETURN: Status
@ -90,7 +90,8 @@ acpi_ex_system_wait_semaphore (
status = acpi_os_wait_semaphore (semaphore, 1, timeout); status = acpi_os_wait_semaphore (semaphore, 1, timeout);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"*** Thread awake after blocking, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
/* Reacquire the interpreter */ /* Reacquire the interpreter */
@ -141,7 +142,8 @@ acpi_ex_system_do_stall (
* (ACPI specifies 100 usec as max, but this gives some slack in * (ACPI specifies 100 usec as max, but this gives some slack in
* order to support existing BIOSs) * order to support existing BIOSs)
*/ */
ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", how_long)); ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
how_long));
status = AE_AML_OPERAND_VALUE; status = AE_AML_OPERAND_VALUE;
} }
else { else {
@ -192,8 +194,8 @@ acpi_ex_system_do_suspend (
* *
* FUNCTION: acpi_ex_system_acquire_mutex * FUNCTION: acpi_ex_system_acquire_mutex
* *
* PARAMETERS: *time_desc - The 'time to delay' object descriptor * PARAMETERS: time_desc - The 'time to delay' object descriptor
* *obj_desc - The object descriptor for this op * obj_desc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
* *
@ -218,9 +220,8 @@ acpi_ex_system_acquire_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
/* /* Support for the _GL_ Mutex object -- go get the global lock */
* Support for the _GL_ Mutex object -- go get the global lock
*/
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value); status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
@ -236,7 +237,7 @@ acpi_ex_system_acquire_mutex (
* *
* FUNCTION: acpi_ex_system_release_mutex * FUNCTION: acpi_ex_system_release_mutex
* *
* PARAMETERS: *obj_desc - The object descriptor for this op * PARAMETERS: obj_desc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
* *
@ -261,9 +262,8 @@ acpi_ex_system_release_mutex (
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
/* /* Support for the _GL_ Mutex object -- release the global lock */
* Support for the _GL_ Mutex object -- release the global lock
*/
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) { if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
status = acpi_ev_release_global_lock (); status = acpi_ev_release_global_lock ();
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
@ -278,9 +278,9 @@ acpi_ex_system_release_mutex (
* *
* FUNCTION: acpi_ex_system_signal_event * FUNCTION: acpi_ex_system_signal_event
* *
* PARAMETERS: *obj_desc - The object descriptor for this op * PARAMETERS: obj_desc - The object descriptor for this op
* *
* RETURN: AE_OK * RETURN: Status
* *
* DESCRIPTION: Provides an access point to perform synchronization operations * DESCRIPTION: Provides an access point to perform synchronization operations
* within the AML. * within the AML.
@ -309,8 +309,8 @@ acpi_ex_system_signal_event (
* *
* FUNCTION: acpi_ex_system_wait_event * FUNCTION: acpi_ex_system_wait_event
* *
* PARAMETERS: *time_desc - The 'time to delay' object descriptor * PARAMETERS: time_desc - The 'time to delay' object descriptor
* *obj_desc - The object descriptor for this op * obj_desc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
* *
@ -344,7 +344,7 @@ acpi_ex_system_wait_event (
* *
* FUNCTION: acpi_ex_system_reset_event * FUNCTION: acpi_ex_system_reset_event
* *
* PARAMETERS: *obj_desc - The object descriptor for this op * PARAMETERS: obj_desc - The object descriptor for this op
* *
* RETURN: Status * RETURN: Status
* *

View File

@ -67,22 +67,31 @@
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exutils") ACPI_MODULE_NAME ("exutils")
/* Local prototypes */
static u32
acpi_ex_digits_needed (
acpi_integer value,
u32 base);
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_enter_interpreter * FUNCTION: acpi_ex_enter_interpreter
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: Status
*
* DESCRIPTION: Enter the interpreter execution region. Failure to enter * DESCRIPTION: Enter the interpreter execution region. Failure to enter
* the interpreter region is a fatal system error * the interpreter region is a fatal system error
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ex_enter_interpreter (void) acpi_ex_enter_interpreter (
void)
{ {
acpi_status status; acpi_status status;
@ -104,6 +113,8 @@ acpi_ex_enter_interpreter (void)
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: None
*
* DESCRIPTION: Exit the interpreter execution region * DESCRIPTION: Exit the interpreter execution region
* *
* Cases where the interpreter is unlocked: * Cases where the interpreter is unlocked:
@ -119,7 +130,8 @@ acpi_ex_enter_interpreter (void)
******************************************************************************/ ******************************************************************************/
void void
acpi_ex_exit_interpreter (void) acpi_ex_exit_interpreter (
void)
{ {
acpi_status status; acpi_status status;
@ -212,7 +224,8 @@ acpi_ex_acquire_global_lock (
locked = TRUE; locked = TRUE;
} }
else { else {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Could not acquire Global Lock, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
} }
} }
@ -228,7 +241,7 @@ acpi_ex_acquire_global_lock (
* PARAMETERS: locked_by_me - Return value from corresponding call to * PARAMETERS: locked_by_me - Return value from corresponding call to
* acquire_global_lock. * acquire_global_lock.
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Release the global lock if it is locked. * DESCRIPTION: Release the global lock if it is locked.
* *
@ -269,11 +282,14 @@ acpi_ex_release_global_lock (
* PARAMETERS: Value - Value to be represented * PARAMETERS: Value - Value to be represented
* Base - Base of representation * Base - Base of representation
* *
* RETURN: the number of digits needed to represent Value in Base * RETURN: The number of digits.
*
* DESCRIPTION: Calculate the number of digits needed to represent the Value
* in the given Base (Radix)
* *
******************************************************************************/ ******************************************************************************/
u32 static u32
acpi_ex_digits_needed ( acpi_ex_digits_needed (
acpi_integer value, acpi_integer value,
u32 base) u32 base)
@ -312,6 +328,8 @@ acpi_ex_digits_needed (
* PARAMETERS: numeric_id - EISA ID to be converted * PARAMETERS: numeric_id - EISA ID to be converted
* out_string - Where to put the converted string (8 bytes) * out_string - Where to put the converted string (8 bytes)
* *
* RETURN: None
*
* DESCRIPTION: Convert a numeric EISA ID to string representation * DESCRIPTION: Convert a numeric EISA ID to string representation
* *
******************************************************************************/ ******************************************************************************/
@ -349,7 +367,10 @@ acpi_ex_eisa_id_to_string (
* PARAMETERS: Value - Value to be converted * PARAMETERS: Value - Value to be converted
* out_string - Where to put the converted string (8 bytes) * out_string - Where to put the converted string (8 bytes)
* *
* RETURN: Convert a number to string representation * RETURN: None, string
*
* DESCRIPTOIN: Convert a number to string representation. Assumes string
* buffer is large enough to hold the string.
* *
******************************************************************************/ ******************************************************************************/

360
drivers/acpi/glue.c Normal file
View File

@ -0,0 +1,360 @@
/*
* Link physical devices with ACPI devices support
*
* Copyright (c) 2005 David Shaohua Li <shaohua.li@intel.com>
* Copyright (c) 2005 Intel Corp.
*
* This file is released under the GPLv2.
*/
#include <linux/init.h>
#include <linux/list.h>
#include <linux/device.h>
#include <linux/rwsem.h>
#include <linux/acpi.h>
#define ACPI_GLUE_DEBUG 0
#if ACPI_GLUE_DEBUG
#define DBG(x...) printk(PREFIX x)
#else
#define DBG(x...)
#endif
static LIST_HEAD(bus_type_list);
static DECLARE_RWSEM(bus_type_sem);
int register_acpi_bus_type(struct acpi_bus_type *type)
{
if (acpi_disabled)
return -ENODEV;
if (type && type->bus && type->find_device) {
down_write(&bus_type_sem);
list_add_tail(&type->list, &bus_type_list);
up_write(&bus_type_sem);
printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name);
return 0;
}
return -ENODEV;
}
EXPORT_SYMBOL(register_acpi_bus_type);
int unregister_acpi_bus_type(struct acpi_bus_type *type)
{
if (acpi_disabled)
return 0;
if (type) {
down_write(&bus_type_sem);
list_del_init(&type->list);
up_write(&bus_type_sem);
printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name);
return 0;
}
return -ENODEV;
}
EXPORT_SYMBOL(unregister_acpi_bus_type);
static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type)
{
struct acpi_bus_type *tmp, *ret = NULL;
down_read(&bus_type_sem);
list_for_each_entry(tmp, &bus_type_list, list) {
if (tmp->bus == type) {
ret = tmp;
break;
}
}
up_read(&bus_type_sem);
return ret;
}
static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle)
{
struct acpi_bus_type *tmp;
int ret = -ENODEV;
down_read(&bus_type_sem);
list_for_each_entry(tmp, &bus_type_list, list) {
if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) {
ret = 0;
break;
}
}
up_read(&bus_type_sem);
return ret;
}
/* Get PCI root bridge's handle from its segment and bus number */
struct acpi_find_pci_root {
unsigned int seg;
unsigned int bus;
acpi_handle handle;
};
static acpi_status
do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
{
int *busnr = (int *)data;
struct acpi_resource_address64 address;
if (resource->id != ACPI_RSTYPE_ADDRESS16 &&
resource->id != ACPI_RSTYPE_ADDRESS32 &&
resource->id != ACPI_RSTYPE_ADDRESS64)
return AE_OK;
acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE))
*busnr = address.min_address_range;
return AE_OK;
}
static int get_root_bridge_busnr(acpi_handle handle)
{
acpi_status status;
int bus, bbn;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL,
(unsigned long *)&bbn);
if (status == AE_NOT_FOUND) {
/* Assume bus = 0 */
printk(KERN_INFO PREFIX
"Assume root bridge [%s] bus is 0\n",
(char *)buffer.pointer);
status = AE_OK;
bbn = 0;
}
if (ACPI_FAILURE(status)) {
bbn = -ENODEV;
goto exit;
}
if (bbn > 0)
goto exit;
/* _BBN in some systems return 0 for all root bridges */
bus = -1;
status = acpi_walk_resources(handle, METHOD_NAME__CRS,
do_root_bridge_busnr_callback, &bus);
/* If _CRS failed, we just use _BBN */
if (ACPI_FAILURE(status) || (bus == -1))
goto exit;
/* We select _CRS */
if (bbn != bus) {
printk(KERN_INFO PREFIX
"_BBN and _CRS returns different value for %s. Select _CRS\n",
(char *)buffer.pointer);
bbn = bus;
}
exit:
acpi_os_free(buffer.pointer);
return bbn;
}
static acpi_status
find_pci_rootbridge(acpi_handle handle, u32 lvl, void *context, void **rv)
{
struct acpi_find_pci_root *find = (struct acpi_find_pci_root *)context;
unsigned long seg, bus;
acpi_status status;
int tmp;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
status = acpi_evaluate_integer(handle, METHOD_NAME__SEG, NULL, &seg);
if (status == AE_NOT_FOUND) {
/* Assume seg = 0 */
printk(KERN_INFO PREFIX
"Assume root bridge [%s] segment is 0\n",
(char *)buffer.pointer);
status = AE_OK;
seg = 0;
}
if (ACPI_FAILURE(status)) {
status = AE_CTRL_DEPTH;
goto exit;
}
tmp = get_root_bridge_busnr(handle);
if (tmp < 0) {
printk(KERN_ERR PREFIX
"Find root bridge failed for %s\n",
(char *)buffer.pointer);
status = AE_CTRL_DEPTH;
goto exit;
}
bus = tmp;
if (seg == find->seg && bus == find->bus)
find->handle = handle;
status = AE_OK;
exit:
acpi_os_free(buffer.pointer);
return status;
}
acpi_handle acpi_get_pci_rootbridge_handle(unsigned int seg, unsigned int bus)
{
struct acpi_find_pci_root find = { seg, bus, NULL };
acpi_get_devices(PCI_ROOT_HID_STRING, find_pci_rootbridge, &find, NULL);
return find.handle;
}
/* Get device's handler per its address under its parent */
struct acpi_find_child {
acpi_handle handle;
acpi_integer address;
};
static acpi_status
do_acpi_find_child(acpi_handle handle, u32 lvl, void *context, void **rv)
{
acpi_status status;
struct acpi_device_info *info;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_find_child *find = (struct acpi_find_child *)context;
status = acpi_get_object_info(handle, &buffer);
if (ACPI_SUCCESS(status)) {
info = buffer.pointer;
if (info->address == find->address)
find->handle = handle;
acpi_os_free(buffer.pointer);
}
return AE_OK;
}
acpi_handle acpi_get_child(acpi_handle parent, acpi_integer address)
{
struct acpi_find_child find = { NULL, address };
if (!parent)
return NULL;
acpi_walk_namespace(ACPI_TYPE_DEVICE, parent,
1, do_acpi_find_child, &find, NULL);
return find.handle;
}
EXPORT_SYMBOL(acpi_get_child);
/* Link ACPI devices with physical devices */
static void acpi_glue_data_handler(acpi_handle handle,
u32 function, void *context)
{
/* we provide an empty handler */
}
/* Note: a success call will increase reference count by one */
struct device *acpi_get_physical_device(acpi_handle handle)
{
acpi_status status;
struct device *dev;
status = acpi_get_data(handle, acpi_glue_data_handler, (void **)&dev);
if (ACPI_SUCCESS(status))
return get_device(dev);
return NULL;
}
EXPORT_SYMBOL(acpi_get_physical_device);
static int acpi_bind_one(struct device *dev, acpi_handle handle)
{
acpi_status status;
if (dev->firmware_data) {
printk(KERN_WARNING PREFIX
"Drivers changed 'firmware_data' for %s\n", dev->bus_id);
return -EINVAL;
}
get_device(dev);
status = acpi_attach_data(handle, acpi_glue_data_handler, dev);
if (ACPI_FAILURE(status)) {
put_device(dev);
return -EINVAL;
}
dev->firmware_data = handle;
return 0;
}
static int acpi_unbind_one(struct device *dev)
{
if (!dev->firmware_data)
return 0;
if (dev == acpi_get_physical_device(dev->firmware_data)) {
/* acpi_get_physical_device increase refcnt by one */
put_device(dev);
acpi_detach_data(dev->firmware_data, acpi_glue_data_handler);
dev->firmware_data = NULL;
/* acpi_bind_one increase refcnt by one */
put_device(dev);
} else {
printk(KERN_ERR PREFIX
"Oops, 'firmware_data' corrupt for %s\n", dev->bus_id);
}
return 0;
}
static int acpi_platform_notify(struct device *dev)
{
struct acpi_bus_type *type;
acpi_handle handle;
int ret = -EINVAL;
if (!dev->bus || !dev->parent) {
/* bridge devices genernally haven't bus or parent */
ret = acpi_find_bridge_device(dev, &handle);
goto end;
}
type = acpi_get_bus_type(dev->bus);
if (!type) {
DBG("No ACPI bus support for %s\n", dev->bus_id);
ret = -EINVAL;
goto end;
}
if ((ret = type->find_device(dev, &handle)) != 0)
DBG("Can't get handler for %s\n", dev->bus_id);
end:
if (!ret)
acpi_bind_one(dev, handle);
#if ACPI_GLUE_DEBUG
if (!ret) {
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer);
DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer);
acpi_os_free(buffer.pointer);
} else
DBG("Device %s -> No ACPI support\n", dev->bus_id);
#endif
return ret;
}
static int acpi_platform_notify_remove(struct device *dev)
{
acpi_unbind_one(dev);
return 0;
}
static int __init init_acpi_device_notify(void)
{
if (acpi_disabled)
return 0;
if (platform_notify || platform_notify_remove) {
printk(KERN_ERR PREFIX "Can't use platform_notify\n");
return 0;
}
platform_notify = acpi_platform_notify;
platform_notify_remove = acpi_platform_notify_remove;
return 0;
}
arch_initcall(init_acpi_device_notify);

View File

@ -58,7 +58,8 @@
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Initialize and validate various ACPI registers * DESCRIPTION: Initialize and validate the various ACPI registers defined in
* the FADT.
* *
******************************************************************************/ ******************************************************************************/
@ -75,7 +76,7 @@ acpi_hw_initialize (
/* We must have the ACPI tables by the time we get here */ /* We must have the ACPI tables by the time we get here */
if (!acpi_gbl_FADT) { if (!acpi_gbl_FADT) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES); return_ACPI_STATUS (AE_NO_ACPI_TABLES);
} }
@ -131,7 +132,8 @@ acpi_hw_set_mode (
* transitions are not supported. * transitions are not supported.
*/ */
if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) { if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n")); ACPI_REPORT_ERROR ((
"No ACPI mode transition supported in this system (enable/disable both zero)\n"));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -162,7 +164,8 @@ acpi_hw_set_mode (
} }
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_REPORT_ERROR (("Could not write mode change, %s\n", acpi_format_exception (status))); ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -173,7 +176,8 @@ acpi_hw_set_mode (
retry = 3000; retry = 3000;
while (retry) { while (retry) {
if (acpi_hw_get_mode() == mode) { if (acpi_hw_get_mode() == mode) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", mode)); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
mode));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
acpi_os_stall(1000); acpi_os_stall(1000);
@ -185,7 +189,7 @@ acpi_hw_set_mode (
} }
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_hw_get_mode * FUNCTION: acpi_hw_get_mode
* *
@ -199,7 +203,8 @@ acpi_hw_set_mode (
******************************************************************************/ ******************************************************************************/
u32 u32
acpi_hw_get_mode (void) acpi_hw_get_mode (
void)
{ {
acpi_status status; acpi_status status;
u32 value; u32 value;

View File

@ -48,6 +48,13 @@
#define _COMPONENT ACPI_HARDWARE #define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwgpe") ACPI_MODULE_NAME ("hwgpe")
/* Local prototypes */
static acpi_status
acpi_hw_enable_wakeup_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block);
/****************************************************************************** /******************************************************************************
* *
@ -135,6 +142,7 @@ acpi_hw_clear_gpe (
* DESCRIPTION: Return the status of a single GPE. * DESCRIPTION: Return the status of a single GPE.
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
acpi_status acpi_status
acpi_hw_get_gpe_status ( acpi_hw_get_gpe_status (
@ -206,7 +214,7 @@ unlock_and_exit:
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Disable all GPEs within a GPE block * DESCRIPTION: Disable all GPEs within a single GPE block
* *
******************************************************************************/ ******************************************************************************/
@ -244,7 +252,7 @@ acpi_hw_disable_gpe_block (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Clear status bits for all GPEs within a GPE block * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
* *
******************************************************************************/ ******************************************************************************/
@ -282,8 +290,8 @@ acpi_hw_clear_gpe_block (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
* combination wake/run GPEs.) * combination wake/run GPEs.
* *
******************************************************************************/ ******************************************************************************/
@ -327,12 +335,12 @@ acpi_hw_enable_runtime_gpe_block (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
* combination wake/run GPEs.) * combination wake/run GPEs.
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_hw_enable_wakeup_gpe_block ( acpi_hw_enable_wakeup_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info, struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block) struct acpi_gpe_block_info *gpe_block)
@ -350,7 +358,8 @@ acpi_hw_enable_wakeup_gpe_block (
/* Enable all "wake" GPEs in this register */ /* Enable all "wake" GPEs in this register */
status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_wake, status = acpi_hw_low_level_write (8,
gpe_block->register_info[i].enable_for_wake,
&gpe_block->register_info[i].enable_address); &gpe_block->register_info[i].enable_address);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return (status); return (status);
@ -369,7 +378,7 @@ acpi_hw_enable_wakeup_gpe_block (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Disable and clear all GPEs * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
* *
******************************************************************************/ ******************************************************************************/
@ -397,7 +406,7 @@ acpi_hw_disable_all_gpes (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable all GPEs of the given type * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
* *
******************************************************************************/ ******************************************************************************/
@ -424,7 +433,7 @@ acpi_hw_enable_all_runtime_gpes (
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Enable all GPEs of the given type * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
* *
******************************************************************************/ ******************************************************************************/

View File

@ -87,7 +87,8 @@ acpi_hw_clear_acpi_status (
} }
} }
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_STATUS,
ACPI_BITMASK_ALL_FIXED_STATUS); ACPI_BITMASK_ALL_FIXED_STATUS);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto unlock_and_exit; goto unlock_and_exit;
@ -138,28 +139,30 @@ acpi_get_sleep_type_data (
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct acpi_parameter_info info; struct acpi_parameter_info info;
char *sleep_state_name;
ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data"); ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
/* /* Validate parameters */
* Validate parameters
*/
if ((sleep_state > ACPI_S_STATES_MAX) || if ((sleep_state > ACPI_S_STATES_MAX) ||
!sleep_type_a || !sleep_type_b) { !sleep_type_a || !sleep_type_b) {
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
/* /* Evaluate the namespace object containing the values for this state */
* Evaluate the namespace object containing the values for this state
*/
info.parameters = NULL; info.parameters = NULL;
status = acpi_ns_evaluate_by_name ((char *) acpi_gbl_sleep_state_names[sleep_state], info.return_object = NULL;
&info); sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state];
status = acpi_ns_evaluate_by_name (sleep_state_name, &info);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating sleep_state [%s]\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
acpi_format_exception (status), acpi_gbl_sleep_state_names[sleep_state])); "%s while evaluating sleep_state [%s]\n",
acpi_format_exception (status), sleep_state_name));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -167,45 +170,57 @@ acpi_get_sleep_type_data (
/* Must have a return object */ /* Must have a return object */
if (!info.return_object) { if (!info.return_object) {
ACPI_REPORT_ERROR (("Missing Sleep State object\n")); ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
sleep_state_name));
status = AE_NOT_EXIST; status = AE_NOT_EXIST;
} }
/* It must be of type Package */ /* It must be of type Package */
else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) { else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) {
ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
/* The package must have at least two elements */ /*
* The package must have at least two elements. NOTE (March 2005): This
* goes against the current ACPI spec which defines this object as a
* package with one encoded DWORD element. However, existing practice
* by BIOS vendors seems to be to have 2 or more elements, at least
* one per sleep type (A/B).
*/
else if (info.return_object->package.count < 2) { else if (info.return_object->package.count < 2) {
ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); ACPI_REPORT_ERROR ((
"Sleep State return package does not have at least two elements\n"));
status = AE_AML_NO_OPERAND; status = AE_AML_NO_OPERAND;
} }
/* The first two elements must both be of type Integer */ /* The first two elements must both be of type Integer */
else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0]) != ACPI_TYPE_INTEGER) || else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0])
(ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1]) != ACPI_TYPE_INTEGER)) { != ACPI_TYPE_INTEGER) ||
ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", (ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1])
!= ACPI_TYPE_INTEGER)) {
ACPI_REPORT_ERROR ((
"Sleep State return package elements are not both Integers (%s, %s)\n",
acpi_ut_get_object_type_name (info.return_object->package.elements[0]), acpi_ut_get_object_type_name (info.return_object->package.elements[0]),
acpi_ut_get_object_type_name (info.return_object->package.elements[1]))); acpi_ut_get_object_type_name (info.return_object->package.elements[1])));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
else { else {
/* /* Valid _Sx_ package size, type, and value */
* Valid _Sx_ package size, type, and value
*/ *sleep_type_a = (u8)
*sleep_type_a = (u8) (info.return_object->package.elements[0])->integer.value; (info.return_object->package.elements[0])->integer.value;
*sleep_type_b = (u8) (info.return_object->package.elements[1])->integer.value; *sleep_type_b = (u8)
(info.return_object->package.elements[1])->integer.value;
} }
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"While evaluating sleep_state [%s], bad Sleep object %p type %s\n", "%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
acpi_gbl_sleep_state_names[sleep_state], info.return_object, acpi_format_exception (status),
sleep_state_name, info.return_object,
acpi_ut_get_object_type_name (info.return_object))); acpi_ut_get_object_type_name (info.return_object)));
} }
@ -427,14 +442,16 @@ acpi_set_register (
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
register_value, register_value,
ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); ACPI_FORMAT_UINT64 (
acpi_gbl_FADT->xpm2_cnt_blk.address)));
ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position, ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
bit_reg_info->access_bit_mask, value); bit_reg_info->access_bit_mask, value);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
register_value, register_value,
ACPI_FORMAT_UINT64 (acpi_gbl_FADT->xpm2_cnt_blk.address))); ACPI_FORMAT_UINT64 (
acpi_gbl_FADT->xpm2_cnt_blk.address)));
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM2_CONTROL, (u8) (register_value)); ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
@ -454,7 +471,9 @@ unlock_and_exit:
/* Normalize the value that was read */ /* Normalize the value that was read */
ACPI_DEBUG_EXEC (register_value = ((register_value & bit_reg_info->access_bit_mask) >> bit_reg_info->bit_position)); ACPI_DEBUG_EXEC (register_value =
((register_value & bit_reg_info->access_bit_mask) >>
bit_reg_info->bit_position));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
value, register_value, bit_reg_info->parent_register)); value, register_value, bit_reg_info->parent_register));
@ -469,7 +488,7 @@ EXPORT_SYMBOL(acpi_set_register);
* *
* PARAMETERS: use_lock - Mutex hw access * PARAMETERS: use_lock - Mutex hw access
* register_id - register_iD + Offset * register_id - register_iD + Offset
* return_value - Value that was read from the register * return_value - Where the register value is returned
* *
* RETURN: Status and the value read. * RETURN: Status and the value read.
* *
@ -557,7 +576,8 @@ acpi_hw_register_read (
break; break;
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", register_id)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
register_id));
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;
} }
@ -763,7 +783,8 @@ acpi_hw_low_level_read (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
*value, width, *value, width,
ACPI_FORMAT_UINT64 (address), ACPI_FORMAT_UINT64 (address),
acpi_ut_get_region_name (reg->address_space_id))); acpi_ut_get_region_name (reg->address_space_id)));
@ -841,7 +862,8 @@ acpi_hw_low_level_write (
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
value, width, value, width,
ACPI_FORMAT_UINT64 (address), ACPI_FORMAT_UINT64 (address),
acpi_ut_get_region_name (reg->address_space_id))); acpi_ut_get_region_name (reg->address_space_id)));

View File

@ -43,27 +43,13 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <acpi/acpi.h> #include <acpi/acpi.h>
#define _COMPONENT ACPI_HARDWARE #define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwsleep") ACPI_MODULE_NAME ("hwsleep")
#define METHOD_NAME__BFS "\\_BFS" /*******************************************************************************
#define METHOD_NAME__GTS "\\_GTS"
#define METHOD_NAME__PTS "\\_PTS"
#define METHOD_NAME__SST "\\_SI._SST"
#define METHOD_NAME__WAK "\\_WAK"
#define ACPI_SST_INDICATOR_OFF 0
#define ACPI_SST_WORKING 1
#define ACPI_SST_WAKING 2
#define ACPI_SST_SLEEPING 3
#define ACPI_SST_SLEEP_CONTEXT 4
/******************************************************************************
* *
* FUNCTION: acpi_set_firmware_waking_vector * FUNCTION: acpi_set_firmware_waking_vector
* *
@ -72,7 +58,7 @@
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: access function for d_firmware_waking_vector field in FACS * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
* *
******************************************************************************/ ******************************************************************************/
@ -99,19 +85,20 @@ acpi_set_firmware_waking_vector (
} }
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_get_firmware_waking_vector * FUNCTION: acpi_get_firmware_waking_vector
* *
* PARAMETERS: *physical_address - Output buffer where contents of * PARAMETERS: *physical_address - Where the contents of
* the firmware_waking_vector field of * the firmware_waking_vector field of
* the FACS will be stored. * the FACS will be returned.
* *
* RETURN: Status * RETURN: Status, vector
* *
* DESCRIPTION: Access function for firmware_waking_vector field in FACS * DESCRIPTION: Access function for the firmware_waking_vector field in FACS
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
acpi_status acpi_status
acpi_get_firmware_waking_vector ( acpi_get_firmware_waking_vector (
@ -141,7 +128,7 @@ acpi_get_firmware_waking_vector (
#endif #endif
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_enter_sleep_state_prep * FUNCTION: acpi_enter_sleep_state_prep
* *
@ -215,7 +202,7 @@ acpi_enter_sleep_state_prep (
break; break;
default: default:
arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */ arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
break; break;
} }
@ -223,14 +210,15 @@ acpi_enter_sleep_state_prep (
status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
acpi_format_exception (status)));
} }
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_enter_sleep_state * FUNCTION: acpi_enter_sleep_state
* *
@ -299,15 +287,18 @@ acpi_enter_sleep_state (
/* Get current value of PM1A control */ /* Get current value of PM1A control */
status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol); status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", sleep_state)); ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
"Entering sleep state [S%d]\n", sleep_state));
/* Clear SLP_EN and SLP_TYP fields */ /* Clear SLP_EN and SLP_TYP fields */
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask | sleep_enable_reg_info->access_bit_mask); PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
sleep_enable_reg_info->access_bit_mask);
PM1Bcontrol = PM1Acontrol; PM1Bcontrol = PM1Acontrol;
/* Insert SLP_TYP bits */ /* Insert SLP_TYP bits */
@ -322,12 +313,14 @@ acpi_enter_sleep_state (
/* Write #1: fill in SLP_TYP data */ /* Write #1: fill in SLP_TYP data */
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -341,22 +334,25 @@ acpi_enter_sleep_state (
ACPI_FLUSH_CPU_CACHE (); ACPI_FLUSH_CPU_CACHE ();
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol); status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
if (sleep_state > ACPI_STATE_S3) { if (sleep_state > ACPI_STATE_S3) {
/* /*
* We wanted to sleep > S3, but it didn't happen (by virtue of the fact that * We wanted to sleep > S3, but it didn't happen (by virtue of the
* we are still executing!) * fact that we are still executing!)
* *
* Wait ten seconds, then try again. This is to get S4/S5 to work on all machines. * Wait ten seconds, then try again. This is to get S4/S5 to work on
* all machines.
* *
* We wait so long to allow chipsets that poll this reg very slowly to * We wait so long to allow chipsets that poll this reg very slowly to
* still read the right value. Ideally, this block would go * still read the right value. Ideally, this block would go
@ -364,7 +360,8 @@ acpi_enter_sleep_state (
*/ */
acpi_os_stall (10000000); acpi_os_stall (10000000);
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL,
sleep_enable_reg_info->access_bit_mask); sleep_enable_reg_info->access_bit_mask);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
@ -374,7 +371,8 @@ acpi_enter_sleep_state (
/* Wait until we enter sleep state */ /* Wait until we enter sleep state */
do { do {
status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -388,7 +386,7 @@ acpi_enter_sleep_state (
EXPORT_SYMBOL(acpi_enter_sleep_state); EXPORT_SYMBOL(acpi_enter_sleep_state);
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_enter_sleep_state_s4bios * FUNCTION: acpi_enter_sleep_state_s4bios
* *
@ -439,11 +437,13 @@ acpi_enter_sleep_state_s4bios (
ACPI_FLUSH_CPU_CACHE (); ACPI_FLUSH_CPU_CACHE ();
status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, (u32) acpi_gbl_FADT->S4bios_req, 8); status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
(u32) acpi_gbl_FADT->S4bios_req, 8);
do { do {
acpi_os_stall(1000); acpi_os_stall(1000);
status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value, ACPI_MTX_DO_NOT_LOCK); status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -454,7 +454,7 @@ acpi_enter_sleep_state_s4bios (
EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios); EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
/****************************************************************************** /*******************************************************************************
* *
* FUNCTION: acpi_leave_sleep_state * FUNCTION: acpi_leave_sleep_state
* *
@ -534,18 +534,21 @@ acpi_leave_sleep_state (
arg.integer.value = ACPI_SST_WAKING; arg.integer.value = ACPI_SST_WAKING;
status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
acpi_format_exception (status)));
} }
arg.integer.value = sleep_state; arg.integer.value = sleep_state;
status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL); status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL);
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", acpi_format_exception (status))); ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
acpi_format_exception (status)));
} }
status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL); status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL);
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", acpi_format_exception (status))); ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
acpi_format_exception (status)));
} }
/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */ /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
@ -567,15 +570,19 @@ acpi_leave_sleep_state (
/* Enable power button */ /* Enable power button */
(void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id, (void) acpi_set_register(
acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
1, ACPI_MTX_DO_NOT_LOCK); 1, ACPI_MTX_DO_NOT_LOCK);
(void) acpi_set_register(acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
(void) acpi_set_register(
acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
1, ACPI_MTX_DO_NOT_LOCK); 1, ACPI_MTX_DO_NOT_LOCK);
arg.integer.value = ACPI_SST_WORKING; arg.integer.value = ACPI_SST_WORKING;
status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL); status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) { if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
ACPI_REPORT_ERROR (("Method _SST failed, %s\n", acpi_format_exception (status))); ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
acpi_format_exception (status)));
} }
return_ACPI_STATUS (status); return_ACPI_STATUS (status);

View File

@ -43,7 +43,6 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <acpi/acpi.h> #include <acpi/acpi.h>
#define _COMPONENT ACPI_HARDWARE #define _COMPONENT ACPI_HARDWARE
@ -90,7 +89,7 @@ acpi_get_timer_resolution (
* *
* PARAMETERS: Ticks - Where the timer value is returned * PARAMETERS: Ticks - Where the timer value is returned
* *
* RETURN: Status and current ticks * RETURN: Status and current timer value (ticks)
* *
* DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks). * DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks).
* *
@ -199,5 +198,6 @@ acpi_get_timer_duration (
*time_elapsed = (u32) quotient; *time_elapsed = (u32) quotient;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
EXPORT_SYMBOL(acpi_get_timer_duration); EXPORT_SYMBOL(acpi_get_timer_duration);

1019
drivers/acpi/hotkey.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1025,7 +1025,7 @@ static int setup_notify(struct ibm_struct *ibm)
return 0; return 0;
} }
static int device_add(struct acpi_device *device) static int ibmacpi_device_add(struct acpi_device *device)
{ {
return 0; return 0;
} }
@ -1043,7 +1043,7 @@ static int register_driver(struct ibm_struct *ibm)
memset(ibm->driver, 0, sizeof(struct acpi_driver)); memset(ibm->driver, 0, sizeof(struct acpi_driver));
sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name); sprintf(ibm->driver->name, "%s/%s", IBM_NAME, ibm->name);
ibm->driver->ids = ibm->hid; ibm->driver->ids = ibm->hid;
ibm->driver->ops.add = &device_add; ibm->driver->ops.add = &ibmacpi_device_add;
ret = acpi_bus_register_driver(ibm->driver); ret = acpi_bus_register_driver(ibm->driver);
if (ret < 0) { if (ret < 0) {
@ -1185,6 +1185,10 @@ static int __init acpi_ibm_init(void)
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
if (!acpi_specific_hotkey_enabled){
printk(IBM_ERR "Using generic hotkey driver\n");
return -ENODEV;
}
/* these handles are required */ /* these handles are required */
if (IBM_HANDLE_INIT(ec, 1) < 0 || if (IBM_HANDLE_INIT(ec, 1) < 0 ||
IBM_HANDLE_INIT(hkey, 1) < 0 || IBM_HANDLE_INIT(hkey, 1) < 0 ||

View File

@ -67,7 +67,8 @@
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ns_root_initialize (void) acpi_ns_root_initialize (
void)
{ {
acpi_status status; acpi_status status;
const struct acpi_predefined_names *init_val = NULL; const struct acpi_predefined_names *init_val = NULL;
@ -265,7 +266,7 @@ unlock_and_exit:
* *
* FUNCTION: acpi_ns_lookup * FUNCTION: acpi_ns_lookup
* *
* PARAMETERS: prefix_node - Search scope if name is not fully qualified * PARAMETERS: scope_info - Current scope info block
* Pathname - Search pathname, in internal format * Pathname - Search pathname, in internal format
* (as represented in the AML stream) * (as represented in the AML stream)
* Type - Type associated with name * Type - Type associated with name

View File

@ -49,14 +49,20 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsalloc") ACPI_MODULE_NAME ("nsalloc")
/* Local prototypes */
static void
acpi_ns_remove_reference (
struct acpi_namespace_node *node);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_create_node * FUNCTION: acpi_ns_create_node
* *
* PARAMETERS: acpi_name - Name of the new node * PARAMETERS: Name - Name of the new node (4 char ACPI name)
* *
* RETURN: None * RETURN: New namespace node (Null on failure)
* *
* DESCRIPTION: Create a namespace node * DESCRIPTION: Create a namespace node
* *
@ -145,7 +151,6 @@ acpi_ns_delete_node (
} }
} }
ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++); ACPI_MEM_TRACKING (acpi_gbl_memory_lists[ACPI_MEM_LIST_NSNODE].total_freed++);
/* /*
@ -157,57 +162,6 @@ acpi_ns_delete_node (
} }
#ifdef ACPI_ALPHABETIC_NAMESPACE
/*******************************************************************************
*
* FUNCTION: acpi_ns_compare_names
*
* PARAMETERS: Name1 - First name to compare
* Name2 - Second name to compare
*
* RETURN: value from strncmp
*
* DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
* underscore are forced to be alphabetically first.
*
******************************************************************************/
int
acpi_ns_compare_names (
char *name1,
char *name2)
{
char reversed_name1[ACPI_NAME_SIZE];
char reversed_name2[ACPI_NAME_SIZE];
u32 i;
u32 j;
/*
* Replace all instances of "underscore" with a value that is smaller so
* that all names that are prefixed with underscore(s) are alphabetically
* first.
*
* Reverse the name bytewise so we can just do a 32-bit compare instead
* of a strncmp.
*/
for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
reversed_name1[j] = name1[i];
if (name1[i] == '_') {
reversed_name1[j] = '*';
}
reversed_name2[j] = name2[i];
if (name2[i] == '_') {
reversed_name2[j] = '*';
}
}
return (*(int *) reversed_name1 - *(int *) reversed_name2);
}
#endif
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_install_node * FUNCTION: acpi_ns_install_node
@ -271,7 +225,8 @@ acpi_ns_install_node (
* alphabetic placement. * alphabetic placement.
*/ */
previous_child_node = NULL; previous_child_node = NULL;
while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node), acpi_ut_get_node_name (node)) < 0) { while (acpi_ns_compare_names (acpi_ut_get_node_name (child_node),
acpi_ut_get_node_name (node)) < 0) {
if (child_node->flags & ANOBJ_END_OF_PEER_LIST) { if (child_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* Last peer; Clear end-of-list flag */ /* Last peer; Clear end-of-list flag */
@ -429,7 +384,8 @@ acpi_ns_delete_children (
/* There should be only one reference remaining on this node */ /* There should be only one reference remaining on this node */
if (child_node->reference_count != 1) { if (child_node->reference_count != 1) {
ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n", ACPI_REPORT_WARNING ((
"Existing references (%d) on node being deleted (%p)\n",
child_node->reference_count, child_node)); child_node->reference_count, child_node));
} }
@ -548,7 +504,7 @@ acpi_ns_delete_namespace_subtree (
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ns_remove_reference ( acpi_ns_remove_reference (
struct acpi_namespace_node *node) struct acpi_namespace_node *node)
{ {
@ -683,3 +639,54 @@ acpi_ns_delete_namespace_by_owner (
} }
#ifdef ACPI_ALPHABETIC_NAMESPACE
/*******************************************************************************
*
* FUNCTION: acpi_ns_compare_names
*
* PARAMETERS: Name1 - First name to compare
* Name2 - Second name to compare
*
* RETURN: value from strncmp
*
* DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
* underscore are forced to be alphabetically first.
*
******************************************************************************/
int
acpi_ns_compare_names (
char *name1,
char *name2)
{
char reversed_name1[ACPI_NAME_SIZE];
char reversed_name2[ACPI_NAME_SIZE];
u32 i;
u32 j;
/*
* Replace all instances of "underscore" with a value that is smaller so
* that all names that are prefixed with underscore(s) are alphabetically
* first.
*
* Reverse the name bytewise so we can just do a 32-bit compare instead
* of a strncmp.
*/
for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--) {
reversed_name1[j] = name1[i];
if (name1[i] == '_') {
reversed_name1[j] = '*';
}
reversed_name2[j] = name2[i];
if (name2[i] == '_') {
reversed_name2[j] = '*';
}
}
return (*(int *) reversed_name1 - *(int *) reversed_name2);
}
#endif

View File

@ -50,16 +50,32 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsdump") ACPI_MODULE_NAME ("nsdump")
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
void
acpi_ns_dump_root_devices (
void);
static acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
#endif
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_print_pathname * FUNCTION: acpi_ns_print_pathname
* *
* PARAMETERS: num_segment - Number of ACPI name segments * PARAMETERS: num_segments - Number of ACPI name segments
* Pathname - The compressed (internal) path * Pathname - The compressed (internal) path
* *
* RETURN: None
*
* DESCRIPTION: Print an object's full namespace pathname * DESCRIPTION: Print an object's full namespace pathname
* *
******************************************************************************/ ******************************************************************************/
@ -103,6 +119,8 @@ acpi_ns_print_pathname (
* Level - Desired debug level * Level - Desired debug level
* Component - Caller's component ID * Component - Caller's component ID
* *
* RETURN: None
*
* DESCRIPTION: Print an object's full namespace pathname * DESCRIPTION: Print an object's full namespace pathname
* Manages allocation/freeing of a pathname buffer * Manages allocation/freeing of a pathname buffer
* *
@ -137,9 +155,12 @@ acpi_ns_dump_pathname (
* *
* FUNCTION: acpi_ns_dump_one_object * FUNCTION: acpi_ns_dump_one_object
* *
* PARAMETERS: Handle - Node to be dumped * PARAMETERS: obj_handle - Node to be dumped
* Level - Nesting level of the handle * Level - Nesting level of the handle
* Context - Passed into walk_namespace * Context - Passed into walk_namespace
* return_value - Not used
*
* RETURN: Status
* *
* DESCRIPTION: Dump a single Node * DESCRIPTION: Dump a single Node
* This procedure is a user_function called by acpi_ns_walk_namespace. * This procedure is a user_function called by acpi_ns_walk_namespace.
@ -394,8 +415,7 @@ acpi_ns_dump_one_object (
return (AE_OK); return (AE_OK);
} }
acpi_os_printf ("(R%d)", acpi_os_printf ("(R%d)", obj_desc->common.reference_count);
obj_desc->common.reference_count);
switch (type) { switch (type) {
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
@ -551,18 +571,20 @@ cleanup:
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_dump_objects * FUNCTION: acpi_ns_dump_objects
* *
* PARAMETERS: Type - Object type to be dumped * PARAMETERS: Type - Object type to be dumped
* display_type - 0 or ACPI_DISPLAY_SUMMARY
* max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX
* for an effectively unlimited depth. * for an effectively unlimited depth.
* owner_id - Dump only objects owned by this ID. Use * owner_id - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners. * ACPI_UINT32_MAX to match all owners.
* start_handle - Where in namespace to start/end search * start_handle - Where in namespace to start/end search
* *
* RETURN: None
*
* DESCRIPTION: Dump typed objects within the loaded namespace. * DESCRIPTION: Dump typed objects within the loaded namespace.
* Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. * Uses acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object.
* *
@ -590,8 +612,42 @@ acpi_ns_dump_objects (
ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object, ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
(void *) &info, NULL); (void *) &info, NULL);
} }
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_entry
*
* PARAMETERS: Handle - Node to be dumped
* debug_level - Output level
*
* RETURN: None
*
* DESCRIPTION: Dump a single Node
*
******************************************************************************/
void
acpi_ns_dump_entry (
acpi_handle handle,
u32 debug_level)
{
struct acpi_walk_info info;
ACPI_FUNCTION_ENTRY ();
info.debug_level = debug_level;
info.owner_id = ACPI_UINT32_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
(void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
}
#ifdef _ACPI_ASL_COMPILER
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_dump_tables * FUNCTION: acpi_ns_dump_tables
@ -601,6 +657,8 @@ acpi_ns_dump_objects (
* max_depth - Maximum depth of dump. Use INT_MAX * max_depth - Maximum depth of dump. Use INT_MAX
* for an effectively unlimited depth. * for an effectively unlimited depth.
* *
* RETURN: None
*
* DESCRIPTION: Dump the name space, or a portion of it. * DESCRIPTION: Dump the name space, or a portion of it.
* *
******************************************************************************/ ******************************************************************************/
@ -626,7 +684,7 @@ acpi_ns_dump_tables (
} }
if (ACPI_NS_ALL == search_base) { if (ACPI_NS_ALL == search_base) {
/* entire namespace */ /* Entire namespace */
search_handle = acpi_gbl_root_node; search_handle = acpi_gbl_root_node;
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
@ -636,38 +694,5 @@ acpi_ns_dump_tables (
ACPI_UINT32_MAX, search_handle); ACPI_UINT32_MAX, search_handle);
return_VOID; return_VOID;
} }
#endif /* _ACPI_ASL_COMPILER */
#endif /* ACPI_FUTURE_USAGE */ #endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_entry
*
* PARAMETERS: Handle - Node to be dumped
* debug_level - Output level
*
* DESCRIPTION: Dump a single Node
*
******************************************************************************/
void
acpi_ns_dump_entry (
acpi_handle handle,
u32 debug_level)
{
struct acpi_walk_info info;
ACPI_FUNCTION_ENTRY ();
info.debug_level = debug_level;
info.owner_id = ACPI_UINT32_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
(void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
}
#endif

View File

@ -43,15 +43,18 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acnamesp.h>
/* TBD: This entire module is apparently obsolete and should be removed */
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsdumpdv") ACPI_MODULE_NAME ("nsdumpdv")
#ifdef ACPI_OBSOLETE_FUNCTIONS
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
#include <acpi/acnamesp.h>
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_dump_one_device * FUNCTION: acpi_ns_dump_one_device
@ -59,13 +62,16 @@
* PARAMETERS: Handle - Node to be dumped * PARAMETERS: Handle - Node to be dumped
* Level - Nesting level of the handle * Level - Nesting level of the handle
* Context - Passed into walk_namespace * Context - Passed into walk_namespace
* return_value - Not used
*
* RETURN: Status
* *
* DESCRIPTION: Dump a single Node that represents a device * DESCRIPTION: Dump a single Node that represents a device
* This procedure is a user_function called by acpi_ns_walk_namespace. * This procedure is a user_function called by acpi_ns_walk_namespace.
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_dump_one_device ( acpi_ns_dump_one_device (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
@ -108,12 +114,15 @@ acpi_ns_dump_one_device (
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: None
*
* DESCRIPTION: Dump all objects of type "device" * DESCRIPTION: Dump all objects of type "device"
* *
******************************************************************************/ ******************************************************************************/
void void
acpi_ns_dump_root_devices (void) acpi_ns_dump_root_devices (
void)
{ {
acpi_handle sys_bus_handle; acpi_handle sys_bus_handle;
acpi_status status; acpi_status status;
@ -142,5 +151,6 @@ acpi_ns_dump_root_devices (void)
} }
#endif #endif
#endif

View File

@ -52,6 +52,16 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nseval") ACPI_MODULE_NAME ("nseval")
/* Local prototypes */
static acpi_status
acpi_ns_execute_control_method (
struct acpi_parameter_info *info);
static acpi_status
acpi_ns_get_object_value (
struct acpi_parameter_info *info);
/******************************************************************************* /*******************************************************************************
* *
@ -59,12 +69,16 @@
* *
* PARAMETERS: Pathname - Name of method to execute, If NULL, the * PARAMETERS: Pathname - Name of method to execute, If NULL, the
* handle is the object to execute * handle is the object to execute
* Info - Method info block * Info - Method info block, contains:
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* Params - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Find and execute the requested method using the handle as a * DESCRIPTION: Evaluate the object or find and execute the requested method
* scope
* *
* MUTEX: Locks Namespace * MUTEX: Locks Namespace
* *
@ -158,7 +172,7 @@ cleanup1:
* FUNCTION: acpi_ns_evaluate_by_name * FUNCTION: acpi_ns_evaluate_by_name
* *
* PARAMETERS: Pathname - Fully qualified pathname to the object * PARAMETERS: Pathname - Fully qualified pathname to the object
* Info - Contains: * Info - Method info block, contains:
* return_object - Where to put method's return value (if * return_object - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* Params - List of parameters to pass to the method, * Params - List of parameters to pass to the method,
@ -167,8 +181,8 @@ cleanup1:
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Find and execute the requested method passing the given * DESCRIPTION: Evaluate the object or rind and execute the requested method
* parameters * passing the given parameters
* *
* MUTEX: Locks Namespace * MUTEX: Locks Namespace
* *
@ -241,17 +255,21 @@ cleanup:
* *
* FUNCTION: acpi_ns_evaluate_by_handle * FUNCTION: acpi_ns_evaluate_by_handle
* *
* PARAMETERS: Handle - Method Node to execute * PARAMETERS: Info - Method info block, contains:
* Params - List of parameters to pass to the method, * Node - Method/Object Node to execute
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* param_type - Type of Parameter list * return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* parameter_type - Type of Parameter list
* return_object - Where to put method's return value (if * return_object - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Execute the requested method passing the given parameters * DESCRIPTION: Evaluate object or execute the requested method passing the
* given parameters
* *
* MUTEX: Locks Namespace * MUTEX: Locks Namespace
* *
@ -345,7 +363,16 @@ acpi_ns_evaluate_by_handle (
* *
* FUNCTION: acpi_ns_execute_control_method * FUNCTION: acpi_ns_execute_control_method
* *
* PARAMETERS: Info - Method info block (w/params) * PARAMETERS: Info - Method info block, contains:
* Node - Method Node to execute
* Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* parameter_type - Type of Parameter list
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* *
* RETURN: Status * RETURN: Status
* *
@ -355,7 +382,7 @@ acpi_ns_evaluate_by_handle (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_execute_control_method ( acpi_ns_execute_control_method (
struct acpi_parameter_info *info) struct acpi_parameter_info *info)
{ {
@ -414,7 +441,10 @@ acpi_ns_execute_control_method (
* *
* FUNCTION: acpi_ns_get_object_value * FUNCTION: acpi_ns_get_object_value
* *
* PARAMETERS: Info - Method info block (w/params) * PARAMETERS: Info - Method info block, contains:
* Node - Object's NS node
* return_object - Where to put object value (if
* any). If NULL, no value is returned.
* *
* RETURN: Status * RETURN: Status
* *
@ -424,7 +454,7 @@ acpi_ns_execute_control_method (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_get_object_value ( acpi_ns_get_object_value (
struct acpi_parameter_info *info) struct acpi_parameter_info *info)
{ {

View File

@ -50,6 +50,22 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsinit") ACPI_MODULE_NAME ("nsinit")
/* Local prototypes */
static acpi_status
acpi_ns_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
static acpi_status
acpi_ns_init_one_device (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
/******************************************************************************* /*******************************************************************************
* *
@ -191,7 +207,7 @@ acpi_ns_initialize_devices (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_init_one_object ( acpi_ns_init_one_object (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 level, u32 level,
@ -331,7 +347,7 @@ acpi_ns_init_one_object (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_init_one_device ( acpi_ns_init_one_device (
acpi_handle obj_handle, acpi_handle obj_handle,
u32 nesting_level, u32 nesting_level,
@ -374,7 +390,8 @@ acpi_ns_init_one_device (
/* /*
* Run _STA to determine if we can run _INI on the device. * Run _STA to determine if we can run _INI on the device.
*/ */
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_STA")); ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
pinfo.node, METHOD_NAME__STA));
status = acpi_ut_execute_STA (pinfo.node, &flags); status = acpi_ut_execute_STA (pinfo.node, &flags);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -399,8 +416,9 @@ acpi_ns_init_one_device (
/* /*
* The device is present. Run _INI. * The device is present. Run _INI.
*/ */
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD, pinfo.node, "_INI")); ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
status = acpi_ns_evaluate_relative ("_INI", &pinfo); pinfo.node, METHOD_NAME__INI));
status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* No _INI (AE_NOT_FOUND) means device requires no initialization */ /* No _INI (AE_NOT_FOUND) means device requires no initialization */

View File

@ -50,9 +50,24 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsload") ACPI_MODULE_NAME ("nsload")
/* Local prototypes */
static acpi_status
acpi_ns_load_table_by_type (
acpi_table_type table_type);
#ifdef ACPI_FUTURE_IMPLEMENTATION
acpi_status
acpi_ns_unload_namespace (
acpi_handle handle);
static acpi_status
acpi_ns_delete_subtree (
acpi_handle start_handle);
#endif
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_load_table * FUNCTION: acpi_ns_load_table
@ -159,7 +174,7 @@ acpi_ns_load_table (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_load_table_by_type ( acpi_ns_load_table_by_type (
acpi_table_type table_type) acpi_table_type table_type)
{ {
@ -321,8 +336,7 @@ acpi_ns_load_namespace (
} }
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_IMPLEMENTATION
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_delete_subtree * FUNCTION: acpi_ns_delete_subtree
@ -339,7 +353,7 @@ acpi_ns_load_namespace (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ns_delete_subtree ( acpi_ns_delete_subtree (
acpi_handle start_handle) acpi_handle start_handle)
{ {
@ -453,8 +467,6 @@ acpi_ns_unload_namespace (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
#endif
#endif /* ACPI_FUTURE_USAGE */
#endif #endif

View File

@ -50,6 +50,14 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsnames") ACPI_MODULE_NAME ("nsnames")
/* Local prototypes */
static void
acpi_ns_build_external_path (
struct acpi_namespace_node *node,
acpi_size size,
char *name_buffer);
/******************************************************************************* /*******************************************************************************
* *
@ -66,7 +74,7 @@
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ns_build_external_path ( acpi_ns_build_external_path (
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
acpi_size size, acpi_size size,
@ -126,7 +134,7 @@ acpi_ns_build_external_path (
* *
* FUNCTION: acpi_ns_get_external_pathname * FUNCTION: acpi_ns_get_external_pathname
* *
* PARAMETERS: Node - NS node whose pathname is needed * PARAMETERS: Node - Namespace node whose pathname is needed
* *
* RETURN: Pointer to storage containing the fully qualified name of * RETURN: Pointer to storage containing the fully qualified name of
* the node, In external format (name segments separated by path * the node, In external format (name segments separated by path

View File

@ -60,6 +60,8 @@
* Type - Type of object, or ACPI_TYPE_ANY if not * Type - Type of object, or ACPI_TYPE_ANY if not
* known * known
* *
* RETURN: Status
*
* DESCRIPTION: Record the given object as the value associated with the * DESCRIPTION: Record the given object as the value associated with the
* name whose acpi_handle is passed. If Object is NULL * name whose acpi_handle is passed. If Object is NULL
* and Type is ACPI_TYPE_ANY, set the name as having no value. * and Type is ACPI_TYPE_ANY, set the name as having no value.
@ -97,7 +99,8 @@ acpi_ns_attach_object (
if (!object && (ACPI_TYPE_ANY != type)) { if (!object && (ACPI_TYPE_ANY != type)) {
/* Null object */ /* Null object */
ACPI_REPORT_ERROR (("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n")); ACPI_REPORT_ERROR ((
"ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER); return_ACPI_STATUS (AE_BAD_PARAMETER);
} }
@ -112,7 +115,8 @@ acpi_ns_attach_object (
/* Check if this object is already attached */ /* Check if this object is already attached */
if (node->object == object) { if (node->object == object) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in name_obj %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Obj %p already installed in name_obj %p\n",
object, node)); object, node));
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
@ -192,7 +196,7 @@ acpi_ns_attach_object (
* *
* FUNCTION: acpi_ns_detach_object * FUNCTION: acpi_ns_detach_object
* *
* PARAMETERS: Node - An node whose object will be detached * PARAMETERS: Node - A Namespace node whose object will be detached
* *
* RETURN: None. * RETURN: None.
* *
@ -248,7 +252,7 @@ acpi_ns_detach_object (
* *
* FUNCTION: acpi_ns_get_attached_object * FUNCTION: acpi_ns_get_attached_object
* *
* PARAMETERS: Node - Parent Node to be examined * PARAMETERS: Node - Namespace node
* *
* RETURN: Current value of the object field from the Node whose * RETURN: Current value of the object field from the Node whose
* handle is passed * handle is passed
@ -284,7 +288,7 @@ acpi_ns_get_attached_object (
* *
* FUNCTION: acpi_ns_get_secondary_object * FUNCTION: acpi_ns_get_secondary_object
* *
* PARAMETERS: Node - Parent Node to be examined * PARAMETERS: Node - Namespace node
* *
* RETURN: Current value of the object field from the Node whose * RETURN: Current value of the object field from the Node whose
* handle is passed. * handle is passed.

View File

@ -49,15 +49,24 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nssearch") ACPI_MODULE_NAME ("nssearch")
/* Local prototypes */
static acpi_status
acpi_ns_search_parent_tree (
u32 target_name,
struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_namespace_node **return_node);
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_search_node * FUNCTION: acpi_ns_search_node
* *
* PARAMETERS: *target_name - Ascii ACPI name to search for * PARAMETERS: target_name - Ascii ACPI name to search for
* *Node - Starting node where search will begin * Node - Starting node where search will begin
* Type - Object type to match * Type - Object type to match
* **return_node - Where the matched Named obj is returned * return_node - Where the matched Named obj is returned
* *
* RETURN: Status * RETURN: Status
* *
@ -163,10 +172,10 @@ acpi_ns_search_node (
* *
* FUNCTION: acpi_ns_search_parent_tree * FUNCTION: acpi_ns_search_parent_tree
* *
* PARAMETERS: *target_name - Ascii ACPI name to search for * PARAMETERS: target_name - Ascii ACPI name to search for
* *Node - Starting node where search will begin * Node - Starting node where search will begin
* Type - Object type to match * Type - Object type to match
* **return_node - Where the matched Node is returned * return_node - Where the matched Node is returned
* *
* RETURN: Status * RETURN: Status
* *
@ -257,12 +266,12 @@ acpi_ns_search_parent_tree (
* *
* PARAMETERS: target_name - Ascii ACPI name to search for (4 chars) * PARAMETERS: target_name - Ascii ACPI name to search for (4 chars)
* walk_state - Current state of the walk * walk_state - Current state of the walk
* *Node - Starting node where search will begin * Node - Starting node where search will begin
* interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x. * interpreter_mode - Add names only in ACPI_MODE_LOAD_PASS_x.
* Otherwise,search only. * Otherwise,search only.
* Type - Object type to match * Type - Object type to match
* Flags - Flags describing the search restrictions * Flags - Flags describing the search restrictions
* **return_node - Where the Node is returned * return_node - Where the Node is returned
* *
* RETURN: Status * RETURN: Status
* *

View File

@ -51,6 +51,18 @@
#define _COMPONENT ACPI_NAMESPACE #define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsutils") ACPI_MODULE_NAME ("nsutils")
/* Local prototypes */
static u8
acpi_ns_valid_path_separator (
char sep);
#ifdef ACPI_OBSOLETE_FUNCTIONS
acpi_name
acpi_ns_find_parent_name (
struct acpi_namespace_node *node_to_search);
#endif
/******************************************************************************* /*******************************************************************************
* *
@ -59,7 +71,8 @@
* PARAMETERS: module_name - Caller's module name (for error output) * PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output) * line_number - Caller's line number (for error output)
* component_id - Caller's component ID (for error output) * component_id - Caller's component ID (for error output)
* Message - Error message to use on failure * internal_name - Name or path of the namespace node
* lookup_status - Exception code from NS lookup
* *
* RETURN: None * RETURN: None
* *
@ -121,6 +134,9 @@ acpi_ns_report_error (
* line_number - Caller's line number (for error output) * line_number - Caller's line number (for error output)
* component_id - Caller's component ID (for error output) * component_id - Caller's component ID (for error output)
* Message - Error message to use on failure * Message - Error message to use on failure
* prefix_node - Prefix relative to the path
* Path - Path to the node
* method_status - Execution status
* *
* RETURN: None * RETURN: None
* *
@ -162,7 +178,7 @@ acpi_ns_report_method_error (
* FUNCTION: acpi_ns_print_node_pathname * FUNCTION: acpi_ns_print_node_pathname
* *
* PARAMETERS: Node - Object * PARAMETERS: Node - Object
* Msg - Prefix message * Message - Prefix message
* *
* DESCRIPTION: Print an object's full namespace pathname * DESCRIPTION: Print an object's full namespace pathname
* Manages allocation/freeing of a pathname buffer * Manages allocation/freeing of a pathname buffer
@ -172,7 +188,7 @@ acpi_ns_report_method_error (
void void
acpi_ns_print_node_pathname ( acpi_ns_print_node_pathname (
struct acpi_namespace_node *node, struct acpi_namespace_node *node,
char *msg) char *message)
{ {
struct acpi_buffer buffer; struct acpi_buffer buffer;
acpi_status status; acpi_status status;
@ -189,8 +205,8 @@ acpi_ns_print_node_pathname (
status = acpi_ns_handle_to_pathname (node, &buffer); status = acpi_ns_handle_to_pathname (node, &buffer);
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
if (msg) { if (message) {
acpi_os_printf ("%s ", msg); acpi_os_printf ("%s ", message);
} }
acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node); acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
@ -232,7 +248,7 @@ acpi_ns_valid_root_prefix (
* *
******************************************************************************/ ******************************************************************************/
u8 static u8
acpi_ns_valid_path_separator ( acpi_ns_valid_path_separator (
char sep) char sep)
{ {
@ -245,10 +261,12 @@ acpi_ns_valid_path_separator (
* *
* FUNCTION: acpi_ns_get_type * FUNCTION: acpi_ns_get_type
* *
* PARAMETERS: Handle - Parent Node to be examined * PARAMETERS: Node - Parent Node to be examined
* *
* RETURN: Type field from Node whose handle is passed * RETURN: Type field from Node whose handle is passed
* *
* DESCRIPTION: Return the type of a Namespace node
*
******************************************************************************/ ******************************************************************************/
acpi_object_type acpi_object_type
@ -276,6 +294,8 @@ acpi_ns_get_type (
* RETURN: LOCAL if names must be found locally in objects of the * RETURN: LOCAL if names must be found locally in objects of the
* passed type, 0 if enclosing scopes should be searched * passed type, 0 if enclosing scopes should be searched
* *
* DESCRIPTION: Returns scope rule for the given object type.
*
******************************************************************************/ ******************************************************************************/
u32 u32
@ -303,7 +323,7 @@ acpi_ns_local (
* PARAMETERS: Info - Info struct initialized with the * PARAMETERS: Info - Info struct initialized with the
* external name pointer. * external name pointer.
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Calculate the length of the internal (AML) namestring * DESCRIPTION: Calculate the length of the internal (AML) namestring
* corresponding to the external (ASL) namestring. * corresponding to the external (ASL) namestring.
@ -551,14 +571,16 @@ acpi_ns_internalize_name (
* *
* FUNCTION: acpi_ns_externalize_name * FUNCTION: acpi_ns_externalize_name
* *
* PARAMETERS: *internal_name - Internal representation of name * PARAMETERS: internal_name_length - Lenth of the internal name below
* **converted_name - Where to return the resulting * internal_name - Internal representation of name
* external representation of name * converted_name_length - Where the length is returned
* converted_name - Where the resulting external name
* is returned
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
* to its external form (e.g. "\_PR_.CPU0") * to its external (printable) form (e.g. "\_PR_.CPU0")
* *
******************************************************************************/ ******************************************************************************/
@ -717,8 +739,9 @@ acpi_ns_externalize_name (
* *
* DESCRIPTION: Convert a namespace handle to a real Node * DESCRIPTION: Convert a namespace handle to a real Node
* *
* Note: Real integer handles allow for more verification * Note: Real integer handles would allow for more verification
* and keep all pointers within this subsystem. * and keep all pointers within this subsystem - however this introduces
* more (and perhaps unnecessary) overhead.
* *
******************************************************************************/ ******************************************************************************/
@ -775,7 +798,7 @@ acpi_ns_convert_entry_to_handle (
return ((acpi_handle) node); return ((acpi_handle) node);
/* --------------------------------------------------- /* Example future implementation ---------------------
if (!Node) if (!Node)
{ {
@ -801,12 +824,13 @@ acpi_ns_convert_entry_to_handle (
* *
* RETURN: none * RETURN: none
* *
* DESCRIPTION: free memory allocated for table storage. * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
* *
******************************************************************************/ ******************************************************************************/
void void
acpi_ns_terminate (void) acpi_ns_terminate (
void)
{ {
union acpi_operand_object *obj_desc; union acpi_operand_object *obj_desc;
@ -940,7 +964,6 @@ acpi_ns_get_node_by_path (
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
cleanup: cleanup:
/* Cleanup */
if (internal_path) { if (internal_path) {
ACPI_MEM_FREE (internal_path); ACPI_MEM_FREE (internal_path);
} }
@ -948,6 +971,74 @@ cleanup:
} }
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_parent_node
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Parent entry of the given entry
*
* DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_parent_node (
struct acpi_namespace_node *node)
{
ACPI_FUNCTION_ENTRY ();
if (!node) {
return (NULL);
}
/*
* Walk to the end of this peer list. The last entry is marked with a flag
* and the peer pointer is really a pointer back to the parent. This saves
* putting a parent back pointer in each and every named object!
*/
while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
node = node->peer;
}
return (node->peer);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_next_valid_node
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Next valid Node in the linked node list. NULL if no more valid
* nodes.
*
* DESCRIPTION: Find the next valid node within a name table.
* Useful for implementing NULL-end-of-list loops.
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_next_valid_node (
struct acpi_namespace_node *node)
{
/* If we are at the end of this peer list, return NULL */
if (node->flags & ANOBJ_END_OF_PEER_LIST) {
return NULL;
}
/* Otherwise just return the next peer */
return (node->peer);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ns_find_parent_name * FUNCTION: acpi_ns_find_parent_name
@ -961,7 +1052,7 @@ cleanup:
* (which "should not happen"). * (which "should not happen").
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_name acpi_name
acpi_ns_find_parent_name ( acpi_ns_find_parent_name (
struct acpi_namespace_node *child_node) struct acpi_namespace_node *child_node)
@ -997,73 +1088,3 @@ acpi_ns_find_parent_name (
#endif #endif
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_parent_node
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Parent entry of the given entry
*
* DESCRIPTION: Obtain the parent entry for a given entry in the namespace.
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_parent_node (
struct acpi_namespace_node *node)
{
ACPI_FUNCTION_ENTRY ();
if (!node) {
return (NULL);
}
/*
* Walk to the end of this peer list. The last entry is marked with a flag
* and the peer pointer is really a pointer back to the parent. This saves
* putting a parent back pointer in each and every named object!
*/
while (!(node->flags & ANOBJ_END_OF_PEER_LIST)) {
node = node->peer;
}
return (node->peer);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_next_valid_node
*
* PARAMETERS: Node - Current table entry
*
* RETURN: Next valid Node in the linked node list. NULL if no more valid
* nodes.
*
* DESCRIPTION: Find the next valid node within a name table.
* Useful for implementing NULL-end-of-list loops.
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_next_valid_node (
struct acpi_namespace_node *node)
{
/* If we are at the end of this peer list, return NULL */
if (node->flags & ANOBJ_END_OF_PEER_LIST) {
return NULL;
}
/* Otherwise just return the next peer */
return (node->peer);
}

View File

@ -58,11 +58,11 @@
* FUNCTION: acpi_evaluate_object_typed * FUNCTION: acpi_evaluate_object_typed
* *
* PARAMETERS: Handle - Object handle (optional) * PARAMETERS: Handle - Object handle (optional)
* *Pathname - Object pathname (optional) * Pathname - Object pathname (optional)
* **external_params - List of parameters to pass to method, * external_params - List of parameters to pass to method,
* terminated by NULL. May be NULL * terminated by NULL. May be NULL
* if no parameters are being passed. * if no parameters are being passed.
* *return_buffer - Where to put method's return value (if * return_buffer - Where to put method's return value (if
* any). If NULL, no value is returned. * any). If NULL, no value is returned.
* return_type - Expected type of return object * return_type - Expected type of return object
* *
@ -73,6 +73,7 @@
* be valid (non-null) * be valid (non-null)
* *
******************************************************************************/ ******************************************************************************/
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
acpi_status acpi_status
acpi_evaluate_object_typed ( acpi_evaluate_object_typed (
@ -307,7 +308,8 @@ acpi_evaluate_object (
if (ACPI_SUCCESS (status)) { if (ACPI_SUCCESS (status)) {
/* Validate/Allocate/Clear caller buffer */ /* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer (return_buffer, buffer_space_needed); status = acpi_ut_initialize_buffer (return_buffer,
buffer_space_needed);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
/* /*
* Caller's buffer is too small or a new one can't be allocated * Caller's buffer is too small or a new one can't be allocated
@ -423,7 +425,8 @@ acpi_walk_namespace (
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
status = acpi_ns_walk_namespace (type, start_object, max_depth, ACPI_NS_WALK_UNLOCK, status = acpi_ns_walk_namespace (type, start_object, max_depth,
ACPI_NS_WALK_UNLOCK,
user_function, context, return_value); user_function, context, return_value);
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
@ -525,7 +528,8 @@ acpi_ns_get_device_callback (
} }
} }
status = info->user_function (obj_handle, nesting_level, info->context, return_value); status = info->user_function (obj_handle, nesting_level, info->context,
return_value);
return (status); return (status);
} }

View File

@ -57,9 +57,9 @@
* FUNCTION: acpi_get_handle * FUNCTION: acpi_get_handle
* *
* PARAMETERS: Parent - Object to search under (search scope). * PARAMETERS: Parent - Object to search under (search scope).
* path_name - Pointer to an asciiz string containing the * Pathname - Pointer to an asciiz string containing the
* name * name
* ret_handle - Where the return handle is placed * ret_handle - Where the return handle is returned
* *
* RETURN: Status * RETURN: Status
* *
@ -220,7 +220,7 @@ EXPORT_SYMBOL(acpi_get_name);
* FUNCTION: acpi_get_object_info * FUNCTION: acpi_get_object_info
* *
* PARAMETERS: Handle - Object Handle * PARAMETERS: Handle - Object Handle
* Info - Where the info is returned * Buffer - Where the info is returned
* *
* RETURN: Status * RETURN: Status
* *

View File

@ -56,7 +56,7 @@
* FUNCTION: acpi_get_type * FUNCTION: acpi_get_type
* *
* PARAMETERS: Handle - Handle of object whose type is desired * PARAMETERS: Handle - Handle of object whose type is desired
* *ret_type - Where the type will be placed * ret_type - Where the type will be placed
* *
* RETURN: Status * RETURN: Status
* *
@ -258,5 +258,5 @@ unlock_and_exit:
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); (void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
return (status); return (status);
} }
EXPORT_SYMBOL(acpi_get_next_object);
EXPORT_SYMBOL(acpi_get_next_object);

View File

@ -71,6 +71,9 @@ EXPORT_SYMBOL(acpi_in_debugger);
extern char line_buf[80]; extern char line_buf[80];
#endif /*ENABLE_DEBUGGER*/ #endif /*ENABLE_DEBUGGER*/
int acpi_specific_hotkey_enabled;
EXPORT_SYMBOL(acpi_specific_hotkey_enabled);
static unsigned int acpi_irq_irq; static unsigned int acpi_irq_irq;
static acpi_osd_handler acpi_irq_handler; static acpi_osd_handler acpi_irq_handler;
static void *acpi_irq_context; static void *acpi_irq_context;
@ -1152,6 +1155,15 @@ acpi_wake_gpes_always_on_setup(char *str)
__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup); __setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
int __init
acpi_hotkey_setup(char *str)
{
acpi_specific_hotkey_enabled = TRUE;
return 1;
}
__setup("acpi_specific_hotkey", acpi_hotkey_setup);
/* /*
* max_cstate is defined in the base kernel so modules can * max_cstate is defined in the base kernel so modules can
* change it w/o depending on the state of the processor module. * change it w/o depending on the state of the processor module.

View File

@ -50,6 +50,16 @@
#define _COMPONENT ACPI_PARSER #define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psargs") ACPI_MODULE_NAME ("psargs")
/* Local prototypes */
static u32
acpi_ps_get_next_package_length (
struct acpi_parse_state *parser_state);
static union acpi_parse_object *
acpi_ps_get_next_field (
struct acpi_parse_state *parser_state);
/******************************************************************************* /*******************************************************************************
* *
@ -64,7 +74,7 @@
* *
******************************************************************************/ ******************************************************************************/
u32 static u32
acpi_ps_get_next_package_length ( acpi_ps_get_next_package_length (
struct acpi_parse_state *parser_state) struct acpi_parse_state *parser_state)
{ {
@ -78,7 +88,6 @@ acpi_ps_get_next_package_length (
encoded_length = (u32) ACPI_GET8 (parser_state->aml); encoded_length = (u32) ACPI_GET8 (parser_state->aml);
parser_state->aml++; parser_state->aml++;
switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ { switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
case 0: /* 1-byte encoding (bits 0-5) */ case 0: /* 1-byte encoding (bits 0-5) */
@ -287,13 +296,14 @@ acpi_ps_get_next_namepath (
* parent tree, but don't open a new scope -- we just want to lookup the * parent tree, but don't open a new scope -- we just want to lookup the
* object (MUST BE mode EXECUTE to perform upsearch) * object (MUST BE mode EXECUTE to perform upsearch)
*/ */
status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &node); ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &node);
if (ACPI_SUCCESS (status) && method_call) { if (ACPI_SUCCESS (status) && method_call) {
if (node->type == ACPI_TYPE_METHOD) { if (node->type == ACPI_TYPE_METHOD) {
/* /* This name is actually a control method invocation */
* This name is actually a control method invocation
*/
method_desc = acpi_ns_get_attached_object (node); method_desc = acpi_ns_get_attached_object (node);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Control Method - %p Desc %p Path=%p\n", "Control Method - %p Desc %p Path=%p\n",
@ -360,7 +370,7 @@ acpi_ps_get_next_namepath (
/* /*
* We got a NOT_FOUND during table load or we encountered * We got a NOT_FOUND during table load or we encountered
* a cond_ref_of(x) where the target does not exist. * a cond_ref_of(x) where the target does not exist.
* -- either case is ok * Either case is ok
*/ */
status = AE_OK; status = AE_OK;
} }
@ -486,11 +496,12 @@ acpi_ps_get_next_simple_arg (
* *
******************************************************************************/ ******************************************************************************/
union acpi_parse_object * static union acpi_parse_object *
acpi_ps_get_next_field ( acpi_ps_get_next_field (
struct acpi_parse_state *parser_state) struct acpi_parse_state *parser_state)
{ {
u32 aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, u32 aml_offset = (u32)
ACPI_PTR_DIFF (parser_state->aml,
parser_state->aml_start); parser_state->aml_start);
union acpi_parse_object *field; union acpi_parse_object *field;
u16 opcode; u16 opcode;
@ -500,7 +511,7 @@ acpi_ps_get_next_field (
ACPI_FUNCTION_TRACE ("ps_get_next_field"); ACPI_FUNCTION_TRACE ("ps_get_next_field");
/* determine field type */ /* Determine field type */
switch (ACPI_GET8 (parser_state->aml)) { switch (ACPI_GET8 (parser_state->aml)) {
default: default:
@ -521,7 +532,6 @@ acpi_ps_get_next_field (
break; break;
} }
/* Allocate a new field op */ /* Allocate a new field op */
field = acpi_ps_alloc_op (opcode); field = acpi_ps_alloc_op (opcode);
@ -582,10 +592,10 @@ acpi_ps_get_next_field (
* *
* FUNCTION: acpi_ps_get_next_arg * FUNCTION: acpi_ps_get_next_arg
* *
* PARAMETERS: parser_state - Current parser state object * PARAMETERS: walk_state - Current state
* parser_state - Current parser state object
* arg_type - The argument type (AML_*_ARG) * arg_type - The argument type (AML_*_ARG)
* arg_count - If the argument points to a control method * return_arg - Where the next arg is returned
* the method's argument is returned here.
* *
* RETURN: Status, and an op object containing the next argument. * RETURN: Status, and an op object containing the next argument.
* *
@ -619,7 +629,7 @@ acpi_ps_get_next_arg (
case ARGP_NAME: case ARGP_NAME:
case ARGP_NAMESTRING: case ARGP_NAMESTRING:
/* constants, strings, and namestrings are all the same size */ /* Constants, strings, and namestrings are all the same size */
arg = acpi_ps_alloc_op (AML_BYTE_OP); arg = acpi_ps_alloc_op (AML_BYTE_OP);
if (!arg) { if (!arg) {
@ -654,7 +664,6 @@ acpi_ps_get_next_arg (
else { else {
arg = field; arg = field;
} }
prev = field; prev = field;
} }
@ -677,8 +686,8 @@ acpi_ps_get_next_arg (
/* Fill in bytelist data */ /* Fill in bytelist data */
arg->common.value.size = (u32) ACPI_PTR_DIFF (parser_state->pkg_end, arg->common.value.size = (u32)
parser_state->aml); ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
arg->named.data = parser_state->aml; arg->named.data = parser_state->aml;
/* Skip to End of byte data */ /* Skip to End of byte data */
@ -706,7 +715,7 @@ acpi_ps_get_next_arg (
status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0); status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
} }
else { else {
/* single complex argument, nothing returned */ /* Single complex argument, nothing returned */
walk_state->arg_count = 1; walk_state->arg_count = 1;
} }
@ -716,7 +725,7 @@ acpi_ps_get_next_arg (
case ARGP_DATAOBJ: case ARGP_DATAOBJ:
case ARGP_TERMARG: case ARGP_TERMARG:
/* single complex argument, nothing returned */ /* Single complex argument, nothing returned */
walk_state->arg_count = 1; walk_state->arg_count = 1;
break; break;
@ -727,7 +736,7 @@ acpi_ps_get_next_arg (
case ARGP_OBJLIST: case ARGP_OBJLIST:
if (parser_state->aml < parser_state->pkg_end) { if (parser_state->aml < parser_state->pkg_end) {
/* non-empty list of variable arguments, nothing returned */ /* Non-empty list of variable arguments, nothing returned */
walk_state->arg_count = ACPI_VAR_ARGS; walk_state->arg_count = ACPI_VAR_ARGS;
} }

View File

@ -44,6 +44,7 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acparser.h> #include <acpi/acparser.h>
#include <acpi/acopcode.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
@ -51,23 +52,6 @@
ACPI_MODULE_NAME ("psopcode") ACPI_MODULE_NAME ("psopcode")
#define _UNK 0x6B
/*
* Reserved ASCII characters. Do not use any of these for
* internal opcodes, since they are used to differentiate
* name strings from AML opcodes
*/
#define _ASC 0x6C
#define _NAM 0x6C
#define _PFX 0x6D
#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
#define MAX_EXTENDED_OPCODE 0x88
#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
#define MAX_INTERNAL_OPCODE
#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
/******************************************************************************* /*******************************************************************************
* *
* NAME: acpi_gbl_aml_op_info * NAME: acpi_gbl_aml_op_info
@ -79,274 +63,9 @@
* *
******************************************************************************/ ******************************************************************************/
/*
* All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed
* into a 32-bit number and stored in the master opcode table at the end of this file.
*/
#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
#define ARGP_ARG0 ARG_NONE
#define ARGP_ARG1 ARG_NONE
#define ARGP_ARG2 ARG_NONE
#define ARGP_ARG3 ARG_NONE
#define ARGP_ARG4 ARG_NONE
#define ARGP_ARG5 ARG_NONE
#define ARGP_ARG6 ARG_NONE
#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BREAK_OP ARG_NONE
#define ARGP_BREAK_POINT_OP ARG_NONE
#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
#define ARGP_CONTINUE_OP ARG_NONE
#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_DEBUG_OP ARG_NONE
#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LOCAL0 ARG_NONE
#define ARGP_LOCAL1 ARG_NONE
#define ARGP_LOCAL2 ARG_NONE
#define ARGP_LOCAL3 ARG_NONE
#define ARGP_LOCAL4 ARG_NONE
#define ARGP_LOCAL5 ARG_NONE
#define ARGP_LOCAL6 ARG_NONE
#define ARGP_LOCAL7 ARG_NONE
#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_NOOP_OP ARG_NONE
#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
#define ARGP_ONE_OP ARG_NONE
#define ARGP_ONES_OP ARG_NONE
#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_REVISION_OP ARG_NONE
#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
#define ARGP_TIMER_OP ARG_NONE
#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
#define ARGP_ZERO_OP ARG_NONE
/*
* All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed
* into a 32-bit number and stored in the master opcode table at the end of this file.
*
* (Used by prep_operands procedure and the ASL Compiler)
*/
#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
#define ARGI_ARG0 ARG_NONE
#define ARGI_ARG1 ARG_NONE
#define ARGI_ARG2 ARG_NONE
#define ARGI_ARG3 ARG_NONE
#define ARGI_ARG4 ARG_NONE
#define ARGI_ARG5 ARG_NONE
#define ARGI_ARG6 ARG_NONE
#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BREAK_OP ARG_NONE
#define ARGI_BREAK_POINT_OP ARG_NONE
#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
#define ARGI_DEBUG_OP ARG_NONE
#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_IF_OP ARGI_INVALID_OPCODE
#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
#define ARGI_LOCAL0 ARG_NONE
#define ARGI_LOCAL1 ARG_NONE
#define ARGI_LOCAL2 ARG_NONE
#define ARGI_LOCAL3 ARG_NONE
#define ARGI_LOCAL4 ARG_NONE
#define ARGI_LOCAL5 ARG_NONE
#define ARGI_LOCAL6 ARG_NONE
#define ARGI_LOCAL7 ARG_NONE
#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
#define ARGI_NAME_OP ARGI_INVALID_OPCODE
#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
#define ARGI_NOOP_OP ARG_NONE
#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
#define ARGI_ONE_OP ARG_NONE
#define ARGI_ONES_OP ARG_NONE
#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
#define ARGI_REVISION_OP ARG_NONE
#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_TARGETREF)
#define ARGI_STRING_OP ARGI_INVALID_OPCODE
#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
#define ARGI_TIMER_OP ARG_NONE
#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
#define ARGI_WORD_OP ARGI_INVALID_OPCODE
#define ARGI_ZERO_OP ARG_NONE
/* /*
* Summary of opcode types/flags * Summary of opcode types/flags
*/ *
/******************************************************************************
Opcodes that have associated namespace objects (AML_NSOBJECT flag) Opcodes that have associated namespace objects (AML_NSOBJECT flag)
@ -464,10 +183,9 @@
/* /*
* Master Opcode information table. A summary of everything we know about each opcode, all in one place. * Master Opcode information table. A summary of everything we know about each
* opcode, all in one place.
*/ */
const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
{ {
/*! [Begin] no source code translation */ /*! [Begin] no source code translation */
@ -693,8 +411,7 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
* *
* PARAMETERS: Opcode - The AML opcode * PARAMETERS: Opcode - The AML opcode
* *
* RETURN: A pointer to the info about the opcode. NULL if the opcode was * RETURN: A pointer to the info about the opcode.
* not found in the table.
* *
* DESCRIPTION: Find AML opcode description based on the opcode. * DESCRIPTION: Find AML opcode description based on the opcode.
* NOTE: This procedure must ALWAYS return a valid pointer! * NOTE: This procedure must ALWAYS return a valid pointer!
@ -731,7 +448,8 @@ acpi_ps_get_opcode_info (
default: default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", opcode)); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown AML opcode [%4.4X]\n", opcode));
break; break;
} }

View File

@ -64,6 +64,23 @@
static u32 acpi_gbl_depth = 0; static u32 acpi_gbl_depth = 0;
/* Local prototypes */
static void
acpi_ps_complete_this_op (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
static acpi_status
acpi_ps_next_parse_state (
struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
acpi_status callback_status);
static acpi_status
acpi_ps_parse_loop (
struct acpi_walk_state *walk_state);
/******************************************************************************* /*******************************************************************************
* *
@ -100,7 +117,7 @@ acpi_ps_get_opcode_size (
* *
* PARAMETERS: parser_state - A parser state object * PARAMETERS: parser_state - A parser state object
* *
* RETURN: Status * RETURN: Next AML opcode
* *
* DESCRIPTION: Get next AML opcode (without incrementing AML pointer) * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
* *
@ -117,7 +134,6 @@ acpi_ps_peek_opcode (
aml = parser_state->aml; aml = parser_state->aml;
opcode = (u16) ACPI_GET8 (aml); opcode = (u16) ACPI_GET8 (aml);
if (opcode == AML_EXTOP) { if (opcode == AML_EXTOP) {
/* Extended opcode */ /* Extended opcode */
@ -142,7 +158,7 @@ acpi_ps_peek_opcode (
* *
******************************************************************************/ ******************************************************************************/
void static void
acpi_ps_complete_this_op ( acpi_ps_complete_this_op (
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
union acpi_parse_object *op) union acpi_parse_object *op)
@ -272,7 +288,6 @@ acpi_ps_complete_this_op (
next = NULL; next = NULL;
} }
} }
prev = next; prev = next;
} }
} }
@ -280,7 +295,7 @@ acpi_ps_complete_this_op (
cleanup: cleanup:
/* Now we can actually delete the subtree rooted at op */ /* Now we can actually delete the subtree rooted at Op */
acpi_ps_delete_parse_tree (op); acpi_ps_delete_parse_tree (op);
return_VOID; return_VOID;
@ -291,7 +306,9 @@ cleanup:
* *
* FUNCTION: acpi_ps_next_parse_state * FUNCTION: acpi_ps_next_parse_state
* *
* PARAMETERS: parser_state - Current parser state object * PARAMETERS: walk_state - Current state
* Op - Current parse op
* callback_status - Status from previous operation
* *
* RETURN: Status * RETURN: Status
* *
@ -300,7 +317,7 @@ cleanup:
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ps_next_parse_state ( acpi_ps_next_parse_state (
struct acpi_walk_state *walk_state, struct acpi_walk_state *walk_state,
union acpi_parse_object *op, union acpi_parse_object *op,
@ -382,9 +399,8 @@ acpi_ps_next_parse_state (
case AE_CTRL_TRANSFER: case AE_CTRL_TRANSFER:
/* /* A method call (invocation) -- transfer control */
* A method call (invocation) -- transfer control
*/
status = AE_CTRL_TRANSFER; status = AE_CTRL_TRANSFER;
walk_state->prev_op = op; walk_state->prev_op = op;
walk_state->method_call_op = op; walk_state->method_call_op = op;
@ -397,6 +413,7 @@ acpi_ps_next_parse_state (
default: default:
status = callback_status; status = callback_status;
if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) { if ((callback_status & AE_CODE_MASK) == AE_CODE_CONTROL) {
status = AE_OK; status = AE_OK;
@ -412,7 +429,7 @@ acpi_ps_next_parse_state (
* *
* FUNCTION: acpi_ps_parse_loop * FUNCTION: acpi_ps_parse_loop
* *
* PARAMETERS: parser_state - Current parser state object * PARAMETERS: walk_state - Current state
* *
* RETURN: Status * RETURN: Status
* *
@ -421,7 +438,7 @@ acpi_ps_next_parse_state (
* *
******************************************************************************/ ******************************************************************************/
acpi_status static acpi_status
acpi_ps_parse_loop ( acpi_ps_parse_loop (
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state)
{ {
@ -443,6 +460,7 @@ acpi_ps_parse_loop (
walk_state->arg_types = 0; walk_state->arg_types = 0;
#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) #if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) { if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
/* We are restarting a preempted control method */ /* We are restarting a preempted control method */
@ -471,7 +489,8 @@ acpi_ps_parse_loop (
acpi_format_exception (status))); acpi_format_exception (status)));
} }
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "get_predicate Failed, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"get_predicate Failed, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
} }
@ -492,9 +511,8 @@ acpi_ps_parse_loop (
} }
#endif #endif
/* /* Iterative parsing loop, while there is more AML to process: */
* Iterative parsing loop, while there is more aml to process:
*/
while ((parser_state->aml < parser_state->aml_end) || (op)) { while ((parser_state->aml < parser_state->aml_end) || (op)) {
aml_op_start = parser_state->aml; aml_op_start = parser_state->aml;
if (!op) { if (!op) {
@ -578,8 +596,10 @@ acpi_ps_parse_loop (
INCREMENT_ARG_LIST (walk_state->arg_types); INCREMENT_ARG_LIST (walk_state->arg_types);
} }
/* Make sure that we found a NAME and didn't run out of arguments */ /*
* Make sure that we found a NAME and didn't run out of
* arguments
*/
if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) { if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
status = AE_AML_NO_OPERAND; status = AE_AML_NO_OPERAND;
goto close_this_op; goto close_this_op;
@ -597,12 +617,13 @@ acpi_ps_parse_loop (
status = walk_state->descending_callback (walk_state, &op); status = walk_state->descending_callback (walk_state, &op);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"During name lookup/catalog, %s\n",
acpi_format_exception (status))); acpi_format_exception (status)));
goto close_this_op; goto close_this_op;
} }
if (op == NULL) { if (!op) {
continue; continue;
} }
@ -688,11 +709,15 @@ acpi_ps_parse_loop (
} }
/* Start arg_count at zero because we don't know if there are any args yet */ /*
* Start arg_count at zero because we don't know if there are
* any args yet
*/
walk_state->arg_count = 0; walk_state->arg_count = 0;
if (walk_state->arg_types) /* Are there any arguments that must be processed? */ { /* Are there any arguments that must be processed? */
if (walk_state->arg_types) {
/* Get arguments */ /* Get arguments */
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
@ -720,14 +745,18 @@ acpi_ps_parse_loop (
default: default:
/* Op is not a constant or string, append each argument to the Op */ /*
* Op is not a constant or string, append each argument
* to the Op
*/
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) && while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
!walk_state->arg_count) { !walk_state->arg_count) {
walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml, walk_state->aml_offset = (u32)
parser_state->aml_start); ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
status = acpi_ps_get_next_arg (walk_state, parser_state, status = acpi_ps_get_next_arg (walk_state, parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg); GET_CURRENT_ARG_TYPE (walk_state->arg_types),
&arg);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
goto close_this_op; goto close_this_op;
} }
@ -752,7 +781,8 @@ acpi_ps_parse_loop (
* Save the length and address of the body * Save the length and address of the body
*/ */
op->named.data = parser_state->aml; op->named.data = parser_state->aml;
op->named.length = (u32) (parser_state->pkg_end - parser_state->aml); op->named.length = (u32) (parser_state->pkg_end -
parser_state->aml);
/* Skip body of method */ /* Skip body of method */
@ -773,7 +803,8 @@ acpi_ps_parse_loop (
* to parse them correctly. * to parse them correctly.
*/ */
op->named.data = aml_op_start; op->named.data = aml_op_start;
op->named.length = (u32) (parser_state->pkg_end - aml_op_start); op->named.length = (u32) (parser_state->pkg_end -
aml_op_start);
/* Skip body */ /* Skip body */
@ -785,7 +816,8 @@ acpi_ps_parse_loop (
case AML_WHILE_OP: case AML_WHILE_OP:
if (walk_state->control_state) { if (walk_state->control_state) {
walk_state->control_state->control.package_end = parser_state->pkg_end; walk_state->control_state->control.package_end =
parser_state->pkg_end;
} }
break; break;
@ -801,8 +833,10 @@ acpi_ps_parse_loop (
/* Check for arguments that need to be processed */ /* Check for arguments that need to be processed */
if (walk_state->arg_count) { if (walk_state->arg_count) {
/* There are arguments (complex ones), push Op and prepare for argument */ /*
* There are arguments (complex ones), push Op and
* prepare for argument
*/
status = acpi_ps_push_scope (parser_state, op, status = acpi_ps_push_scope (parser_state, op,
walk_state->arg_types, walk_state->arg_count); walk_state->arg_types, walk_state->arg_count);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -812,8 +846,10 @@ acpi_ps_parse_loop (
continue; continue;
} }
/* All arguments have been processed -- Op is complete, prepare for next */ /*
* All arguments have been processed -- Op is complete,
* prepare for next
*/
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode); walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
if (walk_state->op_info->flags & AML_NAMED) { if (walk_state->op_info->flags & AML_NAMED) {
if (acpi_gbl_depth) { if (acpi_gbl_depth) {
@ -880,9 +916,8 @@ close_this_op:
case AE_CTRL_TRANSFER: case AE_CTRL_TRANSFER:
/* /* We are about to transfer to a called method. */
* We are about to transfer to a called method.
*/
walk_state->prev_op = op; walk_state->prev_op = op;
walk_state->prev_arg_types = walk_state->arg_types; walk_state->prev_arg_types = walk_state->arg_types;
return_ACPI_STATUS (status); return_ACPI_STATUS (status);
@ -1051,10 +1086,7 @@ close_this_op:
* *
* FUNCTION: acpi_ps_parse_aml * FUNCTION: acpi_ps_parse_aml
* *
* PARAMETERS: start_scope - The starting point of the parse. Becomes the * PARAMETERS: walk_state - Current state
* root of the parsed op tree.
* Aml - Pointer to the raw AML code to parse
* aml_size - Length of the AML to parse
* *
* *
* RETURN: Status * RETURN: Status
@ -1076,8 +1108,10 @@ acpi_ps_parse_aml (
ACPI_FUNCTION_TRACE ("ps_parse_aml"); ACPI_FUNCTION_TRACE ("ps_parse_aml");
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with walk_state=%p Aml=%p size=%X\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
walk_state, walk_state->parser_state.aml, walk_state->parser_state.aml_size)); "Entered with walk_state=%p Aml=%p size=%X\n",
walk_state, walk_state->parser_state.aml,
walk_state->parser_state.aml_size));
/* Create and initialize a new thread state */ /* Create and initialize a new thread state */
@ -1142,9 +1176,10 @@ acpi_ps_parse_aml (
if ((status == AE_ALREADY_EXISTS) && if ((status == AE_ALREADY_EXISTS) &&
(!walk_state->method_desc->method.semaphore)) { (!walk_state->method_desc->method.semaphore)) {
/* /*
* This method is marked not_serialized, but it tried to create a named * This method is marked not_serialized, but it tried to create
* object, causing the second thread entrance to fail. We will workaround * a named object, causing the second thread entrance to fail.
* this by marking the method permanently as Serialized. * We will workaround this by marking the method permanently
* as Serialized.
*/ */
walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED; walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
walk_state->method_desc->method.concurrency = 1; walk_state->method_desc->method.concurrency = 1;
@ -1187,7 +1222,8 @@ acpi_ps_parse_aml (
previous_walk_state = walk_state; previous_walk_state = walk_state;
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "return_value=%p, implicit_value=%p State=%p\n", ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"return_value=%p, implicit_value=%p State=%p\n",
walk_state->return_desc, walk_state->implicit_return_obj, walk_state)); walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
/* Check if we have restarted a preempted walk */ /* Check if we have restarted a preempted walk */
@ -1231,12 +1267,14 @@ acpi_ps_parse_aml (
*/ */
else if (previous_walk_state->caller_return_desc) { else if (previous_walk_state->caller_return_desc) {
if (previous_walk_state->implicit_return_obj) { if (previous_walk_state->implicit_return_obj) {
*(previous_walk_state->caller_return_desc) = previous_walk_state->implicit_return_obj; *(previous_walk_state->caller_return_desc) =
previous_walk_state->implicit_return_obj;
} }
else { else {
/* NULL if no return value */ /* NULL if no return value */
*(previous_walk_state->caller_return_desc) = previous_walk_state->return_desc; *(previous_walk_state->caller_return_desc) =
previous_walk_state->return_desc;
} }
} }
else { else {

View File

@ -65,6 +65,7 @@ union acpi_parse_object *
acpi_ps_get_parent_scope ( acpi_ps_get_parent_scope (
struct acpi_parse_state *parser_state) struct acpi_parse_state *parser_state)
{ {
return (parser_state->scope->parse_scope.op); return (parser_state->scope->parse_scope.op);
} }
@ -87,7 +88,9 @@ u8
acpi_ps_has_completed_scope ( acpi_ps_has_completed_scope (
struct acpi_parse_state *parser_state) struct acpi_parse_state *parser_state)
{ {
return ((u8) ((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
return ((u8)
((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
!parser_state->scope->parse_scope.arg_count))); !parser_state->scope->parse_scope.arg_count)));
} }
@ -178,12 +181,12 @@ acpi_ps_push_scope (
acpi_ut_push_generic_state (&parser_state->scope, scope); acpi_ut_push_generic_state (&parser_state->scope, scope);
if (arg_count == ACPI_VAR_ARGS) { if (arg_count == ACPI_VAR_ARGS) {
/* multiple arguments */ /* Multiple arguments */
scope->parse_scope.arg_end = parser_state->pkg_end; scope->parse_scope.arg_end = parser_state->pkg_end;
} }
else { else {
/* single argument */ /* Single argument */
scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR); scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
} }
@ -221,9 +224,8 @@ acpi_ps_pop_scope (
ACPI_FUNCTION_TRACE ("ps_pop_scope"); ACPI_FUNCTION_TRACE ("ps_pop_scope");
/* /* Only pop the scope if there is in fact a next scope */
* Only pop the scope if there is in fact a next scope
*/
if (scope->common.next) { if (scope->common.next) {
scope = acpi_ut_pop_generic_state (&parser_state->scope); scope = acpi_ut_pop_generic_state (&parser_state->scope);
@ -246,7 +248,8 @@ acpi_ps_pop_scope (
*arg_count = 0; *arg_count = 0;
} }
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *op, *arg_count)); ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Popped Op %p Args %X\n", *op, *arg_count));
return_VOID; return_VOID;
} }
@ -257,7 +260,7 @@ acpi_ps_pop_scope (
* *
* PARAMETERS: parser_state - Current parser state object * PARAMETERS: parser_state - Current parser state object
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Destroy available list, remaining stack levels, and return * DESCRIPTION: Destroy available list, remaining stack levels, and return
* root scope * root scope

View File

@ -49,6 +49,14 @@
#define _COMPONENT ACPI_PARSER #define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("pstree") ACPI_MODULE_NAME ("pstree")
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
union acpi_parse_object *
acpi_ps_get_child (
union acpi_parse_object *op);
#endif
/******************************************************************************* /*******************************************************************************
* *
@ -152,7 +160,6 @@ acpi_ps_append_arg (
return; return;
} }
/* Append the argument to the linked argument list */ /* Append the argument to the linked argument list */
if (op->common.value.arg) { if (op->common.value.arg) {
@ -164,14 +171,12 @@ acpi_ps_append_arg (
} }
prev_arg->common.next = arg; prev_arg->common.next = arg;
} }
else { else {
/* No argument list, this will be the first argument */ /* No argument list, this will be the first argument */
op->common.value.arg = arg; op->common.value.arg = arg;
} }
/* Set the parent in this arg and any args linked after it */ /* Set the parent in this arg and any args linked after it */
while (arg) { while (arg) {
@ -182,7 +187,82 @@ acpi_ps_append_arg (
#ifdef ACPI_FUTURE_USAGE #ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_depth_next
*
* PARAMETERS: Origin - Root of subtree to search
* Op - Last (previous) Op that was found
*
* RETURN: Next Op found in the search.
*
* DESCRIPTION: Get next op in tree (walking the tree in depth-first order)
* Return NULL when reaching "origin" or when walking up from root
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_get_depth_next (
union acpi_parse_object *origin,
union acpi_parse_object *op)
{
union acpi_parse_object *next = NULL;
union acpi_parse_object *parent;
union acpi_parse_object *arg;
ACPI_FUNCTION_ENTRY ();
if (!op) {
return (NULL);
}
/* Look for an argument or child */
next = acpi_ps_get_arg (op, 0);
if (next) {
return (next);
}
/* Look for a sibling */
next = op->common.next;
if (next) {
return (next);
}
/* Look for a sibling of parent */
parent = op->common.parent;
while (parent) {
arg = acpi_ps_get_arg (parent, 0);
while (arg && (arg != origin) && (arg != op)) {
arg = arg->common.next;
}
if (arg == origin) {
/* Reached parent of origin, end search */
return (NULL);
}
if (parent->common.next) {
/* Found sibling of parent */
return (parent->common.next);
}
op = parent;
parent = parent->common.parent;
}
return (next);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ps_get_child * FUNCTION: acpi_ps_get_child
@ -194,6 +274,7 @@ acpi_ps_append_arg (
* DESCRIPTION: Get op's children or NULL if none * DESCRIPTION: Get op's children or NULL if none
* *
******************************************************************************/ ******************************************************************************/
union acpi_parse_object * union acpi_parse_object *
acpi_ps_get_child ( acpi_ps_get_child (
union acpi_parse_object *op) union acpi_parse_object *op)
@ -247,81 +328,7 @@ acpi_ps_get_child (
return (child); return (child);
} }
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_depth_next
*
* PARAMETERS: Origin - Root of subtree to search
* Op - Last (previous) Op that was found
*
* RETURN: Next Op found in the search.
*
* DESCRIPTION: Get next op in tree (walking the tree in depth-first order)
* Return NULL when reaching "origin" or when walking up from root
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_get_depth_next (
union acpi_parse_object *origin,
union acpi_parse_object *op)
{
union acpi_parse_object *next = NULL;
union acpi_parse_object *parent;
union acpi_parse_object *arg;
ACPI_FUNCTION_ENTRY ();
if (!op) {
return (NULL);
}
/* look for an argument or child */
next = acpi_ps_get_arg (op, 0);
if (next) {
return (next);
}
/* look for a sibling */
next = op->common.next;
if (next) {
return (next);
}
/* look for a sibling of parent */
parent = op->common.parent;
while (parent) {
arg = acpi_ps_get_arg (parent, 0);
while (arg && (arg != origin) && (arg != op)) {
arg = arg->common.next;
}
if (arg == origin) {
/* reached parent of origin, end search */
return (NULL);
}
if (parent->common.next) {
/* found sibling of parent */
return (parent->common.next);
}
op = parent;
parent = parent->common.parent;
}
return (next);
}
#endif /* ACPI_FUTURE_USAGE */ #endif /* ACPI_FUTURE_USAGE */

View File

@ -45,7 +45,6 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acparser.h> #include <acpi/acparser.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_PARSER #define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psutils") ACPI_MODULE_NAME ("psutils")
@ -57,7 +56,7 @@
* *
* PARAMETERS: None * PARAMETERS: None
* *
* RETURN: scope_op * RETURN: A new Scope object, null on failure
* *
* DESCRIPTION: Create a Scope and associated namepath op with the root name * DESCRIPTION: Create a Scope and associated namepath op with the root name
* *
@ -75,7 +74,6 @@ acpi_ps_create_scope_op (
return (NULL); return (NULL);
} }
scope_op->named.name = ACPI_ROOT_NAME; scope_op->named.name = ACPI_ROOT_NAME;
return (scope_op); return (scope_op);
} }
@ -88,10 +86,9 @@ acpi_ps_create_scope_op (
* PARAMETERS: Op - A newly allocated Op object * PARAMETERS: Op - A newly allocated Op object
* Opcode - Opcode to store in the Op * Opcode - Opcode to store in the Op
* *
* RETURN: Status * RETURN: None
* *
* DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on * DESCRIPTION: Initialize a parse (Op) object
* opcode
* *
******************************************************************************/ ******************************************************************************/
@ -107,7 +104,8 @@ acpi_ps_init_op (
op->common.aml_opcode = opcode; op->common.aml_opcode = opcode;
ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name, ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
(acpi_ps_get_opcode_info (opcode))->name, sizeof (op->common.aml_op_name))); (acpi_ps_get_opcode_info (opcode))->name,
sizeof (op->common.aml_op_name)));
} }
@ -117,7 +115,7 @@ acpi_ps_init_op (
* *
* PARAMETERS: Opcode - Opcode that will be stored in the new Op * PARAMETERS: Opcode - Opcode that will be stored in the new Op
* *
* RETURN: Pointer to the new Op. * RETURN: Pointer to the new Op, null on failure
* *
* DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
* opcode. A cache of opcodes is available for the pure * opcode. A cache of opcodes is available for the pure
@ -275,7 +273,6 @@ acpi_ps_get_name (
union acpi_parse_object *op) union acpi_parse_object *op)
{ {
/* The "generic" object has no name associated with it */ /* The "generic" object has no name associated with it */
if (op->common.flags & ACPI_PARSEOP_GENERIC) { if (op->common.flags & ACPI_PARSEOP_GENERIC) {

View File

@ -90,17 +90,15 @@ acpi_ps_delete_parse_tree (
} }
} }
/* /* No more children, this Op is complete. */
* No more children, this Op is complete.
*/
next = op->common.next; next = op->common.next;
parent = op->common.parent; parent = op->common.parent;
acpi_ps_free_op (op); acpi_ps_free_op (op);
/* /* If we are back to the starting point, the walk is complete. */
* If we are back to the starting point, the walk is complete.
*/
if (op == subtree_root) { if (op == subtree_root) {
return_VOID; return_VOID;
} }
@ -111,5 +109,6 @@ acpi_ps_delete_parse_tree (
op = parent; op = parent;
} }
} }
return_VOID; return_VOID;
} }

View File

@ -57,13 +57,16 @@
* *
* FUNCTION: acpi_psx_execute * FUNCTION: acpi_psx_execute
* *
* PARAMETERS: Info->Node - A method object containing both the AML * PARAMETERS: Info - Method info block, contains:
* address and length. * Node - Method Node to execute
* **Params - List of parameters to pass to method, * Parameters - List of parameters to pass to the method,
* terminated by NULL. Params itself may be * terminated by NULL. Params itself may be
* NULL if no parameters are being passed. * NULL if no parameters are being passed.
* **return_obj_desc - Return object from execution of the * return_object - Where to put method's return value (if
* method. * any). If NULL, no value is returned.
* parameter_type - Type of Parameter list
* return_object - Where to put method's return value (if
* any). If NULL, no value is returned.
* *
* RETURN: Status * RETURN: Status
* *
@ -196,9 +199,8 @@ acpi_psx_execute (
goto cleanup3; goto cleanup3;
} }
/* /* The walk of the parse tree is where we actually execute the method */
* The walk of the parse tree is where we actually execute the method
*/
status = acpi_ps_parse_aml (walk_state); status = acpi_ps_parse_aml (walk_state);
goto cleanup2; /* Walk state already deleted */ goto cleanup2; /* Walk state already deleted */
@ -217,7 +219,8 @@ cleanup1:
for (i = 0; info->parameters[i]; i++) { for (i = 0; info->parameters[i]; i++) {
/* Ignore errors, just do them all */ /* Ignore errors, just do them all */
(void) acpi_ut_update_object_reference (info->parameters[i], REF_DECREMENT); (void) acpi_ut_update_object_reference (
info->parameters[i], REF_DECREMENT);
} }
} }

View File

@ -72,10 +72,12 @@ struct acpi_pci_link_irq {
u8 active; /* Current IRQ */ u8 active; /* Current IRQ */
u8 edge_level; /* All IRQs */ u8 edge_level; /* All IRQs */
u8 active_high_low; /* All IRQs */ u8 active_high_low; /* All IRQs */
u8 initialized;
u8 resource_type; u8 resource_type;
u8 possible_count; u8 possible_count;
u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE];
u8 initialized:1;
u8 suspend_resume:1;
u8 reserved:6;
}; };
struct acpi_pci_link { struct acpi_pci_link {
@ -530,6 +532,10 @@ static int acpi_pci_link_allocate(
ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); ACPI_FUNCTION_TRACE("acpi_pci_link_allocate");
if (link->irq.suspend_resume) {
acpi_pci_link_set(link, link->irq.active);
link->irq.suspend_resume = 0;
}
if (link->irq.initialized) if (link->irq.initialized)
return_VALUE(0); return_VALUE(0);
@ -713,38 +719,24 @@ end:
return_VALUE(result); return_VALUE(result);
} }
static int static int
acpi_pci_link_resume ( irqrouter_suspend(
struct acpi_pci_link *link) struct sys_device *dev,
{ u32 state)
ACPI_FUNCTION_TRACE("acpi_pci_link_resume");
if (link->irq.active && link->irq.initialized)
return_VALUE(acpi_pci_link_set(link, link->irq.active));
else
return_VALUE(0);
}
static int
irqrouter_resume(
struct sys_device *dev)
{ {
struct list_head *node = NULL; struct list_head *node = NULL;
struct acpi_pci_link *link = NULL; struct acpi_pci_link *link = NULL;
ACPI_FUNCTION_TRACE("irqrouter_resume"); ACPI_FUNCTION_TRACE("irqrouter_suspend");
list_for_each(node, &acpi_link.entries) { list_for_each(node, &acpi_link.entries) {
link = list_entry(node, struct acpi_pci_link, node); link = list_entry(node, struct acpi_pci_link, node);
if (!link) { if (!link) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
continue; continue;
} }
if (link->irq.active && link->irq.initialized)
acpi_pci_link_resume(link); link->irq.suspend_resume = 1;
} }
return_VALUE(0); return_VALUE(0);
} }
@ -812,8 +804,11 @@ static int __init acpi_irq_penalty_update(char *str, int used)
* There is no ISA_POSSIBLE weight, so we simply use * There is no ISA_POSSIBLE weight, so we simply use
* the (small) PCI_USING penalty. * the (small) PCI_USING penalty.
*/ */
void acpi_penalize_isa_irq(int irq) void acpi_penalize_isa_irq(int irq, int active)
{ {
if (active)
acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED;
else
acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING; acpi_irq_penalty[irq] += PIRQ_PENALTY_PCI_USING;
} }
@ -856,7 +851,7 @@ __setup("acpi_irq_balance", acpi_irq_balance_set);
static struct sysdev_class irqrouter_sysdev_class = { static struct sysdev_class irqrouter_sysdev_class = {
set_kset_name("irqrouter"), set_kset_name("irqrouter"),
.resume = irqrouter_resume, .suspend = irqrouter_suspend,
}; };

View File

@ -255,6 +255,43 @@ acpi_processor_errata (
} }
/* --------------------------------------------------------------------------
Common ACPI processor fucntions
-------------------------------------------------------------------------- */
/*
* _PDC is required for a BIOS-OS handshake for most of the newer
* ACPI processor features.
*/
int acpi_processor_set_pdc(struct acpi_processor *pr,
struct acpi_object_list *pdc_in)
{
acpi_status status = AE_OK;
u32 arg0_buf[3];
union acpi_object arg0 = {ACPI_TYPE_BUFFER};
struct acpi_object_list no_object = {1, &arg0};
struct acpi_object_list *pdc;
ACPI_FUNCTION_TRACE("acpi_processor_set_pdc");
arg0.buffer.length = 12;
arg0.buffer.pointer = (u8 *) arg0_buf;
arg0_buf[0] = ACPI_PDC_REVISION_ID;
arg0_buf[1] = 0;
arg0_buf[2] = 0;
pdc = (pdc_in) ? pdc_in : &no_object;
status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL);
if ((ACPI_FAILURE(status)) && (pdc_in))
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n"));
return_VALUE(status);
}
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
FS Interface (/proc) FS Interface (/proc)
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */

View File

@ -6,6 +6,8 @@
* Copyright (C) 2004 Dominik Brodowski <linux@brodo.de> * Copyright (C) 2004 Dominik Brodowski <linux@brodo.de>
* Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> * Copyright (C) 2004 Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
* - Added processor hotplug support * - Added processor hotplug support
* Copyright (C) 2005 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
* - Added support for C3 on SMP
* *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* *
@ -142,7 +144,7 @@ acpi_processor_power_activate (
switch (old->type) { switch (old->type) {
case ACPI_STATE_C3: case ACPI_STATE_C3:
/* Disable bus master reload */ /* Disable bus master reload */
if (new->type != ACPI_STATE_C3) if (new->type != ACPI_STATE_C3 && pr->flags.bm_check)
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK); acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0, ACPI_MTX_DO_NOT_LOCK);
break; break;
} }
@ -152,7 +154,7 @@ acpi_processor_power_activate (
switch (new->type) { switch (new->type) {
case ACPI_STATE_C3: case ACPI_STATE_C3:
/* Enable bus master reload */ /* Enable bus master reload */
if (old->type != ACPI_STATE_C3) if (old->type != ACPI_STATE_C3 && pr->flags.bm_check)
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK); acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1, ACPI_MTX_DO_NOT_LOCK);
break; break;
} }
@ -163,6 +165,9 @@ acpi_processor_power_activate (
} }
static atomic_t c3_cpu_count;
static void acpi_processor_idle (void) static void acpi_processor_idle (void)
{ {
struct acpi_processor *pr = NULL; struct acpi_processor *pr = NULL;
@ -297,8 +302,22 @@ static void acpi_processor_idle (void)
break; break;
case ACPI_STATE_C3: case ACPI_STATE_C3:
/* Disable bus master arbitration */
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK); if (pr->flags.bm_check) {
if (atomic_inc_return(&c3_cpu_count) ==
num_online_cpus()) {
/*
* All CPUs are trying to go to C3
* Disable bus master arbitration
*/
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1,
ACPI_MTX_DO_NOT_LOCK);
}
} else {
/* SMP with no shared cache... Invalidate cache */
ACPI_FLUSH_CPU_CACHE();
}
/* Get start time (ticks) */ /* Get start time (ticks) */
t1 = inl(acpi_fadt.xpm_tmr_blk.address); t1 = inl(acpi_fadt.xpm_tmr_blk.address);
/* Invoke C3 */ /* Invoke C3 */
@ -307,8 +326,12 @@ static void acpi_processor_idle (void)
t2 = inl(acpi_fadt.xpm_tmr_blk.address); t2 = inl(acpi_fadt.xpm_tmr_blk.address);
/* Get end time (ticks) */ /* Get end time (ticks) */
t2 = inl(acpi_fadt.xpm_tmr_blk.address); t2 = inl(acpi_fadt.xpm_tmr_blk.address);
if (pr->flags.bm_check) {
/* Enable bus master arbitration */ /* Enable bus master arbitration */
atomic_dec(&c3_cpu_count);
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK); acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_DO_NOT_LOCK);
}
/* Re-enable interrupts */ /* Re-enable interrupts */
local_irq_enable(); local_irq_enable();
/* Compute time (ticks) that we were actually asleep */ /* Compute time (ticks) that we were actually asleep */
@ -519,6 +542,29 @@ static int acpi_processor_get_power_info_fadt (struct acpi_processor *pr)
} }
static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr)
{
int i;
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1");
for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)
memset(pr->power.states, 0, sizeof(struct acpi_processor_cx));
/* if info is obtained from pblk/fadt, type equals state */
pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1;
pr->power.states[ACPI_STATE_C2].type = ACPI_STATE_C2;
pr->power.states[ACPI_STATE_C3].type = ACPI_STATE_C3;
/* the C0 state only exists as a filler in our array,
* and all processors need to support C1 */
pr->power.states[ACPI_STATE_C0].valid = 1;
pr->power.states[ACPI_STATE_C1].valid = 1;
return_VALUE(0);
}
static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
{ {
acpi_status status = 0; acpi_status status = 0;
@ -529,9 +575,6 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr)
ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst"); ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst");
if (errata.smp)
return_VALUE(-ENODEV);
if (nocst) if (nocst)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
@ -664,13 +707,6 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
return_VOID; return_VOID;
} }
/* We're (currently) only supporting C2 on UP */
else if (errata.smp) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C2 not supported in SMP mode\n"));
return_VOID;
}
/* /*
* Otherwise we've met all of our C2 requirements. * Otherwise we've met all of our C2 requirements.
* Normalize the C2 latency to expidite policy * Normalize the C2 latency to expidite policy
@ -686,6 +722,8 @@ static void acpi_processor_power_verify_c3(
struct acpi_processor *pr, struct acpi_processor *pr,
struct acpi_processor_cx *cx) struct acpi_processor_cx *cx)
{ {
static int bm_check_flag;
ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3"); ACPI_FUNCTION_TRACE("acpi_processor_get_power_verify_c3");
if (!cx->address) if (!cx->address)
@ -702,20 +740,6 @@ static void acpi_processor_power_verify_c3(
return_VOID; return_VOID;
} }
/* bus mastering control is necessary */
else if (!pr->flags.bm_control) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C3 support requires bus mastering control\n"));
return_VOID;
}
/* We're (currently) only supporting C2 on UP */
else if (errata.smp) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C3 not supported in SMP mode\n"));
return_VOID;
}
/* /*
* PIIX4 Erratum #18: We don't support C3 when Type-F (fast) * PIIX4 Erratum #18: We don't support C3 when Type-F (fast)
* DMA transfers are used by any ISA device to avoid livelock. * DMA transfers are used by any ISA device to avoid livelock.
@ -729,6 +753,39 @@ static void acpi_processor_power_verify_c3(
return_VOID; return_VOID;
} }
/* All the logic here assumes flags.bm_check is same across all CPUs */
if (!bm_check_flag) {
/* Determine whether bm_check is needed based on CPU */
acpi_processor_power_init_bm_check(&(pr->flags), pr->id);
bm_check_flag = pr->flags.bm_check;
} else {
pr->flags.bm_check = bm_check_flag;
}
if (pr->flags.bm_check) {
printk("Disabling BM access before entering C3\n");
/* bus mastering control is necessary */
if (!pr->flags.bm_control) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"C3 support requires bus mastering control\n"));
return_VOID;
}
} else {
printk("Invalidating cache before entering C3\n");
/*
* WBINVD should be set in fadt, for C3 state to be
* supported on when bm_check is not required.
*/
if (acpi_fadt.wb_invd != 1) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Cache invalidation should work properly"
" for C3 to be enabled on SMP systems\n"));
return_VOID;
}
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD,
0, ACPI_MTX_DO_NOT_LOCK);
}
/* /*
* Otherwise we've met all of our C3 requirements. * Otherwise we've met all of our C3 requirements.
* Normalize the C3 latency to expidite policy. Enable * Normalize the C3 latency to expidite policy. Enable
@ -737,7 +794,6 @@ static void acpi_processor_power_verify_c3(
*/ */
cx->valid = 1; cx->valid = 1;
cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency); cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
pr->flags.bm_check = 1;
return_VOID; return_VOID;
} }
@ -787,10 +843,7 @@ static int acpi_processor_get_power_info (
if ((result) || (acpi_processor_power_verify(pr) < 2)) { if ((result) || (acpi_processor_power_verify(pr) < 2)) {
result = acpi_processor_get_power_info_fadt(pr); result = acpi_processor_get_power_info_fadt(pr);
if (result) if (result)
return_VALUE(result); result = acpi_processor_get_power_info_default_c1(pr);
if (acpi_processor_power_verify(pr) < 2)
return_VALUE(-ENODEV);
} }
/* /*
@ -810,12 +863,11 @@ static int acpi_processor_get_power_info (
* CPU as being "idle manageable" * CPU as being "idle manageable"
*/ */
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
if (pr->power.states[i].valid) if (pr->power.states[i].valid) {
pr->power.count = i; pr->power.count = i;
if ((pr->power.states[i].valid) &&
(pr->power.states[i].type >= ACPI_STATE_C2))
pr->flags.power = 1; pr->flags.power = 1;
} }
}
return_VALUE(0); return_VALUE(0);
} }
@ -829,7 +881,7 @@ int acpi_processor_cst_has_changed (struct acpi_processor *pr)
if (!pr) if (!pr)
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
if (errata.smp || nocst) { if ( nocst) {
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
@ -929,7 +981,6 @@ static struct file_operations acpi_processor_power_fops = {
.release = single_release, .release = single_release,
}; };
int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device) int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *device)
{ {
acpi_status status = 0; acpi_status status = 0;
@ -946,7 +997,10 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
first_run++; first_run++;
} }
if (!errata.smp && (pr->id == 0) && acpi_fadt.cst_cnt && !nocst) { if (!pr)
return_VALUE(-EINVAL);
if (acpi_fadt.cst_cnt && !nocst) {
status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8); status = acpi_os_write_port(acpi_fadt.smi_cmd, acpi_fadt.cst_cnt, 8);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@ -954,6 +1008,8 @@ int acpi_processor_power_init(struct acpi_processor *pr, struct acpi_device *dev
} }
} }
acpi_processor_power_init_pdc(&(pr->power), pr->id);
acpi_processor_set_pdc(pr, pr->power.pdc);
acpi_processor_get_power_info(pr); acpi_processor_get_power_info(pr);
/* /*

View File

@ -165,37 +165,6 @@ void acpi_processor_ppc_exit(void) {
acpi_processor_ppc_status &= ~PPC_REGISTERED; acpi_processor_ppc_status &= ~PPC_REGISTERED;
} }
/*
* when registering a cpufreq driver with this ACPI processor driver, the
* _PCT and _PSS structures are read out and written into struct
* acpi_processor_performance.
*/
static int acpi_processor_set_pdc (struct acpi_processor *pr)
{
acpi_status status = AE_OK;
u32 arg0_buf[3];
union acpi_object arg0 = {ACPI_TYPE_BUFFER};
struct acpi_object_list no_object = {1, &arg0};
struct acpi_object_list *pdc;
ACPI_FUNCTION_TRACE("acpi_processor_set_pdc");
arg0.buffer.length = 12;
arg0.buffer.pointer = (u8 *) arg0_buf;
arg0_buf[0] = ACPI_PDC_REVISION_ID;
arg0_buf[1] = 0;
arg0_buf[2] = 0;
pdc = (pr->performance->pdc) ? pr->performance->pdc : &no_object;
status = acpi_evaluate_object(pr->handle, "_PDC", pdc, NULL);
if ((ACPI_FAILURE(status)) && (pr->performance->pdc))
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Error evaluating _PDC, using legacy perf. control...\n"));
return_VALUE(status);
}
static int static int
acpi_processor_get_performance_control ( acpi_processor_get_performance_control (
@ -357,7 +326,7 @@ acpi_processor_get_performance_info (
if (!pr || !pr->performance || !pr->handle) if (!pr || !pr->performance || !pr->handle)
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
acpi_processor_set_pdc(pr); acpi_processor_set_pdc(pr, pr->performance->pdc);
status = acpi_get_handle(pr->handle, "_PCT", &handle); status = acpi_get_handle(pr->handle, "_PCT", &handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {

View File

@ -77,21 +77,21 @@ acpi_rs_address16_resource (
u8 **output_buffer, u8 **output_buffer,
acpi_size *structure_size) acpi_size *structure_size)
{ {
u8 *buffer = byte_stream_buffer;
struct acpi_resource *output_struct = (void *) *output_buffer;
u8 *temp_ptr;
acpi_size struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16);
u32 index; u32 index;
u16 temp16; u16 temp16;
u8 temp8; u8 temp8;
u8 *temp_ptr;
u8 *buffer = byte_stream_buffer;
struct acpi_resource *output_struct = (void *) *output_buffer;
acpi_size struct_size = ACPI_SIZEOF_RESOURCE (
struct acpi_resource_address16);
ACPI_FUNCTION_TRACE ("rs_address16_resource"); ACPI_FUNCTION_TRACE ("rs_address16_resource");
/* /* Point past the Descriptor to get the number of bytes consumed */
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1; buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer); ACPI_MOVE_16_TO_16 (&temp16, buffer);
@ -104,9 +104,8 @@ acpi_rs_address16_resource (
*bytes_consumed = temp16 + 3; *bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS16; output_struct->id = ACPI_RSTYPE_ADDRESS16;
/* /* Get the Resource Type (Byte3) */
* Get the Resource Type (Byte3)
*/
buffer += 2; buffer += 2;
temp8 = *buffer; temp8 = *buffer;
@ -118,9 +117,8 @@ acpi_rs_address16_resource (
output_struct->data.address16.resource_type = temp8; output_struct->data.address16.resource_type = temp8;
/* /* Get the General Flags (Byte4) */
* Get the General Flags (Byte4)
*/
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
@ -140,9 +138,8 @@ acpi_rs_address16_resource (
output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01; output_struct->data.address16.max_address_fixed = (temp8 >> 3) & 0x01;
/* /* Get the Type Specific Flags (Byte5) */
* Get the Type Specific Flags (Byte5)
*/
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
@ -165,39 +162,34 @@ acpi_rs_address16_resource (
} }
} }
/* /* Get Granularity (Bytes 6-7) */
* Get Granularity (Bytes 6-7)
*/
buffer += 1; buffer += 1;
ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer); ACPI_MOVE_16_TO_32 (&output_struct->data.address16.granularity, buffer);
/* /* Get min_address_range (Bytes 8-9) */
* Get min_address_range (Bytes 8-9)
*/
buffer += 2; buffer += 2;
ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer); ACPI_MOVE_16_TO_32 (&output_struct->data.address16.min_address_range, buffer);
/* /* Get max_address_range (Bytes 10-11) */
* Get max_address_range (Bytes 10-11)
*/
buffer += 2; buffer += 2;
ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer); ACPI_MOVE_16_TO_32 (&output_struct->data.address16.max_address_range, buffer);
/* /* Get address_translation_offset (Bytes 12-13) */
* Get address_translation_offset (Bytes 12-13)
*/ buffer += 2;
buffer += 2; ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset,
ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_translation_offset, buffer); buffer);
/* Get address_length (Bytes 14-15) */
/*
* Get address_length (Bytes 14-15)
*/
buffer += 2; buffer += 2;
ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer); ACPI_MOVE_16_TO_32 (&output_struct->data.address16.address_length, buffer);
/* /* Resource Source Index (if present) */
* Resource Source Index (if present)
*/
buffer += 2; buffer += 2;
/* /*
@ -225,7 +217,8 @@ acpi_rs_address16_resource (
output_struct->data.address16.resource_source.string_ptr = output_struct->data.address16.resource_source.string_ptr =
(char *)((u8 * )output_struct + struct_size); (char *)((u8 * )output_struct + struct_size);
temp_ptr = (u8 *) output_struct->data.address16.resource_source.string_ptr; temp_ptr = (u8 *)
output_struct->data.address16.resource_source.string_ptr;
/* Copy the string into the buffer */ /* Copy the string into the buffer */
@ -239,9 +232,8 @@ acpi_rs_address16_resource (
index += 1; index += 1;
} }
/* /* Add the terminating null */
* Add the terminating null
*/
*temp_ptr = 0x00; *temp_ptr = 0x00;
output_struct->data.address16.resource_source.string_length = index + 1; output_struct->data.address16.resource_source.string_length = index + 1;
@ -260,14 +252,12 @@ acpi_rs_address16_resource (
output_struct->data.address16.resource_source.string_ptr = NULL; output_struct->data.address16.resource_source.string_ptr = NULL;
} }
/* /* Set the Length parameter */
* Set the Length parameter
*/
output_struct->length = (u32) struct_size; output_struct->length = (u32) struct_size;
/* /* Return the final size of the structure */
* Return the final size of the structure
*/
*structure_size = struct_size; *structure_size = struct_size;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -305,28 +295,24 @@ acpi_rs_address16_stream (
ACPI_FUNCTION_TRACE ("rs_address16_stream"); ACPI_FUNCTION_TRACE ("rs_address16_stream");
/* /* The descriptor field is static */
* The descriptor field is static
*/
*buffer = 0x88; *buffer = 0x88;
buffer += 1; buffer += 1;
/* /* Save a pointer to the Length field - to be filled in later */
* Save a pointer to the Length field - to be filled in later
*/
length_field = buffer; length_field = buffer;
buffer += 2; buffer += 2;
/* /* Set the Resource Type (Memory, Io, bus_number) */
* Set the Resource Type (Memory, Io, bus_number)
*/
temp8 = (u8) (linked_list->data.address16.resource_type & 0x03); temp8 = (u8) (linked_list->data.address16.resource_type & 0x03);
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the general flags */
* Set the general flags
*/
temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01); temp8 = (u8) (linked_list->data.address16.producer_consumer & 0x01);
temp8 |= (linked_list->data.address16.decode & 0x01) << 1; temp8 |= (linked_list->data.address16.decode & 0x01) << 1;
@ -336,9 +322,8 @@ acpi_rs_address16_stream (
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the type specific flags */
* Set the type specific flags
*/
temp8 = 0; temp8 = 0;
if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) { if (ACPI_MEMORY_RANGE == linked_list->data.address16.resource_type) {
@ -362,39 +347,34 @@ acpi_rs_address16_stream (
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the address space granularity */
* Set the address space granularity
*/
ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity); ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.granularity);
buffer += 2; buffer += 2;
/* /* Set the address range minimum */
* Set the address range minimum
*/
ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range); ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.min_address_range);
buffer += 2; buffer += 2;
/* /* Set the address range maximum */
* Set the address range maximum
*/
ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range); ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.max_address_range);
buffer += 2; buffer += 2;
/* /* Set the address translation offset */
* Set the address translation offset
*/ ACPI_MOVE_32_TO_16 (buffer,
ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_translation_offset); &linked_list->data.address16.address_translation_offset);
buffer += 2; buffer += 2;
/* /* Set the address length */
* Set the address length
*/
ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length); ACPI_MOVE_32_TO_16 (buffer, &linked_list->data.address16.address_length);
buffer += 2; buffer += 2;
/* /* Resource Source Index and Resource Source are optional */
* Resource Source Index and Resource Source are optional
*/
if (0 != linked_list->data.address16.resource_source.string_length) { if (0 != linked_list->data.address16.resource_source.string_length) {
temp8 = (u8) linked_list->data.address16.resource_source.index; temp8 = (u8) linked_list->data.address16.resource_source.index;
@ -403,9 +383,8 @@ acpi_rs_address16_stream (
temp_pointer = (char *) buffer; temp_pointer = (char *) buffer;
/* /* Copy the string */
* Copy the string
*/
ACPI_STRCPY (temp_pointer, ACPI_STRCPY (temp_pointer,
linked_list->data.address16.resource_source.string_ptr); linked_list->data.address16.resource_source.string_ptr);
@ -413,12 +392,12 @@ acpi_rs_address16_stream (
* Buffer needs to be set to the length of the sting + one for the * Buffer needs to be set to the length of the sting + one for the
* terminating null * terminating null
*/ */
buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address16.resource_source.string_ptr) + 1); buffer += (acpi_size)(ACPI_STRLEN (
linked_list->data.address16.resource_source.string_ptr) + 1);
} }
/* /* Return the number of bytes consumed in this operation */
* Return the number of bytes consumed in this operation
*/
actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer); actual_bytes = ACPI_PTR_DIFF (buffer, *output_buffer);
*bytes_consumed = actual_bytes; *bytes_consumed = actual_bytes;
@ -475,9 +454,8 @@ acpi_rs_address32_resource (
buffer = byte_stream_buffer; buffer = byte_stream_buffer;
struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32); struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32);
/* /* Point past the Descriptor to get the number of bytes consumed */
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1; buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer); ACPI_MOVE_16_TO_16 (&temp16, buffer);
@ -490,9 +468,8 @@ acpi_rs_address32_resource (
*bytes_consumed = temp16 + 3; *bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS32; output_struct->id = ACPI_RSTYPE_ADDRESS32;
/* /* Get the Resource Type (Byte3) */
* Get the Resource Type (Byte3)
*/
buffer += 2; buffer += 2;
temp8 = *buffer; temp8 = *buffer;
@ -504,35 +481,29 @@ acpi_rs_address32_resource (
output_struct->data.address32.resource_type = temp8; output_struct->data.address32.resource_type = temp8;
/* /* Get the General Flags (Byte4) */
* Get the General Flags (Byte4)
*/
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
/* /* Producer / Consumer */
* Producer / Consumer
*/
output_struct->data.address32.producer_consumer = temp8 & 0x01; output_struct->data.address32.producer_consumer = temp8 & 0x01;
/* /* Decode */
* Decode
*/
output_struct->data.address32.decode = (temp8 >> 1) & 0x01; output_struct->data.address32.decode = (temp8 >> 1) & 0x01;
/* /* Min Address Fixed */
* Min Address Fixed
*/
output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01; output_struct->data.address32.min_address_fixed = (temp8 >> 2) & 0x01;
/* /* Max Address Fixed */
* Max Address Fixed
*/
output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01; output_struct->data.address32.max_address_fixed = (temp8 >> 3) & 0x01;
/* /* Get the Type Specific Flags (Byte5) */
* Get the Type Specific Flags (Byte5)
*/
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
@ -556,39 +527,34 @@ acpi_rs_address32_resource (
} }
} }
/* /* Get Granularity (Bytes 6-9) */
* Get Granularity (Bytes 6-9)
*/
buffer += 1; buffer += 1;
ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer); ACPI_MOVE_32_TO_32 (&output_struct->data.address32.granularity, buffer);
/* /* Get min_address_range (Bytes 10-13) */
* Get min_address_range (Bytes 10-13)
*/
buffer += 4; buffer += 4;
ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer); ACPI_MOVE_32_TO_32 (&output_struct->data.address32.min_address_range, buffer);
/* /* Get max_address_range (Bytes 14-17) */
* Get max_address_range (Bytes 14-17)
*/
buffer += 4; buffer += 4;
ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer); ACPI_MOVE_32_TO_32 (&output_struct->data.address32.max_address_range, buffer);
/* /* Get address_translation_offset (Bytes 18-21) */
* Get address_translation_offset (Bytes 18-21)
*/ buffer += 4;
buffer += 4; ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset,
ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_translation_offset, buffer); buffer);
/* Get address_length (Bytes 22-25) */
/*
* Get address_length (Bytes 22-25)
*/
buffer += 4; buffer += 4;
ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer); ACPI_MOVE_32_TO_32 (&output_struct->data.address32.address_length, buffer);
/* /* Resource Source Index (if present) */
* Resource Source Index (if present)
*/
buffer += 4; buffer += 4;
/* /*
@ -615,7 +581,8 @@ acpi_rs_address32_resource (
output_struct->data.address32.resource_source.string_ptr = output_struct->data.address32.resource_source.string_ptr =
(char *)((u8 *)output_struct + struct_size); (char *)((u8 *)output_struct + struct_size);
temp_ptr = (u8 *) output_struct->data.address32.resource_source.string_ptr; temp_ptr = (u8 *)
output_struct->data.address32.resource_source.string_ptr;
/* Copy the string into the buffer */ /* Copy the string into the buffer */
@ -628,9 +595,8 @@ acpi_rs_address32_resource (
index += 1; index += 1;
} }
/* /* Add the terminating null */
* Add the terminating null
*/
*temp_ptr = 0x00; *temp_ptr = 0x00;
output_struct->data.address32.resource_source.string_length = index + 1; output_struct->data.address32.resource_source.string_length = index + 1;
@ -648,14 +614,12 @@ acpi_rs_address32_resource (
output_struct->data.address32.resource_source.string_ptr = NULL; output_struct->data.address32.resource_source.string_ptr = NULL;
} }
/* /* Set the Length parameter */
* Set the Length parameter
*/
output_struct->length = (u32) struct_size; output_struct->length = (u32) struct_size;
/* /* Return the final size of the structure */
* Return the final size of the structure
*/
*structure_size = struct_size; *structure_size = struct_size;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -694,29 +658,25 @@ acpi_rs_address32_stream (
buffer = *output_buffer; buffer = *output_buffer;
/* /* The descriptor field is static */
* The descriptor field is static
*/
*buffer = 0x87; *buffer = 0x87;
buffer += 1; buffer += 1;
/* /* Set a pointer to the Length field - to be filled in later */
* Set a pointer to the Length field - to be filled in later
*/
length_field = ACPI_CAST_PTR (u16, buffer); length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2; buffer += 2;
/* /* Set the Resource Type (Memory, Io, bus_number) */
* Set the Resource Type (Memory, Io, bus_number)
*/
temp8 = (u8) (linked_list->data.address32.resource_type & 0x03); temp8 = (u8) (linked_list->data.address32.resource_type & 0x03);
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the general flags */
* Set the general flags
*/
temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01); temp8 = (u8) (linked_list->data.address32.producer_consumer & 0x01);
temp8 |= (linked_list->data.address32.decode & 0x01) << 1; temp8 |= (linked_list->data.address32.decode & 0x01) << 1;
temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2; temp8 |= (linked_list->data.address32.min_address_fixed & 0x01) << 2;
@ -725,9 +685,8 @@ acpi_rs_address32_stream (
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the type specific flags */
* Set the type specific flags
*/
temp8 = 0; temp8 = 0;
if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) { if (ACPI_MEMORY_RANGE == linked_list->data.address32.resource_type) {
@ -751,39 +710,34 @@ acpi_rs_address32_stream (
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the address space granularity */
* Set the address space granularity
*/
ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity); ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.granularity);
buffer += 4; buffer += 4;
/* /* Set the address range minimum */
* Set the address range minimum
*/
ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range); ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.min_address_range);
buffer += 4; buffer += 4;
/* /* Set the address range maximum */
* Set the address range maximum
*/
ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range); ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.max_address_range);
buffer += 4; buffer += 4;
/* /* Set the address translation offset */
* Set the address translation offset
*/ ACPI_MOVE_32_TO_32 (buffer,
ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_translation_offset); &linked_list->data.address32.address_translation_offset);
buffer += 4; buffer += 4;
/* /* Set the address length */
* Set the address length
*/
ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length); ACPI_MOVE_32_TO_32 (buffer, &linked_list->data.address32.address_length);
buffer += 4; buffer += 4;
/* /* Resource Source Index and Resource Source are optional */
* Resource Source Index and Resource Source are optional
*/
if (0 != linked_list->data.address32.resource_source.string_length) { if (0 != linked_list->data.address32.resource_source.string_length) {
temp8 = (u8) linked_list->data.address32.resource_source.index; temp8 = (u8) linked_list->data.address32.resource_source.index;
@ -792,9 +746,8 @@ acpi_rs_address32_stream (
temp_pointer = (char *) buffer; temp_pointer = (char *) buffer;
/* /* Copy the string */
* Copy the string
*/
ACPI_STRCPY (temp_pointer, ACPI_STRCPY (temp_pointer,
linked_list->data.address32.resource_source.string_ptr); linked_list->data.address32.resource_source.string_ptr);
@ -802,12 +755,12 @@ acpi_rs_address32_stream (
* Buffer needs to be set to the length of the sting + one for the * Buffer needs to be set to the length of the sting + one for the
* terminating null * terminating null
*/ */
buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address32.resource_source.string_ptr) + 1); buffer += (acpi_size)(ACPI_STRLEN (
linked_list->data.address32.resource_source.string_ptr) + 1);
} }
/* /* Return the number of bytes consumed in this operation */
* Return the number of bytes consumed in this operation
*/
*bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/* /*
@ -864,9 +817,8 @@ acpi_rs_address64_resource (
struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64); struct_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64);
resource_type = *buffer; resource_type = *buffer;
/* /* Point past the Descriptor to get the number of bytes consumed */
* Point past the Descriptor to get the number of bytes consumed
*/
buffer += 1; buffer += 1;
ACPI_MOVE_16_TO_16 (&temp16, buffer); ACPI_MOVE_16_TO_16 (&temp16, buffer);
@ -879,9 +831,8 @@ acpi_rs_address64_resource (
*bytes_consumed = temp16 + 3; *bytes_consumed = temp16 + 3;
output_struct->id = ACPI_RSTYPE_ADDRESS64; output_struct->id = ACPI_RSTYPE_ADDRESS64;
/* /* Get the Resource Type (Byte3) */
* Get the Resource Type (Byte3)
*/
buffer += 2; buffer += 2;
temp8 = *buffer; temp8 = *buffer;
@ -893,35 +844,29 @@ acpi_rs_address64_resource (
output_struct->data.address64.resource_type = temp8; output_struct->data.address64.resource_type = temp8;
/* /* Get the General Flags (Byte4) */
* Get the General Flags (Byte4)
*/
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
/* /* Producer / Consumer */
* Producer / Consumer
*/
output_struct->data.address64.producer_consumer = temp8 & 0x01; output_struct->data.address64.producer_consumer = temp8 & 0x01;
/* /* Decode */
* Decode
*/
output_struct->data.address64.decode = (temp8 >> 1) & 0x01; output_struct->data.address64.decode = (temp8 >> 1) & 0x01;
/* /* Min Address Fixed */
* Min Address Fixed
*/
output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01; output_struct->data.address64.min_address_fixed = (temp8 >> 2) & 0x01;
/* /* Max Address Fixed */
* Max Address Fixed
*/
output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01; output_struct->data.address64.max_address_fixed = (temp8 >> 3) & 0x01;
/* /* Get the Type Specific Flags (Byte5) */
* Get the Type Specific Flags (Byte5)
*/
buffer += 1; buffer += 1;
temp8 = *buffer; temp8 = *buffer;
@ -951,33 +896,29 @@ acpi_rs_address64_resource (
buffer += 2; buffer += 2;
} }
/* /* Get Granularity (Bytes 6-13) or (Bytes 8-15) */
* Get Granularity (Bytes 6-13) or (Bytes 8-15)
*/
buffer += 1; buffer += 1;
ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer); ACPI_MOVE_64_TO_64 (&output_struct->data.address64.granularity, buffer);
/* /* Get min_address_range (Bytes 14-21) or (Bytes 16-23) */
* Get min_address_range (Bytes 14-21) or (Bytes 16-23)
*/
buffer += 8; buffer += 8;
ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer); ACPI_MOVE_64_TO_64 (&output_struct->data.address64.min_address_range, buffer);
/* /* Get max_address_range (Bytes 22-29) or (Bytes 24-31) */
* Get max_address_range (Bytes 22-29) or (Bytes 24-31)
*/
buffer += 8; buffer += 8;
ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer); ACPI_MOVE_64_TO_64 (&output_struct->data.address64.max_address_range, buffer);
/* /* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39) */
* Get address_translation_offset (Bytes 30-37) or (Bytes 32-39)
*/ buffer += 8;
buffer += 8; ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset,
ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_translation_offset, buffer); buffer);
/* Get address_length (Bytes 38-45) or (Bytes 40-47) */
/*
* Get address_length (Bytes 38-45) or (Bytes 40-47)
*/
buffer += 8; buffer += 8;
ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer); ACPI_MOVE_64_TO_64 (&output_struct->data.address64.address_length, buffer);
@ -989,14 +930,15 @@ acpi_rs_address64_resource (
/* Get type_specific_attribute (Bytes 48-55) */ /* Get type_specific_attribute (Bytes 48-55) */
buffer += 8; buffer += 8;
ACPI_MOVE_64_TO_64 (&output_struct->data.address64.type_specific_attributes, buffer); ACPI_MOVE_64_TO_64 (
&output_struct->data.address64.type_specific_attributes,
buffer);
} }
else { else {
output_struct->data.address64.type_specific_attributes = 0; output_struct->data.address64.type_specific_attributes = 0;
/* /* Resource Source Index (if present) */
* Resource Source Index (if present)
*/
buffer += 8; buffer += 8;
/* /*
@ -1025,7 +967,8 @@ acpi_rs_address64_resource (
output_struct->data.address64.resource_source.string_ptr = output_struct->data.address64.resource_source.string_ptr =
(char *)((u8 *)output_struct + struct_size); (char *)((u8 *)output_struct + struct_size);
temp_ptr = (u8 *) output_struct->data.address64.resource_source.string_ptr; temp_ptr = (u8 *)
output_struct->data.address64.resource_source.string_ptr;
/* Copy the string into the buffer */ /* Copy the string into the buffer */
@ -1042,7 +985,8 @@ acpi_rs_address64_resource (
* Add the terminating null * Add the terminating null
*/ */
*temp_ptr = 0x00; *temp_ptr = 0x00;
output_struct->data.address64.resource_source.string_length = index + 1; output_struct->data.address64.resource_source.string_length =
index + 1;
/* /*
* In order for the struct_size to fall on a 32-bit boundary, * In order for the struct_size to fall on a 32-bit boundary,
@ -1054,14 +998,12 @@ acpi_rs_address64_resource (
} }
} }
/* /* Set the Length parameter */
* Set the Length parameter
*/
output_struct->length = (u32) struct_size; output_struct->length = (u32) struct_size;
/* /* Return the final size of the structure */
* Return the final size of the structure
*/
*structure_size = struct_size; *structure_size = struct_size;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -1100,29 +1042,25 @@ acpi_rs_address64_stream (
buffer = *output_buffer; buffer = *output_buffer;
/* /* The descriptor field is static */
* The descriptor field is static
*/
*buffer = 0x8A; *buffer = 0x8A;
buffer += 1; buffer += 1;
/* /* Set a pointer to the Length field - to be filled in later */
* Set a pointer to the Length field - to be filled in later
*/
length_field = ACPI_CAST_PTR (u16, buffer); length_field = ACPI_CAST_PTR (u16, buffer);
buffer += 2; buffer += 2;
/* /* Set the Resource Type (Memory, Io, bus_number) */
* Set the Resource Type (Memory, Io, bus_number)
*/
temp8 = (u8) (linked_list->data.address64.resource_type & 0x03); temp8 = (u8) (linked_list->data.address64.resource_type & 0x03);
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the general flags */
* Set the general flags
*/
temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01); temp8 = (u8) (linked_list->data.address64.producer_consumer & 0x01);
temp8 |= (linked_list->data.address64.decode & 0x01) << 1; temp8 |= (linked_list->data.address64.decode & 0x01) << 1;
temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2; temp8 |= (linked_list->data.address64.min_address_fixed & 0x01) << 2;
@ -1131,9 +1069,8 @@ acpi_rs_address64_stream (
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the type specific flags */
* Set the type specific flags
*/
temp8 = 0; temp8 = 0;
if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) { if (ACPI_MEMORY_RANGE == linked_list->data.address64.resource_type) {
@ -1157,39 +1094,34 @@ acpi_rs_address64_stream (
*buffer = temp8; *buffer = temp8;
buffer += 1; buffer += 1;
/* /* Set the address space granularity */
* Set the address space granularity
*/
ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity); ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.granularity);
buffer += 8; buffer += 8;
/* /* Set the address range minimum */
* Set the address range minimum
*/
ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range); ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.min_address_range);
buffer += 8; buffer += 8;
/* /* Set the address range maximum */
* Set the address range maximum
*/
ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range); ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.max_address_range);
buffer += 8; buffer += 8;
/* /* Set the address translation offset */
* Set the address translation offset
*/ ACPI_MOVE_64_TO_64 (buffer,
ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_translation_offset); &linked_list->data.address64.address_translation_offset);
buffer += 8; buffer += 8;
/* /* Set the address length */
* Set the address length
*/
ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length); ACPI_MOVE_64_TO_64 (buffer, &linked_list->data.address64.address_length);
buffer += 8; buffer += 8;
/* /* Resource Source Index and Resource Source are optional */
* Resource Source Index and Resource Source are optional
*/
if (0 != linked_list->data.address64.resource_source.string_length) { if (0 != linked_list->data.address64.resource_source.string_length) {
temp8 = (u8) linked_list->data.address64.resource_source.index; temp8 = (u8) linked_list->data.address64.resource_source.index;
@ -1198,21 +1130,21 @@ acpi_rs_address64_stream (
temp_pointer = (char *) buffer; temp_pointer = (char *) buffer;
/* /* Copy the string */
* Copy the string
*/ ACPI_STRCPY (temp_pointer,
ACPI_STRCPY (temp_pointer, linked_list->data.address64.resource_source.string_ptr); linked_list->data.address64.resource_source.string_ptr);
/* /*
* Buffer needs to be set to the length of the sting + one for the * Buffer needs to be set to the length of the sting + one for the
* terminating null * terminating null
*/ */
buffer += (acpi_size)(ACPI_STRLEN (linked_list->data.address64.resource_source.string_ptr) + 1); buffer += (acpi_size)(ACPI_STRLEN (
linked_list->data.address64.resource_source.string_ptr) + 1);
} }
/* /* Return the number of bytes consumed in this operation */
* Return the number of bytes consumed in this operation
*/
*bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer); *bytes_consumed = ACPI_PTR_DIFF (buffer, *output_buffer);
/* /*

View File

@ -81,9 +81,8 @@ acpi_rs_get_byte_stream_length (
while (!done) { while (!done) {
/* /* Init the variable that will hold the size to add to the total. */
* Init the variable that will hold the size to add to the total.
*/
segment_size = 0; segment_size = 0;
switch (linked_list->id) { switch (linked_list->id) {
@ -196,7 +195,8 @@ acpi_rs_get_byte_stream_length (
segment_size = 16; segment_size = 16;
if (linked_list->data.address16.resource_source.string_ptr) { if (linked_list->data.address16.resource_source.string_ptr) {
segment_size += linked_list->data.address16.resource_source.string_length; segment_size +=
linked_list->data.address16.resource_source.string_length;
segment_size++; segment_size++;
} }
break; break;
@ -212,7 +212,8 @@ acpi_rs_get_byte_stream_length (
segment_size = 26; segment_size = 26;
if (linked_list->data.address32.resource_source.string_ptr) { if (linked_list->data.address32.resource_source.string_ptr) {
segment_size += linked_list->data.address32.resource_source.string_length; segment_size +=
linked_list->data.address32.resource_source.string_length;
segment_size++; segment_size++;
} }
break; break;
@ -227,7 +228,8 @@ acpi_rs_get_byte_stream_length (
segment_size = 46; segment_size = 46;
if (linked_list->data.address64.resource_source.string_ptr) { if (linked_list->data.address64.resource_source.string_ptr) {
segment_size += linked_list->data.address64.resource_source.string_length; segment_size +=
linked_list->data.address64.resource_source.string_length;
segment_size++; segment_size++;
} }
break; break;
@ -241,38 +243,36 @@ acpi_rs_get_byte_stream_length (
* Index + the length of the null terminated string * Index + the length of the null terminated string
* Resource Source + 1 for the null. * Resource Source + 1 for the null.
*/ */
segment_size = 9 + segment_size = 9 + (((acpi_size)
(((acpi_size) linked_list->data.extended_irq.number_of_interrupts - 1) * 4); linked_list->data.extended_irq.number_of_interrupts - 1) * 4);
if (linked_list->data.extended_irq.resource_source.string_ptr) { if (linked_list->data.extended_irq.resource_source.string_ptr) {
segment_size += linked_list->data.extended_irq.resource_source.string_length; segment_size +=
linked_list->data.extended_irq.resource_source.string_length;
segment_size++; segment_size++;
} }
break; break;
default: default:
/*
* If we get here, everything is out of sync, exit with error /* If we get here, everything is out of sync, exit with error */
*/
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
} /* switch (linked_list->Id) */ } /* switch (linked_list->Id) */
/* /* Update the total */
* Update the total
*/
byte_stream_size_needed += segment_size; byte_stream_size_needed += segment_size;
/* /* Point to the next object */
* Point to the next object
*/
linked_list = ACPI_PTR_ADD (struct acpi_resource, linked_list = ACPI_PTR_ADD (struct acpi_resource,
linked_list, linked_list->length); linked_list, linked_list->length);
} }
/* /* This is the data the caller needs */
* This is the data the caller needs
*/
*size_needed = byte_stream_size_needed; *size_needed = byte_stream_size_needed;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -320,9 +320,8 @@ acpi_rs_get_list_length (
while (bytes_parsed < byte_stream_buffer_length) { while (bytes_parsed < byte_stream_buffer_length) {
/* /* The next byte in the stream is the resource type */
* The next byte in the stream is the resource type
*/
resource_type = acpi_rs_get_resource_type (*byte_stream_buffer); resource_type = acpi_rs_get_resource_type (*byte_stream_buffer);
switch (resource_type) { switch (resource_type) {
@ -346,9 +345,8 @@ acpi_rs_get_list_length (
ACPI_MOVE_16_TO_16 (&temp16, buffer); ACPI_MOVE_16_TO_16 (&temp16, buffer);
bytes_consumed = temp16 + 3; bytes_consumed = temp16 + 3;
/* /* Ensure a 32-bit boundary for the structure */
* Ensure a 32-bit boundary for the structure
*/
temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16); temp16 = (u16) ACPI_ROUND_UP_to_32_bITS (temp16);
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
@ -416,9 +414,8 @@ acpi_rs_get_list_length (
temp8 = 0; temp8 = 0;
} }
/* /* Ensure a 64-bit boundary for the structure */
* Ensure a 64-bit boundary for the structure
*/
temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8); temp8 = (u8) ACPI_ROUND_UP_to_64_bITS (temp8);
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) + structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address64) +
@ -452,9 +449,8 @@ acpi_rs_get_list_length (
temp8 = 0; temp8 = 0;
} }
/* /* Ensure a 32-bit boundary for the structure */
* Ensure a 32-bit boundary for the structure
*/
temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) + structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address32) +
@ -488,9 +484,8 @@ acpi_rs_get_list_length (
temp8 = 0; temp8 = 0;
} }
/* /* Ensure a 32-bit boundary for the structure */
* Ensure a 32-bit boundary for the structure
*/
temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) + structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_address16) +
@ -537,9 +532,8 @@ acpi_rs_get_list_length (
temp8 = 0; temp8 = 0;
} }
/* /* Ensure a 32-bit boundary for the structure */
* Ensure a 32-bit boundary for the structure
*/
temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) + structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_ext_irq) +
@ -567,9 +561,8 @@ acpi_rs_get_list_length (
++buffer; ++buffer;
/* /* Look at the number of bits set */
* Look at the number of bits set
*/
ACPI_MOVE_16_TO_16 (&temp16, buffer); ACPI_MOVE_16_TO_16 (&temp16, buffer);
for (index = 0; index < 16; index++) { for (index = 0; index < 16; index++) {
@ -596,9 +589,8 @@ acpi_rs_get_list_length (
++buffer; ++buffer;
/* /* Look at the number of bits set */
* Look at the number of bits set
*/
temp8 = *buffer; temp8 = *buffer;
for(index = 0; index < 8; index++) { for(index = 0; index < 8; index++) {
@ -670,9 +662,8 @@ acpi_rs_get_list_length (
temp8 = (u8) (temp8 & 0x7); temp8 = (u8) (temp8 & 0x7);
bytes_consumed = temp8 + 1; bytes_consumed = temp8 + 1;
/* /* Ensure a 32-bit boundary for the structure */
* Ensure a 32-bit boundary for the structure
*/
temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8); temp8 = (u8) ACPI_ROUND_UP_to_32_bITS (temp8);
structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) + structure_size = ACPI_SIZEOF_RESOURCE (struct acpi_resource_vendor) +
(temp8 * sizeof (u8)); (temp8 * sizeof (u8));
@ -697,21 +688,18 @@ acpi_rs_get_list_length (
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
} }
/* /* Update the return value and counter */
* Update the return value and counter
*/
buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size); buffer_size += (u32) ACPI_ALIGN_RESOURCE_SIZE (structure_size);
bytes_parsed += bytes_consumed; bytes_parsed += bytes_consumed;
/* /* Set the byte stream to point to the next resource */
* Set the byte stream to point to the next resource
*/
byte_stream_buffer += bytes_consumed; byte_stream_buffer += bytes_consumed;
} }
/* /* This is the data the caller needs */
* This is the data the caller needs
*/
*size_needed = buffer_size; *size_needed = buffer_size;
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);
} }
@ -767,9 +755,8 @@ acpi_rs_get_pci_routing_table_length (
top_object_list = package_object->package.elements; top_object_list = package_object->package.elements;
for (index = 0; index < number_of_elements; index++) { for (index = 0; index < number_of_elements; index++) {
/* /* Dereference the sub-package */
* Dereference the sub-package
*/
package_element = *top_object_list; package_element = *top_object_list;
/* /*
@ -778,37 +765,40 @@ acpi_rs_get_pci_routing_table_length (
*/ */
sub_object_list = package_element->package.elements; sub_object_list = package_element->package.elements;
/* /* Scan the irq_table_elements for the Source Name String */
* Scan the irq_table_elements for the Source Name String
*/
name_found = FALSE; name_found = FALSE;
for (table_index = 0; table_index < 4 && !name_found; table_index++) { for (table_index = 0; table_index < 4 && !name_found; table_index++) {
if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*sub_object_list)) || if ((ACPI_TYPE_STRING ==
((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*sub_object_list)) && ACPI_GET_OBJECT_TYPE (*sub_object_list)) ||
((*sub_object_list)->reference.opcode == AML_INT_NAMEPATH_OP))) {
((ACPI_TYPE_LOCAL_REFERENCE ==
ACPI_GET_OBJECT_TYPE (*sub_object_list)) &&
((*sub_object_list)->reference.opcode ==
AML_INT_NAMEPATH_OP))) {
name_found = TRUE; name_found = TRUE;
} }
else { else {
/* /* Look at the next element */
* Look at the next element
*/
sub_object_list++; sub_object_list++;
} }
} }
temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4); temp_size_needed += (sizeof (struct acpi_pci_routing_table) - 4);
/* /* Was a String type found? */
* Was a String type found?
*/
if (name_found) { if (name_found) {
if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) { if (ACPI_GET_OBJECT_TYPE (*sub_object_list) == ACPI_TYPE_STRING) {
/* /*
* The length String.Length field does not include the * The length String.Length field does not include the
* terminating NULL, add 1 * terminating NULL, add 1
*/ */
temp_size_needed += ((acpi_size) (*sub_object_list)->string.length + 1); temp_size_needed += ((acpi_size)
(*sub_object_list)->string.length + 1);
} }
else { else {
temp_size_needed += acpi_ns_get_pathname_length ( temp_size_needed += acpi_ns_get_pathname_length (
@ -827,14 +817,14 @@ acpi_rs_get_pci_routing_table_length (
temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed); temp_size_needed = ACPI_ROUND_UP_to_64_bITS (temp_size_needed);
/* /* Point to the next union acpi_operand_object */
* Point to the next union acpi_operand_object
*/
top_object_list++; top_object_list++;
} }
/* /*
* Adding an extra element to the end of the list, essentially a NULL terminator * Adding an extra element to the end of the list, essentially a
* NULL terminator
*/ */
*buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table); *buffer_size_needed = temp_size_needed + sizeof (struct acpi_pci_routing_table);
return_ACPI_STATUS (AE_OK); return_ACPI_STATUS (AE_OK);

View File

@ -87,9 +87,8 @@ acpi_rs_create_resource_list (
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n", ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "byte_stream_buffer = %p\n",
byte_stream_buffer)); byte_stream_buffer));
/* /* Params already validated, so we don't re-validate here */
* Params already validated, so we don't re-validate here
*/
byte_stream_buffer_length = byte_stream_buffer->buffer.length; byte_stream_buffer_length = byte_stream_buffer->buffer.length;
byte_stream_start = byte_stream_buffer->buffer.pointer; byte_stream_start = byte_stream_buffer->buffer.pointer;
@ -171,9 +170,8 @@ acpi_rs_create_pci_routing_table (
/* Params already validated, so we don't re-validate here */ /* Params already validated, so we don't re-validate here */
/* /* Get the required buffer length */
* Get the required buffer length
*/
status = acpi_rs_get_pci_routing_table_length (package_object, status = acpi_rs_get_pci_routing_table_length (package_object,
&buffer_size_needed); &buffer_size_needed);
if (ACPI_FAILURE (status)) { if (ACPI_FAILURE (status)) {
@ -217,9 +215,8 @@ acpi_rs_create_pci_routing_table (
*/ */
user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4); user_prt->length = (sizeof (struct acpi_pci_routing_table) - 4);
/* /* Each element of the top-level package must also be a package */
* Each element of the top-level package must also be a package
*/
if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE (*top_object_list) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X]) Need sub-package, found %s\n", "(PRT[%X]) Need sub-package, found %s\n",
@ -243,9 +240,8 @@ acpi_rs_create_pci_routing_table (
*/ */
sub_object_list = (*top_object_list)->package.elements; sub_object_list = (*top_object_list)->package.elements;
/* /* 1) First subobject: Dereference the PRT.Address */
* 1) First subobject: Dereference the PRT.Address
*/
obj_desc = sub_object_list[0]; obj_desc = sub_object_list[0];
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
user_prt->address = obj_desc->integer.value; user_prt->address = obj_desc->integer.value;
@ -257,9 +253,8 @@ acpi_rs_create_pci_routing_table (
return_ACPI_STATUS (AE_BAD_DATA); return_ACPI_STATUS (AE_BAD_DATA);
} }
/* /* 2) Second subobject: Dereference the PRT.Pin */
* 2) Second subobject: Dereference the PRT.Pin
*/
obj_desc = sub_object_list[1]; obj_desc = sub_object_list[1];
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
user_prt->pin = (u32) obj_desc->integer.value; user_prt->pin = (u32) obj_desc->integer.value;
@ -271,9 +266,8 @@ acpi_rs_create_pci_routing_table (
return_ACPI_STATUS (AE_BAD_DATA); return_ACPI_STATUS (AE_BAD_DATA);
} }
/* /* 3) Third subobject: Dereference the PRT.source_name */
* 3) Third subobject: Dereference the PRT.source_name
*/
obj_desc = sub_object_list[2]; obj_desc = sub_object_list[2];
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) { switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
@ -296,7 +290,9 @@ acpi_rs_create_pci_routing_table (
status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer); status = acpi_ns_handle_to_pathname ((acpi_handle) node, &path_buffer);
user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1; /* include null terminator */ /* +1 to include null terminator */
user_prt->length += (u32) ACPI_STRLEN (user_prt->source) + 1;
break; break;
@ -304,8 +300,10 @@ acpi_rs_create_pci_routing_table (
ACPI_STRCPY (user_prt->source, obj_desc->string.pointer); ACPI_STRCPY (user_prt->source, obj_desc->string.pointer);
/* Add to the Length field the length of the string (add 1 for terminator) */ /*
* Add to the Length field the length of the string
* (add 1 for terminator)
*/
user_prt->length += obj_desc->string.length + 1; user_prt->length += obj_desc->string.length + 1;
break; break;
@ -333,9 +331,8 @@ acpi_rs_create_pci_routing_table (
user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length); user_prt->length = (u32) ACPI_ROUND_UP_to_64_bITS (user_prt->length);
/* /* 4) Fourth subobject: Dereference the PRT.source_index */
* 4) Fourth subobject: Dereference the PRT.source_index
*/
obj_desc = sub_object_list[3]; obj_desc = sub_object_list[3];
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_INTEGER) {
user_prt->source_index = (u32) obj_desc->integer.value; user_prt->source_index = (u32) obj_desc->integer.value;

Some files were not shown because too many files have changed in this diff Show More