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

This commit is contained in:
Linus Torvalds 2006-02-01 22:06:15 -08:00
commit 59ed2f59e4
198 changed files with 8848 additions and 8659 deletions

View File

@ -452,6 +452,11 @@ running once the system is up.
eata= [HW,SCSI] eata= [HW,SCSI]
ec_intr= [HW,ACPI] ACPI Embedded Controller interrupt mode
Format: <int>
0: polling mode
non-0: interrupt mode (default)
eda= [HW,PS2] eda= [HW,PS2]
edb= [HW,PS2] edb= [HW,PS2]

View File

@ -3,6 +3,6 @@ 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),) ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += cstate.o obj-y += cstate.o processor.o
endif endif

View File

@ -464,7 +464,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
* success: return IRQ number (>=0) * success: return IRQ number (>=0)
* failure: return < 0 * failure: return < 0
*/ */
int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) int acpi_register_gsi(u32 gsi, int triggering, int polarity)
{ {
unsigned int irq; unsigned int irq;
unsigned int plat_gsi = gsi; unsigned int plat_gsi = gsi;
@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
extern void eisa_set_level_irq(unsigned int irq); extern void eisa_set_level_irq(unsigned int irq);
if (edge_level == ACPI_LEVEL_SENSITIVE) if (triggering == ACPI_LEVEL_SENSITIVE)
eisa_set_level_irq(gsi); eisa_set_level_irq(gsi);
} }
#endif #endif
#ifdef CONFIG_X86_IO_APIC #ifdef CONFIG_X86_IO_APIC
if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {
plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low); plat_gsi = mp_register_gsi(gsi, triggering, polarity);
} }
#endif #endif
acpi_gsi_to_irq(plat_gsi, &irq); acpi_gsi_to_irq(plat_gsi, &irq);

View File

@ -14,64 +14,6 @@
#include <acpi/processor.h> #include <acpi/processor.h>
#include <asm/acpi.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 * Initialize bm_flags based on the CPU cache properties
* On SMP it depends on cache configuration * On SMP it depends on cache configuration

View File

@ -0,0 +1,75 @@
/*
* arch/i386/kernel/acpi/processor.c
*
* Copyright (C) 2005 Intel Corporation
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
* - Added _PDC for platforms with 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 init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
{
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;
if (cpu_has(c, X86_FEATURE_EST))
buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
obj->type = ACPI_TYPE_BUFFER;
obj->buffer.length = 12;
obj->buffer.pointer = (u8 *) buf;
obj_list->count = 1;
obj_list->pointer = obj;
pr->pdc = obj_list;
return;
}
/* Initialize _PDC data based on the CPU vendor */
void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
{
unsigned int cpu = pr->id;
struct cpuinfo_x86 *c = cpu_data + cpu;
pr->pdc = NULL;
if (c->x86_vendor == X86_VENDOR_INTEL)
init_intel_pdc(pr, c);
return;
}
EXPORT_SYMBOL(arch_acpi_processor_init_pdc);

View File

@ -295,68 +295,6 @@ acpi_cpufreq_guess_freq (
} }
/*
* acpi_processor_cpu_init_pdc_est - let BIOS know about the SMP capabilities
* of this driver
* @perf: processor-specific acpi_io_data struct
* @cpu: CPU being initialized
*
* To avoid issues with legacy OSes, some BIOSes require to be informed of
* the SMP capabilities of OS P-state driver. Here we set the bits in _PDC
* accordingly, for Enhanced Speedstep. Actual call to _PDC is done in
* driver/acpi/processor.c
*/
static void
acpi_processor_cpu_init_pdc_est(
struct acpi_processor_performance *perf,
unsigned int cpu,
struct acpi_object_list *obj_list
)
{
union acpi_object *obj;
u32 *buf;
struct cpuinfo_x86 *c = cpu_data + cpu;
dprintk("acpi_processor_cpu_init_pdc_est\n");
if (!cpu_has(c, X86_FEATURE_EST))
return;
/* Initialize pdc. It will be used later. */
if (!obj_list)
return;
if (!(obj_list->count && obj_list->pointer))
return;
obj = obj_list->pointer;
if ((obj->buffer.length == 12) && obj->buffer.pointer) {
buf = (u32 *)obj->buffer.pointer;
buf[0] = ACPI_PDC_REVISION_ID;
buf[1] = 1;
buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
perf->pdc = obj_list;
}
return;
}
/* CPU specific PDC initialization */
static void
acpi_processor_cpu_init_pdc(
struct acpi_processor_performance *perf,
unsigned int cpu,
struct acpi_object_list *obj_list
)
{
struct cpuinfo_x86 *c = cpu_data + cpu;
dprintk("acpi_processor_cpu_init_pdc\n");
perf->pdc = NULL;
if (cpu_has(c, X86_FEATURE_EST))
acpi_processor_cpu_init_pdc_est(perf, cpu, obj_list);
return;
}
static int static int
acpi_cpufreq_cpu_init ( acpi_cpufreq_cpu_init (
struct cpufreq_policy *policy) struct cpufreq_policy *policy)
@ -367,14 +305,7 @@ acpi_cpufreq_cpu_init (
unsigned int result = 0; unsigned int result = 0;
struct cpuinfo_x86 *c = &cpu_data[policy->cpu]; struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
union acpi_object arg0 = {ACPI_TYPE_BUFFER};
u32 arg0_buf[3];
struct acpi_object_list arg_list = {1, &arg0};
dprintk("acpi_cpufreq_cpu_init\n"); dprintk("acpi_cpufreq_cpu_init\n");
/* setup arg_list for _PDC settings */
arg0.buffer.length = 12;
arg0.buffer.pointer = (u8 *) arg0_buf;
data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
if (!data) if (!data)
@ -382,9 +313,7 @@ acpi_cpufreq_cpu_init (
acpi_io_data[cpu] = data; acpi_io_data[cpu] = data;
acpi_processor_cpu_init_pdc(&data->acpi_data, cpu, &arg_list);
result = acpi_processor_register_performance(&data->acpi_data, cpu); result = acpi_processor_register_performance(&data->acpi_data, cpu);
data->acpi_data.pdc = NULL;
if (result) if (result)
goto err_free; goto err_free;

View File

@ -362,22 +362,10 @@ static struct acpi_processor_performance p;
*/ */
static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
{ {
union acpi_object arg0 = {ACPI_TYPE_BUFFER};
u32 arg0_buf[3];
struct acpi_object_list arg_list = {1, &arg0};
unsigned long cur_freq; unsigned long cur_freq;
int result = 0, i; int result = 0, i;
unsigned int cpu = policy->cpu; unsigned int cpu = policy->cpu;
/* _PDC settings */
arg0.buffer.length = 12;
arg0.buffer.pointer = (u8 *) arg0_buf;
arg0_buf[0] = ACPI_PDC_REVISION_ID;
arg0_buf[1] = 1;
arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR;
p.pdc = &arg_list;
/* register with ACPI core */ /* register with ACPI core */
if (acpi_processor_register_performance(&p, cpu)) { if (acpi_processor_register_performance(&p, cpu)) {
dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); dprintk(KERN_INFO PFX "obtaining ACPI data failed\n");

View File

@ -1080,7 +1080,7 @@ void __init mp_config_acpi_legacy_irqs (void)
#define MAX_GSI_NUM 4096 #define MAX_GSI_NUM 4096
int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) int mp_register_gsi (u32 gsi, int triggering, int polarity)
{ {
int ioapic = -1; int ioapic = -1;
int ioapic_pin = 0; int ioapic_pin = 0;
@ -1129,7 +1129,7 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
if (edge_level) { if (triggering == ACPI_LEVEL_SENSITIVE) {
/* /*
* For PCI devices assign IRQs in order, avoiding gaps * For PCI devices assign IRQs in order, avoiding gaps
* due to unused I/O APIC pins. * due to unused I/O APIC pins.
@ -1151,8 +1151,8 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
} }
io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
return gsi; return gsi;
} }

View File

@ -13,6 +13,11 @@ obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o
obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o
obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o
obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += acpi-processor.o
endif
obj-$(CONFIG_IA64_PALINFO) += palinfo.o obj-$(CONFIG_IA64_PALINFO) += palinfo.o
obj-$(CONFIG_IOSAPIC) += iosapic.o obj-$(CONFIG_IOSAPIC) += iosapic.o
obj-$(CONFIG_MODULES) += module.o obj-$(CONFIG_MODULES) += module.o

View File

@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
struct acpi_resource_vendor *vendor; struct acpi_resource_vendor *vendor;
struct acpi_vendor_descriptor *descriptor; struct acpi_vendor_descriptor *descriptor;
u32 length; u32 byte_length;
if (resource->id != ACPI_RSTYPE_VENDOR) if (resource->type != ACPI_RESOURCE_TYPE_VENDOR)
return AE_OK; return AE_OK;
vendor = (struct acpi_resource_vendor *)&resource->data; vendor = (struct acpi_resource_vendor *)&resource->data;
descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
if (vendor->length <= sizeof(*info->descriptor) || if (vendor->byte_length <= sizeof(*info->descriptor) ||
descriptor->guid_id != info->descriptor->guid_id || descriptor->guid_id != info->descriptor->guid_id ||
efi_guidcmp(descriptor->guid, info->descriptor->guid)) efi_guidcmp(descriptor->guid, info->descriptor->guid))
return AE_OK; return AE_OK;
length = vendor->length - sizeof(struct acpi_vendor_descriptor); byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
info->data = acpi_os_allocate(length); info->data = acpi_os_allocate(byte_length);
if (!info->data) if (!info->data)
return AE_NO_MEMORY; return AE_NO_MEMORY;
memcpy(info->data, memcpy(info->data,
vendor->reserved + sizeof(struct acpi_vendor_descriptor), vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
length); byte_length);
info->length = length; info->length = byte_length;
return AE_CTRL_TERMINATE; return AE_CTRL_TERMINATE;
} }
acpi_status acpi_status
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
u8 ** data, u32 * length) u8 ** data, u32 * byte_length)
{ {
struct acpi_vendor_info info; struct acpi_vendor_info info;
@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
return AE_NOT_FOUND; return AE_NOT_FOUND;
*data = info.data; *data = info.data;
*length = info.length; *byte_length = info.length;
return AE_OK; return AE_OK;
} }

View File

@ -0,0 +1,67 @@
/*
* arch/ia64/kernel/cpufreq/processor.c
*
* Copyright (C) 2005 Intel Corporation
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
* - Added _PDC for platforms with 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 init_intel_pdc(struct acpi_processor *pr)
{
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_EST_CAPABILITY_SMP;
obj->type = ACPI_TYPE_BUFFER;
obj->buffer.length = 12;
obj->buffer.pointer = (u8 *) buf;
obj_list->count = 1;
obj_list->pointer = obj;
pr->pdc = obj_list;
return;
}
/* Initialize _PDC data based on the CPU vendor */
void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
{
pr->pdc = NULL;
init_intel_pdc(pr);
return;
}
EXPORT_SYMBOL(arch_acpi_processor_init_pdc);

View File

@ -567,16 +567,16 @@ void __init acpi_numa_arch_fixup(void)
* success: return IRQ number (>=0) * success: return IRQ number (>=0)
* failure: return < 0 * failure: return < 0
*/ */
int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) int acpi_register_gsi(u32 gsi, int triggering, int polarity)
{ {
if (has_8259 && gsi < 16) if (has_8259 && gsi < 16)
return isa_irq_to_vector(gsi); return isa_irq_to_vector(gsi);
return iosapic_register_intr(gsi, return iosapic_register_intr(gsi,
(active_high_low == (polarity ==
ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
IOSAPIC_POL_LOW, IOSAPIC_POL_LOW,
(edge_level == (triggering ==
ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
IOSAPIC_LEVEL); IOSAPIC_LEVEL);
} }

View File

@ -1 +1,2 @@
obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o

View File

@ -269,48 +269,6 @@ acpi_cpufreq_verify (
} }
/*
* processor_init_pdc - let BIOS know about the SMP capabilities
* of this driver
* @perf: processor-specific acpi_io_data struct
* @cpu: CPU being initialized
*
* To avoid issues with legacy OSes, some BIOSes require to be informed of
* the SMP capabilities of OS P-state driver. Here we set the bits in _PDC
* accordingly. Actual call to _PDC is done in driver/acpi/processor.c
*/
static void
processor_init_pdc (
struct acpi_processor_performance *perf,
unsigned int cpu,
struct acpi_object_list *obj_list
)
{
union acpi_object *obj;
u32 *buf;
dprintk("processor_init_pdc\n");
perf->pdc = NULL;
/* Initialize pdc. It will be used later. */
if (!obj_list)
return;
if (!(obj_list->count && obj_list->pointer))
return;
obj = obj_list->pointer;
if ((obj->buffer.length == 12) && obj->buffer.pointer) {
buf = (u32 *)obj->buffer.pointer;
buf[0] = ACPI_PDC_REVISION_ID;
buf[1] = 1;
buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
perf->pdc = obj_list;
}
return;
}
static int static int
acpi_cpufreq_cpu_init ( acpi_cpufreq_cpu_init (
struct cpufreq_policy *policy) struct cpufreq_policy *policy)
@ -320,14 +278,7 @@ acpi_cpufreq_cpu_init (
struct cpufreq_acpi_io *data; struct cpufreq_acpi_io *data;
unsigned int result = 0; unsigned int result = 0;
union acpi_object arg0 = {ACPI_TYPE_BUFFER};
u32 arg0_buf[3];
struct acpi_object_list arg_list = {1, &arg0};
dprintk("acpi_cpufreq_cpu_init\n"); dprintk("acpi_cpufreq_cpu_init\n");
/* setup arg_list for _PDC settings */
arg0.buffer.length = 12;
arg0.buffer.pointer = (u8 *) arg0_buf;
data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
if (!data) if (!data)
@ -337,9 +288,7 @@ acpi_cpufreq_cpu_init (
acpi_io_data[cpu] = data; acpi_io_data[cpu] = data;
processor_init_pdc(&data->acpi_data, cpu, &arg_list);
result = acpi_processor_register_performance(&data->acpi_data, cpu); result = acpi_processor_register_performance(&data->acpi_data, cpu);
data->acpi_data.pdc = NULL;
if (result) if (result)
goto err_free; goto err_free;

View File

@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
goto free_resource; goto free_resource;
} }
min = addr->min_address_range; min = addr->minimum;
max = min + addr->address_length - 1; max = min + addr->address_length - 1;
if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION)
sparse = 1; sparse = 1;
space_nr = new_space(addr->address_translation_offset, sparse); space_nr = new_space(addr->translation_offset, sparse);
if (space_nr == ~0) if (space_nr == ~0)
goto free_name; goto free_name;
@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
if (addr.resource_type == ACPI_MEMORY_RANGE) { if (addr.resource_type == ACPI_MEMORY_RANGE) {
flags = IORESOURCE_MEM; flags = IORESOURCE_MEM;
root = &iomem_resource; root = &iomem_resource;
offset = addr.address_translation_offset; offset = addr.translation_offset;
} else if (addr.resource_type == ACPI_IO_RANGE) { } else if (addr.resource_type == ACPI_IO_RANGE) {
flags = IORESOURCE_IO; flags = IORESOURCE_IO;
root = &ioport_resource; root = &ioport_resource;
@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
window = &info->controller->window[info->controller->windows++]; window = &info->controller->window[info->controller->windows++];
window->resource.name = info->name; window->resource.name = info->name;
window->resource.flags = flags; window->resource.flags = flags;
window->resource.start = addr.min_address_range + offset; window->resource.start = addr.minimum + offset;
window->resource.end = window->resource.start + addr.address_length - 1; window->resource.end = window->resource.start + addr.address_length - 1;
window->resource.child = NULL; window->resource.child = NULL;
window->offset = offset; window->offset = offset;

View File

@ -1,3 +1,8 @@
obj-y := boot.o obj-y := boot.o
boot-y := ../../../i386/kernel/acpi/boot.o boot-y := ../../../i386/kernel/acpi/boot.o
obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
ifneq ($(CONFIG_ACPI_PROCESSOR),)
obj-y += processor.o
endif

View File

@ -0,0 +1,72 @@
/*
* arch/x86_64/kernel/acpi/processor.c
*
* Copyright (C) 2005 Intel Corporation
* Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
* - Added _PDC for platforms with 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 init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
{
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_EST_CAPABILITY_SMP;
obj->type = ACPI_TYPE_BUFFER;
obj->buffer.length = 12;
obj->buffer.pointer = (u8 *) buf;
obj_list->count = 1;
obj_list->pointer = obj;
pr->pdc = obj_list;
return;
}
/* Initialize _PDC data based on the CPU vendor */
void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
{
unsigned int cpu = pr->id;
struct cpuinfo_x86 *c = cpu_data + cpu;
pr->pdc = NULL;
if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST))
init_intel_pdc(pr, c);
return;
}
EXPORT_SYMBOL(arch_acpi_processor_init_pdc);

View File

@ -2027,7 +2027,7 @@ int __init io_apic_get_redir_entries (int ioapic)
} }
int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
{ {
struct IO_APIC_route_entry entry; struct IO_APIC_route_entry entry;
unsigned long flags; unsigned long flags;
@ -2049,8 +2049,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
entry.delivery_mode = INT_DELIVERY_MODE; entry.delivery_mode = INT_DELIVERY_MODE;
entry.dest_mode = INT_DEST_MODE; entry.dest_mode = INT_DEST_MODE;
entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
entry.trigger = edge_level; entry.trigger = triggering;
entry.polarity = active_high_low; entry.polarity = polarity;
entry.mask = 1; /* Disabled (masked) */ entry.mask = 1; /* Disabled (masked) */
irq = gsi_irq_sharing(irq); irq = gsi_irq_sharing(irq);
@ -2065,9 +2065,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
"IRQ %d Mode:%i Active:%i)\n", ioapic, "IRQ %d Mode:%i Active:%i)\n", ioapic,
mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
edge_level, active_high_low); triggering, polarity);
ioapic_register_intr(irq, entry.vector, edge_level); ioapic_register_intr(irq, entry.vector, triggering);
if (!ioapic && (irq < 16)) if (!ioapic && (irq < 16))
disable_8259A_irq(irq); disable_8259A_irq(irq);

View File

@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void)
#define MAX_GSI_NUM 4096 #define MAX_GSI_NUM 4096
int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) int mp_register_gsi(u32 gsi, int triggering, int polarity)
{ {
int ioapic = -1; int ioapic = -1;
int ioapic_pin = 0; int ioapic_pin = 0;
@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
if (edge_level) { if (triggering == ACPI_LEVEL_SENSITIVE) {
/* /*
* For PCI devices assign IRQs in order, avoiding gaps * For PCI devices assign IRQs in order, avoiding gaps
* due to unused I/O APIC pins. * due to unused I/O APIC pins.
@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
} }
io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
return gsi; return gsi;
} }

View File

@ -267,7 +267,6 @@ config ACPI_DEBUG
config ACPI_EC config ACPI_EC
bool bool
depends on X86
default y default y
help help
This driver is required on some systems for the proper operation of This driver is required on some systems for the proper operation of

View File

@ -71,8 +71,8 @@ static struct acpi_driver acpi_memory_device_driver = {
struct acpi_memory_device { struct acpi_memory_device {
acpi_handle handle; acpi_handle handle;
unsigned int state; /* State of the memory device */ unsigned int state; /* State of the memory device */
unsigned short cache_attribute; /* memory cache attribute */ unsigned short caching; /* memory cache attribute */
unsigned short read_write_attribute; /* memory read/write attribute */ unsigned short write_protect; /* memory read/write attribute */
u64 start_addr; /* Memory Range start physical addr */ u64 start_addr; /* Memory Range start physical addr */
u64 end_addr; /* Memory Range end physical addr */ u64 end_addr; /* Memory Range end physical addr */
}; };
@ -97,12 +97,12 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
if (address64.resource_type == ACPI_MEMORY_RANGE) { if (address64.resource_type == ACPI_MEMORY_RANGE) {
/* Populate the structure */ /* Populate the structure */
mem_device->cache_attribute = mem_device->caching =
address64.attribute.memory.cache_attribute; address64.info.mem.caching;
mem_device->read_write_attribute = mem_device->write_protect =
address64.attribute.memory.read_write_attribute; address64.info.mem.write_protect;
mem_device->start_addr = address64.min_address_range; mem_device->start_addr = address64.minimum;
mem_device->end_addr = address64.max_address_range; mem_device->end_addr = address64.maximum;
} }
} }
@ -250,7 +250,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
int result; int result;
u64 start = mem_device->start_addr; u64 start = mem_device->start_addr;
u64 len = mem_device->end_addr - start + 1; u64 len = mem_device->end_addr - start + 1;
unsigned long attr = mem_device->read_write_attribute;
ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); ACPI_FUNCTION_TRACE("acpi_memory_disable_device");

View File

@ -78,9 +78,9 @@ MODULE_LICENSE("GPL");
static uid_t asus_uid; static uid_t asus_uid;
static gid_t asus_gid; static gid_t asus_gid;
module_param(asus_uid, uint, 0); module_param(asus_uid, uint, 0);
MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n"); MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus.\n");
module_param(asus_gid, uint, 0); module_param(asus_gid, uint, 0);
MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n"); MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus.\n");
/* For each model, all features implemented, /* For each model, all features implemented,
* those marked with R are relative to HOTK, A for absolute */ * those marked with R are relative to HOTK, A for absolute */
@ -302,7 +302,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV", .brightness_set = "SPLV",
.brightness_get = "GPLV", .brightness_get = "GPLV",
.display_set = "SDSP", .display_set = "SDSP",
.display_get = "\\SSTE"}, .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"},
{ {
.name = "M6R", .name = "M6R",
.mt_mled = "MLED", .mt_mled = "MLED",
@ -851,6 +851,8 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
mode = S_IFREG | S_IRUGO | S_IWUGO; mode = S_IFREG | S_IRUGO | S_IWUGO;
} else { } else {
mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
printk(KERN_WARNING " asus_uid and asus_gid parameters are "
"deprecated, use chown and chmod instead!\n");
} }
acpi_device_dir(device) = asus_proc_dir; acpi_device_dir(device) = asus_proc_dir;
@ -987,9 +989,21 @@ static int __init asus_hotk_get_info(void)
printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", printk(KERN_NOTICE " BSTS called, 0x%02x returned\n",
bsts_result); bsts_result);
/* Samsung P30 has a device with a valid _HID whose INIT does not /* This is unlikely with implicit return */
* return anything. Catch this one and any similar here */ if (buffer.pointer == NULL)
if (buffer.pointer == NULL) { return -EINVAL;
model = (union acpi_object *) buffer.pointer;
/*
* Samsung P30 has a device with a valid _HID whose INIT does not
* return anything. It used to be possible to catch this exception,
* but the implicit return code will now happily confuse the
* driver. We assume that every ACPI_TYPE_STRING is a valid model
* identifier but it's still possible to get completely bogus data.
*/
if (model->type == ACPI_TYPE_STRING) {
printk(KERN_NOTICE " %s model detected, ", model->string.pointer);
} else {
if (asus_info && /* Samsung P30 */ if (asus_info && /* Samsung P30 */
strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) { strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
hotk->model = P30; hotk->model = P30;
@ -1002,13 +1016,10 @@ static int __init asus_hotk_get_info(void)
"the developers with your DSDT\n"); "the developers with your DSDT\n");
} }
hotk->methods = &model_conf[hotk->model]; hotk->methods = &model_conf[hotk->model];
return AE_OK;
} acpi_os_free(model);
model = (union acpi_object *)buffer.pointer; return AE_OK;
if (model->type == ACPI_TYPE_STRING) {
printk(KERN_NOTICE " %s model detected, ",
model->string.pointer);
} }
hotk->model = END_MODEL; hotk->model = END_MODEL;

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -128,7 +128,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, ACPI_IMODE_LOAD_PASS1, flags, walk_state,
&(node)); &(node));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status); ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
@ -232,7 +232,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
+ (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_ERROR((AE_INFO,
"Bit offset within field too large (> 0xFFFFFFFF)"));
return_ACPI_STATUS(AE_SUPPORT); return_ACPI_STATUS(AE_SUPPORT);
} }
@ -268,8 +269,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
ACPI_NS_DONT_OPEN_SCOPE, 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, ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
status); status);
if (status != AE_ALREADY_EXISTS) { if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -293,7 +294,11 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
+ (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", (char *)&info->field_node->name)); ACPI_ERROR((AE_INFO,
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
ACPI_CAST_PTR(char,
&info->field_node->
name)));
return_ACPI_STATUS(AE_SUPPORT); return_ACPI_STATUS(AE_SUPPORT);
} }
@ -302,9 +307,9 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info,
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Invalid opcode in field list: %X\n", "Invalid opcode in field list: %X",
arg->common.aml_opcode)); arg->common.aml_opcode));
return_ACPI_STATUS(AE_AML_BAD_OPCODE); return_ACPI_STATUS(AE_AML_BAD_OPCODE);
} }
@ -349,7 +354,7 @@ acpi_ds_create_field(union acpi_parse_object *op,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node); walk_state, &region_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status); ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
@ -431,8 +436,8 @@ acpi_ds_init_field_objects(union acpi_parse_object *op,
ACPI_NS_ERROR_IF_FOUND, 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, ACPI_ERROR_NAMESPACE((char *)&arg->named.name,
status); status);
if (status != AE_ALREADY_EXISTS) { if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -488,7 +493,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node); walk_state, &region_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status); ACPI_ERROR_NAMESPACE(arg->common.value.name, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
@ -502,7 +507,7 @@ acpi_ds_create_bank_field(union acpi_parse_object *op,
ACPI_NS_SEARCH_PARENT, walk_state, ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node); &info.register_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status); ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -560,7 +565,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
ACPI_NS_SEARCH_PARENT, walk_state, ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node); &info.register_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status); ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -573,7 +578,7 @@ acpi_ds_create_index_field(union acpi_parse_object *op,
ACPI_NS_SEARCH_PARENT, walk_state, ACPI_NS_SEARCH_PARENT, walk_state,
&info.data_register_node); &info.data_register_node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status); ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -84,7 +84,7 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
acpi_object_type type; acpi_object_type type;
acpi_status status; acpi_status status;
ACPI_FUNCTION_NAME("ds_init_one_object"); ACPI_FUNCTION_ENTRY();
/* /*
* We are only interested in NS nodes owned by the table that * We are only interested in NS nodes owned by the table that
@ -105,11 +105,10 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
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, ACPI_EXCEPTION((AE_INFO, status,
"Region %p [%4.4s] - Init failure, %s\n", "During Region initialization %p [%4.4s]",
obj_handle, obj_handle,
acpi_ut_get_node_name(obj_handle), acpi_ut_get_node_name(obj_handle)));
acpi_format_exception(status)));
} }
info->op_region_count++; info->op_region_count++;
@ -117,14 +116,6 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
case ACPI_TYPE_METHOD: case ACPI_TYPE_METHOD:
/*
* Print a dot for each method unless we are going to print
* the entire pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
}
/* /*
* Set the execution data width (32 or 64) based upon the * Set the execution data width (32 or 64) based upon the
* revision number of the parent ACPI table. * revision number of the parent ACPI table.
@ -134,6 +125,21 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
if (info->table_desc->pointer->revision == 1) { if (info->table_desc->pointer->revision == 1) {
node->flags |= ANOBJ_DATA_WIDTH_32; node->flags |= ANOBJ_DATA_WIDTH_32;
} }
#ifdef ACPI_INIT_PARSE_METHODS
/*
* Note 11/2005: Removed this code to parse all methods during table
* load because it causes problems if there are any errors during the
* parse. Also, it seems like overkill and we probably don't want to
* abort a table load because of an issue with a single method.
*/
/*
* Print a dot for each method unless we are going to print
* the entire pathname
*/
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
}
/* /*
* Always parse methods to detect errors, we will delete * Always parse methods to detect errors, we will delete
@ -141,15 +147,15 @@ acpi_ds_init_one_object(acpi_handle obj_handle,
*/ */
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, ACPI_ERROR((AE_INFO,
"\n+Method %p [%4.4s] - parse failure, %s\n", "Method %p [%4.4s] - parse failure, %s",
obj_handle, obj_handle,
acpi_ut_get_node_name(obj_handle), acpi_ut_get_node_name(obj_handle),
acpi_format_exception(status))); acpi_format_exception(status)));
/* This parse failed, but we will continue parsing more methods */ /* This parse failed, but we will continue parsing more methods */
} }
#endif
info->method_count++; info->method_count++;
break; break;
@ -207,8 +213,7 @@ acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX, status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
acpi_ds_init_one_object, &info, NULL); acpi_ds_init_one_object, &info, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n", ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
acpi_format_exception(status)));
} }
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -47,135 +47,66 @@
#include <acpi/acdispat.h> #include <acpi/acdispat.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsmethod") ACPI_MODULE_NAME("dsmethod")
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ds_parse_method * FUNCTION: acpi_ds_method_error
* *
* PARAMETERS: Node - Method node * PARAMETERS: Status - Execution status
* walk_state - Current state
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Parse the AML that is associated with the method. * DESCRIPTION: Called on method error. Invoke the global exception handler if
* present, dump the method data if the disassembler is configured
* *
* MUTEX: Assumes parser is locked * Note: Allows the exception handler to change the status code
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node) acpi_status
acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state)
{ {
acpi_status status; ACPI_FUNCTION_ENTRY();
union acpi_operand_object *obj_desc;
union acpi_parse_object *op;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node); /* Ignore AE_OK and control exception codes */
/* Parameter Validation */ if (ACPI_SUCCESS(status) || (status & AE_CODE_CONTROL)) {
return (status);
if (!node) {
return_ACPI_STATUS(AE_NULL_ENTRY);
} }
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, /* Invoke the global exception handler */
"**** Parsing [%4.4s] **** named_obj=%p\n",
acpi_ut_get_node_name(node), node));
/* Extract the method object from the method Node */ if (acpi_gbl_exception_handler) {
/* Exit the interpreter, allow handler to execute methods */
obj_desc = acpi_ns_get_attached_object(node); acpi_ex_exit_interpreter();
if (!obj_desc) {
return_ACPI_STATUS(AE_NULL_OBJECT); /*
* Handler can map the exception code to anything it wants, including
* AE_OK, in which case the executing method will not be aborted.
*/
status = acpi_gbl_exception_handler(status,
walk_state->method_node ?
walk_state->method_node->
name.integer : 0,
walk_state->opcode,
walk_state->aml_offset,
NULL);
(void)acpi_ex_enter_interpreter();
} }
#ifdef ACPI_DISASSEMBLER
/* Create a mutex for the method if there is a concurrency limit */
if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
(!obj_desc->method.semaphore)) {
status = acpi_os_create_semaphore(obj_desc->method.concurrency,
obj_desc->method.concurrency,
&obj_desc->method.semaphore);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
/*
* Allocate a new parser op to be the root of the parsed
* method tree
*/
op = acpi_ps_alloc_op(AML_METHOD_OP);
if (!op) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name(op, node->name.integer);
op->common.node = node;
/*
* Get a new owner_id for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
goto cleanup; /* Display method locals/args if disassembler is present */
acpi_dm_dump_method_info(status, walk_state, walk_state->op);
} }
#endif
/* Create and initialize a new walk state */ return (status);
walk_state =
acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup2;
}
status = acpi_ds_init_aml_walk(walk_state, op, node,
obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, 1);
if (ACPI_FAILURE(status)) {
acpi_ds_delete_walk_state(walk_state);
goto cleanup2;
}
/*
* Parse the method, first pass
*
* The first pass load is where newly declared named objects are added into
* the namespace. Actual evaluation of the named objects (what would be
* called a "second pass") happens during the actual execution of the
* method so that operands to the named objects can take on dynamic
* run-time values.
*/
status = acpi_ps_parse_aml(walk_state);
if (ACPI_FAILURE(status)) {
goto cleanup2;
}
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
acpi_ut_get_node_name(node), node, op));
/*
* Delete the parse tree. We simply re-parse the method for every
* execution since there isn't much overhead (compared to keeping lots
* of parse trees around)
*/
acpi_ns_delete_namespace_subtree(node);
acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
cleanup2:
acpi_ut_release_owner_id(&obj_desc->method.owner_id);
cleanup:
acpi_ps_delete_parse_tree(op);
return_ACPI_STATUS(status);
} }
/******************************************************************************* /*******************************************************************************
@ -195,9 +126,9 @@ acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, acpi_ds_begin_method_execution(struct acpi_namespace_node * method_node,
union acpi_operand_object *obj_desc, union acpi_operand_object * obj_desc,
struct acpi_namespace_node *calling_method_node) struct acpi_namespace_node * calling_method_node)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -210,7 +141,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
/* Prevent wraparound of thread count */ /* Prevent wraparound of thread count */
if (obj_desc->method.thread_count == ACPI_UINT8_MAX) { if (obj_desc->method.thread_count == ACPI_UINT8_MAX) {
ACPI_REPORT_ERROR(("Method reached maximum reentrancy limit (255)\n")); ACPI_ERROR((AE_INFO,
"Method reached maximum reentrancy limit (255)"));
return_ACPI_STATUS(AE_AML_METHOD_LIMIT); return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
} }
@ -539,22 +471,61 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
acpi_os_signal_semaphore(walk_state->method_desc->method. acpi_os_signal_semaphore(walk_state->method_desc->method.
semaphore, 1); semaphore, 1);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not signal method semaphore\n")); ACPI_ERROR((AE_INFO,
"Could not signal method semaphore"));
/* Ignore error and continue cleanup */ /* Ignore error and continue cleanup */
} }
} }
/*
* There are no more threads executing this method. Perform
* additional cleanup.
*
* The method Node is stored in the walk state
*/
method_node = walk_state->method_node;
/* Lock namespace for possible update */
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
goto exit;
}
/*
* Delete any namespace entries created immediately underneath
* the method
*/
if (method_node->child) {
acpi_ns_delete_namespace_subtree(method_node);
}
/*
* Delete any namespace entries created anywhere else within
* the namespace by the execution of this method
*/
acpi_ns_delete_namespace_by_owner(walk_state->method_desc->method.
owner_id);
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
/* Are there any other threads currently executing this method? */
if (walk_state->method_desc->method.thread_count) { if (walk_state->method_desc->method.thread_count) {
/*
* Additional threads. Do not release the owner_id in this case,
* we immediately reuse it for the next thread executing this method
*/
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"*** Not deleting method namespace, there are still %d threads\n", "*** Completed execution of one thread, %d threads remaining\n",
walk_state->method_desc->method. walk_state->method_desc->method.
thread_count)); thread_count));
} else { /* This is the last executing thread */ } else {
/* This is the only executing thread for this method */
/* /*
* Support to dynamically change a method from not_serialized to * Support to dynamically change a method from not_serialized to
* Serialized if it appears that the method is written foolishly and * Serialized if it appears that the method is incorrectly written and
* does not support multiple thread execution. The best example of this * does not support multiple thread execution. The best example of this
* is if such a method creates namespace objects and blocks. A second * is if such a method creates namespace objects and blocks. A second
* thread will fail with an AE_ALREADY_EXISTS exception * thread will fail with an AE_ALREADY_EXISTS exception
@ -570,34 +541,8 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
semaphore); semaphore);
} }
/* /* No more threads, we can free the owner_id */
* There are no more threads executing this method. Perform
* additional cleanup.
*
* The method Node is stored in the walk state
*/
method_node = walk_state->method_node;
/*
* Delete any namespace entries created immediately underneath
* the method
*/
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
goto exit;
}
if (method_node->child) {
acpi_ns_delete_namespace_subtree(method_node);
}
/*
* Delete any namespace entries created anywhere else within
* the namespace
*/
acpi_ns_delete_namespace_by_owner(walk_state->method_desc->
method.owner_id);
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
acpi_ut_release_owner_id(&walk_state->method_desc->method. acpi_ut_release_owner_id(&walk_state->method_desc->method.
owner_id); owner_id);
} }
@ -606,3 +551,140 @@ void acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
(void)acpi_ut_release_mutex(ACPI_MTX_PARSER); (void)acpi_ut_release_mutex(ACPI_MTX_PARSER);
return_VOID; return_VOID;
} }
#ifdef ACPI_INIT_PARSE_METHODS
/*
* Note 11/2005: Removed this code to parse all methods during table
* load because it causes problems if there are any errors during the
* parse. Also, it seems like overkill and we probably don't want to
* abort a table load because of an issue with a single method.
*/
/*******************************************************************************
*
* FUNCTION: acpi_ds_parse_method
*
* PARAMETERS: Node - Method node
*
* RETURN: Status
*
* DESCRIPTION: Parse the AML that is associated with the method.
*
* MUTEX: Assumes parser is locked
*
******************************************************************************/
acpi_status acpi_ds_parse_method(struct acpi_namespace_node *node)
{
acpi_status status;
union acpi_operand_object *obj_desc;
union acpi_parse_object *op;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
/* Parameter Validation */
if (!node) {
return_ACPI_STATUS(AE_NULL_ENTRY);
}
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"**** Parsing [%4.4s] **** named_obj=%p\n",
acpi_ut_get_node_name(node), node));
/* Extract the method object from the method Node */
obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) {
return_ACPI_STATUS(AE_NULL_OBJECT);
}
/* Create a mutex for the method if there is a concurrency limit */
if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
(!obj_desc->method.semaphore)) {
status = acpi_os_create_semaphore(obj_desc->method.concurrency,
obj_desc->method.concurrency,
&obj_desc->method.semaphore);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
/*
* Allocate a new parser op to be the root of the parsed
* method tree
*/
op = acpi_ps_alloc_op(AML_METHOD_OP);
if (!op) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Init new op with the method name and pointer back to the Node */
acpi_ps_set_name(op, node->name.integer);
op->common.node = node;
/*
* Get a new owner_id for objects created by this method. Namespace
* objects (such as Operation Regions) can be created during the
* first pass parse.
*/
status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
/* Create and initialize a new walk state */
walk_state =
acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup2;
}
status = acpi_ds_init_aml_walk(walk_state, op, node,
obj_desc->method.aml_start,
obj_desc->method.aml_length, NULL, 1);
if (ACPI_FAILURE(status)) {
acpi_ds_delete_walk_state(walk_state);
goto cleanup2;
}
/*
* Parse the method, first pass
*
* The first pass load is where newly declared named objects are added into
* the namespace. Actual evaluation of the named objects (what would be
* called a "second pass") happens during the actual execution of the
* method so that operands to the named objects can take on dynamic
* run-time values.
*/
status = acpi_ps_parse_aml(walk_state);
if (ACPI_FAILURE(status)) {
goto cleanup2;
}
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
acpi_ut_get_node_name(node), node, op));
/*
* Delete the parse tree. We simply re-parse the method for every
* execution since there isn't much overhead (compared to keeping lots
* of parse trees around)
*/
acpi_ns_delete_namespace_subtree(node);
acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
cleanup2:
acpi_ut_release_owner_id(&obj_desc->method.owner_id);
cleanup:
acpi_ps_delete_parse_tree(op);
return_ACPI_STATUS(status);
}
#endif

View File

@ -5,7 +5,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -260,9 +260,9 @@ acpi_ds_method_data_get_node(u16 opcode,
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, ACPI_ERROR((AE_INFO,
"Local index %d is invalid (max %d)\n", "Local index %d is invalid (max %d)",
index, ACPI_METHOD_MAX_LOCAL)); index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS(AE_AML_INVALID_INDEX); return_ACPI_STATUS(AE_AML_INVALID_INDEX);
} }
@ -274,9 +274,9 @@ acpi_ds_method_data_get_node(u16 opcode,
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, ACPI_ERROR((AE_INFO,
"Arg index %d is invalid (max %d)\n", "Arg index %d is invalid (max %d)",
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,8 +286,7 @@ acpi_ds_method_data_get_node(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n", ACPI_ERROR((AE_INFO, "Opcode %d is invalid", opcode));
opcode));
return_ACPI_STATUS(AE_AML_BAD_OPCODE); return_ACPI_STATUS(AE_AML_BAD_OPCODE);
} }
@ -378,8 +377,7 @@ acpi_ds_method_data_get_value(u16 opcode,
/* Validate the object descriptor */ /* Validate the object descriptor */
if (!dest_desc) { if (!dest_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Null object descriptor pointer"));
"Null object descriptor pointer\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
@ -424,23 +422,24 @@ acpi_ds_method_data_get_value(u16 opcode,
switch (opcode) { switch (opcode) {
case AML_ARG_OP: case AML_ARG_OP:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Uninitialized Arg[%d] at node %p\n", "Uninitialized Arg[%d] at node %p",
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, ACPI_ERROR((AE_INFO,
"Uninitialized Local[%d] at node %p\n", "Uninitialized Local[%d] at node %p",
index, node)); index, node));
return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL); return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
default: default:
ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n", ACPI_ERROR((AE_INFO,
opcode)); "Not a Arg/Local opcode: %X",
opcode));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -51,6 +51,7 @@
#define _COMPONENT ACPI_DISPATCHER #define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsobject") ACPI_MODULE_NAME("dsobject")
/* Local prototypes */
static acpi_status static acpi_status
acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
union acpi_parse_object *op, union acpi_parse_object *op,
@ -85,7 +86,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
*obj_desc_ptr = NULL; *obj_desc_ptr = NULL;
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) { if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/* /*
* This is an named object reference. If this name was * This is a named object reference. If this name was
* previously looked up in the namespace, it was stored in this op. * previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now * Otherwise, go ahead and look it up now
*/ */
@ -96,18 +97,48 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
ACPI_IMODE_EXECUTE, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_SEARCH_PARENT |
ACPI_NS_DONT_OPEN_SCOPE, NULL, ACPI_NS_DONT_OPEN_SCOPE, NULL,
(struct acpi_namespace_node **) ACPI_CAST_INDIRECT_PTR(struct
&(op->common.node)); acpi_namespace_node,
&(op->
common.
node)));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(op->common.value.string, /* Check if we are resolving a named reference within a package */
status);
if ((status == AE_NOT_FOUND)
&& (acpi_gbl_enable_interpreter_slack)
&&
((op->common.parent->common.aml_opcode ==
AML_PACKAGE_OP)
|| (op->common.parent->common.aml_opcode ==
AML_VAR_PACKAGE_OP))) {
/*
* We didn't find the target and we are populating elements
* of a package - ignore if slack enabled. Some ASL code
* contains dangling invalid references in packages and
* expects that no exception will be issued. Leave the
* element as a null element. It cannot be used, but it
* can be overwritten by subsequent ASL code - this is
* typically the case.
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Ignoring unresolved reference in package [%4.4s]\n",
walk_state->
scope_info->scope.
node->name.ascii));
return_ACPI_STATUS(AE_OK);
} else {
ACPI_ERROR_NAMESPACE(op->common.value.
string, status);
}
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} }
} }
/* Create and init the internal ACPI object */ /* Create and init a new internal ACPI object */
obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
(op->common.aml_opcode))-> (op->common.aml_opcode))->
@ -157,13 +188,13 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj"); ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
/*
* If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
* The buffer object already exists (from the NS node), otherwise it must
* be created.
*/
obj_desc = *obj_desc_ptr; obj_desc = *obj_desc_ptr;
if (obj_desc) { if (!obj_desc) {
/*
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
* The buffer object already exists (from the NS node)
*/
} else {
/* Create a new buffer object */ /* Create a new buffer object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER); obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@ -183,10 +214,9 @@ acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
byte_list = arg->named.next; byte_list = arg->named.next;
if (byte_list) { if (byte_list) {
if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) { if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Expecting bytelist, got AML opcode %X in op %p\n", "Expecting bytelist, got AML opcode %X in op %p",
byte_list->common.aml_opcode, byte_list->common.aml_opcode, byte_list));
byte_list));
acpi_ut_remove_reference(obj_desc); acpi_ut_remove_reference(obj_desc);
return (AE_TYPE); return (AE_TYPE);
@ -259,7 +289,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
union acpi_operand_object *obj_desc = NULL; union acpi_operand_object *obj_desc = NULL;
u32 package_list_length; u32 package_list_length;
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 i; acpi_native_uint i;
ACPI_FUNCTION_TRACE("ds_build_internal_package_obj"); ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
@ -271,13 +301,12 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
parent = parent->common.parent; parent = parent->common.parent;
} }
/*
* If we are evaluating a Named package object "Name (xxxx, Package)",
* the package object already exists, otherwise it must be created.
*/
obj_desc = *obj_desc_ptr; obj_desc = *obj_desc_ptr;
if (obj_desc) { if (!obj_desc) {
/*
* We are evaluating a Named package object "Name (xxxx, Package)".
* Get the existing package object from the NS node
*/
} else {
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE); obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
*obj_desc_ptr = obj_desc; *obj_desc_ptr = obj_desc;
if (!obj_desc) { if (!obj_desc) {
@ -291,11 +320,9 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
/* Count the number of items in the package list */ /* Count the number of items in the package list */
package_list_length = 0;
arg = op->common.value.arg; arg = op->common.value.arg;
arg = arg->common.next; arg = arg->common.next;
while (arg) { for (package_list_length = 0; arg; package_list_length++) {
package_list_length++;
arg = arg->common.next; arg = arg->common.next;
} }
@ -322,12 +349,11 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
} }
/* /*
* Now init the elements of the package * Initialize all elements of the package
*/ */
i = 0;
arg = op->common.value.arg; arg = op->common.value.arg;
arg = arg->common.next; arg = arg->common.next;
while (arg) { for (i = 0; arg; i++) {
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 */
@ -340,8 +366,6 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
package. package.
elements[i]); elements[i]);
} }
i++;
arg = arg->common.next; arg = arg->common.next;
} }
@ -518,9 +542,9 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unknown constant opcode %X\n", "Unknown constant opcode %X",
opcode)); opcode));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
} }
@ -535,9 +559,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Unknown Integer type %X",
"Unknown Integer type %X\n", op_info->type));
op_info->type));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
} }
@ -615,9 +638,8 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
"Unimplemented data type: %X\n", ACPI_GET_OBJECT_TYPE(obj_desc)));
ACPI_GET_OBJECT_TYPE(obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -245,7 +245,9 @@ acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
node = obj_desc->buffer.node; node = obj_desc->buffer.node;
if (!node) { if (!node) {
ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc)); ACPI_ERROR((AE_INFO,
"No pointer back to NS node in buffer obj %p",
obj_desc));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -287,8 +289,9 @@ acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
node = obj_desc->package.node; node = obj_desc->package.node;
if (!node) { if (!node) {
ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n", ACPI_ERROR((AE_INFO,
obj_desc)); "No pointer back to NS node in package %p",
obj_desc));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -413,9 +416,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
/* Host object must be a Buffer */ /* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) { if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Target of Create Field is not a Buffer object - %s\n", "Target of Create Field is not a Buffer object - %s",
acpi_ut_get_object_type_name(buffer_desc))); acpi_ut_get_object_type_name(buffer_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
@ -427,10 +430,10 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
* 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, ACPI_ERROR((AE_INFO,
"(%s) destination not a NS Node [%s]\n", "(%s) destination not a NS Node [%s]",
acpi_ps_get_opcode_name(aml_opcode), acpi_ps_get_opcode_name(aml_opcode),
acpi_ut_get_descriptor_name(result_desc))); acpi_ut_get_descriptor_name(result_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
@ -453,8 +456,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
/* Must have a valid (>0) bit count */ /* Must have a valid (>0) bit count */
if (bit_count == 0) { if (bit_count == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Attempt to create_field of length 0\n")); "Attempt to create_field of length zero"));
status = AE_AML_OPERAND_VALUE; status = AE_AML_OPERAND_VALUE;
goto cleanup; goto cleanup;
} }
@ -507,9 +510,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unknown field creation opcode %02x\n", "Unknown field creation opcode %02x", aml_opcode));
aml_opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
@ -517,13 +519,12 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
/* Entire field must fit within the current length of the buffer */ /* Entire field must fit within the current length of the buffer */
if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) { if ((bit_offset + bit_count) > (8 * (u32) buffer_desc->buffer.length)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n", "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
acpi_ut_get_node_name(result_desc), acpi_ut_get_node_name(result_desc),
bit_offset + bit_count, bit_offset + bit_count,
acpi_ut_get_node_name(buffer_desc->buffer. acpi_ut_get_node_name(buffer_desc->buffer.node),
node), 8 * (u32) buffer_desc->buffer.length));
8 * (u32) buffer_desc->buffer.length));
status = AE_AML_BUFFER_LIMIT; status = AE_AML_BUFFER_LIMIT;
goto cleanup; goto cleanup;
} }
@ -629,9 +630,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
"after acpi_ex_resolve_operands"); "after acpi_ex_resolve_operands");
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", ACPI_ERROR((AE_INFO, "(%s) bad operand(s) (%X)",
acpi_ps_get_opcode_name(op->common. acpi_ps_get_opcode_name(op->common.aml_opcode),
aml_opcode), status)); status));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -1155,9 +1156,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Unknown control opcode=%X Op=%p",
"Unknown control opcode=%X Op=%p\n", op->common.aml_opcode, op));
op->common.aml_opcode, op));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
break; break;

View File

@ -5,7 +5,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -176,8 +176,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
/* Must have both an Op and a Result Object */ /* Must have both an Op and a Result Object */
if (!op) { if (!op) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); ACPI_ERROR((AE_INFO, "Null Op"));
return_VALUE(TRUE); return_UINT8(TRUE);
} }
/* /*
@ -208,7 +208,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
"At Method level, result of [%s] not used\n", "At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name(op->common. acpi_ps_get_opcode_name(op->common.
aml_opcode))); aml_opcode)));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/* Get info on the parent. The root_op is AML_SCOPE */ /* Get info on the parent. The root_op is AML_SCOPE */
@ -216,9 +216,8 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
parent_info = parent_info =
acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode); 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, ACPI_ERROR((AE_INFO, "Unknown parent opcode Op=%p", op));
"Unknown parent opcode. Op=%p\n", op)); return_UINT8(FALSE);
return_VALUE(FALSE);
} }
/* /*
@ -304,7 +303,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common. acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op)); aml_opcode), op));
return_VALUE(TRUE); return_UINT8(TRUE);
result_not_used: result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@ -313,7 +312,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,
acpi_ps_get_opcode_name(op->common.parent->common. acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op)); aml_opcode), op));
return_VALUE(FALSE); return_UINT8(FALSE);
} }
/******************************************************************************* /*******************************************************************************
@ -344,7 +343,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj); ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
if (!op) { if (!op) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n")); ACPI_ERROR((AE_INFO, "Null Op"));
return_VOID; return_VOID;
} }
@ -567,7 +566,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(name_string, status); ACPI_ERROR_NAMESPACE(name_string, status);
} }
} }
@ -616,7 +615,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
if (op_info->flags & AML_HAS_RETVAL) { if (op_info->flags & AML_HAS_RETVAL) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Argument previously created, already stacked \n")); "Argument previously created, already stacked\n"));
ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(walk_state-> (walk_state->
@ -635,10 +634,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
* 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, ACPI_EXCEPTION((AE_INFO, status,
"Missing or null operand, %s\n", "Missing or null operand"));
acpi_format_exception
(status)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
} else { } else {
@ -730,7 +727,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,
*/ */
(void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state); (void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n", ACPI_EXCEPTION((AE_INFO, status, "While creating Arg %d",
(arg_count + 1), acpi_format_exception(status))); (arg_count + 1)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -100,9 +100,8 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
if (result_obj) { if (result_obj) {
status = acpi_ds_result_pop(&obj_desc, walk_state); status = acpi_ds_result_pop(&obj_desc, walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"Could not get result from predicate evaluation, %s\n", "Could not get result from predicate evaluation"));
acpi_format_exception(status)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -123,9 +122,9 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
} }
if (!obj_desc) { if (!obj_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"No predicate obj_desc=%p State=%p\n", "No predicate obj_desc=%p State=%p",
obj_desc, walk_state)); obj_desc, walk_state));
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
@ -140,10 +139,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
} }
if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n", "Bad predicate (not an integer) obj_desc=%p State=%p Type=%X",
obj_desc, walk_state, obj_desc, walk_state,
ACPI_GET_OBJECT_TYPE(obj_desc))); ACPI_GET_OBJECT_TYPE(obj_desc)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
@ -314,12 +313,13 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
case AML_CLASS_EXECUTE: case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE: case AML_CLASS_CREATE:
/* /*
* Most operators with arguments. * Most operators with arguments.
* Start a new result/operand state * Start a new result/operand state
*/ */
status = acpi_ds_result_stack_push(walk_state); if (walk_state->opcode != AML_CREATE_FIELD_OP) {
status = acpi_ds_result_stack_push(walk_state);
}
break; break;
default: default:
@ -361,8 +361,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
op_class = walk_state->op_info->class; op_class = walk_state->op_info->class;
if (op_class == AML_CLASS_UNKNOWN) { if (op_class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n", ACPI_ERROR((AE_INFO, "Unknown opcode %X",
op->common.aml_opcode)); op->common.aml_opcode));
return_ACPI_STATUS(AE_NOT_IMPLEMENTED); return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
} }
@ -452,12 +452,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
walk_state->operands[1]->reference.offset)) { walk_state->operands[1]->reference.offset)) {
status = AE_OK; status = AE_OK;
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"[%s]: Could not resolve operands, %s\n", "While resolving operands for [%s]",
acpi_ps_get_opcode_name acpi_ps_get_opcode_name
(walk_state->opcode), (walk_state->opcode)));
acpi_format_exception
(status)));
} }
} }
@ -676,8 +674,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
case AML_TYPE_UNDEFINED: case AML_TYPE_UNDEFINED:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Undefined opcode type Op=%p\n", op)); "Undefined opcode type Op=%p", op));
return_ACPI_STATUS(AE_NOT_IMPLEMENTED); return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
case AML_TYPE_BOGUS: case AML_TYPE_BOGUS:
@ -689,10 +687,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
op_class, op_type, op_class, op_type, op->common.aml_opcode,
op->common.aml_opcode, op)); op));
status = AE_NOT_IMPLEMENTED; status = AE_NOT_IMPLEMENTED;
break; break;
@ -723,20 +721,6 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
cleanup: cleanup:
/* Invoke exception handler on error */
if (ACPI_FAILURE(status) &&
acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
acpi_ex_exit_interpreter();
status = acpi_gbl_exception_handler(status,
walk_state->method_node->
name.integer,
walk_state->opcode,
walk_state->aml_offset,
NULL);
(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 */
@ -758,18 +742,14 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
} }
#endif #endif
/* Invoke exception handler on error */
if (ACPI_FAILURE(status)) {
status = acpi_ds_method_error(status, walk_state);
}
/* Always clear the object stack */ /* Always clear the object stack */
walk_state->num_operands = 0; walk_state->num_operands = 0;
#ifdef ACPI_DISASSEMBLER
/* On error, display method locals/args */
if (ACPI_FAILURE(status)) {
acpi_dm_dump_method_info(status, walk_state, op);
}
#endif
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -127,7 +127,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
char *path; char *path;
u32 flags; u32 flags;
ACPI_FUNCTION_NAME("ds_load1_begin_op"); ACPI_FUNCTION_TRACE("ds_load1_begin_op");
op = walk_state->op; op = walk_state->op;
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@ -138,14 +138,14 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
if (op) { if (op) {
if (!(walk_state->op_info->flags & AML_NAMED)) { if (!(walk_state->op_info->flags & AML_NAMED)) {
*out_op = op; *out_op = op;
return (AE_OK); return_ACPI_STATUS(AE_OK);
} }
/* Check if this object has already been installed in the namespace */ /* Check if this object has already been installed in the namespace */
if (op->common.node) { if (op->common.node) {
*out_op = op; *out_op = op;
return (AE_OK); return_ACPI_STATUS(AE_OK);
} }
} }
@ -187,8 +187,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
} }
#endif #endif
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(path, status); ACPI_ERROR_NAMESPACE(path, status);
return (status); return_ACPI_STATUS(status);
} }
/* /*
@ -233,9 +233,11 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
/* 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_ut_get_type_name(node->type), path)); ACPI_ERROR((AE_INFO,
"Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
acpi_ut_get_type_name(node->type), path));
return (AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
break; break;
@ -257,6 +259,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
* buffer_field, or Package), the name of the object is already * buffer_field, or Package), the name of the object is already
* in the namespace. * in the namespace.
*/ */
if (walk_state->deferred_node) { if (walk_state->deferred_node) {
/* This name is already in the namespace, get the node */ /* This name is already in the namespace, get the node */
@ -265,6 +268,16 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
break; break;
} }
/*
* If we are executing a method, do not create any namespace objects
* during the load phase, only during execution.
*/
if (walk_state->method_node) {
node = NULL;
status = AE_OK;
break;
}
flags = ACPI_NS_NO_UPSEARCH; flags = ACPI_NS_NO_UPSEARCH;
if ((walk_state->opcode != AML_SCOPE_OP) && if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) { (!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
@ -289,8 +302,8 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, ACPI_IMODE_LOAD_PASS1, flags, walk_state,
&(node)); &(node));
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(path, status); ACPI_ERROR_NAMESPACE(path, status);
return (status); return_ACPI_STATUS(status);
} }
break; break;
} }
@ -302,28 +315,29 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
op = acpi_ps_alloc_op(walk_state->opcode); op = acpi_ps_alloc_op(walk_state->opcode);
if (!op) { if (!op) {
return (AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
} }
/* Initialize */ /* Initialize the op */
op->named.name = node->name.integer;
#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
op->named.path = (u8 *) path; op->named.path = ACPI_CAST_PTR(u8, path);
#endif #endif
/* if (node) {
* Put the Node in the "op" object that the parser uses, so we /*
* can get it again quickly when this scope is closed * Put the Node in the "op" object that the parser uses, so we
*/ * can get it again quickly when this scope is closed
op->common.node = node; */
op->common.node = node;
op->named.name = node->name.integer;
}
acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state), acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state),
op); op);
*out_op = op; *out_op = op;
return (status); return_ACPI_STATUS(status);
} }
/******************************************************************************* /*******************************************************************************
@ -339,13 +353,13 @@ acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
* *
******************************************************************************/ ******************************************************************************/
acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state) acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state)
{ {
union acpi_parse_object *op; union acpi_parse_object *op;
acpi_object_type object_type; acpi_object_type object_type;
acpi_status status = AE_OK; acpi_status status = AE_OK;
ACPI_FUNCTION_NAME("ds_load1_end_op"); ACPI_FUNCTION_TRACE("ds_load1_end_op");
op = walk_state->op; op = walk_state->op;
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
@ -354,7 +368,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
/* We are only interested in opcodes that have an associated name */ /* We are only interested in opcodes that have an associated name */
if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) { if (!(walk_state->op_info->flags & (AML_NAMED | AML_FIELD))) {
return (AE_OK); return_ACPI_STATUS(AE_OK);
} }
/* Get the object type to determine if we should pop the scope */ /* Get the object type to determine if we should pop the scope */
@ -363,21 +377,37 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
if (walk_state->op_info->flags & AML_FIELD) { if (walk_state->op_info->flags & AML_FIELD) {
if (walk_state->opcode == AML_FIELD_OP || /*
walk_state->opcode == AML_BANK_FIELD_OP || * If we are executing a method, do not create any namespace objects
walk_state->opcode == AML_INDEX_FIELD_OP) { * during the load phase, only during execution.
status = acpi_ds_init_field_objects(op, walk_state); */
if (!walk_state->method_node) {
if (walk_state->opcode == AML_FIELD_OP ||
walk_state->opcode == AML_BANK_FIELD_OP ||
walk_state->opcode == AML_INDEX_FIELD_OP) {
status =
acpi_ds_init_field_objects(op, walk_state);
}
} }
return (status); return_ACPI_STATUS(status);
} }
if (op->common.aml_opcode == AML_REGION_OP) { /*
status = acpi_ex_create_region(op->named.data, op->named.length, * If we are executing a method, do not create any namespace objects
(acpi_adr_space_type) * during the load phase, only during execution.
((op->common.value.arg)->common. */
value.integer), walk_state); if (!walk_state->method_node) {
if (ACPI_FAILURE(status)) { if (op->common.aml_opcode == AML_REGION_OP) {
return (status); status =
acpi_ex_create_region(op->named.data,
op->named.length,
(acpi_adr_space_type)
((op->common.value.arg)->
common.value.integer),
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
} }
} }
#endif #endif
@ -391,47 +421,63 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
common. common.
aml_opcode))-> aml_opcode))->
object_type; object_type;
op->common.node->type = (u8) object_type;
}
}
if (op->common.aml_opcode == AML_METHOD_OP) { /* Set node type if we have a namespace node */
/*
* method_op pkg_length name_string method_flags term_list
*
* Note: We must create the method node/object pair as soon as we
* see the method declaration. This allows later pass1 parsing
* of invocations of the method (need to know the number of
* arguments.)
*/
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"LOADING-Method: State=%p Op=%p named_obj=%p\n",
walk_state, op, op->named.node));
if (!acpi_ns_get_attached_object(op->named.node)) { if (op->common.node) {
walk_state->operands[0] = (void *)op->named.node; op->common.node->type = (u8) object_type;
walk_state->num_operands = 1;
status =
acpi_ds_create_operands(walk_state,
op->common.value.arg);
if (ACPI_SUCCESS(status)) {
status = acpi_ex_create_method(op->named.data,
op->named.length,
walk_state);
}
walk_state->operands[0] = NULL;
walk_state->num_operands = 0;
if (ACPI_FAILURE(status)) {
return (status);
} }
} }
} }
/* Pop the scope stack */ /*
* If we are executing a method, do not create any namespace objects
* during the load phase, only during execution.
*/
if (!walk_state->method_node) {
if (op->common.aml_opcode == AML_METHOD_OP) {
/*
* method_op pkg_length name_string method_flags term_list
*
* Note: We must create the method node/object pair as soon as we
* see the method declaration. This allows later pass1 parsing
* of invocations of the method (need to know the number of
* arguments.)
*/
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"LOADING-Method: State=%p Op=%p named_obj=%p\n",
walk_state, op, op->named.node));
if (acpi_ns_opens_scope(object_type)) { if (!acpi_ns_get_attached_object(op->named.node)) {
walk_state->operands[0] =
ACPI_CAST_PTR(void, op->named.node);
walk_state->num_operands = 1;
status =
acpi_ds_create_operands(walk_state,
op->common.value.
arg);
if (ACPI_SUCCESS(status)) {
status =
acpi_ex_create_method(op->named.
data,
op->named.
length,
walk_state);
}
walk_state->operands[0] = NULL;
walk_state->num_operands = 0;
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
}
}
/* Pop the scope stack (only if loading a table) */
if (!walk_state->method_node && acpi_ns_opens_scope(object_type)) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"(%s): Popping scope for Op %p\n", "(%s): Popping scope for Op %p\n",
acpi_ut_get_type_name(object_type), op)); acpi_ut_get_type_name(object_type), op));
@ -439,7 +485,7 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
status = acpi_ds_scope_stack_pop(walk_state); status = acpi_ds_scope_stack_pop(walk_state);
} }
return (status); return_ACPI_STATUS(status);
} }
/******************************************************************************* /*******************************************************************************
@ -456,8 +502,8 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
******************************************************************************/ ******************************************************************************/
acpi_status acpi_status
acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state, acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
union acpi_parse_object ** out_op) union acpi_parse_object **out_op)
{ {
union acpi_parse_object *op; union acpi_parse_object *op;
struct acpi_namespace_node *node; struct acpi_namespace_node *node;
@ -574,10 +620,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
if (status == AE_NOT_FOUND) { if (status == AE_NOT_FOUND) {
status = AE_OK; status = AE_OK;
} else { } else {
ACPI_REPORT_NSERROR(buffer_ptr, status); ACPI_ERROR_NAMESPACE(buffer_ptr, status);
} }
#else #else
ACPI_REPORT_NSERROR(buffer_ptr, status); ACPI_ERROR_NAMESPACE(buffer_ptr, status);
#endif #endif
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -607,7 +653,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
* Scope (DEB) { ... } * Scope (DEB) { ... }
*/ */
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))); ACPI_WARNING((AE_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
buffer_ptr,
acpi_ut_get_type_name(node->type)));
node->type = ACPI_TYPE_ANY; node->type = ACPI_TYPE_ANY;
walk_state->scope_info->common.value = ACPI_TYPE_ANY; walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@ -617,7 +666,10 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
/* 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_ut_get_type_name(node->type), buffer_ptr)); ACPI_ERROR((AE_INFO,
"Invalid type (%s) for target of Scope operator [%4.4s]",
acpi_ut_get_type_name(node->type),
buffer_ptr));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
} }
@ -670,7 +722,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(buffer_ptr, status); ACPI_ERROR_NAMESPACE(buffer_ptr, status);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -840,6 +892,13 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
case AML_TYPE_NAMED_FIELD: case AML_TYPE_NAMED_FIELD:
/*
* If we are executing a method, initialize the field
*/
if (walk_state->method_node) {
status = acpi_ds_init_field_objects(op, walk_state);
}
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
case AML_INDEX_FIELD_OP: case AML_INDEX_FIELD_OP:
@ -929,6 +988,24 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
switch (op->common.aml_opcode) { switch (op->common.aml_opcode) {
#ifndef ACPI_NO_METHOD_EXECUTION #ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP: case AML_REGION_OP:
/*
* If we are executing a method, initialize the region
*/
if (walk_state->method_node) {
status =
acpi_ex_create_region(op->named.data,
op->named.length,
(acpi_adr_space_type)
((op->common.value.
arg)->common.value.
integer),
walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}
}
/* /*
* The op_region is not fully parsed at this time. Only valid * The op_region is not fully parsed at this time. Only valid
* argument is the space_id. (We must save the address of the * argument is the space_id. (We must save the address of the
@ -957,11 +1034,50 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
status = acpi_ds_create_node(walk_state, node, op); status = acpi_ds_create_node(walk_state, node, op);
break; break;
case AML_METHOD_OP:
/*
* method_op pkg_length name_string method_flags term_list
*
* Note: We must create the method node/object pair as soon as we
* see the method declaration. This allows later pass1 parsing
* of invocations of the method (need to know the number of
* arguments.)
*/
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"LOADING-Method: State=%p Op=%p named_obj=%p\n",
walk_state, op, op->named.node));
if (!acpi_ns_get_attached_object(op->named.node)) {
walk_state->operands[0] =
ACPI_CAST_PTR(void, op->named.node);
walk_state->num_operands = 1;
status =
acpi_ds_create_operands(walk_state,
op->common.value.
arg);
if (ACPI_SUCCESS(status)) {
status =
acpi_ex_create_method(op->named.
data,
op->named.
length,
walk_state);
}
walk_state->operands[0] = NULL;
walk_state->num_operands = 0;
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
break;
#endif /* ACPI_NO_METHOD_EXECUTION */ #endif /* ACPI_NO_METHOD_EXECUTION */
default: default:
/* All NAMED_COMPLEX opcodes must be handled above */ /* All NAMED_COMPLEX opcodes must be handled above */
/* Note: Method objects were already created in Pass 1 */
break; break;
} }
break; break;
@ -1004,7 +1120,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
*/ */
op->common.node = new_node; op->common.node = new_node;
} else { } else {
ACPI_REPORT_NSERROR(arg->common.value.string, status); ACPI_ERROR_NAMESPACE(arg->common.value.string, status);
} }
break; break;

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -107,14 +107,14 @@ acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
if (!node) { if (!node) {
/* Invalid scope */ /* Invalid scope */
ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n")); ACPI_ERROR((AE_INFO, "Null scope parameter"));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* 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_WARNING((AE_INFO, "Invalid object type: 0x%X", type));
} }
/* Allocate a new scope object */ /* Allocate a new scope object */

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -92,26 +92,23 @@ acpi_ds_result_remove(union acpi_operand_object **object,
state = walk_state->results; state = walk_state->results;
if (!state) { if (!state) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "No result object pushed! State=%p",
"No result object pushed! State=%p\n", walk_state));
walk_state));
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (index >= ACPI_OBJ_MAX_OPERAND) { if (index >= ACPI_OBJ_MAX_OPERAND) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Index out of range: %X State=%p Num=%X\n", "Index out of range: %X State=%p Num=%X",
index, walk_state, index, walk_state, state->results.num_results));
state->results.num_results));
} }
/* Check for a valid result object */ /* Check for a valid result object */
if (!state->results.obj_desc[index]) { if (!state->results.obj_desc[index]) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Null operand! State=%p #Ops=%X, Index=%X\n", "Null operand! State=%p #Ops=%X, Index=%X",
walk_state, state->results.num_results, walk_state, state->results.num_results, index));
index));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -163,9 +160,8 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
} }
if (!state->results.num_results) { if (!state->results.num_results) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Result stack is empty! State=%p",
"Result stack is empty! State=%p\n", walk_state));
walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -192,8 +188,7 @@ acpi_ds_result_pop(union acpi_operand_object ** object,
} }
} }
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "No result objects! State=%p", walk_state));
"No result objects! State=%p\n", walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -222,15 +217,14 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
state = walk_state->results; state = walk_state->results;
if (!state) { if (!state) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Warning: No result object pushed! State=%p\n", "No result object pushed! State=%p", walk_state));
walk_state));
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (!state->results.num_results) { if (!state->results.num_results) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "No result objects! State=%p",
"No result objects! State=%p\n", walk_state)); walk_state));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -250,10 +244,10 @@ acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
/* Check for a valid result object */ /* Check for a valid result object */
if (!*object) { if (!*object) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Null operand! State=%p #Ops=%X Index=%X\n", "Null operand! State=%p #Ops=%X Index=%X",
walk_state, state->results.num_results, walk_state, state->results.num_results,
(u32) index)); (u32) index));
return (AE_AML_NO_RETURN_VALUE); return (AE_AML_NO_RETURN_VALUE);
} }
@ -288,23 +282,21 @@ acpi_ds_result_push(union acpi_operand_object * object,
state = walk_state->results; state = walk_state->results;
if (!state) { if (!state) {
ACPI_REPORT_ERROR(("No result stack frame during push\n")); ACPI_ERROR((AE_INFO, "No result stack frame during push"));
return (AE_AML_INTERNAL); return (AE_AML_INTERNAL);
} }
if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) { if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Result stack overflow: Obj=%p State=%p Num=%X\n", "Result stack overflow: Obj=%p State=%p Num=%X",
object, walk_state, object, walk_state, state->results.num_results));
state->results.num_results));
return (AE_STACK_OVERFLOW); return (AE_STACK_OVERFLOW);
} }
if (!object) { if (!object) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Null Object! Obj=%p State=%p Num=%X\n", "Null Object! Obj=%p State=%p Num=%X",
object, walk_state, object, walk_state, state->results.num_results));
state->results.num_results));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
@ -413,10 +405,9 @@ acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
/* Check for stack overflow */ /* Check for stack overflow */
if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) { if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"overflow! Obj=%p State=%p #Ops=%X\n", "Object stack overflow! Obj=%p State=%p #Ops=%X",
object, walk_state, object, walk_state, walk_state->num_operands));
walk_state->num_operands));
return (AE_STACK_OVERFLOW); return (AE_STACK_OVERFLOW);
} }
@ -460,10 +451,10 @@ acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
/* Check for stack underflow */ /* Check for stack underflow */
if (walk_state->num_operands == 0) { if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Underflow! Count=%X State=%p #Ops=%X\n", "Object stack underflow! Count=%X State=%p #Ops=%X",
pop_count, walk_state, pop_count, walk_state,
walk_state->num_operands)); walk_state->num_operands));
return (AE_STACK_UNDERFLOW); return (AE_STACK_UNDERFLOW);
} }
@ -506,10 +497,10 @@ acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
/* Check for stack underflow */ /* Check for stack underflow */
if (walk_state->num_operands == 0) { if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Underflow! Count=%X State=%p #Ops=%X\n", "Object stack underflow! Count=%X State=%p #Ops=%X",
pop_count, walk_state, pop_count, walk_state,
walk_state->num_operands)); walk_state->num_operands));
return (AE_STACK_UNDERFLOW); return (AE_STACK_UNDERFLOW);
} }
@ -826,16 +817,14 @@ void acpi_ds_delete_walk_state(struct acpi_walk_state *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, ACPI_ERROR((AE_INFO, "%p is not a valid walk state",
"%p is not a valid walk state\n", walk_state));
walk_state));
return; return;
} }
if (walk_state->parser_state.scope) { if (walk_state->parser_state.scope) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "%p walk still has a scope list",
"%p walk still has a scope list\n", walk_state));
walk_state));
} }
/* Always must free any linked control states */ /* Always must free any linked control states */
@ -894,25 +883,24 @@ acpi_ds_result_insert(void *object,
state = walk_state->results; state = walk_state->results;
if (!state) { if (!state) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "No result object pushed! State=%p",
"No result object pushed! State=%p\n", walk_state));
walk_state));
return (AE_NOT_EXIST); return (AE_NOT_EXIST);
} }
if (index >= ACPI_OBJ_NUM_OPERANDS) { if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Index out of range: %X Obj=%p State=%p Num=%X\n", "Index out of range: %X Obj=%p State=%p Num=%X",
index, object, walk_state, index, object, walk_state,
state->results.num_results)); state->results.num_results));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
if (!object) { if (!object) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Null Object! Index=%X Obj=%p State=%p Num=%X\n", "Null Object! Index=%X Obj=%p State=%p Num=%X",
index, object, walk_state, index, object, walk_state,
state->results.num_results)); state->results.num_results));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
@ -986,9 +974,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
/* Check for stack underflow */ /* Check for stack underflow */
if (walk_state->num_operands == 0) { if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Missing operand/stack empty! State=%p #Ops=%X\n", "Missing operand/stack empty! State=%p #Ops=%X",
walk_state, walk_state->num_operands)); walk_state, walk_state->num_operands));
*object = NULL; *object = NULL;
return (AE_AML_NO_OPERAND); return (AE_AML_NO_OPERAND);
} }
@ -1000,9 +988,9 @@ acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
/* Check for a valid operand */ /* Check for a valid operand */
if (!walk_state->operands[walk_state->num_operands]) { if (!walk_state->operands[walk_state->num_operands]) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Null operand! State=%p #Ops=%X\n", "Null operand! State=%p #Ops=%X",
walk_state, walk_state->num_operands)); walk_state, walk_state->num_operands));
*object = NULL; *object = NULL;
return (AE_AML_NO_OPERAND); return (AE_AML_NO_OPERAND);
} }

View File

@ -60,20 +60,20 @@ ACPI_MODULE_NAME("acpi_ec")
#define ACPI_EC_BURST_ENABLE 0x82 #define ACPI_EC_BURST_ENABLE 0x82
#define ACPI_EC_BURST_DISABLE 0x83 #define ACPI_EC_BURST_DISABLE 0x83
#define ACPI_EC_COMMAND_QUERY 0x84 #define ACPI_EC_COMMAND_QUERY 0x84
#define EC_POLLING 0xFF #define EC_POLL 0xFF
#define EC_BURST 0x00 #define EC_INTR 0x00
static int acpi_ec_remove(struct acpi_device *device, int type); static int acpi_ec_remove(struct acpi_device *device, int type);
static int acpi_ec_start(struct acpi_device *device); static int acpi_ec_start(struct acpi_device *device);
static int acpi_ec_stop(struct acpi_device *device, int type); static int acpi_ec_stop(struct acpi_device *device, int type);
static int acpi_ec_burst_add(struct acpi_device *device); static int acpi_ec_intr_add(struct acpi_device *device);
static int acpi_ec_polling_add(struct acpi_device *device); static int acpi_ec_poll_add(struct acpi_device *device);
static struct acpi_driver acpi_ec_driver = { static struct acpi_driver acpi_ec_driver = {
.name = ACPI_EC_DRIVER_NAME, .name = ACPI_EC_DRIVER_NAME,
.class = ACPI_EC_CLASS, .class = ACPI_EC_CLASS,
.ids = ACPI_EC_HID, .ids = ACPI_EC_HID,
.ops = { .ops = {
.add = acpi_ec_polling_add, .add = acpi_ec_intr_add,
.remove = acpi_ec_remove, .remove = acpi_ec_remove,
.start = acpi_ec_start, .start = acpi_ec_start,
.stop = acpi_ec_stop, .stop = acpi_ec_stop,
@ -105,7 +105,7 @@ union acpi_ec {
atomic_t pending_gpe; atomic_t pending_gpe;
struct semaphore sem; struct semaphore sem;
wait_queue_head_t wait; wait_queue_head_t wait;
} burst; } intr;
struct { struct {
u32 mode; u32 mode;
@ -117,37 +117,37 @@ union acpi_ec {
struct acpi_generic_address data_addr; struct acpi_generic_address data_addr;
unsigned long global_lock; unsigned long global_lock;
spinlock_t lock; spinlock_t lock;
} polling; } poll;
}; };
static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event); static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event);
static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event);
static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data); static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data);
static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data); static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data);
static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data); static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data);
static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data); static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data);
static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data); static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data);
static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data); static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data);
static void acpi_ec_gpe_polling_query(void *ec_cxt); static void acpi_ec_gpe_poll_query(void *ec_cxt);
static void acpi_ec_gpe_burst_query(void *ec_cxt); static void acpi_ec_gpe_intr_query(void *ec_cxt);
static u32 acpi_ec_gpe_polling_handler(void *data); static u32 acpi_ec_gpe_poll_handler(void *data);
static u32 acpi_ec_gpe_burst_handler(void *data); static u32 acpi_ec_gpe_intr_handler(void *data);
static acpi_status __init static acpi_status __init
acpi_fake_ecdt_polling_callback(acpi_handle handle, acpi_fake_ecdt_poll_callback(acpi_handle handle,
u32 Level, void *context, void **retval); u32 Level, void *context, void **retval);
static acpi_status __init static acpi_status __init
acpi_fake_ecdt_burst_callback(acpi_handle handle, acpi_fake_ecdt_intr_callback(acpi_handle handle,
u32 Level, void *context, void **retval); u32 Level, void *context, void **retval);
static int __init acpi_ec_polling_get_real_ecdt(void); static int __init acpi_ec_poll_get_real_ecdt(void);
static int __init acpi_ec_burst_get_real_ecdt(void); static int __init acpi_ec_intr_get_real_ecdt(void);
/* 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 */
static union acpi_ec *ec_ecdt; static union acpi_ec *ec_ecdt;
/* External interfaces use first EC only, so remember */ /* External interfaces use first EC only, so remember */
static struct acpi_device *first_ec; static struct acpi_device *first_ec;
static int acpi_ec_polling_mode = EC_POLLING; static int acpi_ec_poll_mode = EC_INTR;
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Transaction Management Transaction Management
@ -163,13 +163,13 @@ static u32 acpi_ec_read_status(union acpi_ec *ec)
static int acpi_ec_wait(union acpi_ec *ec, u8 event) static int acpi_ec_wait(union acpi_ec *ec, u8 event)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_ec_polling_wait(ec, event); return acpi_ec_poll_wait(ec, event);
else else
return acpi_ec_burst_wait(ec, event); return acpi_ec_intr_wait(ec, event);
} }
static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event) static int acpi_ec_poll_wait(union acpi_ec *ec, u8 event)
{ {
u32 acpi_ec_status = 0; u32 acpi_ec_status = 0;
u32 i = ACPI_EC_UDELAY_COUNT; u32 i = ACPI_EC_UDELAY_COUNT;
@ -203,36 +203,31 @@ static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
return -ETIME; return -ETIME;
} }
static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) static int acpi_ec_intr_wait(union acpi_ec *ec, unsigned int event)
{ {
int result = 0; int result = 0;
ACPI_FUNCTION_TRACE("acpi_ec_wait"); ACPI_FUNCTION_TRACE("acpi_ec_wait");
ec->burst.expect_event = event; ec->intr.expect_event = event;
smp_mb(); smp_mb();
switch (event) { switch (event) {
case ACPI_EC_EVENT_OBF: case ACPI_EC_EVENT_IBE:
if (acpi_ec_read_status(ec) & event) { if (~acpi_ec_read_status(ec) & event) {
ec->burst.expect_event = 0; ec->intr.expect_event = 0;
return_VALUE(0); return_VALUE(0);
} }
break; break;
default:
case ACPI_EC_EVENT_IBE:
if (~acpi_ec_read_status(ec) & event) {
ec->burst.expect_event = 0;
return_VALUE(0);
}
break; break;
} }
result = wait_event_timeout(ec->burst.wait, result = wait_event_timeout(ec->intr.wait,
!ec->burst.expect_event, !ec->intr.expect_event,
msecs_to_jiffies(ACPI_EC_DELAY)); msecs_to_jiffies(ACPI_EC_DELAY));
ec->burst.expect_event = 0; ec->intr.expect_event = 0;
smp_mb(); smp_mb();
/* /*
@ -255,7 +250,12 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
return_VALUE(-ETIME); return_VALUE(-ETIME);
} }
static int acpi_ec_enter_burst_mode(union acpi_ec *ec) #ifdef ACPI_FUTURE_USAGE
/*
* Note: samsung nv5000 doesn't work with ec burst mode.
* http://bugzilla.kernel.org/show_bug.cgi?id=4980
*/
int acpi_ec_enter_burst_mode(union acpi_ec *ec)
{ {
u32 tmp = 0; u32 tmp = 0;
int status = 0; int status = 0;
@ -270,45 +270,56 @@ static int acpi_ec_enter_burst_mode(union acpi_ec *ec)
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
&ec->common.command_addr); &ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status)
return_VALUE(-EINVAL);
acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr);
if (tmp != 0x90) { /* Burst ACK byte */ if (tmp != 0x90) { /* Burst ACK byte */
return_VALUE(-EINVAL); return_VALUE(-EINVAL);
} }
} }
atomic_set(&ec->burst.leaving_burst, 0); atomic_set(&ec->intr.leaving_burst, 0);
return_VALUE(0); return_VALUE(0);
end: end:
printk("Error in acpi_ec_wait\n"); printk(KERN_WARNING PREFIX "Error in acpi_ec_wait\n");
return_VALUE(-1); return_VALUE(-1);
} }
static int acpi_ec_leave_burst_mode(union acpi_ec *ec) int acpi_ec_leave_burst_mode(union acpi_ec *ec)
{ {
int status = 0;
ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode");
atomic_set(&ec->burst.leaving_burst, 1); status = acpi_ec_read_status(ec);
if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)){
status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
if(status)
goto end;
acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);
acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
}
atomic_set(&ec->intr.leaving_burst, 1);
return_VALUE(0); return_VALUE(0);
end:
printk(KERN_WARNING PREFIX "leave burst_mode:error\n");
return_VALUE(-1);
} }
#endif /* ACPI_FUTURE_USAGE */
static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data) static int acpi_ec_read(union acpi_ec *ec, u8 address, u32 * data)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_ec_polling_read(ec, address, data); return acpi_ec_poll_read(ec, address, data);
else else
return acpi_ec_burst_read(ec, address, data); return acpi_ec_intr_read(ec, address, data);
} }
static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data) static int acpi_ec_write(union acpi_ec *ec, u8 address, u8 data)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_ec_polling_write(ec, address, data); return acpi_ec_poll_write(ec, address, data);
else else
return acpi_ec_burst_write(ec, address, data); return acpi_ec_intr_write(ec, address, data);
} }
static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data) static int acpi_ec_poll_read(union acpi_ec *ec, u8 address, u32 * data)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
int result = 0; int result = 0;
@ -328,7 +339,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
spin_lock_irqsave(&ec->polling.lock, flags); spin_lock_irqsave(&ec->poll.lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
&ec->common.command_addr); &ec->common.command_addr);
@ -347,7 +358,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
*data, address)); *data, address));
end: end:
spin_unlock_irqrestore(&ec->polling.lock, flags); spin_unlock_irqrestore(&ec->poll.lock, flags);
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
@ -355,7 +366,7 @@ static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
return_VALUE(result); return_VALUE(result);
} }
static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data) static int acpi_ec_poll_write(union acpi_ec *ec, u8 address, u8 data)
{ {
int result = 0; int result = 0;
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -373,7 +384,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
spin_lock_irqsave(&ec->polling.lock, flags); spin_lock_irqsave(&ec->poll.lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
&ec->common.command_addr); &ec->common.command_addr);
@ -395,7 +406,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
data, address)); data, address));
end: end:
spin_unlock_irqrestore(&ec->polling.lock, flags); spin_unlock_irqrestore(&ec->poll.lock, flags);
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
@ -403,7 +414,7 @@ static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
return_VALUE(result); return_VALUE(result);
} }
static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data) static int acpi_ec_intr_read(union acpi_ec *ec, u8 address, u32 * data)
{ {
int status = 0; int status = 0;
u32 glk; u32 glk;
@ -422,25 +433,24 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
} }
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
down(&ec->burst.sem); down(&ec->intr.sem);
acpi_ec_enter_burst_mode(ec);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (status) { if (status) {
printk("read EC, IB not empty\n"); printk(KERN_DEBUG PREFIX "read EC, IB not empty\n");
goto end; goto end;
} }
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
&ec->common.command_addr); &ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (status) { if (status) {
printk("read EC, IB not empty\n"); printk(KERN_DEBUG PREFIX "read EC, IB not empty\n");
} }
acpi_hw_low_level_write(8, address, &ec->common.data_addr); acpi_hw_low_level_write(8, address, &ec->common.data_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status) { if (status) {
printk("read EC, OB not full\n"); printk(KERN_DEBUG PREFIX "read EC, OB not full\n");
goto end; goto end;
} }
acpi_hw_low_level_read(8, data, &ec->common.data_addr); acpi_hw_low_level_read(8, data, &ec->common.data_addr);
@ -448,8 +458,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
*data, address)); *data, address));
end: end:
acpi_ec_leave_burst_mode(ec); up(&ec->intr.sem);
up(&ec->burst.sem);
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
@ -457,7 +466,7 @@ static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
return_VALUE(status); return_VALUE(status);
} }
static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data) static int acpi_ec_intr_write(union acpi_ec *ec, u8 address, u8 data)
{ {
int status = 0; int status = 0;
u32 glk; u32 glk;
@ -474,25 +483,23 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
} }
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
down(&ec->burst.sem); down(&ec->intr.sem);
acpi_ec_enter_burst_mode(ec);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (status) { if (status) {
printk("write EC, IB not empty\n"); printk(KERN_DEBUG PREFIX "write EC, IB not empty\n");
} }
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
&ec->common.command_addr); &ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (status) { if (status) {
printk("write EC, IB not empty\n"); printk(KERN_DEBUG PREFIX "write EC, IB not empty\n");
} }
acpi_hw_low_level_write(8, address, &ec->common.data_addr); acpi_hw_low_level_write(8, address, &ec->common.data_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (status) { if (status) {
printk("write EC, IB not empty\n"); printk(KERN_DEBUG PREFIX "write EC, IB not empty\n");
} }
acpi_hw_low_level_write(8, data, &ec->common.data_addr); acpi_hw_low_level_write(8, data, &ec->common.data_addr);
@ -500,8 +507,7 @@ static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
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));
acpi_ec_leave_burst_mode(ec); up(&ec->intr.sem);
up(&ec->burst.sem);
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
@ -553,12 +559,12 @@ EXPORT_SYMBOL(ec_write);
static int acpi_ec_query(union acpi_ec *ec, u32 * data) static int acpi_ec_query(union acpi_ec *ec, u32 * data)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_ec_polling_query(ec, data); return acpi_ec_poll_query(ec, data);
else else
return acpi_ec_burst_query(ec, data); return acpi_ec_intr_query(ec, data);
} }
static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data) static int acpi_ec_poll_query(union acpi_ec *ec, u32 * data)
{ {
int result = 0; int result = 0;
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -583,7 +589,7 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
* 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->polling.lock, flags); spin_lock_irqsave(&ec->poll.lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
&ec->common.command_addr); &ec->common.command_addr);
@ -596,14 +602,14 @@ static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
result = -ENODATA; result = -ENODATA;
end: end:
spin_unlock_irqrestore(&ec->polling.lock, flags); spin_unlock_irqrestore(&ec->poll.lock, flags);
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
return_VALUE(result); return_VALUE(result);
} }
static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data) static int acpi_ec_intr_query(union acpi_ec *ec, u32 * data)
{ {
int status = 0; int status = 0;
u32 glk; u32 glk;
@ -620,11 +626,11 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
return_VALUE(-ENODEV); return_VALUE(-ENODEV);
} }
down(&ec->burst.sem); down(&ec->intr.sem);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (status) { if (status) {
printk("query EC, IB not empty\n"); printk(KERN_DEBUG PREFIX "query EC, IB not empty\n");
goto end; goto end;
} }
/* /*
@ -636,7 +642,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
&ec->common.command_addr); &ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status) { if (status) {
printk("query EC, OB not full\n"); printk(KERN_DEBUG PREFIX "query EC, OB not full\n");
goto end; goto end;
} }
@ -645,7 +651,7 @@ static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
status = -ENODATA; status = -ENODATA;
end: end:
up(&ec->burst.sem); up(&ec->intr.sem);
if (ec->common.global_lock) if (ec->common.global_lock)
acpi_release_global_lock(glk); acpi_release_global_lock(glk);
@ -664,13 +670,13 @@ union acpi_ec_query_data {
static void acpi_ec_gpe_query(void *ec_cxt) static void acpi_ec_gpe_query(void *ec_cxt)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
acpi_ec_gpe_polling_query(ec_cxt); acpi_ec_gpe_poll_query(ec_cxt);
else else
acpi_ec_gpe_burst_query(ec_cxt); acpi_ec_gpe_intr_query(ec_cxt);
} }
static void acpi_ec_gpe_polling_query(void *ec_cxt) static void acpi_ec_gpe_poll_query(void *ec_cxt)
{ {
union acpi_ec *ec = (union acpi_ec *)ec_cxt; union acpi_ec *ec = (union acpi_ec *)ec_cxt;
u32 value = 0; u32 value = 0;
@ -685,9 +691,9 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt)
if (!ec_cxt) if (!ec_cxt)
goto end; goto end;
spin_lock_irqsave(&ec->polling.lock, flags); spin_lock_irqsave(&ec->poll.lock, flags);
acpi_hw_low_level_read(8, &value, &ec->common.command_addr); acpi_hw_low_level_read(8, &value, &ec->common.command_addr);
spin_unlock_irqrestore(&ec->polling.lock, flags); spin_unlock_irqrestore(&ec->poll.lock, flags);
/* TBD: Implement asynch events! /* TBD: Implement asynch events!
* NOTE: All we care about are EC-SCI's. Other EC events are * NOTE: All we care about are EC-SCI's. Other EC events are
@ -711,7 +717,7 @@ static void acpi_ec_gpe_polling_query(void *ec_cxt)
end: end:
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
} }
static void acpi_ec_gpe_burst_query(void *ec_cxt) static void acpi_ec_gpe_intr_query(void *ec_cxt)
{ {
union acpi_ec *ec = (union acpi_ec *)ec_cxt; union acpi_ec *ec = (union acpi_ec *)ec_cxt;
u32 value; u32 value;
@ -736,18 +742,18 @@ static void acpi_ec_gpe_burst_query(void *ec_cxt)
acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL);
end: end:
atomic_dec(&ec->burst.pending_gpe); atomic_dec(&ec->intr.pending_gpe);
return; return;
} }
static u32 acpi_ec_gpe_handler(void *data) static u32 acpi_ec_gpe_handler(void *data)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_ec_gpe_polling_handler(data); return acpi_ec_gpe_poll_handler(data);
else else
return acpi_ec_gpe_burst_handler(data); return acpi_ec_gpe_intr_handler(data);
} }
static u32 acpi_ec_gpe_polling_handler(void *data) static u32 acpi_ec_gpe_poll_handler(void *data)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
union acpi_ec *ec = (union acpi_ec *)data; union acpi_ec *ec = (union acpi_ec *)data;
@ -765,7 +771,7 @@ static u32 acpi_ec_gpe_polling_handler(void *data)
else else
return ACPI_INTERRUPT_NOT_HANDLED; return ACPI_INTERRUPT_NOT_HANDLED;
} }
static u32 acpi_ec_gpe_burst_handler(void *data) static u32 acpi_ec_gpe_intr_handler(void *data)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 value; u32 value;
@ -777,22 +783,22 @@ static u32 acpi_ec_gpe_burst_handler(void *data)
acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); acpi_clear_gpe(NULL, ec->common.gpe_bit, ACPI_ISR);
value = acpi_ec_read_status(ec); value = acpi_ec_read_status(ec);
switch (ec->burst.expect_event) { switch (ec->intr.expect_event) {
case ACPI_EC_EVENT_OBF: case ACPI_EC_EVENT_OBF:
if (!(value & ACPI_EC_FLAG_OBF)) if (!(value & ACPI_EC_FLAG_OBF))
break; break;
case ACPI_EC_EVENT_IBE: case ACPI_EC_EVENT_IBE:
if ((value & ACPI_EC_FLAG_IBF)) if ((value & ACPI_EC_FLAG_IBF))
break; break;
ec->burst.expect_event = 0; ec->intr.expect_event = 0;
wake_up(&ec->burst.wait); wake_up(&ec->intr.wait);
return ACPI_INTERRUPT_HANDLED; return ACPI_INTERRUPT_HANDLED;
default: default:
break; break;
} }
if (value & ACPI_EC_FLAG_SCI) { if (value & ACPI_EC_FLAG_SCI) {
atomic_add(1, &ec->burst.pending_gpe); atomic_add(1, &ec->intr.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 ? return status == AE_OK ?
@ -980,7 +986,7 @@ static int acpi_ec_remove_fs(struct acpi_device *device)
Driver Interface Driver Interface
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
static int acpi_ec_polling_add(struct acpi_device *device) static int acpi_ec_poll_add(struct acpi_device *device)
{ {
int result = 0; int result = 0;
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -999,7 +1005,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
ec->common.handle = device->handle; ec->common.handle = device->handle;
ec->common.uid = -1; ec->common.uid = -1;
spin_lock_init(&ec->polling.lock); spin_lock_init(&ec->poll.lock);
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;
@ -1038,7 +1044,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
if (result) if (result)
goto end; goto end;
printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", printk(KERN_INFO PREFIX "%s [%s] (gpe %d) polling mode.\n",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
(u32) ec->common.gpe_bit); (u32) ec->common.gpe_bit);
@ -1051,7 +1057,7 @@ static int acpi_ec_polling_add(struct acpi_device *device)
return_VALUE(result); return_VALUE(result);
} }
static int acpi_ec_burst_add(struct acpi_device *device) static int acpi_ec_intr_add(struct acpi_device *device)
{ {
int result = 0; int result = 0;
acpi_status status = AE_OK; acpi_status status = AE_OK;
@ -1070,10 +1076,10 @@ static int acpi_ec_burst_add(struct acpi_device *device)
ec->common.handle = device->handle; ec->common.handle = device->handle;
ec->common.uid = -1; ec->common.uid = -1;
atomic_set(&ec->burst.pending_gpe, 0); atomic_set(&ec->intr.pending_gpe, 0);
atomic_set(&ec->burst.leaving_burst, 1); atomic_set(&ec->intr.leaving_burst, 1);
init_MUTEX(&ec->burst.sem); init_MUTEX(&ec->intr.sem);
init_waitqueue_head(&ec->burst.wait); init_waitqueue_head(&ec->intr.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;
@ -1112,8 +1118,7 @@ static int acpi_ec_burst_add(struct acpi_device *device)
if (result) if (result)
goto end; goto end;
printk("burst-mode-ec-10-Aug\n"); printk(KERN_INFO PREFIX "%s [%s] (gpe %d) interrupt mode.\n",
printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n",
acpi_device_name(device), acpi_device_bid(device), acpi_device_name(device), acpi_device_bid(device),
(u32) ec->common.gpe_bit); (u32) ec->common.gpe_bit);
@ -1151,7 +1156,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
union acpi_ec *ec = (union acpi_ec *)context; union acpi_ec *ec = (union acpi_ec *)context;
struct acpi_generic_address *addr; struct acpi_generic_address *addr;
if (resource->id != ACPI_RSTYPE_IO) { if (resource->type != ACPI_RESOURCE_TYPE_IO) {
return AE_OK; return AE_OK;
} }
@ -1171,7 +1176,7 @@ acpi_ec_io_ports(struct acpi_resource *resource, void *context)
addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO; addr->address_space_id = ACPI_ADR_SPACE_SYSTEM_IO;
addr->register_bit_width = 8; addr->register_bit_width = 8;
addr->register_bit_offset = 0; addr->register_bit_offset = 0;
addr->address = resource->data.io.min_base_address; addr->address = resource->data.io.minimum;
return AE_OK; return AE_OK;
} }
@ -1267,16 +1272,16 @@ acpi_fake_ecdt_callback(acpi_handle handle,
u32 Level, void *context, void **retval) u32 Level, void *context, void **retval)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_fake_ecdt_polling_callback(handle, return acpi_fake_ecdt_poll_callback(handle,
Level, context, retval); Level, context, retval);
else else
return acpi_fake_ecdt_burst_callback(handle, return acpi_fake_ecdt_intr_callback(handle,
Level, context, retval); Level, context, retval);
} }
static acpi_status __init static acpi_status __init
acpi_fake_ecdt_polling_callback(acpi_handle handle, acpi_fake_ecdt_poll_callback(acpi_handle handle,
u32 Level, void *context, void **retval) u32 Level, void *context, void **retval)
{ {
acpi_status status; acpi_status status;
@ -1295,7 +1300,7 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle,
&ec_ecdt->common.gpe_bit); &ec_ecdt->common.gpe_bit);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return status; return status;
spin_lock_init(&ec_ecdt->polling.lock); spin_lock_init(&ec_ecdt->poll.lock);
ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.global_lock = TRUE;
ec_ecdt->common.handle = handle; ec_ecdt->common.handle = handle;
@ -1308,13 +1313,13 @@ acpi_fake_ecdt_polling_callback(acpi_handle handle,
} }
static acpi_status __init static acpi_status __init
acpi_fake_ecdt_burst_callback(acpi_handle handle, acpi_fake_ecdt_intr_callback(acpi_handle handle,
u32 Level, void *context, void **retval) u32 Level, void *context, void **retval)
{ {
acpi_status status; acpi_status status;
init_MUTEX(&ec_ecdt->burst.sem); init_MUTEX(&ec_ecdt->intr.sem);
init_waitqueue_head(&ec_ecdt->burst.wait); init_waitqueue_head(&ec_ecdt->intr.wait);
status = acpi_walk_resources(handle, METHOD_NAME__CRS, status = acpi_walk_resources(handle, METHOD_NAME__CRS,
acpi_ec_io_ports, ec_ecdt); acpi_ec_io_ports, ec_ecdt);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
@ -1380,13 +1385,13 @@ static int __init acpi_ec_fake_ecdt(void)
static int __init acpi_ec_get_real_ecdt(void) static int __init acpi_ec_get_real_ecdt(void)
{ {
if (acpi_ec_polling_mode) if (acpi_ec_poll_mode)
return acpi_ec_polling_get_real_ecdt(); return acpi_ec_poll_get_real_ecdt();
else else
return acpi_ec_burst_get_real_ecdt(); return acpi_ec_intr_get_real_ecdt();
} }
static int __init acpi_ec_polling_get_real_ecdt(void) static int __init acpi_ec_poll_get_real_ecdt(void)
{ {
acpi_status status; acpi_status status;
struct acpi_table_ecdt *ecdt_ptr; struct acpi_table_ecdt *ecdt_ptr;
@ -1411,7 +1416,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void)
ec_ecdt->common.status_addr = ecdt_ptr->ec_control; ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
ec_ecdt->common.data_addr = ecdt_ptr->ec_data; ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit;
spin_lock_init(&ec_ecdt->polling.lock); spin_lock_init(&ec_ecdt->poll.lock);
/* use the GL just to be safe */ /* use the GL just to be safe */
ec_ecdt->common.global_lock = TRUE; ec_ecdt->common.global_lock = TRUE;
ec_ecdt->common.uid = ecdt_ptr->uid; ec_ecdt->common.uid = ecdt_ptr->uid;
@ -1431,7 +1436,7 @@ static int __init acpi_ec_polling_get_real_ecdt(void)
return -ENODEV; return -ENODEV;
} }
static int __init acpi_ec_burst_get_real_ecdt(void) static int __init acpi_ec_intr_get_real_ecdt(void)
{ {
acpi_status status; acpi_status status;
struct acpi_table_ecdt *ecdt_ptr; struct acpi_table_ecdt *ecdt_ptr;
@ -1452,8 +1457,8 @@ static int __init acpi_ec_burst_get_real_ecdt(void)
return -ENOMEM; return -ENOMEM;
memset(ec_ecdt, 0, sizeof(union acpi_ec)); memset(ec_ecdt, 0, sizeof(union acpi_ec));
init_MUTEX(&ec_ecdt->burst.sem); init_MUTEX(&ec_ecdt->intr.sem);
init_waitqueue_head(&ec_ecdt->burst.wait); init_waitqueue_head(&ec_ecdt->intr.wait);
ec_ecdt->common.command_addr = ecdt_ptr->ec_control; ec_ecdt->common.command_addr = ecdt_ptr->ec_control;
ec_ecdt->common.status_addr = ecdt_ptr->ec_control; ec_ecdt->common.status_addr = ecdt_ptr->ec_control;
ec_ecdt->common.data_addr = ecdt_ptr->ec_data; ec_ecdt->common.data_addr = ecdt_ptr->ec_data;
@ -1571,22 +1576,22 @@ static int __init acpi_fake_ecdt_setup(char *str)
} }
__setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup);
static int __init acpi_ec_set_polling_mode(char *str) static int __init acpi_ec_set_intr_mode(char *str)
{ {
int burst; int intr;
if (!get_option(&str, &burst)) if (!get_option(&str, &intr))
return 0; return 0;
if (burst) { if (intr) {
acpi_ec_polling_mode = EC_BURST; acpi_ec_poll_mode = EC_INTR;
acpi_ec_driver.ops.add = acpi_ec_burst_add; acpi_ec_driver.ops.add = acpi_ec_intr_add;
} else { } else {
acpi_ec_polling_mode = EC_POLLING; acpi_ec_poll_mode = EC_POLL;
acpi_ec_driver.ops.add = acpi_ec_polling_add; acpi_ec_driver.ops.add = acpi_ec_poll_add;
} }
printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling"); printk(KERN_INFO PREFIX "EC %s mode.\n", intr ? "interrupt" : "polling");
return 0; return 0;
} }
__setup("ec_burst=", acpi_ec_set_polling_mode); __setup("ec_intr=", acpi_ec_set_intr_mode);

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -73,7 +73,7 @@ acpi_status acpi_ev_initialize_events(void)
/* Make sure we have ACPI tables */ /* Make sure we have ACPI tables */
if (!acpi_gbl_DSDT) { if (!acpi_gbl_DSDT) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n")); ACPI_WARNING((AE_INFO, "No ACPI tables present!"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES); return_ACPI_STATUS(AE_NO_ACPI_TABLES);
} }
@ -84,20 +84,63 @@ acpi_status acpi_ev_initialize_events(void)
*/ */
status = acpi_ev_fixed_event_initialize(); status = acpi_ev_fixed_event_initialize();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n", ACPI_EXCEPTION((AE_INFO, status,
acpi_format_exception(status))); "Unable to initialize fixed events"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
status = acpi_ev_gpe_initialize(); status = acpi_ev_gpe_initialize();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO, status,
"Unable to initialize general purpose events"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/*******************************************************************************
*
* FUNCTION: acpi_ev_install_fadt_gpes
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
* (0 and 1). This causes the _PRW methods to be run, so the HW
* must be fully initialized at this point, including global lock
* support.
*
******************************************************************************/
acpi_status acpi_ev_install_fadt_gpes(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_install_fadt_gpes");
/* Namespace must be locked */
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return (status);
}
/* FADT GPE Block 0 */
(void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device,
acpi_gbl_gpe_fadt_blocks[0]);
/* FADT GPE Block 1 */
(void)acpi_ev_initialize_gpe_block(acpi_gbl_fadt_gpe_device,
acpi_gbl_gpe_fadt_blocks[1]);
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(AE_OK);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ev_install_xrupt_handlers * FUNCTION: acpi_ev_install_xrupt_handlers
@ -120,7 +163,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
status = acpi_ev_install_sci_handler(); status = acpi_ev_install_sci_handler();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO, status,
"Unable to install System Control Interrupt handler"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -128,7 +172,8 @@ acpi_status acpi_ev_install_xrupt_handlers(void)
status = acpi_ev_init_global_lock_handler(); status = acpi_ev_init_global_lock_handler();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO, status,
"Unable to initialize Global Lock handler"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -262,7 +307,9 @@ static u32 acpi_ev_fixed_event_dispatch(u32 event)
enable_register_id, 0, enable_register_id, 0,
ACPI_MTX_DO_NOT_LOCK); ACPI_MTX_DO_NOT_LOCK);
ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event)); ACPI_ERROR((AE_INFO,
"No installed handler for fixed event [%08X]",
event));
return (ACPI_INTERRUPT_NOT_HANDLED); return (ACPI_INTERRUPT_NOT_HANDLED);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -372,14 +372,14 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
{ {
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u8 enabled_status_byte;
struct acpi_gpe_register_info *gpe_register_info;
u32 status_reg;
u32 enable_reg;
u32 flags;
acpi_status status; acpi_status status;
struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_register_info *gpe_register_info;
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u8 enabled_status_byte;
u32 status_reg;
u32 enable_reg;
acpi_cpu_flags flags;
acpi_native_uint i; acpi_native_uint i;
acpi_native_uint j; acpi_native_uint j;
@ -546,7 +546,11 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
status = acpi_ns_evaluate_by_handle(&info); status = acpi_ns_evaluate_by_handle(&info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("%s while evaluating method [%4.4s] for GPE[%2X]\n", acpi_format_exception(status), acpi_ut_get_node_name(local_gpe_event_info.dispatch.method_node), gpe_number)); ACPI_EXCEPTION((AE_INFO, status,
"While evaluating method [%4.4s] for GPE[%2X]",
acpi_ut_get_node_name
(local_gpe_event_info.dispatch.
method_node), gpe_number));
} }
} }
@ -599,8 +603,10 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
ACPI_GPE_EDGE_TRIGGERED) { 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_format_exception(status), gpe_number)); ACPI_EXCEPTION((AE_INFO, status,
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); "Unable to clear GPE[%2X]",
gpe_number));
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
@ -637,8 +643,10 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
ACPI_GPE_LEVEL_TRIGGERED) { 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_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number)); ACPI_EXCEPTION((AE_INFO, status,
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); "Unable to clear GPE[%2X]",
gpe_number));
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
} }
} }
break; break;
@ -651,8 +659,10 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
*/ */
status = acpi_ev_disable_gpe(gpe_event_info); status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); ACPI_EXCEPTION((AE_INFO, status,
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); "Unable to disable GPE[%2X]",
gpe_number));
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
} }
/* /*
@ -663,7 +673,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
acpi_ev_asynch_execute_gpe_method, acpi_ev_asynch_execute_gpe_method,
gpe_event_info); gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number)); ACPI_EXCEPTION((AE_INFO, status,
"Unable to queue handler for GPE[%2X] - event disabled",
gpe_number));
} }
break; break;
@ -671,7 +683,9 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
/* No handler or method to run! */ /* No handler or method to run! */
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number)); ACPI_ERROR((AE_INFO,
"No handler or method for GPE[%2X], disabling event",
gpe_number));
/* /*
* Disable the GPE. The GPE will remain disabled until the ACPI * Disable the GPE. The GPE will remain disabled until the ACPI
@ -679,13 +693,15 @@ acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
*/ */
status = acpi_ev_disable_gpe(gpe_event_info); status = acpi_ev_disable_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number)); ACPI_EXCEPTION((AE_INFO, status,
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED); "Unable to disable GPE[%2X]",
gpe_number));
return_UINT32(ACPI_INTERRUPT_NOT_HANDLED);
} }
break; break;
} }
return_VALUE(ACPI_INTERRUPT_HANDLED); return_UINT32(ACPI_INTERRUPT_HANDLED);
} }
#ifdef ACPI_GPE_NOTIFY_CHECK #ifdef ACPI_GPE_NOTIFY_CHECK
@ -722,7 +738,9 @@ acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info)); ACPI_INFO((AE_INFO,
"GPE %p was updated from wake/run to wake-only",
gpe_event_info));
/* This was a wake-only GPE */ /* This was a wake-only GPE */

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -78,7 +78,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block);
* *
* RETURN: TRUE if the gpe_event is valid * RETURN: TRUE if the gpe_event is valid
* *
* DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL. * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
* Should be called only when the GPE lists are semaphore locked * Should be called only when the GPE lists are semaphore locked
* and not subject to change. * and not subject to change.
* *
@ -136,7 +136,7 @@ acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_xrupt_info *gpe_xrupt_info;
acpi_status status = AE_OK; acpi_status status = AE_OK;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("ev_walk_gpe_list"); ACPI_FUNCTION_TRACE("ev_walk_gpe_list");
@ -264,7 +264,7 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
* 2) Edge/Level determination is based on the 2nd character * 2) Edge/Level determination is based on the 2nd character
* of the method name * of the method name
* *
* NOTE: Default GPE type is RUNTIME. May be changed later to WAKE * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
* if a _PRW object is found that points to this GPE. * if a _PRW object is found that points to this GPE.
*/ */
switch (name[1]) { switch (name[1]) {
@ -279,9 +279,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
default: default:
/* Unknown method type, just ignore it! */ /* Unknown method type, just ignore it! */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n", "Unknown GPE method type: %s (name not of form _Lxx or _Exx)",
name)); name));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
@ -291,9 +291,9 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
if (gpe_number == ACPI_UINT32_MAX) { if (gpe_number == ACPI_UINT32_MAX) {
/* Conversion failed; invalid method, just ignore it */ /* Conversion failed; invalid method, just ignore it */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n", "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
name)); name));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
@ -313,14 +313,14 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
/* /*
* Now we can add this information to the gpe_event_info block * Now we can add this information to the gpe_event_info block
* for use during dispatch of this GPE. Default type is RUNTIME, although * for use during dispatch of this GPE. Default type is RUNTIME, although
* this may change when the _PRW methods are executed later. * this may change when the _PRW methods are executed later.
*/ */
gpe_event_info = gpe_event_info =
&gpe_block->event_info[gpe_number - gpe_block->block_base_number]; &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD | gpe_event_info->flags = (u8)
ACPI_GPE_TYPE_RUNTIME); (type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
gpe_event_info->dispatch.method_node = gpe_event_info->dispatch.method_node =
(struct acpi_namespace_node *)obj_handle; (struct acpi_namespace_node *)obj_handle;
@ -341,11 +341,11 @@ acpi_ev_save_method_info(acpi_handle obj_handle,
* *
* PARAMETERS: Callback from walk_namespace * PARAMETERS: Callback from walk_namespace
* *
* RETURN: Status. NOTE: We ignore errors so that the _PRW walk is * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
* not aborted on a single _PRW failure. * not aborted on a single _PRW failure.
* *
* DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a * DESCRIPTION: Called from acpi_walk_namespace. Expects each object to be a
* Device. Run the _PRW method. If present, extract the GPE * Device. Run the _PRW method. If present, extract the GPE
* number and mark the GPE as a WAKE GPE. * number and mark the GPE as a WAKE GPE.
* *
******************************************************************************/ ******************************************************************************/
@ -443,6 +443,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
gpe_event_info->flags &= gpe_event_info->flags &=
~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED); ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
status = status =
acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE); acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -466,7 +467,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
* *
* RETURN: A GPE interrupt block * RETURN: A GPE interrupt block
* *
* DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
* block per unique interrupt level used for GPEs. * block per unique interrupt level used for GPEs.
* Should be called only when the GPE lists are semaphore locked * Should be called only when the GPE lists are semaphore locked
* and not subject to change. * and not subject to change.
@ -479,7 +480,7 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
struct acpi_gpe_xrupt_info *next_gpe_xrupt; struct acpi_gpe_xrupt_info *next_gpe_xrupt;
struct acpi_gpe_xrupt_info *gpe_xrupt; struct acpi_gpe_xrupt_info *gpe_xrupt;
acpi_status status; acpi_status status;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block"); ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
@ -526,9 +527,9 @@ static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
acpi_ev_gpe_xrupt_handler, acpi_ev_gpe_xrupt_handler,
gpe_xrupt); gpe_xrupt);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not install GPE interrupt handler at level 0x%X\n", "Could not install GPE interrupt handler at level 0x%X",
interrupt_number)); interrupt_number));
return_PTR(NULL); return_PTR(NULL);
} }
} }
@ -553,7 +554,7 @@ static acpi_status
acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt) acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
{ {
acpi_status status; acpi_status status;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt"); ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt");
@ -566,8 +567,9 @@ acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt)
/* Disable this interrupt */ /* Disable this interrupt */
status = acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number, status =
acpi_ev_gpe_xrupt_handler); acpi_os_remove_interrupt_handler(gpe_xrupt->interrupt_number,
acpi_ev_gpe_xrupt_handler);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -610,7 +612,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
struct acpi_gpe_block_info *next_gpe_block; struct acpi_gpe_block_info *next_gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_block; struct acpi_gpe_xrupt_info *gpe_xrupt_block;
acpi_status status; acpi_status status;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("ev_install_gpe_block"); ACPI_FUNCTION_TRACE("ev_install_gpe_block");
@ -663,7 +665,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block)
{ {
acpi_status status; acpi_status status;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("ev_install_gpe_block"); ACPI_FUNCTION_TRACE("ev_install_gpe_block");
@ -743,22 +745,22 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
sizeof(struct sizeof(struct
acpi_gpe_register_info)); acpi_gpe_register_info));
if (!gpe_register_info) { if (!gpe_register_info) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not allocate the gpe_register_info table\n")); "Could not allocate the gpe_register_info table"));
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
/* /*
* Allocate the GPE event_info block. There are eight distinct GPEs * Allocate the GPE event_info block. There are eight distinct GPEs
* per register. Initialization to zeros is sufficient. * per register. Initialization to zeros is sufficient.
*/ */
gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block-> gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block->
register_count * register_count *
ACPI_GPE_REGISTER_WIDTH) * 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, ACPI_ERROR((AE_INFO,
"Could not allocate the gpe_event_info table\n")); "Could not allocate the gpe_event_info table"));
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto error_exit; goto error_exit;
} }
@ -769,9 +771,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
gpe_block->event_info = gpe_event_info; gpe_block->event_info = gpe_event_info;
/* /*
* Initialize the GPE Register and Event structures. A goal of these * Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register sets * tables is to hide the fact that there are two separate GPE register sets
* in a given gpe hardware block, the status registers occupy the first half, * in a given GPE hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half. * and the enable registers occupy the second half.
*/ */
this_register = gpe_register_info; this_register = gpe_register_info;
@ -812,11 +814,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
this_event++; this_event++;
} }
/* /* Disable all GPEs within this register */
* Clear the status/enable registers. Note that status registers
* are cleared by writing a '1', while enable registers are cleared
* by writing a '0'.
*/
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00, status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
&this_register-> &this_register->
enable_address); enable_address);
@ -824,6 +823,8 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
goto error_exit; goto error_exit;
} }
/* Clear any pending GPE events within this register */
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF, status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF,
&this_register-> &this_register->
status_address); status_address);
@ -860,7 +861,9 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
* *
* RETURN: Status * RETURN: Status
* *
* DESCRIPTION: Create and Install a block of GPE registers * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
* the block are disabled at exit.
* Note: Assumes namespace is locked.
* *
******************************************************************************/ ******************************************************************************/
@ -872,14 +875,8 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
u32 interrupt_number, u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block) struct acpi_gpe_block_info **return_gpe_block)
{ {
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_event_info *gpe_event_info;
acpi_native_uint i;
acpi_native_uint j;
u32 wake_gpe_count;
u32 gpe_enabled_count;
acpi_status status; acpi_status status;
struct acpi_gpe_walk_info gpe_info; struct acpi_gpe_block_info *gpe_block;
ACPI_FUNCTION_TRACE("ev_create_gpe_block"); ACPI_FUNCTION_TRACE("ev_create_gpe_block");
@ -896,22 +893,24 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
/* Initialize the new GPE block */ /* Initialize the new GPE block */
gpe_block->node = gpe_device;
gpe_block->register_count = register_count; gpe_block->register_count = register_count;
gpe_block->block_base_number = gpe_block_base_number; gpe_block->block_base_number = gpe_block_base_number;
gpe_block->node = gpe_device;
ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address, ACPI_MEMCPY(&gpe_block->block_address, gpe_block_address,
sizeof(struct acpi_generic_address)); sizeof(struct acpi_generic_address));
/* Create the register_info and event_info sub-structures */ /*
* Create the register_info and event_info sub-structures
* Note: disables and clears all GPEs in the block
*/
status = acpi_ev_create_gpe_info_blocks(gpe_block); status = acpi_ev_create_gpe_info_blocks(gpe_block);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_MEM_FREE(gpe_block); ACPI_MEM_FREE(gpe_block);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
/* Install the new block in the global list(s) */ /* Install the new block in the global lists */
status = acpi_ev_install_gpe_block(gpe_block, interrupt_number); status = acpi_ev_install_gpe_block(gpe_block, interrupt_number);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -926,16 +925,70 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
acpi_ev_save_method_info, gpe_block, acpi_ev_save_method_info, gpe_block,
NULL); NULL);
/* Return the new block */
if (return_gpe_block) {
(*return_gpe_block) = gpe_block;
}
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
(u32) gpe_block->block_base_number,
(u32) (gpe_block->block_base_number +
((gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH) - 1)),
gpe_device->name.ascii, gpe_block->register_count,
interrupt_number));
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_initialize_gpe_block
*
* PARAMETERS: gpe_device - Handle to the parent GPE block
* gpe_block - Gpe Block info
*
* RETURN: Status
*
* DESCRIPTION: Initialize and enable a GPE block. First find and run any
* _PRT methods associated with the block, then enable the
* appropriate GPEs.
* Note: Assumes namespace is locked.
*
******************************************************************************/
acpi_status
acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,
struct acpi_gpe_block_info *gpe_block)
{
acpi_status status;
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_gpe_walk_info gpe_info;
u32 wake_gpe_count;
u32 gpe_enabled_count;
acpi_native_uint i;
acpi_native_uint j;
ACPI_FUNCTION_TRACE("ev_initialize_gpe_block");
/* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
if (!gpe_block) {
return_ACPI_STATUS(AE_OK);
}
/* /*
* Runtime option: Should Wake GPEs be enabled at runtime? The default * Runtime option: Should wake GPEs be enabled at runtime? The default
* is No, they should only be enabled just as the machine goes to sleep. * is no, they should only be enabled just as the machine goes to sleep.
*/ */
if (acpi_gbl_leave_wake_gpes_disabled) { if (acpi_gbl_leave_wake_gpes_disabled) {
/* /*
* Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods. * Differentiate runtime vs wake GPEs, via the _PRW control methods.
* (Each GPE that has one or more _PRWs that reference it is by * Each GPE that has one or more _PRWs that reference it is by
* definition a WAKE GPE and will not be enabled while the machine * definition a wake GPE and will not be enabled while the machine
* is running.) * is running.
*/ */
gpe_info.gpe_block = gpe_block; gpe_info.gpe_block = gpe_block;
gpe_info.gpe_device = gpe_device; gpe_info.gpe_device = gpe_device;
@ -948,9 +1001,12 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
} }
/* /*
* Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs, * Enable all GPEs in this block that have these attributes:
* and 2) have a corresponding _Lxx or _Exx method. All other GPEs must * 1) are "runtime" or "run/wake" GPEs, and
* be enabled via the acpi_enable_gpe() external interface. * 2) have a corresponding _Lxx or _Exx method
*
* Any other GPEs within this block must be enabled via the acpi_enable_gpe()
* external interface.
*/ */
wake_gpe_count = 0; wake_gpe_count = 0;
gpe_enabled_count = 0; gpe_enabled_count = 0;
@ -976,32 +1032,19 @@ acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
} }
} }
/* Dump info about this GPE block */
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
(u32) gpe_block->block_base_number,
(u32) (gpe_block->block_base_number +
((gpe_block->register_count *
ACPI_GPE_REGISTER_WIDTH) - 1)),
gpe_device->name.ascii, gpe_block->register_count,
interrupt_number));
/* Enable all valid GPEs found above */
status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
ACPI_DEBUG_PRINT((ACPI_DB_INIT, ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"Found %u Wake, Enabled %u Runtime GPEs in this block\n", "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
wake_gpe_count, gpe_enabled_count)); wake_gpe_count, gpe_enabled_count));
/* Return the new block */ /* Enable all valid runtime GPEs found above */
if (return_gpe_block) { status = acpi_hw_enable_runtime_gpe_block(NULL, gpe_block);
(*return_gpe_block) = gpe_block; if (ACPI_FAILURE(status)) {
ACPI_ERROR((AE_INFO, "Could not enable GPEs in gpe_block %p",
gpe_block));
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(status);
} }
/******************************************************************************* /*******************************************************************************
@ -1072,8 +1115,8 @@ acpi_status acpi_ev_gpe_initialize(void)
&acpi_gbl_gpe_fadt_blocks[0]); &acpi_gbl_gpe_fadt_blocks[0]);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n", ACPI_EXCEPTION((AE_INFO, status,
acpi_format_exception(status))); "Could not create GPE Block 0"));
} }
} }
@ -1086,7 +1129,12 @@ acpi_status acpi_ev_gpe_initialize(void)
if ((register_count0) && if ((register_count0) &&
(gpe_number_max >= acpi_gbl_FADT->gpe1_base)) { (gpe_number_max >= acpi_gbl_FADT->gpe1_base)) {
ACPI_REPORT_ERROR(("GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n", gpe_number_max, acpi_gbl_FADT->gpe1_base, acpi_gbl_FADT->gpe1_base + ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1))); ACPI_ERROR((AE_INFO,
"GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
gpe_number_max, acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->gpe1_base +
((register_count1 *
ACPI_GPE_REGISTER_WIDTH) - 1)));
/* Ignore GPE1 block by setting the register count to zero */ /* Ignore GPE1 block by setting the register count to zero */
@ -1104,7 +1152,8 @@ acpi_status acpi_ev_gpe_initialize(void)
[1]); [1]);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO, status,
"Could not create GPE Block 1"));
} }
/* /*
@ -1130,7 +1179,9 @@ acpi_status acpi_ev_gpe_initialize(void)
/* Check for Max GPE number out-of-range */ /* Check for Max GPE number out-of-range */
if (gpe_number_max > ACPI_GPE_MAX) { if (gpe_number_max > ACPI_GPE_MAX) {
ACPI_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max)); ACPI_ERROR((AE_INFO,
"Maximum GPE number from FADT is too large: 0x%X",
gpe_number_max));
status = AE_BAD_VALUE; status = AE_BAD_VALUE;
goto cleanup; goto cleanup;
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -303,7 +303,8 @@ static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore, acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
acpi_gbl_global_lock_thread_count); acpi_gbl_global_lock_thread_count);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n")); ACPI_ERROR((AE_INFO,
"Could not signal Global Lock semaphore"));
} }
} }
} }
@ -344,7 +345,8 @@ static u32 acpi_ev_global_lock_handler(void *context)
acpi_ev_global_lock_thread, acpi_ev_global_lock_thread,
context); context);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO, status,
"Could not queue Global Lock thread"));
return (ACPI_INTERRUPT_NOT_HANDLED); return (ACPI_INTERRUPT_NOT_HANDLED);
} }
@ -384,7 +386,8 @@ acpi_status acpi_ev_init_global_lock_handler(void)
* with an error. * with an error.
*/ */
if (status == AE_NO_HARDWARE_RESPONSE) { if (status == AE_NO_HARDWARE_RESPONSE) {
ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n")); ACPI_ERROR((AE_INFO,
"No response from Global Lock hardware, disabling lock"));
acpi_gbl_global_lock_present = FALSE; acpi_gbl_global_lock_present = FALSE;
status = AE_OK; status = AE_OK;
@ -480,7 +483,8 @@ acpi_status acpi_ev_release_global_lock(void)
ACPI_FUNCTION_TRACE("ev_release_global_lock"); ACPI_FUNCTION_TRACE("ev_release_global_lock");
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_WARNING((AE_INFO,
"Cannot release HW Global Lock, it has not been acquired"));
return_ACPI_STATUS(AE_NOT_ACQUIRED); return_ACPI_STATUS(AE_NOT_ACQUIRED);
} }
@ -542,9 +546,9 @@ void 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, ACPI_ERROR((AE_INFO,
"Could not disable fixed event %d\n", "Could not disable fixed event %d",
(u32) i)); (u32) i));
} }
} }
@ -556,8 +560,7 @@ void 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, ACPI_ERROR((AE_INFO, "Could not remove SCI handler"));
"Could not remove SCI handler\n"));
} }
} }
@ -570,8 +573,7 @@ void acpi_ev_terminate(void)
if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) { if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
status = acpi_disable(); status = acpi_disable();
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_WARNING((AE_INFO, "acpi_disable failed"));
"acpi_disable failed\n"));
} }
} }
return_VOID; return_VOID;

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -295,12 +295,12 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
handler_desc = region_obj->region.handler; handler_desc = region_obj->region.handler;
if (!handler_desc) { if (!handler_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"No handler for Region [%4.4s] (%p) [%s]\n", "No handler for Region [%4.4s] (%p) [%s]",
acpi_ut_get_node_name(region_obj->region. acpi_ut_get_node_name(region_obj->region.node),
node), region_obj, region_obj,
acpi_ut_get_region_name(region_obj->region. acpi_ut_get_region_name(region_obj->region.
space_id))); space_id)));
return_ACPI_STATUS(AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST);
} }
@ -317,12 +317,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
if (!region_setup) { if (!region_setup) {
/* No initialization routine, exit with error */ /* No initialization routine, exit with error */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"No init routine for region(%p) [%s]\n", "No init routine for region(%p) [%s]",
region_obj, region_obj,
acpi_ut_get_region_name(region_obj-> acpi_ut_get_region_name(region_obj->region.
region. space_id)));
space_id)));
return_ACPI_STATUS(AE_NOT_EXIST); return_ACPI_STATUS(AE_NOT_EXIST);
} }
@ -347,12 +346,11 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
/* Check for failure of the Region Setup */ /* Check for failure of the Region Setup */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"Region Init: %s [%s]\n", "During region initialization: [%s]",
acpi_format_exception(status), acpi_ut_get_region_name(region_obj->
acpi_ut_get_region_name(region_obj-> region.
region. space_id)));
space_id)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -406,10 +404,9 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
region_obj2->extra.region_context); region_obj2->extra.region_context);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n", ACPI_EXCEPTION((AE_INFO, status, "Returned by Handler for [%s]",
acpi_ut_get_region_name(region_obj->region. acpi_ut_get_region_name(region_obj->region.
space_id), space_id)));
acpi_format_exception(status)));
} }
if (! if (!
@ -501,12 +498,10 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
status = acpi_ev_execute_reg_method(region_obj, 0); status = acpi_ev_execute_reg_method(region_obj, 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"%s from region _REG, [%s]\n", "from region _REG, [%s]",
acpi_format_exception(status), acpi_ut_get_region_name
acpi_ut_get_region_name (region_obj->region.space_id)));
(region_obj->region.
space_id)));
} }
if (acpi_ns_is_locked) { if (acpi_ns_is_locked) {
@ -528,12 +523,10 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj,
/* Init routine may fail, Just ignore errors */ /* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"%s from region init, [%s]\n", "from region init, [%s]",
acpi_format_exception(status), acpi_ut_get_region_name
acpi_ut_get_region_name (region_obj->region.space_id)));
(region_obj->region.
space_id)));
} }
region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE); region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -233,7 +233,11 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,
*/ */
status = AE_OK; status = AE_OK;
} else { } else {
ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO,
status,
"Could not install pci_config handler for Root Bridge %4.4s",
acpi_ut_get_node_name
(pci_root_node)));
} }
} }
break; break;

View File

@ -6,7 +6,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -88,7 +88,7 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
*/ */
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled); return_UINT32(interrupt_handled);
} }
/******************************************************************************* /*******************************************************************************
@ -121,7 +121,7 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
*/ */
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
return_VALUE(interrupt_handled); return_UINT32(interrupt_handled);
} }
/****************************************************************************** /******************************************************************************

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -143,8 +143,8 @@ acpi_install_fixed_event_handler(u32 event,
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status))
status = acpi_enable_event(event, 0); status = acpi_enable_event(event, 0);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_WARNING((AE_INFO, "Could not enable fixed event %X",
"Could not enable fixed event.\n")); event));
/* Remove the handler */ /* Remove the handler */
@ -204,10 +204,11 @@ acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
acpi_gbl_fixed_event_handlers[event].context = NULL; acpi_gbl_fixed_event_handlers[event].context = NULL;
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_WARNING((AE_INFO,
"Could not write to fixed event enable register.\n")); "Could not write to fixed event enable register %X",
event));
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n", ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X\n",
event)); event));
} }
@ -434,7 +435,7 @@ acpi_remove_notify_handler(acpi_handle device,
if (device == ACPI_ROOT_OBJECT) { if (device == ACPI_ROOT_OBJECT) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Removing notify handler for ROOT object.\n")); "Removing notify handler for namespace 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) ||
@ -562,7 +563,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
struct acpi_gpe_event_info *gpe_event_info; struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler; struct acpi_handler_info *handler;
acpi_status status; acpi_status status;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("acpi_install_gpe_handler"); ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
@ -653,7 +654,7 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
struct acpi_gpe_event_info *gpe_event_info; struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler; struct acpi_handler_info *handler;
acpi_status status; acpi_status status;
u32 flags; acpi_cpu_flags flags;
ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler"); ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -70,8 +70,7 @@ acpi_status acpi_enable(void)
/* Make sure we have the FADT */ /* Make sure we have the FADT */
if (!acpi_gbl_FADT) { if (!acpi_gbl_FADT) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_WARNING((AE_INFO, "No FADT information present!"));
"No FADT information present!\n"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES); return_ACPI_STATUS(AE_NO_ACPI_TABLES);
} }
@ -83,7 +82,8 @@ acpi_status acpi_enable(void)
status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI); status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n")); ACPI_ERROR((AE_INFO,
"Could not transition to ACPI mode"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -113,8 +113,7 @@ acpi_status acpi_disable(void)
ACPI_FUNCTION_TRACE("acpi_disable"); ACPI_FUNCTION_TRACE("acpi_disable");
if (!acpi_gbl_FADT) { if (!acpi_gbl_FADT) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_WARNING((AE_INFO, "No FADT information present!"));
"No FADT information present!\n"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES); return_ACPI_STATUS(AE_NO_ACPI_TABLES);
} }
@ -127,8 +126,8 @@ acpi_status 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, ACPI_ERROR((AE_INFO,
"Could not exit ACPI mode to legacy mode")); "Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -185,9 +184,9 @@ acpi_status acpi_enable_event(u32 event, u32 flags)
} }
if (value != 1) { if (value != 1) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not enable %s event\n", "Could not enable %s event",
acpi_ut_get_event_name(event))); acpi_ut_get_event_name(event)));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
} }
@ -384,9 +383,9 @@ acpi_status acpi_disable_event(u32 event, u32 flags)
} }
if (value != 0) { if (value != 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not disable %s events\n", "Could not disable %s events",
acpi_ut_get_event_name(event))); acpi_ut_get_event_name(event)));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
} }
@ -626,6 +625,13 @@ acpi_install_gpe_block(acpi_handle gpe_device,
goto unlock_and_exit; goto unlock_and_exit;
} }
/* Run the _PRW methods and enable the GPEs */
status = acpi_ev_initialize_gpe_block(node, gpe_block);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* Get the device_object attached to the node */ /* Get the device_object attached to the node */
obj_desc = acpi_ns_get_attached_object(node); obj_desc = acpi_ns_get_attached_object(node);

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -413,9 +413,9 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
(!ACPI_STRNCMP(table_ptr->signature, (!ACPI_STRNCMP(table_ptr->signature,
acpi_gbl_table_data[ACPI_TABLE_SSDT].signature, acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) { acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n", "Table has invalid signature [%4.4s], must be SSDT or PSDT",
table_ptr->signature)); table_ptr->signature));
status = AE_BAD_SIGNATURE; status = AE_BAD_SIGNATURE;
goto cleanup; goto cleanup;
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -504,18 +504,12 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
} }
/* /*
* Perform the conversion. * Create a new string object and string buffer
* (-1 because of extra separator included in string_length from above) * (-1 because of extra separator included in string_length from above)
*/ */
string_length--;
if (string_length > ACPI_MAX_STRING_CONVERSION) { /* ACPI limit */
return_ACPI_STATUS(AE_AML_STRING_LIMIT);
}
/* Create a new string object and string buffer */
return_desc = return_desc =
acpi_ut_create_string_object((acpi_size) string_length); acpi_ut_create_string_object((acpi_size)
(string_length - 1));
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
@ -647,7 +641,9 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
break; break;
default: default:
ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type)); ACPI_ERROR((AE_INFO,
"Bad destination type during conversion: %X",
destination_type));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -660,17 +656,13 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unknown Target type ID 0x%X Op %s dest_type %s\n", "Unknown Target type ID 0x%X aml_opcode %X dest_type %s",
GET_CURRENT_ARG_TYPE(walk_state->op_info-> GET_CURRENT_ARG_TYPE(walk_state->op_info->
runtime_args), runtime_args),
walk_state->op_info->name, walk_state->opcode,
acpi_ut_get_type_name(destination_type))); acpi_ut_get_type_name(destination_type)));
status = AE_AML_INTERNAL;
ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n",
GET_CURRENT_ARG_TYPE(walk_state->op_info->
runtime_args)))
status = AE_AML_INTERNAL;
} }
/* /*

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -300,8 +300,8 @@ acpi_ex_create_region(u8 * aml_start,
*/ */
if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) && if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
(region_space < ACPI_USER_REGION_BEGIN)) { (region_space < ACPI_USER_REGION_BEGIN)) {
ACPI_REPORT_ERROR(("Invalid address_space type %X\n", ACPI_ERROR((AE_INFO, "Invalid address_space type %X",
region_space)); region_space));
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID); return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -55,20 +55,386 @@ ACPI_MODULE_NAME("exdump")
*/ */
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* Local prototypes */ /* Local prototypes */
#ifdef ACPI_FUTURE_USAGE
static void acpi_ex_out_string(char *title, char *value); 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_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); static void acpi_ex_out_address(char *title, acpi_physical_address value);
static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc);
static void static void
acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
#endif /* ACPI_FUTURE_USAGE */ u32 level, u32 index);
/*******************************************************************************
*
* Object Descriptor info tables
*
* Note: The first table entry must be an INIT opcode and must contain
* the table length (number of table entries)
*
******************************************************************************/
static struct acpi_exdump_info acpi_ex_dump_integer[2] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_integer), NULL},
{ACPI_EXD_UINT64, ACPI_EXD_OFFSET(integer.value), "Value"}
};
static struct acpi_exdump_info acpi_ex_dump_string[4] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_string), NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(string.length), "Length"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(string.pointer), "Pointer"},
{ACPI_EXD_STRING, 0, NULL}
};
static struct acpi_exdump_info acpi_ex_dump_buffer[4] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer), NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(buffer.length), "Length"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer.pointer), "Pointer"},
{ACPI_EXD_BUFFER, 0, NULL}
};
static struct acpi_exdump_info acpi_ex_dump_package[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_package), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(package.flags), "Flags"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(package.count), "Elements"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(package.elements), "Element List"},
{ACPI_EXD_PACKAGE, 0, NULL}
};
static struct acpi_exdump_info acpi_ex_dump_device[4] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_device), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.handler), "Handler"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.system_notify),
"System Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(device.device_notify),
"Device Notify"}
};
static struct acpi_exdump_info acpi_ex_dump_event[2] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_event), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(event.semaphore), "Semaphore"}
};
static struct acpi_exdump_info acpi_ex_dump_method[8] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_method), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.param_count), "param_count"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.concurrency), "Concurrency"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.semaphore), "Semaphore"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.owner_id), "Owner Id"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(method.thread_count), "Thread Count"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(method.aml_length), "Aml Length"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(method.aml_start), "Aml Start"}
};
static struct acpi_exdump_info acpi_ex_dump_mutex[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_mutex), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(mutex.sync_level), "Sync Level"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.owner_thread), "Owner Thread"},
{ACPI_EXD_UINT16, ACPI_EXD_OFFSET(mutex.acquisition_depth),
"Acquire Depth"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(mutex.semaphore), "Semaphore"}
};
static struct acpi_exdump_info acpi_ex_dump_region[7] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.space_id), "Space Id"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(region.flags), "Flags"},
{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(region.address), "Address"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(region.length), "Length"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.handler), "Handler"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(region.next), "Next"}
};
static struct acpi_exdump_info acpi_ex_dump_power[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_power), NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.system_level),
"System Level"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(power_resource.resource_order),
"Resource Order"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.system_notify),
"System Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(power_resource.device_notify),
"Device Notify"}
};
static struct acpi_exdump_info acpi_ex_dump_processor[7] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_processor), NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.proc_id), "Processor ID"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(processor.length), "Length"},
{ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET(processor.address), "Address"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.system_notify),
"System Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.device_notify),
"Device Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(processor.handler), "Handler"}
};
static struct acpi_exdump_info acpi_ex_dump_thermal[4] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_thermal), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.system_notify),
"System Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.device_notify),
"Device Notify"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(thermal_zone.handler), "Handler"}
};
static struct acpi_exdump_info acpi_ex_dump_buffer_field[3] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_buffer_field), NULL},
{ACPI_EXD_FIELD, 0, NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(buffer_field.buffer_obj),
"Buffer Object"}
};
static struct acpi_exdump_info acpi_ex_dump_region_field[3] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_region_field), NULL},
{ACPI_EXD_FIELD, 0, NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(field.region_obj), "Region Object"}
};
static struct acpi_exdump_info acpi_ex_dump_bank_field[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
{ACPI_EXD_FIELD, 0, NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(bank_field.value), "Value"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.region_obj),
"Region Object"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(bank_field.bank_obj), "Bank Object"}
};
static struct acpi_exdump_info acpi_ex_dump_index_field[5] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_bank_field), NULL},
{ACPI_EXD_FIELD, 0, NULL},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(index_field.value), "Value"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.index_obj),
"Index Object"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(index_field.data_obj), "Data Object"}
};
static struct acpi_exdump_info acpi_ex_dump_reference[7] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_reference), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(reference.target_type), "Target Type"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(reference.offset), "Offset"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.object), "Object Desc"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.node), "Node"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(reference.where), "Where"},
{ACPI_EXD_REFERENCE, 0, NULL}
};
static struct acpi_exdump_info acpi_ex_dump_address_handler[6] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_address_handler),
NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(address_space.space_id), "Space Id"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.next), "Next"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.region_list),
"Region List"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.node), "Node"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(address_space.context), "Context"}
};
static struct acpi_exdump_info acpi_ex_dump_notify[3] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_notify), NULL},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.node), "Node"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(notify.context), "Context"}
};
/* Miscellaneous tables */
static struct acpi_exdump_info acpi_ex_dump_common[4] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_common), NULL},
{ACPI_EXD_TYPE, 0, NULL},
{ACPI_EXD_UINT16, ACPI_EXD_OFFSET(common.reference_count),
"Reference Count"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common.flags), "Flags"}
};
static struct acpi_exdump_info acpi_ex_dump_field_common[7] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_field_common), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.field_flags),
"Field Flags"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.access_byte_width),
"Access Byte Width"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.bit_length),
"Bit Length"},
{ACPI_EXD_UINT8, ACPI_EXD_OFFSET(common_field.start_field_bit_offset),
"Field Bit Offset"},
{ACPI_EXD_UINT32, ACPI_EXD_OFFSET(common_field.base_byte_offset),
"Base Byte Offset"},
{ACPI_EXD_POINTER, ACPI_EXD_OFFSET(common_field.node), "Parent Node"}
};
static struct acpi_exdump_info acpi_ex_dump_node[6] = {
{ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE(acpi_ex_dump_node), NULL},
{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(flags), "Flags"},
{ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET(owner_id), "Owner Id"},
{ACPI_EXD_UINT16, ACPI_EXD_NSOFFSET(reference_count),
"Reference Count"},
{ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(child), "Child List"},
{ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET(peer), "Next Peer"}
};
/* Dispatch table, indexed by object type */
static struct acpi_exdump_info *acpi_ex_dump_info[] = {
NULL,
acpi_ex_dump_integer,
acpi_ex_dump_string,
acpi_ex_dump_buffer,
acpi_ex_dump_package,
NULL,
acpi_ex_dump_device,
acpi_ex_dump_event,
acpi_ex_dump_method,
acpi_ex_dump_mutex,
acpi_ex_dump_region,
acpi_ex_dump_power,
acpi_ex_dump_processor,
acpi_ex_dump_thermal,
acpi_ex_dump_buffer_field,
NULL,
NULL,
acpi_ex_dump_region_field,
acpi_ex_dump_bank_field,
acpi_ex_dump_index_field,
acpi_ex_dump_reference,
NULL,
NULL,
acpi_ex_dump_notify,
acpi_ex_dump_address_handler,
NULL,
NULL,
NULL
};
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_object
*
* PARAMETERS: obj_desc - Descriptor to dump
* Info - Info table corresponding to this object
* type
*
* RETURN: None
*
* DESCRIPTION: Walk the info table for this object
*
******************************************************************************/
static void
acpi_ex_dump_object(union acpi_operand_object *obj_desc,
struct acpi_exdump_info *info)
{
u8 *target;
char *name;
u8 count;
if (!info) {
acpi_os_printf
("ex_dump_object: Display not implemented for object type %s\n",
acpi_ut_get_object_type_name(obj_desc));
return;
}
/* First table entry must contain the table length (# of table entries) */
count = info->offset;
while (count) {
target = ACPI_ADD_PTR(u8, obj_desc, info->offset);
name = info->name;
switch (info->opcode) {
case ACPI_EXD_INIT:
break;
case ACPI_EXD_TYPE:
acpi_ex_out_string("Type",
acpi_ut_get_object_type_name
(obj_desc));
break;
case ACPI_EXD_UINT8:
acpi_os_printf("%20s : %2.2X\n", name, *target);
break;
case ACPI_EXD_UINT16:
acpi_os_printf("%20s : %4.4X\n", name,
ACPI_GET16(target));
break;
case ACPI_EXD_UINT32:
acpi_os_printf("%20s : %8.8X\n", name,
ACPI_GET32(target));
break;
case ACPI_EXD_UINT64:
acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
ACPI_FORMAT_UINT64(ACPI_GET64(target)));
break;
case ACPI_EXD_POINTER:
acpi_ex_out_pointer(name,
*ACPI_CAST_PTR(void *, target));
break;
case ACPI_EXD_ADDRESS:
acpi_ex_out_address(name,
*ACPI_CAST_PTR
(acpi_physical_address, target));
break;
case ACPI_EXD_STRING:
acpi_ut_print_string(obj_desc->string.pointer,
ACPI_UINT8_MAX);
acpi_os_printf("\n");
break;
case ACPI_EXD_BUFFER:
ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
obj_desc->buffer.length);
break;
case ACPI_EXD_PACKAGE:
/* Dump the package contents */
acpi_os_printf("\nPackage Contents:\n");
acpi_ex_dump_package_obj(obj_desc, 0, 0);
break;
case ACPI_EXD_FIELD:
acpi_ex_dump_object(obj_desc,
acpi_ex_dump_field_common);
break;
case ACPI_EXD_REFERENCE:
acpi_ex_out_string("Opcode",
(acpi_ps_get_opcode_info
(obj_desc->reference.opcode))->
name);
acpi_ex_dump_reference_obj(obj_desc);
break;
default:
acpi_os_printf("**** Invalid table opcode [%X] ****\n",
info->opcode);
return;
}
info++;
count--;
}
}
/******************************************************************************* /*******************************************************************************
* *
@ -214,7 +580,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
acpi_os_printf("Buffer len %X @ %p \n", acpi_os_printf("Buffer len %X @ %p\n",
obj_desc->buffer.length, obj_desc->buffer.length,
obj_desc->buffer.pointer); obj_desc->buffer.pointer);
@ -320,17 +686,17 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
case ACPI_TYPE_BUFFER_FIELD: case ACPI_TYPE_BUFFER_FIELD:
acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", acpi_os_printf("buffer_field: %X bits at byte %X bit %X of\n",
obj_desc->buffer_field.bit_length, obj_desc->buffer_field.bit_length,
obj_desc->buffer_field.base_byte_offset, 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 } else
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
!= ACPI_TYPE_BUFFER) { != ACPI_TYPE_BUFFER) {
acpi_os_printf("*not a Buffer* \n"); acpi_os_printf("*not a Buffer*\n");
} else { } else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
depth + 1); depth + 1);
@ -441,7 +807,6 @@ acpi_ex_dump_operands(union acpi_operand_object **operands,
return; return;
} }
#ifdef ACPI_FUTURE_USAGE
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_out* functions * FUNCTION: acpi_ex_out* functions
@ -465,11 +830,6 @@ static void acpi_ex_out_pointer(char *title, void *value)
acpi_os_printf("%20s : %p\n", title, value); acpi_os_printf("%20s : %p\n", title, value);
} }
static void acpi_ex_out_integer(char *title, u32 value)
{
acpi_os_printf("%20s : %.2X\n", title, value);
}
static void acpi_ex_out_address(char *title, acpi_physical_address value) static void acpi_ex_out_address(char *title, acpi_physical_address value)
{ {
@ -482,16 +842,16 @@ static void acpi_ex_out_address(char *title, acpi_physical_address value)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_node * FUNCTION: acpi_ex_dump_namespace_node
* *
* PARAMETERS: *Node - Descriptor to dump * PARAMETERS: Node - Descriptor to dump
* Flags - Force display if TRUE * Flags - Force display if TRUE
* *
* DESCRIPTION: Dumps the members of the given.Node * DESCRIPTION: Dumps the members of the given.Node
* *
******************************************************************************/ ******************************************************************************/
void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags)
{ {
ACPI_FUNCTION_ENTRY(); ACPI_FUNCTION_ENTRY();
@ -506,19 +866,17 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags)
acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node));
acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type));
acpi_ex_out_integer("Flags", node->flags);
acpi_ex_out_integer("Owner Id", node->owner_id);
acpi_ex_out_integer("Reference Count", node->reference_count);
acpi_ex_out_pointer("Attached Object", acpi_ex_out_pointer("Attached Object",
acpi_ns_get_attached_object(node)); acpi_ns_get_attached_object(node));
acpi_ex_out_pointer("child_list", node->child);
acpi_ex_out_pointer("next_peer", node->peer);
acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node));
acpi_ex_dump_object(ACPI_CAST_PTR(union acpi_operand_object, node),
acpi_ex_dump_node);
} }
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_reference * FUNCTION: acpi_ex_dump_reference_obj
* *
* PARAMETERS: Object - Descriptor to dump * PARAMETERS: Object - Descriptor to dump
* *
@ -526,14 +884,16 @@ void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags)
* *
******************************************************************************/ ******************************************************************************/
static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) static void acpi_ex_dump_reference_obj(union acpi_operand_object *obj_desc)
{ {
struct acpi_buffer ret_buf; struct acpi_buffer ret_buf;
acpi_status status; acpi_status status;
ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
acpi_os_printf("Named Object %p ", obj_desc->reference.node); acpi_os_printf("Named Object %p ", obj_desc->reference.node);
ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = status =
acpi_ns_handle_to_pathname(obj_desc->reference.node, acpi_ns_handle_to_pathname(obj_desc->reference.node,
&ret_buf); &ret_buf);
@ -551,9 +911,9 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ex_dump_package * FUNCTION: acpi_ex_dump_package_obj
* *
* PARAMETERS: Object - Descriptor to dump * PARAMETERS: obj_desc - Descriptor to dump
* Level - Indentation Level * Level - Indentation Level
* Index - Package index for this object * Index - Package index for this object
* *
@ -562,7 +922,8 @@ static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
******************************************************************************/ ******************************************************************************/
static void static void
acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,
u32 level, u32 index)
{ {
u32 i; u32 i;
@ -608,7 +969,8 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
acpi_os_printf("[Buffer] Length %.2X = ", acpi_os_printf("[Buffer] Length %.2X = ",
obj_desc->buffer.length); obj_desc->buffer.length);
if (obj_desc->buffer.length) { if (obj_desc->buffer.length) {
acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, acpi_ut_dump_buffer(ACPI_CAST_PTR
(u8, obj_desc->buffer.pointer),
obj_desc->buffer.length, obj_desc->buffer.length,
DB_DWORD_DISPLAY, _COMPONENT); DB_DWORD_DISPLAY, _COMPONENT);
} else { } else {
@ -618,19 +980,19 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
acpi_os_printf("[Package] Contains %d Elements: \n", acpi_os_printf("[Package] Contains %d Elements:\n",
obj_desc->package.count); obj_desc->package.count);
for (i = 0; i < obj_desc->package.count; i++) { for (i = 0; i < obj_desc->package.count; i++) {
acpi_ex_dump_package(obj_desc->package.elements[i], acpi_ex_dump_package_obj(obj_desc->package.elements[i],
level + 1, i); level + 1, i);
} }
break; break;
case ACPI_TYPE_LOCAL_REFERENCE: case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf("[Object Reference] "); acpi_os_printf("[Object Reference] ");
acpi_ex_dump_reference(obj_desc); acpi_ex_dump_reference_obj(obj_desc);
break; break;
default: default:
@ -645,7 +1007,7 @@ acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
* *
* FUNCTION: acpi_ex_dump_object_descriptor * FUNCTION: acpi_ex_dump_object_descriptor
* *
* PARAMETERS: Object - Descriptor to dump * PARAMETERS: obj_desc - Descriptor to dump
* Flags - Force display if TRUE * Flags - Force display if TRUE
* *
* DESCRIPTION: Dumps the members of the object descriptor given. * DESCRIPTION: Dumps the members of the object descriptor given.
@ -670,11 +1032,13 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
} }
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, acpi_ex_dump_namespace_node((struct acpi_namespace_node *)
flags); obj_desc, flags);
acpi_os_printf("\nAttached Object (%p):\n", acpi_os_printf("\nAttached Object (%p):\n",
((struct acpi_namespace_node *)obj_desc)-> ((struct acpi_namespace_node *)obj_desc)->
object); object);
acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *)
obj_desc)->object, flags); obj_desc)->object, flags);
return_VOID; return_VOID;
@ -687,233 +1051,18 @@ acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
return_VOID; return_VOID;
} }
/* Common Fields */ if (obj_desc->common.type > ACPI_TYPE_NS_NODE_MAX) {
return_VOID;
acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc));
acpi_ex_out_integer("Reference Count",
obj_desc->common.reference_count);
acpi_ex_out_integer("Flags", obj_desc->common.flags);
/* Object-specific Fields */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_INTEGER:
acpi_os_printf("%20s : %8.8X%8.8X\n", "Value",
ACPI_FORMAT_UINT64(obj_desc->integer.value));
break;
case ACPI_TYPE_STRING:
acpi_ex_out_integer("Length", obj_desc->string.length);
acpi_os_printf("%20s : %p ", "Pointer",
obj_desc->string.pointer);
acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX);
acpi_os_printf("\n");
break;
case ACPI_TYPE_BUFFER:
acpi_ex_out_integer("Length", obj_desc->buffer.length);
acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer);
ACPI_DUMP_BUFFER(obj_desc->buffer.pointer,
obj_desc->buffer.length);
break;
case ACPI_TYPE_PACKAGE:
acpi_ex_out_integer("Flags", obj_desc->package.flags);
acpi_ex_out_integer("Elements", obj_desc->package.count);
acpi_ex_out_pointer("Element List", obj_desc->package.elements);
/* Dump the package contents */
acpi_os_printf("\nPackage Contents:\n");
acpi_ex_dump_package(obj_desc, 0, 0);
break;
case ACPI_TYPE_DEVICE:
acpi_ex_out_pointer("Handler", obj_desc->device.handler);
acpi_ex_out_pointer("system_notify",
obj_desc->device.system_notify);
acpi_ex_out_pointer("device_notify",
obj_desc->device.device_notify);
break;
case ACPI_TYPE_EVENT:
acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore);
break;
case ACPI_TYPE_METHOD:
acpi_ex_out_integer("param_count",
obj_desc->method.param_count);
acpi_ex_out_integer("Concurrency",
obj_desc->method.concurrency);
acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore);
acpi_ex_out_integer("owner_id", obj_desc->method.owner_id);
acpi_ex_out_integer("aml_length", obj_desc->method.aml_length);
acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start);
break;
case ACPI_TYPE_MUTEX:
acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level);
acpi_ex_out_pointer("owner_thread",
obj_desc->mutex.owner_thread);
acpi_ex_out_integer("acquire_depth",
obj_desc->mutex.acquisition_depth);
acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore);
break;
case ACPI_TYPE_REGION:
acpi_ex_out_integer("space_id", obj_desc->region.space_id);
acpi_ex_out_integer("Flags", obj_desc->region.flags);
acpi_ex_out_address("Address", obj_desc->region.address);
acpi_ex_out_integer("Length", obj_desc->region.length);
acpi_ex_out_pointer("Handler", obj_desc->region.handler);
acpi_ex_out_pointer("Next", obj_desc->region.next);
break;
case ACPI_TYPE_POWER:
acpi_ex_out_integer("system_level",
obj_desc->power_resource.system_level);
acpi_ex_out_integer("resource_order",
obj_desc->power_resource.resource_order);
acpi_ex_out_pointer("system_notify",
obj_desc->power_resource.system_notify);
acpi_ex_out_pointer("device_notify",
obj_desc->power_resource.device_notify);
break;
case ACPI_TYPE_PROCESSOR:
acpi_ex_out_integer("Processor ID",
obj_desc->processor.proc_id);
acpi_ex_out_integer("Length", obj_desc->processor.length);
acpi_ex_out_address("Address",
(acpi_physical_address) obj_desc->processor.
address);
acpi_ex_out_pointer("system_notify",
obj_desc->processor.system_notify);
acpi_ex_out_pointer("device_notify",
obj_desc->processor.device_notify);
acpi_ex_out_pointer("Handler", obj_desc->processor.handler);
break;
case ACPI_TYPE_THERMAL:
acpi_ex_out_pointer("system_notify",
obj_desc->thermal_zone.system_notify);
acpi_ex_out_pointer("device_notify",
obj_desc->thermal_zone.device_notify);
acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler);
break;
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_ex_out_integer("field_flags",
obj_desc->common_field.field_flags);
acpi_ex_out_integer("access_byte_width",
obj_desc->common_field.access_byte_width);
acpi_ex_out_integer("bit_length",
obj_desc->common_field.bit_length);
acpi_ex_out_integer("fld_bit_offset",
obj_desc->common_field.
start_field_bit_offset);
acpi_ex_out_integer("base_byte_offset",
obj_desc->common_field.base_byte_offset);
acpi_ex_out_pointer("parent_node", obj_desc->common_field.node);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_BUFFER_FIELD:
acpi_ex_out_pointer("buffer_obj",
obj_desc->buffer_field.buffer_obj);
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_ex_out_pointer("region_obj",
obj_desc->field.region_obj);
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_ex_out_integer("Value",
obj_desc->bank_field.value);
acpi_ex_out_pointer("region_obj",
obj_desc->bank_field.region_obj);
acpi_ex_out_pointer("bank_obj",
obj_desc->bank_field.bank_obj);
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_ex_out_integer("Value",
obj_desc->index_field.value);
acpi_ex_out_pointer("Index",
obj_desc->index_field.index_obj);
acpi_ex_out_pointer("Data",
obj_desc->index_field.data_obj);
break;
default:
/* All object types covered above */
break;
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
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_integer("Offset", obj_desc->reference.offset);
acpi_ex_out_pointer("obj_desc", obj_desc->reference.object);
acpi_ex_out_pointer("Node", obj_desc->reference.node);
acpi_ex_out_pointer("Where", obj_desc->reference.where);
acpi_ex_dump_reference(obj_desc);
break;
case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
acpi_ex_out_integer("space_id",
obj_desc->address_space.space_id);
acpi_ex_out_pointer("Next", obj_desc->address_space.next);
acpi_ex_out_pointer("region_list",
obj_desc->address_space.region_list);
acpi_ex_out_pointer("Node", obj_desc->address_space.node);
acpi_ex_out_pointer("Context", obj_desc->address_space.context);
break;
case ACPI_TYPE_LOCAL_NOTIFY:
acpi_ex_out_pointer("Node", obj_desc->notify.node);
acpi_ex_out_pointer("Context", obj_desc->notify.context);
break;
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
case ACPI_TYPE_LOCAL_EXTRA:
case ACPI_TYPE_LOCAL_DATA:
default:
acpi_os_printf
("ex_dump_object_descriptor: Display not implemented for object type %s\n",
acpi_ut_get_object_type_name(obj_desc));
break;
} }
/* Common Fields */
acpi_ex_dump_object(obj_desc, acpi_ex_dump_common);
/* Object-specific fields */
acpi_ex_dump_object(obj_desc, acpi_ex_dump_info[obj_desc->common.type]);
return_VOID; return_VOID;
} }
#endif /* ACPI_FUTURE_USAGE */
#endif #endif

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -249,13 +249,18 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
*/ */
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_ut_get_object_type_name(source_desc))); ACPI_ERROR((AE_INFO,
"SMBus write requires Buffer, found type %s",
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_SMBUS_BUFFER_SIZE, source_desc->buffer.length)); ACPI_ERROR((AE_INFO,
"SMBus write requires Buffer of length %X, found length %X",
ACPI_SMBUS_BUFFER_SIZE,
source_desc->buffer.length));
return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -94,10 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
/* We must have a valid region */ /* We must have a valid region */
if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) { if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Needed Region, found type %X (%s)",
"Needed Region, found type %X (%s)\n", ACPI_GET_OBJECT_TYPE(rgn_desc),
ACPI_GET_OBJECT_TYPE(rgn_desc), acpi_ut_get_object_type_name(rgn_desc)));
acpi_ut_get_object_type_name(rgn_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -162,31 +161,28 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,
* than the region itself. For example, a region of length one * than the region itself. For example, a region of length one
* byte, and a field with Dword access specified. * byte, and a field with Dword access specified.
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"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)",
acpi_ut_get_node_name(obj_desc-> acpi_ut_get_node_name(obj_desc->
common_field. common_field.node),
node), obj_desc->common_field.access_byte_width,
obj_desc->common_field. acpi_ut_get_node_name(rgn_desc->region.
access_byte_width, node),
acpi_ut_get_node_name(rgn_desc-> rgn_desc->region.length));
region.node),
rgn_desc->region.length));
} }
/* /*
* Offset rounded up to next multiple of field width * Offset rounded up to next multiple of field width
* exceeds region length, indicate an error * exceeds region length, indicate an error
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)",
acpi_ut_get_node_name(obj_desc->common_field. acpi_ut_get_node_name(obj_desc->common_field.node),
node), obj_desc->common_field.base_byte_offset,
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, acpi_ut_get_node_name(rgn_desc->region.node),
acpi_ut_get_node_name(rgn_desc->region.node), rgn_desc->region.length));
rgn_desc->region.length));
return_ACPI_STATUS(AE_AML_REGION_LIMIT); return_ACPI_STATUS(AE_AML_REGION_LIMIT);
} }
@ -270,18 +266,17 @@ acpi_ex_access_region(union acpi_operand_object *obj_desc,
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_NOT_IMPLEMENTED) { if (status == AE_NOT_IMPLEMENTED) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Region %s(%X) not implemented\n", "Region %s(%X) not implemented",
acpi_ut_get_region_name(rgn_desc-> acpi_ut_get_region_name(rgn_desc->region.
region. space_id),
space_id), rgn_desc->region.space_id));
rgn_desc->region.space_id));
} else if (status == AE_NOT_EXIST) { } else if (status == AE_NOT_EXIST) {
ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n", ACPI_ERROR((AE_INFO,
acpi_ut_get_region_name(rgn_desc-> "Region %s(%X) has no handler",
region. acpi_ut_get_region_name(rgn_desc->region.
space_id), space_id),
rgn_desc->region.space_id)); rgn_desc->region.space_id));
} }
} }
@ -514,8 +509,8 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
default: default:
ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n", ACPI_ERROR((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE(obj_desc))); ACPI_GET_OBJECT_TYPE(obj_desc)));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -618,11 +613,11 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"write_with_update_rule: Unknown update_rule setting: %X\n", "Unknown update_rule value: %X",
(obj_desc->common_field. (obj_desc->common_field.
field_flags & field_flags &
AML_FIELD_UPDATE_RULE_MASK))); AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE); return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
} }
} }
@ -677,10 +672,9 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
if (buffer_length < if (buffer_length <
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Field size %X (bits) is too large for buffer (%X)\n", "Field size %X (bits) is too large for buffer (%X)",
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length, buffer_length));
buffer_length));
return_ACPI_STATUS(AE_BUFFER_OVERFLOW); return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
} }
@ -792,10 +786,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
if (buffer_length < if (buffer_length <
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) { ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Field size %X (bits) is too large for buffer (%X)\n", "Field size %X (bits) is too large for buffer (%X)",
obj_desc->common_field.bit_length, obj_desc->common_field.bit_length, buffer_length));
buffer_length));
return_ACPI_STATUS(AE_BUFFER_OVERFLOW); return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -45,6 +45,7 @@
#include <acpi/acpi.h> #include <acpi/acpi.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/amlresrc.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exmisc") ACPI_MODULE_NAME("exmisc")
@ -97,7 +98,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
default: default:
ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode)); ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X",
obj_desc->reference.opcode));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
break; break;
@ -112,7 +114,8 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
default: default:
ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc))); ACPI_ERROR((AE_INFO, "Invalid descriptor type %X",
ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
return_ACPI_STATUS(AE_TYPE); return_ACPI_STATUS(AE_TYPE);
} }
@ -157,48 +160,65 @@ acpi_ex_concat_template(union acpi_operand_object *operand0,
union acpi_operand_object **actual_return_desc, union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state) struct acpi_walk_state *walk_state)
{ {
acpi_status status;
union acpi_operand_object *return_desc; union acpi_operand_object *return_desc;
u8 *new_buf; u8 *new_buf;
u8 *end_tag1; u8 *end_tag;
u8 *end_tag2; acpi_size length0;
acpi_size length1; acpi_size length1;
acpi_size length2; acpi_size new_length;
ACPI_FUNCTION_TRACE("ex_concat_template"); ACPI_FUNCTION_TRACE("ex_concat_template");
/* Find the end_tags in each resource template */ /*
* Find the end_tag descriptor in each resource template.
* Note1: returned pointers point TO the end_tag, not past it.
* Note2: zero-length buffers are allowed; treated like one end_tag
*/
end_tag1 = acpi_ut_get_resource_end_tag(operand0); /* Get the length of the first resource template */
end_tag2 = acpi_ut_get_resource_end_tag(operand1);
if (!end_tag1 || !end_tag2) { status = acpi_ut_get_resource_end_tag(operand0, &end_tag);
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
} }
/* Compute the length of each part */ length0 = ACPI_PTR_DIFF(end_tag, operand0->buffer.pointer);
length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer); /* Get the length of the second resource template */
length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */
/* Create a new buffer object for the result */ status = acpi_ut_get_resource_end_tag(operand1, &end_tag);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
return_desc = acpi_ut_create_buffer_object(length1 + length2); length1 = ACPI_PTR_DIFF(end_tag, operand1->buffer.pointer);
/* Combine both lengths, minimum size will be 2 for end_tag */
new_length = length0 + length1 + sizeof(struct aml_resource_end_tag);
/* Create a new buffer object for the result (with one end_tag) */
return_desc = acpi_ut_create_buffer_object(new_length);
if (!return_desc) { if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY); return_ACPI_STATUS(AE_NO_MEMORY);
} }
/* Copy the templates to the new descriptor */ /*
* Copy the templates to the new buffer, 0 first, then 1 follows. One
* end_tag descriptor is copied from Operand1.
*/
new_buf = return_desc->buffer.pointer; new_buf = return_desc->buffer.pointer;
ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1); ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length0);
ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2); ACPI_MEMCPY(new_buf + length0, operand1->buffer.pointer, length1);
/* Compute the new checksum */ /* Insert end_tag and set the checksum to zero, means "ignore checksum" */
new_buf[return_desc->buffer.length - 1] = new_buf[new_length - 1] = 0;
acpi_ut_generate_checksum(return_desc->buffer.pointer, new_buf[new_length - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
(return_desc->buffer.length - 1));
/* Return the completed template descriptor */ /* Return the completed resource template */
*actual_return_desc = return_desc; *actual_return_desc = return_desc;
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
@ -229,7 +249,6 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
union acpi_operand_object *return_desc; union acpi_operand_object *return_desc;
char *new_buf; char *new_buf;
acpi_status status; acpi_status status;
acpi_size new_length;
ACPI_FUNCTION_TRACE("ex_do_concatenate"); ACPI_FUNCTION_TRACE("ex_do_concatenate");
@ -256,8 +275,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
break; break;
default: default:
ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n", ACPI_ERROR((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE(operand0))); ACPI_GET_OBJECT_TYPE(operand0)));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
} }
@ -296,8 +315,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Copy the first integer, LSB first */ /* Copy the first integer, LSB first */
ACPI_MEMCPY(new_buf, ACPI_MEMCPY(new_buf, &operand0->integer.value,
&operand0->integer.value,
acpi_gbl_integer_byte_width); acpi_gbl_integer_byte_width);
/* Copy the second integer (LSB first) after the first */ /* Copy the second integer (LSB first) after the first */
@ -311,14 +329,11 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Result of two Strings is a String */ /* Result of two Strings is a String */
new_length = (acpi_size) operand0->string.length + return_desc = acpi_ut_create_string_object((acpi_size)
(acpi_size) local_operand1->string.length; (operand0->string.
if (new_length > ACPI_MAX_STRING_CONVERSION) { length +
status = AE_AML_STRING_LIMIT; local_operand1->
goto cleanup; string.length));
}
return_desc = acpi_ut_create_string_object(new_length);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
@ -338,11 +353,10 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Result of two Buffers is a Buffer */ /* Result of two Buffers is a Buffer */
return_desc = acpi_ut_create_buffer_object((acpi_size) return_desc = acpi_ut_create_buffer_object((acpi_size)
operand0->buffer. (operand0->buffer.
length + length +
(acpi_size) local_operand1->
local_operand1-> buffer.length));
buffer.length);
if (!return_desc) { if (!return_desc) {
status = AE_NO_MEMORY; status = AE_NO_MEMORY;
goto cleanup; goto cleanup;
@ -352,8 +366,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Concatenate the buffers */ /* Concatenate the buffers */
ACPI_MEMCPY(new_buf, ACPI_MEMCPY(new_buf, operand0->buffer.pointer,
operand0->buffer.pointer, operand0->buffer.length); operand0->buffer.length);
ACPI_MEMCPY(new_buf + operand0->buffer.length, ACPI_MEMCPY(new_buf + operand0->buffer.length,
local_operand1->buffer.pointer, local_operand1->buffer.pointer,
local_operand1->buffer.length); local_operand1->buffer.length);
@ -363,8 +377,8 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0,
/* Invalid object type, should not happen here */ /* Invalid object type, should not happen here */
ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n", ACPI_ERROR((AE_INFO, "Invalid object type: %X",
ACPI_GET_OBJECT_TYPE(operand0))); ACPI_GET_OBJECT_TYPE(operand0)));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
goto cleanup; goto cleanup;
} }
@ -625,9 +639,8 @@ acpi_ex_do_logical_op(u16 opcode,
/* Lexicographic compare: compare the data bytes */ /* Lexicographic compare: compare the data bytes */
compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer, compare = ACPI_MEMCMP(operand0->buffer.pointer,
(const char *)local_operand1->buffer. local_operand1->buffer.pointer,
pointer,
(length0 > length1) ? length1 : length0); (length0 > length1) ? length1 : length0);
switch (opcode) { switch (opcode) {

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -153,7 +153,9 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
/* Sanity check -- we must have a valid thread ID */ /* Sanity check -- we must have a valid thread ID */
if (!walk_state->thread) { if (!walk_state->thread) {
ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); ACPI_ERROR((AE_INFO,
"Cannot acquire Mutex [%4.4s], null thread info",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -162,7 +164,9 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
* 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_ut_get_node_name(obj_desc->mutex.node))); ACPI_ERROR((AE_INFO,
"Cannot acquire Mutex [%4.4s], incorrect sync_level",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_MUTEX_ORDER); return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
} }
@ -237,14 +241,18 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
/* The mutex must have been previously acquired in order to release it */ /* The mutex must have been previously acquired in order to release it */
if (!obj_desc->mutex.owner_thread) { if (!obj_desc->mutex.owner_thread) {
ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node))); ACPI_ERROR((AE_INFO,
"Cannot release Mutex [%4.4s], not acquired",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED); return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
} }
/* Sanity check -- we must have a valid thread ID */ /* Sanity check -- we must have a valid thread ID */
if (!walk_state->thread) { if (!walk_state->thread) {
ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node))); ACPI_ERROR((AE_INFO,
"Cannot release Mutex [%4.4s], null thread info",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -255,7 +263,11 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
if ((obj_desc->mutex.owner_thread->thread_id != if ((obj_desc->mutex.owner_thread->thread_id !=
walk_state->thread->thread_id) walk_state->thread->thread_id)
&& (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) { && (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
ACPI_REPORT_ERROR(("Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n", walk_state->thread->thread_id, acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.owner_thread->thread_id)); ACPI_ERROR((AE_INFO,
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
walk_state->thread->thread_id,
acpi_ut_get_node_name(obj_desc->mutex.node),
obj_desc->mutex.owner_thread->thread_id));
return_ACPI_STATUS(AE_AML_NOT_OWNER); return_ACPI_STATUS(AE_AML_NOT_OWNER);
} }
@ -264,7 +276,9 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
* 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_ut_get_node_name(obj_desc->mutex.node))); ACPI_ERROR((AE_INFO,
"Cannot release Mutex [%4.4s], incorrect sync_level",
acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_MUTEX_ORDER); return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -99,7 +99,8 @@ static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
*/ */
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_ERROR((AE_INFO,
"Could not allocate size %d", size_needed));
return_PTR(NULL); return_PTR(NULL);
} }
@ -167,8 +168,7 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
char_buf[0] = *aml_address; char_buf[0] = *aml_address;
if ('0' <= char_buf[0] && char_buf[0] <= '9') { if ('0' <= char_buf[0] && char_buf[0] <= '9') {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n", ACPI_ERROR((AE_INFO, "Invalid leading digit: %c", char_buf[0]));
char_buf[0]));
return_ACPI_STATUS(AE_CTRL_PENDING); return_ACPI_STATUS(AE_CTRL_PENDING);
} }
@ -191,10 +191,10 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
if (name_string) { if (name_string) {
ACPI_STRCAT(name_string, char_buf); ACPI_STRCAT(name_string, char_buf);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Appended to - %s \n", name_string)); "Appended to - %s\n", name_string));
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"No Name string - %s \n", char_buf)); "No Name string - %s\n", char_buf));
} }
} else if (index == 0) { } else if (index == 0) {
/* /*
@ -211,12 +211,12 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
* the required 4 * the required 4
*/ */
status = AE_AML_BAD_NAME; status = AE_AML_BAD_NAME;
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Bad character %02x in name, at %p\n", "Bad character %02x in name, at %p",
*aml_address, aml_address)); *aml_address, aml_address));
} }
*in_aml_address = (u8 *) aml_address; *in_aml_address = ACPI_CAST_PTR(u8, aml_address);
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -412,8 +412,7 @@ acpi_ex_get_name_string(acpi_object_type data_type,
if (AE_CTRL_PENDING == status && has_prefix) { if (AE_CTRL_PENDING == status && has_prefix) {
/* Ran out of segments after processing a prefix */ /* Ran out of segments after processing a prefix */
ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n", ACPI_ERROR((AE_INFO, "Malformed Name at %p", name_string));
name_string));
status = AE_AML_BAD_NAME; status = AE_AML_BAD_NAME;
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -111,7 +111,8 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
default: /* Unknown opcode */ default: /* Unknown opcode */
ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
break; break;
} }
@ -188,7 +189,8 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
default: /* Unknown opcode */ default: /* Unknown opcode */
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
break; break;
} }
@ -227,7 +229,8 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
default: /* Unknown opcode */ default: /* Unknown opcode */
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
@ -346,9 +349,9 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
/* Check the range of the digit */ /* Check the range of the digit */
if (temp32 > 9) { if (temp32 > 9) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"BCD digit too large (not decimal): 0x%X\n", "BCD digit too large (not decimal): 0x%X",
temp32)); temp32));
status = AE_AML_NUMERIC_OVERFLOW; status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup; goto cleanup;
@ -393,12 +396,10 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
/* Overflow if there is any data left in Digit */ /* Overflow if there is any data left in Digit */
if (digit > 0) { if (digit > 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Integer too large to convert to BCD: %8.8X%8.8X\n", "Integer too large to convert to BCD: %8.8X%8.8X",
ACPI_FORMAT_UINT64(operand ACPI_FORMAT_UINT64(operand[0]->
[0]-> integer.value)));
integer.
value)));
status = AE_AML_NUMERIC_OVERFLOW; status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup; goto cleanup;
} }
@ -525,15 +526,16 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
/* These are two obsolete opcodes */ /* These are two obsolete opcodes */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"%s is obsolete and not implemented\n", "%s is obsolete and not implemented",
acpi_ps_get_opcode_name(walk_state->opcode))); acpi_ps_get_opcode_name(walk_state->opcode)));
status = AE_SUPPORT; status = AE_SUPPORT;
goto cleanup; goto cleanup;
default: /* Unknown opcode */ default: /* Unknown opcode */
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
@ -639,11 +641,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc, acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc,
walk_state); walk_state);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"%s: bad operand(s) %s\n", "While resolving operands for [%s]",
acpi_ps_get_opcode_name(walk_state-> acpi_ps_get_opcode_name(walk_state->
opcode), opcode)));
acpi_format_exception(status)));
goto cleanup; goto cleanup;
} }
@ -742,9 +743,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"size_of - Operand is not Buf/Int/Str/Pkg - found type %s\n", "Operand is not Buf/Int/Str/Pkg - found type %s",
acpi_ut_get_type_name(type))); acpi_ut_get_type_name(type)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
@ -941,11 +942,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unknown Index target_type %X in obj %p\n", "Unknown Index target_type %X in obj %p",
operand[0]->reference. operand[0]->reference.
target_type, target_type, operand[0]));
operand[0]));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
goto cleanup; goto cleanup;
} }
@ -971,11 +971,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unknown opcode in ref(%p) - %X\n", "Unknown opcode in ref(%p) - %X",
operand[0], operand[0],
operand[0]->reference. operand[0]->reference.opcode));
opcode));
status = AE_TYPE; status = AE_TYPE;
goto cleanup; goto cleanup;
@ -985,7 +984,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -111,9 +111,9 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
/* Are 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_ERROR((AE_INFO,
"Unexpected notify object type [%s]\n", "Unexpected notify object type [%s]",
acpi_ut_get_type_name(node->type))); acpi_ut_get_type_name(node->type)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
@ -157,7 +157,8 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
} }
@ -221,7 +222,8 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
@ -344,10 +346,6 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
(length < operand[1]->integer.value) && (length < operand[1]->integer.value) &&
(operand[0]->buffer.pointer[length])) { (operand[0]->buffer.pointer[length])) {
length++; length++;
if (length > ACPI_MAX_STRING_CONVERSION) {
status = AE_AML_STRING_LIMIT;
goto cleanup;
}
} }
/* Allocate a new string object */ /* Allocate a new string object */
@ -358,8 +356,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
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;
@ -391,10 +391,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
/* 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_ERROR((AE_INFO,
"Index value (%X%8.8X) beyond package end (%X)\n", "Index value (%X%8.8X) beyond package end (%X)",
ACPI_FORMAT_UINT64(index), ACPI_FORMAT_UINT64(index),
operand[0]->package.count)); operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
} }
@ -407,10 +407,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
/* 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_ERROR((AE_INFO,
"Index value (%X%8.8X) beyond end of buffer (%X)\n", "Index value (%X%8.8X) beyond end of buffer (%X)",
ACPI_FORMAT_UINT64(index), ACPI_FORMAT_UINT64(index),
operand[0]->buffer.length)); operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT; status = AE_AML_BUFFER_LIMIT;
goto cleanup; goto cleanup;
} }
@ -442,7 +442,8 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
break; break;
} }
@ -546,7 +547,8 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -119,7 +119,8 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }
@ -223,8 +224,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
goto cleanup; goto cleanup;
} }
if (length > 0) { if (buffer) {
/* Copy the portion requested */ /* We have a buffer, copy the portion requested */
ACPI_MEMCPY(buffer, operand[0]->string.pointer + index, ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
length); length);
@ -242,7 +243,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -234,8 +234,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) || if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
(operand[3]->integer.value > MAX_MATCH_OPERATOR)) { (operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Match operator out of range"));
"Match operator out of range\n"));
status = AE_AML_OPERAND_VALUE; status = AE_AML_OPERAND_VALUE;
goto cleanup; goto cleanup;
} }
@ -244,10 +243,10 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
index = operand[5]->integer.value; index = operand[5]->integer.value;
if (index >= operand[0]->package.count) { if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Index (%X%8.8X) beyond package end (%X)\n", "Index (%X%8.8X) beyond package end (%X)",
ACPI_FORMAT_UINT64(index), ACPI_FORMAT_UINT64(index),
operand[0]->package.count)); operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT; status = AE_AML_PACKAGE_LIMIT;
goto cleanup; goto cleanup;
} }
@ -316,7 +315,8 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
default: default:
ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X",
walk_state->opcode));
status = AE_AML_BAD_OPCODE; status = AE_AML_BAD_OPCODE;
goto cleanup; goto cleanup;
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -274,9 +274,8 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
default: default:
/* Invalid field access type */ /* Invalid field access type */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Unknown field access type %X", access));
"Unknown field access type %X\n", access)); return_UINT32(0);
return_VALUE(0);
} }
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) { if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
@ -289,7 +288,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
} }
*return_byte_alignment = byte_alignment; *return_byte_alignment = byte_alignment;
return_VALUE(bit_length); return_UINT32(bit_length);
} }
/******************************************************************************* /*******************************************************************************
@ -422,15 +421,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) { if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
if (!info->region_node) { if (!info->region_node) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n")); ACPI_ERROR((AE_INFO, "Null region_node"));
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
type = acpi_ns_get_type(info->region_node); type = acpi_ns_get_type(info->region_node);
if (type != ACPI_TYPE_REGION) { if (type != ACPI_TYPE_REGION) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed Region, found type %X (%s)\n", "Needed Region, found type %X (%s)",
type, acpi_ut_get_type_name(type))); type, acpi_ut_get_type_name(type)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -499,17 +498,17 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
case ACPI_TYPE_LOCAL_INDEX_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD:
/* Get the Index and Data registers */
obj_desc->index_field.index_obj = obj_desc->index_field.index_obj =
acpi_ns_get_attached_object(info->register_node); acpi_ns_get_attached_object(info->register_node);
obj_desc->index_field.data_obj = obj_desc->index_field.data_obj =
acpi_ns_get_attached_object(info->data_register_node); acpi_ns_get_attached_object(info->data_register_node);
obj_desc->index_field.value = (u32)
(info->field_bit_position /
ACPI_MUL_8(obj_desc->field.access_byte_width));
if (!obj_desc->index_field.data_obj if (!obj_desc->index_field.data_obj
|| !obj_desc->index_field.index_obj) { || !obj_desc->index_field.index_obj) {
ACPI_REPORT_ERROR(("Null Index Object during field prep\n")); ACPI_ERROR((AE_INFO,
"Null Index Object during field prep"));
acpi_ut_delete_object_desc(obj_desc); acpi_ut_delete_object_desc(obj_desc);
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -519,6 +518,15 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
acpi_ut_add_reference(obj_desc->index_field.data_obj); acpi_ut_add_reference(obj_desc->index_field.data_obj);
acpi_ut_add_reference(obj_desc->index_field.index_obj); acpi_ut_add_reference(obj_desc->index_field.index_obj);
/*
* The value written to the Index register is the byte offset of the
* target field
* Note: may change code to: ACPI_DIV_8 (Info->field_bit_position)
*/
obj_desc->index_field.value = (u32)
(info->field_bit_position /
ACPI_MUL_8(obj_desc->field.access_byte_width));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", "index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.start_field_bit_offset,

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -77,7 +77,7 @@ acpi_ex_system_memory_space_handler(u32 function,
struct acpi_mem_space_context *mem_info = region_context; struct acpi_mem_space_context *mem_info = region_context;
u32 length; u32 length;
acpi_size window_size; acpi_size window_size;
#ifndef ACPI_MISALIGNED_TRANSFERS #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
u32 remainder; u32 remainder;
#endif #endif
@ -103,13 +103,12 @@ acpi_ex_system_memory_space_handler(u32 function,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Invalid system_memory width %d",
"Invalid system_memory width %d\n", bit_width));
bit_width));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE); return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
} }
#ifndef ACPI_MISALIGNED_TRANSFERS #ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
/* /*
* Hardware does not support non-aligned data transfers, we must verify * Hardware does not support non-aligned data transfers, we must verify
* the request. * the request.
@ -159,10 +158,10 @@ acpi_ex_system_memory_space_handler(u32 function,
(void **)&mem_info-> (void **)&mem_info->
mapped_logical_address); mapped_logical_address);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not map memory at %8.8X%8.8X, size %X\n", "Could not map memory at %8.8X%8.8X, size %X",
ACPI_FORMAT_UINT64(address), ACPI_FORMAT_UINT64(address),
(u32) window_size)); (u32) window_size));
mem_info->mapped_length = 0; mem_info->mapped_length = 0;
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -199,20 +198,20 @@ acpi_ex_system_memory_space_handler(u32 function,
*value = 0; *value = 0;
switch (bit_width) { switch (bit_width) {
case 8: case 8:
*value = (acpi_integer) * ((u8 *) logical_addr_ptr); *value = (acpi_integer) ACPI_GET8(logical_addr_ptr);
break; break;
case 16: case 16:
*value = (acpi_integer) * ((u16 *) logical_addr_ptr); *value = (acpi_integer) ACPI_GET16(logical_addr_ptr);
break; break;
case 32: case 32:
*value = (acpi_integer) * ((u32 *) logical_addr_ptr); *value = (acpi_integer) ACPI_GET32(logical_addr_ptr);
break; break;
#if ACPI_MACHINE_WIDTH != 16 #if ACPI_MACHINE_WIDTH != 16
case 64: case 64:
*value = (acpi_integer) * ((u64 *) logical_addr_ptr); *value = (acpi_integer) ACPI_GET64(logical_addr_ptr);
break; break;
#endif #endif
default: default:
@ -225,20 +224,20 @@ acpi_ex_system_memory_space_handler(u32 function,
switch (bit_width) { switch (bit_width) {
case 8: case 8:
*(u8 *) logical_addr_ptr = (u8) * value; ACPI_SET8(logical_addr_ptr) = (u8) * value;
break; break;
case 16: case 16:
*(u16 *) logical_addr_ptr = (u16) * value; ACPI_SET16(logical_addr_ptr) = (u16) * value;
break; break;
case 32: case 32:
*(u32 *) logical_addr_ptr = (u32) * value; ACPI_SET32(logical_addr_ptr) = (u32) * value;
break; break;
#if ACPI_MACHINE_WIDTH != 16 #if ACPI_MACHINE_WIDTH != 16
case 64: case 64:
*(u64 *) logical_addr_ptr = (u64) * value; ACPI_SET64(logical_addr_ptr) = (u64) * value;
break; break;
#endif #endif

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -122,8 +122,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
} }
if (!source_desc) { if (!source_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "No object attached to node %p", node));
"No object attached to node %p\n", node));
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
@ -135,10 +134,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_PACKAGE: case ACPI_TYPE_PACKAGE:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) { if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Object not a Package, type %s",
"Object not a Package, 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);
} }
@ -154,10 +151,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_BUFFER: case ACPI_TYPE_BUFFER:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) { if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Object not a Buffer, type %s",
"Object not a Buffer, 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);
} }
@ -173,10 +168,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_STRING: case ACPI_TYPE_STRING:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) { if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Object not a String, type %s",
"Object not a String, 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);
} }
@ -189,10 +182,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_INTEGER: case ACPI_TYPE_INTEGER:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) { if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Object not a Integer, type %s",
"Object not a Integer, 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);
} }
@ -236,9 +227,8 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
case ACPI_TYPE_ANY: case ACPI_TYPE_ANY:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Untyped entry %p, no attached object!\n", "Untyped entry %p, no attached object!", node));
node));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
@ -257,12 +247,11 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
default: default:
/* No named references are allowed here */ /* No named references are allowed here */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unsupported Reference opcode %X (%s)\n", "Unsupported Reference opcode %X (%s)",
source_desc->reference.opcode, source_desc->reference.opcode,
acpi_ps_get_opcode_name(source_desc-> acpi_ps_get_opcode_name(source_desc->
reference. reference.opcode)));
opcode)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -272,9 +261,9 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
/* Default case is for unknown types */ /* Default case is for unknown types */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Node %p - Unknown object type %X\n", "Node %p - Unknown object type %X",
node, entry_type)); node, entry_type));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -81,7 +81,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr); ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
if (!stack_ptr || !*stack_ptr) { if (!stack_ptr || !*stack_ptr) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n")); ACPI_ERROR((AE_INFO, "Internal - null pointer"));
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
@ -97,8 +97,7 @@ acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
} }
if (!*stack_ptr) { if (!*stack_ptr) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Internal - null pointer"));
"Internal - null pointer\n"));
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
} }
@ -228,9 +227,9 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
* A NULL object descriptor means an unitialized element of * A NULL object descriptor means an unitialized element of
* the package, can't dereference it * the package, can't dereference it
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Attempt to deref an Index to NULL pkg element Idx=%p\n", "Attempt to deref an Index to NULL pkg element Idx=%p",
stack_desc)); stack_desc));
status = AE_AML_UNINITIALIZED_ELEMENT; status = AE_AML_UNINITIALIZED_ELEMENT;
} }
break; break;
@ -239,7 +238,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
/* Invalid reference object */ /* Invalid reference object */
ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc)); ACPI_ERROR((AE_INFO,
"Unknown target_type %X in Index/Reference obj %p",
stack_desc->reference.target_type,
stack_desc));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -264,7 +266,10 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
default: default:
ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc)); ACPI_ERROR((AE_INFO,
"Unknown Reference opcode %X (%s) in %p",
opcode, acpi_ps_get_opcode_name(opcode),
stack_desc));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
} }
@ -386,7 +391,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
if (ACPI_GET_DESCRIPTOR_TYPE(node) != if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
ACPI_DESC_TYPE_NAMED) { ACPI_DESC_TYPE_NAMED) {
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
node,
acpi_ut_get_descriptor_name(node)));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -442,7 +449,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
if (ACPI_GET_DESCRIPTOR_TYPE(node) != if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
ACPI_DESC_TYPE_NAMED) { ACPI_DESC_TYPE_NAMED) {
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node))); ACPI_ERROR((AE_INFO, "Not a NS node %p [%s]",
node,
acpi_ut_get_descriptor_name(node)));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -511,7 +520,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
default: default:
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode)); ACPI_ERROR((AE_INFO,
"Unknown Reference subtype %X",
obj_desc->reference.opcode));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -46,6 +46,7 @@
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/acparser.h> #include <acpi/acparser.h>
#include <acpi/acinterp.h> #include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_EXECUTER #define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exresop") ACPI_MODULE_NAME("exresop")
@ -73,7 +74,7 @@ static acpi_status
acpi_ex_check_object_type(acpi_object_type type_needed, acpi_ex_check_object_type(acpi_object_type type_needed,
acpi_object_type this_type, void *object) acpi_object_type this_type, void *object)
{ {
ACPI_FUNCTION_NAME("ex_check_object_type"); ACPI_FUNCTION_ENTRY();
if (type_needed == ACPI_TYPE_ANY) { if (type_needed == ACPI_TYPE_ANY) {
/* All types OK, so we don't perform any typechecks */ /* All types OK, so we don't perform any typechecks */
@ -95,10 +96,10 @@ acpi_ex_check_object_type(acpi_object_type type_needed,
} }
if (type_needed != this_type) { if (type_needed != this_type) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [%s], found [%s] %p\n", "Needed type [%s], found [%s] %p",
acpi_ut_get_type_name(type_needed), acpi_ut_get_type_name(type_needed),
acpi_ut_get_type_name(this_type), object)); acpi_ut_get_type_name(this_type), object));
return (AE_AML_OPERAND_TYPE); return (AE_AML_OPERAND_TYPE);
} }
@ -151,13 +152,13 @@ acpi_ex_resolve_operands(u16 opcode,
arg_types = op_info->runtime_args; arg_types = op_info->runtime_args;
if (arg_types == ARGI_INVALID_OPCODE) { if (arg_types == ARGI_INVALID_OPCODE) {
ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", opcode));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Opcode %X [%s] required_operand_types=%8.8X \n", "Opcode %X [%s] required_operand_types=%8.8X\n",
opcode, op_info->name, arg_types)); opcode, op_info->name, arg_types));
/* /*
@ -169,7 +170,8 @@ acpi_ex_resolve_operands(u16 opcode,
*/ */
while (GET_CURRENT_ARG_TYPE(arg_types)) { while (GET_CURRENT_ARG_TYPE(arg_types)) {
if (!stack_ptr || !*stack_ptr) { if (!stack_ptr || !*stack_ptr) {
ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); ACPI_ERROR((AE_INFO, "Null stack entry at %p",
stack_ptr));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -187,6 +189,22 @@ acpi_ex_resolve_operands(u16 opcode,
object_type = object_type =
((struct acpi_namespace_node *)obj_desc)->type; ((struct acpi_namespace_node *)obj_desc)->type;
/*
* Resolve an alias object. The construction of these objects
* guarantees that there is only one level of alias indirection;
* thus, the attached object is always the aliased namespace node
*/
if (object_type == ACPI_TYPE_LOCAL_ALIAS) {
obj_desc =
acpi_ns_get_attached_object((struct
acpi_namespace_node
*)obj_desc);
*stack_ptr = obj_desc;
object_type =
((struct acpi_namespace_node *)obj_desc)->
type;
}
break; break;
case ACPI_DESC_TYPE_OPERAND: case ACPI_DESC_TYPE_OPERAND:
@ -198,9 +216,9 @@ acpi_ex_resolve_operands(u16 opcode,
/* 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, ACPI_ERROR((AE_INFO,
"Bad operand object type [%X]\n", "Bad operand object type [%X]",
object_type)); object_type));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -238,13 +256,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Operand is a Reference, Unknown Reference Opcode %X [%s]\n", "Operand is a Reference, Unknown Reference Opcode: %X",
obj_desc->reference. obj_desc->reference.
opcode, opcode));
(acpi_ps_get_opcode_info
(obj_desc->reference.
opcode))->name));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -255,11 +270,10 @@ acpi_ex_resolve_operands(u16 opcode,
/* Invalid descriptor */ /* Invalid descriptor */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Invalid descriptor %p [%s]\n", "Invalid descriptor %p [%s]",
obj_desc, obj_desc,
acpi_ut_get_descriptor_name acpi_ut_get_descriptor_name(obj_desc)));
(obj_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -417,11 +431,10 @@ acpi_ex_resolve_operands(u16 opcode,
acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), (obj_desc), obj_desc));
obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -444,11 +457,10 @@ acpi_ex_resolve_operands(u16 opcode,
status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), (obj_desc), obj_desc));
obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -472,11 +484,10 @@ acpi_ex_resolve_operands(u16 opcode,
ACPI_IMPLICIT_CONVERT_HEX); ACPI_IMPLICIT_CONVERT_HEX);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (status == AE_TYPE) { if (status == AE_TYPE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), (obj_desc), obj_desc));
obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -502,10 +513,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), obj_desc)); (obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -539,10 +550,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Integer/String/Buffer], found [%s] %p\n", "Needed [Integer/String/Buffer], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), obj_desc)); (obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -566,10 +577,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Buffer/String/Package/Reference], found [%s] %p\n", "Needed [Buffer/String/Package/Reference], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), obj_desc)); (obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -588,10 +599,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Buffer/String/Package], found [%s] %p\n", "Needed [Buffer/String/Package], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), obj_desc)); (obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -611,10 +622,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed [Region/region_field], found [%s] %p\n", "Needed [Region/region_field], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), obj_desc)); (obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -656,10 +667,10 @@ acpi_ex_resolve_operands(u16 opcode,
break; break;
} }
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name
(obj_desc), obj_desc)); (obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -669,9 +680,9 @@ acpi_ex_resolve_operands(u16 opcode,
/* Unknown type */ /* Unknown type */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Internal - Unknown ARGI (required operand) type %X\n", "Internal - Unknown ARGI (required operand) type %X",
this_arg_type)); this_arg_type));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -250,7 +250,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
/* Validate parameters */ /* Validate parameters */
if (!source_desc || !dest_desc) { if (!source_desc || !dest_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n")); ACPI_ERROR((AE_INFO, "Null parameter"));
return_ACPI_STATUS(AE_AML_NO_OPERAND); return_ACPI_STATUS(AE_AML_NO_OPERAND);
} }
@ -290,10 +290,10 @@ acpi_ex_store(union acpi_operand_object *source_desc,
/* Destination is not a Reference object */ /* Destination is not a Reference object */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Target is not a Reference or Constant object - %s [%p]\n", "Target is not a Reference or Constant object - %s [%p]",
acpi_ut_get_object_type_name(dest_desc), acpi_ut_get_object_type_name(dest_desc),
dest_desc)); dest_desc));
ACPI_DUMP_STACK_ENTRY(source_desc); ACPI_DUMP_STACK_ENTRY(source_desc);
ACPI_DUMP_STACK_ENTRY(dest_desc); ACPI_DUMP_STACK_ENTRY(dest_desc);
@ -360,8 +360,8 @@ acpi_ex_store(union acpi_operand_object *source_desc,
default: default:
ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n", ACPI_ERROR((AE_INFO, "Unknown Reference opcode %X",
ref_desc->reference.opcode)); ref_desc->reference.opcode));
ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR); ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR);
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
@ -490,10 +490,9 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
/* All other types are invalid */ /* All other types are invalid */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Source must be Integer/Buffer/String type, not %s\n", "Source must be Integer/Buffer/String type, not %s",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name(source_desc)));
(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
} }
@ -503,8 +502,8 @@ acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Target is not a Package or buffer_field\n")); "Target is not a Package or buffer_field"));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
} }

View File

@ -7,7 +7,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -123,11 +123,10 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
&& (source_desc->reference.opcode == AML_LOAD_OP))) { && (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_ERROR((AE_INFO,
"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)",
acpi_ut_get_object_type_name acpi_ut_get_object_type_name(source_desc),
(source_desc), acpi_ut_get_type_name(target_type)));
acpi_ut_get_type_name(target_type)));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
break; break;
@ -135,9 +134,11 @@ acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
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 */ /*
* All aliases should have been resolved earlier, during the
ACPI_REPORT_ERROR(("Store into Alias - should never happen\n")); * operand resolution phase.
*/
ACPI_ERROR((AE_INFO, "Store into an unresolved Alias object"));
status = AE_AML_INTERNAL; status = AE_AML_INTERNAL;
break; break;
@ -280,9 +281,8 @@ acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
/* /*
* All other types come here. * All other types come here.
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_WARN, ACPI_WARNING((AE_INFO, "Store into type %s not implemented",
"Store into type %s not implemented\n", acpi_ut_get_object_type_name(dest_desc)));
acpi_ut_get_object_type_name(dest_desc)));
status = AE_NOT_IMPLEMENTED; status = AE_NOT_IMPLEMENTED;
break; break;

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -71,7 +71,7 @@ acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
/* We know that source_desc is a buffer by now */ /* We know that source_desc is a buffer by now */
buffer = (u8 *) source_desc->buffer.pointer; buffer = ACPI_CAST_PTR(u8, source_desc->buffer.pointer);
length = source_desc->buffer.length; length = source_desc->buffer.length;
/* /*
@ -160,7 +160,7 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
/* We know that source_desc is a string by now */ /* We know that source_desc is a string by now */
buffer = (u8 *) source_desc->string.pointer; buffer = ACPI_CAST_PTR(u8, source_desc->string.pointer);
length = source_desc->string.length; length = source_desc->string.length;
/* /*

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -129,8 +129,8 @@ acpi_status acpi_ex_system_do_stall(u32 how_long)
* (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", ACPI_ERROR((AE_INFO, "Time parameter is too large (%d)",
how_long)); how_long));
status = AE_AML_OPERAND_VALUE; status = AE_AML_OPERAND_VALUE;
} else { } else {
acpi_os_stall(how_long); acpi_os_stall(how_long);

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -91,7 +91,7 @@ acpi_status acpi_ex_enter_interpreter(void)
status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE); status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n")); ACPI_ERROR((AE_INFO, "Could not acquire interpreter mutex"));
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
@ -127,7 +127,7 @@ void acpi_ex_exit_interpreter(void)
status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE); status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not release interpreter mutex\n")); ACPI_ERROR((AE_INFO, "Could not release interpreter mutex"));
} }
return_VOID; return_VOID;
@ -200,13 +200,12 @@ u8 acpi_ex_acquire_global_lock(u32 field_flags)
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
locked = TRUE; locked = TRUE;
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"Could not acquire Global Lock, %s\n", "Could not acquire Global Lock"));
acpi_format_exception(status)));
} }
} }
return_VALUE(locked); return_UINT8(locked);
} }
/******************************************************************************* /*******************************************************************************
@ -237,7 +236,8 @@ void acpi_ex_release_global_lock(u8 locked_by_me)
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
/* Report the error, but there isn't much else we can do */ /* Report the error, but there isn't much else we can do */
ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status))); ACPI_EXCEPTION((AE_INFO, status,
"Could not release ACPI Global Lock"));
} }
} }
@ -268,7 +268,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */ /* acpi_integer is unsigned, so we don't worry about a '-' prefix */
if (value == 0) { if (value == 0) {
return_VALUE(1); return_UINT32(1);
} }
current_value = value; current_value = value;
@ -282,7 +282,7 @@ static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
num_digits++; num_digits++;
} }
return_VALUE(num_digits); return_UINT32(num_digits);
} }
/******************************************************************************* /*******************************************************************************

View File

@ -99,15 +99,15 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
unsigned long *busnr = (unsigned long *)data; unsigned long *busnr = (unsigned long *)data;
struct acpi_resource_address64 address; struct acpi_resource_address64 address;
if (resource->id != ACPI_RSTYPE_ADDRESS16 && if (resource->type != ACPI_RESOURCE_TYPE_ADDRESS16 &&
resource->id != ACPI_RSTYPE_ADDRESS32 && resource->type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
resource->id != ACPI_RSTYPE_ADDRESS64) resource->type != ACPI_RESOURCE_TYPE_ADDRESS64)
return AE_OK; return AE_OK;
acpi_resource_to_address64(resource, &address); acpi_resource_to_address64(resource, &address);
if ((address.address_length > 0) && if ((address.address_length > 0) &&
(address.resource_type == ACPI_BUS_NUMBER_RANGE)) (address.resource_type == ACPI_BUS_NUMBER_RANGE))
*busnr = address.min_address_range; *busnr = address.minimum;
return AE_OK; return AE_OK;
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -68,8 +68,7 @@ acpi_status acpi_hw_initialize(void)
/* 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, "No FADT is present\n")); ACPI_ERROR((AE_INFO, "No FADT is present"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES); return_ACPI_STATUS(AE_NO_ACPI_TABLES);
} }
@ -108,7 +107,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
* system does not support mode transition. * system does not support mode transition.
*/ */
if (!acpi_gbl_FADT->smi_cmd) { if (!acpi_gbl_FADT->smi_cmd) {
ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n")); ACPI_ERROR((AE_INFO,
"No SMI_CMD in FADT, mode transition failed"));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
} }
@ -120,7 +120,8 @@ acpi_status acpi_hw_set_mode(u32 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_ERROR((AE_INFO,
"No ACPI mode transition supported in this system (enable/disable both zero)"));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
@ -154,8 +155,8 @@ acpi_status acpi_hw_set_mode(u32 mode)
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not write mode change, %s\n", ACPI_EXCEPTION((AE_INFO, status,
acpi_format_exception(status))); "Could not write ACPI mode change"));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -175,7 +176,7 @@ acpi_status acpi_hw_set_mode(u32 mode)
retry--; retry--;
} }
ACPI_REPORT_ERROR(("Hardware never changed modes\n")); ACPI_ERROR((AE_INFO, "Hardware did not change modes"));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE); return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
} }
@ -204,18 +205,18 @@ u32 acpi_hw_get_mode(void)
* system does not support mode transition. * system does not support mode transition.
*/ */
if (!acpi_gbl_FADT->smi_cmd) { if (!acpi_gbl_FADT->smi_cmd) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} }
status = status =
acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK); acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
return_VALUE(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
if (value) { if (value) {
return_VALUE(ACPI_SYS_MODE_ACPI); return_UINT32(ACPI_SYS_MODE_ACPI);
} else { } else {
return_VALUE(ACPI_SYS_MODE_LEGACY); return_UINT32(ACPI_SYS_MODE_LEGACY);
} }
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -7,7 +7,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -144,7 +144,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
info.parameters = NULL; info.parameters = NULL;
info.return_object = NULL; info.return_object = NULL;
sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state]; sleep_state_name =
ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
status = acpi_ns_evaluate_by_name(sleep_state_name, &info); status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
@ -159,15 +160,16 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
/* Must have a return object */ /* Must have a return object */
if (!info.return_object) { if (!info.return_object) {
ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n", ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
sleep_state_name)); 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 return object is not a Package\n")); ACPI_ERROR((AE_INFO,
"Sleep State return object is not a Package"));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
} }
@ -179,7 +181,8 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
* one per sleep type (A/B). * 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 return package does not have at least two elements\n")); ACPI_ERROR((AE_INFO,
"Sleep State return package does not have at least two elements"));
status = AE_AML_NO_OPERAND; status = AE_AML_NO_OPERAND;
} }
@ -189,7 +192,12 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
!= ACPI_TYPE_INTEGER) || != ACPI_TYPE_INTEGER) ||
(ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1]) (ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
!= ACPI_TYPE_INTEGER)) { != 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[1]))); ACPI_ERROR((AE_INFO,
"Sleep State return package elements are not both Integers (%s, %s)",
acpi_ut_get_object_type_name(info.return_object->
package.elements[0]),
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 */
@ -201,12 +209,11 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n", "While evaluating sleep_state [%s], bad Sleep object %p type %s",
acpi_format_exception(status), sleep_state_name, info.return_object,
sleep_state_name, info.return_object, acpi_ut_get_object_type_name(info.
acpi_ut_get_object_type_name(info. return_object)));
return_object)));
} }
acpi_ut_remove_reference(info.return_object); acpi_ut_remove_reference(info.return_object);
@ -229,12 +236,11 @@ EXPORT_SYMBOL(acpi_get_sleep_type_data);
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id) struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
{ {
ACPI_FUNCTION_NAME("hw_get_bit_register_info"); ACPI_FUNCTION_ENTRY();
if (register_id > ACPI_BITREG_MAX) { if (register_id > ACPI_BITREG_MAX) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Invalid bit_register ID: %X",
"Invalid bit_register ID: %X\n", register_id));
register_id));
return (NULL); return (NULL);
} }
@ -334,8 +340,8 @@ acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
bit_reg_info = acpi_hw_get_bit_register_info(register_id); bit_reg_info = acpi_hw_get_bit_register_info(register_id);
if (!bit_reg_info) { if (!bit_reg_info) {
ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n", ACPI_ERROR((AE_INFO, "Bad ACPI HW register_id: %X",
register_id)); register_id));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
@ -569,8 +575,7 @@ acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n", ACPI_ERROR((AE_INFO, "Unknown Register ID: %X", register_id));
register_id));
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
break; break;
} }
@ -765,9 +770,9 @@ acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unsupported address space: %X\n", "Unsupported address space: %X",
reg->address_space_id)); reg->address_space_id));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }
@ -836,9 +841,9 @@ acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
break; break;
default: default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Unsupported address space: %X\n", "Unsupported address space: %X",
reg->address_space_id)); reg->address_space_id));
return (AE_BAD_PARAMETER); return (AE_BAD_PARAMETER);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -199,8 +199,8 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
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_EXCEPTION((AE_INFO, status,
acpi_format_exception(status))); "While executing method _SST"));
} }
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
@ -232,9 +232,8 @@ acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) || if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
(acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) { (acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
ACPI_REPORT_ERROR(("Sleep values out of range: A=%X B=%X\n", ACPI_ERROR((AE_INFO, "Sleep values out of range: A=%X B=%X",
acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b));
acpi_gbl_sleep_type_b));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE); return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
} }
@ -533,21 +532,18 @@ acpi_status acpi_leave_sleep_state(u8 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_EXCEPTION((AE_INFO, status, "During Method _SST"));
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_EXCEPTION((AE_INFO, status, "During Method _BFS"));
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_EXCEPTION((AE_INFO, status, "During Method _WAK"));
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? */
@ -582,8 +578,7 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
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_EXCEPTION((AE_INFO, status, "During Method _SST"));
acpi_format_exception(status)));
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(status);

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -54,36 +54,36 @@ static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges"); ACPI_FUNCTION_TRACE("acpi_reserve_io_ranges");
if (res->id == ACPI_RSTYPE_IO) { if (res->type == ACPI_RESOURCE_TYPE_IO) {
struct acpi_resource_io *io_res = &res->data.io; struct acpi_resource_io *io_res = &res->data.io;
if (io_res->min_base_address != io_res->max_base_address) if (io_res->minimum != io_res->maximum)
return_VALUE(AE_OK); return_VALUE(AE_OK);
if (IS_RESERVED_ADDR if (IS_RESERVED_ADDR
(io_res->min_base_address, io_res->range_length)) { (io_res->minimum, io_res->address_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n", "Motherboard resources 0x%08x - 0x%08x\n",
io_res->min_base_address, io_res->minimum,
io_res->min_base_address + io_res->minimum +
io_res->range_length)); io_res->address_length));
requested_res = requested_res =
request_region(io_res->min_base_address, request_region(io_res->minimum,
io_res->range_length, "motherboard"); io_res->address_length, "motherboard");
} }
} else if (res->id == ACPI_RSTYPE_FIXED_IO) { } else if (res->type == ACPI_RESOURCE_TYPE_FIXED_IO) {
struct acpi_resource_fixed_io *fixed_io_res = struct acpi_resource_fixed_io *fixed_io_res =
&res->data.fixed_io; &res->data.fixed_io;
if (IS_RESERVED_ADDR if (IS_RESERVED_ADDR
(fixed_io_res->base_address, fixed_io_res->range_length)) { (fixed_io_res->address, fixed_io_res->address_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n", "Motherboard resources 0x%08x - 0x%08x\n",
fixed_io_res->base_address, fixed_io_res->address,
fixed_io_res->base_address + fixed_io_res->address +
fixed_io_res->range_length)); fixed_io_res->address_length));
requested_res = requested_res =
request_region(fixed_io_res->base_address, request_region(fixed_io_res->address,
fixed_io_res->range_length, fixed_io_res->address_length,
"motherboard"); "motherboard");
} }
} else { } else {

View File

@ -5,7 +5,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -110,10 +110,9 @@ acpi_status acpi_ns_root_initialize(void)
ACPI_NS_NO_UPSEARCH, NULL, &new_node); ACPI_NS_NO_UPSEARCH, NULL, &new_node);
if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */ if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"Could not create predefined name %s, %s\n", "Could not create predefined name %s",
init_val->name, init_val->name));
acpi_format_exception(status)));
} }
/* /*
@ -124,9 +123,9 @@ acpi_status acpi_ns_root_initialize(void)
if (init_val->val) { if (init_val->val) {
status = acpi_os_predefined_override(init_val, &val); status = acpi_os_predefined_override(init_val, &val);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not override predefined %s\n", "Could not override predefined %s",
init_val->name)); init_val->name));
} }
if (!val) { if (!val) {
@ -233,7 +232,9 @@ acpi_status acpi_ns_root_initialize(void)
default: default:
ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type)); ACPI_ERROR((AE_INFO,
"Unsupported initial type value %X",
init_val->type));
acpi_ut_remove_reference(obj_desc); acpi_ut_remove_reference(obj_desc);
obj_desc = NULL; obj_desc = NULL;
continue; continue;
@ -339,7 +340,9 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
prefix_node = scope_info->scope.node; prefix_node = scope_info->scope.node;
if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) != if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
ACPI_DESC_TYPE_NAMED) { ACPI_DESC_TYPE_NAMED) {
ACPI_REPORT_ERROR(("ns_lookup: %p is not a namespace node [%s]\n", prefix_node, acpi_ut_get_descriptor_name(prefix_node))); ACPI_ERROR((AE_INFO, "%p is not a namespace node [%s]",
prefix_node,
acpi_ut_get_descriptor_name(prefix_node)));
return_ACPI_STATUS(AE_AML_INTERNAL); return_ACPI_STATUS(AE_AML_INTERNAL);
} }
@ -429,7 +432,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
if (!this_node) { if (!this_node) {
/* Current scope has no parent scope */ /* Current scope has no parent scope */
ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n")); ACPI_ERROR((AE_INFO,
"ACPI path has too many parent prefixes (^) - reached beyond root node"));
return_ACPI_STATUS(AE_NOT_FOUND); return_ACPI_STATUS(AE_NOT_FOUND);
} }
} }
@ -498,7 +502,7 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
path++; path++;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Multi Pathname (%d Segments, Flags=%X) \n", "Multi Pathname (%d Segments, Flags=%X)\n",
num_segments, flags)); num_segments, flags));
break; break;
@ -600,7 +604,12 @@ acpi_ns_lookup(union acpi_generic_state *scope_info,
(this_node->type != type_to_check_for)) { (this_node->type != type_to_check_for)) {
/* Complain about a type mismatch */ /* Complain about a type mismatch */
ACPI_REPORT_WARNING(("ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)\n", (char *)&simple_name, acpi_ut_get_type_name(this_node->type), acpi_ut_get_type_name(type_to_check_for))); ACPI_WARNING((AE_INFO,
"ns_lookup: Type mismatch on %4.4s (%s), searching for (%s)",
ACPI_CAST_PTR(char, &simple_name),
acpi_ut_get_type_name(this_node->type),
acpi_ut_get_type_name
(type_to_check_for)));
} }
/* /*

View File

@ -5,7 +5,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -272,9 +272,8 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
/* Grandchildren should have all been deleted already */ /* Grandchildren should have all been deleted already */
if (child_node->child) { if (child_node->child) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "Found a grandchild! P=%p C=%p",
"Found a grandchild! P=%p C=%p\n", parent_node, child_node));
parent_node, child_node));
} }
/* Now we can free this child object */ /* Now we can free this child object */
@ -302,7 +301,9 @@ void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
/* 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", child_node->reference_count, child_node)); ACPI_WARNING((AE_INFO,
"Existing references (%d) on node being deleted (%p)",
child_node->reference_count, child_node));
} }
/* Now we can delete the node */ /* Now we can delete the node */

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -198,12 +198,13 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
/* Check the node type and name */ /* Check the node type and name */
if (type > ACPI_TYPE_LOCAL_MAX) { if (type > ACPI_TYPE_LOCAL_MAX) {
ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type)); ACPI_WARNING((AE_INFO, "Invalid ACPI Object Type %08X",
type));
} }
if (!acpi_ut_valid_acpi_name(this_node->name.integer)) { if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n", ACPI_WARNING((AE_INFO, "Invalid ACPI Name %08X",
this_node->name.integer)); this_node->name.integer));
} }
acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
@ -212,7 +213,9 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
/* /*
* Now we can print out the pertinent information * Now we can print out the pertinent information
*/ */
acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node); acpi_os_printf(" %-12s %p %2.2X ",
acpi_ut_get_type_name(type), this_node,
this_node->owner_id);
dbg_level = acpi_dbg_level; dbg_level = acpi_dbg_level;
acpi_dbg_level = 0; acpi_dbg_level = 0;

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -6,7 +6,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -373,8 +373,7 @@ acpi_ns_execute_control_method(struct acpi_parameter_info *info)
info->obj_desc = acpi_ns_get_attached_object(info->node); info->obj_desc = acpi_ns_get_attached_object(info->node);
if (!info->obj_desc) { if (!info->obj_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO, "No attached method object"));
"No attached method object\n"));
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(AE_NULL_OBJECT); return_ACPI_STATUS(AE_NULL_OBJECT);

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -93,8 +93,7 @@ acpi_status acpi_ns_initialize_objects(void)
ACPI_UINT32_MAX, acpi_ns_init_one_object, ACPI_UINT32_MAX, acpi_ns_init_one_object,
&info, NULL); &info, NULL);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
acpi_format_exception(status)));
} }
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
@ -159,12 +158,11 @@ acpi_status acpi_ns_initialize_devices(void)
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n", ACPI_EXCEPTION((AE_INFO, status, "During walk_namespace"));
acpi_format_exception(status)));
} }
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
"\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", "\n%hd Devices found - executed %hd _STA, %hd _INI methods\n",
info.device_count, info.num_STA, info.num_INI)); info.device_count, info.num_STA, info.num_INI));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
@ -289,12 +287,10 @@ acpi_ns_init_one_object(acpi_handle obj_handle,
} }
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n")); ACPI_EXCEPTION((AE_INFO, status,
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Could not execute arguments for [%4.4s] (%s)",
"Could not execute arguments for [%4.4s] (%s), %s\n", acpi_ut_get_node_name(node),
acpi_ut_get_node_name(node), acpi_ut_get_type_name(type)));
acpi_ut_get_type_name(type),
acpi_format_exception(status)));
} }
/* /*
@ -336,23 +332,22 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
struct acpi_parameter_info pinfo; struct acpi_parameter_info pinfo;
u32 flags; u32 flags;
acpi_status status; acpi_status status;
struct acpi_namespace_node *ini_node;
struct acpi_namespace_node *device_node;
ACPI_FUNCTION_TRACE("ns_init_one_device"); ACPI_FUNCTION_TRACE("ns_init_one_device");
pinfo.parameters = NULL; device_node = acpi_ns_map_handle_to_node(obj_handle);
pinfo.parameter_type = ACPI_PARAM_ARGS; if (!device_node) {
pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
if (!pinfo.node) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* /*
* We will run _STA/_INI on Devices, Processors and thermal_zones only * We will run _STA/_INI on Devices, Processors and thermal_zones only
*/ */
if ((pinfo.node->type != ACPI_TYPE_DEVICE) && if ((device_node->type != ACPI_TYPE_DEVICE) &&
(pinfo.node->type != ACPI_TYPE_PROCESSOR) && (device_node->type != ACPI_TYPE_PROCESSOR) &&
(pinfo.node->type != ACPI_TYPE_THERMAL)) { (device_node->type != ACPI_TYPE_THERMAL)) {
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
@ -364,57 +359,69 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
info->device_count++; info->device_count++;
/* /*
* Run _STA to determine if we can run _INI on the device. * Check if the _INI method exists for this device -
* if _INI does not exist, there is no need to run _STA
* No _INI means device requires no initialization
*/ */
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, status = acpi_ns_search_node(*ACPI_CAST_PTR(u32, METHOD_NAME__INI),
pinfo.node, device_node, ACPI_TYPE_METHOD, &ini_node);
METHOD_NAME__STA));
status = acpi_ut_execute_STA(pinfo.node, &flags);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (pinfo.node->type == ACPI_TYPE_DEVICE) { /* No _INI method found - move on to next device */
/* Ignore error and move on to next device */
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
}
/* _STA is not required for Processor or thermal_zone objects */
} else {
info->num_STA++;
if (!(flags & 0x01)) {
/* Don't look at children of a not present device */
return_ACPI_STATUS(AE_CTRL_DEPTH);
}
} }
/* /*
* The device is present. Run _INI. * Run _STA to determine if we can run _INI on the device -
* the device must be present before _INI can be run.
* However, _STA is not required - assume device present if no _STA
*/
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
device_node,
METHOD_NAME__STA));
pinfo.node = device_node;
pinfo.parameters = NULL;
pinfo.parameter_type = ACPI_PARAM_ARGS;
status = acpi_ut_execute_STA(pinfo.node, &flags);
if (ACPI_FAILURE(status)) {
/* Ignore error and move on to next device */
return_ACPI_STATUS(AE_OK);
}
if (flags != ACPI_UINT32_MAX) {
info->num_STA++;
}
if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
/* Don't look at children of a not present device */
return_ACPI_STATUS(AE_CTRL_DEPTH);
}
/*
* The device is present and _INI exists. Run the _INI method.
* (We already have the _INI node from above)
*/ */
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD, ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
pinfo.node, pinfo.node,
METHOD_NAME__INI)); METHOD_NAME__INI));
status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
if (ACPI_FAILURE(status)) {
/* No _INI (AE_NOT_FOUND) means device requires no initialization */
if (status != AE_NOT_FOUND) { pinfo.node = ini_node;
/* Ignore error and move on to next device */ status = acpi_ns_evaluate_by_handle(&pinfo);
if (ACPI_FAILURE(status)) {
/* Ignore error and move on to next device */
#ifdef ACPI_DEBUG_OUTPUT #ifdef ACPI_DEBUG_OUTPUT
char *scope_name = char *scope_name = acpi_ns_get_external_pathname(ini_node);
acpi_ns_get_external_pathname(pinfo.node);
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n", ACPI_WARNING((AE_INFO, "%s._INI failed: %s",
scope_name, scope_name, acpi_format_exception(status)));
acpi_format_exception(status)));
ACPI_MEM_FREE(scope_name); ACPI_MEM_FREE(scope_name);
#endif #endif
}
status = AE_OK;
} else { } else {
/* Delete any return object (especially if implicit_return is enabled) */ /* Delete any return object (especially if implicit_return is enabled) */
@ -434,5 +441,5 @@ acpi_ns_init_one_device(acpi_handle obj_handle,
acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI); acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
} }
return_ACPI_STATUS(status); return_ACPI_STATUS(AE_OK);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -92,7 +92,7 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
/* Check validity of the AML start and length */ /* Check validity of the AML start and length */
if (!table_desc->aml_start) { if (!table_desc->aml_start) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n")); ACPI_ERROR((AE_INFO, "Null AML pointer"));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
@ -102,8 +102,8 @@ acpi_ns_load_table(struct acpi_table_desc *table_desc,
/* Ignore table if there is no AML contained within */ /* Ignore table if there is no AML contained within */
if (!table_desc->aml_length) { if (!table_desc->aml_length) {
ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n", ACPI_WARNING((AE_INFO, "Zero-length AML block in table [%4.4s]",
table_desc->pointer->signature)); table_desc->pointer->signature));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }
@ -263,7 +263,7 @@ acpi_status acpi_ns_load_namespace(void)
/* There must be at least a DSDT installed */ /* There must be at least a DSDT installed */
if (acpi_gbl_DSDT == NULL) { if (acpi_gbl_DSDT == NULL) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n")); ACPI_ERROR((AE_INFO, "DSDT is not in memory"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES); return_ACPI_STATUS(AE_NO_ACPI_TABLES);
} }

View File

@ -5,7 +5,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -75,7 +75,7 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
acpi_size index; acpi_size index;
struct acpi_namespace_node *parent_node; struct acpi_namespace_node *parent_node;
ACPI_FUNCTION_NAME("ns_build_external_path"); ACPI_FUNCTION_ENTRY();
/* Special case for root */ /* Special case for root */
@ -110,9 +110,9 @@ acpi_ns_build_external_path(struct acpi_namespace_node *node,
name_buffer[index] = AML_ROOT_PREFIX; name_buffer[index] = AML_ROOT_PREFIX;
if (index != 0) { if (index != 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Could not construct pathname; index=%X, size=%X, Path=%s\n", "Could not construct pathname; index=%X, size=%X, Path=%s",
(u32) index, (u32) size, &name_buffer[size])); (u32) index, (u32) size, &name_buffer[size]));
} }
return; return;
@ -148,7 +148,7 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
name_buffer = ACPI_MEM_CALLOCATE(size); name_buffer = ACPI_MEM_CALLOCATE(size);
if (!name_buffer) { if (!name_buffer) {
ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n")); ACPI_ERROR((AE_INFO, "Allocation failure"));
return_PTR(NULL); return_PTR(NULL);
} }
@ -241,7 +241,7 @@ acpi_ns_handle_to_pathname(acpi_handle target_handle,
acpi_ns_build_external_path(node, required_size, buffer->pointer); acpi_ns_build_external_path(node, required_size, buffer->pointer);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n", ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X]\n",
(char *)buffer->pointer, (u32) required_size)); (char *)buffer->pointer, (u32) required_size));
return_ACPI_STATUS(AE_OK); return_ACPI_STATUS(AE_OK);
} }

View File

@ -6,7 +6,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -84,22 +84,23 @@ acpi_ns_attach_object(struct acpi_namespace_node *node,
if (!node) { if (!node) {
/* Invalid handle */ /* Invalid handle */
ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n")); ACPI_ERROR((AE_INFO, "Null named_obj handle"));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
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_ERROR((AE_INFO,
"Null object, but type not ACPI_TYPE_ANY"));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) { if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
/* Not a name handle */ /* Not a name handle */
ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n", ACPI_ERROR((AE_INFO, "Invalid handle %p [%s]",
node, acpi_ut_get_descriptor_name(node))); node, acpi_ut_get_descriptor_name(node)));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
@ -254,7 +255,7 @@ union acpi_operand_object *acpi_ns_get_attached_object(struct
ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node); ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
if (!node) { if (!node) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n")); ACPI_WARNING((AE_INFO, "Null Node ptr"));
return_PTR(NULL); return_PTR(NULL);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -99,8 +99,8 @@ acpi_ns_search_node(u32 target_name,
if (scope_name) { if (scope_name) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Searching %s (%p) For [%4.4s] (%s)\n", "Searching %s (%p) For [%4.4s] (%s)\n",
scope_name, node, scope_name, node, ACPI_CAST_PTR(char,
(char *)&target_name, &target_name),
acpi_ut_get_type_name(type))); acpi_ut_get_type_name(type)));
ACPI_MEM_FREE(scope_name); ACPI_MEM_FREE(scope_name);
@ -131,7 +131,7 @@ acpi_ns_search_node(u32 target_name,
*/ */
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n", "Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
(char *)&target_name, ACPI_CAST_PTR(char, &target_name),
acpi_ut_get_type_name(next_node-> acpi_ut_get_type_name(next_node->
type), type),
next_node, next_node,
@ -160,7 +160,8 @@ acpi_ns_search_node(u32 target_name,
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n", "Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
(char *)&target_name, acpi_ut_get_type_name(type), ACPI_CAST_PTR(char, &target_name),
acpi_ut_get_type_name(type),
acpi_ut_get_node_name(node), node, node->child)); acpi_ut_get_node_name(node), node, node->child));
return_ACPI_STATUS(AE_NOT_FOUND); return_ACPI_STATUS(AE_NOT_FOUND);
@ -210,14 +211,14 @@ acpi_ns_search_parent_tree(u32 target_name,
*/ */
if (!parent_node) { if (!parent_node) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n", ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
(char *)&target_name)); ACPI_CAST_PTR(char, &target_name)));
return_ACPI_STATUS(AE_NOT_FOUND); return_ACPI_STATUS(AE_NOT_FOUND);
} }
if (acpi_ns_local(type)) { if (acpi_ns_local(type)) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"[%4.4s] type [%s] must be local to this scope (no parent search)\n", "[%4.4s] type [%s] must be local to this scope (no parent search)\n",
(char *)&target_name, ACPI_CAST_PTR(char, &target_name),
acpi_ut_get_type_name(type))); acpi_ut_get_type_name(type)));
return_ACPI_STATUS(AE_NOT_FOUND); return_ACPI_STATUS(AE_NOT_FOUND);
} }
@ -227,7 +228,7 @@ acpi_ns_search_parent_tree(u32 target_name,
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Searching parent [%4.4s] for [%4.4s]\n", "Searching parent [%4.4s] for [%4.4s]\n",
acpi_ut_get_node_name(parent_node), acpi_ut_get_node_name(parent_node),
(char *)&target_name)); ACPI_CAST_PTR(char, &target_name)));
/* /*
* Search parents until target is found or we have backed up to the root * Search parents until target is found or we have backed up to the root
@ -297,18 +298,17 @@ acpi_ns_search_and_enter(u32 target_name,
/* Parameter validation */ /* Parameter validation */
if (!node || !target_name || !return_node) { if (!node || !target_name || !return_node) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Null param: Node %p Name %X return_node %p\n", "Null param: Node %p Name %X return_node %p",
node, target_name, return_node)); node, target_name, return_node));
ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
/* Name must consist of printable characters */ /* Name must consist of printable characters */
if (!acpi_ut_valid_acpi_name(target_name)) { if (!acpi_ut_valid_acpi_name(target_name)) {
ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name)); ACPI_ERROR((AE_INFO, "Bad character in ACPI Name: %X",
target_name));
return_ACPI_STATUS(AE_BAD_CHARACTER); return_ACPI_STATUS(AE_BAD_CHARACTER);
} }
@ -360,7 +360,7 @@ acpi_ns_search_and_enter(u32 target_name,
if (interpreter_mode == ACPI_IMODE_EXECUTE) { if (interpreter_mode == ACPI_IMODE_EXECUTE) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"%4.4s Not found in %p [Not adding]\n", "%4.4s Not found in %p [Not adding]\n",
(char *)&target_name, node)); ACPI_CAST_PTR(char, &target_name), node));
return_ACPI_STATUS(AE_NOT_FOUND); return_ACPI_STATUS(AE_NOT_FOUND);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -63,7 +63,6 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
* *
* 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)
* internal_name - Name or path of the namespace node * internal_name - Name or path of the namespace node
* lookup_status - Exception code from NS lookup * lookup_status - Exception code from NS lookup
* *
@ -76,19 +75,17 @@ acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
void void
acpi_ns_report_error(char *module_name, acpi_ns_report_error(char *module_name,
u32 line_number, u32 line_number,
u32 component_id,
char *internal_name, acpi_status lookup_status) char *internal_name, acpi_status lookup_status)
{ {
acpi_status status; acpi_status status;
char *name = NULL; char *name = NULL;
acpi_os_printf("%8s-%04d: *** Error: Looking up ", acpi_ut_report_error(module_name, line_number);
module_name, line_number);
if (lookup_status == AE_BAD_CHARACTER) { if (lookup_status == AE_BAD_CHARACTER) {
/* There is a non-ascii character in the name */ /* There is a non-ascii character in the name */
acpi_os_printf("[0x%4.4X] (NON-ASCII)\n", acpi_os_printf("[0x%4.4X] (NON-ASCII)",
*(ACPI_CAST_PTR(u32, internal_name))); *(ACPI_CAST_PTR(u32, internal_name)));
} else { } else {
/* Convert path to external format */ /* Convert path to external format */
@ -109,7 +106,7 @@ acpi_ns_report_error(char *module_name,
} }
} }
acpi_os_printf(" in namespace, %s\n", acpi_os_printf(" Namespace lookup failure, %s\n",
acpi_format_exception(lookup_status)); acpi_format_exception(lookup_status));
} }
@ -119,10 +116,9 @@ acpi_ns_report_error(char *module_name,
* *
* 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)
* Message - Error message to use on failure * Message - Error message to use on failure
* prefix_node - Prefix relative to the path * prefix_node - Prefix relative to the path
* Path - Path to the node * Path - Path to the node (optional)
* method_status - Execution status * method_status - Execution status
* *
* RETURN: None * RETURN: None
@ -134,7 +130,6 @@ acpi_ns_report_error(char *module_name,
void void
acpi_ns_report_method_error(char *module_name, acpi_ns_report_method_error(char *module_name,
u32 line_number, u32 line_number,
u32 component_id,
char *message, char *message,
struct acpi_namespace_node *prefix_node, struct acpi_namespace_node *prefix_node,
char *path, acpi_status method_status) char *path, acpi_status method_status)
@ -142,17 +137,16 @@ acpi_ns_report_method_error(char *module_name,
acpi_status status; acpi_status status;
struct acpi_namespace_node *node = prefix_node; struct acpi_namespace_node *node = prefix_node;
acpi_ut_report_error(module_name, line_number);
if (path) { if (path) {
status = acpi_ns_get_node_by_path(path, prefix_node, status = acpi_ns_get_node_by_path(path, prefix_node,
ACPI_NS_NO_UPSEARCH, &node); ACPI_NS_NO_UPSEARCH, &node);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
acpi_os_printf acpi_os_printf("[Could not get node by pathname]");
("report_method_error: Could not get node\n");
return;
} }
} }
acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number);
acpi_ns_print_node_pathname(node, message); acpi_ns_print_node_pathname(node, message);
acpi_os_printf(", %s\n", acpi_format_exception(method_status)); acpi_os_printf(", %s\n", acpi_format_exception(method_status));
} }
@ -248,11 +242,11 @@ acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
ACPI_FUNCTION_TRACE("ns_get_type"); ACPI_FUNCTION_TRACE("ns_get_type");
if (!node) { if (!node) {
ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n")); ACPI_WARNING((AE_INFO, "Null Node parameter"));
return_VALUE(ACPI_TYPE_ANY); return_UINT32(ACPI_TYPE_ANY);
} }
return_VALUE((acpi_object_type) node->type); return_UINT32((acpi_object_type) node->type);
} }
/******************************************************************************* /*******************************************************************************
@ -275,11 +269,11 @@ u32 acpi_ns_local(acpi_object_type type)
if (!acpi_ut_valid_object_type(type)) { if (!acpi_ut_valid_object_type(type)) {
/* Type code out of range */ /* Type code out of range */
ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n")); ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
return_VALUE(ACPI_NS_NORMAL); return_UINT32(ACPI_NS_NORMAL);
} }
return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL); return_UINT32((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
} }
/******************************************************************************* /*******************************************************************************
@ -627,7 +621,7 @@ acpi_ns_externalize_name(u32 internal_name_length,
* with internal_name (invalid format). * with internal_name (invalid format).
*/ */
if (required_length > internal_name_length) { if (required_length > internal_name_length) {
ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n")); ACPI_ERROR((AE_INFO, "Invalid internal name"));
return_ACPI_STATUS(AE_BAD_PATHNAME); return_ACPI_STATUS(AE_BAD_PATHNAME);
} }
@ -803,12 +797,11 @@ u32 acpi_ns_opens_scope(acpi_object_type type)
if (!acpi_ut_valid_object_type(type)) { if (!acpi_ut_valid_object_type(type)) {
/* type code out of range */ /* type code out of range */
ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n", ACPI_WARNING((AE_INFO, "Invalid Object Type %X", type));
type)); return_UINT32(ACPI_NS_NORMAL);
return_VALUE(ACPI_NS_NORMAL);
} }
return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE); return_UINT32(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
} }
/******************************************************************************* /*******************************************************************************

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -6,7 +6,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -112,8 +112,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
if (return_buffer->length == 0) { if (return_buffer->length == 0) {
/* Error because caller specifically asked for a return value */ /* Error because caller specifically asked for a return value */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n")); ACPI_ERROR((AE_INFO, "No return value"));
return_ACPI_STATUS(AE_NULL_OBJECT); return_ACPI_STATUS(AE_NULL_OBJECT);
} }
@ -125,11 +124,11 @@ acpi_evaluate_object_typed(acpi_handle handle,
/* Return object type does not match requested type */ /* Return object type does not match requested type */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Incorrect return type [%s] requested [%s]\n", "Incorrect return type [%s] requested [%s]",
acpi_ut_get_type_name(((union acpi_object *) acpi_ut_get_type_name(((union acpi_object *)return_buffer->
return_buffer->pointer)->type), pointer)->type),
acpi_ut_get_type_name(return_type))); acpi_ut_get_type_name(return_type)));
if (must_free) { if (must_free) {
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
@ -236,11 +235,11 @@ acpi_evaluate_object(acpi_handle handle,
* qualified names above, this is an error * qualified names above, this is an error
*/ */
if (!pathname) { if (!pathname) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Both Handle and Pathname are NULL\n")); "Both Handle and Pathname are NULL"));
} else { } else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Handle is NULL and Pathname is relative\n")); "Handle is NULL and Pathname is relative"));
} }
status = AE_BAD_PARAMETER; status = AE_BAD_PARAMETER;
@ -399,7 +398,7 @@ acpi_walk_namespace(acpi_object_type type,
/* Parameter validation */ /* Parameter validation */
if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) { if ((type > ACPI_TYPE_LOCAL_MAX) || (!max_depth) || (!user_function)) {
return_ACPI_STATUS(AE_BAD_PARAMETER); return_ACPI_STATUS(AE_BAD_PARAMETER);
} }
@ -473,8 +472,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
return (AE_CTRL_DEPTH); return (AE_CTRL_DEPTH);
} }
if (!(flags & 0x01)) { if (!(flags & ACPI_STA_DEVICE_PRESENT)) {
/* Don't return at the device or children of the device if not there */ /* Don't examine children of the device if not present */
return (AE_CTRL_DEPTH); return (AE_CTRL_DEPTH);
} }

View File

@ -6,7 +6,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -300,8 +300,7 @@ acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
status = acpi_ut_execute_CID(node, &cid_list); status = acpi_ut_execute_CID(node, &cid_list);
if (ACPI_SUCCESS(status)) { if (ACPI_SUCCESS(status)) {
size += ((acpi_size) cid_list->count - 1) * size += cid_list->size;
sizeof(struct acpi_compatible_id);
info->valid |= ACPI_VALID_CID; info->valid |= ACPI_VALID_CID;
} }

View File

@ -6,7 +6,7 @@
******************************************************************************/ ******************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -838,7 +838,7 @@ acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
static const int quantum_ms = 1000 / HZ; static const int quantum_ms = 1000 / HZ;
ret = down_trylock(sem); ret = down_trylock(sem);
for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { for (i = timeout; (i > 0 && ret != 0); i -= quantum_ms) {
schedule_timeout_interruptible(1); schedule_timeout_interruptible(1);
ret = down_trylock(sem); ret = down_trylock(sem);
} }
@ -1060,13 +1060,11 @@ EXPORT_SYMBOL(max_cstate);
* Acquire a spinlock. * Acquire a spinlock.
* *
* handle is a pointer to the spinlock_t. * handle is a pointer to the spinlock_t.
* flags is *not* the result of save_flags - it is an ACPI-specific flag variable
* that indicates whether we are at interrupt level.
*/ */
unsigned long acpi_os_acquire_lock(acpi_handle handle) acpi_cpu_flags acpi_os_acquire_lock(acpi_handle handle)
{ {
unsigned long flags; acpi_cpu_flags flags;
spin_lock_irqsave((spinlock_t *) handle, flags); spin_lock_irqsave((spinlock_t *) handle, flags);
return flags; return flags;
} }
@ -1075,7 +1073,7 @@ unsigned long acpi_os_acquire_lock(acpi_handle handle)
* Release a spinlock. See above. * Release a spinlock. See above.
*/ */
void acpi_os_release_lock(acpi_handle handle, unsigned long flags) void acpi_os_release_lock(acpi_handle handle, acpi_cpu_flags flags)
{ {
spin_unlock_irqrestore((spinlock_t *) handle, flags); spin_unlock_irqrestore((spinlock_t *) handle, flags);
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -45,6 +45,7 @@
#include <acpi/acparser.h> #include <acpi/acparser.h>
#include <acpi/amlcode.h> #include <acpi/amlcode.h>
#include <acpi/acnamesp.h> #include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_PARSER #define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psargs") ACPI_MODULE_NAME("psargs")
@ -62,61 +63,51 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
* *
* PARAMETERS: parser_state - Current parser state object * PARAMETERS: parser_state - Current parser state object
* *
* RETURN: Decoded package length. On completion, the AML pointer points * RETURN: Decoded package length. On completion, the AML pointer points
* past the length byte or bytes. * past the length byte or bytes.
* *
* DESCRIPTION: Decode and return a package length field * DESCRIPTION: Decode and return a package length field.
* Note: Largest package length is 28 bits, from ACPI specification
* *
******************************************************************************/ ******************************************************************************/
static u32 static u32
acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state) acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
{ {
u32 encoded_length; u8 *aml = parser_state->aml;
u32 length = 0; u32 package_length = 0;
acpi_native_uint byte_count;
u8 byte_zero_mask = 0x3F; /* Default [0:5] */
ACPI_FUNCTION_TRACE("ps_get_next_package_length"); ACPI_FUNCTION_TRACE("ps_get_next_package_length");
encoded_length = (u32) ACPI_GET8(parser_state->aml); /*
parser_state->aml++; * Byte 0 bits [6:7] contain the number of additional bytes
* used to encode the package length, either 0,1,2, or 3
*/
byte_count = (aml[0] >> 6);
parser_state->aml += (byte_count + 1);
switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */ /* Get bytes 3, 2, 1 as needed */
case 0: /* 1-byte encoding (bits 0-5) */
length = (encoded_length & 0x3F); while (byte_count) {
break; /*
* Final bit positions for the package length bytes:
* Byte3->[20:27]
* Byte2->[12:19]
* Byte1->[04:11]
* Byte0->[00:03]
*/
package_length |= (aml[byte_count] << ((byte_count << 3) - 4));
case 1: /* 2-byte encoding (next byte + bits 0-3) */ byte_zero_mask = 0x0F; /* Use bits [0:3] of byte 0 */
byte_count--;
length = ((ACPI_GET8(parser_state->aml) << 04) |
(encoded_length & 0x0F));
parser_state->aml++;
break;
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
(ACPI_GET8(parser_state->aml) << 04) |
(encoded_length & 0x0F));
parser_state->aml += 2;
break;
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
length = ((ACPI_GET8(parser_state->aml + 2) << 20) |
(ACPI_GET8(parser_state->aml + 1) << 12) |
(ACPI_GET8(parser_state->aml) << 04) |
(encoded_length & 0x0F));
parser_state->aml += 3;
break;
default:
/* Can't get here, only 2 bits / 4 cases */
break;
} }
return_VALUE(length); /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
package_length |= (aml[0] & byte_zero_mask);
return_UINT32(package_length);
} }
/******************************************************************************* /*******************************************************************************
@ -135,16 +126,15 @@ acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state) u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
{ {
u8 *start = parser_state->aml; u8 *start = parser_state->aml;
acpi_native_uint length; u32 package_length;
ACPI_FUNCTION_TRACE("ps_get_next_package_end"); ACPI_FUNCTION_TRACE("ps_get_next_package_end");
/* Function below changes parser_state->Aml */ /* Function below updates parser_state->Aml */
length = package_length = acpi_ps_get_next_package_length(parser_state);
(acpi_native_uint) acpi_ps_get_next_package_length(parser_state);
return_PTR(start + length); /* end of package */ return_PTR(start + package_length); /* end of package */
} }
/******************************************************************************* /*******************************************************************************
@ -169,17 +159,15 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
ACPI_FUNCTION_TRACE("ps_get_next_namestring"); ACPI_FUNCTION_TRACE("ps_get_next_namestring");
/* Handle multiple prefix characters */ /* Point past any namestring prefix characters (backslash or carat) */
while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
/* Include prefix '\\' or '^' */
while (acpi_ps_is_prefix_char(*end)) {
end++; end++;
} }
/* Decode the path */ /* Decode the path prefix character */
switch (ACPI_GET8(end)) { switch (*end) {
case 0: case 0:
/* null_name */ /* null_name */
@ -199,9 +187,9 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
case AML_MULTI_NAME_PREFIX_OP: case AML_MULTI_NAME_PREFIX_OP:
/* Multiple name segments, 4 chars each */ /* Multiple name segments, 4 chars each, count in next byte */
end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE); end += 2 + (*(end + 1) * ACPI_NAME_SIZE);
break; break;
default: default:
@ -212,7 +200,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
break; break;
} }
parser_state->aml = (u8 *) end; parser_state->aml = end;
return_PTR((char *)start); return_PTR((char *)start);
} }
@ -224,7 +212,7 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
* Arg - Where the namepath will be stored * Arg - Where the namepath will be stored
* arg_count - If the namepath points to a control method * arg_count - If the namepath points to a control method
* the method's argument is returned here. * the method's argument is returned here.
* method_call - Whether the namepath can possibly be the * possible_method_call - Whether the namepath can possibly be the
* start of a method call * start of a method call
* *
* RETURN: Status * RETURN: Status
@ -240,11 +228,11 @@ char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
acpi_status acpi_status
acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
struct acpi_parse_state *parser_state, struct acpi_parse_state *parser_state,
union acpi_parse_object *arg, u8 method_call) union acpi_parse_object *arg, u8 possible_method_call)
{ {
char *path; char *path;
union acpi_parse_object *name_op; union acpi_parse_object *name_op;
acpi_status status = AE_OK; acpi_status status;
union acpi_operand_object *method_desc; union acpi_operand_object *method_desc;
struct acpi_namespace_node *node; struct acpi_namespace_node *node;
union acpi_generic_state scope_info; union acpi_generic_state scope_info;
@ -252,115 +240,129 @@ acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
ACPI_FUNCTION_TRACE("ps_get_next_namepath"); ACPI_FUNCTION_TRACE("ps_get_next_namepath");
path = acpi_ps_get_next_namestring(parser_state); path = acpi_ps_get_next_namestring(parser_state);
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
/* Null path case is allowed */ /* Null path case is allowed, just exit */
if (path) { if (!path) {
/* arg->common.value.name = path;
* Lookup the name in the internal namespace return_ACPI_STATUS(AE_OK);
*/ }
scope_info.scope.node = NULL;
node = parser_state->start_node;
if (node) {
scope_info.scope.node = node;
}
/* /* Setup search scope info */
* Lookup object. We don't want to add anything new to the namespace
* here, however. So we use MODE_EXECUTE. Allow searching of the
* parent tree, but don't open a new scope -- we just want to lookup the
* object (MUST BE mode EXECUTE to perform upsearch)
*/
status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT |
ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
if (ACPI_SUCCESS(status) && method_call) {
if (node->type == ACPI_TYPE_METHOD) {
/* This name is actually a control method invocation */
method_desc = acpi_ns_get_attached_object(node); scope_info.scope.node = NULL;
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, node = parser_state->start_node;
"Control Method - %p Desc %p Path=%p\n", if (node) {
node, method_desc, path)); scope_info.scope.node = node;
name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
if (!name_op) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Change arg into a METHOD CALL and attach name to it */
acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
name_op->common.value.name = path;
/* Point METHODCALL/NAME to the METHOD Node */
name_op->common.node = node;
acpi_ps_append_arg(arg, name_op);
if (!method_desc) {
ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Control Method - %p Args %X\n",
node,
method_desc->method.
param_count));
/* Get the number of arguments to expect */
walk_state->arg_count =
method_desc->method.param_count;
return_ACPI_STATUS(AE_OK);
}
/*
* Else this is normal named object reference.
* Just init the NAMEPATH object with the pathname.
* (See code below)
*/
}
if (ACPI_FAILURE(status)) {
/*
* 1) Any error other than NOT_FOUND is always severe
* 2) NOT_FOUND is only important if we are executing a method.
* 3) If executing a cond_ref_of opcode, NOT_FOUND is ok.
*/
if ((((walk_state->
parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) && (status == AE_NOT_FOUND)
&& (walk_state->op->common.aml_opcode !=
AML_COND_REF_OF_OP))
|| (status != AE_NOT_FOUND)) {
ACPI_REPORT_NSERROR(path, status);
acpi_os_printf
("search_node %p start_node %p return_node %p\n",
scope_info.scope.node,
parser_state->start_node, node);
} else {
/*
* We got a NOT_FOUND during table load or we encountered
* a cond_ref_of(x) where the target does not exist.
* Either case is ok
*/
status = AE_OK;
}
}
} }
/* /*
* Regardless of success/failure above, * Lookup the name in the internal namespace. We don't want to add
* Just initialize the Op with the pathname. * anything new to the namespace here, however, so we use MODE_EXECUTE.
* Allow searching of the parent tree, but don't open a new scope -
* we just want to lookup the object (must be mode EXECUTE to perform
* the upsearch)
*/ */
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); status =
arg->common.value.name = path; acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &node);
/*
* If this name is a control method invocation, we must
* setup the method call
*/
if (ACPI_SUCCESS(status) &&
possible_method_call && (node->type == ACPI_TYPE_METHOD)) {
/* This name is actually a control method invocation */
method_desc = acpi_ns_get_attached_object(node);
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Control Method - %p Desc %p Path=%p\n", node,
method_desc, path));
name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
if (!name_op) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Change Arg into a METHOD CALL and attach name to it */
acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
name_op->common.value.name = path;
/* Point METHODCALL/NAME to the METHOD Node */
name_op->common.node = node;
acpi_ps_append_arg(arg, name_op);
if (!method_desc) {
ACPI_ERROR((AE_INFO,
"Control Method %p has no attached object",
node));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Control Method - %p Args %X\n",
node, method_desc->method.param_count));
/* Get the number of arguments to expect */
walk_state->arg_count = method_desc->method.param_count;
return_ACPI_STATUS(AE_OK);
}
/*
* Special handling if the name was not found during the lookup -
* some not_found cases are allowed
*/
if (status == AE_NOT_FOUND) {
/* 1) not_found is ok during load pass 1/2 (allow forward references) */
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) !=
ACPI_PARSE_EXECUTE) {
status = AE_OK;
}
/* 2) not_found during a cond_ref_of(x) is ok by definition */
else if (walk_state->op->common.aml_opcode ==
AML_COND_REF_OF_OP) {
status = AE_OK;
}
/*
* 3) not_found while building a Package is ok at this point, we
* may flag as an error later if slack mode is not enabled.
* (Some ASL code depends on allowing this behavior)
*/
else if ((arg->common.parent) &&
((arg->common.parent->common.aml_opcode ==
AML_PACKAGE_OP)
|| (arg->common.parent->common.aml_opcode ==
AML_VAR_PACKAGE_OP))) {
status = AE_OK;
}
}
/* Final exception check (may have been changed from code above) */
if (ACPI_FAILURE(status)) {
ACPI_ERROR_NAMESPACE(path, status);
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) {
/* Report a control method execution error */
status = acpi_ds_method_error(status, walk_state);
}
}
/* Save the namepath */
arg->common.value.name = path;
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -382,59 +384,63 @@ void
acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
u32 arg_type, union acpi_parse_object *arg) u32 arg_type, union acpi_parse_object *arg)
{ {
u32 length;
u16 opcode;
u8 *aml = parser_state->aml;
ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type); ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
switch (arg_type) { switch (arg_type) {
case ARGP_BYTEDATA: case ARGP_BYTEDATA:
acpi_ps_init_op(arg, AML_BYTE_OP); /* Get 1 byte from the AML stream */
arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml);
parser_state->aml++; opcode = AML_BYTE_OP;
arg->common.value.integer = (acpi_integer) * aml;
length = 1;
break; break;
case ARGP_WORDDATA: case ARGP_WORDDATA:
acpi_ps_init_op(arg, AML_WORD_OP);
/* Get 2 bytes from the AML stream */ /* Get 2 bytes from the AML stream */
ACPI_MOVE_16_TO_32(&arg->common.value.integer, opcode = AML_WORD_OP;
parser_state->aml); ACPI_MOVE_16_TO_64(&arg->common.value.integer, aml);
parser_state->aml += 2; length = 2;
break; break;
case ARGP_DWORDDATA: case ARGP_DWORDDATA:
acpi_ps_init_op(arg, AML_DWORD_OP);
/* Get 4 bytes from the AML stream */ /* Get 4 bytes from the AML stream */
ACPI_MOVE_32_TO_32(&arg->common.value.integer, opcode = AML_DWORD_OP;
parser_state->aml); ACPI_MOVE_32_TO_64(&arg->common.value.integer, aml);
parser_state->aml += 4; length = 4;
break; break;
case ARGP_QWORDDATA: case ARGP_QWORDDATA:
acpi_ps_init_op(arg, AML_QWORD_OP);
/* Get 8 bytes from the AML stream */ /* Get 8 bytes from the AML stream */
ACPI_MOVE_64_TO_64(&arg->common.value.integer, opcode = AML_QWORD_OP;
parser_state->aml); ACPI_MOVE_64_TO_64(&arg->common.value.integer, aml);
parser_state->aml += 8; length = 8;
break; break;
case ARGP_CHARLIST: case ARGP_CHARLIST:
acpi_ps_init_op(arg, AML_STRING_OP); /* Get a pointer to the string, point past the string */
arg->common.value.string = (char *)parser_state->aml;
while (ACPI_GET8(parser_state->aml) != '\0') { opcode = AML_STRING_OP;
parser_state->aml++; arg->common.value.string = ACPI_CAST_PTR(char, aml);
/* Find the null terminator */
length = 0;
while (aml[length]) {
length++;
} }
parser_state->aml++; length++;
break; break;
case ARGP_NAME: case ARGP_NAME:
@ -443,14 +449,16 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP); acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
arg->common.value.name = arg->common.value.name =
acpi_ps_get_next_namestring(parser_state); acpi_ps_get_next_namestring(parser_state);
break; return_VOID;
default: default:
ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type)); ACPI_ERROR((AE_INFO, "Invalid arg_type %X", arg_type));
break; return_VOID;
} }
acpi_ps_init_op(arg, opcode);
parser_state->aml += length;
return_VOID; return_VOID;
} }
@ -540,7 +548,7 @@ static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
* access_type is first operand, access_attribute is second * access_type is first operand, access_attribute is second
*/ */
field->common.value.integer = field->common.value.integer =
(ACPI_GET8(parser_state->aml) << 8); (((u32) ACPI_GET8(parser_state->aml) << 8));
parser_state->aml++; parser_state->aml++;
field->common.value.integer |= ACPI_GET8(parser_state->aml); field->common.value.integer |= ACPI_GET8(parser_state->aml);
parser_state->aml++; parser_state->aml++;
@ -703,7 +711,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
default: default:
ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type)); ACPI_ERROR((AE_INFO, "Invalid arg_type: %X", arg_type));
status = AE_AML_OPERAND_TYPE; status = AE_AML_OPERAND_TYPE;
break; break;
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -123,16 +123,12 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
&& ((status & AE_CODE_MASK) != && ((status & AE_CODE_MASK) !=
AE_CODE_CONTROL)) { AE_CODE_CONTROL)) {
if (status == AE_AML_NO_RETURN_VALUE) { if (status == AE_AML_NO_RETURN_VALUE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"Invoked method did not return a value, %s\n", "Invoked method did not return a value"));
acpi_format_exception
(status)));
} }
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"get_predicate Failed, %s\n", "get_predicate Failed"));
acpi_format_exception
(status)));
return_ACPI_STATUS(status); return_ACPI_STATUS(status);
} }
@ -190,11 +186,11 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
/* The opcode is unrecognized. Just skip unknown opcodes */ /* The opcode is unrecognized. Just skip unknown opcodes */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_ERROR((AE_INFO,
"Found unknown opcode %X at AML address %p offset %X, ignoring\n", "Found unknown opcode %X at AML address %p offset %X, ignoring",
walk_state->opcode, walk_state->opcode,
parser_state->aml, parser_state->aml,
walk_state->aml_offset)); walk_state->aml_offset));
ACPI_DUMP_BUFFER(parser_state->aml, 128); ACPI_DUMP_BUFFER(parser_state->aml, 128);
@ -281,10 +277,8 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
walk_state->descending_callback(walk_state, walk_state->descending_callback(walk_state,
&op); &op);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_EXCEPTION((AE_INFO, status,
"During name lookup/catalog, %s\n", "During name lookup/catalog"));
acpi_format_exception
(status)));
goto close_this_op; goto close_this_op;
} }
@ -704,6 +698,15 @@ acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
acpi_ps_pop_scope(parser_state, &op, acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_types,
&walk_state->arg_count); &walk_state->arg_count);
if (op->common.aml_opcode != AML_WHILE_OP) {
status2 =
acpi_ds_result_stack_pop
(walk_state);
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
}
} }
/* Close this iteration of the While loop */ /* Close this iteration of the While loop */

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -747,7 +747,7 @@ const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
/* Unknown AML opcode */ /* Unknown AML opcode */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Unknown AML opcode [%4.4X]\n", opcode)); "Unknown AML opcode [%4.4X]\n", opcode));
return (&acpi_gbl_aml_op_info[_UNK]); return (&acpi_gbl_aml_op_info[_UNK]);

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -333,7 +333,6 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
switch (callback_status) { switch (callback_status) {
case AE_CTRL_TERMINATE: case AE_CTRL_TERMINATE:
/* /*
* A control method was terminated via a RETURN statement. * A control method was terminated via a RETURN statement.
* The walk of this method is complete. * The walk of this method is complete.
@ -346,13 +345,19 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
parser_state->aml = walk_state->aml_last_while; parser_state->aml = walk_state->aml_last_while;
walk_state->control_state->common.value = FALSE; walk_state->control_state->common.value = FALSE;
status = AE_CTRL_BREAK; status = acpi_ds_result_stack_pop(walk_state);
if (ACPI_SUCCESS(status)) {
status = AE_CTRL_BREAK;
}
break; break;
case AE_CTRL_CONTINUE: case AE_CTRL_CONTINUE:
parser_state->aml = walk_state->aml_last_while; parser_state->aml = walk_state->aml_last_while;
status = AE_CTRL_CONTINUE; status = acpi_ds_result_stack_pop(walk_state);
if (ACPI_SUCCESS(status)) {
status = AE_CTRL_CONTINUE;
}
break; break;
case AE_CTRL_PENDING: case AE_CTRL_PENDING:
@ -369,16 +374,18 @@ acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
#endif #endif
case AE_CTRL_TRUE: case AE_CTRL_TRUE:
/* /*
* Predicate of an IF was true, and we are at the matching ELSE. * Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package * Just close out this package
*/ */
parser_state->aml = acpi_ps_get_next_package_end(parser_state); parser_state->aml = acpi_ps_get_next_package_end(parser_state);
status = acpi_ds_result_stack_pop(walk_state);
if (ACPI_SUCCESS(status)) {
status = AE_CTRL_PENDING;
}
break; break;
case AE_CTRL_FALSE: case AE_CTRL_FALSE:
/* /*
* Either an IF/WHILE Predicate was false or we encountered a BREAK * Either an IF/WHILE Predicate was false or we encountered a BREAK
* opcode. In both cases, we do not execute the rest of the * opcode. In both cases, we do not execute the rest of the
@ -503,22 +510,23 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
} else if (status == AE_CTRL_TERMINATE) { } else if (status == AE_CTRL_TERMINATE) {
status = AE_OK; status = AE_OK;
} else if ((status != AE_OK) && (walk_state->method_desc)) { } else if ((status != AE_OK) && (walk_state->method_desc)) {
ACPI_REPORT_METHOD_ERROR("Method execution failed", /* Either the method parse or actual execution failed */
walk_state->method_node, NULL,
status);
/* Ensure proper cleanup */ ACPI_ERROR_METHOD("Method parse/execution failed",
walk_state->method_node, NULL,
walk_state->parse_flags |= ACPI_PARSE_EXECUTE; status);
/* Check for possible multi-thread reentrancy problem */ /* Check for possible multi-thread reentrancy problem */
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 * Method tried to create an object twice. The probable cause is
* that the method cannot handle reentrancy.
*
* The method is marked not_serialized, but it tried to create
* a named object, causing the second thread entrance to fail. * a named object, causing the second thread entrance to fail.
* We will workaround this by marking the method permanently * Workaround this problem by marking the method permanently
* as Serialized. * as Serialized.
*/ */
walk_state->method_desc->method.method_flags |= walk_state->method_desc->method.method_flags |=
@ -536,15 +544,23 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
acpi_ds_scope_stack_clear(walk_state); acpi_ds_scope_stack_clear(walk_state);
/* /*
* If we just returned from the execution of a control method, * If we just returned from the execution of a control method or if we
* there's lots of cleanup to do * encountered an error during the method parse phase, there's lots of
* cleanup to do
*/ */
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == if (((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) { ACPI_PARSE_EXECUTE) || (ACPI_FAILURE(status))) {
if (walk_state->method_desc) { if (walk_state->method_desc) {
/* Decrement the thread count on the method parse tree */ /* Decrement the thread count on the method parse tree */
walk_state->method_desc->method.thread_count--; if (walk_state->method_desc->method.
thread_count) {
walk_state->method_desc->method.
thread_count--;
} else {
ACPI_ERROR((AE_INFO,
"Invalid zero thread count in method"));
}
} }
acpi_ds_terminate_control_method(walk_state); acpi_ds_terminate_control_method(walk_state);
@ -553,7 +569,6 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
/* Delete this walk state and all linked control states */ /* Delete this walk state and all linked control states */
acpi_ps_cleanup_scope(&walk_state->parser_state); acpi_ps_cleanup_scope(&walk_state->parser_state);
previous_walk_state = walk_state; previous_walk_state = walk_state;
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, ACPI_DEBUG_PRINT((ACPI_DB_PARSE,

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -132,7 +132,8 @@ acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
if (op_info->class == AML_CLASS_UNKNOWN) { if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode */ /* Invalid opcode */
ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode)); ACPI_ERROR((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
op->common.aml_opcode));
return; return;
} }

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*****************************************************************************/ *****************************************************************************/
/* /*
* Copyright (C) 2000 - 2005, R. Byron Moore * Copyright (C) 2000 - 2006, R. Byron Moore
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -50,11 +50,145 @@
ACPI_MODULE_NAME("psxface") ACPI_MODULE_NAME("psxface")
/* Local Prototypes */ /* Local Prototypes */
static void acpi_ps_start_trace(struct acpi_parameter_info *info);
static void acpi_ps_stop_trace(struct acpi_parameter_info *info);
static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info); static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info);
static void static void
acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action); acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
/*******************************************************************************
*
* FUNCTION: acpi_debug_trace
*
* PARAMETERS: method_name - Valid ACPI name string
* debug_level - Optional level mask. 0 to use default
* debug_layer - Optional layer mask. 0 to use default
* Flags - bit 1: one shot(1) or persistent(0)
*
* RETURN: Status
*
* DESCRIPTION: External interface to enable debug tracing during control
* method execution
*
******************************************************************************/
acpi_status
acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags)
{
acpi_status status;
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return (status);
}
/* TBDs: Validate name, allow full path or just nameseg */
acpi_gbl_trace_method_name = *ACPI_CAST_PTR(u32, name);
acpi_gbl_trace_flags = flags;
if (debug_level) {
acpi_gbl_trace_dbg_level = debug_level;
}
if (debug_layer) {
acpi_gbl_trace_dbg_layer = debug_layer;
}
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_start_trace
*
* PARAMETERS: Info - Method info struct
*
* RETURN: None
*
* DESCRIPTION: Start control method execution trace
*
******************************************************************************/
static void acpi_ps_start_trace(struct acpi_parameter_info *info)
{
acpi_status status;
ACPI_FUNCTION_ENTRY();
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return;
}
if ((!acpi_gbl_trace_method_name) ||
(acpi_gbl_trace_method_name != info->node->name.integer)) {
goto exit;
}
acpi_gbl_original_dbg_level = acpi_dbg_level;
acpi_gbl_original_dbg_layer = acpi_dbg_layer;
acpi_dbg_level = 0x00FFFFFF;
acpi_dbg_layer = ACPI_UINT32_MAX;
if (acpi_gbl_trace_dbg_level) {
acpi_dbg_level = acpi_gbl_trace_dbg_level;
}
if (acpi_gbl_trace_dbg_layer) {
acpi_dbg_layer = acpi_gbl_trace_dbg_layer;
}
exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_stop_trace
*
* PARAMETERS: Info - Method info struct
*
* RETURN: None
*
* DESCRIPTION: Stop control method execution trace
*
******************************************************************************/
static void acpi_ps_stop_trace(struct acpi_parameter_info *info)
{
acpi_status status;
ACPI_FUNCTION_ENTRY();
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return;
}
if ((!acpi_gbl_trace_method_name) ||
(acpi_gbl_trace_method_name != info->node->name.integer)) {
goto exit;
}
/* Disable further tracing if type is one-shot */
if (acpi_gbl_trace_flags & 1) {
acpi_gbl_trace_method_name = 0;
acpi_gbl_trace_dbg_level = 0;
acpi_gbl_trace_dbg_layer = 0;
}
acpi_dbg_level = acpi_gbl_original_dbg_level;
acpi_dbg_layer = acpi_gbl_original_dbg_layer;
exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
}
/******************************************************************************* /*******************************************************************************
* *
* FUNCTION: acpi_ps_execute_method * FUNCTION: acpi_ps_execute_method
@ -104,6 +238,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
*/ */
acpi_ps_update_parameter_list(info, REF_INCREMENT); acpi_ps_update_parameter_list(info, REF_INCREMENT);
/* Begin tracing if requested */
acpi_ps_start_trace(info);
/* /*
* 1) Perform the first pass parse of the method to enter any * 1) Perform the first pass parse of the method to enter any
* named objects that it creates into the namespace * named objects that it creates into the namespace
@ -129,6 +267,10 @@ acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
status = acpi_ps_execute_pass(info); status = acpi_ps_execute_pass(info);
cleanup: cleanup:
/* End optional tracing */
acpi_ps_stop_trace(info);
/* Take away the extra reference that we gave the parameters above */ /* Take away the extra reference that we gave the parameters above */
acpi_ps_update_parameter_list(info, REF_DECREMENT); acpi_ps_update_parameter_list(info, REF_DECREMENT);

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