[ACPI] Lindent all ACPI files

Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Len Brown
2005-08-05 00:44:28 -04:00
parent c65ade4dc8
commit 4be44fcd3b
190 changed files with 24344 additions and 29290 deletions

View File

@@ -40,9 +40,15 @@
#ifdef CONFIG_X86_64
static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id) { }
static inline void acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
}
extern void __init clustered_apic_check(void);
static inline int ioapic_setup_disabled(void) { return 0; }
static inline int ioapic_setup_disabled(void)
{
return 0;
}
#include <asm/proto.h>
#else /* X86 */
@@ -212,10 +218,7 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
#endif /* CONFIG_PCI_MMCONFIG */
#ifdef CONFIG_X86_LOCAL_APIC
static int __init
acpi_parse_madt (
unsigned long phys_addr,
unsigned long size)
static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
{
struct acpi_table_madt *madt = NULL;
@@ -240,10 +243,8 @@ acpi_parse_madt (
return 0;
}
static int __init
acpi_parse_lapic (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_lapic *processor = NULL;
@@ -260,16 +261,15 @@ acpi_parse_lapic (
x86_acpiid_to_apicid[processor->acpi_id] = processor->id;
mp_register_lapic (
processor->id, /* APIC ID */
mp_register_lapic(processor->id, /* APIC ID */
processor->flags.enabled); /* Enabled? */
return 0;
}
static int __init
acpi_parse_lapic_addr_ovr (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL;
@@ -284,8 +284,7 @@ acpi_parse_lapic_addr_ovr (
}
static int __init
acpi_parse_lapic_nmi (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_lapic_nmi *lapic_nmi = NULL;
@@ -302,14 +301,12 @@ acpi_parse_lapic_nmi (
return 0;
}
#endif /*CONFIG_X86_LOCAL_APIC */
#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER)
static int __init
acpi_parse_ioapic (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_ioapic *ioapic = NULL;
@@ -320,10 +317,8 @@ acpi_parse_ioapic (
acpi_table_print_madt_entry(header);
mp_register_ioapic (
ioapic->id,
ioapic->address,
ioapic->global_irq_base);
mp_register_ioapic(ioapic->id,
ioapic->address, ioapic->global_irq_base);
return 0;
}
@@ -331,8 +326,7 @@ acpi_parse_ioapic (
/*
* Parse Interrupt Source Override for the ACPI SCI
*/
static void
acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
{
if (trigger == 0) /* compatible SCI trigger is level */
trigger = 3;
@@ -363,8 +357,8 @@ acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
}
static int __init
acpi_parse_int_src_ovr (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_int_src_ovr(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_int_src_ovr *intsrc = NULL;
@@ -377,7 +371,8 @@ acpi_parse_int_src_ovr (
if (intsrc->bus_irq == acpi_fadt.sci_int) {
acpi_sci_ioapic_setup(intsrc->global_irq,
intsrc->flags.polarity, intsrc->flags.trigger);
intsrc->flags.polarity,
intsrc->flags.trigger);
return 0;
}
@@ -387,19 +382,15 @@ acpi_parse_int_src_ovr (
return 0;
}
mp_override_legacy_irq (
intsrc->bus_irq,
mp_override_legacy_irq(intsrc->bus_irq,
intsrc->flags.polarity,
intsrc->flags.trigger,
intsrc->global_irq);
intsrc->flags.trigger, intsrc->global_irq);
return 0;
}
static int __init
acpi_parse_nmi_src (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
{
struct acpi_table_nmi_src *nmi_src = NULL;
@@ -433,8 +424,7 @@ acpi_parse_nmi_src (
* ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0)
*/
void __init
acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
{
unsigned int mask = 1 << irq;
unsigned int old, new;
@@ -470,7 +460,6 @@ acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger)
outb(new >> 8, 0x4d1);
}
#endif /* CONFIG_ACPI_BUS */
int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
@@ -513,50 +502,48 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
acpi_gsi_to_irq(plat_gsi, &irq);
return irq;
}
EXPORT_SYMBOL(acpi_register_gsi);
/*
* ACPI based hotplug support for CPU
*/
#ifdef CONFIG_ACPI_HOTPLUG_CPU
int
acpi_map_lsapic(acpi_handle handle, int *pcpu)
int acpi_map_lsapic(acpi_handle handle, int *pcpu)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_map_lsapic);
int
acpi_unmap_lsapic(int cpu)
int acpi_unmap_lsapic(int cpu)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_unmap_lsapic);
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
int
acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_register_ioapic);
int
acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
{
/* TBD */
return -EINVAL;
}
EXPORT_SYMBOL(acpi_unregister_ioapic);
static unsigned long __init
acpi_scan_rsdp (
unsigned long start,
unsigned long length)
acpi_scan_rsdp(unsigned long start, unsigned long length)
{
unsigned long offset = 0;
unsigned long sig_len = sizeof("RSD PTR ") - 1;
@@ -592,7 +579,6 @@ static int __init acpi_parse_sbf(unsigned long phys_addr, unsigned long size)
return 0;
}
#ifdef CONFIG_HPET_TIMER
static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
@@ -613,7 +599,6 @@ static int __init acpi_parse_hpet(unsigned long phys, unsigned long size)
"memory.\n");
return -1;
}
#ifdef CONFIG_X86_64
vxtime.hpet_address = hpet_tbl->addr.addrl |
((long)hpet_tbl->addr.addrh << 32);
@@ -649,7 +634,6 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
printk(KERN_WARNING PREFIX "Unable to map FADT\n");
return 0;
}
#ifdef CONFIG_ACPI_INTERPRETER
/* initialize sci_int early for INT_SRC_OVR MADT parsing */
acpi_fadt.sci_int = fadt->sci_int;
@@ -658,14 +642,16 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
#ifdef CONFIG_ACPI_BUS
/* initialize rev and apic_phys_dest_mode for x86_64 genapic */
acpi_fadt.revision = fadt->revision;
acpi_fadt.force_apic_physical_destination_mode = fadt->force_apic_physical_destination_mode;
acpi_fadt.force_apic_physical_destination_mode =
fadt->force_apic_physical_destination_mode;
#endif
#ifdef CONFIG_X86_PM_TIMER
/* detect the location of the ACPI PM Timer */
if (fadt->revision >= FADT2_REVISION_ID) {
/* FADT rev. 2 */
if (fadt->xpm_tmr_blk.address_space_id != ACPI_ADR_SPACE_SYSTEM_IO)
if (fadt->xpm_tmr_blk.address_space_id !=
ACPI_ADR_SPACE_SYSTEM_IO)
return 0;
pmtmr_ioport = fadt->xpm_tmr_blk.address;
@@ -674,14 +660,13 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
pmtmr_ioport = fadt->V1_pm_tmr_blk;
}
if (pmtmr_ioport)
printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport);
printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
pmtmr_ioport);
#endif
return 0;
}
unsigned long __init
acpi_find_rsdp (void)
unsigned long __init acpi_find_rsdp(void)
{
unsigned long rsdp_phys = 0;
@@ -707,8 +692,7 @@ acpi_find_rsdp (void)
* Parse LAPIC entries in MADT
* returns 0 on success, < 0 on error
*/
static int __init
acpi_parse_madt_lapic_entries(void)
static int __init acpi_parse_madt_lapic_entries(void)
{
int count;
@@ -717,9 +701,12 @@ acpi_parse_madt_lapic_entries(void)
* and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
*/
count = acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0);
count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,
acpi_parse_lapic_addr_ovr, 0);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
printk(KERN_ERR PREFIX
"Error parsing LAPIC address override entry\n");
return count;
}
@@ -731,14 +718,14 @@ acpi_parse_madt_lapic_entries(void)
printk(KERN_ERR PREFIX "No LAPIC entries present\n");
/* TBD: Cleanup to allow fallback to MPS */
return -ENODEV;
}
else if (count < 0) {
} else if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC entry\n");
/* TBD: Cleanup to allow fallback to MPS */
return count;
}
count = acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */
@@ -753,8 +740,7 @@ acpi_parse_madt_lapic_entries(void)
* Parse IOAPIC related entries in MADT
* returns 0 on success, < 0 on error
*/
static int __init
acpi_parse_madt_ioapic_entries(void)
static int __init acpi_parse_madt_ioapic_entries(void)
{
int count;
@@ -777,19 +763,23 @@ acpi_parse_madt_ioapic_entries(void)
return -ENODEV;
}
count = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, MAX_IO_APICS);
count =
acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,
MAX_IO_APICS);
if (!count) {
printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
return -ENODEV;
}
else if (count < 0) {
} else if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing IOAPIC entry\n");
return count;
}
count = acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, NR_IRQ_VECTORS);
count =
acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,
NR_IRQ_VECTORS);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
printk(KERN_ERR PREFIX
"Error parsing interrupt source overrides entry\n");
/* TBD: Cleanup to allow fallback to MPS */
return count;
}
@@ -804,7 +794,9 @@ acpi_parse_madt_ioapic_entries(void)
/* Fill in identity legacy mapings where no override */
mp_config_acpi_legacy_irqs();
count = acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, NR_IRQ_VECTORS);
count =
acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,
NR_IRQ_VECTORS);
if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
/* TBD: Cleanup to allow fallback to MPS */
@@ -820,9 +812,7 @@ static inline int acpi_parse_madt_ioapic_entries(void)
}
#endif /* !(CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER) */
static void __init
acpi_process_madt(void)
static void __init acpi_process_madt(void)
{
#ifdef CONFIG_X86_LOCAL_APIC
int count, error;
@@ -854,7 +844,8 @@ acpi_process_madt(void)
/*
* Dell Precision Workstation 410, 610 come here.
*/
printk(KERN_ERR PREFIX "Invalid BIOS MADT, disabling ACPI\n");
printk(KERN_ERR PREFIX
"Invalid BIOS MADT, disabling ACPI\n");
disable_acpi();
}
}
@@ -906,7 +897,8 @@ static int __init dmi_disable_acpi(struct dmi_system_id *d)
static int __init force_acpi_ht(struct dmi_system_id *d)
{
if (!acpi_force) {
printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident);
printk(KERN_NOTICE "%s detected: force use of acpi=ht\n",
d->ident);
disable_acpi();
acpi_ht = 1;
} else {
@@ -1044,7 +1036,8 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC"),
DMI_MATCH(DMI_BOARD_NAME, "<A7V>"),
/* newer BIOS, Revision 1011, does work */
DMI_MATCH(DMI_BIOS_VERSION, "ASUS A7V ACPI BIOS Revision 1007"),
DMI_MATCH(DMI_BIOS_VERSION,
"ASUS A7V ACPI BIOS Revision 1007"),
},
},
@@ -1057,7 +1050,8 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_BOARD_NAME, "PR-DLS"),
DMI_MATCH(DMI_BIOS_VERSION, "ASUS PR-DLS ACPI BIOS Revision 1010"),
DMI_MATCH(DMI_BIOS_VERSION,
"ASUS PR-DLS ACPI BIOS Revision 1010"),
DMI_MATCH(DMI_BIOS_DATE, "03/21/2003")
},
},
@@ -1098,8 +1092,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
* !0: failure
*/
int __init
acpi_boot_table_init(void)
int __init acpi_boot_table_init(void)
{
int error;
@@ -1122,7 +1115,6 @@ acpi_boot_table_init(void)
disable_acpi();
return error;
}
#ifdef __i386__
check_acpi_pci();
#endif
@@ -1146,7 +1138,6 @@ acpi_boot_table_init(void)
return 0;
}
int __init acpi_boot_init(void)
{
/*
@@ -1172,4 +1163,3 @@ int __init acpi_boot_init(void)
return 0;
}

View File

@@ -24,7 +24,8 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
{
int pgd_ofs = 0;
while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
while ((pgd_ofs < pgd_limit)
&& (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
pgd_ofs++, pgd++;
}
@@ -42,7 +43,8 @@ int acpi_save_state_mem (void)
if (!acpi_wakeup_address)
return 1;
init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
memcpy((void *)acpi_wakeup_address, &wakeup_start,
&wakeup_end - &wakeup_start);
acpi_copy_wakeup_routine(acpi_wakeup_address);
return 0;
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
void __init acpi_reserve_bootmem(void)
{
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
printk(KERN_ERR "ACPI: Wakeup code way too big, S3 disabled.\n");
printk(KERN_ERR
"ACPI: Wakeup code way too big, S3 disabled.\n");
return;
}
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
return 1;
}
__setup("acpi_sleep=", acpi_sleep_setup);
static __init int reset_videomode_after_s3(struct dmi_system_id *d)
{
acpi_video_flags |= 2;

View File

@@ -50,7 +50,9 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
if (!info->data)
return AE_NO_MEMORY;
memcpy(info->data, vendor->reserved + sizeof(struct acpi_vendor_descriptor), length);
memcpy(info->data,
vendor->reserved + sizeof(struct acpi_vendor_descriptor),
length);
info->length = length;
return AE_CTRL_TERMINATE;
}
@@ -64,7 +66,8 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
info.descriptor = id;
info.data = NULL;
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match, &info);
acpi_walk_resources(obj, METHOD_NAME__CRS, acpi_vendor_resource_match,
&info);
if (!info.data)
return AE_NOT_FOUND;
@@ -75,17 +78,19 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
struct acpi_vendor_descriptor hp_ccsr_descriptor = {
.guid_id = 2,
.guid = EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01, 0x37, 0x0e, 0xad)
.guid =
EFI_GUID(0x69e9adf9, 0x924f, 0xab5f, 0xf6, 0x4a, 0x24, 0xd2, 0x01,
0x37, 0x0e, 0xad)
};
acpi_status
hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
{
acpi_status status;
u8 *data;
u32 length;
status = acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
status =
acpi_find_vendor_resource(obj, &hp_ccsr_descriptor, &data, &length);
if (ACPI_FAILURE(status) || length != 16)
return AE_NOT_FOUND;

View File

@@ -74,12 +74,11 @@ unsigned int acpi_cpei_override;
unsigned int acpi_cpei_phys_cpuid;
#define MAX_SAPICS 256
u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
{ [0 ... MAX_SAPICS - 1] = -1 };
u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0...MAX_SAPICS - 1] = -1 };
EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
const char *
acpi_get_sysname (void)
const char *acpi_get_sysname(void)
{
#ifdef CONFIG_IA64_GENERIC
unsigned long rsdp_phys;
@@ -89,27 +88,29 @@ acpi_get_sysname (void)
rsdp_phys = acpi_find_rsdp();
if (!rsdp_phys) {
printk(KERN_ERR "ACPI 2.0 RSDP not found, default to \"dig\"\n");
printk(KERN_ERR
"ACPI 2.0 RSDP not found, default to \"dig\"\n");
return "dig";
}
rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys);
if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
printk(KERN_ERR "ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
printk(KERN_ERR
"ACPI 2.0 RSDP signature incorrect, default to \"dig\"\n");
return "dig";
}
xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
hdr = &xsdt->header;
if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
printk(KERN_ERR "ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
printk(KERN_ERR
"ACPI 2.0 XSDT signature incorrect, default to \"dig\"\n");
return "dig";
}
if (!strcmp(hdr->oem_id, "HP")) {
return "hpzx1";
}
else if (!strcmp(hdr->oem_id, "SGI")) {
} else if (!strcmp(hdr->oem_id, "SGI")) {
return "sn2";
}
@@ -146,8 +147,7 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
* Interrupt routing API for device drivers. Provides interrupt vector for
* a generic platform event. Currently only CPEI is implemented.
*/
int
acpi_request_vector (u32 int_type)
int acpi_request_vector(u32 int_type)
{
int vector = -1;
@@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type)
/* corrected platform error interrupt */
vector = platform_intr_list[int_type];
} else
printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
printk(KERN_ERR
"acpi_request_vector(): invalid interrupt type\n");
return vector;
}
char *
__acpi_map_table (unsigned long phys_addr, unsigned long size)
char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
{
return __va(phys_addr);
}
@@ -174,10 +174,9 @@ static int available_cpus __initdata;
struct acpi_table_madt *acpi_madt __initdata;
static u8 has_8259;
static int __init
acpi_parse_lapic_addr_ovr (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_lapic_addr_ovr *lapic;
@@ -193,7 +192,6 @@ acpi_parse_lapic_addr_ovr (
return 0;
}
static int __init
acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
{
@@ -206,9 +204,11 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
if (lsapic->flags.enabled) {
#ifdef CONFIG_SMP
smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
smp_boot_data.cpu_phys_id[available_cpus] =
(lsapic->id << 8) | lsapic->eid;
#endif
ia64_acpiid_to_sapicid[lsapic->acpi_id] = (lsapic->id << 8) | lsapic->eid;
ia64_acpiid_to_sapicid[lsapic->acpi_id] =
(lsapic->id << 8) | lsapic->eid;
++available_cpus;
}
@@ -216,7 +216,6 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
return 0;
}
static int __init
acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
{
@@ -231,7 +230,6 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
return 0;
}
static int __init
acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
{
@@ -245,10 +243,9 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
return iosapic_init(iosapic->address, iosapic->global_irq_base);
}
static int __init
acpi_parse_plat_int_src (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_plat_int_src(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_plat_int_src *plintsrc;
int vector;
@@ -267,8 +264,12 @@ acpi_parse_plat_int_src (
plintsrc->iosapic_vector,
plintsrc->eid,
plintsrc->id,
(plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
(plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
(plintsrc->flags.polarity ==
1) ? IOSAPIC_POL_HIGH :
IOSAPIC_POL_LOW,
(plintsrc->flags.trigger ==
1) ? IOSAPIC_EDGE :
IOSAPIC_LEVEL);
platform_intr_list[plintsrc->type] = vector;
if (acpi_madt_rev > 1) {
@@ -283,7 +284,6 @@ acpi_parse_plat_int_src (
return 0;
}
unsigned int can_cpei_retarget(void)
{
extern int cpe_vector;
@@ -322,8 +322,8 @@ unsigned int get_cpei_target_cpu(void)
}
static int __init
acpi_parse_int_src_ovr (
acpi_table_entry_header *header, const unsigned long end)
acpi_parse_int_src_ovr(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_int_src_ovr *p;
@@ -333,12 +333,13 @@ acpi_parse_int_src_ovr (
return -EINVAL;
iosapic_override_isa_irq(p->bus_irq, p->global_irq,
(p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
(p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
(p->flags.polarity ==
1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
(p->flags.trigger ==
1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
return 0;
}
static int __init
acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
{
@@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
return 0;
}
static void __init
acpi_madt_oem_check (char *oem_id, char *oem_table_id)
static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
{
if (!strncmp(oem_id, "IBM", 3) &&
(!strncmp(oem_table_id, "SERMOW", 6))) {
if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
/*
* Unfortunately ITC_DRIFT is not yet part of the
@@ -370,8 +369,7 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id)
}
}
static int __init
acpi_parse_madt (unsigned long phys_addr, unsigned long size)
static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
{
if (!phys_addr || !size)
return -EINVAL;
@@ -401,7 +399,6 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
return 0;
}
#ifdef CONFIG_ACPI_NUMA
#undef SLIT_DEBUG
@@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table;
* ACPI 2.0 SLIT (System Locality Information Table)
* http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
*/
void __init
acpi_numa_slit_init (struct acpi_table_slit *slit)
void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
{
u32 len;
len = sizeof(struct acpi_table_header) + 8
+ slit->localities * slit->localities;
if (slit->header.length != len) {
printk(KERN_ERR "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
printk(KERN_ERR
"ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
len, slit->header.length);
memset(numa_slit, 10, sizeof(numa_slit));
return;
@@ -443,7 +440,8 @@ acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa)
/* record this node in proximity bitmap */
pxm_bit_set(pa->proximity_domain);
node_cpuid[srat_num_cpus].phys_id = (pa->apic_id << 8) | (pa->lsapic_eid);
node_cpuid[srat_num_cpus].phys_id =
(pa->apic_id << 8) | (pa->lsapic_eid);
/* nid should be overridden as logical node id later */
node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
srat_num_cpus++;
@@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
num_node_memblks++;
}
void __init
acpi_numa_arch_fixup (void)
void __init acpi_numa_arch_fixup(void)
{
int i, j, node_from, node_to;
@@ -534,10 +531,13 @@ acpi_numa_arch_fixup (void)
for (i = 0; i < srat_num_cpus; i++)
node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes());
printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
printk(KERN_INFO "Number of logical nodes in system = %d\n",
num_online_nodes());
printk(KERN_INFO "Number of memory chunks in system = %d\n",
num_node_memblks);
if (!slit_table) return;
if (!slit_table)
return;
memset(numa_slit, -1, sizeof(numa_slit));
for (i = 0; i < slit_table->localities; i++) {
if (!pxm_bit_test(i))
@@ -567,29 +567,32 @@ acpi_numa_arch_fixup (void)
* success: return IRQ number (>=0)
* failure: return < 0
*/
int
acpi_register_gsi (u32 gsi, int edge_level, int active_high_low)
int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
{
if (has_8259 && gsi < 16)
return isa_irq_to_vector(gsi);
return iosapic_register_intr(gsi,
(active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
(edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
(active_high_low ==
ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
IOSAPIC_POL_LOW,
(edge_level ==
ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
IOSAPIC_LEVEL);
}
EXPORT_SYMBOL(acpi_register_gsi);
#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
void
acpi_unregister_gsi (u32 gsi)
void acpi_unregister_gsi(u32 gsi)
{
iosapic_unregister_intr(gsi);
}
EXPORT_SYMBOL(acpi_unregister_gsi);
#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
static int __init
acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
{
struct acpi_table_header *fadt_header;
struct fadt_descriptor_rev2 *fadt;
@@ -613,22 +616,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
return 0;
}
unsigned long __init
acpi_find_rsdp (void)
unsigned long __init acpi_find_rsdp(void)
{
unsigned long rsdp_phys = 0;
if (efi.acpi20)
rsdp_phys = __pa(efi.acpi20);
else if (efi.acpi)
printk(KERN_WARNING PREFIX "v1.0/r0.71 tables no longer supported\n");
printk(KERN_WARNING PREFIX
"v1.0/r0.71 tables no longer supported\n");
return rsdp_phys;
}
int __init
acpi_boot_init (void)
int __init acpi_boot_init(void)
{
/*
@@ -646,27 +646,39 @@ acpi_boot_init (void)
/* Local APIC */
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
if (acpi_table_parse_madt
(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
printk(KERN_ERR PREFIX
"Error parsing LAPIC address override entry\n");
if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) < 1)
printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS)
< 1)
printk(KERN_ERR PREFIX
"Error parsing MADT - no LAPIC entries\n");
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) < 0)
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0)
< 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* I/O APIC */
if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
if (acpi_table_parse_madt
(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
printk(KERN_ERR PREFIX
"Error parsing MADT - no IOSAPIC entries\n");
/* System-Level Interrupt Routing */
if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
if (acpi_table_parse_madt
(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src,
ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
printk(KERN_ERR PREFIX
"Error parsing platform interrupt source entry\n");
if (acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
if (acpi_table_parse_madt
(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0)
printk(KERN_ERR PREFIX
"Error parsing interrupt source overrides entry\n");
if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
@@ -685,7 +697,8 @@ acpi_boot_init (void)
if (available_cpus == 0) {
printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id();
smp_boot_data.cpu_phys_id[available_cpus] =
hard_smp_processor_id();
available_cpus = 1; /* We've got at least one of these, no? */
}
smp_boot_data.cpu_count = available_cpus;
@@ -695,8 +708,10 @@ acpi_boot_init (void)
if (srat_num_cpus == 0) {
int cpu, i = 1;
for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
if (smp_boot_data.cpu_phys_id[cpu] !=
hard_smp_processor_id())
node_cpuid[i++].phys_id =
smp_boot_data.cpu_phys_id[cpu];
}
# endif
#endif
@@ -704,12 +719,12 @@ acpi_boot_init (void)
build_cpu_to_node_map();
#endif
/* Make boot-up look pretty */
printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
total_cpus);
return 0;
}
int
acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
{
int vector;
@@ -730,8 +745,7 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
*/
#ifdef CONFIG_ACPI_HOTPLUG_CPU
static
int
acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
{
#ifdef CONFIG_ACPI_NUMA
int pxm_id;
@@ -742,17 +756,14 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
* Assuming that the container driver would have set the proximity
* domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
*/
node_cpuid[cpu].nid = (pxm_id < 0) ? 0:
pxm_to_nid_map[pxm_id];
node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
node_cpuid[cpu].phys_id = physid;
#endif
return (0);
}
int
acpi_map_lsapic(acpi_handle handle, int *pcpu)
int acpi_map_lsapic(acpi_handle handle, int *pcpu)
{
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
@@ -802,11 +813,10 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
*pcpu = cpu;
return (0);
}
EXPORT_SYMBOL(acpi_map_lsapic);
int
acpi_unmap_lsapic(int cpu)
int acpi_unmap_lsapic(int cpu)
{
int i;
@@ -825,10 +835,10 @@ acpi_unmap_lsapic(int cpu)
return (0);
}
EXPORT_SYMBOL(acpi_unmap_lsapic);
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
#ifdef CONFIG_ACPI_NUMA
acpi_status __devinit
acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
@@ -884,8 +894,7 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
}
#endif /* CONFIG_NUMA */
int
acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
{
int err;
@@ -898,13 +907,14 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
return 0;
}
EXPORT_SYMBOL(acpi_register_ioapic);
int
acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base)
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
{
return iosapic_remove(gsi_base);
}
EXPORT_SYMBOL(acpi_unregister_ioapic);
#endif /* CONFIG_ACPI_BOOT */

View File

@@ -47,7 +47,6 @@
#include <asm/proto.h>
#include <asm/tlbflush.h>
/* --------------------------------------------------------------------------
Low-Level Sleep Support
-------------------------------------------------------------------------- */
@@ -81,7 +80,8 @@ int acpi_save_state_mem (void)
{
init_low_mapping();
memcpy((void *) acpi_wakeup_address, &wakeup_start, &wakeup_end - &wakeup_start);
memcpy((void *)acpi_wakeup_address, &wakeup_start,
&wakeup_end - &wakeup_start);
acpi_copy_wakeup_routine(acpi_wakeup_address);
return 0;
@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
{
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE)
printk(KERN_CRIT "ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
printk(KERN_CRIT
"ACPI: Wakeup code way too big, will crash on attempt to suspend\n");
}
static int __init acpi_sleep_setup(char *str)
@@ -129,4 +130,6 @@ __setup("acpi_sleep=", acpi_sleep_setup);
#endif /*CONFIG_ACPI_SLEEP */
void acpi_pci_link_exit(void) {}
void acpi_pci_link_exit(void)
{
}

View File

@@ -32,7 +32,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_AC_COMPONENT 0x00020000
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_AC_HID "ACPI0003"
@@ -81,9 +80,7 @@ static struct file_operations acpi_ac_fops = {
AC Adapter Management
-------------------------------------------------------------------------- */
static int
acpi_ac_get_state (
struct acpi_ac *ac)
static int acpi_ac_get_state(struct acpi_ac *ac)
{
acpi_status status = AE_OK;
@@ -103,7 +100,6 @@ acpi_ac_get_state (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
@@ -145,9 +141,7 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
}
static int
acpi_ac_add_fs (
struct acpi_device *device)
static int acpi_ac_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
@@ -177,16 +171,12 @@ acpi_ac_add_fs (
return_VALUE(0);
}
static int
acpi_ac_remove_fs (
struct acpi_device *device)
static int acpi_ac_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_AC_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
acpi_device_dir(device) = NULL;
@@ -195,16 +185,11 @@ acpi_ac_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Model
-------------------------------------------------------------------------- */
static void
acpi_ac_notify (
acpi_handle handle,
u32 event,
void *data)
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_ac *ac = (struct acpi_ac *)data;
struct acpi_device *device = NULL;
@@ -231,10 +216,7 @@ acpi_ac_notify (
return_VOID;
}
static int
acpi_ac_add (
struct acpi_device *device)
static int acpi_ac_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
@@ -264,7 +246,8 @@ acpi_ac_add (
goto end;
status = acpi_install_notify_handler(ac->handle,
ACPI_DEVICE_NOTIFY, acpi_ac_notify, ac);
ACPI_DEVICE_NOTIFY, acpi_ac_notify,
ac);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
@@ -285,11 +268,7 @@ end:
return_VALUE(result);
}
static int
acpi_ac_remove (
struct acpi_device *device,
int type)
static int acpi_ac_remove(struct acpi_device *device, int type)
{
acpi_status status = AE_OK;
struct acpi_ac *ac = NULL;
@@ -314,9 +293,7 @@ acpi_ac_remove (
return_VALUE(0);
}
static int __init
acpi_ac_init (void)
static int __init acpi_ac_init(void)
{
int result = 0;
@@ -336,9 +313,7 @@ acpi_ac_init (void)
return_VALUE(0);
}
static void __exit
acpi_ac_exit (void)
static void __exit acpi_ac_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_ac_exit");
@@ -349,6 +324,5 @@ acpi_ac_exit (void)
return_VOID;
}
module_init(acpi_ac_init);
module_exit(acpi_ac_exit);

View File

@@ -32,7 +32,6 @@
#include <linux/memory_hotplug.h>
#include <acpi/acpi_drivers.h>
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
#define ACPI_MEMORY_DEVICE_CLASS "memory"
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
@@ -78,7 +77,6 @@ struct acpi_memory_device {
u64 end_addr; /* Memory Range end physical addr */
};
static int
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
{
@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
status = acpi_get_parent(handle, &phandle);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error in acpi_get_parent\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
return_VALUE(-EINVAL);
}
@@ -147,8 +144,7 @@ acpi_memory_get_device(acpi_handle handle,
*/
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error in acpi_bus_add\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
return_VALUE(-EINVAL);
}
@@ -162,8 +158,7 @@ end:
return_VALUE(0);
}
static int
acpi_memory_check_device(struct acpi_memory_device *mem_device)
static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
{
unsigned long current_status;
@@ -185,8 +180,7 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
return_VALUE(0);
}
static int
acpi_memory_enable_device(struct acpi_memory_device *mem_device)
static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
{
int result;
@@ -209,8 +203,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
(mem_device->end_addr - mem_device->start_addr) + 1,
mem_device->read_write_attribute);
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"\nadd_memory failed\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
mem_device->state = MEMORY_INVALID_STATE;
return result;
}
@@ -218,8 +211,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
return result;
}
static int
acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
{
acpi_status status;
struct acpi_object_list arg_list;
@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
return_VALUE(0);
}
static int
acpi_memory_disable_device(struct acpi_memory_device *mem_device)
static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
{
int result;
u64 start = mem_device->start_addr;
@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
return result;
}
static void
acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_memory_device *mem_device;
struct acpi_device *device;
@@ -355,8 +345,7 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
return_VOID;
}
static int
acpi_memory_device_add(struct acpi_device *device)
static int acpi_memory_device_add(struct acpi_device *device)
{
int result;
struct acpi_memory_device *mem_device = NULL;
@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
return_VALUE(result);
}
static int
acpi_memory_device_remove (struct acpi_device *device, int type)
static int acpi_memory_device_remove(struct acpi_device *device, int type)
{
struct acpi_memory_device *mem_device = NULL;
@@ -410,8 +398,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
/*
* Helper function to check for memory device
*/
static acpi_status
is_memory_device(acpi_handle handle)
static acpi_status is_memory_device(acpi_handle handle)
{
char *hardware_id;
acpi_status status;
@@ -475,7 +462,8 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
return_ACPI_STATUS(AE_OK); /* continue */
status = acpi_remove_notify_handler(handle,
ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify);
ACPI_SYSTEM_NOTIFY,
acpi_memory_device_notify);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n"));
@@ -485,8 +473,7 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
return_ACPI_STATUS(status);
}
static int __init
acpi_memory_device_init (void)
static int __init acpi_memory_device_init(void)
{
int result;
acpi_status status;
@@ -512,8 +499,7 @@ acpi_memory_device_init (void)
return_VALUE(0);
}
static void __exit
acpi_memory_device_exit (void)
static void __exit acpi_memory_device_exit(void)
{
acpi_status status;
@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
module_init(acpi_memory_device_init);
module_exit(acpi_memory_device_exit);

View File

@@ -75,7 +75,6 @@ MODULE_AUTHOR("Julien Lerouge, Karol Kozimor");
MODULE_DESCRIPTION(ACPI_HOTK_NAME);
MODULE_LICENSE("GPL");
static uid_t asus_uid;
static gid_t asus_gid;
module_param(asus_uid, uint, 0);
@@ -83,7 +82,6 @@ MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
module_param(asus_gid, uint, 0);
MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n");
/* For each model, all features implemented,
* those marked with R are relative to HOTK, A for absolute */
struct model_data {
@@ -171,8 +169,7 @@ static struct model_data model_conf[END_MODEL] = {
.mt_lcd_switch = A1x_PREFIX "_Q10",
.lcd_status = "\\BKLI",
.brightness_up = A1x_PREFIX "_Q0E",
.brightness_down = A1x_PREFIX "_Q0F"
},
.brightness_down = A1x_PREFIX "_Q0F"},
{
.name = "A2x",
@@ -184,8 +181,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "D1x",
@@ -196,8 +192,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_down = "\\Q0B",
.brightness_status = "\\BLVL",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "L2D",
@@ -210,8 +205,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_up = "\\Q0E",
.brightness_down = "\\Q0F",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "L3C",
@@ -222,8 +216,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"
},
.display_get = "\\_SB.PCI0.PCI1.VGAC.NMAP"},
{
.name = "L3D",
@@ -235,8 +228,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "L3H",
@@ -247,8 +239,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "L4R",
@@ -260,8 +251,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\_SB.PCI0.P0P1.VGA.GETD"
},
.display_get = "\\_SB.PCI0.P0P1.VGA.GETD"},
{
.name = "L5x",
@@ -273,8 +263,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "L8L"
@@ -290,8 +279,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_down = M1A_PREFIX "Q0F",
.brightness_status = "\\BRIT",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "M2E",
@@ -302,8 +290,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\INFB"
},
.display_get = "\\INFB"},
{
.name = "M6N",
@@ -315,8 +302,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\SSTE"
},
.display_get = "\\SSTE"},
{
.name = "M6R",
.mt_mled = "MLED",
@@ -326,9 +312,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\SSTE"
},
.display_get = "\\SSTE"},
{
.name = "P30",
@@ -339,8 +323,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_down = P30_PREFIX "_Q69",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\DNXT"
},
.display_get = "\\DNXT"},
{
.name = "S1x",
@@ -350,8 +333,7 @@ static struct model_data model_conf[END_MODEL] = {
.mt_lcd_switch = S1x_PREFIX "Q10",
.lcd_status = "\\PNOF",
.brightness_set = "SPLV",
.brightness_get = "GPLV"
},
.brightness_get = "GPLV"},
{
.name = "S2x",
@@ -360,8 +342,7 @@ static struct model_data model_conf[END_MODEL] = {
.mt_lcd_switch = S2x_PREFIX "_Q10",
.lcd_status = "\\BKLI",
.brightness_up = S2x_PREFIX "_Q0B",
.brightness_down = S2x_PREFIX "_Q0A"
},
.brightness_down = S2x_PREFIX "_Q0A"},
{
.name = "xxN",
@@ -372,8 +353,7 @@ static struct model_data model_conf[END_MODEL] = {
.brightness_set = "SPLV",
.brightness_get = "GPLV",
.display_set = "SDSP",
.display_get = "\\ADVG"
}
.display_get = "\\ADVG"}
};
/* procdir we use */
@@ -427,7 +407,6 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
return (status == AE_OK);
}
static int read_acpi_int(acpi_handle handle, const char *method, int *val)
{
struct acpi_buffer output;
@@ -469,7 +448,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
* The significance of others is yet to be found.
*/
if (read_acpi_int(hotk->handle, "SFUN", &temp))
len += sprintf(page + len, "SFUN value : 0x%04x\n", temp);
len +=
sprintf(page + len, "SFUN value : 0x%04x\n", temp);
/*
* Another value for userspace: the ASYM method returns 0x02 for
* battery low and 0x04 for battery critical, its readings tend to be
@@ -478,7 +458,8 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
* silently ignored.
*/
if (read_acpi_int(hotk->handle, "ASYM", &temp))
len += sprintf(page + len, "ASYM value : 0x%04x\n", temp);
len +=
sprintf(page + len, "ASYM value : 0x%04x\n", temp);
if (asus_info) {
snprintf(buf, 16, "%d", asus_info->length);
len += sprintf(page + len, "DSDT length : %s\n", buf);
@@ -501,7 +482,6 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
return len;
}
/*
* /proc handlers
* We write our info in page, we begin at offset off and cannot write more
@@ -510,8 +490,7 @@ proc_read_info(char *page, char **start, off_t off, int count, int *eof,
*/
/* Generic LED functions */
static int
read_led(const char *ledname, int ledmask)
static int read_led(const char *ledname, int ledmask)
{
if (ledname) {
int led_status;
@@ -559,12 +538,12 @@ write_led(const char __user *buffer, unsigned long count,
led_out = !led_out & 0x1;
if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", ledname);
printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
ledname);
return count;
}
/*
* Proc handlers for MLED
*/
@@ -572,10 +551,10 @@ static int
proc_read_mled(char *page, char **start, off_t off, int count, int *eof,
void *data)
{
return sprintf(page, "%d\n", read_led(hotk->methods->mled_status, MLED_ON));
return sprintf(page, "%d\n",
read_led(hotk->methods->mled_status, MLED_ON));
}
static int
proc_write_mled(struct file *file, const char __user * buffer,
unsigned long count, void *data)
@@ -590,7 +569,8 @@ static int
proc_read_wled(char *page, char **start, off_t off, int count, int *eof,
void *data)
{
return sprintf(page, "%d\n", read_led(hotk->methods->wled_status, WLED_ON));
return sprintf(page, "%d\n",
read_led(hotk->methods->wled_status, WLED_ON));
}
static int
@@ -607,7 +587,8 @@ static int
proc_read_tled(char *page, char **start, off_t off, int count, int *eof,
void *data)
{
return sprintf(page, "%d\n", read_led(hotk->methods->tled_status, TLED_ON));
return sprintf(page, "%d\n",
read_led(hotk->methods->tled_status, TLED_ON));
}
static int
@@ -617,7 +598,6 @@ proc_write_tled(struct file *file, const char __user *buffer,
return write_led(buffer, count, hotk->methods->mt_tled, TLED_ON, 0);
}
static int get_lcd_state(void)
{
int lcd = 0;
@@ -625,7 +605,8 @@ static int get_lcd_state(void)
if (hotk->model != L3H) {
/* We don't have to check anything if we are here */
if (!read_acpi_int(NULL, hotk->methods->lcd_status, &lcd))
printk(KERN_WARNING "Asus ACPI: Error reading LCD status\n");
printk(KERN_WARNING
"Asus ACPI: Error reading LCD status\n");
if (hotk->model == L2D)
lcd = ~lcd;
@@ -648,7 +629,9 @@ static int get_lcd_state(void)
output.length = sizeof(out_obj);
output.pointer = &out_obj;
status = acpi_evaluate_object(NULL, hotk->methods->lcd_status, &input, &output);
status =
acpi_evaluate_object(NULL, hotk->methods->lcd_status,
&input, &output);
if (status != AE_OK)
return -1;
if (out_obj.type == ACPI_TYPE_INTEGER)
@@ -669,10 +652,13 @@ static int set_lcd_state(int value)
/* switch */
if (hotk->model != L3H) {
status =
acpi_evaluate_object(NULL, hotk->methods->mt_lcd_switch,
acpi_evaluate_object(NULL,
hotk->methods->mt_lcd_switch,
NULL, NULL);
} else { /* L3H and the like have to be handled differently */
if (!write_acpi_int(hotk->handle, hotk->methods->mt_lcd_switch, 0x07, NULL))
if (!write_acpi_int
(hotk->handle, hotk->methods->mt_lcd_switch, 0x07,
NULL))
status = AE_ERROR;
/* L3H's AML executes EHK (0x07) upon Fn+F7 keypress,
the exact behaviour is simulated here */
@@ -691,7 +677,6 @@ proc_read_lcd(char *page, char **start, off_t off, int count, int *eof,
return sprintf(page, "%d\n", get_lcd_state());
}
static int
proc_write_lcd(struct file *file, const char __user * buffer,
unsigned long count, void *data)
@@ -704,7 +689,6 @@ proc_write_lcd(struct file *file, const char __user *buffer,
return count;
}
static int read_brightness(void)
{
int value;
@@ -712,11 +696,13 @@ static int read_brightness(void)
if (hotk->methods->brightness_get) { /* SPLV/GPLV laptop */
if (!read_acpi_int(hotk->handle, hotk->methods->brightness_get,
&value))
printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
printk(KERN_WARNING
"Asus ACPI: Error reading brightness\n");
} else if (hotk->methods->brightness_status) { /* For D1 for example */
if (!read_acpi_int(NULL, hotk->methods->brightness_status,
&value))
printk(KERN_WARNING "Asus ACPI: Error reading brightness\n");
printk(KERN_WARNING
"Asus ACPI: Error reading brightness\n");
} else /* No GPLV method */
value = hotk->brightness;
return value;
@@ -733,7 +719,8 @@ static void set_brightness(int value)
if (hotk->methods->brightness_set) {
if (!write_acpi_int(hotk->handle, hotk->methods->brightness_set,
value, NULL))
printk(KERN_WARNING "Asus ACPI: Error changing brightness\n");
printk(KERN_WARNING
"Asus ACPI: Error changing brightness\n");
return;
}
@@ -746,7 +733,8 @@ static void set_brightness(int value)
NULL, NULL);
(value > 0) ? value-- : value++;
if (ACPI_FAILURE(status))
printk(KERN_WARNING "Asus ACPI: Error changing brightness\n");
printk(KERN_WARNING
"Asus ACPI: Error changing brightness\n");
}
return;
}
@@ -796,7 +784,8 @@ proc_read_disp(char *page, char **start, off_t off, int count, int *eof,
int value = 0;
if (!read_acpi_int(hotk->handle, hotk->methods->display_get, &value))
printk(KERN_WARNING "Asus ACPI: Error reading display status\n");
printk(KERN_WARNING
"Asus ACPI: Error reading display status\n");
value &= 0x07; /* needed for some models, shouldn't hurt others */
return sprintf(page, "%d\n", value);
}
@@ -822,7 +811,6 @@ proc_write_disp(struct file *file, const char __user *buffer,
return count;
}
typedef int (proc_readfunc) (char *page, char **start, off_t off, int count,
int *eof, void *data);
typedef int (proc_writefunc) (struct file * file, const char __user * buffer,
@@ -833,7 +821,8 @@ __init asus_proc_add(char *name, proc_writefunc *writefunc,
proc_readfunc * readfunc, mode_t mode,
struct acpi_device *device)
{
struct proc_dir_entry *proc = create_proc_entry(name, mode, acpi_device_dir(device));
struct proc_dir_entry *proc =
create_proc_entry(name, mode, acpi_device_dir(device));
if (!proc) {
printk(KERN_WARNING " Unable to create %s fs entry\n", name);
return -1;
@@ -881,15 +870,18 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
}
if (hotk->methods->mt_wled) {
asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled, mode, device);
asus_proc_add(PROC_WLED, &proc_write_wled, &proc_read_wled,
mode, device);
}
if (hotk->methods->mt_mled) {
asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled, mode, device);
asus_proc_add(PROC_MLED, &proc_write_mled, &proc_read_mled,
mode, device);
}
if (hotk->methods->mt_tled) {
asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled, mode, device);
asus_proc_add(PROC_TLED, &proc_write_tled, &proc_read_tled,
mode, device);
}
/*
@@ -897,16 +889,19 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
* from keyboard
*/
if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status) {
asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode, device);
asus_proc_add(PROC_LCD, &proc_write_lcd, &proc_read_lcd, mode,
device);
}
if ((hotk->methods->brightness_up && hotk->methods->brightness_down) ||
(hotk->methods->brightness_get && hotk->methods->brightness_set)) {
asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode, device);
asus_proc_add(PROC_BRN, &proc_write_brn, &proc_read_brn, mode,
device);
}
if (hotk->methods->display_set) {
asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp, mode, device);
asus_proc_add(PROC_DISP, &proc_write_disp, &proc_read_disp,
mode, device);
}
return 0;
@@ -924,8 +919,10 @@ static int asus_hotk_remove_fs(struct acpi_device* device)
remove_proc_entry(PROC_TLED, acpi_device_dir(device));
if (hotk->methods->mt_lcd_switch && hotk->methods->lcd_status)
remove_proc_entry(PROC_LCD, acpi_device_dir(device));
if ((hotk->methods->brightness_up && hotk->methods->brightness_down) ||
(hotk->methods->brightness_get && hotk->methods->brightness_set))
if ((hotk->methods->brightness_up
&& hotk->methods->brightness_down)
|| (hotk->methods->brightness_get
&& hotk->methods->brightness_set))
remove_proc_entry(PROC_BRN, acpi_device_dir(device));
if (hotk->methods->display_set)
remove_proc_entry(PROC_DISP, acpi_device_dir(device));
@@ -933,7 +930,6 @@ static int asus_hotk_remove_fs(struct acpi_device* device)
return 0;
}
static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
{
/* TODO Find a better way to handle events count. */
@@ -988,7 +984,8 @@ static int __init asus_hotk_get_info(void)
if (!read_acpi_int(hotk->handle, "BSTS", &bsts_result))
printk(KERN_WARNING " Error calling BSTS\n");
else if (bsts_result)
printk(KERN_NOTICE " BSTS called, 0x%02x returned\n", bsts_result);
printk(KERN_NOTICE " BSTS called, 0x%02x returned\n",
bsts_result);
/* Samsung P30 has a device with a valid _HID whose INIT does not
* return anything. Catch this one and any similar here */
@@ -996,7 +993,8 @@ static int __init asus_hotk_get_info(void)
if (asus_info && /* Samsung P30 */
strncmp(asus_info->oem_table_id, "ODEM", 4) == 0) {
hotk->model = P30;
printk(KERN_NOTICE " Samsung P30 detected, supported\n");
printk(KERN_NOTICE
" Samsung P30 detected, supported\n");
} else {
hotk->model = M2E;
printk(KERN_WARNING " no string returned by INIT\n");
@@ -1009,7 +1007,8 @@ static int __init asus_hotk_get_info(void)
model = (union acpi_object *)buffer.pointer;
if (model->type == ACPI_TYPE_STRING) {
printk(KERN_NOTICE " %s model detected, ", model->string.pointer);
printk(KERN_NOTICE " %s model detected, ",
model->string.pointer);
}
hotk->model = END_MODEL;
@@ -1091,7 +1090,6 @@ static int __init asus_hotk_get_info(void)
return AE_OK;
}
static int __init asus_hotk_check(void)
{
int result = 0;
@@ -1110,7 +1108,6 @@ static int __init asus_hotk_check(void)
return result;
}
static int __init asus_hotk_add(struct acpi_device *device)
{
acpi_status status = AE_OK;
@@ -1134,7 +1131,6 @@ static int __init asus_hotk_add(struct acpi_device *device)
acpi_driver_data(device) = hotk;
hotk->device = device;
result = asus_hotk_check();
if (result)
goto end;
@@ -1153,14 +1149,19 @@ static int __init asus_hotk_add(struct acpi_device *device)
printk(KERN_ERR " Error installing notify handler\n");
/* For laptops without GPLV: init the hotk->brightness value */
if ((!hotk->methods->brightness_get) && (!hotk->methods->brightness_status) &&
(hotk->methods->brightness_up && hotk->methods->brightness_down)) {
status = acpi_evaluate_object(NULL, hotk->methods->brightness_down,
if ((!hotk->methods->brightness_get)
&& (!hotk->methods->brightness_status)
&& (hotk->methods->brightness_up
&& hotk->methods->brightness_down)) {
status =
acpi_evaluate_object(NULL, hotk->methods->brightness_down,
NULL, NULL);
if (ACPI_FAILURE(status))
printk(KERN_WARNING " Error changing brightness\n");
else {
status = acpi_evaluate_object(NULL, hotk->methods->brightness_up,
status =
acpi_evaluate_object(NULL,
hotk->methods->brightness_up,
NULL, NULL);
if (ACPI_FAILURE(status))
printk(KERN_WARNING " Strange, error changing"
@@ -1176,7 +1177,6 @@ static int __init asus_hotk_add(struct acpi_device *device)
return result;
}
static int asus_hotk_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
@@ -1196,7 +1196,6 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
return 0;
}
static int __init asus_acpi_init(void)
{
int result;
@@ -1225,7 +1224,6 @@ static int __init asus_acpi_init(void)
return 0;
}
static void __exit asus_acpi_exit(void)
{
acpi_bus_unregister_driver(&asus_hotk_driver);

View File

@@ -34,7 +34,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
#define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS"
@@ -53,7 +52,6 @@
#define ACPI_BATTERY_UNITS_WATTS "mW"
#define ACPI_BATTERY_UNITS_AMPS "mA"
#define _COMPONENT ACPI_BATTERY_COMPONENT
ACPI_MODULE_NAME("acpi_battery")
@@ -117,21 +115,20 @@ struct acpi_battery {
struct acpi_battery_info *info;
};
/* --------------------------------------------------------------------------
Battery Management
-------------------------------------------------------------------------- */
static int
acpi_battery_get_info (
struct acpi_battery *battery,
acpi_battery_get_info(struct acpi_battery *battery,
struct acpi_battery_info **bif)
{
int result = 0;
acpi_status status = 0;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BIF),
ACPI_BATTERY_FORMAT_BIF};
ACPI_BATTERY_FORMAT_BIF
};
struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL;
@@ -184,15 +181,15 @@ end:
}
static int
acpi_battery_get_status (
struct acpi_battery *battery,
acpi_battery_get_status(struct acpi_battery *battery,
struct acpi_battery_status **bst)
{
int result = 0;
acpi_status status = 0;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
struct acpi_buffer format = { sizeof(ACPI_BATTERY_FORMAT_BST),
ACPI_BATTERY_FORMAT_BST};
ACPI_BATTERY_FORMAT_BST
};
struct acpi_buffer data = { 0, NULL };
union acpi_object *package = NULL;
@@ -244,11 +241,8 @@ end:
return_VALUE(result);
}
static int
acpi_battery_set_alarm (
struct acpi_battery *battery,
unsigned long alarm)
acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
{
acpi_status status = 0;
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
@@ -275,10 +269,7 @@ acpi_battery_set_alarm (
return_VALUE(0);
}
static int
acpi_battery_check (
struct acpi_battery *battery)
static int acpi_battery_check(struct acpi_battery *battery)
{
int result = 0;
acpi_status status = AE_OK;
@@ -336,7 +327,6 @@ acpi_battery_check (
return_VALUE(result);
}
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
@@ -369,7 +359,9 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
goto end;
}
units = bif->power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
units =
bif->
power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
seq_printf(seq, "design capacity: unknown\n");
@@ -409,14 +401,10 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
(u32) bif->battery_capacity_granularity_1, units);
seq_printf(seq, "capacity granularity 2: %d %sh\n",
(u32) bif->battery_capacity_granularity_2, units);
seq_printf(seq, "model number: %s\n",
bif->model_number);
seq_printf(seq, "serial number: %s\n",
bif->serial_number);
seq_printf(seq, "battery type: %s\n",
bif->battery_type);
seq_printf(seq, "OEM info: %s\n",
bif->oem_info);
seq_printf(seq, "model number: %s\n", bif->model_number);
seq_printf(seq, "serial number: %s\n", bif->serial_number);
seq_printf(seq, "battery type: %s\n", bif->battery_type);
seq_printf(seq, "OEM info: %s\n", bif->oem_info);
end:
kfree(bif);
@@ -429,9 +417,7 @@ static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_battery_read_info, PDE(inode)->data);
}
static int
acpi_battery_read_state (struct seq_file *seq, void *offset)
static int acpi_battery_read_state(struct seq_file *seq, void *offset)
{
int result = 0;
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
@@ -452,7 +438,9 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
/* Battery Units */
units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
units =
battery->flags.
power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
/* Battery Status (_BST) */
@@ -468,11 +456,11 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
seq_printf(seq, "capacity state: critical\n");
if ((bst->state & 0x01) && (bst->state & 0x02)) {
seq_printf(seq, "charging state: charging/discharging\n");
seq_printf(seq,
"charging state: charging/discharging\n");
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Battery Charging and Discharging?\n"));
}
else if (bst->state & 0x01)
} else if (bst->state & 0x01)
seq_printf(seq, "charging state: discharging\n");
else if (bst->state & 0x02)
seq_printf(seq, "charging state: charging\n");
@@ -509,9 +497,7 @@ static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
return single_open(file, acpi_battery_read_state, PDE(inode)->data);
}
static int
acpi_battery_read_alarm (struct seq_file *seq, void *offset)
static int acpi_battery_read_alarm(struct seq_file *seq, void *offset)
{
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
char *units = "?";
@@ -528,7 +514,9 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
/* Battery Units */
units = battery->flags.power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
units =
battery->flags.
power_unit ? ACPI_BATTERY_UNITS_AMPS : ACPI_BATTERY_UNITS_WATTS;
/* Battery Alarm */
@@ -542,13 +530,10 @@ end:
return_VALUE(0);
}
static ssize_t
acpi_battery_write_alarm (
struct file *file,
acpi_battery_write_alarm(struct file *file,
const char __user * buffer,
size_t count,
loff_t *ppos)
size_t count, loff_t * ppos)
{
int result = 0;
char alarm_string[12] = { '\0' };
@@ -606,9 +591,7 @@ static struct file_operations acpi_battery_alarm_ops = {
.owner = THIS_MODULE,
};
static int
acpi_battery_add_fs (
struct acpi_device *device)
static int acpi_battery_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
@@ -650,7 +633,8 @@ acpi_battery_add_fs (
/* 'alarm' [R/W] */
entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM,
S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
@@ -664,10 +648,7 @@ acpi_battery_add_fs (
return_VALUE(0);
}
static int
acpi_battery_remove_fs (
struct acpi_device *device)
static int acpi_battery_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
@@ -686,16 +667,11 @@ acpi_battery_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static void
acpi_battery_notify (
acpi_handle handle,
u32 event,
void *data)
static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_battery *battery = (struct acpi_battery *)data;
struct acpi_device *device = NULL;
@@ -723,10 +699,7 @@ acpi_battery_notify (
return_VOID;
}
static int
acpi_battery_add (
struct acpi_device *device)
static int acpi_battery_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = 0;
@@ -756,7 +729,8 @@ acpi_battery_add (
goto end;
status = acpi_install_notify_handler(battery->handle,
ACPI_DEVICE_NOTIFY, acpi_battery_notify, battery);
ACPI_DEVICE_NOTIFY,
acpi_battery_notify, battery);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error installing notify handler\n"));
@@ -777,11 +751,7 @@ end:
return_VALUE(result);
}
static int
acpi_battery_remove (
struct acpi_device *device,
int type)
static int acpi_battery_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
struct acpi_battery *battery = NULL;
@@ -794,7 +764,8 @@ acpi_battery_remove (
battery = (struct acpi_battery *)acpi_driver_data(device);
status = acpi_remove_notify_handler(battery->handle,
ACPI_DEVICE_NOTIFY, acpi_battery_notify);
ACPI_DEVICE_NOTIFY,
acpi_battery_notify);
if (ACPI_FAILURE(status))
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error removing notify handler\n"));
@@ -806,9 +777,7 @@ acpi_battery_remove (
return_VALUE(0);
}
static int __init
acpi_battery_init (void)
static int __init acpi_battery_init(void)
{
int result = 0;
@@ -828,9 +797,7 @@ acpi_battery_init (void)
return_VALUE(0);
}
static void __exit
acpi_battery_exit (void)
static void __exit acpi_battery_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_battery_exit");
@@ -841,6 +808,5 @@ acpi_battery_exit (void)
return_VOID;
}
module_init(acpi_battery_init);
module_exit(acpi_battery_exit);

View File

@@ -26,7 +26,6 @@
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -34,16 +33,14 @@
#include <acpi/acpi_bus.h>
#include <linux/dmi.h>
enum acpi_blacklist_predicates
{
enum acpi_blacklist_predicates {
all_versions,
less_than_or_equal,
equal,
greater_than_or_equal,
};
struct acpi_blacklist_item
{
struct acpi_blacklist_item {
char oem_id[7];
char oem_table_id[9];
u32 oem_revision;
@@ -57,26 +54,28 @@ struct acpi_blacklist_item
* POLICY: If *anything* doesn't work, put it on the blacklist.
* If they are critical errors, mark it critical, and abort driver load.
*/
static struct acpi_blacklist_item acpi_blacklist[] __initdata =
{
static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
/* Compaq Presario 1700 */
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal, "Multiple problems", 1},
{"PTLTD ", " DSDT ", 0x06040000, ACPI_DSDT, less_than_or_equal,
"Multiple problems", 1},
/* Sony FX120, FX140, FX150? */
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal, "ACPI driver problem", 1},
{"SONY ", "U0 ", 0x20010313, ACPI_DSDT, less_than_or_equal,
"ACPI driver problem", 1},
/* Compaq Presario 800, Insyde BIOS */
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal, "Does not use _REG to protect EC OpRegions", 1},
{"INT440", "SYSFexxx", 0x00001001, ACPI_DSDT, less_than_or_equal,
"Does not use _REG to protect EC OpRegions", 1},
/* IBM 600E - _ADR should return 7, but it returns 1 */
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal,
"Incorrect _ADR", 1},
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions,
"Bogus PCI routing", 1},
{""}
};
#if CONFIG_ACPI_BLACKLIST_YEAR
static int __init
blacklist_by_year(void)
static int __init blacklist_by_year(void)
{
int year;
char *s = dmi_get_system_info(DMI_BIOS_DATE);
@@ -109,19 +108,21 @@ blacklist_by_year(void)
return 0;
}
#else
static inline int blacklist_by_year(void) { return 0; }
static inline int blacklist_by_year(void)
{
return 0;
}
#endif
int __init
acpi_blacklisted(void)
int __init acpi_blacklisted(void)
{
int i = 0;
int blacklisted = 0;
struct acpi_table_header *table_header;
while (acpi_blacklist[i].oem_id[0] != '\0')
{
if (acpi_get_table_header_early(acpi_blacklist[i].table, &table_header)) {
while (acpi_blacklist[i].oem_id[0] != '\0') {
if (acpi_get_table_header_early
(acpi_blacklist[i].table, &table_header)) {
i++;
continue;
}
@@ -131,33 +132,43 @@ acpi_blacklisted(void)
continue;
}
if (strncmp(acpi_blacklist[i].oem_table_id, table_header->oem_table_id, 8)) {
if (strncmp
(acpi_blacklist[i].oem_table_id, table_header->oem_table_id,
8)) {
i++;
continue;
}
if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
|| (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
&& table_header->oem_revision <= acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
&& table_header->oem_revision >= acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate ==
less_than_or_equal
&& table_header->oem_revision <=
acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate ==
greater_than_or_equal
&& table_header->oem_revision >=
acpi_blacklist[i].oem_revision)
|| (acpi_blacklist[i].oem_revision_predicate == equal
&& table_header->oem_revision == acpi_blacklist[i].oem_revision)) {
&& table_header->oem_revision ==
acpi_blacklist[i].oem_revision)) {
printk(KERN_ERR PREFIX "Vendor \"%6.6s\" System \"%8.8s\" "
printk(KERN_ERR PREFIX
"Vendor \"%6.6s\" System \"%8.8s\" "
"Revision 0x%x has a known ACPI BIOS problem.\n",
acpi_blacklist[i].oem_id,
acpi_blacklist[i].oem_table_id,
acpi_blacklist[i].oem_revision);
printk(KERN_ERR PREFIX "Reason: %s. This is a %s error\n",
printk(KERN_ERR PREFIX
"Reason: %s. This is a %s error\n",
acpi_blacklist[i].reason,
(acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
(acpi_blacklist[i].
is_critical_error ? "non-recoverable" :
"recoverable"));
blacklisted = acpi_blacklist[i].is_critical_error;
break;
}
else {
} else {
i++;
}
}
@@ -166,4 +177,3 @@ acpi_blacklisted(void)
return blacklisted;
}

View File

@@ -36,10 +36,8 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_BUS_COMPONENT
ACPI_MODULE_NAME("acpi_bus")
#ifdef CONFIG_X86
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
#endif
@@ -57,10 +55,7 @@ EXPORT_SYMBOL(acpi_root_dir);
Device Management
-------------------------------------------------------------------------- */
int
acpi_bus_get_device (
acpi_handle handle,
struct acpi_device **device)
int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
{
acpi_status status = AE_OK;
@@ -80,11 +75,10 @@ acpi_bus_get_device (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_get_device);
int
acpi_bus_get_status (
struct acpi_device *device)
int acpi_bus_get_status(struct acpi_device *device)
{
acpi_status status = AE_OK;
unsigned long sta = 0;
@@ -98,7 +92,8 @@ acpi_bus_get_status (
* Evaluate _STA if present.
*/
if (device->flags.dynamic_status) {
status = acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
status =
acpi_evaluate_integer(device->handle, "_STA", NULL, &sta);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
STRUCT_TO_INT(device->status) = (int)sta;
@@ -116,27 +111,24 @@ acpi_bus_get_status (
if (device->status.functional && !device->status.present) {
printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
"functional but not present; setting present\n",
device->pnp.bus_id,
(u32) STRUCT_TO_INT(device->status));
device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
device->status.present = 1;
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status)));
device->pnp.bus_id,
(u32) STRUCT_TO_INT(device->status)));
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_get_status);
EXPORT_SYMBOL(acpi_bus_get_status);
/* --------------------------------------------------------------------------
Power Management
-------------------------------------------------------------------------- */
int
acpi_bus_get_power (
acpi_handle handle,
int *state)
int acpi_bus_get_power(acpi_handle handle, int *state)
{
int result = 0;
acpi_status status = 0;
@@ -157,8 +149,7 @@ acpi_bus_get_power (
*state = device->parent->power.state;
else
*state = ACPI_STATE_D0;
}
else {
} else {
/*
* Get the device's power state either directly (via _PSC) or
* indirectly (via power resources).
@@ -169,8 +160,7 @@ acpi_bus_get_power (
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
device->power.state = (int)psc;
}
else if (device->power.flags.power_resources) {
} else if (device->power.flags.power_resources) {
result = acpi_power_get_inferred_state(device);
if (result)
return_VALUE(result);
@@ -184,13 +174,10 @@ acpi_bus_get_power (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_get_power);
int
acpi_bus_set_power (
acpi_handle handle,
int state)
int acpi_bus_set_power(acpi_handle handle, int state)
{
int result = 0;
acpi_status status = AE_OK;
@@ -209,7 +196,8 @@ acpi_bus_set_power (
/* Make sure this is a valid target state */
if (!device->flags.power_manageable) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device is not power manageable\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Device is not power manageable\n"));
return_VALUE(-ENODEV);
}
/*
@@ -219,15 +207,18 @@ acpi_bus_set_power (
if (device->power.state == ACPI_STATE_UNKNOWN)
acpi_bus_get_power(device->handle, &device->power.state);
if (state == device->power.state) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
state));
return_VALUE(0);
}
if (!device->power.states[state].flags.valid) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n", state));
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Device does not support D%d\n",
state));
return_VALUE(-ENODEV);
}
if (device->parent && (state < device->parent->power.state)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Cannot set device to a higher-powered state than parent\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Cannot set device to a higher-powered state than parent\n"));
return_VALUE(-ENODEV);
}
@@ -252,8 +243,7 @@ acpi_bus_set_power (
goto end;
}
}
}
else {
} else {
if (device->power.states[state].flags.explicit_set) {
status = acpi_evaluate_object(device->handle,
object_name, NULL, NULL);
@@ -271,18 +261,19 @@ acpi_bus_set_power (
end:
if (result)
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Error transitioning device [%s] to D%d\n",
device->pnp.bus_id, state));
else
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Device [%s] transitioned to D%d\n",
device->pnp.bus_id, state));
return_VALUE(result);
}
EXPORT_SYMBOL(acpi_bus_set_power);
/* --------------------------------------------------------------------------
Event Management
-------------------------------------------------------------------------- */
@@ -294,11 +285,7 @@ DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
extern int event_is_open;
int
acpi_bus_generate_event (
struct acpi_device *device,
u8 type,
int data)
int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
{
struct acpi_bus_event *event = NULL;
unsigned long flags = 0;
@@ -329,11 +316,10 @@ acpi_bus_generate_event (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_generate_event);
int
acpi_bus_receive_event (
struct acpi_bus_event *event)
int acpi_bus_receive_event(struct acpi_bus_event *event)
{
unsigned long flags = 0;
struct acpi_bus_event *entry = NULL;
@@ -361,7 +347,8 @@ acpi_bus_receive_event (
}
spin_lock_irqsave(&acpi_bus_event_lock, flags);
entry = list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
entry =
list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
if (entry)
list_del(&entry->node);
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
@@ -375,17 +362,15 @@ acpi_bus_receive_event (
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_bus_receive_event);
EXPORT_SYMBOL(acpi_bus_receive_event);
/* --------------------------------------------------------------------------
Notification Handling
-------------------------------------------------------------------------- */
static int
acpi_bus_check_device (
struct acpi_device *device,
int *status_changed)
acpi_bus_check_device(struct acpi_device *device, int *status_changed)
{
acpi_status status = 0;
struct acpi_device_status old_status;
@@ -429,8 +414,7 @@ acpi_bus_check_device (
if ((device->status.present) && !(old_status.present)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
/* TBD: Handle device insertion */
}
else if (!(device->status.present) && (old_status.present)) {
} else if (!(device->status.present) && (old_status.present)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
/* TBD: Handle device removal */
}
@@ -438,10 +422,7 @@ acpi_bus_check_device (
return_VALUE(0);
}
static int
acpi_bus_check_scope (
struct acpi_device *device)
static int acpi_bus_check_scope(struct acpi_device *device)
{
int result = 0;
int status_changed = 0;
@@ -467,17 +448,12 @@ acpi_bus_check_scope (
return_VALUE(0);
}
/**
* acpi_bus_notify
* ---------------
* Callback for all 'system-level' device notifications (values 0x00-0x7F).
*/
static void
acpi_bus_notify (
acpi_handle handle,
u32 type,
void *data)
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
{
int result = 0;
struct acpi_device *device = NULL;
@@ -490,7 +466,8 @@ acpi_bus_notify (
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS CHECK notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received BUS CHECK notification for device [%s]\n",
device->pnp.bus_id));
result = acpi_bus_check_scope(device);
/*
@@ -500,7 +477,8 @@ acpi_bus_notify (
break;
case ACPI_NOTIFY_DEVICE_CHECK:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE CHECK notification for device [%s]\n",
device->pnp.bus_id));
result = acpi_bus_check_device(device, NULL);
/*
@@ -510,43 +488,50 @@ acpi_bus_notify (
break;
case ACPI_NOTIFY_DEVICE_WAKE:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE WAKE notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_EJECT_REQUEST:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received EJECT REQUEST notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received DEVICE CHECK LIGHT notification for device [%s]\n",
device->pnp.bus_id));
/* TBD: Exactly what does 'light' mean? */
break;
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received FREQUENCY MISMATCH notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received BUS MODE MISMATCH notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_POWER_FAULT:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received POWER FAULT notification for device [%s]\n",
device->pnp.bus_id));
/* TBD */
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Received unknown/unsupported notification [%08x]\n",
type));
break;
}
@@ -558,8 +543,7 @@ acpi_bus_notify (
Initialization/Cleanup
-------------------------------------------------------------------------- */
static int __init
acpi_bus_init_irq (void)
static int __init acpi_bus_init_irq(void)
{
acpi_status status = AE_OK;
union acpi_object arg = { ACPI_TYPE_INTEGER };
@@ -601,9 +585,7 @@ acpi_bus_init_irq (void)
return_VALUE(0);
}
void __init
acpi_early_init (void)
void __init acpi_early_init(void)
{
acpi_status status = AE_OK;
struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
@@ -619,13 +601,15 @@ acpi_early_init (void)
status = acpi_initialize_subsystem();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize the ACPI Interpreter\n");
printk(KERN_ERR PREFIX
"Unable to initialize the ACPI Interpreter\n");
goto error0;
}
status = acpi_load_tables();
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to load the System Description Tables\n");
printk(KERN_ERR PREFIX
"Unable to load the System Description Tables\n");
goto error0;
}
@@ -637,7 +621,6 @@ acpi_early_init (void)
printk(KERN_ERR PREFIX "Unable to get the FADT\n");
goto error0;
}
#ifdef CONFIG_X86
if (!acpi_ioapic) {
extern acpi_interrupt_flags acpi_sci_flags;
@@ -647,7 +630,8 @@ acpi_early_init (void)
acpi_sci_flags.trigger = 3;
/* Set PIC-mode SCI trigger type */
acpi_pic_sci_set_trigger(acpi_fadt.sci_int, acpi_sci_flags.trigger);
acpi_pic_sci_set_trigger(acpi_fadt.sci_int,
acpi_sci_flags.trigger);
} else {
extern int acpi_sci_override_gsi;
/*
@@ -658,7 +642,10 @@ acpi_early_init (void)
}
#endif
status = acpi_enable_subsystem(~(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE));
status =
acpi_enable_subsystem(~
(ACPI_NO_HARDWARE_INIT |
ACPI_NO_ACPI_ENABLE));
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
goto error0;
@@ -671,8 +658,7 @@ error0:
return_VOID;
}
static int __init
acpi_bus_init (void)
static int __init acpi_bus_init(void)
{
int result = 0;
acpi_status status = AE_OK;
@@ -682,14 +668,17 @@ acpi_bus_init (void)
status = acpi_os_initialize1();
status = acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
status =
acpi_enable_subsystem(ACPI_NO_HARDWARE_INIT | ACPI_NO_ACPI_ENABLE);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to start the ACPI Interpreter\n");
printk(KERN_ERR PREFIX
"Unable to start the ACPI Interpreter\n");
goto error1;
}
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to initialize ACPI OS objects\n");
printk(KERN_ERR PREFIX
"Unable to initialize ACPI OS objects\n");
goto error1;
}
#ifdef CONFIG_ACPI_EC
@@ -723,9 +712,12 @@ acpi_bus_init (void)
/*
* Register the for all standard device notifications.
*/
status = acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, &acpi_bus_notify, NULL);
status =
acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
&acpi_bus_notify, NULL);
if (ACPI_FAILURE(status)) {
printk(KERN_ERR PREFIX "Unable to register for device notifications\n");
printk(KERN_ERR PREFIX
"Unable to register for device notifications\n");
goto error1;
}
@@ -750,8 +742,7 @@ static int __init acpi_init (void)
ACPI_FUNCTION_TRACE("acpi_init");
printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
ACPI_CA_VERSION);
printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
if (acpi_disabled) {
printk(KERN_INFO PREFIX "Interpreter disabled.\n");
@@ -767,7 +758,8 @@ static int __init acpi_init (void)
if (!PM_IS_ACTIVE())
pm_active = 1;
else {
printk(KERN_INFO PREFIX "APM is already active, exiting\n");
printk(KERN_INFO PREFIX
"APM is already active, exiting\n");
disable_acpi();
result = -ENODEV;
}

View File

@@ -32,7 +32,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_BUTTON_COMPONENT 0x00080000
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
#define ACPI_BUTTON_CLASS "button"
@@ -67,7 +66,6 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
MODULE_LICENSE("GPL");
static int acpi_button_add(struct acpi_device *device);
static int acpi_button_remove(struct acpi_device *device, int type);
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
@@ -103,6 +101,7 @@ static struct file_operations acpi_button_state_fops = {
.llseek = seq_lseek,
.release = single_release,
};
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
@@ -143,9 +142,9 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
if (ACPI_FAILURE(status)) {
seq_printf(seq, "state: unsupported\n");
}
else{
seq_printf(seq, "state: %s\n", (state ? "open" : "closed"));
} else {
seq_printf(seq, "state: %s\n",
(state ? "open" : "closed"));
}
return_VALUE(0);
@@ -160,9 +159,7 @@ static struct proc_dir_entry *acpi_power_dir;
static struct proc_dir_entry *acpi_sleep_dir;
static struct proc_dir_entry *acpi_lid_dir;
static int
acpi_button_add_fs (
struct acpi_device *device)
static int acpi_button_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
struct acpi_button *button = NULL;
@@ -237,10 +234,7 @@ acpi_button_add_fs (
return_VALUE(0);
}
static int
acpi_button_remove_fs (
struct acpi_device *device)
static int acpi_button_remove_fs(struct acpi_device *device)
{
struct acpi_button *button = NULL;
@@ -262,16 +256,11 @@ acpi_button_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static void
acpi_button_notify (
acpi_handle handle,
u32 event,
void *data)
static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_button *button = (struct acpi_button *)data;
@@ -282,7 +271,8 @@ acpi_button_notify (
switch (event) {
case ACPI_BUTTON_NOTIFY_STATUS:
acpi_bus_generate_event(button->device, event, ++button->pushed);
acpi_bus_generate_event(button->device, event,
++button->pushed);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
@@ -293,10 +283,7 @@ acpi_button_notify (
return_VOID;
}
static acpi_status
acpi_button_notify_fixed (
void *data)
static acpi_status acpi_button_notify_fixed(void *data)
{
struct acpi_button *button = (struct acpi_button *)data;
@@ -310,10 +297,7 @@ acpi_button_notify_fixed (
return_ACPI_STATUS(AE_OK);
}
static int
acpi_button_add (
struct acpi_device *device)
static int acpi_button_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
@@ -339,40 +323,32 @@ acpi_button_add (
*/
if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
button->type = ACPI_BUTTON_TYPE_POWER;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_POWER);
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWERF)) {
button->type = ACPI_BUTTON_TYPE_POWERF;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_POWERF);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEP)) {
button->type = ACPI_BUTTON_TYPE_SLEEP;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_SLEEP);
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_SLEEPF)) {
button->type = ACPI_BUTTON_TYPE_SLEEPF;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
}
else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
} else if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_LID)) {
button->type = ACPI_BUTTON_TYPE_LID;
strcpy(acpi_device_name(device),
ACPI_BUTTON_DEVICE_NAME_LID);
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
sprintf(acpi_device_class(device), "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
acpi_device_hid(device)));
result = -ENODEV;
@@ -385,20 +361,19 @@ acpi_button_add (
switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF:
status = acpi_install_fixed_event_handler (
ACPI_EVENT_POWER_BUTTON,
status =
acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
acpi_button_notify_fixed,
button);
break;
case ACPI_BUTTON_TYPE_SLEEPF:
status = acpi_install_fixed_event_handler (
ACPI_EVENT_SLEEP_BUTTON,
status =
acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
acpi_button_notify_fixed,
button);
break;
default:
status = acpi_install_notify_handler (
button->handle,
status = acpi_install_notify_handler(button->handle,
ACPI_DEVICE_NOTIFY,
acpi_button_notify,
button);
@@ -415,7 +390,8 @@ acpi_button_add (
if (device->wakeup.flags.valid) {
/* Button's GPE is run-wake GPE */
acpi_set_gpe_type(device->wakeup.gpe_device,
device->wakeup.gpe_number, ACPI_GPE_TYPE_WAKE_RUN);
device->wakeup.gpe_number,
ACPI_GPE_TYPE_WAKE_RUN);
acpi_enable_gpe(device->wakeup.gpe_device,
device->wakeup.gpe_number, ACPI_NOT_ISR);
device->wakeup.state.enabled = 1;
@@ -433,9 +409,7 @@ end:
return_VALUE(result);
}
static int
acpi_button_remove (struct acpi_device *device, int type)
static int acpi_button_remove(struct acpi_device *device, int type)
{
acpi_status status = 0;
struct acpi_button *button = NULL;
@@ -450,16 +424,19 @@ acpi_button_remove (struct acpi_device *device, int type)
/* Unregister for device notifications. */
switch (button->type) {
case ACPI_BUTTON_TYPE_POWERF:
status = acpi_remove_fixed_event_handler(
ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed);
status =
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
acpi_button_notify_fixed);
break;
case ACPI_BUTTON_TYPE_SLEEPF:
status = acpi_remove_fixed_event_handler(
ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed);
status =
acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
acpi_button_notify_fixed);
break;
default:
status = acpi_remove_notify_handler(button->handle,
ACPI_DEVICE_NOTIFY, acpi_button_notify);
ACPI_DEVICE_NOTIFY,
acpi_button_notify);
break;
}
@@ -474,9 +451,7 @@ acpi_button_remove (struct acpi_device *device, int type)
return_VALUE(0);
}
static int __init
acpi_button_init (void)
static int __init acpi_button_init(void)
{
int result = 0;
@@ -495,9 +470,7 @@ acpi_button_init (void)
return_VALUE(0);
}
static void __exit
acpi_button_exit (void)
static void __exit acpi_button_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_button_exit");
@@ -514,6 +487,5 @@ acpi_button_exit (void)
return_VOID;
}
module_init(acpi_button_init);
module_exit(acpi_button_exit);

View File

@@ -65,11 +65,9 @@ static struct acpi_driver acpi_container_driver = {
},
};
/*******************************************************************/
static int
is_device_present(acpi_handle handle)
static int is_device_present(acpi_handle handle)
{
acpi_handle temp;
acpi_status status;
@@ -89,8 +87,7 @@ is_device_present(acpi_handle handle)
}
/*******************************************************************/
static int
acpi_container_add(struct acpi_device *device)
static int acpi_container_add(struct acpi_device *device)
{
struct acpi_container *container;
@@ -111,15 +108,13 @@ acpi_container_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
acpi_driver_data(device) = container;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n", \
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device <%s> bid <%s>\n",
acpi_device_name(device), acpi_device_bid(device)));
return_VALUE(0);
}
static int
acpi_container_remove(struct acpi_device *device, int type)
static int acpi_container_remove(struct acpi_device *device, int type)
{
acpi_status status = AE_OK;
struct acpi_container *pc = NULL;
@@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type)
return status;
}
static int
container_device_add(struct acpi_device **device, acpi_handle handle)
static int container_device_add(struct acpi_device **device, acpi_handle handle)
{
acpi_handle phandle;
struct acpi_device *pdev;
@@ -158,8 +151,7 @@ container_device_add(struct acpi_device **device, acpi_handle handle)
return_VALUE(result);
}
static void
container_notify_cb(acpi_handle handle, u32 type, void *context)
static void container_notify_cb(acpi_handle handle, u32 type, void *context)
{
struct acpi_device *device = NULL;
int result;
@@ -207,9 +199,7 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
static acpi_status
container_walk_namespace_cb(acpi_handle handle,
u32 lvl,
void *context,
void **rv)
u32 lvl, void *context, void **rv)
{
char *hid = NULL;
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -241,8 +231,7 @@ container_walk_namespace_cb(acpi_handle handle,
case INSTALL_NOTIFY_HANDLER:
acpi_install_notify_handler(handle,
ACPI_SYSTEM_NOTIFY,
container_notify_cb,
NULL);
container_notify_cb, NULL);
break;
case UNINSTALL_NOTIFY_HANDLER:
acpi_remove_notify_handler(handle,
@@ -259,9 +248,7 @@ end:
return_ACPI_STATUS(AE_OK);
}
static int __init
acpi_container_init(void)
static int __init acpi_container_init(void)
{
int result = 0;
int action = INSTALL_NOTIFY_HANDLER;
@@ -275,14 +262,12 @@ acpi_container_init(void)
acpi_walk_namespace(ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
container_walk_namespace_cb,
&action, NULL);
container_walk_namespace_cb, &action, NULL);
return (0);
}
static void __exit
acpi_container_exit(void)
static void __exit acpi_container_exit(void)
{
int action = UNINSTALL_NOTIFY_HANDLER;
@@ -291,8 +276,7 @@ acpi_container_exit(void)
acpi_walk_namespace(ACPI_TYPE_DEVICE,
ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
container_walk_namespace_cb,
&action, NULL);
container_walk_namespace_cb, &action, NULL);
acpi_bus_unregister_driver(&acpi_container_driver);

View File

@@ -13,14 +13,11 @@
#define _COMPONENT ACPI_SYSTEM_COMPONENT
ACPI_MODULE_NAME("debug")
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
#ifdef MODULE_PARAM_PREFIX
#undef MODULE_PARAM_PREFIX
#endif
#define MODULE_PARAM_PREFIX
module_param(acpi_dbg_layer, uint, 0400);
module_param(acpi_dbg_level, uint, 0400);
@@ -35,8 +32,7 @@ struct acpi_dlevel {
};
#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
static const struct acpi_dlayer acpi_debug_layers[] =
{
static const struct acpi_dlayer acpi_debug_layers[] = {
ACPI_DEBUG_INIT(ACPI_UTILITIES),
ACPI_DEBUG_INIT(ACPI_HARDWARE),
ACPI_DEBUG_INIT(ACPI_EVENTS),
@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
ACPI_DEBUG_INIT(ACPI_TOOLS),
};
static const struct acpi_dlevel acpi_debug_levels[] =
{
static const struct acpi_dlevel acpi_debug_levels[] = {
ACPI_DEBUG_INIT(ACPI_LV_ERROR),
ACPI_DEBUG_INIT(ACPI_LV_WARN),
ACPI_DEBUG_INIT(ACPI_LV_INIT),
@@ -92,13 +87,8 @@ static const struct acpi_dlevel acpi_debug_levels[] =
};
static int
acpi_system_read_debug (
char *page,
char **start,
off_t off,
int count,
int *eof,
void *data)
acpi_system_read_debug(char *page,
char **start, off_t off, int count, int *eof, void *data)
{
char *p = page;
int size = 0;
@@ -115,14 +105,15 @@ acpi_system_read_debug (
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_layers[i].name,
acpi_debug_layers[i].value,
(acpi_dbg_layer & acpi_debug_layers[i].value) ?
'*' : ' ');
(acpi_dbg_layer & acpi_debug_layers[i].
value) ? '*' : ' ');
}
p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
ACPI_ALL_DRIVERS,
(acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
'*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
' ' : '-');
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
ACPI_ALL_DRIVERS) ==
0 ? ' ' : '-');
p += sprintf(p,
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
acpi_dbg_layer);
@@ -132,8 +123,8 @@ acpi_system_read_debug (
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
acpi_debug_levels[i].name,
acpi_debug_levels[i].value,
(acpi_dbg_level & acpi_debug_levels[i].value) ?
'*' : ' ');
(acpi_dbg_level & acpi_debug_levels[i].
value) ? '*' : ' ');
}
p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
acpi_dbg_level);
@@ -145,22 +136,22 @@ acpi_system_read_debug (
end:
size = (p - page);
if (size <= off+count) *eof = 1;
if (size <= off + count)
*eof = 1;
*start = page + off;
size -= off;
if (size>count) size = count;
if (size<0) size = 0;
if (size > count)
size = count;
if (size < 0)
size = 0;
return size;
}
static int
acpi_system_write_debug (
struct file *file,
acpi_system_write_debug(struct file *file,
const char __user * buffer,
unsigned long count,
void *data)
unsigned long count, void *data)
{
char debug_string[12] = { '\0' };
@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
/* 'debug_layer' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
acpi_system_read_debug,(void *)0);
entry =
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
acpi_root_dir, acpi_system_read_debug,
(void *)0);
if (entry)
entry->write_proc = acpi_system_write_debug;
else
@@ -210,8 +203,10 @@ static int __init acpi_debug_init(void)
/* 'debug_level' [R/W] */
name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
acpi_system_read_debug, (void *)1);
entry =
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
acpi_root_dir, acpi_system_read_debug,
(void *)1);
if (entry)
entry->write_proc = acpi_system_write_debug;
else

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acdispat.h>
@@ -49,19 +48,15 @@
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsfield")
/* Local prototypes */
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
acpi_ds_get_field_names(struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg);
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_buffer_field
@@ -82,8 +77,7 @@ acpi_ds_get_field_names (
******************************************************************************/
acpi_status
acpi_ds_create_buffer_field (
union acpi_parse_object *op,
acpi_ds_create_buffer_field(union acpi_parse_object *op,
struct acpi_walk_state *walk_state)
{
union acpi_parse_object *arg;
@@ -93,16 +87,13 @@ acpi_ds_create_buffer_field (
union acpi_operand_object *second_desc = NULL;
u32 flags;
ACPI_FUNCTION_TRACE("ds_create_buffer_field");
/* Get the name_string argument */
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
arg = acpi_ps_get_arg(op, 3);
}
else {
} else {
/* Create Bit/Byte/Word/Dword field */
arg = acpi_ps_get_arg(op, 2);
@@ -115,8 +106,7 @@ acpi_ds_create_buffer_field (
if (walk_state->deferred_node) {
node = walk_state->deferred_node;
status = AE_OK;
}
else {
} else {
/*
* During the load phase, we want to enter the name of the field into
* the namespace. During the execute phase (when we evaluate the size
@@ -124,8 +114,7 @@ acpi_ds_create_buffer_field (
*/
if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
}
else {
} else {
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND;
}
@@ -133,9 +122,11 @@ acpi_ds_create_buffer_field (
/*
* Enter the name_string into the namespace
*/
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
flags, walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.string, ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
&(node));
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
@@ -188,7 +179,6 @@ acpi_ds_create_buffer_field (
goto cleanup;
}
cleanup:
/* Remove local reference to the object */
@@ -197,7 +187,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_get_field_names
@@ -214,18 +203,15 @@ cleanup:
******************************************************************************/
static acpi_status
acpi_ds_get_field_names (
struct acpi_create_field_info *info,
acpi_ds_get_field_names(struct acpi_create_field_info *info,
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg)
{
acpi_status status;
acpi_integer position;
ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info);
/* First field starts at bit zero */
info->field_bit_position = 0;
@@ -246,15 +232,13 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR ((
"Bit offset within field too large (> 0xFFFFFFFF)\n"));
ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
return_ACPI_STATUS(AE_SUPPORT);
}
info->field_bit_position = (u32) position;
break;
case AML_INT_ACCESSFIELD_OP:
/*
@@ -266,31 +250,32 @@ acpi_ds_get_field_names (
* ACCESS_TYPE bits
*/
info->field_flags = (u8)
((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((info->
field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
((u8) ((u32) arg->common.value.integer >> 8)));
info->attribute = (u8) (arg->common.value.integer);
break;
case AML_INT_NAMEDFIELD_OP:
/* Lookup the name */
status = acpi_ns_lookup(walk_state->scope_info,
(char *)&arg->named.name,
info->field_type, ACPI_IMODE_EXECUTE,
info->field_type,
ACPI_IMODE_EXECUTE,
ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &info->field_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
ACPI_REPORT_NSERROR((char *)&arg->named.name,
status);
if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS(status);
}
/* Already exists, ignore error */
}
else {
} else {
arg->common.node = info->field_node;
info->field_bit_length = arg->common.value.size;
@@ -308,16 +293,13 @@ acpi_ds_get_field_names (
+ (acpi_integer) arg->common.value.size;
if (position > ACPI_UINT32_MAX) {
ACPI_REPORT_ERROR ((
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
(char *) &info->field_node->name));
ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name));
return_ACPI_STATUS(AE_SUPPORT);
}
info->field_bit_position += info->field_bit_length;
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -332,7 +314,6 @@ acpi_ds_get_field_names (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_field
@@ -348,8 +329,7 @@ acpi_ds_get_field_names (
******************************************************************************/
acpi_status
acpi_ds_create_field (
union acpi_parse_object *op,
acpi_ds_create_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state)
{
@@ -357,17 +337,17 @@ acpi_ds_create_field (
union acpi_parse_object *arg;
struct acpi_create_field_info info;
ACPI_FUNCTION_TRACE_PTR("ds_create_field", op);
/* First arg is the name of the parent op_region (must already exist) */
arg = op->common.value.arg;
if (!region_node) {
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.name, ACPI_TYPE_REGION,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status);
return_ACPI_STATUS(status);
@@ -390,7 +370,6 @@ acpi_ds_create_field (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_field_objects
@@ -407,8 +386,7 @@ acpi_ds_create_field (
******************************************************************************/
acpi_status
acpi_ds_init_field_objects (
union acpi_parse_object *op,
acpi_ds_init_field_objects(union acpi_parse_object *op,
struct acpi_walk_state *walk_state)
{
acpi_status status;
@@ -416,10 +394,8 @@ acpi_ds_init_field_objects (
struct acpi_namespace_node *node;
u8 type = 0;
ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op);
switch (walk_state->opcode) {
case AML_FIELD_OP:
arg = acpi_ps_get_arg(op, 2);
@@ -450,11 +426,13 @@ acpi_ds_init_field_objects (
status = acpi_ns_lookup(walk_state->scope_info,
(char *)&arg->named.name,
type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_NO_UPSEARCH |
ACPI_NS_DONT_OPEN_SCOPE |
ACPI_NS_ERROR_IF_FOUND,
walk_state, &node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
ACPI_REPORT_NSERROR((char *)&arg->named.name,
status);
if (status != AE_ALREADY_EXISTS) {
return_ACPI_STATUS(status);
}
@@ -475,7 +453,6 @@ acpi_ds_init_field_objects (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_bank_field
@@ -491,8 +468,7 @@ acpi_ds_init_field_objects (
******************************************************************************/
acpi_status
acpi_ds_create_bank_field (
union acpi_parse_object *op,
acpi_ds_create_bank_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state)
{
@@ -500,17 +476,17 @@ acpi_ds_create_bank_field (
union acpi_parse_object *arg;
struct acpi_create_field_info info;
ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op);
/* First arg is the name of the parent op_region (must already exist) */
arg = op->common.value.arg;
if (!region_node) {
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &region_node);
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.name, ACPI_TYPE_REGION,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &region_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.name, status);
return_ACPI_STATUS(status);
@@ -520,9 +496,11 @@ acpi_ds_create_bank_field (
/* Second arg is the Bank Register (Field) (must already exist) */
arg = arg->common.next;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
status =
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
@@ -548,7 +526,6 @@ acpi_ds_create_bank_field (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_index_field
@@ -564,8 +541,7 @@ acpi_ds_create_bank_field (
******************************************************************************/
acpi_status
acpi_ds_create_index_field (
union acpi_parse_object *op,
acpi_ds_create_index_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state)
{
@@ -573,16 +549,16 @@ acpi_ds_create_index_field (
union acpi_parse_object *arg;
struct acpi_create_field_info info;
ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op);
/* First arg is the name of the Index register (must already exist) */
arg = op->common.value.arg;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
status =
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
ACPI_NS_SEARCH_PARENT, walk_state,
&info.register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
@@ -591,9 +567,11 @@ acpi_ds_create_index_field (
/* Second arg is the data register (must already exist) */
arg = arg->common.next;
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
status =
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
ACPI_NS_SEARCH_PARENT, walk_state,
&info.data_register_node);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
return_ACPI_STATUS(status);
@@ -613,5 +591,3 @@ acpi_ds_create_index_field (
return_ACPI_STATUS(status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/acnamesp.h>
@@ -50,14 +49,9 @@
ACPI_MODULE_NAME("dsinit")
/* Local prototypes */
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_ds_init_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
/*******************************************************************************
*
@@ -80,21 +74,18 @@ acpi_ds_init_one_object (
******************************************************************************/
static acpi_status
acpi_ds_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ds_init_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
struct acpi_init_walk_info *info =
(struct acpi_init_walk_info *)context;
struct acpi_namespace_node *node =
(struct acpi_namespace_node *)obj_handle;
acpi_object_type type;
acpi_status status;
ACPI_FUNCTION_NAME("ds_init_one_object");
/*
* We are only interested in NS nodes owned by the table that
* was just loaded
@@ -116,14 +107,14 @@ acpi_ds_init_one_object (
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Region %p [%4.4s] - Init failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
obj_handle,
acpi_ut_get_node_name(obj_handle),
acpi_format_exception(status)));
}
info->op_region_count++;
break;
case ACPI_TYPE_METHOD:
/*
@@ -152,7 +143,8 @@ acpi_ds_init_one_object (
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"\n+Method %p [%4.4s] - parse failure, %s\n",
obj_handle, acpi_ut_get_node_name (obj_handle),
obj_handle,
acpi_ut_get_node_name(obj_handle),
acpi_format_exception(status)));
/* This parse failed, but we will continue parsing more methods */
@@ -161,13 +153,11 @@ acpi_ds_init_one_object (
info->method_count++;
break;
case ACPI_TYPE_DEVICE:
info->device_count++;
break;
default:
break;
}
@@ -179,7 +169,6 @@ acpi_ds_init_one_object (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_initialize_objects
@@ -195,17 +184,14 @@ acpi_ds_init_one_object (
******************************************************************************/
acpi_status
acpi_ds_initialize_objects (
struct acpi_table_desc *table_desc,
acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
struct acpi_namespace_node * start_node)
{
acpi_status status;
struct acpi_init_walk_info info;
ACPI_FUNCTION_TRACE("ds_initialize_objects");
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "Parsing all Control Methods:"));
@@ -227,13 +213,14 @@ acpi_ds_initialize_objects (
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
table_desc->pointer->signature, table_desc->owner_id, info.object_count,
info.device_count, info.method_count, info.op_region_count));
table_desc->pointer->signature,
table_desc->owner_id, info.object_count,
info.device_count, info.method_count,
info.op_region_count));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"%hd Methods, %hd Regions\n", info.method_count, info.op_region_count));
"%hd Methods, %hd Regions\n", info.method_count,
info.op_region_count));
return_ACPI_STATUS(AE_OK);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -49,11 +48,9 @@
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsmethod")
/*******************************************************************************
*
* FUNCTION: acpi_ds_parse_method
@@ -67,27 +64,23 @@
* MUTEX: Assumes parser is locked
*
******************************************************************************/
acpi_status
acpi_ds_parse_method (
struct acpi_namespace_node *node)
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_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 */
@@ -135,8 +128,9 @@ acpi_ds_parse_method (
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (
obj_desc->method.owner_id, NULL, NULL, NULL);
walk_state =
acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup2;
@@ -184,7 +178,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_begin_method_execution
@@ -202,17 +195,14 @@ cleanup:
******************************************************************************/
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,
struct acpi_namespace_node *calling_method_node)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node);
if (!method_node) {
return_ACPI_STATUS(AE_NULL_ENTRY);
}
@@ -231,7 +221,8 @@ acpi_ds_begin_method_execution (
* thread that is making recursive method calls.
*/
if (method_node == calling_method_node) {
if (obj_desc->method.thread_count >= obj_desc->method.concurrency) {
if (obj_desc->method.thread_count >=
obj_desc->method.concurrency) {
return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
}
}
@@ -240,7 +231,8 @@ acpi_ds_begin_method_execution (
* Get a unit from the method semaphore. This releases the
* interpreter if we block
*/
status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore,
status =
acpi_ex_system_wait_semaphore(obj_desc->method.semaphore,
ACPI_WAIT_FOREVER);
}
@@ -252,7 +244,6 @@ acpi_ds_begin_method_execution (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_call_control_method
@@ -268,8 +259,7 @@ acpi_ds_begin_method_execution (
******************************************************************************/
acpi_status
acpi_ds_call_control_method (
struct acpi_thread_state *thread,
acpi_ds_call_control_method(struct acpi_thread_state *thread,
struct acpi_walk_state *this_walk_state,
union acpi_parse_object *op)
{
@@ -280,10 +270,10 @@ acpi_ds_call_control_method (
struct acpi_parameter_info info;
u32 i;
ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Execute method %p, currentstate=%p\n",
this_walk_state->prev_op, this_walk_state));
/*
@@ -315,8 +305,9 @@ acpi_ds_call_control_method (
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
/* 1) Parse: Create a new walk state for the preempting walk */
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
op, obj_desc, NULL);
next_walk_state =
acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
obj_desc, NULL);
if (!next_walk_state) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -330,7 +321,8 @@ acpi_ds_call_control_method (
}
status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
obj_desc->method.aml_start, obj_desc->method.aml_length,
obj_desc->method.aml_start,
obj_desc->method.aml_length,
NULL, 1);
if (ACPI_FAILURE(status)) {
acpi_ds_delete_walk_state(next_walk_state);
@@ -363,8 +355,8 @@ acpi_ds_call_control_method (
info.parameter_type = ACPI_PARAM_ARGS;
status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node,
obj_desc->method.aml_start, obj_desc->method.aml_length,
&info, 3);
obj_desc->method.aml_start,
obj_desc->method.aml_length, &info, 3);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
@@ -383,7 +375,8 @@ acpi_ds_call_control_method (
this_walk_state->num_operands = 0;
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Starting nested execution, newstate=%p\n", next_walk_state));
"Starting nested execution, newstate=%p\n",
next_walk_state));
if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
status = obj_desc->method.implementation(next_walk_state);
@@ -392,7 +385,6 @@ acpi_ds_call_control_method (
return_ACPI_STATUS(AE_OK);
/* On error, we must delete the new walk state */
cleanup:
@@ -407,7 +399,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_restart_control_method
@@ -423,20 +414,17 @@ cleanup:
******************************************************************************/
acpi_status
acpi_ds_restart_control_method (
struct acpi_walk_state *walk_state,
acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
union acpi_operand_object *return_desc)
{
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state);
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"****Restart [%4.4s] Op %p return_value_from_callee %p\n",
(char *) &walk_state->method_node->name, walk_state->method_call_op,
return_desc));
(char *)&walk_state->method_node->name,
walk_state->method_call_op, return_desc));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
" return_from_this_method_used?=%X res_stack %p Walk %p\n",
@@ -472,7 +460,8 @@ acpi_ds_restart_control_method (
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
else if (!acpi_ds_do_implicit_return (return_desc, walk_state, FALSE)) {
else if (!acpi_ds_do_implicit_return
(return_desc, walk_state, FALSE)) {
/*
* Delete the return value if it will not be used by the
* calling method
@@ -484,7 +473,6 @@ acpi_ds_restart_control_method (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_terminate_control_method
@@ -499,18 +487,14 @@ acpi_ds_restart_control_method (
*
******************************************************************************/
acpi_status
acpi_ds_terminate_control_method (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
{
union acpi_operand_object *obj_desc;
struct acpi_namespace_node *method_node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state);
if (!walk_state) {
return (AE_BAD_PARAMETER);
}
@@ -539,8 +523,9 @@ acpi_ds_terminate_control_method (
/* Signal completion of the execution of this method if necessary */
if (walk_state->method_desc->method.semaphore) {
status = acpi_os_signal_semaphore (
walk_state->method_desc->method.semaphore, 1);
status =
acpi_os_signal_semaphore(walk_state->method_desc->method.
semaphore, 1);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not signal method semaphore\n"));
status = AE_OK;
@@ -552,7 +537,8 @@ acpi_ds_terminate_control_method (
if (walk_state->method_desc->method.thread_count) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"*** Not deleting method namespace, there are still %d threads\n",
walk_state->method_desc->method.thread_count));
walk_state->method_desc->method.
thread_count));
}
if (!walk_state->method_desc->method.thread_count) {
@@ -569,7 +555,9 @@ acpi_ds_terminate_control_method (
if ((walk_state->method_desc->method.concurrency == 1) &&
(!walk_state->method_desc->method.semaphore)) {
status = acpi_os_create_semaphore(1, 1,
&walk_state->method_desc->method.semaphore);
&walk_state->
method_desc->method.
semaphore);
}
/*
@@ -597,9 +585,11 @@ acpi_ds_terminate_control_method (
* Delete any namespace entries created anywhere else within
* the namespace
*/
acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owner_id);
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.owner_id);
acpi_ut_release_owner_id(&walk_state->method_desc->method.
owner_id);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -609,5 +599,3 @@ acpi_ds_terminate_control_method (
status = acpi_ut_release_mutex(ACPI_MTX_PARSER);
return_ACPI_STATUS(status);
}

View File

@@ -41,41 +41,32 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsmthdat")
/* Local prototypes */
static void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
acpi_ds_method_data_delete_value(u16 opcode,
u32 index, struct acpi_walk_state *walk_state);
static acpi_status
acpi_ds_method_data_set_value (
u16 opcode,
acpi_ds_method_data_set_value(u16 opcode,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state);
#ifdef ACPI_OBSOLETE_FUNCTIONS
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state);
acpi_ds_method_data_get_type(u16 opcode,
u32 index, struct acpi_walk_state *walk_state);
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_init
@@ -97,16 +88,12 @@ acpi_ds_method_data_get_type (
*
******************************************************************************/
void
acpi_ds_method_data_init (
struct acpi_walk_state *walk_state)
void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE("ds_method_data_init");
/* Init the method arguments */
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
@@ -126,7 +113,8 @@ acpi_ds_method_data_init (
NAMEOF_LOCAL_NTE);
walk_state->local_variables[i].name.integer |= (i << 24);
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].descriptor =
ACPI_DESC_TYPE_NAMED;
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
ANOBJ_METHOD_LOCAL;
@@ -135,7 +123,6 @@ acpi_ds_method_data_init (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_delete_all
@@ -149,26 +136,25 @@ acpi_ds_method_data_init (
*
******************************************************************************/
void
acpi_ds_method_data_delete_all (
struct acpi_walk_state *walk_state)
void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
{
u32 index;
ACPI_FUNCTION_TRACE("ds_method_data_delete_all");
/* Detach the locals */
for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
if (walk_state->local_variables[index].object) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
index, walk_state->local_variables[index].object));
index,
walk_state->local_variables[index].
object));
/* Detach object (if present) and remove a reference */
acpi_ns_detach_object (&walk_state->local_variables[index]);
acpi_ns_detach_object(&walk_state->
local_variables[index]);
}
}
@@ -177,7 +163,8 @@ acpi_ds_method_data_delete_all (
for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
if (walk_state->arguments[index].object) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
index, walk_state->arguments[index].object));
index,
walk_state->arguments[index].object));
/* Detach object (if present) and remove a reference */
@@ -188,7 +175,6 @@ acpi_ds_method_data_delete_all (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_init_args
@@ -206,35 +192,33 @@ acpi_ds_method_data_delete_all (
******************************************************************************/
acpi_status
acpi_ds_method_data_init_args (
union acpi_operand_object **params,
acpi_ds_method_data_init_args(union acpi_operand_object **params,
u32 max_param_count,
struct acpi_walk_state *walk_state)
{
acpi_status status;
u32 index = 0;
ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params);
if (!params) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"No param list passed to method\n"));
return_ACPI_STATUS(AE_OK);
}
/* Copy passed parameters into the new method stack frame */
while ((index < ACPI_METHOD_NUM_ARGS) &&
(index < max_param_count) &&
params[index]) {
(index < max_param_count) && params[index]) {
/*
* A valid parameter.
* Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference
*/
status = acpi_ds_method_data_set_value(AML_ARG_OP, index,
params[index], walk_state);
params[index],
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -246,7 +230,6 @@ acpi_ds_method_data_init_args (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_get_node
@@ -263,15 +246,13 @@ acpi_ds_method_data_init_args (
******************************************************************************/
acpi_status
acpi_ds_method_data_get_node (
u16 opcode,
acpi_ds_method_data_get_node(u16 opcode,
u32 index,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node **node)
{
ACPI_FUNCTION_TRACE("ds_method_data_get_node");
/*
* Method Locals and Arguments are supported
*/
@@ -305,14 +286,14 @@ acpi_ds_method_data_get_node (
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n",
opcode));
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_set_value
@@ -330,8 +311,7 @@ acpi_ds_method_data_get_node (
******************************************************************************/
static acpi_status
acpi_ds_method_data_set_value (
u16 opcode,
acpi_ds_method_data_set_value(u16 opcode,
u32 index,
union acpi_operand_object *object,
struct acpi_walk_state *walk_state)
@@ -339,10 +319,8 @@ acpi_ds_method_data_set_value (
acpi_status status;
struct acpi_namespace_node *node;
ACPI_FUNCTION_TRACE("ds_method_data_set_value");
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"new_obj %p Opcode %X, Refs=%d [%s]\n", object,
opcode, object->common.reference_count,
@@ -369,7 +347,6 @@ acpi_ds_method_data_set_value (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_get_value
@@ -387,8 +364,7 @@ acpi_ds_method_data_set_value (
******************************************************************************/
acpi_status
acpi_ds_method_data_get_value (
u16 opcode,
acpi_ds_method_data_get_value(u16 opcode,
u32 index,
struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc)
@@ -397,14 +373,13 @@ acpi_ds_method_data_get_value (
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE("ds_method_data_get_value");
/* Validate the object descriptor */
if (!dest_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Null object descriptor pointer\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -433,7 +408,8 @@ acpi_ds_method_data_get_value (
/* If slack enabled, init the local_x/arg_x to an Integer of value zero */
if (acpi_gbl_enable_interpreter_slack) {
object = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
object =
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!object) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -444,7 +420,8 @@ acpi_ds_method_data_get_value (
/* Otherwise, return the error */
else switch (opcode) {
else
switch (opcode) {
case AML_ARG_OP:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
@@ -462,7 +439,8 @@ acpi_ds_method_data_get_value (
return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
default:
ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode));
ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n",
opcode));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
}
@@ -477,7 +455,6 @@ acpi_ds_method_data_get_value (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_method_data_delete_value
@@ -494,19 +471,15 @@ acpi_ds_method_data_get_value (
******************************************************************************/
static void
acpi_ds_method_data_delete_value (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state)
acpi_ds_method_data_delete_value(u16 opcode,
u32 index, struct acpi_walk_state *walk_state)
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE("ds_method_data_delete_value");
/* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
@@ -538,7 +511,6 @@ acpi_ds_method_data_delete_value (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_store_object_to_local
@@ -557,8 +529,7 @@ acpi_ds_method_data_delete_value (
******************************************************************************/
acpi_status
acpi_ds_store_object_to_local (
u16 opcode,
acpi_ds_store_object_to_local(u16 opcode,
u32 index,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state)
@@ -568,7 +539,6 @@ acpi_ds_store_object_to_local (
union acpi_operand_object *current_obj_desc;
union acpi_operand_object *new_obj_desc;
ACPI_FUNCTION_TRACE("ds_store_object_to_local");
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
opcode, index, obj_desc));
@@ -602,7 +572,9 @@ acpi_ds_store_object_to_local (
*/
new_obj_desc = obj_desc;
if (obj_desc->common.reference_count > 1) {
status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state);
status =
acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -636,20 +608,28 @@ acpi_ds_store_object_to_local (
* If we have a valid reference object that came from ref_of(),
* do the indirect store
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) ==
ACPI_DESC_TYPE_OPERAND)
&& (current_obj_desc->common.type ==
ACPI_TYPE_LOCAL_REFERENCE)
&& (current_obj_desc->reference.opcode ==
AML_REF_OF_OP)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Arg (%p) is an obj_ref(Node), storing in node %p\n",
new_obj_desc, current_obj_desc));
new_obj_desc,
current_obj_desc));
/*
* Store this object to the Node (perform the indirect store)
* NOTE: No implicit conversion is performed, as per the ACPI
* specification rules on storing to Locals/Args.
*/
status = acpi_ex_store_object_to_node (new_obj_desc,
current_obj_desc->reference.object, walk_state,
status =
acpi_ex_store_object_to_node(new_obj_desc,
current_obj_desc->
reference.
object,
walk_state,
ACPI_NO_IMPLICIT_CONVERSION);
/* Remove local reference if we copied the object above */
@@ -673,7 +653,9 @@ acpi_ds_store_object_to_local (
* the descriptor for the Arg or Local.
* (increments the object reference count by one)
*/
status = acpi_ds_method_data_set_value (opcode, index, new_obj_desc, walk_state);
status =
acpi_ds_method_data_set_value(opcode, index, new_obj_desc,
walk_state);
/* Remove local reference if we copied the object above */
@@ -684,7 +666,6 @@ acpi_ds_store_object_to_local (
return_ACPI_STATUS(status);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
@@ -701,19 +682,15 @@ acpi_ds_store_object_to_local (
******************************************************************************/
acpi_object_type
acpi_ds_method_data_get_type (
u16 opcode,
u32 index,
struct acpi_walk_state *walk_state)
acpi_ds_method_data_get_type(u16 opcode,
u32 index, struct acpi_walk_state *walk_state)
{
acpi_status status;
struct acpi_namespace_node *node;
union acpi_operand_object *object;
ACPI_FUNCTION_TRACE("ds_method_data_get_type");
/* Get the namespace node for the arg/local */
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
@@ -735,5 +712,3 @@ acpi_ds_method_data_get_type (
return_VALUE(ACPI_GET_OBJECT_TYPE(object));
}
#endif

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -53,12 +52,10 @@
ACPI_MODULE_NAME("dsobject")
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_operand_object **obj_desc_ptr);
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -76,18 +73,15 @@ acpi_ds_build_internal_object (
******************************************************************************/
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_operand_object **obj_desc_ptr)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE("ds_build_internal_object");
*obj_desc_ptr = NULL;
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
/*
@@ -98,13 +92,16 @@ acpi_ds_build_internal_object (
if (!op->common.node) {
status = acpi_ns_lookup(walk_state->scope_info,
op->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL,
(struct acpi_namespace_node **) &(op->common.node));
ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT |
ACPI_NS_DONT_OPEN_SCOPE, NULL,
(struct acpi_namespace_node **)
&(op->common.node));
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR (op->common.value.string, status);
ACPI_REPORT_NSERROR(op->common.value.string,
status);
return_ACPI_STATUS(status);
}
}
@@ -112,13 +109,15 @@ acpi_ds_build_internal_object (
/* Create and init the internal ACPI object */
obj_desc = acpi_ut_create_internal_object (
(acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
(op->common.aml_opcode))->
object_type);
if (!obj_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
status =
acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode,
&obj_desc);
if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference(obj_desc);
@@ -129,7 +128,6 @@ acpi_ds_build_internal_object (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_build_internal_buffer_obj
@@ -147,8 +145,7 @@ acpi_ds_build_internal_object (
******************************************************************************/
acpi_status
acpi_ds_build_internal_buffer_obj (
struct acpi_walk_state *walk_state,
acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
u32 buffer_length,
union acpi_operand_object **obj_desc_ptr)
@@ -158,18 +155,15 @@ acpi_ds_build_internal_buffer_obj (
union acpi_parse_object *byte_list;
u32 byte_list_length = 0;
ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
obj_desc = *obj_desc_ptr;
if (obj_desc) {
/*
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
* The buffer object already exists (from the NS node)
*/
}
else {
} else {
/* Create a new buffer object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
@@ -191,7 +185,8 @@ acpi_ds_build_internal_buffer_obj (
if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Expecting bytelist, got AML opcode %X in op %p\n",
byte_list->common.aml_opcode, byte_list));
byte_list->common.aml_opcode,
byte_list));
acpi_ut_remove_reference(obj_desc);
return (AE_TYPE);
@@ -216,10 +211,9 @@ acpi_ds_build_internal_buffer_obj (
obj_desc->buffer.pointer = NULL;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Buffer defined with zero length in AML, creating\n"));
}
else {
obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
obj_desc->buffer.length);
} else {
obj_desc->buffer.pointer =
ACPI_MEM_CALLOCATE(obj_desc->buffer.length);
if (!obj_desc->buffer.pointer) {
acpi_ut_delete_object_desc(obj_desc);
return_ACPI_STATUS(AE_NO_MEMORY);
@@ -228,8 +222,8 @@ acpi_ds_build_internal_buffer_obj (
/* Initialize buffer from the byte_list (if present) */
if (byte_list) {
ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data,
byte_list_length);
ACPI_MEMCPY(obj_desc->buffer.pointer,
byte_list->named.data, byte_list_length);
}
}
@@ -238,7 +232,6 @@ acpi_ds_build_internal_buffer_obj (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_build_internal_package_obj
@@ -256,8 +249,7 @@ acpi_ds_build_internal_buffer_obj (
******************************************************************************/
acpi_status
acpi_ds_build_internal_package_obj (
struct acpi_walk_state *walk_state,
acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
u32 package_length,
union acpi_operand_object **obj_desc_ptr)
@@ -269,10 +261,8 @@ acpi_ds_build_internal_package_obj (
acpi_status status = AE_OK;
u32 i;
ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
/* Find the parent of a possibly nested package */
parent = op->common.parent;
@@ -287,8 +277,7 @@ acpi_ds_build_internal_package_obj (
* We are evaluating a Named package object "Name (xxxx, Package)".
* Get the existing package object from the NS node
*/
}
else {
} else {
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
*obj_desc_ptr = obj_desc;
if (!obj_desc) {
@@ -323,8 +312,9 @@ acpi_ds_build_internal_package_obj (
* individual objects). Add an extra pointer slot so
* that the list is always null terminated.
*/
obj_desc->package.elements = ACPI_MEM_CALLOCATE (
((acpi_size) obj_desc->package.count + 1) * sizeof (void *));
obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc->
package.count +
1) * sizeof(void *));
if (!obj_desc->package.elements) {
acpi_ut_delete_object_desc(obj_desc);
@@ -342,11 +332,13 @@ acpi_ds_build_internal_package_obj (
/* Object (package or buffer) is already built */
obj_desc->package.elements[i] =
ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
}
else {
ACPI_CAST_PTR(union acpi_operand_object,
arg->common.node);
} else {
status = acpi_ds_build_internal_object(walk_state, arg,
&obj_desc->package.elements[i]);
&obj_desc->
package.
elements[i]);
}
i++;
@@ -358,7 +350,6 @@ acpi_ds_build_internal_package_obj (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_node
@@ -374,18 +365,15 @@ acpi_ds_build_internal_package_obj (
******************************************************************************/
acpi_status
acpi_ds_create_node (
struct acpi_walk_state *walk_state,
acpi_ds_create_node(struct acpi_walk_state *walk_state,
struct acpi_namespace_node *node,
union acpi_parse_object *op)
{
acpi_status status;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE_PTR("ds_create_node", op);
/*
* Because of the execution pass through the non-control-method
* parts of the table, we can arrive here twice. Only init
@@ -425,7 +413,6 @@ acpi_ds_create_node (
#endif /* ACPI_NO_METHOD_EXECUTION */
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_object_from_op
@@ -444,8 +431,7 @@ acpi_ds_create_node (
******************************************************************************/
acpi_status
acpi_ds_init_object_from_op (
struct acpi_walk_state *walk_state,
acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
u16 opcode,
union acpi_operand_object **ret_obj_desc)
@@ -454,10 +440,8 @@ acpi_ds_init_object_from_op (
union acpi_operand_object *obj_desc;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ds_init_object_from_op");
obj_desc = *ret_obj_desc;
op_info = acpi_ps_get_opcode_info(opcode);
if (op_info->class == AML_CLASS_UNKNOWN) {
@@ -480,7 +464,6 @@ acpi_ds_init_object_from_op (
obj_desc->buffer.aml_length = op->named.length;
break;
case ACPI_TYPE_PACKAGE:
/*
@@ -492,7 +475,6 @@ acpi_ds_init_object_from_op (
obj_desc->package.aml_length = op->named.length;
break;
case ACPI_TYPE_INTEGER:
switch (op_info->type) {
@@ -537,13 +519,13 @@ acpi_ds_init_object_from_op (
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown constant opcode %X\n", opcode));
"Unknown constant opcode %X\n",
opcode));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case AML_TYPE_LITERAL:
obj_desc->integer.value = op->common.value.integer;
@@ -552,20 +534,20 @@ acpi_ds_init_object_from_op (
#endif
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown Integer type %X\n",
op_info->type));
status = AE_AML_OPERAND_TYPE;
break;
}
break;
case ACPI_TYPE_STRING:
obj_desc->string.pointer = op->common.value.string;
obj_desc->string.length = (u32) ACPI_STRLEN (op->common.value.string);
obj_desc->string.length =
(u32) ACPI_STRLEN(op->common.value.string);
/*
* The string is contained in the ACPI table, don't ever try
@@ -574,11 +556,9 @@ acpi_ds_init_object_from_op (
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_METHOD:
break;
case ACPI_TYPE_LOCAL_REFERENCE:
switch (op_info->type) {
@@ -591,13 +571,16 @@ acpi_ds_init_object_from_op (
#ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
obj_desc->reference.offset,
obj_desc->
reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
(struct
acpi_namespace_node
**)&obj_desc->
reference.object);
#endif
break;
case AML_TYPE_METHOD_ARGUMENT:
/* Split the opcode into a base opcode + offset */
@@ -607,9 +590,13 @@ acpi_ds_init_object_from_op (
#ifndef ACPI_NO_METHOD_EXECUTION
status = acpi_ds_method_data_get_node(AML_ARG_OP,
obj_desc->reference.offset,
obj_desc->
reference.offset,
walk_state,
(struct acpi_namespace_node **) &obj_desc->reference.object);
(struct
acpi_namespace_node
**)&obj_desc->
reference.object);
#endif
break;
@@ -626,10 +613,10 @@ acpi_ds_init_object_from_op (
}
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unimplemented data type: %X\n",
ACPI_GET_OBJECT_TYPE(obj_desc)));
status = AE_AML_OPERAND_TYPE;
@@ -638,5 +625,3 @@ acpi_ds_init_object_from_op (
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -55,24 +54,19 @@
ACPI_MODULE_NAME("dsopcode")
/* Local prototypes */
static acpi_status
acpi_ds_execute_arguments (
struct acpi_namespace_node *node,
acpi_ds_execute_arguments(struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start);
u32 aml_length, u8 * aml_start);
static acpi_status
acpi_ds_init_buffer_field (
u16 aml_opcode,
acpi_ds_init_buffer_field(u16 aml_opcode,
union acpi_operand_object *obj_desc,
union acpi_operand_object *buffer_desc,
union acpi_operand_object *offset_desc,
union acpi_operand_object *length_desc,
union acpi_operand_object *result_desc);
/*******************************************************************************
*
* FUNCTION: acpi_ds_execute_arguments
@@ -89,20 +83,16 @@ acpi_ds_init_buffer_field (
******************************************************************************/
static acpi_status
acpi_ds_execute_arguments (
struct acpi_namespace_node *node,
acpi_ds_execute_arguments(struct acpi_namespace_node *node,
struct acpi_namespace_node *scope_node,
u32 aml_length,
u8 *aml_start)
u32 aml_length, u8 * aml_start)
{
acpi_status status;
union acpi_parse_object *op;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE("ds_execute_arguments");
/*
* Allocate a new parser op to be the root of the parsed tree
*/
@@ -183,7 +173,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_get_buffer_field_arguments
@@ -198,17 +187,14 @@ cleanup:
******************************************************************************/
acpi_status
acpi_ds_get_buffer_field_arguments (
union acpi_operand_object *obj_desc)
acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc)
{
union acpi_operand_object *extra_desc;
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_field_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS(AE_OK);
}
@@ -218,18 +204,19 @@ acpi_ds_get_buffer_field_arguments (
extra_desc = acpi_ns_get_secondary_object(obj_desc);
node = obj_desc->buffer_field.node;
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_BUFFER_FIELD, node, NULL));
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
(ACPI_TYPE_BUFFER_FIELD, node, NULL));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] buffer_field Arg Init\n",
acpi_ut_get_node_name(node)));
/* Execute the AML code for the term_arg arguments */
status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start);
extra_desc->extra.aml_length,
extra_desc->extra.aml_start);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_get_buffer_arguments
@@ -243,17 +230,13 @@ acpi_ds_get_buffer_field_arguments (
*
******************************************************************************/
acpi_status
acpi_ds_get_buffer_arguments (
union acpi_operand_object *obj_desc)
acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc)
{
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_get_buffer_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS(AE_OK);
}
@@ -262,8 +245,7 @@ acpi_ds_get_buffer_arguments (
node = obj_desc->buffer.node;
if (!node) {
ACPI_REPORT_ERROR ((
"No pointer back to NS node in buffer obj %p\n", obj_desc));
ACPI_REPORT_ERROR(("No pointer back to NS node in buffer obj %p\n", obj_desc));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -272,11 +254,11 @@ acpi_ds_get_buffer_arguments (
/* Execute the AML code for the term_arg arguments */
status = acpi_ds_execute_arguments(node, node,
obj_desc->buffer.aml_length, obj_desc->buffer.aml_start);
obj_desc->buffer.aml_length,
obj_desc->buffer.aml_start);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_get_package_arguments
@@ -290,17 +272,13 @@ acpi_ds_get_buffer_arguments (
*
******************************************************************************/
acpi_status
acpi_ds_get_package_arguments (
union acpi_operand_object *obj_desc)
acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc)
{
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_get_package_arguments", obj_desc);
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS(AE_OK);
}
@@ -309,8 +287,8 @@ acpi_ds_get_package_arguments (
node = obj_desc->package.node;
if (!node) {
ACPI_REPORT_ERROR ((
"No pointer back to NS node in package %p\n", obj_desc));
ACPI_REPORT_ERROR(("No pointer back to NS node in package %p\n",
obj_desc));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -319,11 +297,11 @@ acpi_ds_get_package_arguments (
/* Execute the AML code for the term_arg arguments */
status = acpi_ds_execute_arguments(node, node,
obj_desc->package.aml_length, obj_desc->package.aml_start);
obj_desc->package.aml_length,
obj_desc->package.aml_start);
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* FUNCTION: acpi_ds_get_region_arguments
@@ -337,18 +315,14 @@ acpi_ds_get_package_arguments (
*
****************************************************************************/
acpi_status
acpi_ds_get_region_arguments (
union acpi_operand_object *obj_desc)
acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
{
struct acpi_namespace_node *node;
acpi_status status;
union acpi_operand_object *extra_desc;
ACPI_FUNCTION_TRACE_PTR("ds_get_region_arguments", obj_desc);
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
return_ACPI_STATUS(AE_OK);
}
@@ -362,19 +336,22 @@ acpi_ds_get_region_arguments (
node = obj_desc->region.node;
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL));
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
(ACPI_TYPE_REGION, node, NULL));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] op_region Arg Init at AML %p\n",
acpi_ut_get_node_name (node), extra_desc->extra.aml_start));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"[%4.4s] op_region Arg Init at AML %p\n",
acpi_ut_get_node_name(node),
extra_desc->extra.aml_start));
/* Execute the argument AML */
status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node),
extra_desc->extra.aml_length, extra_desc->extra.aml_start);
extra_desc->extra.aml_length,
extra_desc->extra.aml_start);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_initialize_region
@@ -387,14 +364,11 @@ acpi_ds_get_region_arguments (
*
******************************************************************************/
acpi_status
acpi_ds_initialize_region (
acpi_handle obj_handle)
acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)
{
union acpi_operand_object *obj_desc;
acpi_status status;
obj_desc = acpi_ns_get_attached_object(obj_handle);
/* Namespace is NOT locked */
@@ -403,7 +377,6 @@ acpi_ds_initialize_region (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_buffer_field
@@ -422,8 +395,7 @@ acpi_ds_initialize_region (
******************************************************************************/
static acpi_status
acpi_ds_init_buffer_field (
u16 aml_opcode,
acpi_ds_init_buffer_field(u16 aml_opcode,
union acpi_operand_object *obj_desc,
union acpi_operand_object *buffer_desc,
union acpi_operand_object *offset_desc,
@@ -436,10 +408,8 @@ acpi_ds_init_buffer_field (
u8 field_flags;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_init_buffer_field", obj_desc);
/* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
@@ -546,13 +516,13 @@ acpi_ds_init_buffer_field (
/* 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,
"Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
acpi_ut_get_node_name(result_desc),
bit_offset + bit_count,
acpi_ut_get_node_name (buffer_desc->buffer.node),
acpi_ut_get_node_name(buffer_desc->buffer.
node),
8 * (u32) buffer_desc->buffer.length));
status = AE_AML_BUFFER_LIMIT;
goto cleanup;
@@ -574,8 +544,8 @@ acpi_ds_init_buffer_field (
/* Reference count for buffer_desc inherits obj_desc count */
buffer_desc->common.reference_count = (u16)
(buffer_desc->common.reference_count + obj_desc->common.reference_count);
(buffer_desc->common.reference_count +
obj_desc->common.reference_count);
cleanup:
@@ -592,8 +562,7 @@ cleanup:
if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference(result_desc); /* Result descriptor */
}
else {
} else {
/* Now the address and length are valid for this buffer_field */
obj_desc->buffer_field.flags |= AOPOBJ_DATA_VALID;
@@ -602,7 +571,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_eval_buffer_field_operands
@@ -618,8 +586,7 @@ cleanup:
******************************************************************************/
acpi_status
acpi_ds_eval_buffer_field_operands (
struct acpi_walk_state *walk_state,
acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op)
{
acpi_status status;
@@ -627,10 +594,8 @@ acpi_ds_eval_buffer_field_operands (
struct acpi_namespace_node *node;
union acpi_parse_object *next_op;
ACPI_FUNCTION_TRACE_PTR("ds_eval_buffer_field_operands", op);
/*
* This is where we evaluate the address and length fields of the
* create_xxx_field declaration
@@ -660,11 +625,13 @@ acpi_ds_eval_buffer_field_operands (
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name(op->common.aml_opcode),
walk_state->num_operands, "after acpi_ex_resolve_operands");
walk_state->num_operands,
"after acpi_ex_resolve_operands");
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
acpi_ps_get_opcode_name (op->common.aml_opcode), status));
acpi_ps_get_opcode_name(op->common.
aml_opcode), status));
return_ACPI_STATUS(status);
}
@@ -674,22 +641,25 @@ acpi_ds_eval_buffer_field_operands (
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
/* NOTE: Slightly different operands for this opcode */
status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
walk_state->operands[0], walk_state->operands[1],
walk_state->operands[2], walk_state->operands[3]);
}
else {
status =
acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
walk_state->operands[0],
walk_state->operands[1],
walk_state->operands[2],
walk_state->operands[3]);
} else {
/* All other, create_xxx_field opcodes */
status = acpi_ds_init_buffer_field (op->common.aml_opcode, obj_desc,
walk_state->operands[0], walk_state->operands[1],
NULL, walk_state->operands[2]);
status =
acpi_ds_init_buffer_field(op->common.aml_opcode, obj_desc,
walk_state->operands[0],
walk_state->operands[1], NULL,
walk_state->operands[2]);
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_eval_region_operands
@@ -705,8 +675,7 @@ acpi_ds_eval_buffer_field_operands (
******************************************************************************/
acpi_status
acpi_ds_eval_region_operands (
struct acpi_walk_state *walk_state,
acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op)
{
acpi_status status;
@@ -715,10 +684,8 @@ acpi_ds_eval_region_operands (
struct acpi_namespace_node *node;
union acpi_parse_object *next_op;
ACPI_FUNCTION_TRACE_PTR("ds_eval_region_operands", op);
/*
* This is where we evaluate the address and length fields of the
* op_region declaration
@@ -788,7 +755,6 @@ acpi_ds_eval_region_operands (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_eval_data_object_operands
@@ -805,8 +771,7 @@ acpi_ds_eval_region_operands (
******************************************************************************/
acpi_status
acpi_ds_eval_data_object_operands (
struct acpi_walk_state *walk_state,
acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
union acpi_operand_object *obj_desc)
{
@@ -814,10 +779,8 @@ acpi_ds_eval_data_object_operands (
union acpi_operand_object *arg_desc;
u32 length;
ACPI_FUNCTION_TRACE("ds_eval_data_object_operands");
/* The first operand (for all of these data objects) is the length */
status = acpi_ds_create_operand(walk_state, op->common.value.arg, 1);
@@ -826,8 +789,9 @@ acpi_ds_eval_data_object_operands (
}
status = acpi_ex_resolve_operands(walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
walk_state);
&(walk_state->
operands[walk_state->num_operands -
1]), walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -852,13 +816,17 @@ acpi_ds_eval_data_object_operands (
switch (op->common.aml_opcode) {
case AML_BUFFER_OP:
status = acpi_ds_build_internal_buffer_obj (walk_state, op, length, &obj_desc);
status =
acpi_ds_build_internal_buffer_obj(walk_state, op, length,
&obj_desc);
break;
case AML_PACKAGE_OP:
case AML_VAR_PACKAGE_OP:
status = acpi_ds_build_internal_package_obj (walk_state, op, length, &obj_desc);
status =
acpi_ds_build_internal_package_obj(walk_state, op, length,
&obj_desc);
break;
default:
@@ -873,8 +841,10 @@ acpi_ds_eval_data_object_operands (
*/
if ((!op->common.parent) ||
((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
(op->common.parent->common.aml_opcode != AML_VAR_PACKAGE_OP) &&
(op->common.parent->common.aml_opcode != AML_NAME_OP))) {
(op->common.parent->common.aml_opcode !=
AML_VAR_PACKAGE_OP)
&& (op->common.parent->common.aml_opcode !=
AML_NAME_OP))) {
walk_state->result_obj = obj_desc;
}
}
@@ -882,7 +852,6 @@ acpi_ds_eval_data_object_operands (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_exec_begin_control_op
@@ -898,17 +867,14 @@ acpi_ds_eval_data_object_operands (
******************************************************************************/
acpi_status
acpi_ds_exec_begin_control_op (
struct acpi_walk_state *walk_state,
acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op)
{
acpi_status status = AE_OK;
union acpi_generic_state *control_state;
ACPI_FUNCTION_NAME("ds_exec_begin_control_op");
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", op,
op->common.aml_opcode, walk_state));
@@ -930,14 +896,16 @@ acpi_ds_exec_begin_control_op (
* Save a pointer to the predicate for multiple executions
* of a loop
*/
control_state->control.aml_predicate_start = walk_state->parser_state.aml - 1;
control_state->control.package_end = walk_state->parser_state.pkg_end;
control_state->control.aml_predicate_start =
walk_state->parser_state.aml - 1;
control_state->control.package_end =
walk_state->parser_state.pkg_end;
control_state->control.opcode = op->common.aml_opcode;
/* Push the control state on this walk's control stack */
acpi_ut_push_generic_state (&walk_state->control_state, control_state);
acpi_ut_push_generic_state(&walk_state->control_state,
control_state);
break;
case AML_ELSE_OP:
@@ -962,7 +930,6 @@ acpi_ds_exec_begin_control_op (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_exec_end_control_op
@@ -978,17 +945,14 @@ acpi_ds_exec_begin_control_op (
******************************************************************************/
acpi_status
acpi_ds_exec_end_control_op (
struct acpi_walk_state *walk_state,
acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
union acpi_parse_object * op)
{
acpi_status status = AE_OK;
union acpi_generic_state *control_state;
ACPI_FUNCTION_NAME("ds_exec_end_control_op");
switch (op->common.aml_opcode) {
case AML_IF_OP:
@@ -1005,16 +969,15 @@ acpi_ds_exec_end_control_op (
* Pop the control state that was created at the start
* of the IF and free it
*/
control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
control_state =
acpi_ut_pop_generic_state(&walk_state->control_state);
acpi_ut_delete_generic_state(control_state);
break;
case AML_ELSE_OP:
break;
case AML_WHILE_OP:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "[WHILE_OP] Op=%p\n", op));
@@ -1030,17 +993,19 @@ acpi_ds_exec_end_control_op (
/* Pop this control state and free it */
control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
control_state =
acpi_ut_pop_generic_state(&walk_state->control_state);
walk_state->aml_last_while = control_state->control.aml_predicate_start;
walk_state->aml_last_while =
control_state->control.aml_predicate_start;
acpi_ut_delete_generic_state(control_state);
break;
case AML_RETURN_OP:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"[RETURN_OP] Op=%p Arg=%p\n",op, op->common.value.arg));
"[RETURN_OP] Op=%p Arg=%p\n", op,
op->common.value.arg));
/*
* One optional operand -- the return value
@@ -1054,7 +1019,9 @@ acpi_ds_exec_end_control_op (
/* Return statement has an immediate operand */
status = acpi_ds_create_operands (walk_state, op->common.value.arg);
status =
acpi_ds_create_operands(walk_state,
op->common.value.arg);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -1064,7 +1031,9 @@ acpi_ds_exec_end_control_op (
* an arg or local), resolve it now because it may
* cease to exist at the end of the method.
*/
status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
status =
acpi_ex_resolve_to_value(&walk_state->operands[0],
walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -1075,8 +1044,7 @@ acpi_ds_exec_end_control_op (
* is set to anything other than zero!
*/
walk_state->return_desc = walk_state->operands[0];
}
else if ((walk_state->results) &&
} else if ((walk_state->results) &&
(walk_state->results->results.num_results > 0)) {
/* Since we have a real Return(), delete any implicit return */
@@ -1091,22 +1059,33 @@ acpi_ds_exec_end_control_op (
*
* Allow references created by the Index operator to return unchanged.
*/
if ((ACPI_GET_DESCRIPTOR_TYPE (walk_state->results->results.obj_desc[0]) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (walk_state->results->results.obj_desc [0]) == ACPI_TYPE_LOCAL_REFERENCE) &&
((walk_state->results->results.obj_desc [0])->reference.opcode != AML_INDEX_OP)) {
status = acpi_ex_resolve_to_value (&walk_state->results->results.obj_desc [0], walk_state);
if ((ACPI_GET_DESCRIPTOR_TYPE
(walk_state->results->results.obj_desc[0]) ==
ACPI_DESC_TYPE_OPERAND)
&&
(ACPI_GET_OBJECT_TYPE
(walk_state->results->results.obj_desc[0]) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])->
reference.opcode != AML_INDEX_OP)) {
status =
acpi_ex_resolve_to_value(&walk_state->
results->results.
obj_desc[0],
walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}
}
walk_state->return_desc = walk_state->results->results.obj_desc [0];
}
else {
walk_state->return_desc =
walk_state->results->results.obj_desc[0];
} else {
/* No return operand */
if (walk_state->num_operands) {
acpi_ut_remove_reference (walk_state->operands [0]);
acpi_ut_remove_reference(walk_state->
operands[0]);
}
walk_state->operands[0] = NULL;
@@ -1114,7 +1093,6 @@ acpi_ds_exec_end_control_op (
walk_state->return_desc = NULL;
}
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Completed RETURN_OP State=%p, ret_val=%p\n",
walk_state, walk_state->return_desc));
@@ -1124,33 +1102,34 @@ acpi_ds_exec_end_control_op (
status = AE_CTRL_TERMINATE;
break;
case AML_NOOP_OP:
/* Just do nothing! */
break;
case AML_BREAK_POINT_OP:
/* Call up to the OS service layer to handle this */
status = acpi_os_signal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode");
status =
acpi_os_signal(ACPI_SIGNAL_BREAKPOINT,
"Executed AML Breakpoint opcode");
/* If and when it returns, all done. */
break;
case AML_BREAK_OP:
case AML_CONTINUE_OP: /* ACPI 2.0 */
/* Pop and delete control states until we find a while */
while (walk_state->control_state &&
(walk_state->control_state->control.opcode != AML_WHILE_OP)) {
control_state = acpi_ut_pop_generic_state (&walk_state->control_state);
(walk_state->control_state->control.opcode !=
AML_WHILE_OP)) {
control_state =
acpi_ut_pop_generic_state(&walk_state->
control_state);
acpi_ut_delete_generic_state(control_state);
}
@@ -1162,22 +1141,22 @@ acpi_ds_exec_end_control_op (
/* Was: walk_state->aml_last_while = walk_state->control_state->Control.aml_predicate_start; */
walk_state->aml_last_while = walk_state->control_state->control.package_end;
walk_state->aml_last_while =
walk_state->control_state->control.package_end;
/* Return status depending on opcode */
if (op->common.aml_opcode == AML_BREAK_OP) {
status = AE_CTRL_BREAK;
}
else {
} else {
status = AE_CTRL_CONTINUE;
}
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown control opcode=%X Op=%p\n",
op->common.aml_opcode, op));
status = AE_AML_BAD_OPCODE;
@@ -1186,4 +1165,3 @@ acpi_ds_exec_end_control_op (
return (status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -53,7 +52,6 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dsutils")
/*******************************************************************************
*
* FUNCTION: acpi_ds_clear_implicit_return
@@ -68,14 +66,10 @@
* parent method exits.)
*
******************************************************************************/
void
acpi_ds_clear_implicit_return (
struct acpi_walk_state *walk_state)
void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_NAME("ds_clear_implicit_return");
/*
* Slack must be enabled for this feature
*/
@@ -98,7 +92,6 @@ acpi_ds_clear_implicit_return (
}
}
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -119,27 +112,22 @@ acpi_ds_clear_implicit_return (
******************************************************************************/
u8
acpi_ds_do_implicit_return (
union acpi_operand_object *return_desc,
struct acpi_walk_state *walk_state,
u8 add_reference)
acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
struct acpi_walk_state *walk_state, u8 add_reference)
{
ACPI_FUNCTION_NAME("ds_do_implicit_return");
/*
* Slack must be enabled for this feature, and we must
* have a valid return object
*/
if ((!acpi_gbl_enable_interpreter_slack) ||
(!return_desc)) {
if ((!acpi_gbl_enable_interpreter_slack) || (!return_desc)) {
return (FALSE);
}
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Result %p will be implicitly returned; Prev=%p\n",
return_desc,
walk_state->implicit_return_obj));
return_desc, walk_state->implicit_return_obj));
/*
* Delete any "stale" implicit return value first. However, in
@@ -164,7 +152,6 @@ acpi_ds_do_implicit_return (
return (TRUE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_is_result_used
@@ -179,15 +166,13 @@ acpi_ds_do_implicit_return (
******************************************************************************/
u8
acpi_ds_is_result_used (
union acpi_parse_object *op,
acpi_ds_is_result_used(union acpi_parse_object * op,
struct acpi_walk_state * walk_state)
{
const struct acpi_opcode_info *parent_info;
ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op);
/* Must have both an Op and a Result Object */
if (!op) {
@@ -204,7 +189,8 @@ acpi_ds_is_result_used (
* NOTE: this is optional because the ASL language does not actually
* support this behavior.
*/
(void) acpi_ds_do_implicit_return (walk_state->result_obj, walk_state, TRUE);
(void)acpi_ds_do_implicit_return(walk_state->result_obj, walk_state,
TRUE);
/*
* Now determine if the parent will use the result
@@ -220,13 +206,15 @@ acpi_ds_is_result_used (
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"At Method level, result of [%s] not used\n",
acpi_ps_get_opcode_name (op->common.aml_opcode)));
acpi_ps_get_opcode_name(op->common.
aml_opcode)));
return_VALUE(FALSE);
}
/* Get info on the parent. The root_op is AML_SCOPE */
parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
parent_info =
acpi_ps_get_opcode_info(op->common.parent->common.aml_opcode);
if (parent_info->class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown parent opcode. Op=%p\n", op));
@@ -256,8 +244,10 @@ acpi_ds_is_result_used (
* If we are executing the predicate AND this is the predicate op,
* we will use the return value
*/
if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) {
if ((walk_state->control_state->common.state ==
ACPI_CONTROL_PREDICATE_EXECUTING)
&& (walk_state->control_state->control.
predicate_op == op)) {
goto result_used;
}
break;
@@ -271,7 +261,6 @@ acpi_ds_is_result_used (
goto result_not_used;
case AML_CLASS_CREATE:
/*
@@ -280,15 +269,16 @@ acpi_ds_is_result_used (
*/
goto result_used;
case AML_CLASS_NAMED_OBJECT:
if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
(op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
(op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
(op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP) ||
(op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
(op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_OP)) {
(op->common.parent->common.aml_opcode == AML_DATA_REGION_OP)
|| (op->common.parent->common.aml_opcode == AML_PACKAGE_OP)
|| (op->common.parent->common.aml_opcode ==
AML_VAR_PACKAGE_OP)
|| (op->common.parent->common.aml_opcode == AML_BUFFER_OP)
|| (op->common.parent->common.aml_opcode ==
AML_INT_EVAL_SUBTREE_OP)) {
/*
* These opcodes allow term_arg(s) as operands and therefore
* the operands can be method calls. The result is used.
@@ -298,7 +288,6 @@ acpi_ds_is_result_used (
goto result_not_used;
default:
/*
@@ -308,26 +297,25 @@ acpi_ds_is_result_used (
goto result_used;
}
result_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Result of [%s] used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name(op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));
return_VALUE(TRUE);
result_not_used:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Result of [%s] not used by Parent [%s] Op=%p\n",
acpi_ps_get_opcode_name(op->common.aml_opcode),
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
acpi_ps_get_opcode_name(op->common.parent->common.
aml_opcode), op));
return_VALUE(FALSE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_delete_result_if_not_used
@@ -346,18 +334,15 @@ result_not_used:
******************************************************************************/
void
acpi_ds_delete_result_if_not_used (
union acpi_parse_object *op,
acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
union acpi_operand_object *result_obj,
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
if (!op) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
return_VOID;
@@ -379,7 +364,6 @@ acpi_ds_delete_result_if_not_used (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_resolve_operands
@@ -394,24 +378,22 @@ acpi_ds_delete_result_if_not_used (
*
******************************************************************************/
acpi_status
acpi_ds_resolve_operands (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
{
u32 i;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state);
/*
* Attempt to resolve each of the valid operands
* Method arguments are passed by reference, not by value. This means
* that the actual objects are passed, not copies of the objects.
*/
for (i = 0; i < walk_state->num_operands; i++) {
status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
status =
acpi_ex_resolve_to_value(&walk_state->operands[i],
walk_state);
if (ACPI_FAILURE(status)) {
break;
}
@@ -420,7 +402,6 @@ acpi_ds_resolve_operands (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_clear_operands
@@ -433,16 +414,12 @@ acpi_ds_resolve_operands (
*
******************************************************************************/
void
acpi_ds_clear_operands (
struct acpi_walk_state *walk_state)
void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state);
/* Remove a reference on each operand on the stack */
for (i = 0; i < walk_state->num_operands; i++) {
@@ -459,7 +436,6 @@ acpi_ds_clear_operands (
}
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_operand
@@ -478,10 +454,8 @@ acpi_ds_clear_operands (
******************************************************************************/
acpi_status
acpi_ds_create_operand (
struct acpi_walk_state *walk_state,
union acpi_parse_object *arg,
u32 arg_index)
acpi_ds_create_operand(struct acpi_walk_state *walk_state,
union acpi_parse_object *arg, u32 arg_index)
{
acpi_status status = AE_OK;
char *name_string;
@@ -492,19 +466,20 @@ acpi_ds_create_operand (
acpi_interpreter_mode interpreter_mode;
const struct acpi_opcode_info *op_info;
ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg);
/* A valid name must be looked up in the namespace */
if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
(arg->common.value.string)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", arg));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n",
arg));
/* Get the entire name string from the AML stream */
status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
status =
acpi_ex_get_name_string(ACPI_TYPE_ANY,
arg->common.value.buffer,
&name_string, &name_length);
if (ACPI_FAILURE(status)) {
@@ -523,13 +498,14 @@ acpi_ds_create_operand (
* actual opcode exists.
*/
if ((walk_state->deferred_node) &&
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
(arg_index != 0)) {
obj_desc = ACPI_CAST_PTR (
union acpi_operand_object, walk_state->deferred_node);
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
&& (arg_index != 0)) {
obj_desc =
ACPI_CAST_PTR(union acpi_operand_object,
walk_state->deferred_node);
status = AE_OK;
}
else /* All other opcodes */ {
} else { /* All other opcodes */
/*
* Differentiate between a namespace "create" operation
* versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
@@ -537,43 +513,51 @@ acpi_ds_create_operand (
* namespace objects during the execution of control methods.
*/
parent_op = arg->common.parent;
op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
if ((op_info->flags & AML_NSNODE) &&
(parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
(parent_op->common.aml_opcode != AML_REGION_OP) &&
(parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
op_info =
acpi_ps_get_opcode_info(parent_op->common.
aml_opcode);
if ((op_info->flags & AML_NSNODE)
&& (parent_op->common.aml_opcode !=
AML_INT_METHODCALL_OP)
&& (parent_op->common.aml_opcode != AML_REGION_OP)
&& (parent_op->common.aml_opcode !=
AML_INT_NAMEPATH_OP)) {
/* Enter name into namespace if not found */
interpreter_mode = ACPI_IMODE_LOAD_PASS2;
}
else {
} else {
/* Return a failure if name not found */
interpreter_mode = ACPI_IMODE_EXECUTE;
}
status = acpi_ns_lookup (walk_state->scope_info, name_string,
status =
acpi_ns_lookup(walk_state->scope_info, name_string,
ACPI_TYPE_ANY, interpreter_mode,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state,
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc));
ACPI_NS_SEARCH_PARENT |
ACPI_NS_DONT_OPEN_SCOPE, walk_state,
ACPI_CAST_INDIRECT_PTR(struct
acpi_namespace_node,
&obj_desc));
/*
* The only case where we pass through (ignore) a NOT_FOUND
* error is for the cond_ref_of opcode.
*/
if (status == AE_NOT_FOUND) {
if (parent_op->common.aml_opcode == AML_COND_REF_OF_OP) {
if (parent_op->common.aml_opcode ==
AML_COND_REF_OF_OP) {
/*
* For the Conditional Reference op, it's OK if
* the name is not found; We just need a way to
* indicate this to the interpreter, set the
* object to the root
*/
obj_desc = ACPI_CAST_PTR (
union acpi_operand_object, acpi_gbl_root_node);
obj_desc =
ACPI_CAST_PTR(union
acpi_operand_object,
acpi_gbl_root_node);
status = AE_OK;
}
else {
} else {
/*
* We just plain didn't find it -- which is a
* very serious error at this point
@@ -603,9 +587,9 @@ acpi_ds_create_operand (
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
}
else {
ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(obj_desc, walk_state));
} else {
/* Check for null name case */
if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
@@ -619,8 +603,7 @@ acpi_ds_create_operand (
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Null namepath: Arg=%p\n", arg));
}
else {
} else {
opcode = arg->common.aml_opcode;
}
@@ -635,14 +618,18 @@ acpi_ds_create_operand (
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Argument previously created, already stacked \n"));
ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (
walk_state->operands [walk_state->num_operands - 1], walk_state));
ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(walk_state->
operands[walk_state->num_operands -
1], walk_state));
/*
* Use value that was already previously returned
* by the evaluation of this argument
*/
status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
status =
acpi_ds_result_pop_from_bottom(&obj_desc,
walk_state);
if (ACPI_FAILURE(status)) {
/*
* Only error is underflow, and this indicates
@@ -650,22 +637,25 @@ acpi_ds_create_operand (
*/
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Missing or null operand, %s\n",
acpi_format_exception (status)));
acpi_format_exception
(status)));
return_ACPI_STATUS(status);
}
}
else {
} else {
/* Create an ACPI_INTERNAL_OBJECT for the argument */
obj_desc = acpi_ut_create_internal_object (op_info->object_type);
obj_desc =
acpi_ut_create_internal_object(op_info->
object_type);
if (!obj_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Initialize the new object */
status = acpi_ds_init_object_from_op (
walk_state, arg, opcode, &obj_desc);
status =
acpi_ds_init_object_from_op(walk_state, arg, opcode,
&obj_desc);
if (ACPI_FAILURE(status)) {
acpi_ut_delete_object_desc(obj_desc);
return_ACPI_STATUS(status);
@@ -679,13 +669,13 @@ acpi_ds_create_operand (
return_ACPI_STATUS(status);
}
ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (obj_desc, walk_state));
ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
(obj_desc, walk_state));
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_operands
@@ -702,18 +692,15 @@ acpi_ds_create_operand (
******************************************************************************/
acpi_status
acpi_ds_create_operands (
struct acpi_walk_state *walk_state,
acpi_ds_create_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *first_arg)
{
acpi_status status = AE_OK;
union acpi_parse_object *arg;
u32 arg_count = 0;
ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg);
/* For all arguments in the list... */
arg = first_arg;
@@ -723,8 +710,9 @@ acpi_ds_create_operands (
goto cleanup;
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
arg_count, arg, first_arg));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Arg #%d (%p) done, Arg1=%p\n", arg_count,
arg, first_arg));
/* Move on to next argument, if any */
@@ -734,7 +722,6 @@ acpi_ds_create_operands (
return_ACPI_STATUS(status);
cleanup:
/*
* We must undo everything done above; meaning that we must
@@ -747,5 +734,3 @@ cleanup:
(arg_count + 1), acpi_format_exception(status)));
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -52,7 +51,6 @@
#include <acpi/acdebug.h>
#include <acpi/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dswexec")
@@ -71,8 +69,8 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
acpi_ex_opcode_2A_2T_1R,
acpi_ex_opcode_3A_0T_0R,
acpi_ex_opcode_3A_1T_1R,
acpi_ex_opcode_6A_0T_1R};
acpi_ex_opcode_6A_0T_1R
};
/*****************************************************************************
*
@@ -88,17 +86,15 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
****************************************************************************/
acpi_status
acpi_ds_get_predicate_value (
struct acpi_walk_state *walk_state,
union acpi_operand_object *result_obj) {
acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
union acpi_operand_object *result_obj)
{
acpi_status status = AE_OK;
union acpi_operand_object *obj_desc;
union acpi_operand_object *local_obj_desc = NULL;
ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state);
walk_state->control_state->common.state = 0;
if (result_obj) {
@@ -110,14 +106,15 @@ acpi_ds_get_predicate_value (
return_ACPI_STATUS(status);
}
}
else {
} else {
status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
status =
acpi_ex_resolve_to_value(&walk_state->operands[0],
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -145,7 +142,8 @@ acpi_ds_get_predicate_value (
if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
obj_desc, walk_state, ACPI_GET_OBJECT_TYPE (obj_desc)));
obj_desc, walk_state,
ACPI_GET_OBJECT_TYPE(obj_desc)));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
@@ -161,8 +159,7 @@ acpi_ds_get_predicate_value (
*/
if (local_obj_desc->integer.value) {
walk_state->control_state->common.value = TRUE;
}
else {
} else {
/*
* Predicate is FALSE, we will just toss the
* rest of the package
@@ -171,15 +168,16 @@ acpi_ds_get_predicate_value (
status = AE_CTRL_FALSE;
}
cleanup:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
walk_state->control_state->common.value, walk_state->op));
walk_state->control_state->common.value,
walk_state->op));
/* Break to debugger to display result */
ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (local_obj_desc, walk_state));
ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
(local_obj_desc, walk_state));
/*
* Delete the predicate result object (we know that
@@ -194,7 +192,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* FUNCTION: acpi_ds_exec_begin_op
@@ -211,18 +208,15 @@ cleanup:
****************************************************************************/
acpi_status
acpi_ds_exec_begin_op (
struct acpi_walk_state *walk_state,
acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
union acpi_parse_object **out_op)
{
union acpi_parse_object *op;
acpi_status status = AE_OK;
u32 opcode_class;
ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
op = walk_state->op;
if (!op) {
status = acpi_ds_load2_begin_op(walk_state, out_op);
@@ -233,12 +227,16 @@ acpi_ds_exec_begin_op (
op = *out_op;
walk_state->op = op;
walk_state->opcode = op->common.aml_opcode;
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(op->common.aml_opcode);
if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name (walk_state->op_info->object_type), op));
acpi_ut_get_type_name(walk_state->
op_info->
object_type),
op));
status = acpi_ds_scope_stack_pop(walk_state);
if (ACPI_FAILURE(status)) {
@@ -263,17 +261,18 @@ acpi_ds_exec_begin_op (
if ((walk_state->control_state) &&
(walk_state->control_state->common.state ==
ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
op, walk_state));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Exec predicate Op=%p State=%p\n", op,
walk_state));
walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING;
walk_state->control_state->common.state =
ACPI_CONTROL_PREDICATE_EXECUTING;
/* Save start of predicate */
walk_state->control_state->control.predicate_op = op;
}
opcode_class = walk_state->op_info->class;
/* We want to send namepaths to the load code */
@@ -296,7 +295,6 @@ acpi_ds_exec_begin_op (
status = acpi_ds_exec_begin_control_op(walk_state, op);
break;
case AML_CLASS_NAMED_OBJECT:
if (walk_state->walk_type == ACPI_WALK_METHOD) {
@@ -314,7 +312,6 @@ acpi_ds_exec_begin_op (
}
break;
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
@@ -325,7 +322,6 @@ acpi_ds_exec_begin_op (
status = acpi_ds_result_stack_push(walk_state);
break;
default:
break;
}
@@ -335,7 +331,6 @@ acpi_ds_exec_begin_op (
return_ACPI_STATUS(status);
}
/*****************************************************************************
*
* FUNCTION: acpi_ds_exec_end_op
@@ -350,9 +345,7 @@ acpi_ds_exec_begin_op (
*
****************************************************************************/
acpi_status
acpi_ds_exec_end_op (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
{
union acpi_parse_object *op;
acpi_status status = AE_OK;
@@ -361,16 +354,15 @@ acpi_ds_exec_end_op (
union acpi_parse_object *next_op;
union acpi_parse_object *first_arg;
ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
op = walk_state->op;
op_type = walk_state->op_info->type;
op_class = walk_state->op_info->class;
if (op_class == AML_CLASS_UNKNOWN) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
op->common.aml_opcode));
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
}
@@ -384,8 +376,11 @@ acpi_ds_exec_end_op (
/* Call debugger for single step support (DEBUG build only) */
ACPI_DEBUGGER_EXEC (status = acpi_db_single_step (walk_state, op, op_class));
ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (status);});
ACPI_DEBUGGER_EXEC(status =
acpi_db_single_step(walk_state, op, op_class));
ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);}
) ;
/* Decode the Opcode Class */
@@ -393,7 +388,6 @@ acpi_ds_exec_end_op (
case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
break;
case AML_CLASS_EXECUTE: /* most operators with arguments */
/* Build resolved operand stack */
@@ -418,12 +412,18 @@ acpi_ds_exec_end_op (
/* Resolve all operands */
status = acpi_ex_resolve_operands(walk_state->opcode,
&(walk_state->operands [walk_state->num_operands -1]),
&(walk_state->
operands
[walk_state->
num_operands - 1]),
walk_state);
if (ACPI_SUCCESS(status)) {
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name (walk_state->opcode),
walk_state->num_operands, "after ex_resolve_operands");
ACPI_DUMP_OPERANDS(ACPI_WALK_OPERANDS,
ACPI_IMODE_EXECUTE,
acpi_ps_get_opcode_name
(walk_state->opcode),
walk_state->num_operands,
"after ex_resolve_operands");
}
}
@@ -433,28 +433,31 @@ acpi_ds_exec_end_op (
* routine. There is one routine per opcode "type" based upon the
* number of opcode arguments and return type.
*/
status = acpi_gbl_op_type_dispatch[op_type] (walk_state);
}
else {
status =
acpi_gbl_op_type_dispatch[op_type] (walk_state);
} else {
/*
* Treat constructs of the form "Store(local_x,local_x)" as noops when the
* Local is uninitialized.
*/
if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
(walk_state->opcode == AML_STORE_OP) &&
(walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
(walk_state->operands[0]->reference.opcode ==
walk_state->operands[1]->reference.opcode) &&
(walk_state->operands[0]->reference.offset ==
(walk_state->operands[0]->common.type ==
ACPI_TYPE_LOCAL_REFERENCE)
&& (walk_state->operands[1]->common.type ==
ACPI_TYPE_LOCAL_REFERENCE)
&& (walk_state->operands[0]->reference.opcode ==
walk_state->operands[1]->reference.opcode)
&& (walk_state->operands[0]->reference.offset ==
walk_state->operands[1]->reference.offset)) {
status = AE_OK;
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"[%s]: Could not resolve operands, %s\n",
acpi_ps_get_opcode_name (walk_state->opcode),
acpi_format_exception (status)));
acpi_ps_get_opcode_name
(walk_state->opcode),
acpi_format_exception
(status)));
}
}
@@ -466,14 +469,14 @@ acpi_ds_exec_end_op (
* If a result object was returned from above, push it on the
* current result stack
*/
if (ACPI_SUCCESS (status) &&
walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state);
if (ACPI_SUCCESS(status) && walk_state->result_obj) {
status =
acpi_ds_result_push(walk_state->result_obj,
walk_state);
}
break;
default:
switch (op_type) {
@@ -487,8 +490,7 @@ acpi_ds_exec_end_op (
if (ACPI_SUCCESS(status)) {
status = acpi_ds_result_stack_pop(walk_state);
}
else if (status == AE_CTRL_PENDING) {
} else if (status == AE_CTRL_PENDING) {
status = acpi_ds_result_stack_pop(walk_state);
if (ACPI_SUCCESS(status)) {
status = AE_CTRL_PENDING;
@@ -496,7 +498,6 @@ acpi_ds_exec_end_op (
}
break;
case AML_TYPE_METHOD_CALL:
/*
@@ -505,16 +506,22 @@ acpi_ds_exec_end_op (
* a reference to it.
*/
if ((op->asl.parent) &&
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
(op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
|| (op->asl.parent->asl.aml_opcode ==
AML_VAR_PACKAGE_OP))) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Method Reference in a Package, Op=%p\n", op));
op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
"Method Reference in a Package, Op=%p\n",
op));
op->common.node =
(struct acpi_namespace_node *)op->asl.value.
arg->asl.node->object;
acpi_ut_add_reference(op->asl.value.arg->asl.
node->object);
return_ACPI_STATUS(AE_OK);
}
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", op));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Method invocation, Op=%p\n", op));
/*
* (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
@@ -561,25 +568,26 @@ acpi_ds_exec_end_op (
*/
return_ACPI_STATUS(status);
case AML_TYPE_CREATE_FIELD:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Executing create_field Buffer/Index Op=%p\n", op));
"Executing create_field Buffer/Index Op=%p\n",
op));
status = acpi_ds_load2_end_op(walk_state);
if (ACPI_FAILURE(status)) {
break;
}
status = acpi_ds_eval_buffer_field_operands (walk_state, op);
status =
acpi_ds_eval_buffer_field_operands(walk_state, op);
break;
case AML_TYPE_CREATE_OBJECT:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Executing create_object (Buffer/Package) Op=%p\n", op));
"Executing create_object (Buffer/Package) Op=%p\n",
op));
switch (op->common.parent->common.aml_opcode) {
case AML_NAME_OP:
@@ -588,11 +596,13 @@ acpi_ds_exec_end_op (
* Put the Node on the object stack (Contains the ACPI Name
* of this object)
*/
walk_state->operands[0] = (void *) op->common.parent->common.node;
walk_state->operands[0] =
(void *)op->common.parent->common.node;
walk_state->num_operands = 1;
status = acpi_ds_create_node(walk_state,
op->common.parent->common.node,
op->common.parent->
common.node,
op->common.parent);
if (ACPI_FAILURE(status)) {
break;
@@ -603,13 +613,19 @@ acpi_ds_exec_end_op (
case AML_INT_EVAL_SUBTREE_OP:
status = acpi_ds_eval_data_object_operands (walk_state, op,
acpi_ns_get_attached_object (op->common.parent->common.node));
status =
acpi_ds_eval_data_object_operands
(walk_state, op,
acpi_ns_get_attached_object(op->common.
parent->common.
node));
break;
default:
status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
status =
acpi_ds_eval_data_object_operands
(walk_state, op, NULL);
break;
}
@@ -625,11 +641,12 @@ acpi_ds_exec_end_op (
* current result stack
*/
if (walk_state->result_obj) {
status = acpi_ds_result_push (walk_state->result_obj, walk_state);
status =
acpi_ds_result_push(walk_state->result_obj,
walk_state);
}
break;
case AML_TYPE_NAMED_FIELD:
case AML_TYPE_NAMED_COMPLEX:
case AML_TYPE_NAMED_SIMPLE:
@@ -642,9 +659,12 @@ acpi_ds_exec_end_op (
if (op->common.aml_opcode == AML_REGION_OP) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Executing op_region Address/Length Op=%p\n", op));
"Executing op_region Address/Length Op=%p\n",
op));
status = acpi_ds_eval_region_operands (walk_state, op);
status =
acpi_ds_eval_region_operands(walk_state,
op);
if (ACPI_FAILURE(status)) {
break;
}
@@ -654,14 +674,12 @@ acpi_ds_exec_end_op (
break;
case AML_TYPE_UNDEFINED:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Undefined opcode type Op=%p\n", op));
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
case AML_TYPE_BOGUS:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -669,12 +687,12 @@ acpi_ds_exec_end_op (
walk_state->opcode, op));
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
op_class, op_type, op->common.aml_opcode, op));
op_class, op_type,
op->common.aml_opcode, op));
status = AE_NOT_IMPLEMENTED;
break;
@@ -697,39 +715,42 @@ acpi_ds_exec_end_op (
(walk_state->control_state->common.state ==
ACPI_CONTROL_PREDICATE_EXECUTING) &&
(walk_state->control_state->control.predicate_op == op)) {
status = acpi_ds_get_predicate_value (walk_state, walk_state->result_obj);
status =
acpi_ds_get_predicate_value(walk_state,
walk_state->result_obj);
walk_state->result_obj = NULL;
}
cleanup:
/* Invoke exception handler on error */
if (ACPI_FAILURE(status) &&
acpi_gbl_exception_handler &&
!(status & AE_CODE_CONTROL)) {
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);
walk_state->method_node->
name.integer,
walk_state->opcode,
walk_state->aml_offset,
NULL);
(void)acpi_ex_enter_interpreter();
}
if (walk_state->result_obj) {
/* Break to debugger to display result */
ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
walk_state));
ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
(walk_state->result_obj, walk_state));
/*
* Delete the result op if and only if:
* Parent will not use the result -- such as any
* non-nested type2 op in a method (parent will be method)
*/
acpi_ds_delete_result_if_not_used (op, walk_state->result_obj, walk_state);
acpi_ds_delete_result_if_not_used(op, walk_state->result_obj,
walk_state);
}
#ifdef _UNDER_DEVELOPMENT
if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
@@ -752,5 +773,3 @@ cleanup:
return_ACPI_STATUS(status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -57,7 +56,6 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dswload")
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_callbacks
@@ -70,11 +68,8 @@
* DESCRIPTION: Init walk state callbacks
*
******************************************************************************/
acpi_status
acpi_ds_init_callbacks (
struct acpi_walk_state *walk_state,
u32 pass_number)
acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
{
switch (pass_number) {
@@ -108,7 +103,6 @@ acpi_ds_init_callbacks (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_load1_begin_op
@@ -123,8 +117,7 @@ acpi_ds_init_callbacks (
******************************************************************************/
acpi_status
acpi_ds_load1_begin_op (
struct acpi_walk_state *walk_state,
acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
union acpi_parse_object ** out_op)
{
union acpi_parse_object *op;
@@ -134,12 +127,11 @@ acpi_ds_load1_begin_op (
char *path;
u32 flags;
ACPI_FUNCTION_NAME("ds_load1_begin_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
walk_state));
/* We are only interested in opcodes that have an associated name */
@@ -164,7 +156,8 @@ acpi_ds_load1_begin_op (
object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"State=%p Op=%p [%s]\n", walk_state, op, acpi_ut_get_type_name (object_type)));
"State=%p Op=%p [%s]\n", walk_state, op,
acpi_ut_get_type_name(object_type)));
switch (walk_state->opcode) {
case AML_SCOPE_OP:
@@ -174,8 +167,10 @@ acpi_ds_load1_begin_op (
* that we can actually open the scope to enter new names underneath it.
* Allow search-to-root for single namesegs.
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info, path, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
/*
@@ -184,9 +179,11 @@ acpi_ds_load1_begin_op (
* insert the name into the namespace.
*/
acpi_dm_add_to_external_list(path);
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info, path,
object_type, ACPI_IMODE_LOAD_PASS1,
ACPI_NS_SEARCH_PARENT, walk_state,
&(node));
}
#endif
if (ACPI_FAILURE(status)) {
@@ -225,7 +222,8 @@ acpi_ds_load1_begin_op (
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
path, acpi_ut_get_type_name (node->type)));
path,
acpi_ut_get_type_name(node->type)));
node->type = ACPI_TYPE_ANY;
walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -235,15 +233,12 @@ acpi_ds_load1_begin_op (
/* 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_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n", acpi_ut_get_type_name(node->type), path));
return (AE_AML_OPERAND_TYPE);
}
break;
default:
/*
@@ -274,10 +269,10 @@ acpi_ds_load1_begin_op (
if ((walk_state->opcode != AML_SCOPE_OP) &&
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
flags |= ACPI_NS_ERROR_IF_FOUND;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"[%s] Cannot already exist\n",
acpi_ut_get_type_name(object_type)));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"[%s] Both Find or Create allowed\n",
acpi_ut_get_type_name(object_type)));
@@ -289,8 +284,10 @@ acpi_ds_load1_begin_op (
* involve arguments to the opcode must be created as we go back up the
* parse tree later.
*/
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info, path, object_type,
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
&(node));
if (ACPI_FAILURE(status)) {
ACPI_REPORT_NSERROR(path, status);
return (status);
@@ -298,7 +295,6 @@ acpi_ds_load1_begin_op (
break;
}
/* Common exit */
if (!op) {
@@ -318,19 +314,18 @@ acpi_ds_load1_begin_op (
op->named.path = (u8 *) path;
#endif
/*
* 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;
acpi_ps_append_arg (acpi_ps_get_parent_scope (&walk_state->parser_state), op);
acpi_ps_append_arg(acpi_ps_get_parent_scope(&walk_state->parser_state),
op);
*out_op = op;
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_load1_end_op
@@ -344,20 +339,17 @@ acpi_ds_load1_begin_op (
*
******************************************************************************/
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;
acpi_object_type object_type;
acpi_status status = AE_OK;
ACPI_FUNCTION_NAME("ds_load1_end_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
walk_state));
/* We are only interested in opcodes that have an associated name */
@@ -379,12 +371,11 @@ acpi_ds_load1_end_op (
return (status);
}
if (op->common.aml_opcode == AML_REGION_OP) {
status = acpi_ex_create_region(op->named.data, op->named.length,
(acpi_adr_space_type)
((op->common.value.arg)->common.value.integer),
walk_state);
((op->common.value.arg)->common.
value.integer), walk_state);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -395,8 +386,11 @@ acpi_ds_load1_end_op (
/* For Name opcode, get the object type from the argument */
if (op->common.value.arg) {
object_type = (acpi_ps_get_opcode_info (
(op->common.value.arg)->common.aml_opcode))->object_type;
object_type = (acpi_ps_get_opcode_info((op->common.
value.arg)->
common.
aml_opcode))->
object_type;
op->common.node->type = (u8) object_type;
}
}
@@ -418,10 +412,13 @@ acpi_ds_load1_end_op (
walk_state->operands[0] = (void *)op->named.node;
walk_state->num_operands = 1;
status = acpi_ds_create_operands (walk_state, op->common.value.arg);
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);
op->named.length,
walk_state);
}
walk_state->operands[0] = NULL;
walk_state->num_operands = 0;
@@ -435,7 +432,8 @@ acpi_ds_load1_end_op (
/* Pop the scope stack */
if (acpi_ns_opens_scope(object_type)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"(%s): Popping scope for Op %p\n",
acpi_ut_get_type_name(object_type), op));
status = acpi_ds_scope_stack_pop(walk_state);
@@ -444,7 +442,6 @@ acpi_ds_load1_end_op (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_load2_begin_op
@@ -459,8 +456,7 @@ acpi_ds_load1_end_op (
******************************************************************************/
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 *op;
@@ -469,12 +465,11 @@ acpi_ds_load2_begin_op (
acpi_object_type object_type;
char *buffer_ptr;
ACPI_FUNCTION_TRACE("ds_load2_begin_op");
op = walk_state->op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op,
walk_state));
if (op) {
if ((walk_state->control_state) &&
@@ -494,12 +489,14 @@ acpi_ds_load2_begin_op (
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
"Begin/EXEC: %s (fl %8.8X)\n",
walk_state->op_info->name,
walk_state->op_info->flags));
/* Executing a type1 or type2 opcode outside of a method */
status = acpi_ds_exec_begin_op (walk_state, out_op);
status =
acpi_ds_exec_begin_op(walk_state, out_op);
return_ACPI_STATUS(status);
}
return_ACPI_STATUS(AE_OK);
@@ -516,17 +513,16 @@ acpi_ds_load2_begin_op (
return_ACPI_STATUS(AE_OK);
}
}
else {
} else {
/* Get name from the op */
buffer_ptr = (char *)&op->named.name;
}
}
else {
} else {
/* Get the namestring from the raw AML */
buffer_ptr = acpi_ps_get_next_namestring (&walk_state->parser_state);
buffer_ptr =
acpi_ps_get_next_namestring(&walk_state->parser_state);
}
/* Map the opcode into an internal object type */
@@ -534,8 +530,8 @@ acpi_ds_load2_begin_op (
object_type = walk_state->op_info->object_type;
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%X\n", walk_state, op, object_type));
"State=%p Op=%p Type=%X\n", walk_state, op,
object_type));
switch (walk_state->opcode) {
case AML_FIELD_OP:
@@ -553,9 +549,10 @@ acpi_ds_load2_begin_op (
* Don't enter the name into the namespace, but look it up
* for use later.
*/
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &(node));
break;
case AML_SCOPE_OP:
@@ -565,15 +562,15 @@ acpi_ds_load2_begin_op (
* Don't enter the name into the namespace, but look it up
* for use later.
*/
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT, walk_state, &(node));
if (ACPI_FAILURE(status)) {
#ifdef ACPI_ASL_COMPILER
if (status == AE_NOT_FOUND) {
status = AE_OK;
}
else {
} else {
ACPI_REPORT_NSERROR(buffer_ptr, status);
}
#else
@@ -607,9 +604,7 @@ acpi_ds_load2_begin_op (
* 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_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)));
node->type = ACPI_TYPE_ANY;
walk_state->scope_info->common.value = ACPI_TYPE_ANY;
@@ -619,9 +614,7 @@ acpi_ds_load2_begin_op (
/* 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_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr));
return (AE_AML_OPERAND_TYPE);
}
@@ -637,7 +630,9 @@ acpi_ds_load2_begin_op (
node = op->common.node;
if (acpi_ns_opens_scope(object_type)) {
status = acpi_ds_scope_stack_push (node, object_type, walk_state);
status =
acpi_ds_scope_stack_push(node, object_type,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -664,9 +659,10 @@ acpi_ds_load2_begin_op (
/* Add new entry into namespace */
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
walk_state, &(node));
status =
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
object_type, ACPI_IMODE_LOAD_PASS2,
ACPI_NS_NO_UPSEARCH, walk_state, &(node));
break;
}
@@ -700,7 +696,6 @@ acpi_ds_load2_begin_op (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_load2_end_op
@@ -714,9 +709,7 @@ acpi_ds_load2_begin_op (
*
******************************************************************************/
acpi_status
acpi_ds_load2_end_op (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
{
union acpi_parse_object *op;
acpi_status status = AE_OK;
@@ -728,7 +721,6 @@ acpi_ds_load2_end_op (
u32 i;
#endif
ACPI_FUNCTION_TRACE("ds_load2_end_op");
op = walk_state->op;
@@ -744,7 +736,8 @@ acpi_ds_load2_end_op (
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"End/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
"End/EXEC: %s (fl %8.8X)\n",
walk_state->op_info->name,
walk_state->op_info->flags));
/* Executing a type1 or type2 opcode outside of a method */
@@ -758,7 +751,8 @@ acpi_ds_load2_end_op (
if (op->common.aml_opcode == AML_SCOPE_OP) {
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Ending scope Op=%p State=%p\n", op, walk_state));
"Ending scope Op=%p State=%p\n", op,
walk_state));
}
object_type = walk_state->op_info->object_type;
@@ -780,7 +774,8 @@ acpi_ds_load2_end_op (
if (acpi_ns_opens_scope(object_type) &&
(op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"(%s) Popping scope for Op %p\n",
acpi_ut_get_type_name(object_type), op));
status = acpi_ds_scope_stack_pop(walk_state);
@@ -819,7 +814,8 @@ acpi_ds_load2_end_op (
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"Create-Load [%s] State=%p Op=%p named_obj=%p\n",
acpi_ps_get_opcode_name (op->common.aml_opcode), walk_state, op, node));
acpi_ps_get_opcode_name(op->common.aml_opcode),
walk_state, op, node));
/* Decode the opcode */
@@ -837,24 +833,29 @@ acpi_ds_load2_end_op (
status = acpi_ds_create_buffer_field(op, walk_state);
break;
case AML_TYPE_NAMED_FIELD:
switch (op->common.aml_opcode) {
case AML_INDEX_FIELD_OP:
status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
walk_state);
status =
acpi_ds_create_index_field(op,
(acpi_handle) arg->
common.node, walk_state);
break;
case AML_BANK_FIELD_OP:
status = acpi_ds_create_bank_field (op, arg->common.node, walk_state);
status =
acpi_ds_create_bank_field(op, arg->common.node,
walk_state);
break;
case AML_FIELD_OP:
status = acpi_ds_create_field (op, arg->common.node, walk_state);
status =
acpi_ds_create_field(op, arg->common.node,
walk_state);
break;
default:
@@ -863,7 +864,6 @@ acpi_ds_load2_end_op (
}
break;
case AML_TYPE_NAMED_SIMPLE:
status = acpi_ds_create_operands(walk_state, arg);
@@ -933,8 +933,9 @@ acpi_ds_load2_end_op (
* If we have a valid region, initialize it
* Namespace is NOT locked at this point.
*/
status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
FALSE);
status =
acpi_ev_initialize_region
(acpi_ns_get_attached_object(node), FALSE);
if (ACPI_FAILURE(status)) {
/*
* If AE_NOT_EXIST is returned, it is not fatal
@@ -947,14 +948,12 @@ acpi_ds_load2_end_op (
}
break;
case AML_NAME_OP:
status = acpi_ds_create_node(walk_state, node, op);
break;
#endif /* ACPI_NO_METHOD_EXECUTION */
default:
/* All NAMED_COMPLEX opcodes must be handled above */
/* Note: Method objects were already created in Pass 1 */
@@ -962,13 +961,11 @@ acpi_ds_load2_end_op (
}
break;
case AML_CLASS_INTERNAL:
/* case AML_INT_NAMEPATH_OP: */
break;
case AML_CLASS_METHOD_CALL:
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
@@ -978,10 +975,13 @@ acpi_ds_load2_end_op (
/*
* Lookup the method name and save the Node
*/
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
walk_state, &(new_node));
status =
acpi_ns_lookup(walk_state->scope_info,
arg->common.value.string, ACPI_TYPE_ANY,
ACPI_IMODE_LOAD_PASS2,
ACPI_NS_SEARCH_PARENT |
ACPI_NS_DONT_OPEN_SCOPE, walk_state,
&(new_node));
if (ACPI_SUCCESS(status)) {
/*
@@ -998,13 +998,11 @@ acpi_ds_load2_end_op (
* parser uses, so we can get it again at the end of this scope
*/
op->common.node = new_node;
}
else {
} else {
ACPI_REPORT_NSERROR(arg->common.value.string, status);
}
break;
default:
break;
}
@@ -1017,5 +1015,3 @@ cleanup:
walk_state->num_operands = 0;
return_ACPI_STATUS(status);
}

View File

@@ -41,15 +41,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME("dswscope")
/****************************************************************************
*
* FUNCTION: acpi_ds_scope_stack_clear
@@ -62,16 +59,12 @@
* root scope object (which remains at the stack top.)
*
***************************************************************************/
void
acpi_ds_scope_stack_clear (
struct acpi_walk_state *walk_state)
void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state)
{
union acpi_generic_state *scope_info;
ACPI_FUNCTION_NAME("ds_scope_stack_clear");
while (walk_state->scope_info) {
/* Pop a scope off the stack */
@@ -80,12 +73,12 @@ acpi_ds_scope_stack_clear (
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Popped object type (%s)\n",
acpi_ut_get_type_name (scope_info->common.value)));
acpi_ut_get_type_name(scope_info->common.
value)));
acpi_ut_delete_generic_state(scope_info);
}
}
/****************************************************************************
*
* FUNCTION: acpi_ds_scope_stack_push
@@ -102,18 +95,15 @@ acpi_ds_scope_stack_clear (
***************************************************************************/
acpi_status
acpi_ds_scope_stack_push (
struct acpi_namespace_node *node,
acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_walk_state *walk_state)
{
union acpi_generic_state *scope_info;
union acpi_generic_state *old_scope_info;
ACPI_FUNCTION_TRACE("ds_scope_stack_push");
if (!node) {
/* Invalid scope */
@@ -124,8 +114,7 @@ acpi_ds_scope_stack_push (
/* Make sure object type is valid */
if (!acpi_ut_valid_object_type(type)) {
ACPI_REPORT_WARNING ((
"ds_scope_stack_push: Invalid object type: 0x%X\n", type));
ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
}
/* Allocate a new scope object */
@@ -144,18 +133,19 @@ acpi_ds_scope_stack_push (
walk_state->scope_depth++;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"[%.2d] Pushed scope ", (u32) walk_state->scope_depth));
"[%.2d] Pushed scope ",
(u32) walk_state->scope_depth));
old_scope_info = walk_state->scope_info;
if (old_scope_info) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
"[%4.4s] (%s)",
acpi_ut_get_node_name (old_scope_info->scope.node),
acpi_ut_get_type_name (old_scope_info->common.value)));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (%s)", "ROOT"));
acpi_ut_get_node_name(old_scope_info->
scope.node),
acpi_ut_get_type_name(old_scope_info->
common.value)));
} else {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT"));
}
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
@@ -169,7 +159,6 @@ acpi_ds_scope_stack_push (
return_ACPI_STATUS(AE_OK);
}
/****************************************************************************
*
* FUNCTION: acpi_ds_scope_stack_pop
@@ -182,17 +171,13 @@ acpi_ds_scope_stack_push (
*
***************************************************************************/
acpi_status
acpi_ds_scope_stack_pop (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state)
{
union acpi_generic_state *scope_info;
union acpi_generic_state *new_scope_info;
ACPI_FUNCTION_TRACE("ds_scope_stack_pop");
/*
* Pop scope info object off the stack.
*/
@@ -213,16 +198,14 @@ acpi_ds_scope_stack_pop (
if (new_scope_info) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
"[%4.4s] (%s)\n",
acpi_ut_get_node_name (new_scope_info->scope.node),
acpi_ut_get_type_name (new_scope_info->common.value)));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
"[\\___] (ROOT)\n"));
acpi_ut_get_node_name(new_scope_info->
scope.node),
acpi_ut_get_type_name(new_scope_info->
common.value)));
} else {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (ROOT)\n"));
}
acpi_ut_delete_generic_state(scope_info);
return_ACPI_STATUS(AE_OK);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
@@ -51,26 +50,18 @@
ACPI_MODULE_NAME("dswstate")
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
acpi_status
acpi_ds_result_insert (
void *object,
u32 index,
struct acpi_walk_state *walk_state);
acpi_ds_result_insert(void *object,
u32 index, struct acpi_walk_state *walk_state);
acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state *walk_state);
acpi_status
acpi_ds_obj_stack_delete_all (
acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
void *
acpi_ds_obj_stack_get_value (
u32 index,
void *acpi_ds_obj_stack_get_value(u32 index,
struct acpi_walk_state *walk_state);
#endif
@@ -92,20 +83,17 @@ acpi_ds_obj_stack_get_value (
******************************************************************************/
acpi_status
acpi_ds_result_remove (
union acpi_operand_object **object,
u32 index,
struct acpi_walk_state *walk_state)
acpi_ds_result_remove(union acpi_operand_object **object,
u32 index, struct acpi_walk_state *walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_remove");
state = walk_state->results;
if (!state) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
@@ -113,7 +101,8 @@ acpi_ds_result_remove (
if (index >= ACPI_OBJ_MAX_OPERAND) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Index out of range: %X State=%p Num=%X\n",
index, walk_state, state->results.num_results));
index, walk_state,
state->results.num_results));
}
/* Check for a valid result object */
@@ -121,7 +110,8 @@ acpi_ds_result_remove (
if (!state->results.obj_desc[index]) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X, Index=%X\n",
walk_state, state->results.num_results, index));
walk_state, state->results.num_results,
index));
return (AE_AML_NO_RETURN_VALUE);
}
@@ -134,8 +124,10 @@ acpi_ds_result_remove (
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
index, walk_state, state->results.num_results));
*object,
(*object) ? acpi_ut_get_object_type_name(*object) :
"NULL", index, walk_state,
state->results.num_results));
return (AE_OK);
}
@@ -157,24 +149,22 @@ acpi_ds_result_remove (
******************************************************************************/
acpi_status
acpi_ds_result_pop (
union acpi_operand_object **object,
acpi_ds_result_pop(union acpi_operand_object ** object,
struct acpi_walk_state * walk_state)
{
acpi_native_uint index;
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_pop");
state = walk_state->results;
if (!state) {
return (AE_OK);
}
if (!state->results.num_results) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Result stack is empty! State=%p\n",
walk_state));
return (AE_AML_NO_RETURN_VALUE);
}
@@ -193,8 +183,10 @@ acpi_ds_result_pop (
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Obj=%p [%s] Index=%X State=%p Num=%X\n",
*object,
(*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
(u32) index -1, walk_state, state->results.num_results));
(*object) ?
acpi_ut_get_object_type_name(*object)
: "NULL", (u32) index - 1, walk_state,
state->results.num_results));
return (AE_OK);
}
@@ -205,7 +197,6 @@ acpi_ds_result_pop (
return (AE_AML_NO_RETURN_VALUE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_pop_from_bottom
@@ -221,27 +212,25 @@ acpi_ds_result_pop (
******************************************************************************/
acpi_status
acpi_ds_result_pop_from_bottom (
union acpi_operand_object **object,
acpi_ds_result_pop_from_bottom(union acpi_operand_object ** object,
struct acpi_walk_state * walk_state)
{
acpi_native_uint index;
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_pop_from_bottom");
state = walk_state->results;
if (!state) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Warning: No result object pushed! State=%p\n", walk_state));
"Warning: No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
if (!state->results.num_results) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n",
walk_state));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No result objects! State=%p\n", walk_state));
return (AE_AML_NO_RETURN_VALUE);
}
@@ -252,7 +241,8 @@ acpi_ds_result_pop_from_bottom (
/* Push entire stack down one element */
for (index = 0; index < state->results.num_results; index++) {
state->results.obj_desc [index] = state->results.obj_desc [index + 1];
state->results.obj_desc[index] =
state->results.obj_desc[index + 1];
}
state->results.num_results--;
@@ -262,18 +252,19 @@ acpi_ds_result_pop_from_bottom (
if (!*object) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Null operand! State=%p #Ops=%X Index=%X\n",
walk_state, state->results.num_results, (u32) index));
walk_state, state->results.num_results,
(u32) index));
return (AE_AML_NO_RETURN_VALUE);
}
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] Results=%p State=%p\n",
*object, (*object) ? acpi_ut_get_object_type_name (*object) : "NULL",
state, walk_state));
*object,
(*object) ? acpi_ut_get_object_type_name(*object) :
"NULL", state, walk_state));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_push
@@ -288,16 +279,13 @@ acpi_ds_result_pop_from_bottom (
******************************************************************************/
acpi_status
acpi_ds_result_push (
union acpi_operand_object *object,
acpi_ds_result_push(union acpi_operand_object * object,
struct acpi_walk_state * walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_push");
state = walk_state->results;
if (!state) {
ACPI_REPORT_ERROR(("No result stack frame during push\n"));
@@ -307,14 +295,16 @@ acpi_ds_result_push (
if (state->results.num_results == ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Result stack overflow: Obj=%p State=%p Num=%X\n",
object, walk_state, state->results.num_results));
object, walk_state,
state->results.num_results));
return (AE_STACK_OVERFLOW);
}
if (!object) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Null Object! Obj=%p State=%p Num=%X\n",
object, walk_state, state->results.num_results));
object, walk_state,
state->results.num_results));
return (AE_BAD_PARAMETER);
}
@@ -322,13 +312,17 @@ acpi_ds_result_push (
state->results.num_results++;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result));
object,
object ?
acpi_ut_get_object_type_name((union
acpi_operand_object *)
object) : "NULL",
walk_state, state->results.num_results,
walk_state->current_result));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_stack_push
@@ -341,15 +335,12 @@ acpi_ds_result_push (
*
******************************************************************************/
acpi_status
acpi_ds_result_stack_push (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_result_stack_push(struct acpi_walk_state * walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_stack_push");
state = acpi_ut_create_generic_state();
if (!state) {
return (AE_NO_MEMORY);
@@ -364,7 +355,6 @@ acpi_ds_result_stack_push (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_result_stack_pop
@@ -377,15 +367,12 @@ acpi_ds_result_stack_push (
*
******************************************************************************/
acpi_status
acpi_ds_result_stack_pop (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_result_stack_pop(struct acpi_walk_state * walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_stack_pop");
/* Check for stack underflow */
if (walk_state->results == NULL) {
@@ -405,7 +392,6 @@ acpi_ds_result_stack_pop (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_push
@@ -420,19 +406,17 @@ acpi_ds_result_stack_pop (
******************************************************************************/
acpi_status
acpi_ds_obj_stack_push (
void *object,
struct acpi_walk_state *walk_state)
acpi_ds_obj_stack_push(void *object, struct acpi_walk_state * walk_state)
{
ACPI_FUNCTION_NAME("ds_obj_stack_push");
/* Check for stack overflow */
if (walk_state->num_operands >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"overflow! Obj=%p State=%p #Ops=%X\n",
object, walk_state, walk_state->num_operands));
object, walk_state,
walk_state->num_operands));
return (AE_STACK_OVERFLOW);
}
@@ -442,13 +426,15 @@ acpi_ds_obj_stack_push (
walk_state->num_operands++;
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
object, acpi_ut_get_object_type_name ((union acpi_operand_object *) object),
walk_state, walk_state->num_operands));
object,
acpi_ut_get_object_type_name((union
acpi_operand_object *)
object), walk_state,
walk_state->num_operands));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop
@@ -464,22 +450,20 @@ acpi_ds_obj_stack_push (
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop (
u32 pop_count,
struct acpi_walk_state *walk_state)
acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state * walk_state)
{
u32 i;
ACPI_FUNCTION_NAME("ds_obj_stack_pop");
for (i = 0; i < pop_count; i++) {
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Underflow! Count=%X State=%p #Ops=%X\n",
pop_count, walk_state, walk_state->num_operands));
pop_count, walk_state,
walk_state->num_operands));
return (AE_STACK_UNDERFLOW);
}
@@ -495,7 +479,6 @@ acpi_ds_obj_stack_pop (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop_and_delete
@@ -511,24 +494,22 @@ acpi_ds_obj_stack_pop (
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop_and_delete (
u32 pop_count,
acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
struct acpi_walk_state * walk_state)
{
u32 i;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_NAME("ds_obj_stack_pop_and_delete");
for (i = 0; i < pop_count; i++) {
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Underflow! Count=%X State=%p #Ops=%X\n",
pop_count, walk_state, walk_state->num_operands));
pop_count, walk_state,
walk_state->num_operands));
return (AE_STACK_UNDERFLOW);
}
@@ -537,7 +518,9 @@ acpi_ds_obj_stack_pop_and_delete (
walk_state->num_operands--;
obj_desc = walk_state->operands[walk_state->num_operands];
if (obj_desc) {
acpi_ut_remove_reference (walk_state->operands [walk_state->num_operands]);
acpi_ut_remove_reference(walk_state->
operands[walk_state->
num_operands]);
walk_state->operands[walk_state->num_operands] = NULL;
}
}
@@ -548,7 +531,6 @@ acpi_ds_obj_stack_pop_and_delete (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_get_current_walk_state
@@ -562,14 +544,11 @@ acpi_ds_obj_stack_pop_and_delete (
*
******************************************************************************/
struct acpi_walk_state *
acpi_ds_get_current_walk_state (
struct acpi_thread_state *thread)
struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
*thread)
{
ACPI_FUNCTION_NAME("ds_get_current_walk_state");
if (!thread) {
return (NULL);
}
@@ -580,7 +559,6 @@ acpi_ds_get_current_walk_state (
return (thread->walk_state_list);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_push_walk_state
@@ -595,20 +573,17 @@ acpi_ds_get_current_walk_state (
******************************************************************************/
void
acpi_ds_push_walk_state (
struct acpi_walk_state *walk_state,
acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
struct acpi_thread_state *thread)
{
ACPI_FUNCTION_TRACE("ds_push_walk_state");
walk_state->next = thread->walk_state_list;
thread->walk_state_list = walk_state;
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_pop_walk_state
@@ -623,16 +598,12 @@ acpi_ds_push_walk_state (
*
******************************************************************************/
struct acpi_walk_state *
acpi_ds_pop_walk_state (
struct acpi_thread_state *thread)
struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
{
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE("ds_pop_walk_state");
walk_state = thread->walk_state_list;
if (walk_state) {
@@ -650,7 +621,6 @@ acpi_ds_pop_walk_state (
return_PTR(walk_state);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_create_walk_state
@@ -667,20 +637,19 @@ acpi_ds_pop_walk_state (
*
******************************************************************************/
struct acpi_walk_state *
acpi_ds_create_walk_state (
acpi_owner_id owner_id,
union acpi_parse_object *origin,
union acpi_operand_object *mth_desc,
struct acpi_thread_state *thread)
struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
union acpi_parse_object
*origin,
union acpi_operand_object
*mth_desc,
struct acpi_thread_state
*thread)
{
struct acpi_walk_state *walk_state;
acpi_status status;
ACPI_FUNCTION_TRACE("ds_create_walk_state");
walk_state = ACPI_MEM_CALLOCATE(sizeof(struct acpi_walk_state));
if (!walk_state) {
return_PTR(NULL);
@@ -717,7 +686,6 @@ acpi_ds_create_walk_state (
return_PTR(walk_state);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_init_aml_walk
@@ -737,23 +705,19 @@ acpi_ds_create_walk_state (
******************************************************************************/
acpi_status
acpi_ds_init_aml_walk (
struct acpi_walk_state *walk_state,
acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
struct acpi_namespace_node *method_node,
u8 * aml_start,
u32 aml_length,
struct acpi_parameter_info *info,
u8 pass_number)
struct acpi_parameter_info *info, u8 pass_number)
{
acpi_status status;
struct acpi_parse_state *parser_state = &walk_state->parser_state;
union acpi_parse_object *extra_op;
ACPI_FUNCTION_TRACE("ds_init_aml_walk");
walk_state->parser_state.aml =
walk_state->parser_state.aml_start = aml_start;
walk_state->parser_state.aml_end =
@@ -766,10 +730,10 @@ acpi_ds_init_aml_walk (
if (info) {
if (info->parameter_type == ACPI_PARAM_GPE) {
walk_state->gpe_event_info = ACPI_CAST_PTR (struct acpi_gpe_event_info,
walk_state->gpe_event_info =
ACPI_CAST_PTR(struct acpi_gpe_event_info,
info->parameters);
}
else {
} else {
walk_state->params = info->parameters;
walk_state->caller_return_desc = &info->return_object;
}
@@ -784,11 +748,14 @@ acpi_ds_init_aml_walk (
walk_state->parser_state.start_node = method_node;
walk_state->walk_type = ACPI_WALK_METHOD;
walk_state->method_node = method_node;
walk_state->method_desc = acpi_ns_get_attached_object (method_node);
walk_state->method_desc =
acpi_ns_get_attached_object(method_node);
/* Push start scope on scope stack and make it current */
status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
status =
acpi_ds_scope_stack_push(method_node, ACPI_TYPE_METHOD,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -796,12 +763,12 @@ acpi_ds_init_aml_walk (
/* Init the method arguments */
status = acpi_ds_method_data_init_args(walk_state->params,
ACPI_METHOD_NUM_ARGS, walk_state);
ACPI_METHOD_NUM_ARGS,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}
else {
} else {
/*
* Setup the current scope.
* Find a Named Op that has a namespace node associated with it.
@@ -815,16 +782,17 @@ acpi_ds_init_aml_walk (
if (!extra_op) {
parser_state->start_node = NULL;
}
else {
} else {
parser_state->start_node = extra_op->common.node;
}
if (parser_state->start_node) {
/* Push start scope on scope stack and make it current */
status = acpi_ds_scope_stack_push (parser_state->start_node,
parser_state->start_node->type, walk_state);
status =
acpi_ds_scope_stack_push(parser_state->start_node,
parser_state->start_node->
type, walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -835,7 +803,6 @@ acpi_ds_init_aml_walk (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_delete_walk_state
@@ -848,28 +815,26 @@ acpi_ds_init_aml_walk (
*
******************************************************************************/
void
acpi_ds_delete_walk_state (
struct acpi_walk_state *walk_state)
void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_TRACE_PTR("ds_delete_walk_state", walk_state);
if (!walk_state) {
return;
}
if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%p is not a valid walk state\n",
walk_state));
return;
}
if (walk_state->parser_state.scope) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%p walk still has a scope list\n",
walk_state));
}
@@ -904,7 +869,6 @@ acpi_ds_delete_walk_state (
return_VOID;
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
@@ -921,20 +885,17 @@ acpi_ds_delete_walk_state (
******************************************************************************/
acpi_status
acpi_ds_result_insert (
void *object,
u32 index,
struct acpi_walk_state *walk_state)
acpi_ds_result_insert(void *object,
u32 index, struct acpi_walk_state *walk_state)
{
union acpi_generic_state *state;
ACPI_FUNCTION_NAME("ds_result_insert");
state = walk_state->results;
if (!state) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No result object pushed! State=%p\n",
walk_state));
return (AE_NOT_EXIST);
}
@@ -942,14 +903,16 @@ acpi_ds_result_insert (
if (index >= ACPI_OBJ_NUM_OPERANDS) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Index out of range: %X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
index, object, walk_state,
state->results.num_results));
return (AE_BAD_PARAMETER);
}
if (!object) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Null Object! Index=%X Obj=%p State=%p Num=%X\n",
index, object, walk_state, state->results.num_results));
index, object, walk_state,
state->results.num_results));
return (AE_BAD_PARAMETER);
}
@@ -958,13 +921,17 @@ acpi_ds_result_insert (
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Obj=%p [%s] State=%p Num=%X Cur=%X\n",
object, object ? acpi_ut_get_object_type_name ((union acpi_operand_object *) object) : "NULL",
walk_state, state->results.num_results, walk_state->current_result));
object,
object ?
acpi_ut_get_object_type_name((union
acpi_operand_object *)
object) : "NULL",
walk_state, state->results.num_results,
walk_state->current_result));
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_delete_all
@@ -978,16 +945,12 @@ acpi_ds_result_insert (
*
******************************************************************************/
acpi_status
acpi_ds_obj_stack_delete_all (
struct acpi_walk_state *walk_state)
acpi_status acpi_ds_obj_stack_delete_all(struct acpi_walk_state * walk_state)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_delete_all", walk_state);
/* The stack size is configurable, but fixed */
for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++) {
@@ -1000,7 +963,6 @@ acpi_ds_obj_stack_delete_all (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_pop_object
@@ -1016,13 +978,11 @@ acpi_ds_obj_stack_delete_all (
******************************************************************************/
acpi_status
acpi_ds_obj_stack_pop_object (
union acpi_operand_object **object,
acpi_ds_obj_stack_pop_object(union acpi_operand_object **object,
struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_NAME("ds_obj_stack_pop_object");
/* Check for stack underflow */
if (walk_state->num_operands == 0) {
@@ -1059,7 +1019,6 @@ acpi_ds_obj_stack_pop_object (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ds_obj_stack_get_value
@@ -1075,15 +1034,11 @@ acpi_ds_obj_stack_pop_object (
*
******************************************************************************/
void *
acpi_ds_obj_stack_get_value (
u32 index,
struct acpi_walk_state *walk_state)
void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state)
{
ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state);
/* Can't do it if the stack is empty */
if (walk_state->num_operands == 0) {
@@ -1096,9 +1051,8 @@ acpi_ds_obj_stack_get_value (
return_PTR(NULL);
}
return_PTR (walk_state->operands[(acpi_native_uint)(walk_state->num_operands - 1) -
return_PTR(walk_state->
operands[(acpi_native_uint) (walk_state->num_operands - 1) -
index]);
}
#endif

View File

@@ -39,39 +39,29 @@
#define _COMPONENT ACPI_EC_COMPONENT
ACPI_MODULE_NAME("acpi_ec")
#define ACPI_EC_COMPONENT 0x00100000
#define ACPI_EC_CLASS "embedded_controller"
#define ACPI_EC_HID "PNP0C09"
#define ACPI_EC_DRIVER_NAME "ACPI Embedded Controller Driver"
#define ACPI_EC_DEVICE_NAME "Embedded Controller"
#define ACPI_EC_FILE_INFO "info"
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
#define ACPI_EC_FLAG_BURST 0x10 /* burst mode */
#define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
#define ACPI_EC_EVENT_OBF 0x01 /* Output buffer full */
#define ACPI_EC_EVENT_IBE 0x02 /* Input buffer empty */
#define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */
#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
#define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */
#define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */
#define ACPI_EC_COMMAND_READ 0x80
#define ACPI_EC_COMMAND_WRITE 0x81
#define ACPI_EC_BURST_ENABLE 0x82
#define ACPI_EC_BURST_DISABLE 0x83
#define ACPI_EC_COMMAND_QUERY 0x84
#define EC_POLLING 0xFF
#define EC_BURST 0x00
static int acpi_ec_remove(struct acpi_device *device, int type);
static int acpi_ec_start(struct acpi_device *device);
static int acpi_ec_stop(struct acpi_device *device, int type);
@@ -143,23 +133,15 @@ static void acpi_ec_gpe_burst_query ( void *ec_cxt);
static u32 acpi_ec_gpe_polling_handler(void *data);
static u32 acpi_ec_gpe_burst_handler(void *data);
static acpi_status __init
acpi_fake_ecdt_polling_callback (
acpi_handle handle,
u32 Level,
void *context,
void **retval);
acpi_fake_ecdt_polling_callback(acpi_handle handle,
u32 Level, void *context, void **retval);
static acpi_status __init
acpi_fake_ecdt_burst_callback (
acpi_handle handle,
u32 Level,
void *context,
void **retval);
acpi_fake_ecdt_burst_callback(acpi_handle handle,
u32 Level, void *context, void **retval);
static int __init
acpi_ec_polling_get_real_ecdt(void);
static int __init
acpi_ec_burst_get_real_ecdt(void);
static int __init acpi_ec_polling_get_real_ecdt(void);
static int __init acpi_ec_burst_get_real_ecdt(void);
/* If we find an EC via the ECDT, we need to keep a ptr to its context */
static union acpi_ec *ec_ecdt;
@@ -179,10 +161,7 @@ static inline u32 acpi_ec_read_status(union acpi_ec *ec)
return status;
}
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)
return acpi_ec_polling_wait(ec, event);
@@ -190,10 +169,7 @@ acpi_ec_wait (
return acpi_ec_burst_wait(ec, event);
}
static int
acpi_ec_polling_wait (
union acpi_ec *ec,
u8 event)
static int acpi_ec_polling_wait(union acpi_ec *ec, u8 event)
{
u32 acpi_ec_status = 0;
u32 i = ACPI_EC_UDELAY_COUNT;
@@ -205,7 +181,8 @@ acpi_ec_polling_wait (
switch (event) {
case ACPI_EC_EVENT_OBF:
do {
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);
acpi_hw_low_level_read(8, &acpi_ec_status,
&ec->common.status_addr);
if (acpi_ec_status & ACPI_EC_FLAG_OBF)
return 0;
udelay(ACPI_EC_UDELAY);
@@ -213,7 +190,8 @@ acpi_ec_polling_wait (
break;
case ACPI_EC_EVENT_IBE:
do {
acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr);
acpi_hw_low_level_read(8, &acpi_ec_status,
&ec->common.status_addr);
if (!(acpi_ec_status & ACPI_EC_FLAG_IBF))
return 0;
udelay(ACPI_EC_UDELAY);
@@ -236,7 +214,8 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
result = wait_event_interruptible_timeout(ec->burst.wait,
!ec->burst.expect_event,
msecs_to_jiffies(ACPI_EC_DELAY));
msecs_to_jiffies
(ACPI_EC_DELAY));
ec->burst.expect_event = 0;
smp_mb();
@@ -266,11 +245,7 @@ static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event)
return_VALUE(-ETIME);
}
static int
acpi_ec_enter_burst_mode (
union acpi_ec *ec)
static int acpi_ec_enter_burst_mode(union acpi_ec *ec)
{
u32 tmp = 0;
int status = 0;
@@ -278,9 +253,9 @@ acpi_ec_enter_burst_mode (
ACPI_FUNCTION_TRACE("acpi_ec_enter_burst_mode");
status = acpi_ec_read_status(ec);
if (status != -EINVAL &&
!(status & ACPI_EC_FLAG_BURST)){
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);
if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
&ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status) {
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
@@ -297,9 +272,7 @@ acpi_ec_enter_burst_mode (
return_VALUE(0);
}
static int
acpi_ec_leave_burst_mode (
union acpi_ec *ec)
static int acpi_ec_leave_burst_mode(union acpi_ec *ec)
{
int status = 0;
@@ -307,13 +280,14 @@ 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)){
acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr);
if (status != -EINVAL && (status & ACPI_EC_FLAG_BURST)) {
acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE,
&ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF);
if (status) {
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"------->wait fail\n"));
return_VALUE(-EINVAL);
}
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
@@ -323,33 +297,21 @@ acpi_ec_leave_burst_mode (
return_VALUE(0);
}
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)
return acpi_ec_polling_read(ec, address, data);
else
return acpi_ec_burst_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)
return acpi_ec_polling_write(ec, address, data);
else
return acpi_ec_burst_write(ec, address, data);
}
static int
acpi_ec_polling_read (
union acpi_ec *ec,
u8 address,
u32 *data)
static int acpi_ec_polling_read(union acpi_ec *ec, u8 address, u32 * data)
{
acpi_status status = AE_OK;
int result = 0;
@@ -371,7 +333,8 @@ acpi_ec_polling_read (
spin_lock_irqsave(&ec->polling.lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
&ec->common.command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result)
goto end;
@@ -395,12 +358,7 @@ end:
return_VALUE(result);
}
static int
acpi_ec_polling_write (
union acpi_ec *ec,
u8 address,
u8 data)
static int acpi_ec_polling_write(union acpi_ec *ec, u8 address, u8 data)
{
int result = 0;
acpi_status status = AE_OK;
@@ -420,7 +378,8 @@ acpi_ec_polling_write (
spin_lock_irqsave(&ec->polling.lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
&ec->common.command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
if (result)
goto end;
@@ -447,11 +406,7 @@ end:
return_VALUE(result);
}
static int
acpi_ec_burst_read (
union acpi_ec *ec,
u8 address,
u32 *data)
static int acpi_ec_burst_read(union acpi_ec *ec, u8 address, u32 * data)
{
int status = 0;
u32 glk;
@@ -476,7 +431,8 @@ retry:
if (acpi_ec_enter_burst_mode(ec))
goto end;
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ,
&ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
if (status) {
@@ -515,12 +471,7 @@ end:
return_VALUE(status);
}
static int
acpi_ec_burst_write (
union acpi_ec *ec,
u8 address,
u8 data)
static int acpi_ec_burst_write(union acpi_ec *ec, u8 address, u8 data)
{
int status = 0;
u32 glk;
@@ -544,9 +495,9 @@ retry:
goto end;
status = acpi_ec_read_status(ec);
if (status != -EINVAL &&
!(status & ACPI_EC_FLAG_BURST)){
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr);
if (status != -EINVAL && !(status & ACPI_EC_FLAG_BURST)) {
acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE,
&ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status)
goto end;
@@ -556,7 +507,8 @@ retry:
}
/*Now we are in burst mode */
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE,
&ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE);
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
if (status) {
@@ -601,8 +553,7 @@ end:
/*
* Externally callable EC access functions. For now, assume 1 EC only
*/
int
ec_read(u8 addr, u8 *val)
int ec_read(u8 addr, u8 * val)
{
union acpi_ec *ec;
int err;
@@ -618,14 +569,13 @@ ec_read(u8 addr, u8 *val)
if (!err) {
*val = temp_data;
return 0;
}
else
} else
return err;
}
EXPORT_SYMBOL(ec_read);
int
ec_write(u8 addr, u8 val)
int ec_write(u8 addr, u8 val)
{
union acpi_ec *ec;
int err;
@@ -639,22 +589,17 @@ ec_write(u8 addr, u8 val)
return err;
}
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)
return acpi_ec_polling_query(ec, data);
else
return acpi_ec_burst_query(ec, data);
}
static int
acpi_ec_polling_query (
union acpi_ec *ec,
u32 *data)
static int acpi_ec_polling_query(union acpi_ec *ec, u32 * data)
{
int result = 0;
acpi_status status = AE_OK;
@@ -681,7 +626,8 @@ acpi_ec_polling_query (
*/
spin_lock_irqsave(&ec->polling.lock, flags);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
&ec->common.command_addr);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (result)
goto end;
@@ -698,10 +644,7 @@ end:
return_VALUE(result);
}
static int
acpi_ec_burst_query (
union acpi_ec *ec,
u32 *data)
static int acpi_ec_burst_query(union acpi_ec *ec, u32 * data)
{
int status = 0;
u32 glk;
@@ -726,7 +669,8 @@ acpi_ec_burst_query (
* Note that successful completion of the query causes the ACPI_EC_SCI
* bit to be cleared (and thus clearing the interrupt source).
*/
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr);
acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY,
&ec->common.command_addr);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF);
if (status) {
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
@@ -753,7 +697,6 @@ end:
return_VALUE(status);
}
/* --------------------------------------------------------------------------
Event Management
-------------------------------------------------------------------------- */
@@ -763,9 +706,7 @@ union acpi_ec_query_data {
u8 data;
};
static void
acpi_ec_gpe_query (
void *ec_cxt)
static void acpi_ec_gpe_query(void *ec_cxt)
{
if (acpi_ec_polling_mode)
acpi_ec_gpe_polling_query(ec_cxt);
@@ -773,16 +714,15 @@ acpi_ec_gpe_query (
acpi_ec_gpe_burst_query(ec_cxt);
}
static void
acpi_ec_gpe_polling_query (
void *ec_cxt)
static void acpi_ec_gpe_polling_query(void *ec_cxt)
{
union acpi_ec *ec = (union acpi_ec *)ec_cxt;
u32 value = 0;
unsigned long flags = 0;
static char object_name[5] = { '_', 'Q', '0', '0', '\0' };
const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8','9','A','B','C','D','E','F'};
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
@@ -815,16 +755,15 @@ acpi_ec_gpe_polling_query (
end:
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_burst_query(void *ec_cxt)
{
union acpi_ec *ec = (union acpi_ec *)ec_cxt;
u32 value;
int result = -ENODATA;
static char object_name[5] = { '_', 'Q', '0', '0', '\0' };
const char hex[] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8','9','A','B','C','D','E','F'};
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
ACPI_FUNCTION_TRACE("acpi_ec_gpe_query");
@@ -845,18 +784,14 @@ end:
return;
}
static u32
acpi_ec_gpe_handler (
void *data)
static u32 acpi_ec_gpe_handler(void *data)
{
if (acpi_ec_polling_mode)
return acpi_ec_gpe_polling_handler(data);
else
return acpi_ec_gpe_burst_handler(data);
}
static u32
acpi_ec_gpe_polling_handler (
void *data)
static u32 acpi_ec_gpe_polling_handler(void *data)
{
acpi_status status = AE_OK;
union acpi_ec *ec = (union acpi_ec *)data;
@@ -874,9 +809,7 @@ acpi_ec_gpe_polling_handler (
else
return ACPI_INTERRUPT_NOT_HANDLED;
}
static u32
acpi_ec_gpe_burst_handler (
void *data)
static u32 acpi_ec_gpe_burst_handler(void *data)
{
acpi_status status = AE_OK;
u32 value;
@@ -929,11 +862,8 @@ acpi_ec_gpe_burst_handler (
-------------------------------------------------------------------------- */
static acpi_status
acpi_ec_space_setup (
acpi_handle region_handle,
u32 function,
void *handler_context,
void **return_context)
acpi_ec_space_setup(acpi_handle region_handle,
u32 function, void *handler_context, void **return_context)
{
/*
* The EC object is in the handler context and is needed
@@ -945,15 +875,12 @@ acpi_ec_space_setup (
return AE_OK;
}
static acpi_status
acpi_ec_space_handler (
u32 function,
acpi_ec_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
int result = 0;
union acpi_ec *ec = NULL;
@@ -967,7 +894,8 @@ acpi_ec_space_handler (
return_VALUE(AE_BAD_PARAMETER);
if (bit_width != 8 && acpi_strict) {
printk(KERN_WARNING PREFIX "acpi_ec_space_handler: bit_width should be 8\n");
printk(KERN_WARNING PREFIX
"acpi_ec_space_handler: bit_width should be 8\n");
return_VALUE(AE_BAD_PARAMETER);
}
@@ -1004,7 +932,6 @@ next_byte:
*value = f_v;
}
out:
switch (result) {
case -EINVAL:
@@ -1021,16 +948,13 @@ out:
}
}
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
static struct proc_dir_entry *acpi_ec_dir;
static int
acpi_ec_read_info (struct seq_file *seq, void *offset)
static int acpi_ec_read_info(struct seq_file *seq, void *offset)
{
union acpi_ec *ec = (union acpi_ec *)seq->private;
@@ -1042,7 +966,8 @@ acpi_ec_read_info (struct seq_file *seq, void *offset)
seq_printf(seq, "gpe bit: 0x%02x\n",
(u32) ec->common.gpe_bit);
seq_printf(seq, "ports: 0x%02x, 0x%02x\n",
(u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address);
(u32) ec->common.status_addr.address,
(u32) ec->common.data_addr.address);
seq_printf(seq, "use global lock: %s\n",
ec->common.global_lock ? "yes" : "no");
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
@@ -1064,9 +989,7 @@ static struct file_operations acpi_ec_info_ops = {
.owner = THIS_MODULE,
};
static int
acpi_ec_add_fs (
struct acpi_device *device)
static int acpi_ec_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
@@ -1094,10 +1017,7 @@ acpi_ec_add_fs (
return_VALUE(0);
}
static int
acpi_ec_remove_fs (
struct acpi_device *device)
static int acpi_ec_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_ec_remove_fs");
@@ -1110,15 +1030,11 @@ acpi_ec_remove_fs (
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static int
acpi_ec_polling_add (
struct acpi_device *device)
static int acpi_ec_polling_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
@@ -1143,23 +1059,28 @@ acpi_ec_polling_add (
acpi_driver_data(device) = ec;
/* Use the global lock for all EC transactions? */
acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);
acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
&ec->common.global_lock);
/* If our UID matches the UID for the ECDT-enumerated EC,
we now have the *real* EC info, so kill the makeshift one. */
acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
if (ec_ecdt && ec_ecdt->common.uid == uid) {
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler);
acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);
acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
&acpi_ec_gpe_handler);
kfree(ec_ecdt);
}
/* Get GPE bit assignment (EC events). */
/* TODO: Add support for _GPE returning a package */
status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);
status =
acpi_evaluate_integer(ec->common.handle, "_GPE", NULL,
&ec->common.gpe_bit);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error obtaining GPE bit assignment\n"));
@@ -1184,9 +1105,7 @@ end:
return_VALUE(result);
}
static int
acpi_ec_burst_add (
struct acpi_device *device)
static int acpi_ec_burst_add(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
@@ -1214,23 +1133,28 @@ acpi_ec_burst_add (
acpi_driver_data(device) = ec;
/* Use the global lock for all EC transactions? */
acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock);
acpi_evaluate_integer(ec->common.handle, "_GLK", NULL,
&ec->common.global_lock);
/* If our UID matches the UID for the ECDT-enumerated EC,
we now have the *real* EC info, so kill the makeshift one. */
acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid);
if (ec_ecdt && ec_ecdt->common.uid == uid) {
acpi_remove_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler);
acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler);
acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
&acpi_ec_gpe_handler);
kfree(ec_ecdt);
}
/* Get GPE bit assignment (EC events). */
/* TODO: Add support for _GPE returning a package */
status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit);
status =
acpi_evaluate_integer(ec->common.handle, "_GPE", NULL,
&ec->common.gpe_bit);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error obtaining GPE bit assignment\n"));
@@ -1256,11 +1180,7 @@ end:
return_VALUE(result);
}
static int
acpi_ec_remove (
struct acpi_device *device,
int type)
static int acpi_ec_remove(struct acpi_device *device, int type)
{
union acpi_ec *ec = NULL;
@@ -1278,11 +1198,8 @@ acpi_ec_remove (
return_VALUE(0);
}
static acpi_status
acpi_ec_io_ports (
struct acpi_resource *resource,
void *context)
acpi_ec_io_ports(struct acpi_resource *resource, void *context)
{
union acpi_ec *ec = (union acpi_ec *)context;
struct acpi_generic_address *addr;
@@ -1312,10 +1229,7 @@ acpi_ec_io_ports (
return AE_OK;
}
static int
acpi_ec_start (
struct acpi_device *device)
static int acpi_ec_start(struct acpi_device *device)
{
acpi_status status = AE_OK;
union acpi_ec *ec = NULL;
@@ -1335,23 +1249,26 @@ acpi_ec_start (
*/
status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS,
acpi_ec_io_ports, ec);
if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses"));
if (ACPI_FAILURE(status)
|| ec->common.command_addr.register_bit_width == 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Error getting I/O port addresses"));
return_VALUE(-ENODEV);
}
ec->common.status_addr = ec->common.command_addr;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n",
(u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address,
(u32) ec->common.gpe_bit,
(u32) ec->common.command_addr.address,
(u32) ec->common.data_addr.address));
/*
* Install GPE handler
*/
status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit,
ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec);
ACPI_GPE_EDGE_TRIGGERED,
&acpi_ec_gpe_handler, ec);
if (ACPI_FAILURE(status)) {
return_VALUE(-ENODEV);
}
@@ -1359,21 +1276,19 @@ acpi_ec_start (
acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR);
status = acpi_install_address_space_handler(ec->common.handle,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler,
&acpi_ec_space_setup, ec);
if (ACPI_FAILURE(status)) {
acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);
acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
&acpi_ec_gpe_handler);
return_VALUE(-ENODEV);
}
return_VALUE(AE_OK);
}
static int
acpi_ec_stop (
struct acpi_device *device,
int type)
static int acpi_ec_stop(struct acpi_device *device, int type)
{
acpi_status status = AE_OK;
union acpi_ec *ec = NULL;
@@ -1386,11 +1301,14 @@ acpi_ec_stop (
ec = acpi_driver_data(device);
status = acpi_remove_address_space_handler(ec->common.handle,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler);
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler);
status =
acpi_remove_gpe_handler(NULL, ec->common.gpe_bit,
&acpi_ec_gpe_handler);
if (ACPI_FAILURE(status))
return_VALUE(-ENODEV);
@@ -1398,11 +1316,8 @@ acpi_ec_stop (
}
static acpi_status __init
acpi_fake_ecdt_callback (
acpi_handle handle,
u32 Level,
void *context,
void **retval)
acpi_fake_ecdt_callback(acpi_handle handle,
u32 Level, void *context, void **retval)
{
if (acpi_ec_polling_mode)
@@ -1414,11 +1329,8 @@ acpi_fake_ecdt_callback (
}
static acpi_status __init
acpi_fake_ecdt_polling_callback (
acpi_handle handle,
u32 Level,
void *context,
void **retval)
acpi_fake_ecdt_polling_callback(acpi_handle handle,
u32 Level, void *context, void **retval)
{
acpi_status status;
@@ -1431,7 +1343,9 @@ acpi_fake_ecdt_polling_callback (
ec_ecdt->common.uid = -1;
acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);
status =
acpi_evaluate_integer(handle, "_GPE", NULL,
&ec_ecdt->common.gpe_bit);
if (ACPI_FAILURE(status))
return status;
spin_lock_init(&ec_ecdt->polling.lock);
@@ -1439,18 +1353,16 @@ acpi_fake_ecdt_polling_callback (
ec_ecdt->common.handle = handle;
printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
(u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,
(u32) ec_ecdt->common.gpe_bit,
(u32) ec_ecdt->common.command_addr.address,
(u32) ec_ecdt->common.data_addr.address);
return AE_CTRL_TERMINATE;
}
static acpi_status __init
acpi_fake_ecdt_burst_callback (
acpi_handle handle,
u32 Level,
void *context,
void **retval)
acpi_fake_ecdt_burst_callback(acpi_handle handle,
u32 Level, void *context, void **retval)
{
acpi_status status;
@@ -1465,14 +1377,17 @@ acpi_fake_ecdt_burst_callback (
ec_ecdt->common.uid = -1;
acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid);
status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit);
status =
acpi_evaluate_integer(handle, "_GPE", NULL,
&ec_ecdt->common.gpe_bit);
if (ACPI_FAILURE(status))
return status;
ec_ecdt->common.global_lock = TRUE;
ec_ecdt->common.handle = handle;
printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n",
(u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address,
(u32) ec_ecdt->common.gpe_bit,
(u32) ec_ecdt->common.command_addr.address,
(u32) ec_ecdt->common.data_addr.address);
return AE_CTRL_TERMINATE;
@@ -1488,8 +1403,7 @@ acpi_fake_ecdt_burst_callback (
* op region (since _REG isn't invoked yet). The assumption is true for
* all systems found.
*/
static int __init
acpi_ec_fake_ecdt(void)
static int __init acpi_ec_fake_ecdt(void)
{
acpi_status status;
int ret = 0;
@@ -1504,9 +1418,7 @@ acpi_ec_fake_ecdt(void)
memset(ec_ecdt, 0, sizeof(union acpi_ec));
status = acpi_get_devices(ACPI_EC_HID,
acpi_fake_ecdt_callback,
NULL,
NULL);
acpi_fake_ecdt_callback, NULL, NULL);
if (ACPI_FAILURE(status)) {
kfree(ec_ecdt);
ec_ecdt = NULL;
@@ -1519,8 +1431,7 @@ error:
return ret;
}
static int __init
acpi_ec_get_real_ecdt(void)
static int __init acpi_ec_get_real_ecdt(void)
{
if (acpi_ec_polling_mode)
return acpi_ec_polling_get_real_ecdt();
@@ -1528,14 +1439,14 @@ acpi_ec_get_real_ecdt(void)
return acpi_ec_burst_get_real_ecdt();
}
static int __init
acpi_ec_polling_get_real_ecdt(void)
static int __init acpi_ec_polling_get_real_ecdt(void)
{
acpi_status status;
struct acpi_table_ecdt *ecdt_ptr;
status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
(struct acpi_table_header **) &ecdt_ptr);
(struct acpi_table_header **)
&ecdt_ptr);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -1558,7 +1469,8 @@ acpi_ec_polling_get_real_ecdt(void)
ec_ecdt->common.global_lock = TRUE;
ec_ecdt->common.uid = ecdt_ptr->uid;
status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
status =
acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
if (ACPI_FAILURE(status)) {
goto error;
}
@@ -1572,15 +1484,14 @@ error:
return -ENODEV;
}
static int __init
acpi_ec_burst_get_real_ecdt(void)
static int __init acpi_ec_burst_get_real_ecdt(void)
{
acpi_status status;
struct acpi_table_ecdt *ecdt_ptr;
status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING,
(struct acpi_table_header **) &ecdt_ptr);
(struct acpi_table_header **)
&ecdt_ptr);
if (ACPI_FAILURE(status))
return -ENODEV;
@@ -1604,7 +1515,8 @@ acpi_ec_burst_get_real_ecdt(void)
ec_ecdt->common.global_lock = TRUE;
ec_ecdt->common.uid = ecdt_ptr->uid;
status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
status =
acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle);
if (ACPI_FAILURE(status)) {
goto error;
}
@@ -1619,8 +1531,7 @@ error:
}
static int __initdata acpi_fake_ecdt_enabled;
int __init
acpi_ec_ecdt_probe (void)
int __init acpi_ec_ecdt_probe(void)
{
acpi_status status;
int ret;
@@ -1638,8 +1549,8 @@ acpi_ec_ecdt_probe (void)
* Install GPE handler
*/
status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler,
ec_ecdt);
ACPI_GPE_EDGE_TRIGGERED,
&acpi_ec_gpe_handler, ec_ecdt);
if (ACPI_FAILURE(status)) {
goto error;
}
@@ -1647,8 +1558,10 @@ acpi_ec_ecdt_probe (void)
acpi_enable_gpe(NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR);
status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_EC, &acpi_ec_space_handler,
&acpi_ec_space_setup, ec_ecdt);
ACPI_ADR_SPACE_EC,
&acpi_ec_space_handler,
&acpi_ec_space_setup,
ec_ecdt);
if (ACPI_FAILURE(status)) {
acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit,
&acpi_ec_gpe_handler);
@@ -1665,7 +1578,6 @@ error:
return -ENODEV;
}
static int __init acpi_ec_init(void)
{
int result = 0;
@@ -1693,8 +1605,7 @@ subsys_initcall(acpi_ec_init);
/* EC driver currently not unloadable */
#if 0
static void __exit
acpi_ec_exit (void)
static void __exit acpi_ec_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_ec_exit");
@@ -1727,8 +1638,8 @@ static int __init acpi_ec_set_polling_mode(char *str)
acpi_ec_polling_mode = EC_POLLING;
acpi_ec_driver.ops.add = acpi_ec_polling_add;
}
printk(KERN_INFO PREFIX "EC %s mode.\n",
burst ? "burst": "polling");
printk(KERN_INFO PREFIX "EC %s mode.\n", burst ? "burst" : "polling");
return 0;
}
__setup("ec_burst=", acpi_ec_set_polling_mode);

View File

@@ -21,8 +21,7 @@ int event_is_open = 0;
extern struct list_head acpi_bus_event_list;
extern wait_queue_head_t acpi_bus_event_queue;
static int
acpi_system_open_event(struct inode *inode, struct file *file)
static int acpi_system_open_event(struct inode *inode, struct file *file)
{
spin_lock_irq(&acpi_system_event_lock);
@@ -40,7 +39,8 @@ out_busy:
}
static ssize_t
acpi_system_read_event(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
acpi_system_read_event(struct file *file, char __user * buffer, size_t count,
loff_t * ppos)
{
int result = 0;
struct acpi_bus_event event;
@@ -48,7 +48,6 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof
static int chars_remaining = 0;
static char *ptr;
ACPI_FUNCTION_TRACE("acpi_system_read_event");
if (!chars_remaining) {
@@ -64,9 +63,11 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof
}
chars_remaining = sprintf(str, "%s %s %08x %08x\n",
event.device_class?event.device_class:"<unknown>",
event.bus_id?event.bus_id:"<unknown>",
event.type, event.data);
event.device_class ? event.
device_class : "<unknown>",
event.bus_id ? event.
bus_id : "<unknown>", event.type,
event.data);
ptr = str;
}
@@ -84,8 +85,7 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof
return_VALUE(count);
}
static int
acpi_system_close_event(struct inode *inode, struct file *file)
static int acpi_system_close_event(struct inode *inode, struct file *file)
{
spin_lock_irq(&acpi_system_event_lock);
event_is_open = 0;
@@ -93,8 +93,7 @@ acpi_system_close_event(struct inode *inode, struct file *file)
return 0;
}
static unsigned int
acpi_system_poll_event(struct file *file, poll_table *wait)
static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
{
poll_wait(file, &acpi_bus_event_queue, wait);
if (!list_empty(&acpi_bus_event_list))
@@ -125,7 +124,8 @@ static int __init acpi_event_init(void)
entry->proc_fops = &acpi_system_event_ops;
else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' proc fs entry\n","event" ));
"Unable to create '%s' proc fs entry\n",
"event"));
error = -EFAULT;
}
return_VALUE(error);

View File

@@ -48,15 +48,9 @@
ACPI_MODULE_NAME("evevent")
/* Local prototypes */
static acpi_status acpi_ev_fixed_event_initialize(void);
static acpi_status
acpi_ev_fixed_event_initialize (
void);
static u32
acpi_ev_fixed_event_dispatch (
u32 event);
static u32 acpi_ev_fixed_event_dispatch(u32 event);
/*******************************************************************************
*
@@ -70,16 +64,12 @@ acpi_ev_fixed_event_dispatch (
*
******************************************************************************/
acpi_status
acpi_ev_initialize_events (
void)
acpi_status acpi_ev_initialize_events(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_initialize_events");
/* Make sure we have ACPI tables */
if (!acpi_gbl_DSDT) {
@@ -94,24 +84,20 @@ acpi_ev_initialize_events (
*/
status = acpi_ev_fixed_event_initialize();
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"Unable to initialize fixed events, %s\n",
ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
acpi_format_exception(status)));
return_ACPI_STATUS(status);
}
status = acpi_ev_gpe_initialize();
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"Unable to initialize general purpose events, %s\n",
acpi_format_exception (status)));
ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
return_ACPI_STATUS(status);
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_install_xrupt_handlers
@@ -124,23 +110,17 @@ acpi_ev_initialize_events (
*
******************************************************************************/
acpi_status
acpi_ev_install_xrupt_handlers (
void)
acpi_status acpi_ev_install_xrupt_handlers(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
/* Install the SCI handler */
status = acpi_ev_install_sci_handler();
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"Unable to install System Control Interrupt Handler, %s\n",
acpi_format_exception (status)));
ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
return_ACPI_STATUS(status);
}
@@ -148,9 +128,7 @@ acpi_ev_install_xrupt_handlers (
status = acpi_ev_init_global_lock_handler();
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"Unable to initialize Global Lock handler, %s\n",
acpi_format_exception (status)));
ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
return_ACPI_STATUS(status);
}
@@ -158,7 +136,6 @@ acpi_ev_install_xrupt_handlers (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_fixed_event_initialize
@@ -171,14 +148,11 @@ acpi_ev_install_xrupt_handlers (
*
******************************************************************************/
static acpi_status
acpi_ev_fixed_event_initialize (
void)
static acpi_status acpi_ev_fixed_event_initialize(void)
{
acpi_native_uint i;
acpi_status status;
/*
* Initialize the structure that keeps track of fixed event handlers
* and enable the fixed events.
@@ -190,9 +164,10 @@ acpi_ev_fixed_event_initialize (
/* Enable the fixed event */
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
status = acpi_set_register (
acpi_gbl_fixed_event_info[i].enable_register_id,
0, ACPI_MTX_LOCK);
status =
acpi_set_register(acpi_gbl_fixed_event_info[i].
enable_register_id, 0,
ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_fixed_event_detect
@@ -215,27 +189,23 @@ acpi_ev_fixed_event_initialize (
*
******************************************************************************/
u32
acpi_ev_fixed_event_detect (
void)
u32 acpi_ev_fixed_event_detect(void)
{
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
u32 fixed_status;
u32 fixed_enable;
acpi_native_uint i;
ACPI_FUNCTION_NAME("ev_fixed_event_detect");
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here.
*/
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
&fixed_status);
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
&fixed_enable);
(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_STATUS, &fixed_status);
(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
@@ -247,8 +217,10 @@ acpi_ev_fixed_event_detect (
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
/* Both the status and enable bits must be on for this event */
if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
(fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
if ((fixed_status & acpi_gbl_fixed_event_info[i].
status_bit_mask)
&& (fixed_enable & acpi_gbl_fixed_event_info[i].
enable_bit_mask)) {
/* Found an active (signalled) event */
int_status |= acpi_ev_fixed_event_dispatch((u32) i);
@@ -258,7 +230,6 @@ acpi_ev_fixed_event_detect (
return (int_status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_fixed_event_dispatch
@@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect (
*
******************************************************************************/
static u32
acpi_ev_fixed_event_dispatch (
u32 event)
static u32 acpi_ev_fixed_event_dispatch(u32 event)
{
ACPI_FUNCTION_ENTRY();
/* Clear the status bit */
(void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
1, ACPI_MTX_DO_NOT_LOCK);
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
/*
* Make sure we've got a handler. If not, report an error.
* The event is disabled to prevent further interrupts.
*/
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
(void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
0, ACPI_MTX_DO_NOT_LOCK);
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
enable_register_id, 0,
ACPI_MTX_DO_NOT_LOCK);
ACPI_REPORT_ERROR (
("No installed handler for fixed event [%08X]\n",
event));
ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
return (ACPI_INTERRUPT_NOT_HANDLED);
}
/* Invoke the Fixed Event handler */
return ((acpi_gbl_fixed_event_handlers[event].handler)(
acpi_gbl_fixed_event_handlers[event].context));
return ((acpi_gbl_fixed_event_handlers[event].
handler) (acpi_gbl_fixed_event_handlers[event].context));
}

View File

@@ -49,11 +49,7 @@
ACPI_MODULE_NAME("evgpe")
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context);
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context);
/*******************************************************************************
*
@@ -69,16 +65,12 @@ acpi_ev_asynch_execute_gpe_method (
******************************************************************************/
acpi_status
acpi_ev_set_gpe_type (
struct acpi_gpe_event_info *gpe_event_info,
u8 type)
acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_set_gpe_type");
/* Validate type and update register enable masks */
switch (type) {
@@ -102,7 +94,6 @@ acpi_ev_set_gpe_type (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_update_gpe_enable_masks
@@ -118,17 +109,14 @@ acpi_ev_set_gpe_type (
******************************************************************************/
acpi_status
acpi_ev_update_gpe_enable_masks (
struct acpi_gpe_event_info *gpe_event_info,
acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
u8 type)
{
struct acpi_gpe_register_info *gpe_register_info;
u8 register_bit;
ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks");
gpe_register_info = gpe_event_info->register_info;
if (!gpe_register_info) {
return_ACPI_STATUS(AE_NOT_EXIST);
@@ -138,7 +126,8 @@ acpi_ev_update_gpe_enable_masks (
/* 1) Disable case. Simply clear all enable bits */
if (type == ACPI_GPE_DISABLE) {
ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
register_bit);
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
return_ACPI_STATUS(AE_OK);
}
@@ -152,7 +141,8 @@ acpi_ev_update_gpe_enable_masks (
break;
case ACPI_GPE_TYPE_RUNTIME:
ACPI_CLEAR_BIT (gpe_register_info->enable_for_wake, register_bit);
ACPI_CLEAR_BIT(gpe_register_info->enable_for_wake,
register_bit);
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
break;
@@ -168,7 +158,6 @@ acpi_ev_update_gpe_enable_masks (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_enable_gpe
@@ -184,19 +173,17 @@ acpi_ev_update_gpe_enable_masks (
******************************************************************************/
acpi_status
acpi_ev_enable_gpe (
struct acpi_gpe_event_info *gpe_event_info,
acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
u8 write_to_hardware)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_enable_gpe");
/* Make sure HW enable masks are updated */
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE);
status =
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -240,7 +227,6 @@ acpi_ev_enable_gpe (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_disable_gpe
@@ -253,23 +239,20 @@ acpi_ev_enable_gpe (
*
******************************************************************************/
acpi_status
acpi_ev_disable_gpe (
struct acpi_gpe_event_info *gpe_event_info)
acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_disable_gpe");
if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
return_ACPI_STATUS(AE_OK);
}
/* Make sure HW enable masks are updated */
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
status =
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -301,7 +284,6 @@ acpi_ev_disable_gpe (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_get_gpe_event_info
@@ -319,19 +301,15 @@ acpi_ev_disable_gpe (
*
******************************************************************************/
struct acpi_gpe_event_info *
acpi_ev_get_gpe_event_info (
acpi_handle gpe_device,
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
u32 gpe_number)
{
union acpi_operand_object *obj_desc;
struct acpi_gpe_block_info *gpe_block;
acpi_native_uint i;
ACPI_FUNCTION_ENTRY();
/* A NULL gpe_block means use the FADT-defined GPE block(s) */
if (!gpe_device) {
@@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info (
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
gpe_block = acpi_gbl_gpe_fadt_blocks[i];
if (gpe_block) {
if ((gpe_number >= gpe_block->block_base_number) &&
(gpe_number < gpe_block->block_base_number +
if ((gpe_number >= gpe_block->block_base_number)
&& (gpe_number <
gpe_block->block_base_number +
(gpe_block->register_count * 8))) {
return (&gpe_block->event_info[gpe_number -
gpe_block->block_base_number]);
return (&gpe_block->
event_info[gpe_number -
gpe_block->
block_base_number]);
}
}
}
@@ -356,23 +337,25 @@ acpi_ev_get_gpe_event_info (
/* A Non-NULL gpe_device means this is a GPE Block Device */
obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) gpe_device);
if (!obj_desc ||
!obj_desc->device.gpe_block) {
obj_desc =
acpi_ns_get_attached_object((struct acpi_namespace_node *)
gpe_device);
if (!obj_desc || !obj_desc->device.gpe_block) {
return (NULL);
}
gpe_block = obj_desc->device.gpe_block;
if ((gpe_number >= gpe_block->block_base_number) &&
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
return (&gpe_block->event_info[gpe_number - gpe_block->block_base_number]);
(gpe_number <
gpe_block->block_base_number + (gpe_block->register_count * 8))) {
return (&gpe_block->
event_info[gpe_number - gpe_block->block_base_number]);
}
return (NULL);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_gpe_detect
@@ -387,9 +370,7 @@ acpi_ev_get_gpe_event_info (
*
******************************************************************************/
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;
@@ -402,7 +383,6 @@ acpi_ev_gpe_detect (
acpi_native_uint i;
acpi_native_uint j;
ACPI_FUNCTION_NAME("ev_gpe_detect");
/* Check for the case where there are no GPEs */
@@ -428,23 +408,30 @@ acpi_ev_gpe_detect (
/* Read the Status Register */
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg,
&gpe_register_info->status_address);
status =
acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
&status_reg,
&gpe_register_info->
status_address);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* Read the Enable Register */
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg,
&gpe_register_info->enable_address);
status =
acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
&enable_reg,
&gpe_register_info->
enable_address);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
gpe_register_info->base_gpe_number, status_reg, enable_reg));
gpe_register_info->base_gpe_number,
status_reg, enable_reg));
/* Check if there is anything active at all in this register */
@@ -460,14 +447,21 @@ acpi_ev_gpe_detect (
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
/* Examine one GPE bit */
if (enabled_status_byte & acpi_gbl_decode_to8bit[j]) {
if (enabled_status_byte &
acpi_gbl_decode_to8bit[j]) {
/*
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
int_status |= acpi_ev_gpe_dispatch (
&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
(u32) j + gpe_register_info->base_gpe_number);
int_status |=
acpi_ev_gpe_dispatch(&gpe_block->
event_info[(i *
ACPI_GPE_REGISTER_WIDTH)
+
j],
(u32) j +
gpe_register_info->
base_gpe_number);
}
}
}
@@ -481,7 +475,6 @@ unlock_and_exit:
return (int_status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_asynch_execute_gpe_method
@@ -498,9 +491,7 @@ unlock_and_exit:
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
acpi_ev_asynch_execute_gpe_method (
void *context)
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
{
struct acpi_gpe_event_info *gpe_event_info = (void *)context;
u32 gpe_number = 0;
@@ -508,10 +499,8 @@ acpi_ev_asynch_execute_gpe_method (
struct acpi_gpe_event_info local_gpe_event_info;
struct acpi_parameter_info info;
ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) {
return_VOID;
@@ -551,16 +540,13 @@ acpi_ev_asynch_execute_gpe_method (
* control method that corresponds to this GPE
*/
info.node = local_gpe_event_info.dispatch.method_node;
info.parameters = ACPI_CAST_PTR (union acpi_operand_object *, gpe_event_info);
info.parameters =
ACPI_CAST_PTR(union acpi_operand_object *, gpe_event_info);
info.parameter_type = ACPI_PARAM_GPE;
status = acpi_ns_evaluate_by_handle(&info);
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_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));
}
}
@@ -582,7 +568,6 @@ acpi_ev_asynch_execute_gpe_method (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_gpe_dispatch
@@ -600,16 +585,12 @@ acpi_ev_asynch_execute_gpe_method (
******************************************************************************/
u32
acpi_ev_gpe_dispatch (
struct acpi_gpe_event_info *gpe_event_info,
u32 gpe_number)
acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_gpe_dispatch");
/*
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
@@ -618,9 +599,7 @@ acpi_ev_gpe_dispatch (
ACPI_GPE_EDGE_TRIGGERED) {
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
acpi_format_exception (status), gpe_number));
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
}
}
@@ -629,8 +608,7 @@ acpi_ev_gpe_dispatch (
if (acpi_gbl_system_awake_and_running) {
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
}
else {
} else {
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
}
@@ -648,8 +626,10 @@ acpi_ev_gpe_dispatch (
* Invoke the installed handler (at interrupt level)
* Ignore return status for now. TBD: leave GPE disabled on error?
*/
(void) gpe_event_info->dispatch.handler->address (
gpe_event_info->dispatch.handler->context);
(void)gpe_event_info->dispatch.handler->address(gpe_event_info->
dispatch.
handler->
context);
/* It is now safe to clear level-triggered events. */
@@ -657,9 +637,7 @@ acpi_ev_gpe_dispatch (
ACPI_GPE_LEVEL_TRIGGERED) {
status = acpi_hw_clear_gpe(gpe_event_info);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
acpi_format_exception (status), gpe_number));
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
}
}
@@ -673,9 +651,7 @@ acpi_ev_gpe_dispatch (
*/
status = acpi_ev_disable_gpe(gpe_event_info);
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_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
}
@@ -684,11 +660,10 @@ acpi_ev_gpe_dispatch (
* NOTE: Level-triggered GPEs are cleared after the method completes.
*/
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
acpi_ev_asynch_execute_gpe_method, gpe_event_info);
acpi_ev_asynch_execute_gpe_method,
gpe_event_info);
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_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n", acpi_format_exception(status), gpe_number));
}
break;
@@ -696,9 +671,7 @@ acpi_ev_gpe_dispatch (
/* 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_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number));
/*
* Disable the GPE. The GPE will remain disabled until the ACPI
@@ -706,9 +679,7 @@ acpi_ev_gpe_dispatch (
*/
status = acpi_ev_disable_gpe(gpe_event_info);
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_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
}
break;
@@ -717,7 +688,6 @@ acpi_ev_gpe_dispatch (
return_VALUE(ACPI_INTERRUPT_HANDLED);
}
#ifdef ACPI_GPE_NOTIFY_CHECK
/*******************************************************************************
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
@@ -736,17 +706,14 @@ acpi_ev_gpe_dispatch (
******************************************************************************/
acpi_status
acpi_ev_check_for_wake_only_gpe (
struct acpi_gpe_event_info *gpe_event_info)
acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe");
if ((gpe_event_info) && /* Only >0 for _Lxx/_Exx */
((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */ {
((gpe_event_info->flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) { /* System state at GPE time */
/* This must be a wake-only GPE, disable it */
status = acpi_ev_disable_gpe(gpe_event_info);
@@ -755,8 +722,7 @@ acpi_ev_check_for_wake_only_gpe (
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_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info));
/* This was a wake-only GPE */
@@ -766,5 +732,3 @@ acpi_ev_check_for_wake_only_gpe (
return_ACPI_STATUS(AE_OK);
}
#endif

View File

@@ -49,38 +49,26 @@
ACPI_MODULE_NAME("evgpeblk")
/* Local prototypes */
static acpi_status
acpi_ev_save_method_info(acpi_handle obj_handle,
u32 level, void *obj_desc, void **return_value);
static acpi_status
acpi_ev_save_method_info (
acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value);
acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
u32 level, void *info, void **return_value);
static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
interrupt_number);
static acpi_status
acpi_ev_match_prw_and_gpe (
acpi_handle obj_handle,
u32 level,
void *info,
void **return_value);
acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt);
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
static acpi_status
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
u32 interrupt_number);
static acpi_status
acpi_ev_delete_gpe_xrupt (
struct acpi_gpe_xrupt_info *gpe_xrupt);
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
u32 interrupt_number);
static acpi_status
acpi_ev_create_gpe_info_blocks (
struct acpi_gpe_block_info *gpe_block);
acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block);
/*******************************************************************************
*
@@ -96,17 +84,13 @@ acpi_ev_create_gpe_info_blocks (
*
******************************************************************************/
u8
acpi_ev_valid_gpe_event (
struct acpi_gpe_event_info *gpe_event_info)
u8 acpi_ev_valid_gpe_event(struct acpi_gpe_event_info *gpe_event_info)
{
struct acpi_gpe_xrupt_info *gpe_xrupt_block;
struct acpi_gpe_block_info *gpe_block;
ACPI_FUNCTION_ENTRY();
/* No need for spin lock since we are not changing any list elements */
/* Walk the GPE interrupt levels */
@@ -119,7 +103,10 @@ acpi_ev_valid_gpe_event (
while (gpe_block) {
if ((&gpe_block->event_info[0] <= gpe_event_info) &&
(&gpe_block->event_info[((acpi_size) gpe_block->register_count) * 8] > gpe_event_info)) {
(&gpe_block->
event_info[((acpi_size) gpe_block->
register_count) * 8] >
gpe_event_info)) {
return (TRUE);
}
@@ -132,7 +119,6 @@ acpi_ev_valid_gpe_event (
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_walk_gpe_list
@@ -145,19 +131,15 @@ acpi_ev_valid_gpe_event (
*
******************************************************************************/
acpi_status
acpi_ev_walk_gpe_list (
ACPI_GPE_CALLBACK gpe_walk_callback)
acpi_status acpi_ev_walk_gpe_list(ACPI_GPE_CALLBACK gpe_walk_callback)
{
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
acpi_status status = AE_OK;
u32 flags;
ACPI_FUNCTION_TRACE("ev_walk_gpe_list");
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
/* Walk the interrupt level descriptor list */
@@ -186,7 +168,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_delete_gpe_handlers
@@ -202,31 +183,31 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_ev_delete_gpe_handlers (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block)
{
struct acpi_gpe_event_info *gpe_event_info;
acpi_native_uint i;
acpi_native_uint j;
ACPI_FUNCTION_TRACE("ev_delete_gpe_handlers");
/* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) {
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
gpe_event_info =
&gpe_block->
event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) {
ACPI_MEM_FREE(gpe_event_info->dispatch.handler);
gpe_event_info->dispatch.handler = NULL;
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK;
gpe_event_info->flags &=
~ACPI_GPE_DISPATCH_MASK;
}
}
}
@@ -234,7 +215,6 @@ acpi_ev_delete_gpe_handlers (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_save_method_info
@@ -258,11 +238,8 @@ acpi_ev_delete_gpe_handlers (
******************************************************************************/
static acpi_status
acpi_ev_save_method_info (
acpi_handle obj_handle,
u32 level,
void *obj_desc,
void **return_value)
acpi_ev_save_method_info(acpi_handle obj_handle,
u32 level, void *obj_desc, void **return_value)
{
struct acpi_gpe_block_info *gpe_block = (void *)obj_desc;
struct acpi_gpe_event_info *gpe_event_info;
@@ -271,17 +248,16 @@ acpi_ev_save_method_info (
u8 type;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_save_method_info");
/*
* _Lxx and _Exx GPE method support
*
* 1) Extract the name from the object and convert to a string
*/
ACPI_MOVE_32_TO_32(name,
&((struct acpi_namespace_node *) obj_handle)->name.integer);
&((struct acpi_namespace_node *)obj_handle)->name.
integer);
name[ACPI_NAME_SIZE] = 0;
/*
@@ -324,7 +300,9 @@ acpi_ev_save_method_info (
/* Ensure that we have a valid GPE number for this GPE block */
if ((gpe_number < gpe_block->block_base_number) ||
(gpe_number >= (gpe_block->block_base_number + (gpe_block->register_count * 8)))) {
(gpe_number >=
(gpe_block->block_base_number +
(gpe_block->register_count * 8)))) {
/*
* Not valid for this GPE block, just ignore it
* However, it may be valid for a different GPE block, since GPE0 and GPE1
@@ -338,12 +316,14 @@ acpi_ev_save_method_info (
* for use during dispatch of this GPE. Default type is RUNTIME, although
* this may change when the _PRW methods are executed later.
*/
gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
gpe_event_info =
&gpe_block->event_info[gpe_number - gpe_block->block_base_number];
gpe_event_info->flags = (u8) (type | ACPI_GPE_DISPATCH_METHOD |
ACPI_GPE_TYPE_RUNTIME);
gpe_event_info->dispatch.method_node = (struct acpi_namespace_node *) obj_handle;
gpe_event_info->dispatch.method_node =
(struct acpi_namespace_node *)obj_handle;
/* Update enable mask, but don't enable the HW GPE as of yet */
@@ -355,7 +335,6 @@ acpi_ev_save_method_info (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_match_prw_and_gpe
@@ -372,11 +351,8 @@ acpi_ev_save_method_info (
******************************************************************************/
static acpi_status
acpi_ev_match_prw_and_gpe (
acpi_handle obj_handle,
u32 level,
void *info,
void **return_value)
acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
u32 level, void *info, void **return_value)
{
struct acpi_gpe_walk_info *gpe_info = (void *)info;
struct acpi_namespace_node *gpe_device;
@@ -388,10 +364,8 @@ acpi_ev_match_prw_and_gpe (
u32 gpe_number;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_match_prw_and_gpe");
/* Check for a _PRW method under this device */
status = acpi_ut_evaluate_object(obj_handle, METHOD_NAME__PRW,
@@ -427,22 +401,23 @@ acpi_ev_match_prw_and_gpe (
/* Integer is the GPE number in the FADT described GPE blocks */
gpe_number = (u32) obj_desc->integer.value;
}
else if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_PACKAGE) {
} else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
/* Package contains a GPE reference and GPE number within a GPE block */
if ((obj_desc->package.count < 2) ||
(ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[0]) != ACPI_TYPE_LOCAL_REFERENCE) ||
(ACPI_GET_OBJECT_TYPE (obj_desc->package.elements[1]) != ACPI_TYPE_INTEGER)) {
(ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) !=
ACPI_TYPE_LOCAL_REFERENCE)
|| (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) !=
ACPI_TYPE_INTEGER)) {
goto cleanup;
}
/* Get GPE block reference and decode */
target_gpe_device = obj_desc->package.elements[0]->reference.node;
target_gpe_device =
obj_desc->package.elements[0]->reference.node;
gpe_number = (u32) obj_desc->package.elements[1]->integer.value;
}
else {
} else {
/* Unknown type, just ignore it */
goto cleanup;
@@ -458,17 +433,24 @@ acpi_ev_match_prw_and_gpe (
*/
if ((gpe_device == target_gpe_device) &&
(gpe_number >= gpe_block->block_base_number) &&
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
gpe_event_info = &gpe_block->event_info[gpe_number - gpe_block->block_base_number];
(gpe_number <
gpe_block->block_base_number + (gpe_block->register_count * 8))) {
gpe_event_info =
&gpe_block->event_info[gpe_number -
gpe_block->block_base_number];
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
gpe_event_info->flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
status = acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE);
gpe_event_info->flags &=
~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
status =
acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
status =
acpi_ev_update_gpe_enable_masks(gpe_event_info,
ACPI_GPE_DISABLE);
}
cleanup:
@@ -476,7 +458,6 @@ cleanup:
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_get_gpe_xrupt_block
@@ -492,19 +473,16 @@ cleanup:
*
******************************************************************************/
static struct acpi_gpe_xrupt_info *
acpi_ev_get_gpe_xrupt_block (
u32 interrupt_number)
static struct acpi_gpe_xrupt_info *acpi_ev_get_gpe_xrupt_block(u32
interrupt_number)
{
struct acpi_gpe_xrupt_info *next_gpe_xrupt;
struct acpi_gpe_xrupt_info *gpe_xrupt;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE("ev_get_gpe_xrupt_block");
/* No need for lock since we are not changing any list elements here */
next_gpe_xrupt = acpi_gbl_gpe_xrupt_list_head;
@@ -536,8 +514,7 @@ acpi_ev_get_gpe_xrupt_block (
next_gpe_xrupt->next = gpe_xrupt;
gpe_xrupt->previous = next_gpe_xrupt;
}
else {
} else {
acpi_gbl_gpe_xrupt_list_head = gpe_xrupt;
}
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
@@ -546,7 +523,8 @@ acpi_ev_get_gpe_xrupt_block (
if (interrupt_number != acpi_gbl_FADT->sci_int) {
status = acpi_os_install_interrupt_handler(interrupt_number,
acpi_ev_gpe_xrupt_handler, gpe_xrupt);
acpi_ev_gpe_xrupt_handler,
gpe_xrupt);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not install GPE interrupt handler at level 0x%X\n",
@@ -558,7 +536,6 @@ acpi_ev_get_gpe_xrupt_block (
return_PTR(gpe_xrupt);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_delete_gpe_xrupt
@@ -573,16 +550,13 @@ acpi_ev_get_gpe_xrupt_block (
******************************************************************************/
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;
u32 flags;
ACPI_FUNCTION_TRACE("ev_delete_gpe_xrupt");
/* We never want to remove the SCI interrupt handler */
if (gpe_xrupt->interrupt_number == acpi_gbl_FADT->sci_int) {
@@ -616,7 +590,6 @@ acpi_ev_delete_gpe_xrupt (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_install_gpe_block
@@ -631,8 +604,7 @@ acpi_ev_delete_gpe_xrupt (
******************************************************************************/
static acpi_status
acpi_ev_install_gpe_block (
struct acpi_gpe_block_info *gpe_block,
acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block,
u32 interrupt_number)
{
struct acpi_gpe_block_info *next_gpe_block;
@@ -640,10 +612,8 @@ acpi_ev_install_gpe_block (
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE("ev_install_gpe_block");
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -666,8 +636,7 @@ acpi_ev_install_gpe_block (
next_gpe_block->next = gpe_block;
gpe_block->previous = next_gpe_block;
}
else {
} else {
gpe_xrupt_block->gpe_block_list_head = gpe_block;
}
@@ -679,7 +648,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_delete_gpe_block
@@ -692,17 +660,13 @@ unlock_and_exit:
*
******************************************************************************/
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;
u32 flags;
ACPI_FUNCTION_TRACE("ev_install_gpe_block");
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -719,16 +683,15 @@ acpi_ev_delete_gpe_block (
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
}
else {
} else {
/* Remove the block on this interrupt with lock */
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
if (gpe_block->previous) {
gpe_block->previous->next = gpe_block->next;
}
else {
gpe_block->xrupt_block->gpe_block_list_head = gpe_block->next;
} else {
gpe_block->xrupt_block->gpe_block_list_head =
gpe_block->next;
}
if (gpe_block->next) {
@@ -748,7 +711,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_create_gpe_info_blocks
@@ -762,8 +724,7 @@ unlock_and_exit:
******************************************************************************/
static acpi_status
acpi_ev_create_gpe_info_blocks (
struct acpi_gpe_block_info *gpe_block)
acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block)
{
struct acpi_gpe_register_info *gpe_register_info = NULL;
struct acpi_gpe_event_info *gpe_event_info = NULL;
@@ -773,15 +734,14 @@ acpi_ev_create_gpe_info_blocks (
acpi_native_uint j;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_create_gpe_info_blocks");
/* Allocate the GPE register information block */
gpe_register_info = ACPI_MEM_CALLOCATE (
(acpi_size) gpe_block->register_count *
sizeof (struct acpi_gpe_register_info));
gpe_register_info = ACPI_MEM_CALLOCATE((acpi_size) gpe_block->
register_count *
sizeof(struct
acpi_gpe_register_info));
if (!gpe_register_info) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not allocate the gpe_register_info table\n"));
@@ -792,8 +752,8 @@ acpi_ev_create_gpe_info_blocks (
* Allocate the GPE event_info block. There are eight distinct GPEs
* per register. Initialization to zeros is sufficient.
*/
gpe_event_info = ACPI_MEM_CALLOCATE (
((acpi_size) gpe_block->register_count *
gpe_event_info = ACPI_MEM_CALLOCATE(((acpi_size) gpe_block->
register_count *
ACPI_GPE_REGISTER_WIDTH) *
sizeof(struct acpi_gpe_event_info));
if (!gpe_event_info) {
@@ -820,24 +780,29 @@ acpi_ev_create_gpe_info_blocks (
for (i = 0; i < gpe_block->register_count; i++) {
/* Init the register_info for this GPE register (8 GPEs) */
this_register->base_gpe_number = (u8) (gpe_block->block_base_number +
this_register->base_gpe_number =
(u8) (gpe_block->block_base_number +
(i * ACPI_GPE_REGISTER_WIDTH));
ACPI_STORE_ADDRESS(this_register->status_address.address,
(gpe_block->block_address.address
+ i));
(gpe_block->block_address.address + i));
ACPI_STORE_ADDRESS(this_register->enable_address.address,
(gpe_block->block_address.address
+ i
+ gpe_block->register_count));
+ i + gpe_block->register_count));
this_register->status_address.address_space_id = gpe_block->block_address.address_space_id;
this_register->enable_address.address_space_id = gpe_block->block_address.address_space_id;
this_register->status_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH;
this_register->enable_address.register_bit_width = ACPI_GPE_REGISTER_WIDTH;
this_register->status_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH;
this_register->enable_address.register_bit_offset = ACPI_GPE_REGISTER_WIDTH;
this_register->status_address.address_space_id =
gpe_block->block_address.address_space_id;
this_register->enable_address.address_space_id =
gpe_block->block_address.address_space_id;
this_register->status_address.register_bit_width =
ACPI_GPE_REGISTER_WIDTH;
this_register->enable_address.register_bit_width =
ACPI_GPE_REGISTER_WIDTH;
this_register->status_address.register_bit_offset =
ACPI_GPE_REGISTER_WIDTH;
this_register->enable_address.register_bit_offset =
ACPI_GPE_REGISTER_WIDTH;
/* Init the event_info for each GPE within this register */
@@ -853,13 +818,15 @@ acpi_ev_create_gpe_info_blocks (
* by writing a '0'.
*/
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0x00,
&this_register->enable_address);
&this_register->
enable_address);
if (ACPI_FAILURE(status)) {
goto error_exit;
}
status = acpi_hw_low_level_write(ACPI_GPE_REGISTER_WIDTH, 0xFF,
&this_register->status_address);
&this_register->
status_address);
if (ACPI_FAILURE(status)) {
goto error_exit;
}
@@ -869,7 +836,6 @@ acpi_ev_create_gpe_info_blocks (
return_ACPI_STATUS(AE_OK);
error_exit:
if (gpe_register_info) {
ACPI_MEM_FREE(gpe_register_info);
@@ -881,7 +847,6 @@ error_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_create_gpe_block
@@ -900,8 +865,7 @@ error_exit:
******************************************************************************/
acpi_status
acpi_ev_create_gpe_block (
struct acpi_namespace_node *gpe_device,
acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u8 gpe_block_base_number,
@@ -917,10 +881,8 @@ acpi_ev_create_gpe_block (
acpi_status status;
struct acpi_gpe_walk_info gpe_info;
ACPI_FUNCTION_TRACE("ev_create_gpe_block");
if (!register_count) {
return_ACPI_STATUS(AE_OK);
}
@@ -960,8 +922,9 @@ acpi_ev_create_gpe_block (
/* Find all GPE methods (_Lxx, _Exx) for this block */
status = acpi_ns_walk_namespace(ACPI_TYPE_METHOD, gpe_device,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, acpi_ev_save_method_info,
gpe_block, NULL);
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
acpi_ev_save_method_info, gpe_block,
NULL);
/*
* Runtime option: Should Wake GPEs be enabled at runtime? The default
@@ -977,9 +940,11 @@ acpi_ev_create_gpe_block (
gpe_info.gpe_block = gpe_block;
gpe_info.gpe_device = gpe_device;
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ev_match_prw_and_gpe,
&gpe_info, NULL);
status =
acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
acpi_ev_match_prw_and_gpe, &gpe_info,
NULL);
}
/*
@@ -994,10 +959,14 @@ acpi_ev_create_gpe_block (
for (j = 0; j < 8; j++) {
/* Get the info block for this particular GPE */
gpe_event_info = &gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
gpe_event_info =
&gpe_block->
event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j];
if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD) &&
(gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD)
&& (gpe_event_info->
flags & ACPI_GPE_TYPE_RUNTIME)) {
gpe_enabled_count++;
}
@@ -1013,9 +982,9 @@ acpi_ev_create_gpe_block (
"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,
((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 */
@@ -1035,7 +1004,6 @@ acpi_ev_create_gpe_block (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_gpe_initialize
@@ -1048,19 +1016,15 @@ acpi_ev_create_gpe_block (
*
******************************************************************************/
acpi_status
acpi_ev_gpe_initialize (
void)
acpi_status acpi_ev_gpe_initialize(void)
{
u32 register_count0 = 0;
u32 register_count1 = 0;
u32 gpe_number_max = 0;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_gpe_initialize");
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -1091,29 +1055,29 @@ acpi_ev_gpe_initialize (
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
if (acpi_gbl_FADT->gpe0_blk_len &&
acpi_gbl_FADT->xgpe0_blk.address) {
if (acpi_gbl_FADT->gpe0_blk_len && acpi_gbl_FADT->xgpe0_blk.address) {
/* GPE block 0 exists (has both length and address > 0) */
register_count0 = (u16) (acpi_gbl_FADT->gpe0_blk_len / 2);
gpe_number_max = (register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1;
gpe_number_max =
(register_count0 * ACPI_GPE_REGISTER_WIDTH) - 1;
/* Install GPE Block 0 */
status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
&acpi_gbl_FADT->xgpe0_blk, register_count0, 0,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[0]);
&acpi_gbl_FADT->xgpe0_blk,
register_count0, 0,
acpi_gbl_FADT->sci_int,
&acpi_gbl_gpe_fadt_blocks[0]);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"Could not create GPE Block 0, %s\n",
ACPI_REPORT_ERROR(("Could not create GPE Block 0, %s\n",
acpi_format_exception(status)));
}
}
if (acpi_gbl_FADT->gpe1_blk_len &&
acpi_gbl_FADT->xgpe1_blk.address) {
if (acpi_gbl_FADT->gpe1_blk_len && acpi_gbl_FADT->xgpe1_blk.address) {
/* GPE block 1 exists (has both length and address > 0) */
register_count1 = (u16) (acpi_gbl_FADT->gpe1_blk_len / 2);
@@ -1122,28 +1086,25 @@ acpi_ev_gpe_initialize (
if ((register_count0) &&
(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_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)));
/* Ignore GPE1 block by setting the register count to zero */
register_count1 = 0;
}
else {
} else {
/* Install GPE Block 1 */
status = acpi_ev_create_gpe_block (acpi_gbl_fadt_gpe_device,
&acpi_gbl_FADT->xgpe1_blk, register_count1,
status =
acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
&acpi_gbl_FADT->xgpe1_blk,
register_count1,
acpi_gbl_FADT->gpe1_base,
acpi_gbl_FADT->sci_int, &acpi_gbl_gpe_fadt_blocks[1]);
acpi_gbl_FADT->sci_int,
&acpi_gbl_gpe_fadt_blocks
[1]);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR ((
"Could not create GPE Block 1, %s\n",
acpi_format_exception (status)));
ACPI_REPORT_ERROR(("Could not create GPE Block 1, %s\n", acpi_format_exception(status)));
}
/*
@@ -1169,8 +1130,7 @@ acpi_ev_gpe_initialize (
/* Check for Max GPE number out-of-range */
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_REPORT_ERROR(("Maximum GPE number from FADT is too large: 0x%X\n", gpe_number_max));
status = AE_BAD_VALUE;
goto cleanup;
}
@@ -1179,5 +1139,3 @@ cleanup:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(AE_OK);
}

View File

@@ -49,10 +49,8 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evmisc")
#ifdef ACPI_DEBUG_OUTPUT
static const char *acpi_notify_value_names[] =
{
static const char *acpi_notify_value_names[] = {
"Bus Check",
"Device Check",
"Device Wake",
@@ -66,18 +64,11 @@ static const char *acpi_notify_value_names[] =
/* Local prototypes */
static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context);
static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
static void ACPI_SYSTEM_XFACE
acpi_ev_global_lock_thread (
void *context);
static u32
acpi_ev_global_lock_handler (
void *context);
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
static u32 acpi_ev_global_lock_handler(void *context);
/*******************************************************************************
*
@@ -93,9 +84,7 @@ acpi_ev_global_lock_handler (
*
******************************************************************************/
u8
acpi_ev_is_notify_object (
struct acpi_namespace_node *node)
u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
{
switch (node->type) {
case ACPI_TYPE_DEVICE:
@@ -112,7 +101,6 @@ acpi_ev_is_notify_object (
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_queue_notify_request
@@ -128,8 +116,7 @@ acpi_ev_is_notify_object (
******************************************************************************/
acpi_status
acpi_ev_queue_notify_request (
struct acpi_namespace_node *node,
acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
u32 notify_value)
{
union acpi_operand_object *obj_desc;
@@ -137,10 +124,8 @@ acpi_ev_queue_notify_request (
union acpi_generic_state *notify_info;
acpi_status status = AE_OK;
ACPI_FUNCTION_NAME("ev_queue_notify_request");
/*
* For value 3 (Ejection Request), some device method may need to be run.
* For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
@@ -149,13 +134,13 @@ acpi_ev_queue_notify_request (
* initiate soft-off or sleep operation?
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Dispatching Notify(%X) on node %p\n", notify_value, node));
"Dispatching Notify(%X) on node %p\n", notify_value,
node));
if (notify_value <= 7) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
acpi_notify_value_names[notify_value]));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Notify value: 0x%2.2X **Device Specific**\n",
notify_value));
@@ -174,10 +159,11 @@ acpi_ev_queue_notify_request (
case ACPI_TYPE_POWER:
if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
handler_obj = obj_desc->common_notify.system_notify;
}
else {
handler_obj = obj_desc->common_notify.device_notify;
handler_obj =
obj_desc->common_notify.system_notify;
} else {
handler_obj =
obj_desc->common_notify.device_notify;
}
break;
@@ -189,9 +175,10 @@ acpi_ev_queue_notify_request (
/* If there is any handler to run, schedule the dispatcher */
if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
(acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
handler_obj) {
if ((acpi_gbl_system_notify.handler
&& (notify_value <= ACPI_MAX_SYS_NOTIFY))
|| (acpi_gbl_device_notify.handler
&& (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
notify_info = acpi_ut_create_generic_state();
if (!notify_info) {
return (AE_NO_MEMORY);
@@ -203,7 +190,8 @@ acpi_ev_queue_notify_request (
notify_info->notify.handler_obj = handler_obj;
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
acpi_ev_notify_dispatch, notify_info);
acpi_ev_notify_dispatch,
notify_info);
if (ACPI_FAILURE(status)) {
acpi_ut_delete_generic_state(notify_info);
}
@@ -216,13 +204,13 @@ acpi_ev_queue_notify_request (
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"No notify handler for Notify(%4.4s, %X) node %p\n",
acpi_ut_get_node_name (node), notify_value, node));
acpi_ut_get_node_name(node), notify_value,
node));
}
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_notify_dispatch
@@ -236,19 +224,16 @@ acpi_ev_queue_notify_request (
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
acpi_ev_notify_dispatch (
void *context)
static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
{
union acpi_generic_state *notify_info = (union acpi_generic_state *) context;
union acpi_generic_state *notify_info =
(union acpi_generic_state *)context;
acpi_notify_handler global_handler = NULL;
void *global_context = NULL;
union acpi_operand_object *handler_obj;
ACPI_FUNCTION_ENTRY();
/*
* We will invoke a global notify handler if installed.
* This is done _before_ we invoke the per-device handler attached
@@ -261,8 +246,7 @@ acpi_ev_notify_dispatch (
global_handler = acpi_gbl_system_notify.handler;
global_context = acpi_gbl_system_notify.context;
}
}
else {
} else {
/* Global driver notification handler */
if (acpi_gbl_device_notify.handler) {
@@ -274,8 +258,8 @@ acpi_ev_notify_dispatch (
/* Invoke the system handler first, if present */
if (global_handler) {
global_handler (notify_info->notify.node, notify_info->notify.value,
global_context);
global_handler(notify_info->notify.node,
notify_info->notify.value, global_context);
}
/* Now invoke the per-device handler, if present */
@@ -292,7 +276,6 @@ acpi_ev_notify_dispatch (
acpi_ut_delete_generic_state(notify_info);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_global_lock_thread
@@ -307,19 +290,17 @@ acpi_ev_notify_dispatch (
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
acpi_ev_global_lock_thread (
void *context)
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
{
acpi_status status;
/* Signal threads that are waiting for the lock */
if (acpi_gbl_global_lock_thread_count) {
/* Send sufficient units to the semaphore */
status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
status =
acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
acpi_gbl_global_lock_thread_count);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
@@ -327,7 +308,6 @@ acpi_ev_global_lock_thread (
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_global_lock_handler
@@ -342,14 +322,11 @@ acpi_ev_global_lock_thread (
*
******************************************************************************/
static u32
acpi_ev_global_lock_handler (
void *context)
static u32 acpi_ev_global_lock_handler(void *context)
{
u8 acquired = FALSE;
acpi_status status;
/*
* Attempt to get the lock
* If we don't get it now, it will be marked pending and we will
@@ -364,10 +341,10 @@ acpi_ev_global_lock_handler (
/* Run the Global Lock thread which will signal all waiting threads */
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
acpi_ev_global_lock_thread, context);
acpi_ev_global_lock_thread,
context);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
acpi_format_exception (status)));
ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
return (ACPI_INTERRUPT_NOT_HANDLED);
}
@@ -376,7 +353,6 @@ acpi_ev_global_lock_handler (
return (ACPI_INTERRUPT_HANDLED);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_init_global_lock_handler
@@ -389,19 +365,16 @@ acpi_ev_global_lock_handler (
*
******************************************************************************/
acpi_status
acpi_ev_init_global_lock_handler (
void)
acpi_status acpi_ev_init_global_lock_handler(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
acpi_gbl_global_lock_present = TRUE;
status = acpi_install_fixed_event_handler(ACPI_EVENT_GLOBAL,
acpi_ev_global_lock_handler, NULL);
acpi_ev_global_lock_handler,
NULL);
/*
* If the global lock does not exist on this platform, the attempt
@@ -411,8 +384,7 @@ acpi_ev_init_global_lock_handler (
* with an error.
*/
if (status == AE_NO_HARDWARE_RESPONSE) {
ACPI_REPORT_ERROR ((
"No response from Global Lock hardware, disabling lock\n"));
ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
acpi_gbl_global_lock_present = FALSE;
status = AE_OK;
@@ -421,7 +393,6 @@ acpi_ev_init_global_lock_handler (
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_ev_acquire_global_lock
@@ -434,17 +405,13 @@ acpi_ev_init_global_lock_handler (
*
*****************************************************************************/
acpi_status
acpi_ev_acquire_global_lock (
u16 timeout)
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
{
acpi_status status = AE_OK;
u8 acquired = FALSE;
ACPI_FUNCTION_TRACE("ev_acquire_global_lock");
#ifndef ACPI_APPLICATION
/* Make sure that we actually have a global lock */
@@ -471,7 +438,8 @@ acpi_ev_acquire_global_lock (
if (acquired) {
/* We got the lock */
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Acquired the HW Global Lock\n"));
acpi_gbl_global_lock_acquired = TRUE;
return_ACPI_STATUS(AE_OK);
@@ -492,7 +460,6 @@ acpi_ev_acquire_global_lock (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_release_global_lock
@@ -505,20 +472,15 @@ acpi_ev_acquire_global_lock (
*
******************************************************************************/
acpi_status
acpi_ev_release_global_lock (
void)
acpi_status acpi_ev_release_global_lock(void)
{
u8 pending = FALSE;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ev_release_global_lock");
if (!acpi_gbl_global_lock_thread_count) {
ACPI_REPORT_WARNING((
"Cannot release HW Global Lock, it has not been acquired\n"));
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
return_ACPI_STATUS(AE_NOT_ACQUIRED);
}
@@ -550,7 +512,6 @@ acpi_ev_release_global_lock (
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_ev_terminate
@@ -563,17 +524,13 @@ acpi_ev_release_global_lock (
*
******************************************************************************/
void
acpi_ev_terminate (
void)
void acpi_ev_terminate(void)
{
acpi_native_uint i;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_terminate");
if (acpi_gbl_events_initialized) {
/*
* Disable all event-related functionality.
@@ -586,7 +543,8 @@ acpi_ev_terminate (
status = acpi_disable_event((u32) i, 0);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not disable fixed event %d\n", (u32) i));
"Could not disable fixed event %d\n",
(u32) i));
}
}
@@ -612,9 +570,9 @@ acpi_ev_terminate (
if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
status = acpi_disable();
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"acpi_disable failed\n"));
}
}
return_VOID;
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acevents.h>
#include <acpi/acnamesp.h>
@@ -49,31 +48,23 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evregion")
#define ACPI_NUM_DEFAULT_SPACES 4
static u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_DATA_TABLE};
ACPI_ADR_SPACE_DATA_TABLE
};
/* Local prototypes */
static acpi_status
acpi_ev_reg_run (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_ev_reg_run(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
static acpi_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_ev_install_handler(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
/*******************************************************************************
*
@@ -87,16 +78,13 @@ acpi_ev_install_handler (
*
******************************************************************************/
acpi_status
acpi_ev_install_region_handlers (
void) {
acpi_status acpi_ev_install_region_handlers(void)
{
acpi_status status;
acpi_native_uint i;
ACPI_FUNCTION_TRACE("ev_install_region_handlers");
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -122,8 +110,10 @@ acpi_ev_install_region_handlers (
*/
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++) {
status = acpi_ev_install_space_handler(acpi_gbl_root_node,
acpi_gbl_default_address_spaces[i],
ACPI_DEFAULT_HANDLER, NULL, NULL);
acpi_gbl_default_address_spaces
[i],
ACPI_DEFAULT_HANDLER,
NULL, NULL);
switch (status) {
case AE_OK:
case AE_SAME_HANDLER:
@@ -145,7 +135,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_initialize_op_regions
@@ -159,17 +148,13 @@ unlock_and_exit:
*
******************************************************************************/
acpi_status
acpi_ev_initialize_op_regions (
void)
acpi_status acpi_ev_initialize_op_regions(void)
{
acpi_status status;
acpi_native_uint i;
ACPI_FUNCTION_TRACE("ev_initialize_op_regions");
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -183,14 +168,14 @@ acpi_ev_initialize_op_regions (
* _REG will have already been run.
*/
status = acpi_ev_execute_reg_methods(acpi_gbl_root_node,
acpi_gbl_default_address_spaces[i]);
acpi_gbl_default_address_spaces
[i]);
}
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_execute_reg_method
@@ -205,19 +190,15 @@ acpi_ev_initialize_op_regions (
******************************************************************************/
acpi_status
acpi_ev_execute_reg_method (
union acpi_operand_object *region_obj,
u32 function)
acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function)
{
struct acpi_parameter_info info;
union acpi_operand_object *params[3];
union acpi_operand_object *region_obj2;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_execute_reg_method");
region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2) {
return_ACPI_STATUS(AE_NOT_EXIST);
@@ -260,8 +241,8 @@ acpi_ev_execute_reg_method (
/* Execute the method, no return value */
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (
ACPI_TYPE_METHOD, info.node, NULL));
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname
(ACPI_TYPE_METHOD, info.node, NULL));
status = acpi_ns_evaluate_by_handle(&info);
acpi_ut_remove_reference(params[1]);
@@ -272,7 +253,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_address_space_dispatch
@@ -291,12 +271,10 @@ cleanup:
******************************************************************************/
acpi_status
acpi_ev_address_space_dispatch (
union acpi_operand_object *region_obj,
acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
u32 function,
acpi_physical_address address,
u32 bit_width,
void *value)
u32 bit_width, void *value)
{
acpi_status status;
acpi_status status2;
@@ -306,10 +284,8 @@ acpi_ev_address_space_dispatch (
union acpi_operand_object *region_obj2;
void *region_context = NULL;
ACPI_FUNCTION_TRACE("ev_address_space_dispatch");
region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2) {
return_ACPI_STATUS(AE_NOT_EXIST);
@@ -321,8 +297,10 @@ acpi_ev_address_space_dispatch (
if (!handler_desc) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No handler for Region [%4.4s] (%p) [%s]\n",
acpi_ut_get_node_name (region_obj->region.node),
region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
acpi_ut_get_node_name(region_obj->region.
node), region_obj,
acpi_ut_get_region_name(region_obj->region.
space_id)));
return_ACPI_STATUS(AE_NOT_EXIST);
}
@@ -341,7 +319,10 @@ acpi_ev_address_space_dispatch (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No init routine for region(%p) [%s]\n",
region_obj, acpi_ut_get_region_name (region_obj->region.space_id)));
region_obj,
acpi_ut_get_region_name(region_obj->
region.
space_id)));
return_ACPI_STATUS(AE_NOT_EXIST);
}
@@ -353,7 +334,8 @@ acpi_ev_address_space_dispatch (
acpi_ex_exit_interpreter();
status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
handler_desc->address_space.context, &region_context);
handler_desc->address_space.context,
&region_context);
/* Re-enter the interpreter */
@@ -365,9 +347,12 @@ acpi_ev_address_space_dispatch (
/* Check for failure of the Region Setup */
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Region Init: %s [%s]\n",
acpi_format_exception(status),
acpi_ut_get_region_name (region_obj->region.space_id)));
acpi_ut_get_region_name(region_obj->
region.
space_id)));
return_ACPI_STATUS(status);
}
@@ -381,13 +366,13 @@ acpi_ev_address_space_dispatch (
/* The handler for this region was already installed */
ACPI_MEM_FREE(region_context);
}
else {
} else {
/*
* Save the returned context for use in all accesses to
* this particular region
*/
region_obj2->extra.region_context = region_context;
region_obj2->extra.region_context =
region_context;
}
}
}
@@ -400,9 +385,12 @@ acpi_ev_address_space_dispatch (
"Handler %p (@%p) Address %8.8X%8.8X [%s]\n",
&region_obj->region.handler->address_space, handler,
ACPI_FORMAT_UINT64(address),
acpi_ut_get_region_name (region_obj->region.space_id)));
acpi_ut_get_region_name(region_obj->region.
space_id)));
if (!(handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
if (!
(handler_desc->address_space.
hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
/*
* For handlers other than the default (supplied) handlers, we must
* exit the interpreter because the handler *might* block -- we don't
@@ -419,11 +407,14 @@ acpi_ev_address_space_dispatch (
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Handler for [%s] returned %s\n",
acpi_ut_get_region_name (region_obj->region.space_id),
acpi_ut_get_region_name(region_obj->region.
space_id),
acpi_format_exception(status)));
}
if (!(handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
if (!
(handler_desc->address_space.
hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)) {
/*
* We just returned from a non-default handler, we must re-enter the
* interpreter
@@ -437,7 +428,6 @@ acpi_ev_address_space_dispatch (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_detach_region
@@ -453,8 +443,7 @@ acpi_ev_address_space_dispatch (
******************************************************************************/
void
acpi_ev_detach_region(
union acpi_operand_object *region_obj,
acpi_ev_detach_region(union acpi_operand_object *region_obj,
u8 acpi_ns_is_locked)
{
union acpi_operand_object *handler_obj;
@@ -465,10 +454,8 @@ acpi_ev_detach_region(
union acpi_operand_object *region_obj2;
acpi_status status;
ACPI_FUNCTION_TRACE("ev_detach_region");
region_obj2 = acpi_ns_get_secondary_object(region_obj);
if (!region_obj2) {
return_VOID;
@@ -503,7 +490,8 @@ acpi_ev_detach_region(
obj_desc->region.next = NULL; /* Must clear field */
if (acpi_ns_is_locked) {
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
status =
acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_VOID;
}
@@ -513,13 +501,17 @@ acpi_ev_detach_region(
status = acpi_ev_execute_reg_method(region_obj, 0);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%s from region _REG, [%s]\n",
acpi_format_exception(status),
acpi_ut_get_region_name (region_obj->region.space_id)));
acpi_ut_get_region_name
(region_obj->region.
space_id)));
}
if (acpi_ns_is_locked) {
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
status =
acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_VOID;
}
@@ -528,15 +520,20 @@ acpi_ev_detach_region(
/* Call the setup handler with the deactivate notification */
region_setup = handler_obj->address_space.setup;
status = region_setup (region_obj, ACPI_REGION_DEACTIVATE,
handler_obj->address_space.context, region_context);
status =
region_setup(region_obj, ACPI_REGION_DEACTIVATE,
handler_obj->address_space.context,
region_context);
/* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%s from region init, [%s]\n",
acpi_format_exception(status),
acpi_ut_get_region_name (region_obj->region.space_id)));
acpi_ut_get_region_name
(region_obj->region.
space_id)));
}
region_obj->region.flags &= ~(AOPOBJ_SETUP_COMPLETE);
@@ -572,7 +569,6 @@ acpi_ev_detach_region(
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_attach_region
@@ -589,20 +585,19 @@ acpi_ev_detach_region(
******************************************************************************/
acpi_status
acpi_ev_attach_region (
union acpi_operand_object *handler_obj,
acpi_ev_attach_region(union acpi_operand_object *handler_obj,
union acpi_operand_object *region_obj,
u8 acpi_ns_is_locked)
{
ACPI_FUNCTION_TRACE("ev_attach_region");
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Adding Region [%4.4s] %p to address handler %p [%s]\n",
acpi_ut_get_node_name(region_obj->region.node),
region_obj, handler_obj,
acpi_ut_get_region_name (region_obj->region.space_id)));
acpi_ut_get_region_name(region_obj->region.
space_id)));
/* Link this region to the front of the handler's list */
@@ -621,7 +616,6 @@ acpi_ev_attach_region (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_install_handler
@@ -640,11 +634,8 @@ acpi_ev_attach_region (
******************************************************************************/
static acpi_status
acpi_ev_install_handler (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ev_install_handler(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
union acpi_operand_object *handler_obj;
union acpi_operand_object *next_handler_obj;
@@ -652,10 +643,8 @@ acpi_ev_install_handler (
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_NAME("ev_install_handler");
handler_obj = (union acpi_operand_object *)context;
/* Parameter validation */
@@ -676,8 +665,7 @@ acpi_ev_install_handler (
* that are allowed to have address space handlers
*/
if ((node->type != ACPI_TYPE_DEVICE) &&
(node->type != ACPI_TYPE_REGION) &&
(node != acpi_gbl_root_node)) {
(node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
return (AE_OK);
}
@@ -699,11 +687,15 @@ acpi_ev_install_handler (
while (next_handler_obj) {
/* Found a handler, is it for the same address space? */
if (next_handler_obj->address_space.space_id == handler_obj->address_space.space_id) {
if (next_handler_obj->address_space.space_id ==
handler_obj->address_space.space_id) {
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Found handler for region [%s] in device %p(%p) handler %p\n",
acpi_ut_get_region_name (handler_obj->address_space.space_id),
obj_desc, next_handler_obj, handler_obj));
acpi_ut_get_region_name
(handler_obj->address_space.
space_id), obj_desc,
next_handler_obj,
handler_obj));
/*
* Since the object we found it on was a device, then it
@@ -752,7 +744,6 @@ acpi_ev_install_handler (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_install_space_handler
@@ -771,12 +762,10 @@ acpi_ev_install_handler (
******************************************************************************/
acpi_status
acpi_ev_install_space_handler (
struct acpi_namespace_node *node,
acpi_ev_install_space_handler(struct acpi_namespace_node * node,
acpi_adr_space_type space_id,
acpi_adr_space_handler handler,
acpi_adr_space_setup setup,
void *context)
acpi_adr_space_setup setup, void *context)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *handler_obj;
@@ -784,10 +773,8 @@ acpi_ev_install_space_handler (
acpi_object_type type;
u16 flags = 0;
ACPI_FUNCTION_TRACE("ev_install_space_handler");
/*
* This registration is valid for only the types below
* and the root. This is where the default handlers
@@ -795,8 +782,7 @@ acpi_ev_install_space_handler (
*/
if ((node->type != ACPI_TYPE_DEVICE) &&
(node->type != ACPI_TYPE_PROCESSOR) &&
(node->type != ACPI_TYPE_THERMAL) &&
(node != acpi_gbl_root_node)) {
(node->type != ACPI_TYPE_THERMAL) && (node != acpi_gbl_root_node)) {
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
@@ -863,7 +849,8 @@ acpi_ev_install_space_handler (
/* Same space_id indicates a handler already installed */
if (handler_obj->address_space.space_id == space_id) {
if (handler_obj->address_space.handler == handler) {
if (handler_obj->address_space.handler ==
handler) {
/*
* It is (relatively) OK to attempt to install the SAME
* handler twice. This can easily happen
@@ -871,8 +858,7 @@ acpi_ev_install_space_handler (
*/
status = AE_SAME_HANDLER;
goto unlock_and_exit;
}
else {
} else {
/* A handler is already installed */
status = AE_ALREADY_EXISTS;
@@ -884,17 +870,16 @@ acpi_ev_install_space_handler (
handler_obj = handler_obj->address_space.next;
}
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Creating object on Device %p while installing handler\n", node));
"Creating object on Device %p while installing handler\n",
node));
/* obj_desc does not exist, create one */
if (node->type == ACPI_TYPE_ANY) {
type = ACPI_TYPE_DEVICE;
}
else {
} else {
type = node->type;
}
@@ -933,7 +918,8 @@ acpi_ev_install_space_handler (
* Just allocate the object for the handler and link it
* into the list.
*/
handler_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
handler_obj =
acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_ADDRESS_HANDLER);
if (!handler_obj) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
@@ -972,14 +958,14 @@ acpi_ev_install_space_handler (
* of the branch
*/
status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
ACPI_NS_WALK_UNLOCK, acpi_ev_install_handler,
handler_obj, NULL);
ACPI_NS_WALK_UNLOCK,
acpi_ev_install_handler, handler_obj,
NULL);
unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_execute_reg_methods
@@ -995,16 +981,13 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_ev_execute_reg_methods (
struct acpi_namespace_node *node,
acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
acpi_adr_space_type space_id)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_execute_reg_methods");
/*
* Run all _REG methods for all Operation Regions for this
* space ID. This is a separate walk in order to handle any
@@ -1019,7 +1002,6 @@ acpi_ev_execute_reg_methods (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_reg_run
@@ -1031,18 +1013,14 @@ acpi_ev_execute_reg_methods (
******************************************************************************/
static acpi_status
acpi_ev_reg_run (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ev_reg_run(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
union acpi_operand_object *obj_desc;
struct acpi_namespace_node *node;
acpi_adr_space_type space_id;
acpi_status status;
space_id = *ACPI_CAST_PTR(acpi_adr_space_type, context);
/* Convert and validate the device handle */
@@ -1056,8 +1034,7 @@ acpi_ev_reg_run (
* We only care about regions.and objects
* that are allowed to have address space handlers
*/
if ((node->type != ACPI_TYPE_REGION) &&
(node != acpi_gbl_root_node)) {
if ((node->type != ACPI_TYPE_REGION) && (node != acpi_gbl_root_node)) {
return (AE_OK);
}
@@ -1083,4 +1060,3 @@ acpi_ev_reg_run (
status = acpi_ev_execute_reg_method(obj_desc, 1);
return (status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acevents.h>
#include <acpi/acnamesp.h>
@@ -49,7 +48,6 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evrgnini")
/*******************************************************************************
*
* FUNCTION: acpi_ev_system_memory_region_setup
@@ -64,21 +62,17 @@
* DESCRIPTION: Setup a system_memory operation region
*
******************************************************************************/
acpi_status
acpi_ev_system_memory_region_setup (
acpi_handle handle,
acpi_ev_system_memory_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context)
void *handler_context, void **region_context)
{
union acpi_operand_object *region_desc = (union acpi_operand_object *) handle;
union acpi_operand_object *region_desc =
(union acpi_operand_object *)handle;
struct acpi_mem_space_context *local_region_context;
ACPI_FUNCTION_TRACE("ev_system_memory_region_setup");
if (function == ACPI_REGION_DEACTIVATE) {
if (*region_context) {
ACPI_MEM_FREE(*region_context);
@@ -89,7 +83,8 @@ acpi_ev_system_memory_region_setup (
/* Create a new context */
local_region_context = ACPI_MEM_CALLOCATE (sizeof (struct acpi_mem_space_context));
local_region_context =
ACPI_MEM_CALLOCATE(sizeof(struct acpi_mem_space_context));
if (!(local_region_context)) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -103,7 +98,6 @@ acpi_ev_system_memory_region_setup (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_io_space_region_setup
@@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup (
******************************************************************************/
acpi_status
acpi_ev_io_space_region_setup (
acpi_handle handle,
acpi_ev_io_space_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context)
void *handler_context, void **region_context)
{
ACPI_FUNCTION_TRACE("ev_io_space_region_setup");
if (function == ACPI_REGION_DEACTIVATE) {
*region_context = NULL;
}
else {
} else {
*region_context = handler_context;
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_pci_config_region_setup
@@ -158,11 +147,9 @@ acpi_ev_io_space_region_setup (
******************************************************************************/
acpi_status
acpi_ev_pci_config_region_setup (
acpi_handle handle,
acpi_ev_pci_config_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context)
void *handler_context, void **region_context)
{
acpi_status status = AE_OK;
acpi_integer pci_value;
@@ -170,13 +157,12 @@ acpi_ev_pci_config_region_setup (
union acpi_operand_object *handler_obj;
struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *pci_root_node;
union acpi_operand_object *region_obj = (union acpi_operand_object *) handle;
union acpi_operand_object *region_obj =
(union acpi_operand_object *)handle;
struct acpi_device_id object_hID;
ACPI_FUNCTION_TRACE("ev_pci_config_region_setup");
handler_obj = region_obj->region.handler;
if (!handler_obj) {
/*
@@ -184,7 +170,8 @@ acpi_ev_pci_config_region_setup (
* routine checks before we get here, but we check again just in case.
*/
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Attempting to init a region %p, with no handler\n", region_obj));
"Attempting to init a region %p, with no handler\n",
region_obj));
return_ACPI_STATUS(AE_NOT_EXIST);
}
@@ -216,21 +203,27 @@ acpi_ev_pci_config_region_setup (
pci_root_node = parent_node;
while (pci_root_node != acpi_gbl_root_node) {
status = acpi_ut_execute_HID (pci_root_node, &object_hID);
status =
acpi_ut_execute_HID(pci_root_node, &object_hID);
if (ACPI_SUCCESS(status)) {
/*
* Got a valid _HID string, check if this is a PCI root.
* New for ACPI 3.0: check for a PCI Express root also.
*/
if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
sizeof (PCI_ROOT_HID_STRING)) ||
!(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING,
sizeof (PCI_EXPRESS_ROOT_HID_STRING))))) {
if (!
(ACPI_STRNCMP
(object_hID.value, PCI_ROOT_HID_STRING,
sizeof(PCI_ROOT_HID_STRING))
||
!(ACPI_STRNCMP
(object_hID.value,
PCI_EXPRESS_ROOT_HID_STRING,
sizeof(PCI_EXPRESS_ROOT_HID_STRING)))))
{
/* Install a handler for this PCI root bridge */
status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_DEFAULT_HANDLER, NULL, NULL);
status =
acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE(status)) {
if (status == AE_SAME_HANDLER) {
/*
@@ -239,11 +232,8 @@ acpi_ev_pci_config_region_setup (
* new PCI_Config operation region, however.
*/
status = AE_OK;
}
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)));
} 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)));
}
}
break;
@@ -254,8 +244,7 @@ acpi_ev_pci_config_region_setup (
}
/* PCI root bridge not found, use namespace root node */
}
else {
} else {
pci_root_node = handler_obj->address_space.node;
}
@@ -283,7 +272,9 @@ acpi_ev_pci_config_region_setup (
* Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
*/
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, parent_node, &pci_value);
status =
acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, parent_node,
&pci_value);
/*
* The default is zero, and since the allocation above zeroed
@@ -296,14 +287,18 @@ acpi_ev_pci_config_region_setup (
/* The PCI segment number comes from the _SEG method */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value);
status =
acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node,
&pci_value);
if (ACPI_SUCCESS(status)) {
pci_id->segment = ACPI_LOWORD(pci_value);
}
/* The PCI bus number comes from the _BBN method */
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value);
status =
acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node,
&pci_value);
if (ACPI_SUCCESS(status)) {
pci_id->bus = ACPI_LOWORD(pci_value);
}
@@ -316,7 +311,6 @@ acpi_ev_pci_config_region_setup (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_pci_bar_region_setup
@@ -335,19 +329,15 @@ acpi_ev_pci_config_region_setup (
******************************************************************************/
acpi_status
acpi_ev_pci_bar_region_setup (
acpi_handle handle,
acpi_ev_pci_bar_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context)
void *handler_context, void **region_context)
{
ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_cmos_region_setup
@@ -366,19 +356,15 @@ acpi_ev_pci_bar_region_setup (
******************************************************************************/
acpi_status
acpi_ev_cmos_region_setup (
acpi_handle handle,
acpi_ev_cmos_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context)
void *handler_context, void **region_context)
{
ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_default_region_setup
@@ -395,26 +381,21 @@ acpi_ev_cmos_region_setup (
******************************************************************************/
acpi_status
acpi_ev_default_region_setup (
acpi_handle handle,
acpi_ev_default_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context)
void *handler_context, void **region_context)
{
ACPI_FUNCTION_TRACE("ev_default_region_setup");
if (function == ACPI_REGION_DEACTIVATE) {
*region_context = NULL;
}
else {
} else {
*region_context = handler_context;
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_initialize_region
@@ -438,8 +419,7 @@ acpi_ev_default_region_setup (
******************************************************************************/
acpi_status
acpi_ev_initialize_region (
union acpi_operand_object *region_obj,
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
u8 acpi_ns_locked)
{
union acpi_operand_object *handler_obj;
@@ -451,10 +431,8 @@ acpi_ev_initialize_region (
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
union acpi_operand_object *region_obj2;
ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked);
if (!region_obj) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -527,14 +505,19 @@ acpi_ev_initialize_region (
while (handler_obj) {
/* Is this handler of the correct type? */
if (handler_obj->address_space.space_id == space_id) {
if (handler_obj->address_space.space_id ==
space_id) {
/* Found correct handler */
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Found handler %p for region %p in obj %p\n",
handler_obj, region_obj, obj_desc));
handler_obj,
region_obj,
obj_desc));
status = acpi_ev_attach_region (handler_obj, region_obj,
status =
acpi_ev_attach_region(handler_obj,
region_obj,
acpi_ns_locked);
/*
@@ -542,18 +525,26 @@ acpi_ev_initialize_region (
* method
*/
if (acpi_ns_locked) {
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
status =
acpi_ut_release_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS (status);
return_ACPI_STATUS
(status);
}
}
status = acpi_ev_execute_reg_method (region_obj, 1);
status =
acpi_ev_execute_reg_method
(region_obj, 1);
if (acpi_ns_locked) {
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
status =
acpi_ut_acquire_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS (status);
return_ACPI_STATUS
(status);
}
}
@@ -577,8 +568,8 @@ acpi_ev_initialize_region (
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"No handler for region_type %s(%X) (region_obj %p)\n",
acpi_ut_get_region_name (space_id), space_id, region_obj));
acpi_ut_get_region_name(space_id), space_id,
region_obj));
return_ACPI_STATUS(AE_NOT_EXIST);
}

View File

@@ -45,16 +45,11 @@
#include <acpi/acpi.h>
#include <acpi/acevents.h>
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evsci")
/* Local prototypes */
static u32 ACPI_SYSTEM_XFACE
acpi_ev_sci_xrupt_handler (
void *context);
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context);
/*******************************************************************************
*
@@ -69,17 +64,13 @@ acpi_ev_sci_xrupt_handler (
*
******************************************************************************/
static u32 ACPI_SYSTEM_XFACE
acpi_ev_sci_xrupt_handler (
void *context)
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
{
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
/*
* We are guaranteed by the ACPI CA initialization/shutdown code that
* if this interrupt handler is installed, ACPI is enabled.
@@ -100,7 +91,6 @@ acpi_ev_sci_xrupt_handler (
return_VALUE(interrupt_handled);
}
/*******************************************************************************
*
* FUNCTION: acpi_ev_gpe_xrupt_handler
@@ -113,17 +103,13 @@ acpi_ev_sci_xrupt_handler (
*
******************************************************************************/
u32 ACPI_SYSTEM_XFACE
acpi_ev_gpe_xrupt_handler (
void *context)
u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
{
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
/*
* We are guaranteed by the ACPI CA initialization/shutdown code that
* if this interrupt handler is installed, ACPI is enabled.
@@ -138,7 +124,6 @@ acpi_ev_gpe_xrupt_handler (
return_VALUE(interrupt_handled);
}
/******************************************************************************
*
* FUNCTION: acpi_ev_install_sci_handler
@@ -151,22 +136,18 @@ acpi_ev_gpe_xrupt_handler (
*
******************************************************************************/
u32
acpi_ev_install_sci_handler (
void)
u32 acpi_ev_install_sci_handler(void)
{
u32 status = AE_OK;
ACPI_FUNCTION_TRACE("ev_install_sci_handler");
status = acpi_os_install_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head);
acpi_ev_sci_xrupt_handler,
acpi_gbl_gpe_xrupt_list_head);
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_ev_remove_sci_handler
@@ -186,16 +167,12 @@ acpi_ev_install_sci_handler (
*
******************************************************************************/
acpi_status
acpi_ev_remove_sci_handler (
void)
acpi_status acpi_ev_remove_sci_handler(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ev_remove_sci_handler");
/* Just let the OS remove the handler and disable the level */
status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
@@ -203,5 +180,3 @@ acpi_ev_remove_sci_handler (
return_ACPI_STATUS(status);
}

View File

@@ -51,7 +51,6 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evxface")
/*******************************************************************************
*
* FUNCTION: acpi_install_exception_handler
@@ -64,18 +63,13 @@
* DESCRIPTION: Saves the pointer to the handler function
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_install_exception_handler (
acpi_exception_handler handler)
acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
{
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -98,7 +92,6 @@ cleanup:
}
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_install_fixed_event_handler
@@ -116,17 +109,13 @@ cleanup:
******************************************************************************/
acpi_status
acpi_install_fixed_event_handler (
u32 event,
acpi_event_handler handler,
void *context)
acpi_install_fixed_event_handler(u32 event,
acpi_event_handler handler, void *context)
{
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
/* Parameter validation */
if (event > ACPI_EVENT_MAX) {
@@ -154,25 +143,25 @@ acpi_install_fixed_event_handler (
if (ACPI_SUCCESS(status))
status = acpi_enable_event(event, 0);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Could not enable fixed event.\n"));
/* Remove the handler */
acpi_gbl_fixed_event_handlers[event].handler = NULL;
acpi_gbl_fixed_event_handlers[event].context = NULL;
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Enabled fixed event %X, Handler=%p\n", event, handler));
"Enabled fixed event %X, Handler=%p\n", event,
handler));
}
cleanup:
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_install_fixed_event_handler);
EXPORT_SYMBOL(acpi_install_fixed_event_handler);
/*******************************************************************************
*
@@ -188,16 +177,12 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
******************************************************************************/
acpi_status
acpi_remove_fixed_event_handler (
u32 event,
acpi_event_handler handler)
acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
/* Parameter validation */
if (event > ACPI_EVENT_MAX) {
@@ -221,16 +206,16 @@ acpi_remove_fixed_event_handler (
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Could not write to fixed event enable register.\n"));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n",
event));
}
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
/*******************************************************************************
*
@@ -251,26 +236,21 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
******************************************************************************/
acpi_status
acpi_install_notify_handler (
acpi_handle device,
acpi_install_notify_handler(acpi_handle device,
u32 handler_type,
acpi_notify_handler handler,
void *context)
acpi_notify_handler handler, void *context)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *notify_obj;
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
/* Parameter validation */
if ((!device) ||
(!handler) ||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -345,8 +325,7 @@ acpi_install_notify_handler (
status = AE_ALREADY_EXISTS;
goto unlock_and_exit;
}
}
else {
} else {
/* Create a new object */
obj_desc = acpi_ut_create_internal_object(node->type);
@@ -357,7 +336,8 @@ acpi_install_notify_handler (
/* Attach new object to the Node */
status = acpi_ns_attach_object (device, obj_desc, node->type);
status =
acpi_ns_attach_object(device, obj_desc, node->type);
/* Remove local reference to the object */
@@ -369,7 +349,8 @@ acpi_install_notify_handler (
/* Install the handler */
notify_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_NOTIFY);
notify_obj =
acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_NOTIFY);
if (!notify_obj) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
@@ -394,13 +375,12 @@ acpi_install_notify_handler (
}
}
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_install_notify_handler);
EXPORT_SYMBOL(acpi_install_notify_handler);
/*******************************************************************************
*
@@ -420,25 +400,20 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
******************************************************************************/
acpi_status
acpi_remove_notify_handler (
acpi_handle device,
u32 handler_type,
acpi_notify_handler handler)
acpi_remove_notify_handler(acpi_handle device,
u32 handler_type, acpi_notify_handler handler)
{
union acpi_operand_object *notify_obj;
union acpi_operand_object *obj_desc;
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
/* Parameter validation */
if ((!device) ||
(!handler) ||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -554,13 +529,12 @@ acpi_remove_notify_handler (
}
}
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_remove_notify_handler);
EXPORT_SYMBOL(acpi_remove_notify_handler);
/*******************************************************************************
*
@@ -581,22 +555,17 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
******************************************************************************/
acpi_status
acpi_install_gpe_handler (
acpi_handle gpe_device,
acpi_install_gpe_handler(acpi_handle gpe_device,
u32 gpe_number,
u32 type,
acpi_event_handler address,
void *context)
u32 type, acpi_event_handler address, void *context)
{
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
/* Parameter validation */
if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
@@ -618,7 +587,8 @@ acpi_install_gpe_handler (
/* Make sure that there isn't a handler there already */
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) {
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_HANDLER) {
status = AE_ALREADY_EXISTS;
goto unlock_and_exit;
}
@@ -654,13 +624,12 @@ acpi_install_gpe_handler (
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_install_gpe_handler);
EXPORT_SYMBOL(acpi_install_gpe_handler);
/*******************************************************************************
*
@@ -678,20 +647,16 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
******************************************************************************/
acpi_status
acpi_remove_gpe_handler (
acpi_handle gpe_device,
u32 gpe_number,
acpi_event_handler address)
acpi_remove_gpe_handler(acpi_handle gpe_device,
u32 gpe_number, acpi_event_handler address)
{
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_handler_info *handler;
acpi_status status;
u32 flags;
ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
/* Parameter validation */
if (!address) {
@@ -713,7 +678,8 @@ acpi_remove_gpe_handler (
/* Make sure that a handler is indeed installed */
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) != ACPI_GPE_DISPATCH_HANDLER) {
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) !=
ACPI_GPE_DISPATCH_HANDLER) {
status = AE_NOT_EXIST;
goto unlock_and_exit;
}
@@ -759,13 +725,12 @@ acpi_remove_gpe_handler (
ACPI_MEM_FREE(handler);
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_remove_gpe_handler);
EXPORT_SYMBOL(acpi_remove_gpe_handler);
/*******************************************************************************
*
@@ -781,14 +746,10 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
*
******************************************************************************/
acpi_status
acpi_acquire_global_lock (
u16 timeout,
u32 *handle)
acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
{
acpi_status status;
if (!handle) {
return (AE_BAD_PARAMETER);
}
@@ -808,8 +769,8 @@ acpi_acquire_global_lock (
return (status);
}
EXPORT_SYMBOL(acpi_acquire_global_lock);
EXPORT_SYMBOL(acpi_acquire_global_lock);
/*******************************************************************************
*
@@ -823,13 +784,10 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
*
******************************************************************************/
acpi_status
acpi_release_global_lock (
u32 handle)
acpi_status acpi_release_global_lock(u32 handle)
{
acpi_status status;
if (handle != acpi_gbl_global_lock_handle) {
return (AE_NOT_ACQUIRED);
}
@@ -837,5 +795,5 @@ acpi_release_global_lock (
status = acpi_ev_release_global_lock();
return (status);
}
EXPORT_SYMBOL(acpi_release_global_lock);
EXPORT_SYMBOL(acpi_release_global_lock);

View File

@@ -50,7 +50,6 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evxfevnt")
/*******************************************************************************
*
* FUNCTION: acpi_enable
@@ -62,28 +61,24 @@
* DESCRIPTION: Transfers the system into ACPI mode.
*
******************************************************************************/
acpi_status
acpi_enable (
void)
acpi_status acpi_enable(void)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_enable");
/* Make sure we have the FADT */
if (!acpi_gbl_FADT) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"No FADT information present!\n"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
}
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
}
else {
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"System is already in ACPI mode\n"));
} else {
/* Transition to ACPI mode */
status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
@@ -99,7 +94,6 @@ acpi_enable (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_disable
@@ -112,26 +106,22 @@ acpi_enable (
*
******************************************************************************/
acpi_status
acpi_disable (
void)
acpi_status acpi_disable(void)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_disable");
if (!acpi_gbl_FADT) {
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"No FADT information present!\n"));
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
}
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
"System is already in legacy (non-ACPI) mode\n"));
}
else {
} else {
/* Transition to LEGACY mode */
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
@@ -148,7 +138,6 @@ acpi_disable (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_enable_event
@@ -162,18 +151,13 @@ acpi_disable (
*
******************************************************************************/
acpi_status
acpi_enable_event (
u32 event,
u32 flags)
acpi_status acpi_enable_event(u32 event, u32 flags)
{
acpi_status status = AE_OK;
u32 value;
ACPI_FUNCTION_TRACE("acpi_enable_event");
/* Decode the Fixed Event */
if (event > ACPI_EVENT_MAX) {
@@ -184,30 +168,33 @@ acpi_enable_event (
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
1, ACPI_MTX_LOCK);
status =
acpi_set_register(acpi_gbl_fixed_event_info[event].
enable_register_id, 1, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
/* Make sure that the hardware responded */
status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
&value, ACPI_MTX_LOCK);
status =
acpi_get_register(acpi_gbl_fixed_event_info[event].
enable_register_id, &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (value != 1) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not enable %s event\n", acpi_ut_get_event_name (event)));
"Could not enable %s event\n",
acpi_ut_get_event_name(event)));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_enable_event);
EXPORT_SYMBOL(acpi_enable_event);
/*******************************************************************************
*
@@ -223,19 +210,13 @@ EXPORT_SYMBOL(acpi_enable_event);
*
******************************************************************************/
acpi_status
acpi_set_gpe_type (
acpi_handle gpe_device,
u32 gpe_number,
u8 type)
acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
{
acpi_status status = AE_OK;
struct acpi_gpe_event_info *gpe_event_info;
ACPI_FUNCTION_TRACE("acpi_set_gpe_type");
/* Ensure that we have a valid GPE number */
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
@@ -255,8 +236,8 @@ acpi_set_gpe_type (
unlock_and_exit:
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_set_gpe_type);
EXPORT_SYMBOL(acpi_set_gpe_type);
/*******************************************************************************
*
@@ -273,19 +254,13 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
*
******************************************************************************/
acpi_status
acpi_enable_gpe (
acpi_handle gpe_device,
u32 gpe_number,
u32 flags)
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
{
acpi_status status = AE_OK;
struct acpi_gpe_event_info *gpe_event_info;
ACPI_FUNCTION_TRACE("acpi_enable_gpe");
/* Use semaphore lock if not executing at interrupt level */
if (flags & ACPI_NOT_ISR) {
@@ -313,8 +288,8 @@ unlock_and_exit:
}
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_enable_gpe);
EXPORT_SYMBOL(acpi_enable_gpe);
/*******************************************************************************
*
@@ -331,19 +306,13 @@ EXPORT_SYMBOL(acpi_enable_gpe);
*
******************************************************************************/
acpi_status
acpi_disable_gpe (
acpi_handle gpe_device,
u32 gpe_number,
u32 flags)
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
{
acpi_status status = AE_OK;
struct acpi_gpe_event_info *gpe_event_info;
ACPI_FUNCTION_TRACE("acpi_disable_gpe");
/* Use semaphore lock if not executing at interrupt level */
if (flags & ACPI_NOT_ISR) {
@@ -370,7 +339,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_disable_event
@@ -384,18 +352,13 @@ unlock_and_exit:
*
******************************************************************************/
acpi_status
acpi_disable_event (
u32 event,
u32 flags)
acpi_status acpi_disable_event(u32 event, u32 flags)
{
acpi_status status = AE_OK;
u32 value;
ACPI_FUNCTION_TRACE("acpi_disable_event");
/* Decode the Fixed Event */
if (event > ACPI_EVENT_MAX) {
@@ -406,28 +369,31 @@ acpi_disable_event (
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
0, ACPI_MTX_LOCK);
status =
acpi_set_register(acpi_gbl_fixed_event_info[event].
enable_register_id, 0, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
&value, ACPI_MTX_LOCK);
status =
acpi_get_register(acpi_gbl_fixed_event_info[event].
enable_register_id, &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
if (value != 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not disable %s events\n", acpi_ut_get_event_name (event)));
"Could not disable %s events\n",
acpi_ut_get_event_name(event)));
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_disable_event);
EXPORT_SYMBOL(acpi_disable_event);
/*******************************************************************************
*
@@ -441,16 +407,12 @@ EXPORT_SYMBOL(acpi_disable_event);
*
******************************************************************************/
acpi_status
acpi_clear_event (
u32 event)
acpi_status acpi_clear_event(u32 event)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_clear_event");
/* Decode the Fixed Event */
if (event > ACPI_EVENT_MAX) {
@@ -461,13 +423,14 @@ acpi_clear_event (
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
1, ACPI_MTX_LOCK);
status =
acpi_set_register(acpi_gbl_fixed_event_info[event].
status_register_id, 1, ACPI_MTX_LOCK);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_clear_event);
EXPORT_SYMBOL(acpi_clear_event);
/*******************************************************************************
*
@@ -483,19 +446,13 @@ EXPORT_SYMBOL(acpi_clear_event);
*
******************************************************************************/
acpi_status
acpi_clear_gpe (
acpi_handle gpe_device,
u32 gpe_number,
u32 flags)
acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
{
acpi_status status = AE_OK;
struct acpi_gpe_event_info *gpe_event_info;
ACPI_FUNCTION_TRACE("acpi_clear_gpe");
/* Use semaphore lock if not executing at interrupt level */
if (flags & ACPI_NOT_ISR) {
@@ -522,7 +479,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
@@ -538,17 +494,12 @@ unlock_and_exit:
*
******************************************************************************/
acpi_status
acpi_get_event_status (
u32 event,
acpi_event_status *event_status)
acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("acpi_get_event_status");
if (!event_status) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -561,13 +512,13 @@ acpi_get_event_status (
/* Get the status of the requested fixed event */
status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
event_status, ACPI_MTX_LOCK);
status =
acpi_get_register(acpi_gbl_fixed_event_info[event].
status_register_id, event_status, ACPI_MTX_LOCK);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_get_gpe_status
@@ -585,19 +536,14 @@ acpi_get_event_status (
******************************************************************************/
acpi_status
acpi_get_gpe_status (
acpi_handle gpe_device,
u32 gpe_number,
u32 flags,
acpi_event_status *event_status)
acpi_get_gpe_status(acpi_handle gpe_device,
u32 gpe_number, u32 flags, acpi_event_status * event_status)
{
acpi_status status = AE_OK;
struct acpi_gpe_event_info *gpe_event_info;
ACPI_FUNCTION_TRACE("acpi_get_gpe_status");
/* Use semaphore lock if not executing at interrupt level */
if (flags & ACPI_NOT_ISR) {
@@ -627,7 +573,6 @@ unlock_and_exit:
}
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_install_gpe_block
@@ -644,24 +589,18 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_install_gpe_block (
acpi_handle gpe_device,
acpi_install_gpe_block(acpi_handle gpe_device,
struct acpi_generic_address *gpe_block_address,
u32 register_count,
u32 interrupt_number)
u32 register_count, u32 interrupt_number)
{
acpi_status status;
union acpi_operand_object *obj_desc;
struct acpi_namespace_node *node;
struct acpi_gpe_block_info *gpe_block;
ACPI_FUNCTION_TRACE("acpi_install_gpe_block");
if ((!gpe_device) ||
(!gpe_block_address) ||
(!register_count)) {
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -680,8 +619,9 @@ acpi_install_gpe_block (
* For user-installed GPE Block Devices, the gpe_block_base_number
* is always zero
*/
status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
0, interrupt_number, &gpe_block);
status =
acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
interrupt_number, &gpe_block);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
@@ -698,7 +638,8 @@ acpi_install_gpe_block (
goto unlock_and_exit;
}
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_DEVICE);
status =
acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_DEVICE);
/* Remove local reference to the object */
@@ -713,13 +654,12 @@ acpi_install_gpe_block (
obj_desc->device.gpe_block = gpe_block;
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_install_gpe_block);
EXPORT_SYMBOL(acpi_install_gpe_block);
/*******************************************************************************
*
@@ -733,18 +673,14 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
*
******************************************************************************/
acpi_status
acpi_remove_gpe_block (
acpi_handle gpe_device)
acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
{
union acpi_operand_object *obj_desc;
acpi_status status;
struct acpi_namespace_node *node;
ACPI_FUNCTION_TRACE("acpi_remove_gpe_block");
if (!gpe_device) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -763,8 +699,7 @@ acpi_remove_gpe_block (
/* Get the device_object attached to the node */
obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc ||
!obj_desc->device.gpe_block) {
if (!obj_desc || !obj_desc->device.gpe_block) {
return_ACPI_STATUS(AE_NULL_OBJECT);
}

View File

@@ -51,7 +51,6 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME("evxfregn")
/*******************************************************************************
*
* FUNCTION: acpi_install_address_space_handler
@@ -67,22 +66,17 @@
* DESCRIPTION: Install a handler for all op_regions of a given space_id.
*
******************************************************************************/
acpi_status
acpi_install_address_space_handler (
acpi_handle device,
acpi_install_address_space_handler(acpi_handle device,
acpi_adr_space_type space_id,
acpi_adr_space_handler handler,
acpi_adr_space_setup setup,
void *context)
acpi_adr_space_setup setup, void *context)
{
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
/* Parameter validation */
if (!device) {
@@ -104,7 +98,9 @@ acpi_install_address_space_handler (
/* Install the handler for all Regions for this Space ID */
status = acpi_ev_install_space_handler (node, space_id, handler, setup, context);
status =
acpi_ev_install_space_handler(node, space_id, handler, setup,
context);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
@@ -117,8 +113,8 @@ unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_install_address_space_handler);
EXPORT_SYMBOL(acpi_install_address_space_handler);
/*******************************************************************************
*
@@ -135,8 +131,7 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
******************************************************************************/
acpi_status
acpi_remove_address_space_handler (
acpi_handle device,
acpi_remove_address_space_handler(acpi_handle device,
acpi_adr_space_type space_id,
acpi_adr_space_handler handler)
{
@@ -147,10 +142,8 @@ acpi_remove_address_space_handler (
struct acpi_namespace_node *node;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
/* Parameter validation */
if (!device) {
@@ -190,7 +183,8 @@ acpi_remove_address_space_handler (
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
handler_obj, handler, acpi_ut_get_region_name (space_id),
handler_obj, handler,
acpi_ut_get_region_name(space_id),
node, obj_desc));
region_obj = handler_obj->address_space.region_list;
@@ -211,7 +205,8 @@ acpi_remove_address_space_handler (
* Walk the list: Just grab the head because the
* detach_region removed the previous head.
*/
region_obj = handler_obj->address_space.region_list;
region_obj =
handler_obj->address_space.region_list;
}
@@ -235,7 +230,8 @@ acpi_remove_address_space_handler (
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
handler, acpi_ut_get_region_name (space_id), space_id, node, obj_desc));
handler, acpi_ut_get_region_name(space_id), space_id,
node, obj_desc));
status = AE_NOT_EXIST;
@@ -243,5 +239,5 @@ unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_remove_address_space_handler);
EXPORT_SYMBOL(acpi_remove_address_space_handler);

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
@@ -50,19 +49,15 @@
#include <acpi/actables.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exconfig")
/* Local prototypes */
static acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
acpi_ex_add_table(struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
union acpi_operand_object **ddb_handle);
/*******************************************************************************
*
* FUNCTION: acpi_ex_add_table
@@ -79,8 +74,7 @@ acpi_ex_add_table (
******************************************************************************/
static acpi_status
acpi_ex_add_table (
struct acpi_table_header *table,
acpi_ex_add_table(struct acpi_table_header *table,
struct acpi_namespace_node *parent_node,
union acpi_operand_object **ddb_handle)
{
@@ -88,10 +82,8 @@ acpi_ex_add_table (
struct acpi_table_desc table_info;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE("ex_add_table");
/* Create an object to be the table handle */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
@@ -137,14 +129,12 @@ acpi_ex_add_table (
return_ACPI_STATUS(AE_OK);
cleanup:
acpi_ut_remove_reference(obj_desc);
*ddb_handle = NULL;
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_load_table_op
@@ -159,8 +149,7 @@ cleanup:
******************************************************************************/
acpi_status
acpi_ex_load_table_op (
struct acpi_walk_state *walk_state,
acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
union acpi_operand_object **return_desc)
{
acpi_status status;
@@ -171,10 +160,8 @@ acpi_ex_load_table_op (
struct acpi_namespace_node *parameter_node = NULL;
union acpi_operand_object *ddb_handle;
ACPI_FUNCTION_TRACE("ex_load_table_op");
#if 0
/*
* Make sure that the signature does not match one of the tables that
@@ -223,8 +210,10 @@ acpi_ex_load_table_op (
* Find the node referenced by the root_path_string. This is the
* location within the namespace where the table will be loaded.
*/
status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node,
ACPI_NS_SEARCH_PARENT, &parent_node);
status =
acpi_ns_get_node_by_path(operand[3]->string.pointer,
start_node, ACPI_NS_SEARCH_PARENT,
&parent_node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -244,8 +233,10 @@ acpi_ex_load_table_op (
/* Find the node referenced by the parameter_path_string */
status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
ACPI_NS_SEARCH_PARENT, &parameter_node);
status =
acpi_ns_get_node_by_path(operand[4]->string.pointer,
start_node, ACPI_NS_SEARCH_PARENT,
&parameter_node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -264,7 +255,8 @@ acpi_ex_load_table_op (
/* Store the parameter data into the optional parameter object */
status = acpi_ex_store(operand[5],
ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
ACPI_CAST_PTR(union acpi_operand_object,
parameter_node),
walk_state);
if (ACPI_FAILURE(status)) {
(void)acpi_ex_unload_table(ddb_handle);
@@ -276,7 +268,6 @@ acpi_ex_load_table_op (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_load_op
@@ -293,8 +284,7 @@ acpi_ex_load_table_op (
******************************************************************************/
acpi_status
acpi_ex_load_op (
union acpi_operand_object *obj_desc,
acpi_ex_load_op(union acpi_operand_object *obj_desc,
union acpi_operand_object *target,
struct acpi_walk_state *walk_state)
{
@@ -308,14 +298,14 @@ acpi_ex_load_op (
ACPI_FUNCTION_TRACE("ex_load_op");
/* Object can be either an op_region or a Field */
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_REGION:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Region %p %s\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc)));
obj_desc,
acpi_ut_get_object_type_name(obj_desc)));
/*
* If the Region Address and Length have not been previously evaluated,
@@ -336,9 +326,12 @@ acpi_ex_load_op (
table_header.length = 0;
for (i = 0; i < 8; i++) {
status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
(acpi_physical_address) (i + address), 8,
((u8 *) &table_header) + i);
status =
acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
(acpi_physical_address)
(i + address), 8,
((u8 *) &
table_header) + i);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -360,29 +353,34 @@ acpi_ex_load_op (
/* Get the entire table from the op region */
for (i = 0; i < table_header.length; i++) {
status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
(acpi_physical_address) (i + address), 8,
((u8 *) table_ptr + i));
status =
acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
(acpi_physical_address)
(i + address), 8,
((u8 *) table_ptr +
i));
if (ACPI_FAILURE(status)) {
goto cleanup;
}
}
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Load from Field %p %s\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc)));
obj_desc,
acpi_ut_get_object_type_name(obj_desc)));
/*
* The length of the field must be at least as large as the table.
* Read the entire field and thus the entire table. Buffer is
* allocated during the read.
*/
status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
status =
acpi_ex_read_data_from_field(walk_state, obj_desc,
&buffer_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -403,7 +401,6 @@ acpi_ex_load_op (
}
break;
default:
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -450,7 +447,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_unload_table
@@ -463,18 +459,14 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_unload_table (
union acpi_operand_object *ddb_handle)
acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
{
acpi_status status = AE_OK;
union acpi_operand_object *table_desc = ddb_handle;
struct acpi_table_desc *table_info;
ACPI_FUNCTION_TRACE("ex_unload_table");
/*
* Validate the handle
* Although the handle is partially validated in acpi_ex_reconfiguration(),
@@ -507,4 +499,3 @@ acpi_ex_unload_table (
acpi_ut_remove_reference(table_desc);
return_ACPI_STATUS(status);
}

View File

@@ -41,24 +41,17 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exconvrt")
/* Local prototypes */
static u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u16 base,
u8 *string,
u8 max_length);
acpi_ex_convert_to_ascii(acpi_integer integer,
u16 base, u8 * string, u8 max_length);
/*******************************************************************************
*
@@ -76,10 +69,8 @@ acpi_ex_convert_to_ascii (
******************************************************************************/
acpi_status
acpi_ex_convert_to_integer (
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc,
u32 flags)
acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, u32 flags)
{
union acpi_operand_object *return_desc;
u8 *pointer;
@@ -88,10 +79,8 @@ acpi_ex_convert_to_integer (
u32 count;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_INTEGER:
@@ -141,7 +130,6 @@ acpi_ex_convert_to_integer (
}
break;
case ACPI_TYPE_BUFFER:
/* Check for zero-length buffer */
@@ -170,7 +158,6 @@ acpi_ex_convert_to_integer (
}
break;
default:
/* No other types can get here */
break;
@@ -191,7 +178,6 @@ acpi_ex_convert_to_integer (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_convert_to_buffer
@@ -207,17 +193,14 @@ acpi_ex_convert_to_integer (
******************************************************************************/
acpi_status
acpi_ex_convert_to_buffer (
union acpi_operand_object *obj_desc,
acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc)
{
union acpi_operand_object *return_desc;
u8 *new_buf;
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_BUFFER:
@@ -226,14 +209,14 @@ acpi_ex_convert_to_buffer (
*result_desc = obj_desc;
return_ACPI_STATUS(AE_OK);
case ACPI_TYPE_INTEGER:
/*
* Create a new Buffer object.
* Need enough space for one integer
*/
return_desc = acpi_ut_create_buffer_object (acpi_gbl_integer_byte_width);
return_desc =
acpi_ut_create_buffer_object(acpi_gbl_integer_byte_width);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -246,7 +229,6 @@ acpi_ex_convert_to_buffer (
acpi_gbl_integer_byte_width);
break;
case ACPI_TYPE_STRING:
/*
@@ -258,8 +240,9 @@ acpi_ex_convert_to_buffer (
* ASL/AML code that depends on the null being transferred to the new
* buffer.
*/
return_desc = acpi_ut_create_buffer_object (
(acpi_size) obj_desc->string.length + 1);
return_desc = acpi_ut_create_buffer_object((acpi_size)
obj_desc->string.
length + 1);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -271,7 +254,6 @@ acpi_ex_convert_to_buffer (
obj_desc->string.length);
break;
default:
return_ACPI_STATUS(AE_TYPE);
}
@@ -283,7 +265,6 @@ acpi_ex_convert_to_buffer (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_convert_to_ascii
@@ -300,11 +281,8 @@ acpi_ex_convert_to_buffer (
******************************************************************************/
static u32
acpi_ex_convert_to_ascii (
acpi_integer integer,
u16 base,
u8 *string,
u8 data_width)
acpi_ex_convert_to_ascii(acpi_integer integer,
u16 base, u8 * string, u8 data_width)
{
acpi_integer digit;
acpi_native_uint i;
@@ -315,10 +293,8 @@ acpi_ex_convert_to_ascii (
u32 remainder;
u8 supress_zeros;
ACPI_FUNCTION_ENTRY();
switch (base) {
case 10:
@@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii (
digit = integer;
for (j = 0; j < i; j++) {
(void) acpi_ut_short_divide (digit, 10, &digit, &remainder);
(void)acpi_ut_short_divide(digit, 10, &digit,
&remainder);
}
/* Handle leading zeros */
@@ -371,7 +348,9 @@ acpi_ex_convert_to_ascii (
for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
/* Get one hex digit, most significant digits first */
string[k] = (u8) acpi_ut_hex_to_ascii_char (integer, ACPI_MUL_4 (j));
string[k] =
(u8) acpi_ut_hex_to_ascii_char(integer,
ACPI_MUL_4(j));
k++;
}
break;
@@ -395,7 +374,6 @@ acpi_ex_convert_to_ascii (
return ((u32) k);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_convert_to_string
@@ -412,10 +390,8 @@ acpi_ex_convert_to_ascii (
******************************************************************************/
acpi_status
acpi_ex_convert_to_string (
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc,
u32 type)
acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
union acpi_operand_object ** result_desc, u32 type)
{
union acpi_operand_object *return_desc;
u8 *new_buf;
@@ -424,10 +400,8 @@ acpi_ex_convert_to_string (
u16 base = 16;
u8 separator = ',';
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc);
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
case ACPI_TYPE_STRING:
@@ -436,7 +410,6 @@ acpi_ex_convert_to_string (
*result_desc = obj_desc;
return_ACPI_STATUS(AE_OK);
case ACPI_TYPE_INTEGER:
switch (type) {
@@ -460,7 +433,8 @@ acpi_ex_convert_to_string (
* Create a new String
* Need enough space for one ASCII integer (plus null terminator)
*/
return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
return_desc =
acpi_ut_create_string_object((acpi_size) string_length);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -469,8 +443,10 @@ acpi_ex_convert_to_string (
/* Convert integer to string */
string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base,
new_buf, acpi_gbl_integer_byte_width);
string_length =
acpi_ex_convert_to_ascii(obj_desc->integer.value, base,
new_buf,
acpi_gbl_integer_byte_width);
/* Null terminate at the correct place */
@@ -478,7 +454,6 @@ acpi_ex_convert_to_string (
new_buf[string_length] = 0;
break;
case ACPI_TYPE_BUFFER:
/* Setup string length, base, and separator */
@@ -498,11 +473,9 @@ acpi_ex_convert_to_string (
for (i = 0; i < obj_desc->buffer.length; i++) {
if (obj_desc->buffer.pointer[i] >= 100) {
string_length += 4;
}
else if (obj_desc->buffer.pointer[i] >= 10) {
} else if (obj_desc->buffer.pointer[i] >= 10) {
string_length += 3;
}
else {
} else {
string_length += 2;
}
}
@@ -535,13 +508,14 @@ acpi_ex_convert_to_string (
* (-1 because of extra separator included in string_length from above)
*/
string_length--;
if (string_length > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */ {
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 = acpi_ut_create_string_object ((acpi_size) string_length);
return_desc =
acpi_ut_create_string_object((acpi_size) string_length);
if (!return_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -553,8 +527,9 @@ acpi_ex_convert_to_string (
* (separated by commas or spaces)
*/
for (i = 0; i < obj_desc->buffer.length; i++) {
new_buf += acpi_ex_convert_to_ascii (
(acpi_integer) obj_desc->buffer.pointer[i], base,
new_buf += acpi_ex_convert_to_ascii((acpi_integer)
obj_desc->buffer.
pointer[i], base,
new_buf, 1);
*new_buf++ = separator; /* each separated by a comma or space */
}
@@ -575,7 +550,6 @@ acpi_ex_convert_to_string (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_convert_to_target_type
@@ -592,18 +566,15 @@ acpi_ex_convert_to_string (
******************************************************************************/
acpi_status
acpi_ex_convert_to_target_type (
acpi_object_type destination_type,
acpi_ex_convert_to_target_type(acpi_object_type destination_type,
union acpi_operand_object *source_desc,
union acpi_operand_object **result_desc,
struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_convert_to_target_type");
/* Default behavior */
*result_desc = source_desc;
@@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type (
default:
/* No conversion allowed for these types */
if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) {
if (destination_type !=
ACPI_GET_OBJECT_TYPE(source_desc)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Explicit operator, will store (%s) over existing type (%s)\n",
acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_type_name (destination_type)));
acpi_ut_get_object_type_name
(source_desc),
acpi_ut_get_type_name
(destination_type)));
status = AE_TYPE;
}
}
break;
case ARGI_TARGETREF:
switch (destination_type) {
@@ -649,54 +622,54 @@ acpi_ex_convert_to_target_type (
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
status = acpi_ex_convert_to_integer (source_desc, result_desc,
status =
acpi_ex_convert_to_integer(source_desc, result_desc,
16);
break;
case ACPI_TYPE_STRING:
/*
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
*/
status = acpi_ex_convert_to_string (source_desc, result_desc,
status =
acpi_ex_convert_to_string(source_desc, result_desc,
ACPI_IMPLICIT_CONVERT_HEX);
break;
case ACPI_TYPE_BUFFER:
/*
* The operand must be a Buffer. We can convert an
* Integer or String if necessary
*/
status = acpi_ex_convert_to_buffer (source_desc, result_desc);
status =
acpi_ex_convert_to_buffer(source_desc, result_desc);
break;
default:
ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
destination_type));
ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type));
status = AE_AML_INTERNAL;
break;
}
break;
case ARGI_REFERENCE:
/*
* create_xxxx_field cases - we are storing the field object into the name
*/
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown Target type ID 0x%X Op %s dest_type %s\n",
GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args),
walk_state->op_info->name, acpi_ut_get_type_name (destination_type)));
GET_CURRENT_ARG_TYPE(walk_state->op_info->
runtime_args),
walk_state->op_info->name,
acpi_ut_get_type_name(destination_type)));
ACPI_REPORT_ERROR(("Bad Target Type (ARGI): %X\n",
GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)))
GET_CURRENT_ARG_TYPE(walk_state->op_info->
runtime_args)))
status = AE_AML_INTERNAL;
}
@@ -712,5 +685,3 @@ acpi_ex_convert_to_target_type (
return_ACPI_STATUS(status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
@@ -49,11 +48,9 @@
#include <acpi/acevents.h>
#include <acpi/actables.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("excreate")
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -66,19 +63,14 @@
* DESCRIPTION: Create a new named alias
*
******************************************************************************/
acpi_status
acpi_ex_create_alias (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state)
{
struct acpi_namespace_node *target_node;
struct acpi_namespace_node *alias_node;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_create_alias");
/* Get the source/alias operands (both namespace nodes) */
alias_node = (struct acpi_namespace_node *)walk_state->operands[0];
@@ -92,7 +84,9 @@ acpi_ex_create_alias (
* always exactly one level of indirection away from the
* actual aliased name.
*/
target_node = ACPI_CAST_PTR (struct acpi_namespace_node, target_node->object);
target_node =
ACPI_CAST_PTR(struct acpi_namespace_node,
target_node->object);
}
/*
@@ -115,7 +109,8 @@ acpi_ex_create_alias (
* types, the object can change dynamically via a Store.
*/
alias_node->type = ACPI_TYPE_LOCAL_ALIAS;
alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node);
alias_node->object =
ACPI_CAST_PTR(union acpi_operand_object, target_node);
break;
case ACPI_TYPE_METHOD:
@@ -126,7 +121,8 @@ acpi_ex_create_alias (
* types, the object can change dynamically via a Store.
*/
alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
alias_node->object = ACPI_CAST_PTR (union acpi_operand_object, target_node);
alias_node->object =
ACPI_CAST_PTR(union acpi_operand_object, target_node);
break;
default:
@@ -140,7 +136,9 @@ acpi_ex_create_alias (
* target node or the alias Node
*/
status = acpi_ns_attach_object(alias_node,
acpi_ns_get_attached_object (target_node), target_node->type);
acpi_ns_get_attached_object
(target_node),
target_node->type);
break;
}
@@ -149,7 +147,6 @@ acpi_ex_create_alias (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_event
@@ -162,17 +159,13 @@ acpi_ex_create_alias (
*
******************************************************************************/
acpi_status
acpi_ex_create_event (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
{
acpi_status status;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE("ex_create_event");
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
if (!obj_desc) {
status = AE_NO_MEMORY;
@@ -191,8 +184,9 @@ acpi_ex_create_event (
/* Attach object to the Node */
status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
obj_desc, ACPI_TYPE_EVENT);
status =
acpi_ns_attach_object((struct acpi_namespace_node *)walk_state->
operands[0], obj_desc, ACPI_TYPE_EVENT);
cleanup:
/*
@@ -203,7 +197,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_mutex
@@ -218,17 +211,13 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_create_mutex (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS);
/* Create the new mutex object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
@@ -249,13 +238,14 @@ acpi_ex_create_mutex (
/* Init object and attach to NS node */
obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0];
obj_desc->mutex.sync_level =
(u8) walk_state->operands[1]->integer.value;
obj_desc->mutex.node =
(struct acpi_namespace_node *)walk_state->operands[0];
status = acpi_ns_attach_object(obj_desc->mutex.node,
obj_desc, ACPI_TYPE_MUTEX);
cleanup:
/*
* Remove local reference to the object (on error, will cause deletion
@@ -265,7 +255,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_region
@@ -282,21 +271,17 @@ cleanup:
******************************************************************************/
acpi_status
acpi_ex_create_region (
u8 *aml_start,
acpi_ex_create_region(u8 * aml_start,
u32 aml_length,
u8 region_space,
struct acpi_walk_state *walk_state)
u8 region_space, struct acpi_walk_state *walk_state)
{
acpi_status status;
union acpi_operand_object *obj_desc;
struct acpi_namespace_node *node;
union acpi_operand_object *region_obj2;
ACPI_FUNCTION_TRACE("ex_create_region");
/* Get the Namespace Node */
node = walk_state->op->common.node;
@@ -315,7 +300,8 @@ acpi_ex_create_region (
*/
if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
(region_space < ACPI_USER_REGION_BEGIN)) {
ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space));
ACPI_REPORT_ERROR(("Invalid address_space type %X\n",
region_space));
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
}
@@ -349,7 +335,6 @@ acpi_ex_create_region (
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
cleanup:
/* Remove local reference to the object */
@@ -358,7 +343,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_table_region
@@ -371,9 +355,7 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_create_table_region (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
{
acpi_status status;
union acpi_operand_object **operand = &walk_state->operands[0];
@@ -382,10 +364,8 @@ acpi_ex_create_table_region (
struct acpi_table_header *table;
union acpi_operand_object *region_obj2;
ACPI_FUNCTION_TRACE("ex_create_table_region");
/* Get the Node from the object stack */
node = walk_state->op->common.node;
@@ -420,7 +400,8 @@ acpi_ex_create_table_region (
/* Init the region from the operands */
obj_desc->region.space_id = REGION_DATA_TABLE;
obj_desc->region.address = (acpi_physical_address) ACPI_TO_INTEGER (table);
obj_desc->region.address =
(acpi_physical_address) ACPI_TO_INTEGER(table);
obj_desc->region.length = table->length;
obj_desc->region.node = node;
obj_desc->region.flags = AOPOBJ_DATA_VALID;
@@ -436,15 +417,13 @@ acpi_ex_create_table_region (
if (ACPI_FAILURE(status)) {
if (status == AE_NOT_EXIST) {
status = AE_OK;
}
else {
} else {
goto cleanup;
}
}
obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
cleanup:
/* Remove local reference to the object */
@@ -453,7 +432,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_processor
@@ -468,18 +446,14 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_create_processor (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *obj_desc;
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state);
/* Create the processor object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR);
@@ -490,7 +464,8 @@ acpi_ex_create_processor (
/* Initialize the processor object from the operands */
obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
obj_desc->processor.address =
(acpi_io_address) operand[2]->integer.value;
obj_desc->processor.length = (u8) operand[3]->integer.value;
/* Install the processor object in the parent Node */
@@ -504,7 +479,6 @@ acpi_ex_create_processor (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_power_resource
@@ -519,18 +493,14 @@ acpi_ex_create_processor (
*
******************************************************************************/
acpi_status
acpi_ex_create_power_resource (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
acpi_status status;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state);
/* Create the power resource object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER);
@@ -541,7 +511,8 @@ acpi_ex_create_power_resource (
/* Initialize the power object from the operands */
obj_desc->power_resource.system_level = (u8) operand[1]->integer.value;
obj_desc->power_resource.resource_order = (u16) operand[2]->integer.value;
obj_desc->power_resource.resource_order =
(u16) operand[2]->integer.value;
/* Install the power resource object in the parent Node */
@@ -555,7 +526,6 @@ acpi_ex_create_power_resource (
}
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ex_create_method
@@ -571,20 +541,16 @@ acpi_ex_create_power_resource (
******************************************************************************/
acpi_status
acpi_ex_create_method (
u8 *aml_start,
u32 aml_length,
struct acpi_walk_state *walk_state)
acpi_ex_create_method(u8 * aml_start,
u32 aml_length, struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *obj_desc;
acpi_status status;
u8 method_flags;
ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state);
/* Create a new method object */
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
@@ -603,8 +569,10 @@ acpi_ex_create_method (
*/
method_flags = (u8) operand[1]->integer.value;
obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT);
obj_desc->method.method_flags =
(u8) (method_flags & ~AML_METHOD_ARG_COUNT);
obj_desc->method.param_count =
(u8) (method_flags & AML_METHOD_ARG_COUNT);
/*
* Get the concurrency count. If required, a semaphore will be
@@ -613,16 +581,14 @@ acpi_ex_create_method (
if (acpi_gbl_all_methods_serialized) {
obj_desc->method.concurrency = 1;
obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
}
else if (method_flags & AML_METHOD_SERIALIZED) {
} else if (method_flags & AML_METHOD_SERIALIZED) {
/*
* ACPI 1.0: Concurrency = 1
* ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1)
*/
obj_desc->method.concurrency = (u8)
(((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
}
else {
} else {
obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
}
@@ -640,5 +606,3 @@ acpi_ex_create_method (
acpi_ut_remove_reference(operand[1]);
return_ACPI_STATUS(status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
@@ -55,39 +54,20 @@
* The following routines are used for debug output only
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/* 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_integer(char *title, u32 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_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_dump_reference (
union acpi_operand_object *obj_desc);
static void
acpi_ex_dump_package (
union acpi_operand_object *obj_desc,
u32 level,
u32 index);
acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index);
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
@@ -103,19 +83,16 @@ acpi_ex_dump_package (
*
******************************************************************************/
void
acpi_ex_dump_operand (
union acpi_operand_object *obj_desc,
u32 depth)
void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
{
u32 length;
u32 index;
ACPI_FUNCTION_NAME("ex_dump_operand")
if (!((ACPI_LV_EXEC & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
if (!
((ACPI_LV_EXEC & acpi_dbg_level)
&& (_COMPONENT & acpi_dbg_layer))) {
return;
}
@@ -127,7 +104,8 @@ acpi_ex_dump_operand (
}
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", obj_desc));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ",
obj_desc));
ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC);
return;
}
@@ -135,7 +113,8 @@ acpi_ex_dump_operand (
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"%p is not a node or operand object: [%s]\n",
obj_desc, acpi_ut_get_descriptor_name (obj_desc)));
obj_desc,
acpi_ut_get_descriptor_name(obj_desc)));
ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object));
return;
}
@@ -145,8 +124,7 @@ acpi_ex_dump_operand (
if (depth > 0) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ",
depth, " ", depth, obj_desc));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc));
}
@@ -161,29 +139,27 @@ acpi_ex_dump_operand (
acpi_os_printf("Reference: Debug\n");
break;
case AML_NAME_OP:
ACPI_DUMP_PATHNAME(obj_desc->reference.object,
"Reference: Name: ", ACPI_LV_INFO, _COMPONENT);
ACPI_DUMP_ENTRY (obj_desc->reference.object, ACPI_LV_INFO);
"Reference: Name: ", ACPI_LV_INFO,
_COMPONENT);
ACPI_DUMP_ENTRY(obj_desc->reference.object,
ACPI_LV_INFO);
break;
case AML_INDEX_OP:
acpi_os_printf("Reference: Index %p\n",
obj_desc->reference.object);
break;
case AML_REF_OF_OP:
acpi_os_printf("Reference: (ref_of) %p\n",
obj_desc->reference.object);
break;
case AML_ARG_OP:
acpi_os_printf("Reference: Arg%d",
@@ -193,13 +169,14 @@ acpi_ex_dump_operand (
/* Value is an Integer */
acpi_os_printf(" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
ACPI_FORMAT_UINT64(obj_desc->
integer.
value));
}
acpi_os_printf("\n");
break;
case AML_LOCAL_OP:
acpi_os_printf("Reference: Local%d",
@@ -210,20 +187,20 @@ acpi_ex_dump_operand (
/* Value is an Integer */
acpi_os_printf(" value is [%8.8X%8.8x]",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
ACPI_FORMAT_UINT64(obj_desc->
integer.
value));
}
acpi_os_printf("\n");
break;
case AML_INT_NAMEPATH_OP:
acpi_os_printf("Reference.Node->Name %X\n",
obj_desc->reference.node->name.integer);
break;
default:
/* Unknown opcode */
@@ -235,11 +212,11 @@ acpi_ex_dump_operand (
}
break;
case ACPI_TYPE_BUFFER:
acpi_os_printf("Buffer len %X @ %p \n",
obj_desc->buffer.length, obj_desc->buffer.pointer);
obj_desc->buffer.length,
obj_desc->buffer.pointer);
length = obj_desc->buffer.length;
if (length > 64) {
@@ -252,43 +229,45 @@ acpi_ex_dump_operand (
acpi_os_printf("Buffer Contents: ");
for (index = 0; index < length; index++) {
acpi_os_printf (" %02x", obj_desc->buffer.pointer[index]);
acpi_os_printf(" %02x",
obj_desc->buffer.pointer[index]);
}
acpi_os_printf("\n");
}
break;
case ACPI_TYPE_INTEGER:
acpi_os_printf("Integer %8.8X%8.8X\n",
ACPI_FORMAT_UINT64(obj_desc->integer.value));
break;
case ACPI_TYPE_PACKAGE:
acpi_os_printf("Package [Len %X] element_array %p\n",
obj_desc->package.count, obj_desc->package.elements);
obj_desc->package.count,
obj_desc->package.elements);
/*
* If elements exist, package element pointer is valid,
* and debug_level exceeds 1, dump package's elements.
*/
if (obj_desc->package.count &&
obj_desc->package.elements &&
acpi_dbg_level > 1) {
for (index = 0; index < obj_desc->package.count; index++) {
acpi_ex_dump_operand (obj_desc->package.elements[index], depth+1);
obj_desc->package.elements && acpi_dbg_level > 1) {
for (index = 0; index < obj_desc->package.count;
index++) {
acpi_ex_dump_operand(obj_desc->package.
elements[index],
depth + 1);
}
}
break;
case ACPI_TYPE_REGION:
acpi_os_printf("Region %s (%X)",
acpi_ut_get_region_name (obj_desc->region.space_id),
acpi_ut_get_region_name(obj_desc->region.
space_id),
obj_desc->region.space_id);
/*
@@ -297,15 +276,14 @@ acpi_ex_dump_operand (
*/
if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) {
acpi_os_printf("\n");
}
else {
} else {
acpi_os_printf(" base %8.8X%8.8X Length %X\n",
ACPI_FORMAT_UINT64 (obj_desc->region.address),
ACPI_FORMAT_UINT64(obj_desc->region.
address),
obj_desc->region.length);
}
break;
case ACPI_TYPE_STRING:
acpi_os_printf("String length %X @ %p ",
@@ -316,17 +294,15 @@ acpi_ex_dump_operand (
acpi_os_printf("\n");
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_os_printf("bank_field\n");
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf (
"region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
acpi_os_printf
("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
obj_desc->field.bit_length,
obj_desc->field.access_byte_width,
obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK,
@@ -337,40 +313,35 @@ acpi_ex_dump_operand (
acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1);
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf("index_field\n");
break;
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.base_byte_offset,
obj_desc->buffer_field.start_field_bit_offset);
if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n"));
}
else if (ACPI_GET_OBJECT_TYPE (obj_desc->buffer_field.buffer_obj) !=
ACPI_TYPE_BUFFER) {
} else
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
!= ACPI_TYPE_BUFFER) {
acpi_os_printf("*not a Buffer* \n");
}
else {
acpi_ex_dump_operand (obj_desc->buffer_field.buffer_obj, depth+1);
} else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
depth + 1);
}
break;
case ACPI_TYPE_EVENT:
acpi_os_printf("Event\n");
break;
case ACPI_TYPE_METHOD:
acpi_os_printf("Method(%X) @ %p:%X\n",
@@ -379,48 +350,42 @@ acpi_ex_dump_operand (
obj_desc->method.aml_length);
break;
case ACPI_TYPE_MUTEX:
acpi_os_printf("Mutex\n");
break;
case ACPI_TYPE_DEVICE:
acpi_os_printf("Device\n");
break;
case ACPI_TYPE_POWER:
acpi_os_printf("Power\n");
break;
case ACPI_TYPE_PROCESSOR:
acpi_os_printf("Processor\n");
break;
case ACPI_TYPE_THERMAL:
acpi_os_printf("Thermal\n");
break;
default:
/* Unknown Type */
acpi_os_printf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
acpi_os_printf("Unknown Type %X\n",
ACPI_GET_OBJECT_TYPE(obj_desc));
break;
}
return;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_operands
@@ -438,21 +403,16 @@ acpi_ex_dump_operand (
******************************************************************************/
void
acpi_ex_dump_operands (
union acpi_operand_object **operands,
acpi_ex_dump_operands(union acpi_operand_object **operands,
acpi_interpreter_mode interpreter_mode,
char *ident,
u32 num_levels,
char *note,
char *module_name,
u32 line_number)
char *note, char *module_name, u32 line_number)
{
acpi_native_uint i;
ACPI_FUNCTION_NAME("ex_dump_operands");
if (!ident) {
ident = "?";
}
@@ -481,7 +441,6 @@ acpi_ex_dump_operands (
return;
}
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
@@ -496,34 +455,22 @@ acpi_ex_dump_operands (
*
******************************************************************************/
static void
acpi_ex_out_string (
char *title,
char *value)
static void acpi_ex_out_string(char *title, char *value)
{
acpi_os_printf("%20s : %s\n", title, value);
}
static void
acpi_ex_out_pointer (
char *title,
void *value)
static void acpi_ex_out_pointer(char *title, void *value)
{
acpi_os_printf("%20s : %p\n", title, value);
}
static void
acpi_ex_out_integer (
char *title,
u32 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)
{
#if ACPI_MACHINE_WIDTH == 16
@@ -533,7 +480,6 @@ acpi_ex_out_address (
#endif
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_node
@@ -545,17 +491,15 @@ acpi_ex_out_address (
*
******************************************************************************/
void
acpi_ex_dump_node (
struct acpi_namespace_node *node,
u32 flags)
void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags)
{
ACPI_FUNCTION_ENTRY();
if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
if (!
((ACPI_LV_OBJECTS & acpi_dbg_level)
&& (_COMPONENT & acpi_dbg_layer))) {
return;
}
}
@@ -565,13 +509,13 @@ acpi_ex_dump_node (
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_ns_get_attached_object (node));
acpi_ex_out_pointer("Attached Object",
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));
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_reference
@@ -582,32 +526,29 @@ acpi_ex_dump_node (
*
******************************************************************************/
static void
acpi_ex_dump_reference (
union acpi_operand_object *obj_desc)
static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc)
{
struct acpi_buffer ret_buf;
acpi_status status;
if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) {
acpi_os_printf("Named Object %p ", obj_desc->reference.node);
ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_ns_handle_to_pathname (obj_desc->reference.node, &ret_buf);
status =
acpi_ns_handle_to_pathname(obj_desc->reference.node,
&ret_buf);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not convert name to pathname\n");
}
else {
} else {
acpi_os_printf("%s\n", (char *)ret_buf.pointer);
ACPI_MEM_FREE(ret_buf.pointer);
}
}
else if (obj_desc->reference.object) {
acpi_os_printf ("\nReferenced Object: %p\n", obj_desc->reference.object);
} else if (obj_desc->reference.object) {
acpi_os_printf("\nReferenced Object: %p\n",
obj_desc->reference.object);
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_package
@@ -621,14 +562,10 @@ acpi_ex_dump_reference (
******************************************************************************/
static void
acpi_ex_dump_package (
union acpi_operand_object *obj_desc,
u32 level,
u32 index)
acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index)
{
u32 i;
/* Indentation and index output */
if (level > 0) {
@@ -657,7 +594,6 @@ acpi_ex_dump_package (
ACPI_FORMAT_UINT64(obj_desc->integer.value));
break;
case ACPI_TYPE_STRING:
acpi_os_printf("[String] Value: ");
@@ -667,46 +603,44 @@ acpi_ex_dump_package (
acpi_os_printf("\n");
break;
case ACPI_TYPE_BUFFER:
acpi_os_printf ("[Buffer] Length %.2X = ", obj_desc->buffer.length);
acpi_os_printf("[Buffer] Length %.2X = ",
obj_desc->buffer.length);
if (obj_desc->buffer.length) {
acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer,
obj_desc->buffer.length, DB_DWORD_DISPLAY, _COMPONENT);
}
else {
obj_desc->buffer.length,
DB_DWORD_DISPLAY, _COMPONENT);
} else {
acpi_os_printf("\n");
}
break;
case ACPI_TYPE_PACKAGE:
acpi_os_printf("[Package] Contains %d Elements: \n",
obj_desc->package.count);
for (i = 0; i < obj_desc->package.count; i++) {
acpi_ex_dump_package (obj_desc->package.elements[i], level+1, i);
acpi_ex_dump_package(obj_desc->package.elements[i],
level + 1, i);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf("[Object Reference] ");
acpi_ex_dump_reference(obj_desc);
break;
default:
acpi_os_printf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (obj_desc));
acpi_os_printf("[Unknown Type] %X\n",
ACPI_GET_OBJECT_TYPE(obj_desc));
break;
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_dump_object_descriptor
@@ -719,35 +653,36 @@ acpi_ex_dump_package (
******************************************************************************/
void
acpi_ex_dump_object_descriptor (
union acpi_operand_object *obj_desc,
u32 flags)
acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags)
{
ACPI_FUNCTION_TRACE("ex_dump_object_descriptor");
if (!obj_desc) {
return_VOID;
}
if (!flags) {
if (!((ACPI_LV_OBJECTS & acpi_dbg_level) && (_COMPONENT & acpi_dbg_layer))) {
if (!
((ACPI_LV_OBJECTS & acpi_dbg_level)
&& (_COMPONENT & acpi_dbg_layer))) {
return_VOID;
}
}
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) {
acpi_ex_dump_node ((struct acpi_namespace_node *) obj_desc, flags);
acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc,
flags);
acpi_os_printf("\nAttached Object (%p):\n",
((struct acpi_namespace_node *) obj_desc)->object);
acpi_ex_dump_object_descriptor (
((struct acpi_namespace_node *) obj_desc)->object, flags);
((struct acpi_namespace_node *)obj_desc)->
object);
acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *)
obj_desc)->object, flags);
return_VOID;
}
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) {
acpi_os_printf (
"ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
acpi_os_printf
("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n",
obj_desc, acpi_ut_get_descriptor_name(obj_desc));
return_VOID;
}
@@ -755,7 +690,8 @@ acpi_ex_dump_object_descriptor (
/* Common Fields */
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("Reference Count",
obj_desc->common.reference_count);
acpi_ex_out_integer("Flags", obj_desc->common.flags);
/* Object-specific Fields */
@@ -767,25 +703,24 @@ acpi_ex_dump_object_descriptor (
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_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);
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);
@@ -798,41 +733,42 @@ acpi_ex_dump_object_descriptor (
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);
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_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("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);
@@ -843,66 +779,87 @@ acpi_ex_dump_object_descriptor (
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);
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("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_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("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_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);
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);
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);
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);
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:
@@ -911,12 +868,13 @@ acpi_ex_dump_object_descriptor (
}
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("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);
@@ -925,32 +883,31 @@ acpi_ex_dump_object_descriptor (
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_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("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_os_printf
("ex_dump_object_descriptor: Display not implemented for object type %s\n",
acpi_ut_get_object_type_name(obj_desc));
break;
}
@@ -960,4 +917,3 @@ acpi_ex_dump_object_descriptor (
#endif /* ACPI_FUTURE_USAGE */
#endif

View File

@@ -41,16 +41,13 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exfield")
/*******************************************************************************
*
* FUNCTION: acpi_ex_read_data_from_field
@@ -65,10 +62,8 @@
* Buffer, depending on the size of the field.
*
******************************************************************************/
acpi_status
acpi_ex_read_data_from_field (
struct acpi_walk_state *walk_state,
acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
union acpi_operand_object *obj_desc,
union acpi_operand_object **ret_buffer_desc)
{
@@ -78,10 +73,8 @@ acpi_ex_read_data_from_field (
void *buffer;
u8 locked;
ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc);
/* Parameter validation */
if (!obj_desc) {
@@ -102,29 +95,36 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS(status);
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
} else
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
&& (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS)) {
/*
* This is an SMBus read. We must create a buffer to hold the data
* and directly access the region handler.
*/
buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
buffer_desc =
acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
locked =
acpi_ex_acquire_global_lock(obj_desc->common_field.
field_flags);
/*
* Perform the read.
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
status = acpi_ex_access_region(obj_desc, 0,
ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
ACPI_READ | (obj_desc->field.attribute << 16));
ACPI_CAST_PTR(acpi_integer,
buffer_desc->
buffer.pointer),
ACPI_READ | (obj_desc->field.
attribute << 16));
acpi_ex_release_global_lock(locked);
goto exit;
}
@@ -139,7 +139,8 @@ acpi_ex_read_data_from_field (
*
* Note: Field.length is in bits.
*/
length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES (obj_desc->field.bit_length);
length =
(acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length);
if (length > acpi_gbl_integer_byte_width) {
/* Field is too large for an Integer, create a Buffer instead */
@@ -148,8 +149,7 @@ acpi_ex_read_data_from_field (
return_ACPI_STATUS(AE_NO_MEMORY);
}
buffer = buffer_desc->buffer.pointer;
}
else {
} else {
/* Field will fit within an Integer (normal case) */
buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -164,7 +164,8 @@ acpi_ex_read_data_from_field (
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n",
obj_desc, ACPI_GET_OBJECT_TYPE (obj_desc), buffer, (u32) length));
obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer,
(u32) length));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
obj_desc->common_field.bit_length,
@@ -173,26 +174,24 @@ acpi_ex_read_data_from_field (
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
locked =
acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
/* Read from the field */
status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length);
acpi_ex_release_global_lock(locked);
exit:
if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference(buffer_desc);
}
else {
} else {
*ret_buffer_desc = buffer_desc;
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_write_data_to_field
@@ -208,8 +207,7 @@ exit:
******************************************************************************/
acpi_status
acpi_ex_write_data_to_field (
union acpi_operand_object *source_desc,
acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc)
{
@@ -221,10 +219,8 @@ acpi_ex_write_data_to_field (
u8 locked;
union acpi_operand_object *buffer_desc;
ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc);
/* Parameter validation */
if (!source_desc || !obj_desc) {
@@ -242,9 +238,10 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS(status);
}
}
}
else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
} else
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
&& (obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS)) {
/*
* This is an SMBus write. We will bypass the entire field mechanism
* and handoff the buffer directly to the handler.
@@ -252,21 +249,19 @@ acpi_ex_write_data_to_field (
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
*/
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_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
ACPI_REPORT_ERROR ((
"SMBus write requires Buffer of length %X, found length %X\n",
ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
}
buffer_desc = acpi_ut_create_buffer_object (ACPI_SMBUS_BUFFER_SIZE);
buffer_desc =
acpi_ut_create_buffer_object(ACPI_SMBUS_BUFFER_SIZE);
if (!buffer_desc) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -277,7 +272,9 @@ acpi_ex_write_data_to_field (
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
locked =
acpi_ex_acquire_global_lock(obj_desc->common_field.
field_flags);
/*
* Perform the write (returns status and perhaps data in the
@@ -286,7 +283,8 @@ acpi_ex_write_data_to_field (
*/
status = acpi_ex_access_region(obj_desc, 0,
(acpi_integer *) buffer,
ACPI_WRITE | (obj_desc->field.attribute << 16));
ACPI_WRITE | (obj_desc->field.
attribute << 16));
acpi_ex_release_global_lock(locked);
*result_desc = buffer_desc;
@@ -322,8 +320,8 @@ acpi_ex_write_data_to_field (
* the ACPI specification.
*/
new_buffer = NULL;
required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.bit_length);
required_length =
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
if (length < required_length) {
/* We need to create a new buffer */
@@ -345,12 +343,15 @@ acpi_ex_write_data_to_field (
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
source_desc,
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
(source_desc)),
ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
obj_desc,
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
ACPI_GET_OBJECT_TYPE(obj_desc),
obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset,
@@ -358,7 +359,8 @@ acpi_ex_write_data_to_field (
/* Lock entire transaction if requested */
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
locked =
acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
/* Write to the field */
@@ -373,5 +375,3 @@ acpi_ex_write_data_to_field (
return_ACPI_STATUS(status);
}

View File

@@ -41,37 +41,29 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#include <acpi/acevents.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exfldio")
/* Local prototypes */
static acpi_status
acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc,
acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write);
acpi_integer * value, u32 read_write);
static u8
acpi_ex_register_overflow (
union acpi_operand_object *obj_desc,
acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
acpi_integer value);
static acpi_status
acpi_ex_setup_region (
union acpi_operand_object *obj_desc,
acpi_ex_setup_region(union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset);
/*******************************************************************************
*
* FUNCTION: acpi_ex_setup_region
@@ -89,23 +81,21 @@ acpi_ex_setup_region (
******************************************************************************/
static acpi_status
acpi_ex_setup_region (
union acpi_operand_object *obj_desc,
acpi_ex_setup_region(union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset)
{
acpi_status status = AE_OK;
union acpi_operand_object *rgn_desc;
ACPI_FUNCTION_TRACE_U32("ex_setup_region", field_datum_byte_offset);
rgn_desc = obj_desc->common_field.region_obj;
/* We must have a valid region */
if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed Region, found type %X (%s)\n",
ACPI_GET_OBJECT_TYPE(rgn_desc),
acpi_ut_get_object_type_name(rgn_desc)));
@@ -128,7 +118,6 @@ acpi_ex_setup_region (
return_ACPI_STATUS(AE_OK);
}
#ifdef ACPI_UNDER_DEVELOPMENT
/*
* If the Field access is any_acc, we can now compute the optimal
@@ -148,7 +137,8 @@ acpi_ex_setup_region (
*/
if (rgn_desc->region.length < (obj_desc->common_field.base_byte_offset +
field_datum_byte_offset +
obj_desc->common_field.access_byte_width)) {
obj_desc->common_field.
access_byte_width)) {
if (acpi_gbl_enable_interpreter_slack) {
/*
* Slack mode only: We will go ahead and allow access to this
@@ -156,15 +146,17 @@ acpi_ex_setup_region (
* access width boundary.
*/
if (ACPI_ROUND_UP(rgn_desc->region.length,
obj_desc->common_field.access_byte_width) >=
obj_desc->common_field.
access_byte_width) >=
(obj_desc->common_field.base_byte_offset +
(acpi_native_uint) obj_desc->common_field.access_byte_width +
field_datum_byte_offset)) {
(acpi_native_uint) obj_desc->common_field.
access_byte_width + field_datum_byte_offset)) {
return_ACPI_STATUS(AE_OK);
}
}
if (rgn_desc->region.length < obj_desc->common_field.access_byte_width) {
if (rgn_desc->region.length <
obj_desc->common_field.access_byte_width) {
/*
* This is the case where the access_type (acc_word, etc.) is wider
* than the region itself. For example, a region of length one
@@ -172,9 +164,13 @@ acpi_ex_setup_region (
*/
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
acpi_ut_get_node_name (obj_desc->common_field.node),
obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name (rgn_desc->region.node),
acpi_ut_get_node_name(obj_desc->
common_field.
node),
obj_desc->common_field.
access_byte_width,
acpi_ut_get_node_name(rgn_desc->
region.node),
rgn_desc->region.length));
}
@@ -184,9 +180,11 @@ acpi_ex_setup_region (
*/
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
acpi_ut_get_node_name (obj_desc->common_field.node),
acpi_ut_get_node_name(obj_desc->common_field.
node),
obj_desc->common_field.base_byte_offset,
field_datum_byte_offset, obj_desc->common_field.access_byte_width,
field_datum_byte_offset,
obj_desc->common_field.access_byte_width,
acpi_ut_get_node_name(rgn_desc->region.node),
rgn_desc->region.length));
@@ -196,7 +194,6 @@ acpi_ex_setup_region (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_access_region
@@ -216,20 +213,16 @@ acpi_ex_setup_region (
******************************************************************************/
acpi_status
acpi_ex_access_region (
union acpi_operand_object *obj_desc,
acpi_ex_access_region(union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 function)
acpi_integer * value, u32 function)
{
acpi_status status;
union acpi_operand_object *rgn_desc;
acpi_physical_address address;
ACPI_FUNCTION_TRACE("ex_access_region");
/*
* Ensure that the region operands are fully evaluated and verify
* the validity of the request
@@ -248,19 +241,18 @@ acpi_ex_access_region (
*/
rgn_desc = obj_desc->common_field.region_obj;
address = rgn_desc->region.address +
obj_desc->common_field.base_byte_offset +
field_datum_byte_offset;
obj_desc->common_field.base_byte_offset + field_datum_byte_offset;
if ((function & ACPI_IO_MASK) == ACPI_READ) {
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[READ]"));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "[WRITE]"));
}
ACPI_DEBUG_PRINT_RAW((ACPI_DB_BFIELD,
" Region [%s:%X], Width %X, byte_base %X, Offset %X at %8.8X%8.8X\n",
acpi_ut_get_region_name (rgn_desc->region.space_id),
acpi_ut_get_region_name(rgn_desc->region.
space_id),
rgn_desc->region.space_id,
obj_desc->common_field.access_byte_width,
obj_desc->common_field.base_byte_offset,
@@ -271,19 +263,24 @@ acpi_ex_access_region (
status = acpi_ev_address_space_dispatch(rgn_desc, function,
address,
ACPI_MUL_8 (obj_desc->common_field.access_byte_width), value);
ACPI_MUL_8(obj_desc->
common_field.
access_byte_width),
value);
if (ACPI_FAILURE(status)) {
if (status == AE_NOT_IMPLEMENTED) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Region %s(%X) not implemented\n",
acpi_ut_get_region_name (rgn_desc->region.space_id),
acpi_ut_get_region_name(rgn_desc->
region.
space_id),
rgn_desc->region.space_id));
}
else if (status == AE_NOT_EXIST) {
ACPI_REPORT_ERROR ((
"Region %s(%X) has no handler\n",
acpi_ut_get_region_name (rgn_desc->region.space_id),
} else if (status == AE_NOT_EXIST) {
ACPI_REPORT_ERROR(("Region %s(%X) has no handler\n",
acpi_ut_get_region_name(rgn_desc->
region.
space_id),
rgn_desc->region.space_id));
}
}
@@ -291,7 +288,6 @@ acpi_ex_access_region (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_register_overflow
@@ -310,8 +306,7 @@ acpi_ex_access_region (
******************************************************************************/
static u8
acpi_ex_register_overflow (
union acpi_operand_object *obj_desc,
acpi_ex_register_overflow(union acpi_operand_object *obj_desc,
acpi_integer value)
{
@@ -336,7 +331,6 @@ acpi_ex_register_overflow (
return (FALSE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_field_datum_io
@@ -356,19 +350,15 @@ acpi_ex_register_overflow (
******************************************************************************/
static acpi_status
acpi_ex_field_datum_io (
union acpi_operand_object *obj_desc,
acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset,
acpi_integer *value,
u32 read_write)
acpi_integer * value, u32 read_write)
{
acpi_status status;
acpi_integer local_value;
ACPI_FUNCTION_TRACE_U32("ex_field_datum_io", field_datum_byte_offset);
if (read_write == ACPI_READ) {
if (!value) {
local_value = 0;
@@ -411,26 +401,26 @@ acpi_ex_field_datum_io (
* Length is the field width in bytes.
*/
ACPI_MEMCPY(value,
(obj_desc->buffer_field.buffer_obj)->buffer.pointer +
(obj_desc->buffer_field.buffer_obj)->buffer.
pointer +
obj_desc->buffer_field.base_byte_offset +
field_datum_byte_offset,
obj_desc->common_field.access_byte_width);
}
else {
} else {
/*
* Copy the data to the target buffer.
* Length is the field width in bytes.
*/
ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer +
ACPI_MEMCPY((obj_desc->buffer_field.buffer_obj)->buffer.
pointer +
obj_desc->buffer_field.base_byte_offset +
field_datum_byte_offset,
value, obj_desc->common_field.access_byte_width);
field_datum_byte_offset, value,
obj_desc->common_field.access_byte_width);
}
status = AE_OK;
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
/*
@@ -438,7 +428,8 @@ acpi_ex_field_datum_io (
* the register
*/
if (acpi_ex_register_overflow(obj_desc->bank_field.bank_obj,
(acpi_integer) obj_desc->bank_field.value)) {
(acpi_integer) obj_desc->
bank_field.value)) {
return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
}
@@ -446,9 +437,11 @@ acpi_ex_field_datum_io (
* For bank_fields, we must write the bank_value to the bank_register
* (itself a region_field) before we can access the data.
*/
status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj,
status =
acpi_ex_insert_into_field(obj_desc->bank_field.bank_obj,
&obj_desc->bank_field.value,
sizeof (obj_desc->bank_field.value));
sizeof(obj_desc->bank_field.
value));
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -460,26 +453,25 @@ acpi_ex_field_datum_io (
/*lint -fallthrough */
case ACPI_TYPE_LOCAL_REGION_FIELD:
/*
* For simple region_fields, we just directly access the owning
* Operation Region.
*/
status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value,
read_write);
status =
acpi_ex_access_region(obj_desc, field_datum_byte_offset,
value, read_write);
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
/*
* Ensure that the index_value is not beyond the capacity of
* the register
*/
if (acpi_ex_register_overflow(obj_desc->index_field.index_obj,
(acpi_integer) obj_desc->index_field.value)) {
(acpi_integer) obj_desc->
index_field.value)) {
return_ACPI_STATUS(AE_AML_REGISTER_LIMIT);
}
@@ -491,7 +483,8 @@ acpi_ex_field_datum_io (
"Write to Index Register: Value %8.8X\n",
field_datum_byte_offset));
status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,
status =
acpi_ex_insert_into_field(obj_desc->index_field.index_obj,
&field_datum_byte_offset,
sizeof(field_datum_byte_offset));
if (ACPI_FAILURE(status)) {
@@ -505,18 +498,20 @@ acpi_ex_field_datum_io (
if (read_write == ACPI_READ) {
/* Read the datum from the data_register */
status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,
value, sizeof (acpi_integer));
}
else {
status =
acpi_ex_extract_from_field(obj_desc->index_field.
data_obj, value,
sizeof(acpi_integer));
} else {
/* Write the datum to the data_register */
status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,
value, sizeof (acpi_integer));
status =
acpi_ex_insert_into_field(obj_desc->index_field.
data_obj, value,
sizeof(acpi_integer));
}
break;
default:
ACPI_REPORT_ERROR(("Wrong object type in field I/O %X\n",
@@ -530,20 +525,20 @@ acpi_ex_field_datum_io (
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"Value Read %8.8X%8.8X, Width %d\n",
ACPI_FORMAT_UINT64(*value),
obj_desc->common_field.access_byte_width));
}
else {
obj_desc->common_field.
access_byte_width));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"Value Written %8.8X%8.8X, Width %d\n",
ACPI_FORMAT_UINT64(*value),
obj_desc->common_field.access_byte_width));
obj_desc->common_field.
access_byte_width));
}
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_write_with_update_rule
@@ -560,8 +555,7 @@ acpi_ex_field_datum_io (
******************************************************************************/
acpi_status
acpi_ex_write_with_update_rule (
union acpi_operand_object *obj_desc,
acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
acpi_integer mask,
acpi_integer field_value,
u32 field_datum_byte_offset)
@@ -570,10 +564,8 @@ acpi_ex_write_with_update_rule (
acpi_integer merged_value;
acpi_integer current_value;
ACPI_FUNCTION_TRACE_U32("ex_write_with_update_rule", mask);
/* Start with the new bits */
merged_value = field_value;
@@ -583,20 +575,25 @@ acpi_ex_write_with_update_rule (
if (mask != ACPI_INTEGER_MAX) {
/* Decode the update rule */
switch (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK) {
switch (obj_desc->common_field.
field_flags & AML_FIELD_UPDATE_RULE_MASK) {
case AML_FIELD_UPDATE_PRESERVE:
/*
* Check if update rule needs to be applied (not if mask is all
* ones) The left shift drops the bits we want to ignore.
*/
if ((~mask << (ACPI_MUL_8(sizeof(mask)) -
ACPI_MUL_8 (obj_desc->common_field.access_byte_width))) != 0) {
ACPI_MUL_8(obj_desc->common_field.
access_byte_width))) != 0) {
/*
* Read the current contents of the byte/word/dword containing
* the field, and merge with the new field value.
*/
status = acpi_ex_field_datum_io (obj_desc, field_datum_byte_offset,
&current_value, ACPI_READ);
status =
acpi_ex_field_datum_io(obj_desc,
field_datum_byte_offset,
&current_value,
ACPI_READ);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -623,7 +620,9 @@ acpi_ex_write_with_update_rule (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"write_with_update_rule: Unknown update_rule setting: %X\n",
(obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK)));
(obj_desc->common_field.
field_flags &
AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
}
}
@@ -644,7 +643,6 @@ acpi_ex_write_with_update_rule (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_extract_from_field
@@ -660,10 +658,8 @@ acpi_ex_write_with_update_rule (
******************************************************************************/
acpi_status
acpi_ex_extract_from_field (
union acpi_operand_object *obj_desc,
void *buffer,
u32 buffer_length)
acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
void *buffer, u32 buffer_length)
{
acpi_status status;
acpi_integer raw_datum;
@@ -675,17 +671,16 @@ acpi_ex_extract_from_field (
u32 field_datum_count;
u32 i;
ACPI_FUNCTION_TRACE("ex_extract_from_field");
/* Validate target buffer and clear it */
if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.bit_length)) {
if (buffer_length <
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Field size %X (bits) is too large for buffer (%X)\n",
obj_desc->common_field.bit_length, buffer_length));
obj_desc->common_field.bit_length,
buffer_length));
return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
}
@@ -693,21 +688,24 @@ acpi_ex_extract_from_field (
/* Compute the number of datums (access width data items) */
datum_count = ACPI_ROUND_UP_TO (
obj_desc->common_field.bit_length,
obj_desc->common_field.access_bit_width);
field_datum_count = ACPI_ROUND_UP_TO (
obj_desc->common_field.bit_length +
obj_desc->common_field.start_field_bit_offset,
datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
obj_desc->common_field.access_bit_width);
field_datum_count = ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
obj_desc->common_field.
start_field_bit_offset,
obj_desc->common_field.
access_bit_width);
/* Priming read from the field */
status = acpi_ex_field_datum_io (obj_desc, field_offset, &raw_datum, ACPI_READ);
status =
acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum,
ACPI_READ);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset;
merged_datum =
raw_datum >> obj_desc->common_field.start_field_bit_offset;
/* Read the rest of the field */
@@ -738,7 +736,8 @@ acpi_ex_extract_from_field (
buffer_length - buffer_offset));
buffer_offset += obj_desc->common_field.access_byte_width;
merged_datum = raw_datum >> obj_desc->common_field.start_field_bit_offset;
merged_datum =
raw_datum >> obj_desc->common_field.start_field_bit_offset;
}
/* Mask off any extra bits in the last datum */
@@ -758,7 +757,6 @@ acpi_ex_extract_from_field (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_insert_into_field
@@ -774,10 +772,8 @@ acpi_ex_extract_from_field (
******************************************************************************/
acpi_status
acpi_ex_insert_into_field (
union acpi_operand_object *obj_desc,
void *buffer,
u32 buffer_length)
acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
void *buffer, u32 buffer_length)
{
acpi_status status;
acpi_integer mask;
@@ -790,27 +786,29 @@ acpi_ex_insert_into_field (
u32 field_datum_count;
u32 i;
ACPI_FUNCTION_TRACE("ex_insert_into_field");
/* Validate input buffer */
if (buffer_length < ACPI_ROUND_BITS_UP_TO_BYTES (
obj_desc->common_field.bit_length)) {
if (buffer_length <
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Field size %X (bits) is too large for buffer (%X)\n",
obj_desc->common_field.bit_length, buffer_length));
obj_desc->common_field.bit_length,
buffer_length));
return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
}
/* Compute the number of datums (access width data items) */
mask = ACPI_MASK_BITS_BELOW (obj_desc->common_field.start_field_bit_offset);
datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length,
mask =
ACPI_MASK_BITS_BELOW(obj_desc->common_field.start_field_bit_offset);
datum_count =
ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length,
obj_desc->common_field.access_bit_width);
field_datum_count = ACPI_ROUND_UP_TO (obj_desc->common_field.bit_length +
field_datum_count =
ACPI_ROUND_UP_TO(obj_desc->common_field.bit_length +
obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.access_bit_width);
@@ -820,7 +818,8 @@ acpi_ex_insert_into_field (
ACPI_MIN(obj_desc->common_field.access_byte_width,
buffer_length - buffer_offset));
merged_datum = raw_datum << obj_desc->common_field.start_field_bit_offset;
merged_datum =
raw_datum << obj_desc->common_field.start_field_bit_offset;
/* Write the entire field */
@@ -829,7 +828,8 @@ acpi_ex_insert_into_field (
merged_datum &= mask;
status = acpi_ex_write_with_update_rule(obj_desc, mask,
merged_datum, field_offset);
merged_datum,
field_offset);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -852,7 +852,8 @@ acpi_ex_insert_into_field (
ACPI_MEMCPY(&raw_datum, ((char *)buffer) + buffer_offset,
ACPI_MIN(obj_desc->common_field.access_byte_width,
buffer_length - buffer_offset));
merged_datum |= raw_datum << obj_desc->common_field.start_field_bit_offset;
merged_datum |=
raw_datum << obj_desc->common_field.start_field_bit_offset;
}
/* Mask off any extra bits in the last datum */
@@ -868,9 +869,8 @@ acpi_ex_insert_into_field (
merged_datum &= mask;
status = acpi_ex_write_with_update_rule(obj_desc,
mask, merged_datum, field_offset);
mask, merged_datum,
field_offset);
return_ACPI_STATUS(status);
}

View File

@@ -42,16 +42,13 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exmisc")
/*******************************************************************************
*
* FUNCTION: acpi_ex_get_object_reference
@@ -66,20 +63,16 @@
* Common code for the ref_of_op and the cond_ref_of_op.
*
******************************************************************************/
acpi_status
acpi_ex_get_object_reference (
union acpi_operand_object *obj_desc,
acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
union acpi_operand_object **return_desc,
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *reference_obj;
union acpi_operand_object *referenced_obj;
ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
*return_desc = NULL;
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
@@ -104,13 +97,11 @@ acpi_ex_get_object_reference (
default:
ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n",
obj_desc->reference.opcode));
ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
break;
case ACPI_DESC_TYPE_NAMED:
/*
@@ -119,18 +110,16 @@ acpi_ex_get_object_reference (
referenced_obj = obj_desc;
break;
default:
ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n",
ACPI_GET_DESCRIPTOR_TYPE (obj_desc)));
ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
return_ACPI_STATUS(AE_TYPE);
}
/* Create a new reference object */
reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
reference_obj =
acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
if (!reference_obj) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -141,12 +130,12 @@ acpi_ex_get_object_reference (
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Object %p Type [%s], returning Reference %p\n",
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
obj_desc, acpi_ut_get_object_type_name(obj_desc),
*return_desc));
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_concat_template
@@ -163,8 +152,7 @@ acpi_ex_get_object_reference (
******************************************************************************/
acpi_status
acpi_ex_concat_template (
union acpi_operand_object *operand0,
acpi_ex_concat_template(union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
@@ -176,10 +164,8 @@ acpi_ex_concat_template (
acpi_size length1;
acpi_size length2;
ACPI_FUNCTION_TRACE("ex_concat_template");
/* Find the end_tags in each resource template */
end_tag1 = acpi_ut_get_resource_end_tag(operand0);
@@ -191,8 +177,7 @@ acpi_ex_concat_template (
/* Compute the length of each part */
length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer);
length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) +
2; /* Size of END_TAG */
length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */
/* Create a new buffer object for the result */
@@ -219,7 +204,6 @@ acpi_ex_concat_template (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_concatenate
@@ -236,8 +220,7 @@ acpi_ex_concat_template (
******************************************************************************/
acpi_status
acpi_ex_do_concatenate (
union acpi_operand_object *operand0,
acpi_ex_do_concatenate(union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state)
@@ -248,10 +231,8 @@ acpi_ex_do_concatenate (
acpi_status status;
acpi_size new_length;
ACPI_FUNCTION_TRACE("ex_do_concatenate");
/*
* Convert the second operand if necessary. The first operand
* determines the type of the second operand, (See the Data Types
@@ -261,7 +242,8 @@ acpi_ex_do_concatenate (
*/
switch (ACPI_GET_OBJECT_TYPE(operand0)) {
case ACPI_TYPE_INTEGER:
status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
break;
case ACPI_TYPE_STRING:
@@ -303,7 +285,8 @@ acpi_ex_do_concatenate (
/* Need enough buffer space for two integers */
return_desc = acpi_ut_create_buffer_object((acpi_size)
ACPI_MUL_2 (acpi_gbl_integer_byte_width));
ACPI_MUL_2
(acpi_gbl_integer_byte_width));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -345,8 +328,7 @@ acpi_ex_do_concatenate (
/* Concatenate the strings */
ACPI_STRCPY (new_buf,
operand0->string.pointer);
ACPI_STRCPY(new_buf, operand0->string.pointer);
ACPI_STRCPY(new_buf + operand0->string.length,
local_operand1->string.pointer);
break;
@@ -355,9 +337,12 @@ acpi_ex_do_concatenate (
/* Result of two Buffers is a Buffer */
return_desc = acpi_ut_create_buffer_object (
(acpi_size) operand0->buffer.length +
(acpi_size) local_operand1->buffer.length);
return_desc = acpi_ut_create_buffer_object((acpi_size)
operand0->buffer.
length +
(acpi_size)
local_operand1->
buffer.length);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -368,8 +353,7 @@ acpi_ex_do_concatenate (
/* Concatenate the buffers */
ACPI_MEMCPY(new_buf,
operand0->buffer.pointer,
operand0->buffer.length);
operand0->buffer.pointer, operand0->buffer.length);
ACPI_MEMCPY(new_buf + operand0->buffer.length,
local_operand1->buffer.pointer,
local_operand1->buffer.length);
@@ -394,7 +378,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_math_op
@@ -412,61 +395,48 @@ cleanup:
******************************************************************************/
acpi_integer
acpi_ex_do_math_op (
u16 opcode,
acpi_integer integer0,
acpi_integer integer1)
acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
{
ACPI_FUNCTION_ENTRY();
switch (opcode) {
case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */
return (integer0 + integer1);
case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
return (integer0 & integer1);
case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
return (~(integer0 & integer1));
case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
return (integer0 | integer1);
case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
return (~(integer0 | integer1));
case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
return (integer0 ^ integer1);
case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
return (integer0 * integer1);
case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
return (integer0 << integer1);
case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */
return (integer0 >> integer1);
case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
return (integer0 - integer1);
@@ -477,7 +447,6 @@ acpi_ex_do_math_op (
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_logical_numeric_op
@@ -499,19 +468,15 @@ acpi_ex_do_math_op (
******************************************************************************/
acpi_status
acpi_ex_do_logical_numeric_op (
u16 opcode,
acpi_ex_do_logical_numeric_op(u16 opcode,
acpi_integer integer0,
acpi_integer integer1,
u8 *logical_result)
acpi_integer integer1, u8 * logical_result)
{
acpi_status status = AE_OK;
u8 local_result = FALSE;
ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
switch (opcode) {
case AML_LAND_OP: /* LAnd (Integer0, Integer1) */
@@ -538,7 +503,6 @@ acpi_ex_do_logical_numeric_op (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_logical_op
@@ -566,11 +530,9 @@ acpi_ex_do_logical_numeric_op (
******************************************************************************/
acpi_status
acpi_ex_do_logical_op (
u16 opcode,
acpi_ex_do_logical_op(u16 opcode,
union acpi_operand_object *operand0,
union acpi_operand_object *operand1,
u8 *logical_result)
union acpi_operand_object *operand1, u8 * logical_result)
{
union acpi_operand_object *local_operand1 = operand1;
acpi_integer integer0;
@@ -581,10 +543,8 @@ acpi_ex_do_logical_op (
u8 local_result = FALSE;
int compare;
ACPI_FUNCTION_TRACE("ex_do_logical_op");
/*
* Convert the second operand if necessary. The first operand
* determines the type of the second operand, (See the Data Types
@@ -594,7 +554,8 @@ acpi_ex_do_logical_op (
*/
switch (ACPI_GET_OBJECT_TYPE(operand0)) {
case ACPI_TYPE_INTEGER:
status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
status =
acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
break;
case ACPI_TYPE_STRING:
@@ -652,8 +613,7 @@ acpi_ex_do_logical_op (
status = AE_AML_INTERNAL;
break;
}
}
else {
} else {
/*
* 2) Both operands are Strings or both are Buffers
* Note: Code below takes advantage of common Buffer/String
@@ -666,7 +626,8 @@ acpi_ex_do_logical_op (
/* Lexicographic compare: compare the data bytes */
compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
(const char * ) local_operand1->buffer.pointer,
(const char *)local_operand1->buffer.
pointer,
(length0 > length1) ? length1 : length0);
switch (opcode) {
@@ -674,8 +635,7 @@ acpi_ex_do_logical_op (
/* Length and all bytes must be equal */
if ((length0 == length1) &&
(compare == 0)) {
if ((length0 == length1) && (compare == 0)) {
/* Length and all bytes match ==> TRUE */
local_result = TRUE;
@@ -735,5 +695,3 @@ cleanup:
*logical_result = local_result;
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
@@ -50,13 +49,10 @@
ACPI_MODULE_NAME("exmutex")
/* Local prototypes */
static void
acpi_ex_link_mutex (
union acpi_operand_object *obj_desc,
acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread);
/*******************************************************************************
*
* FUNCTION: acpi_ex_unlink_mutex
@@ -69,13 +65,10 @@ acpi_ex_link_mutex (
*
******************************************************************************/
void
acpi_ex_unlink_mutex (
union acpi_operand_object *obj_desc)
void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
{
struct acpi_thread_state *thread = obj_desc->mutex.owner_thread;
if (!thread) {
return;
}
@@ -88,13 +81,11 @@ acpi_ex_unlink_mutex (
if (obj_desc->mutex.prev) {
(obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
}
else {
} else {
thread->acquired_mutex_list = obj_desc->mutex.next;
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_link_mutex
@@ -109,13 +100,11 @@ acpi_ex_unlink_mutex (
******************************************************************************/
static void
acpi_ex_link_mutex (
union acpi_operand_object *obj_desc,
acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
struct acpi_thread_state *thread)
{
union acpi_operand_object *list_head;
list_head = thread->acquired_mutex_list;
/* This object will be the first object in the list */
@@ -134,7 +123,6 @@ acpi_ex_link_mutex (
thread->acquired_mutex_list = obj_desc;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_acquire_mutex
@@ -150,17 +138,14 @@ acpi_ex_link_mutex (
******************************************************************************/
acpi_status
acpi_ex_acquire_mutex (
union acpi_operand_object *time_desc,
acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state)
{
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc);
if (!obj_desc) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -168,8 +153,7 @@ acpi_ex_acquire_mutex (
/* Sanity check -- we must have a valid thread ID */
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_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -178,9 +162,7 @@ acpi_ex_acquire_mutex (
* mutex. This mechanism provides some deadlock prevention
*/
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_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
}
@@ -215,7 +197,8 @@ acpi_ex_acquire_mutex (
obj_desc->mutex.owner_thread = walk_state->thread;
obj_desc->mutex.acquisition_depth = 1;
obj_desc->mutex.original_sync_level = walk_state->thread->current_sync_level;
obj_desc->mutex.original_sync_level =
walk_state->thread->current_sync_level;
walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
@@ -226,7 +209,6 @@ acpi_ex_acquire_mutex (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_release_mutex
@@ -241,16 +223,13 @@ acpi_ex_acquire_mutex (
******************************************************************************/
acpi_status
acpi_ex_release_mutex (
union acpi_operand_object *obj_desc,
acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ex_release_mutex");
if (!obj_desc) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -258,16 +237,14 @@ acpi_ex_release_mutex (
/* The mutex must have been previously acquired in order to release it */
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_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
}
/* Sanity check -- we must have a valid thread ID */
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_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -275,13 +252,10 @@ acpi_ex_release_mutex (
* The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release
*/
if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) &&
(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));
if ((obj_desc->mutex.owner_thread->thread_id !=
walk_state->thread->thread_id)
&& (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));
return_ACPI_STATUS(AE_AML_NOT_OWNER);
}
@@ -290,9 +264,7 @@ acpi_ex_release_mutex (
* equal to the 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_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
}
@@ -316,12 +288,12 @@ acpi_ex_release_mutex (
/* Update the mutex and walk state, restore sync_level before acquire */
obj_desc->mutex.owner_thread = NULL;
walk_state->thread->current_sync_level = obj_desc->mutex.original_sync_level;
walk_state->thread->current_sync_level =
obj_desc->mutex.original_sync_level;
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_release_all_mutexes
@@ -334,18 +306,14 @@ acpi_ex_release_mutex (
*
******************************************************************************/
void
acpi_ex_release_all_mutexes (
struct acpi_thread_state *thread)
void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
{
union acpi_operand_object *next = thread->acquired_mutex_list;
union acpi_operand_object *this;
acpi_status status;
ACPI_FUNCTION_ENTRY();
/* Traverse the list of owned mutexes, releasing each one */
while (next) {
@@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes (
thread->current_sync_level = this->mutex.original_sync_level;
}
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
@@ -51,17 +50,10 @@
ACPI_MODULE_NAME("exnames")
/* Local prototypes */
static char *
acpi_ex_allocate_name_string (
u32 prefix_count,
u32 num_name_segs);
static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs);
static acpi_status
acpi_ex_name_segment (
u8 **in_aml_address,
char *name_string);
acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
/*******************************************************************************
*
@@ -79,10 +71,7 @@ acpi_ex_name_segment (
*
******************************************************************************/
static char *
acpi_ex_allocate_name_string (
u32 prefix_count,
u32 num_name_segs)
static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
{
char *temp_ptr;
char *name_string;
@@ -90,7 +79,6 @@ acpi_ex_allocate_name_string (
ACPI_FUNCTION_TRACE("ex_allocate_name_string");
/*
* Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
* Also, one byte for the null terminator.
@@ -100,9 +88,9 @@ acpi_ex_allocate_name_string (
/* Special case for root */
size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
}
else {
size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
} else {
size_needed =
prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
}
/*
@@ -111,8 +99,7 @@ acpi_ex_allocate_name_string (
*/
name_string = ACPI_MEM_ALLOCATE(size_needed);
if (!name_string) {
ACPI_REPORT_ERROR ((
"ex_allocate_name_string: Could not allocate size %d\n", size_needed));
ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed));
return_PTR(NULL);
}
@@ -122,14 +109,12 @@ acpi_ex_allocate_name_string (
if (prefix_count == ACPI_UINT32_MAX) {
*temp_ptr++ = AML_ROOT_PREFIX;
}
else {
} else {
while (prefix_count--) {
*temp_ptr++ = AML_PARENT_PREFIX;
}
}
/* Set up Dual or Multi prefixes if needed */
if (num_name_segs > 2) {
@@ -137,8 +122,7 @@ acpi_ex_allocate_name_string (
*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
*temp_ptr++ = (char)num_name_segs;
}
else if (2 == num_name_segs) {
} else if (2 == num_name_segs) {
/* Set up dual prefixes */
*temp_ptr++ = AML_DUAL_NAME_PREFIX;
@@ -167,20 +151,15 @@ acpi_ex_allocate_name_string (
*
******************************************************************************/
static acpi_status
acpi_ex_name_segment (
u8 **in_aml_address,
char *name_string)
static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string)
{
char *aml_address = (void *)*in_aml_address;
acpi_status status = AE_OK;
u32 index;
char char_buf[5];
ACPI_FUNCTION_TRACE("ex_name_segment");
/*
* If first character is a digit, then we know that we aren't looking at a
* valid name segment
@@ -188,20 +167,20 @@ acpi_ex_name_segment (
char_buf[0] = *aml_address;
if ('0' <= char_buf[0] && char_buf[0] <= '9') {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0]));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n",
char_buf[0]));
return_ACPI_STATUS(AE_CTRL_PENDING);
}
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
for (index = 0;
(index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address));
index++) {
(index < ACPI_NAME_SIZE)
&& (acpi_ut_valid_acpi_character(*aml_address)); index++) {
char_buf[index] = *aml_address++;
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
}
/* Valid name segment */
if (index == 4) {
@@ -213,13 +192,11 @@ acpi_ex_name_segment (
ACPI_STRCAT(name_string, char_buf);
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Appended to - %s \n", name_string));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"No Name string - %s \n", char_buf));
}
}
else if (index == 0) {
} else if (index == 0) {
/*
* First character was not a valid name character,
* so we are looking at something other than a name.
@@ -228,8 +205,7 @@ acpi_ex_name_segment (
"Leading character is not alpha: %02Xh (not a name)\n",
char_buf[0]));
status = AE_CTRL_PENDING;
}
else {
} else {
/*
* Segment started with one or more valid characters, but fewer than
* the required 4
@@ -244,7 +220,6 @@ acpi_ex_name_segment (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_get_name_string
@@ -263,11 +238,9 @@ acpi_ex_name_segment (
******************************************************************************/
acpi_status
acpi_ex_get_name_string (
acpi_object_type data_type,
acpi_ex_get_name_string(acpi_object_type data_type,
u8 * in_aml_address,
char **out_name_string,
u32 *out_name_length)
char **out_name_string, u32 * out_name_length)
{
acpi_status status = AE_OK;
u8 *aml_address = in_aml_address;
@@ -276,10 +249,8 @@ acpi_ex_get_name_string (
u32 prefix_count = 0;
u8 has_prefix = FALSE;
ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address);
if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
@@ -288,12 +259,11 @@ acpi_ex_get_name_string (
name_string = acpi_ex_allocate_name_string(0, 1);
if (!name_string) {
status = AE_NO_MEMORY;
} else {
status =
acpi_ex_name_segment(&aml_address, name_string);
}
else {
status = acpi_ex_name_segment (&aml_address, name_string);
}
}
else {
} else {
/*
* data_type is not a field name.
* Examine first character of name for root or parent prefix operators
@@ -301,7 +271,8 @@ acpi_ex_get_name_string (
switch (*aml_address) {
case AML_ROOT_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
"root_prefix(\\) at %p\n",
aml_address));
/*
@@ -313,13 +284,13 @@ acpi_ex_get_name_string (
has_prefix = TRUE;
break;
case AML_PARENT_PREFIX:
/* Increment past possibly multiple parent prefixes */
do {
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
"parent_prefix (^) at %p\n",
aml_address));
aml_address++;
@@ -330,7 +301,6 @@ acpi_ex_get_name_string (
has_prefix = TRUE;
break;
default:
/* Not a prefix character */
@@ -343,11 +313,13 @@ acpi_ex_get_name_string (
switch (*aml_address) {
case AML_DUAL_NAME_PREFIX:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
"dual_name_prefix at %p\n",
aml_address));
aml_address++;
name_string = acpi_ex_allocate_name_string (prefix_count, 2);
name_string =
acpi_ex_allocate_name_string(prefix_count, 2);
if (!name_string) {
status = AE_NO_MEMORY;
break;
@@ -357,16 +329,19 @@ acpi_ex_get_name_string (
has_prefix = TRUE;
status = acpi_ex_name_segment (&aml_address, name_string);
status =
acpi_ex_name_segment(&aml_address, name_string);
if (ACPI_SUCCESS(status)) {
status = acpi_ex_name_segment (&aml_address, name_string);
status =
acpi_ex_name_segment(&aml_address,
name_string);
}
break;
case AML_MULTI_NAME_PREFIX_OP:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
"multi_name_prefix at %p\n",
aml_address));
/* Fetch count of segments remaining in name path */
@@ -374,7 +349,9 @@ acpi_ex_get_name_string (
aml_address++;
num_segments = *aml_address;
name_string = acpi_ex_allocate_name_string (prefix_count, num_segments);
name_string =
acpi_ex_allocate_name_string(prefix_count,
num_segments);
if (!name_string) {
status = AE_NO_MEMORY;
break;
@@ -386,14 +363,14 @@ acpi_ex_get_name_string (
has_prefix = TRUE;
while (num_segments &&
(status = acpi_ex_name_segment (&aml_address, name_string)) ==
AE_OK) {
(status =
acpi_ex_name_segment(&aml_address,
name_string)) == AE_OK) {
num_segments--;
}
break;
case 0:
/* null_name valid as of 8-12-98 ASL/AML Grammar Update */
@@ -406,7 +383,8 @@ acpi_ex_get_name_string (
/* Consume the NULL byte */
aml_address++;
name_string = acpi_ex_allocate_name_string (prefix_count, 0);
name_string =
acpi_ex_allocate_name_string(prefix_count, 0);
if (!name_string) {
status = AE_NO_MEMORY;
break;
@@ -414,18 +392,19 @@ acpi_ex_get_name_string (
break;
default:
/* Name segment string */
name_string = acpi_ex_allocate_name_string (prefix_count, 1);
name_string =
acpi_ex_allocate_name_string(prefix_count, 1);
if (!name_string) {
status = AE_NO_MEMORY;
break;
}
status = acpi_ex_name_segment (&aml_address, name_string);
status =
acpi_ex_name_segment(&aml_address, name_string);
break;
}
}
@@ -433,8 +412,8 @@ acpi_ex_get_name_string (
if (AE_CTRL_PENDING == status && has_prefix) {
/* Ran out of segments after processing a prefix */
ACPI_REPORT_ERROR (
("ex_do_name: Malformed Name at %p\n", name_string));
ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n",
name_string));
status = AE_AML_BAD_NAME;
}
@@ -450,5 +429,3 @@ acpi_ex_get_name_string (
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
@@ -50,11 +49,9 @@
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exoparg1")
/*!
* Naming convention for AML interpreter execution routines.
*
@@ -76,7 +73,6 @@
* The AcpiExOpcode* functions are called via the Dispatcher component with
* fully resolved operands.
!*/
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_0A_0T_1R
@@ -88,19 +84,14 @@
* DESCRIPTION: Execute operator with no operands, one return value
*
******************************************************************************/
acpi_status
acpi_ex_opcode_0A_0T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object *return_desc = NULL;
ACPI_FUNCTION_TRACE_STR("ex_opcode_0A_0T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
@@ -120,8 +111,7 @@ acpi_ex_opcode_0A_0T_1R (
default: /* Unknown opcode */
ACPI_REPORT_ERROR (("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_0A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
break;
}
@@ -132,8 +122,7 @@ cleanup:
if ((ACPI_FAILURE(status)) || walk_state->result_obj) {
acpi_ut_remove_reference(return_desc);
}
else {
} else {
/* Save the return value */
walk_state->result_obj = return_desc;
@@ -142,7 +131,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_1A_0T_0R
@@ -156,18 +144,14 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_opcode_1A_0T_0R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_0R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
@@ -176,41 +160,35 @@ acpi_ex_opcode_1A_0T_0R (
status = acpi_ex_release_mutex(operand[0], walk_state);
break;
case AML_RESET_OP: /* Reset (event_object) */
status = acpi_ex_system_reset_event(operand[0]);
break;
case AML_SIGNAL_OP: /* Signal (event_object) */
status = acpi_ex_system_signal_event(operand[0]);
break;
case AML_SLEEP_OP: /* Sleep (msec_time) */
status = acpi_ex_system_do_suspend(operand[0]->integer.value);
break;
case AML_STALL_OP: /* Stall (usec_time) */
status = acpi_ex_system_do_stall ((u32) operand[0]->integer.value);
status =
acpi_ex_system_do_stall((u32) operand[0]->integer.value);
break;
case AML_UNLOAD_OP: /* Unload (Handle) */
status = acpi_ex_unload_table(operand[0]);
break;
default: /* Unknown opcode */
ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
break;
}
@@ -218,7 +196,6 @@ acpi_ex_opcode_1A_0T_0R (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_1A_1T_0R
@@ -232,18 +209,14 @@ acpi_ex_opcode_1A_0T_0R (
*
******************************************************************************/
acpi_status
acpi_ex_opcode_1A_1T_0R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object **operand = &walk_state->operands[0];
ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_0R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
@@ -254,19 +227,16 @@ acpi_ex_opcode_1A_1T_0R (
default: /* Unknown opcode */
ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_0R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_1A_1T_1R
@@ -280,9 +250,7 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_opcode_1A_1T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object **operand = &walk_state->operands[0];
@@ -293,11 +261,9 @@ acpi_ex_opcode_1A_1T_1R (
acpi_integer power_of_ten;
acpi_integer digit;
ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_1T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
@@ -322,7 +288,6 @@ acpi_ex_opcode_1A_1T_1R (
return_desc->integer.value = ~operand[0]->integer.value;
break;
case AML_FIND_SET_LEFT_BIT_OP: /* find_set_left_bit (Operand, Result) */
return_desc->integer.value = operand[0]->integer.value;
@@ -339,7 +304,6 @@ acpi_ex_opcode_1A_1T_1R (
return_desc->integer.value = temp32;
break;
case AML_FIND_SET_RIGHT_BIT_OP: /* find_set_right_bit (Operand, Result) */
return_desc->integer.value = operand[0]->integer.value;
@@ -359,7 +323,6 @@ acpi_ex_opcode_1A_1T_1R (
(ACPI_INTEGER_BIT_SIZE + 1) - temp32;
break;
case AML_FROM_BCD_OP: /* from_bcd (BCDValue, Result) */
/*
@@ -373,7 +336,9 @@ acpi_ex_opcode_1A_1T_1R (
/* Convert each BCD digit (each is one nybble wide) */
for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
for (i = 0;
(i < acpi_gbl_integer_nybble_width) && (digit > 0);
i++) {
/* Get the least significant 4-bit BCD digit */
temp32 = ((u32) digit) & 0xF;
@@ -391,8 +356,8 @@ acpi_ex_opcode_1A_1T_1R (
/* Sum the digit into the result with the current power of 10 */
return_desc->integer.value += (((acpi_integer) temp32) *
power_of_ten);
return_desc->integer.value +=
(((acpi_integer) temp32) * power_of_ten);
/* Shift to next BCD digit */
@@ -404,7 +369,6 @@ acpi_ex_opcode_1A_1T_1R (
}
break;
case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */
return_desc->integer.value = 0;
@@ -412,15 +376,18 @@ acpi_ex_opcode_1A_1T_1R (
/* Each BCD digit is one nybble wide */
for (i = 0; (i < acpi_gbl_integer_nybble_width) && (digit > 0); i++) {
(void) acpi_ut_short_divide (digit, 10, &digit, &temp32);
for (i = 0;
(i < acpi_gbl_integer_nybble_width) && (digit > 0);
i++) {
(void)acpi_ut_short_divide(digit, 10, &digit,
&temp32);
/*
* Insert the BCD digit that resides in the
* remainder from above
*/
return_desc->integer.value |= (((acpi_integer) temp32) <<
ACPI_MUL_4 (i));
return_desc->integer.value |=
(((acpi_integer) temp32) << ACPI_MUL_4(i));
}
/* Overflow if there is any data left in Digit */
@@ -428,13 +395,15 @@ acpi_ex_opcode_1A_1T_1R (
if (digit > 0) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Integer too large to convert to BCD: %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (operand[0]->integer.value)));
ACPI_FORMAT_UINT64(operand
[0]->
integer.
value)));
status = AE_AML_NUMERIC_OVERFLOW;
goto cleanup;
}
break;
case AML_COND_REF_OF_OP: /* cond_ref_of (source_object, Result) */
/*
@@ -442,7 +411,8 @@ acpi_ex_opcode_1A_1T_1R (
* different than the return value stored in the result descriptor
* (There are really two return values)
*/
if ((struct acpi_namespace_node *) operand[0] == acpi_gbl_root_node) {
if ((struct acpi_namespace_node *)operand[0] ==
acpi_gbl_root_node) {
/*
* This means that the object does not exist in the namespace,
* return FALSE
@@ -454,12 +424,14 @@ acpi_ex_opcode_1A_1T_1R (
/* Get the object reference, store it, and remove our reference */
status = acpi_ex_get_object_reference(operand[0],
&return_desc2, walk_state);
&return_desc2,
walk_state);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
status = acpi_ex_store (return_desc2, operand[1], walk_state);
status =
acpi_ex_store(return_desc2, operand[1], walk_state);
acpi_ut_remove_reference(return_desc2);
/* The object exists in the namespace, return TRUE */
@@ -467,14 +439,12 @@ acpi_ex_opcode_1A_1T_1R (
return_desc->integer.value = ACPI_INTEGER_MAX;
goto cleanup;
default:
/* No other opcodes get here */
break;
}
break;
case AML_STORE_OP: /* Store (Source, Target) */
/*
@@ -501,17 +471,16 @@ acpi_ex_opcode_1A_1T_1R (
}
return_ACPI_STATUS(status);
/*
* ACPI 2.0 Opcodes
*/
case AML_COPY_OP: /* Copy (Source, Target) */
status = acpi_ut_copy_iobject_to_iobject (operand[0], &return_desc,
status =
acpi_ut_copy_iobject_to_iobject(operand[0], &return_desc,
walk_state);
break;
case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */
status = acpi_ex_convert_to_string(operand[0], &return_desc,
@@ -522,7 +491,6 @@ acpi_ex_opcode_1A_1T_1R (
}
break;
case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */
status = acpi_ex_convert_to_string(operand[0], &return_desc,
@@ -533,7 +501,6 @@ acpi_ex_opcode_1A_1T_1R (
}
break;
case AML_TO_BUFFER_OP: /* to_buffer (Data, Result) */
status = acpi_ex_convert_to_buffer(operand[0], &return_desc);
@@ -543,7 +510,6 @@ acpi_ex_opcode_1A_1T_1R (
}
break;
case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */
status = acpi_ex_convert_to_integer(operand[0], &return_desc,
@@ -554,7 +520,6 @@ acpi_ex_opcode_1A_1T_1R (
}
break;
case AML_SHIFT_LEFT_BIT_OP: /* shift_left_bit (Source, bit_num) */
case AML_SHIFT_RIGHT_BIT_OP: /* shift_right_bit (Source, bit_num) */
@@ -566,11 +531,9 @@ acpi_ex_opcode_1A_1T_1R (
status = AE_SUPPORT;
goto cleanup;
default: /* Unknown opcode */
ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
@@ -581,7 +544,6 @@ acpi_ex_opcode_1A_1T_1R (
status = acpi_ex_store(return_desc, operand[1], walk_state);
}
cleanup:
if (!walk_state->result_obj) {
@@ -597,7 +559,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_1A_0T_1R
@@ -610,9 +571,7 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_opcode_1A_0T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *temp_desc;
@@ -621,11 +580,9 @@ acpi_ex_opcode_1A_0T_1R (
u32 type;
acpi_integer value;
ACPI_FUNCTION_TRACE_STR("ex_opcode_1A_0T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the AML opcode */
switch (walk_state->opcode) {
@@ -646,7 +603,6 @@ acpi_ex_opcode_1A_0T_1R (
}
break;
case AML_DECREMENT_OP: /* Decrement (Operand) */
case AML_INCREMENT_OP: /* Increment (Operand) */
@@ -665,7 +621,8 @@ acpi_ex_opcode_1A_0T_1R (
* NS Node or an internal object.
*/
temp_desc = operand[0];
if (ACPI_GET_DESCRIPTOR_TYPE (temp_desc) == ACPI_DESC_TYPE_OPERAND) {
if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc) ==
ACPI_DESC_TYPE_OPERAND) {
/* Internal reference object - prevent deletion */
acpi_ut_add_reference(temp_desc);
@@ -678,10 +635,14 @@ acpi_ex_opcode_1A_0T_1R (
* NOTE: We use LNOT_OP here in order to force resolution of the
* reference operand to an actual integer.
*/
status = acpi_ex_resolve_operands (AML_LNOT_OP, &temp_desc, walk_state);
status =
acpi_ex_resolve_operands(AML_LNOT_OP, &temp_desc,
walk_state);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
acpi_ps_get_opcode_name (walk_state->opcode),
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"%s: bad operand(s) %s\n",
acpi_ps_get_opcode_name(walk_state->
opcode),
acpi_format_exception(status)));
goto cleanup;
@@ -692,10 +653,11 @@ acpi_ex_opcode_1A_0T_1R (
* Perform the actual increment or decrement
*/
if (walk_state->opcode == AML_INCREMENT_OP) {
return_desc->integer.value = temp_desc->integer.value +1;
}
else {
return_desc->integer.value = temp_desc->integer.value -1;
return_desc->integer.value =
temp_desc->integer.value + 1;
} else {
return_desc->integer.value =
temp_desc->integer.value - 1;
}
/* Finished with this Integer object */
@@ -709,7 +671,6 @@ acpi_ex_opcode_1A_0T_1R (
status = acpi_ex_store(return_desc, operand[0], walk_state);
break;
case AML_TYPE_OP: /* object_type (source_object) */
/*
@@ -721,7 +682,9 @@ acpi_ex_opcode_1A_0T_1R (
/* Get the type of the base object */
status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL);
status =
acpi_ex_resolve_multiple(walk_state, operand[0], &type,
NULL);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
@@ -736,7 +699,6 @@ acpi_ex_opcode_1A_0T_1R (
return_desc->integer.value = type;
break;
case AML_SIZE_OF_OP: /* size_of (source_object) */
/*
@@ -747,7 +709,8 @@ acpi_ex_opcode_1A_0T_1R (
/* Get the base object */
status = acpi_ex_resolve_multiple(walk_state,
operand[0], &type, &temp_desc);
operand[0], &type,
&temp_desc);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
@@ -799,21 +762,22 @@ acpi_ex_opcode_1A_0T_1R (
return_desc->integer.value = value;
break;
case AML_REF_OF_OP: /* ref_of (source_object) */
status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state);
status =
acpi_ex_get_object_reference(operand[0], &return_desc,
walk_state);
if (ACPI_FAILURE(status)) {
goto cleanup;
}
break;
case AML_DEREF_OF_OP: /* deref_of (obj_reference | String) */
/* Check for a method local or argument, or standalone String */
if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) {
if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) !=
ACPI_DESC_TYPE_NAMED) {
switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
case ACPI_TYPE_LOCAL_REFERENCE:
/*
@@ -827,8 +791,9 @@ acpi_ex_opcode_1A_0T_1R (
/* Set Operand[0] to the value of the local/arg */
status = acpi_ds_method_data_get_value (
operand[0]->reference.opcode,
status =
acpi_ds_method_data_get_value
(operand[0]->reference.opcode,
operand[0]->reference.offset,
walk_state, &temp_desc);
if (ACPI_FAILURE(status)) {
@@ -847,7 +812,8 @@ acpi_ex_opcode_1A_0T_1R (
/* Get the object to which the reference refers */
temp_desc = operand[0]->reference.object;
temp_desc =
operand[0]->reference.object;
acpi_ut_remove_reference(operand[0]);
operand[0] = temp_desc;
break;
@@ -859,7 +825,6 @@ acpi_ex_opcode_1A_0T_1R (
}
break;
case ACPI_TYPE_STRING:
/*
@@ -870,22 +835,28 @@ acpi_ex_opcode_1A_0T_1R (
* 2) Dereference the node to an actual object. Could be a
* Field, so we need to resolve the node to a value.
*/
status = acpi_ns_get_node_by_path (operand[0]->string.pointer,
walk_state->scope_info->scope.node,
status =
acpi_ns_get_node_by_path(operand[0]->string.
pointer,
walk_state->
scope_info->scope.
node,
ACPI_NS_SEARCH_PARENT,
ACPI_CAST_INDIRECT_PTR (
struct acpi_namespace_node, &return_desc));
ACPI_CAST_INDIRECT_PTR
(struct
acpi_namespace_node,
&return_desc));
if (ACPI_FAILURE(status)) {
goto cleanup;
}
status = acpi_ex_resolve_node_to_value (
ACPI_CAST_INDIRECT_PTR (
struct acpi_namespace_node, &return_desc),
status =
acpi_ex_resolve_node_to_value
(ACPI_CAST_INDIRECT_PTR
(struct acpi_namespace_node, &return_desc),
walk_state);
goto cleanup;
default:
status = AE_AML_OPERAND_TYPE;
@@ -895,18 +866,20 @@ acpi_ex_opcode_1A_0T_1R (
/* Operand[0] may have changed from the code above */
if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) {
if (ACPI_GET_DESCRIPTOR_TYPE(operand[0]) ==
ACPI_DESC_TYPE_NAMED) {
/*
* This is a deref_of (object_reference)
* Get the actual object from the Node (This is the dereference).
* This case may only happen when a local_x or arg_x is
* dereferenced above.
*/
return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) operand[0]);
return_desc = acpi_ns_get_attached_object((struct
acpi_namespace_node
*)
operand[0]);
acpi_ut_add_reference(return_desc);
}
else {
} else {
/*
* This must be a reference object produced by either the
* Index() or ref_of() operator
@@ -921,7 +894,8 @@ acpi_ex_opcode_1A_0T_1R (
switch (operand[0]->reference.target_type) {
case ACPI_TYPE_BUFFER_FIELD:
temp_desc = operand[0]->reference.object;
temp_desc =
operand[0]->reference.object;
/*
* Create a new object that contains one element of the
@@ -931,7 +905,9 @@ acpi_ex_opcode_1A_0T_1R (
* sub-buffer of the main buffer, it is only a pointer to a
* single element (byte) of the buffer!
*/
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
return_desc =
acpi_ut_create_internal_object
(ACPI_TYPE_INTEGER);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -943,35 +919,38 @@ acpi_ex_opcode_1A_0T_1R (
* reference to the buffer itself.
*/
return_desc->integer.value =
temp_desc->buffer.pointer[operand[0]->reference.offset];
temp_desc->buffer.
pointer[operand[0]->reference.
offset];
break;
case ACPI_TYPE_PACKAGE:
/*
* Return the referenced element of the package. We must
* add another reference to the referenced object, however.
*/
return_desc = *(operand[0]->reference.where);
return_desc =
*(operand[0]->reference.where);
if (return_desc) {
acpi_ut_add_reference (return_desc);
acpi_ut_add_reference
(return_desc);
}
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown Index target_type %X in obj %p\n",
operand[0]->reference.target_type, operand[0]));
operand[0]->reference.
target_type,
operand[0]));
status = AE_AML_OPERAND_TYPE;
goto cleanup;
}
break;
case AML_REF_OF_OP:
return_desc = operand[0]->reference.object;
@@ -979,8 +958,11 @@ acpi_ex_opcode_1A_0T_1R (
if (ACPI_GET_DESCRIPTOR_TYPE(return_desc) ==
ACPI_DESC_TYPE_NAMED) {
return_desc = acpi_ns_get_attached_object (
(struct acpi_namespace_node *) return_desc);
return_desc =
acpi_ns_get_attached_object((struct
acpi_namespace_node
*)
return_desc);
}
/* Add another reference to the object! */
@@ -988,11 +970,12 @@ acpi_ex_opcode_1A_0T_1R (
acpi_ut_add_reference(return_desc);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown opcode in ref(%p) - %X\n",
operand[0], operand[0]->reference.opcode));
operand[0],
operand[0]->reference.
opcode));
status = AE_TYPE;
goto cleanup;
@@ -1000,16 +983,13 @@ acpi_ex_opcode_1A_0T_1R (
}
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
cleanup:
/* Delete return object on error */
@@ -1021,4 +1001,3 @@ cleanup:
walk_state->result_obj = return_desc;
return_ACPI_STATUS(status);
}

View File

@@ -41,18 +41,15 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acinterp.h>
#include <acpi/acevents.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exoparg2")
/*!
* Naming convention for AML interpreter execution routines.
*
@@ -74,8 +71,6 @@
* The AcpiExOpcode* functions are called via the Dispatcher component with
* fully resolved operands.
!*/
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_2A_0T_0R
@@ -90,21 +85,16 @@
* ALLOCATION: Deletes both operands
*
******************************************************************************/
acpi_status
acpi_ex_opcode_2A_0T_0R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
struct acpi_namespace_node *node;
u32 value;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Examine the opcode */
switch (walk_state->opcode) {
@@ -128,7 +118,6 @@ acpi_ex_opcode_2A_0T_0R (
status = AE_AML_OPERAND_TYPE;
break;
}
#ifdef ACPI_GPE_NOTIFY_CHECK
/*
* GPE method wake/notify check. Here, we want to ensure that we
@@ -144,8 +133,10 @@ acpi_ex_opcode_2A_0T_0R (
* If all three cases are true, this is a wake-only GPE that should
* be disabled at runtime.
*/
if (value == 2) /* device_wake */ {
status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info);
if (value == 2) { /* device_wake */
status =
acpi_ev_check_for_wake_only_gpe(walk_state->
gpe_event_info);
if (ACPI_FAILURE(status)) {
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
@@ -164,18 +155,15 @@ acpi_ex_opcode_2A_0T_0R (
status = acpi_ev_queue_notify_request(node, value);
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_2A_2T_1R
@@ -189,20 +177,16 @@ acpi_ex_opcode_2A_0T_0R (
*
******************************************************************************/
acpi_status
acpi_ex_opcode_2A_2T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc1 = NULL;
union acpi_operand_object *return_desc2 = NULL;
acpi_status status;
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Execute the opcode */
switch (walk_state->opcode) {
@@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R (
/* Divide (Dividend, Divisor, remainder_result quotient_result) */
return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
return_desc1 =
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!return_desc1) {
status = AE_NO_MEMORY;
goto cleanup;
}
return_desc2 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
return_desc2 =
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
if (!return_desc2) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -233,11 +219,9 @@ acpi_ex_opcode_2A_2T_1R (
}
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
@@ -258,7 +242,6 @@ acpi_ex_opcode_2A_2T_1R (
walk_state->result_obj = return_desc1;
cleanup:
/*
* Since the remainder is not returned indirectly, remove a reference to
@@ -275,7 +258,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_2A_1T_1R
@@ -289,9 +271,7 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_opcode_2A_1T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
@@ -299,11 +279,9 @@ acpi_ex_opcode_2A_1T_1R (
acpi_status status = AE_OK;
acpi_size length;
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Execute the opcode */
if (walk_state->op_info->flags & AML_MATH) {
@@ -315,7 +293,8 @@ acpi_ex_opcode_2A_1T_1R (
goto cleanup;
}
return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode,
return_desc->integer.value =
acpi_ex_do_math_op(walk_state->opcode,
operand[0]->integer.value,
operand[1]->integer.value);
goto store_result_to_target;
@@ -334,18 +313,15 @@ acpi_ex_opcode_2A_1T_1R (
status = acpi_ut_divide(operand[0]->integer.value,
operand[1]->integer.value,
NULL,
&return_desc->integer.value);
NULL, &return_desc->integer.value);
break;
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
status = acpi_ex_do_concatenate(operand[0], operand[1],
&return_desc, walk_state);
break;
case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
/*
@@ -388,7 +364,6 @@ acpi_ex_opcode_2A_1T_1R (
operand[0]->buffer.pointer, length);
break;
case AML_CONCAT_RES_OP:
/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
@@ -397,12 +372,12 @@ acpi_ex_opcode_2A_1T_1R (
&return_desc, walk_state);
break;
case AML_INDEX_OP: /* Index (Source Index Result) */
/* Create the internal return object */
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
return_desc =
acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -418,28 +393,30 @@ acpi_ex_opcode_2A_1T_1R (
if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Index value (%X%8.8X) beyond package end (%X)\n",
ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
ACPI_FORMAT_UINT64(index),
operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT;
goto cleanup;
}
return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
return_desc->reference.object = operand[0];
return_desc->reference.where = &operand[0]->package.elements [
index];
}
else {
return_desc->reference.where =
&operand[0]->package.elements[index];
} else {
/* Object to be indexed is a Buffer/String */
if (index >= operand[0]->buffer.length) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Index value (%X%8.8X) beyond end of buffer (%X)\n",
ACPI_FORMAT_UINT64 (index), operand[0]->buffer.length));
ACPI_FORMAT_UINT64(index),
operand[0]->buffer.length));
status = AE_AML_BUFFER_LIMIT;
goto cleanup;
}
return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
return_desc->reference.target_type =
ACPI_TYPE_BUFFER_FIELD;
return_desc->reference.object = operand[0];
}
@@ -463,16 +440,13 @@ acpi_ex_opcode_2A_1T_1R (
walk_state->result_obj = return_desc;
goto cleanup;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
break;
}
store_result_to_target:
if (ACPI_SUCCESS(status)) {
@@ -490,7 +464,6 @@ store_result_to_target:
}
}
cleanup:
/* Delete return object on error */
@@ -502,7 +475,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_2A_0T_1R
@@ -515,20 +487,16 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_opcode_2A_0T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
acpi_status status = AE_OK;
u8 logical_result = FALSE;
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
/* Create the internal return object */
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -543,11 +511,12 @@ acpi_ex_opcode_2A_0T_1R (
/* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
operand[0]->integer.value, operand[1]->integer.value,
&logical_result);
operand[0]->integer.
value,
operand[1]->integer.
value, &logical_result);
goto store_logical_result;
}
else if (walk_state->op_info->flags & AML_LOGICAL) {
} else if (walk_state->op_info->flags & AML_LOGICAL) {
/* logical_op (Operand0, Operand1) */
status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
@@ -558,14 +527,14 @@ acpi_ex_opcode_2A_0T_1R (
switch (walk_state->opcode) {
case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
status = acpi_ex_acquire_mutex (operand[1], operand[0], walk_state);
status =
acpi_ex_acquire_mutex(operand[1], operand[0], walk_state);
if (status == AE_TIME) {
logical_result = TRUE; /* TRUE = Acquire timed out */
status = AE_OK;
}
break;
case AML_WAIT_OP: /* Wait (event_object, Timeout) */
status = acpi_ex_system_wait_event(operand[1], operand[0]);
@@ -575,16 +544,13 @@ acpi_ex_opcode_2A_0T_1R (
}
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
store_logical_result:
/*
* Set return value to according to logical_result. logical TRUE (all ones)
@@ -596,7 +562,6 @@ store_logical_result:
walk_state->result_obj = return_desc;
cleanup:
/* Delete return object on error */
@@ -607,5 +572,3 @@ cleanup:
return_ACPI_STATUS(status);
}

View File

@@ -42,17 +42,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exoparg3")
/*!
* Naming convention for AML interpreter execution routines.
*
@@ -74,8 +71,6 @@
* The AcpiExOpcode* functions are called via the Dispatcher component with
* fully resolved operands.
!*/
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_3A_0T_0R
@@ -87,20 +82,15 @@
* DESCRIPTION: Execute Triadic operator (3 operands)
*
******************************************************************************/
acpi_status
acpi_ex_opcode_3A_0T_0R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
struct acpi_signal_fatal_info *fatal;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R",
acpi_ps_get_opcode_name(walk_state->opcode));
switch (walk_state->opcode) {
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
@@ -110,7 +100,8 @@ acpi_ex_opcode_3A_0T_0R (
(u32) operand[1]->integer.value,
(u32) operand[2]->integer.value));
fatal = ACPI_MEM_ALLOCATE (sizeof (struct acpi_signal_fatal_info));
fatal =
ACPI_MEM_ALLOCATE(sizeof(struct acpi_signal_fatal_info));
if (fatal) {
fatal->type = (u32) operand[0]->integer.value;
fatal->code = (u32) operand[1]->integer.value;
@@ -126,22 +117,18 @@ acpi_ex_opcode_3A_0T_0R (
ACPI_MEM_FREE(fatal);
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_3A_1T_1R
@@ -154,9 +141,7 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ex_opcode_3A_1T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
@@ -165,11 +150,9 @@ acpi_ex_opcode_3A_1T_1R (
acpi_integer index;
acpi_size length;
ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
switch (walk_state->opcode) {
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
@@ -177,8 +160,9 @@ acpi_ex_opcode_3A_1T_1R (
* Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type.
*/
return_desc = acpi_ut_create_internal_object (
ACPI_GET_OBJECT_TYPE (operand[0]));
return_desc =
acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
(operand[0]));
if (!return_desc) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -256,11 +240,9 @@ acpi_ex_opcode_3A_1T_1R (
return_desc->buffer.flags |= AOPOBJ_DATA_VALID;
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
@@ -284,5 +266,3 @@ cleanup:
}
return_ACPI_STATUS(status);
}

View File

@@ -42,17 +42,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exoparg6")
/*!
* Naming convention for AML interpreter execution routines.
*
@@ -74,16 +71,12 @@
* The AcpiExOpcode* functions are called via the Dispatcher component with
* fully resolved operands.
!*/
/* Local prototypes */
static u8
acpi_ex_do_match (
u32 match_op,
acpi_ex_do_match(u32 match_op,
union acpi_operand_object *package_obj,
union acpi_operand_object *match_obj);
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_match
@@ -101,15 +94,13 @@ acpi_ex_do_match (
******************************************************************************/
static u8
acpi_ex_do_match (
u32 match_op,
acpi_ex_do_match(u32 match_op,
union acpi_operand_object *package_obj,
union acpi_operand_object *match_obj)
{
u8 logical_result = TRUE;
acpi_status status;
/*
* Note: Since the package_obj/match_obj ordering is opposite to that of
* the standard logical operators, we have to reverse them when we call
@@ -133,7 +124,8 @@ acpi_ex_do_match (
* True if equal: (P[i] == M)
* Change to: (M == P[i])
*/
status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj,
status =
acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
&logical_result);
if (ACPI_FAILURE(status)) {
return (FALSE);
@@ -146,7 +138,8 @@ acpi_ex_do_match (
* True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
* Change to: (M >= P[i]) (M not_less than P[i])
*/
status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
status =
acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
&logical_result);
if (ACPI_FAILURE(status)) {
return (FALSE);
@@ -160,8 +153,9 @@ acpi_ex_do_match (
* True if less than: (P[i] < M)
* Change to: (M > P[i])
*/
status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
&logical_result);
status =
acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
package_obj, &logical_result);
if (ACPI_FAILURE(status)) {
return (FALSE);
}
@@ -173,8 +167,9 @@ acpi_ex_do_match (
* True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
* Change to: (M <= P[i]) (M not_greater than P[i])
*/
status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
&logical_result);
status =
acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
package_obj, &logical_result);
if (ACPI_FAILURE(status)) {
return (FALSE);
}
@@ -187,7 +182,8 @@ acpi_ex_do_match (
* True if greater than: (P[i] > M)
* Change to: (M < P[i])
*/
status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
status =
acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
&logical_result);
if (ACPI_FAILURE(status)) {
return (FALSE);
@@ -204,7 +200,6 @@ acpi_ex_do_match (
return logical_result;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_6A_0T_1R
@@ -217,9 +212,7 @@ acpi_ex_do_match (
*
******************************************************************************/
acpi_status
acpi_ex_opcode_6A_0T_1R (
struct acpi_walk_state *walk_state)
acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
{
union acpi_operand_object **operand = &walk_state->operands[0];
union acpi_operand_object *return_desc = NULL;
@@ -227,11 +220,9 @@ acpi_ex_opcode_6A_0T_1R (
acpi_integer index;
union acpi_operand_object *this_element;
ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R",
acpi_ps_get_opcode_name(walk_state->opcode));
switch (walk_state->opcode) {
case AML_MATCH_OP:
/*
@@ -243,7 +234,8 @@ acpi_ex_opcode_6A_0T_1R (
if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
(operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Match operator out of range\n"));
status = AE_AML_OPERAND_VALUE;
goto cleanup;
}
@@ -254,7 +246,8 @@ acpi_ex_opcode_6A_0T_1R (
if (index >= operand[0]->package.count) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Index (%X%8.8X) beyond package end (%X)\n",
ACPI_FORMAT_UINT64 (index), operand[0]->package.count));
ACPI_FORMAT_UINT64(index),
operand[0]->package.count));
status = AE_AML_PACKAGE_LIMIT;
goto cleanup;
}
@@ -316,24 +309,20 @@ acpi_ex_opcode_6A_0T_1R (
}
break;
case AML_LOAD_TABLE_OP:
status = acpi_ex_load_table_op(walk_state, &return_desc);
break;
default:
ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
walk_state->opcode));
ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
status = AE_AML_BAD_OPCODE;
goto cleanup;
}
walk_state->result_obj = return_desc;
cleanup:
/* Delete return object on error */

View File

@@ -42,32 +42,24 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exprep")
/* Local prototypes */
static u32
acpi_ex_decode_field_access (
union acpi_operand_object *obj_desc,
u8 field_flags,
u32 *return_byte_alignment);
acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
u8 field_flags, u32 * return_byte_alignment);
#ifdef ACPI_UNDER_DEVELOPMENT
static u32
acpi_ex_generate_access (
u32 field_bit_offset,
u32 field_bit_length,
u32 region_length);
acpi_ex_generate_access(u32 field_bit_offset,
u32 field_bit_length, u32 region_length);
/*******************************************************************************
*
@@ -92,10 +84,8 @@ acpi_ex_generate_access (
******************************************************************************/
static u32
acpi_ex_generate_access (
u32 field_bit_offset,
u32 field_bit_length,
u32 region_length)
acpi_ex_generate_access(u32 field_bit_offset,
u32 field_bit_length, u32 region_length)
{
u32 field_byte_length;
u32 field_byte_offset;
@@ -107,10 +97,8 @@ acpi_ex_generate_access (
u32 minimum_accesses = 0xFFFFFFFF;
u32 accesses;
ACPI_FUNCTION_TRACE("ex_generate_access");
/* Round Field start offset and length to "minimal" byte boundaries */
field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8));
@@ -124,7 +112,8 @@ acpi_ex_generate_access (
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"Byte Length %d, Byte Offset %d, End Offset %d\n",
field_byte_length, field_byte_offset, field_byte_end_offset));
field_byte_length, field_byte_offset,
field_byte_end_offset));
/*
* Iterative search for the maximum access width that is both aligned
@@ -132,7 +121,8 @@ acpi_ex_generate_access (
*
* Start at byte_acc and work upwards to qword_acc max. (1,2,4,8 bytes)
*/
for (access_byte_width = 1; access_byte_width <= 8; access_byte_width <<= 1) {
for (access_byte_width = 1; access_byte_width <= 8;
access_byte_width <<= 1) {
/*
* 1) Round end offset up to next access boundary and make sure that
* this does not go beyond the end of the parent region.
@@ -140,23 +130,29 @@ acpi_ex_generate_access (
* are done. (This does not optimize for the perfectly aligned
* case yet).
*/
if (ACPI_ROUND_UP (field_byte_end_offset, access_byte_width) <= region_length) {
if (ACPI_ROUND_UP(field_byte_end_offset, access_byte_width) <=
region_length) {
field_start_offset =
ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
ACPI_ROUND_DOWN(field_byte_offset,
access_byte_width) /
access_byte_width;
field_end_offset =
ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
access_byte_width) / access_byte_width;
ACPI_ROUND_UP((field_byte_length +
field_byte_offset),
access_byte_width) /
access_byte_width;
accesses = field_end_offset - field_start_offset;
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"access_width %d end is within region\n", access_byte_width));
"access_width %d end is within region\n",
access_byte_width));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"Field Start %d, Field End %d -- requires %d accesses\n",
field_start_offset, field_end_offset, accesses));
field_start_offset, field_end_offset,
accesses));
/* Single access is optimal */
@@ -175,10 +171,10 @@ acpi_ex_generate_access (
minimum_accesses = accesses;
minimum_access_width = access_byte_width;
}
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"access_width %d end is NOT within region\n", access_byte_width));
"access_width %d end is NOT within region\n",
access_byte_width));
if (access_byte_width == 1) {
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"Field goes beyond end-of-region!\n"));
@@ -209,7 +205,6 @@ acpi_ex_generate_access (
}
#endif /* ACPI_UNDER_DEVELOPMENT */
/*******************************************************************************
*
* FUNCTION: acpi_ex_decode_field_access
@@ -226,19 +221,15 @@ acpi_ex_generate_access (
******************************************************************************/
static u32
acpi_ex_decode_field_access (
union acpi_operand_object *obj_desc,
u8 field_flags,
u32 *return_byte_alignment)
acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
u8 field_flags, u32 * return_byte_alignment)
{
u32 access;
u32 byte_alignment;
u32 bit_length;
ACPI_FUNCTION_TRACE("ex_decode_field_access");
access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
switch (access) {
@@ -246,9 +237,12 @@ acpi_ex_decode_field_access (
#ifdef ACPI_UNDER_DEVELOPMENT
byte_alignment =
acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
acpi_ex_generate_access(obj_desc->common_field.
start_field_bit_offset,
obj_desc->common_field.bit_length,
0xFFFFFFFF /* Temp until we pass region_length as parameter */);
0xFFFFFFFF
/* Temp until we pass region_length as parameter */
);
bit_length = byte_alignment * 8;
#endif
@@ -281,8 +275,7 @@ acpi_ex_decode_field_access (
/* Invalid field access type */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unknown field access type %X\n",
access));
"Unknown field access type %X\n", access));
return_VALUE(0);
}
@@ -299,7 +292,6 @@ acpi_ex_decode_field_access (
return_VALUE(bit_length);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_prep_common_field_object
@@ -322,21 +314,17 @@ acpi_ex_decode_field_access (
******************************************************************************/
acpi_status
acpi_ex_prep_common_field_object (
union acpi_operand_object *obj_desc,
acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
u8 field_flags,
u8 field_attribute,
u32 field_bit_position,
u32 field_bit_length)
u32 field_bit_position, u32 field_bit_length)
{
u32 access_bit_width;
u32 byte_alignment;
u32 nearest_byte_address;
ACPI_FUNCTION_TRACE("ex_prep_common_field_object");
/*
* Note: the structure being initialized is the
* ACPI_COMMON_FIELD_INFO; No structure fields outside of the common
@@ -394,21 +382,21 @@ acpi_ex_prep_common_field_object (
* a field datum.
*/
obj_desc->common_field.start_field_bit_offset = (u8)
(field_bit_position - ACPI_MUL_8 (obj_desc->common_field.base_byte_offset));
(field_bit_position -
ACPI_MUL_8(obj_desc->common_field.base_byte_offset));
/*
* Does the entire field fit within a single field access element? (datum)
* (i.e., without crossing a datum boundary)
*/
if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <=
(u16) access_bit_width) {
if ((obj_desc->common_field.start_field_bit_offset +
field_bit_length) <= (u16) access_bit_width) {
obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_prep_field_value
@@ -422,18 +410,14 @@ acpi_ex_prep_common_field_object (
*
******************************************************************************/
acpi_status
acpi_ex_prep_field_value (
struct acpi_create_field_info *info)
acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
{
union acpi_operand_object *obj_desc;
u32 type;
acpi_status status;
ACPI_FUNCTION_TRACE("ex_prep_field_value");
/* Parameter validation */
if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
@@ -463,7 +447,9 @@ acpi_ex_prep_field_value (
obj_desc->common_field.node = info->field_node;
status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags,
info->attribute, info->field_bit_position, info->field_bit_length);
info->attribute,
info->field_bit_position,
info->field_bit_length);
if (ACPI_FAILURE(status)) {
acpi_ut_delete_object_desc(obj_desc);
return_ACPI_STATUS(status);
@@ -474,7 +460,8 @@ acpi_ex_prep_field_value (
switch (info->field_type) {
case ACPI_TYPE_LOCAL_REGION_FIELD:
obj_desc->field.region_obj = acpi_ns_get_attached_object (info->region_node);
obj_desc->field.region_obj =
acpi_ns_get_attached_object(info->region_node);
/* An additional reference for the container */
@@ -482,18 +469,19 @@ acpi_ex_prep_field_value (
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
obj_desc->field.start_field_bit_offset, obj_desc->field.base_byte_offset,
obj_desc->field.access_byte_width, obj_desc->field.region_obj));
obj_desc->field.start_field_bit_offset,
obj_desc->field.base_byte_offset,
obj_desc->field.access_byte_width,
obj_desc->field.region_obj));
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
obj_desc->bank_field.value = info->bank_value;
obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
info->region_node);
obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
info->register_node);
obj_desc->bank_field.region_obj =
acpi_ns_get_attached_object(info->region_node);
obj_desc->bank_field.bank_obj =
acpi_ns_get_attached_object(info->register_node);
/* An additional reference for the attached objects */
@@ -509,18 +497,18 @@ acpi_ex_prep_field_value (
obj_desc->bank_field.bank_obj));
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
info->register_node);
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
info->data_register_node);
obj_desc->index_field.index_obj =
acpi_ns_get_attached_object(info->register_node);
obj_desc->index_field.data_obj =
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));
(info->field_bit_position /
ACPI_MUL_8(obj_desc->field.access_byte_width));
if (!obj_desc->index_field.data_obj || !obj_desc->index_field.index_obj) {
if (!obj_desc->index_field.data_obj
|| !obj_desc->index_field.index_obj) {
ACPI_REPORT_ERROR(("Null Index Object during field prep\n"));
acpi_ut_delete_object_desc(obj_desc);
return_ACPI_STATUS(AE_AML_INTERNAL);
@@ -553,12 +541,13 @@ acpi_ex_prep_field_value (
status = acpi_ns_attach_object(info->field_node, obj_desc,
acpi_ns_get_type(info->field_node));
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n",
info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"Set named_obj %p [%4.4s], obj_desc %p\n",
info->field_node,
acpi_ut_get_node_name(info->field_node), obj_desc));
/* Remove local reference to the object */
acpi_ut_remove_reference(obj_desc);
return_ACPI_STATUS(status);
}

View File

@@ -42,15 +42,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exregion")
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_memory_space_handler
@@ -68,15 +65,12 @@
* DESCRIPTION: Handler for the System Memory address space (Op Region)
*
******************************************************************************/
acpi_status
acpi_ex_system_memory_space_handler (
u32 function,
acpi_ex_system_memory_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
acpi_status status = AE_OK;
void *logical_addr_ptr = NULL;
@@ -89,7 +83,6 @@ acpi_ex_system_memory_space_handler (
ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
/* Validate and translate the bit width */
switch (bit_width) {
@@ -110,7 +103,8 @@ acpi_ex_system_memory_space_handler (
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid system_memory width %d\n",
bit_width));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
}
@@ -120,7 +114,8 @@ acpi_ex_system_memory_space_handler (
* Hardware does not support non-aligned data transfers, we must verify
* the request.
*/
(void) acpi_ut_short_divide ((acpi_integer) address, length, NULL, &remainder);
(void)acpi_ut_short_divide((acpi_integer) address, length, NULL,
&remainder);
if (remainder != 0) {
return_ACPI_STATUS(AE_AML_ALIGNMENT);
}
@@ -132,9 +127,10 @@ acpi_ex_system_memory_space_handler (
* 2) Address beyond the current mapping?
*/
if ((address < mem_info->mapped_physical_address) ||
(((acpi_integer) address + length) >
((acpi_integer)
mem_info->mapped_physical_address + mem_info->mapped_length))) {
(((acpi_integer) address + length) > ((acpi_integer)
mem_info->
mapped_physical_address +
mem_info->mapped_length))) {
/*
* The request cannot be resolved by the current memory mapping;
* Delete the existing mapping and create a new one.
@@ -160,11 +156,13 @@ acpi_ex_system_memory_space_handler (
/* Create a new mapping starting at the address given */
status = acpi_os_map_memory(address, window_size,
(void **) &mem_info->mapped_logical_address);
(void **)&mem_info->
mapped_logical_address);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not map memory at %8.8X%8.8X, size %X\n",
ACPI_FORMAT_UINT64 (address), (u32) window_size));
ACPI_FORMAT_UINT64(address),
(u32) window_size));
mem_info->mapped_length = 0;
return_ACPI_STATUS(status);
}
@@ -185,8 +183,7 @@ acpi_ex_system_memory_space_handler (
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"system_memory %d (%d width) Address=%8.8X%8.8X\n",
function, bit_width,
ACPI_FORMAT_UINT64 (address)));
function, bit_width, ACPI_FORMAT_UINT64(address)));
/*
* Perform the memory read or write
@@ -259,7 +256,6 @@ acpi_ex_system_memory_space_handler (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_io_space_handler
@@ -279,24 +275,20 @@ acpi_ex_system_memory_space_handler (
******************************************************************************/
acpi_status
acpi_ex_system_io_space_handler (
u32 function,
acpi_ex_system_io_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
acpi_status status = AE_OK;
u32 value32;
ACPI_FUNCTION_TRACE("ex_system_io_space_handler");
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"system_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
ACPI_FORMAT_UINT64 (address)));
"system_iO %d (%d width) Address=%8.8X%8.8X\n",
function, bit_width, ACPI_FORMAT_UINT64(address)));
/* Decode the function parameter */
@@ -322,7 +314,6 @@ acpi_ex_system_io_space_handler (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_pci_config_space_handler
@@ -342,22 +333,18 @@ acpi_ex_system_io_space_handler (
******************************************************************************/
acpi_status
acpi_ex_pci_config_space_handler (
u32 function,
acpi_ex_pci_config_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
acpi_status status = AE_OK;
struct acpi_pci_id *pci_id;
u16 pci_register;
ACPI_FUNCTION_TRACE("ex_pci_config_space_handler");
/*
* The arguments to acpi_os(Read|Write)pci_configuration are:
*
@@ -375,8 +362,8 @@ acpi_ex_pci_config_space_handler (
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
function, bit_width, pci_id->segment, pci_id->bus, pci_id->device,
pci_id->function, pci_register));
function, bit_width, pci_id->segment, pci_id->bus,
pci_id->device, pci_id->function, pci_register));
switch (function) {
case ACPI_READ:
@@ -401,7 +388,6 @@ acpi_ex_pci_config_space_handler (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_cmos_space_handler
@@ -421,24 +407,19 @@ acpi_ex_pci_config_space_handler (
******************************************************************************/
acpi_status
acpi_ex_cmos_space_handler (
u32 function,
acpi_ex_cmos_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_pci_bar_space_handler
@@ -458,24 +439,19 @@ acpi_ex_cmos_space_handler (
******************************************************************************/
acpi_status
acpi_ex_pci_bar_space_handler (
u32 function,
acpi_ex_pci_bar_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_data_table_space_handler
@@ -495,23 +471,19 @@ acpi_ex_pci_bar_space_handler (
******************************************************************************/
acpi_status
acpi_ex_data_table_space_handler (
u32 function,
acpi_ex_data_table_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
acpi_integer * value,
void *handler_context,
void *region_context)
void *handler_context, void *region_context)
{
acpi_status status = AE_OK;
u32 byte_width = ACPI_DIV_8(bit_width);
u32 i;
char *logical_addr_ptr;
ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
/* Perform the memory read or write */
@@ -532,5 +504,3 @@ acpi_ex_data_table_space_handler (
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
@@ -50,11 +49,9 @@
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exresnte")
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_node_to_value
@@ -80,12 +77,9 @@
* ACPI_TYPE_PACKAGE
*
******************************************************************************/
acpi_status
acpi_ex_resolve_node_to_value (
struct acpi_namespace_node **object_ptr,
acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object *source_desc;
@@ -93,10 +87,8 @@ acpi_ex_resolve_node_to_value (
struct acpi_namespace_node *node;
acpi_object_type entry_type;
ACPI_FUNCTION_TRACE("ex_resolve_node_to_value");
/*
* The stack pointer points to a struct acpi_namespace_node (Node). Get the
* object that is attached to the Node.
@@ -106,7 +98,8 @@ acpi_ex_resolve_node_to_value (
entry_type = acpi_ns_get_type((acpi_handle) node);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
node, source_desc, acpi_ut_get_type_name (entry_type)));
node, source_desc,
acpi_ut_get_type_name(entry_type)));
if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
(entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
@@ -129,8 +122,8 @@ acpi_ex_resolve_node_to_value (
}
if (!source_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
node));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No object attached to node %p\n", node));
return_ACPI_STATUS(AE_AML_NO_OPERAND);
}
@@ -142,8 +135,10 @@ acpi_ex_resolve_node_to_value (
case ACPI_TYPE_PACKAGE:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
acpi_ut_get_object_type_name (source_desc)));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Object not a Package, type %s\n",
acpi_ut_get_object_type_name
(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -156,12 +151,13 @@ acpi_ex_resolve_node_to_value (
}
break;
case ACPI_TYPE_BUFFER:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
acpi_ut_get_object_type_name (source_desc)));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Object not a Buffer, type %s\n",
acpi_ut_get_object_type_name
(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -174,12 +170,13 @@ acpi_ex_resolve_node_to_value (
}
break;
case ACPI_TYPE_STRING:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
acpi_ut_get_object_type_name (source_desc)));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Object not a String, type %s\n",
acpi_ut_get_object_type_name
(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -189,12 +186,13 @@ acpi_ex_resolve_node_to_value (
acpi_ut_add_reference(obj_desc);
break;
case ACPI_TYPE_INTEGER:
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
acpi_ut_get_object_type_name (source_desc)));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Object not a Integer, type %s\n",
acpi_ut_get_object_type_name
(source_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -204,7 +202,6 @@ acpi_ex_resolve_node_to_value (
acpi_ut_add_reference(obj_desc);
break;
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -214,7 +211,9 @@ acpi_ex_resolve_node_to_value (
"field_read Node=%p source_desc=%p Type=%X\n",
node, source_desc, entry_type));
status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
status =
acpi_ex_read_data_from_field(walk_state, source_desc,
&obj_desc);
break;
/* For these objects, just return the object attached to the Node */
@@ -243,7 +242,6 @@ acpi_ex_resolve_node_to_value (
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
case ACPI_TYPE_LOCAL_REFERENCE:
switch (source_desc->reference.opcode) {
@@ -262,13 +260,14 @@ acpi_ex_resolve_node_to_value (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unsupported Reference opcode %X (%s)\n",
source_desc->reference.opcode,
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
acpi_ps_get_opcode_name(source_desc->
reference.
opcode)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
break;
default:
/* Default case is for unknown types */
@@ -281,11 +280,8 @@ acpi_ex_resolve_node_to_value (
} /* switch (entry_type) */
/* Return the object descriptor */
*object_ptr = (void *)obj_desc;
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acdispat.h>
@@ -50,18 +49,14 @@
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exresolv")
/* Local prototypes */
static acpi_status
acpi_ex_resolve_object_to_value (
union acpi_operand_object **stack_ptr,
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_to_value
@@ -78,16 +73,13 @@ acpi_ex_resolve_object_to_value (
******************************************************************************/
acpi_status
acpi_ex_resolve_to_value (
union acpi_operand_object **stack_ptr,
acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state)
{
acpi_status status;
ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
if (!stack_ptr || !*stack_ptr) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n"));
return_ACPI_STATUS(AE_AML_NO_OPERAND);
@@ -105,7 +97,8 @@ acpi_ex_resolve_to_value (
}
if (!*stack_ptr) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Internal - null pointer\n"));
return_ACPI_STATUS(AE_AML_NO_OPERAND);
}
}
@@ -115,9 +108,10 @@ acpi_ex_resolve_to_value (
* was called (i.e., we can't use an _else_ here.)
*/
if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
status = acpi_ex_resolve_node_to_value (
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, stack_ptr),
walk_state);
status =
acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
(struct acpi_namespace_node,
stack_ptr), walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -127,7 +121,6 @@ acpi_ex_resolve_to_value (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_object_to_value
@@ -143,8 +136,7 @@ acpi_ex_resolve_to_value (
******************************************************************************/
static acpi_status
acpi_ex_resolve_object_to_value (
union acpi_operand_object **stack_ptr,
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
@@ -153,10 +145,8 @@ acpi_ex_resolve_object_to_value (
union acpi_operand_object *obj_desc;
u16 opcode;
ACPI_FUNCTION_TRACE("ex_resolve_object_to_value");
stack_desc = *stack_ptr;
/* This is an union acpi_operand_object */
@@ -184,7 +174,6 @@ acpi_ex_resolve_object_to_value (
(*stack_ptr) = temp_node;
break;
case AML_LOCAL_OP:
case AML_ARG_OP:
@@ -193,13 +182,18 @@ acpi_ex_resolve_object_to_value (
* Note: this increments the local's object reference count
*/
status = acpi_ds_method_data_get_value(opcode,
stack_desc->reference.offset, walk_state, &obj_desc);
stack_desc->
reference.offset,
walk_state,
&obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] value_obj is %p\n",
stack_desc->reference.offset, obj_desc));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"[Arg/Local %X] value_obj is %p\n",
stack_desc->reference.offset,
obj_desc));
/*
* Now we can delete the original Reference Object and
@@ -209,7 +203,6 @@ acpi_ex_resolve_object_to_value (
*stack_ptr = obj_desc;
break;
case AML_INDEX_OP:
switch (stack_desc->reference.target_type) {
@@ -218,7 +211,6 @@ acpi_ex_resolve_object_to_value (
/* Just return - leave the Reference on the stack */
break;
case ACPI_TYPE_PACKAGE:
obj_desc = *stack_desc->reference.where;
@@ -231,8 +223,7 @@ acpi_ex_resolve_object_to_value (
acpi_ut_remove_reference(stack_desc);
acpi_ut_add_reference(obj_desc);
*stack_ptr = obj_desc;
}
else {
} else {
/*
* A NULL object descriptor means an unitialized element of
* the package, can't dereference it
@@ -244,20 +235,16 @@ acpi_ex_resolve_object_to_value (
}
break;
default:
/* 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_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc));
status = AE_AML_INTERNAL;
break;
}
break;
case AML_REF_OF_OP:
case AML_DEBUG_OP:
case AML_LOAD_OP:
@@ -277,27 +264,22 @@ acpi_ex_resolve_object_to_value (
default:
ACPI_REPORT_ERROR ((
"During resolve, Unknown Reference opcode %X (%s) in %p\n",
opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc));
status = AE_AML_INTERNAL;
break;
}
break;
case ACPI_TYPE_BUFFER:
status = acpi_ds_get_buffer_arguments(stack_desc);
break;
case ACPI_TYPE_PACKAGE:
status = acpi_ds_get_package_arguments(stack_desc);
break;
/* These cases may never happen here, but just in case.. */
case ACPI_TYPE_BUFFER_FIELD:
@@ -305,10 +287,14 @@ acpi_ex_resolve_object_to_value (
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read source_desc=%p Type=%X\n",
stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc)));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"field_read source_desc=%p Type=%X\n",
stack_desc,
ACPI_GET_OBJECT_TYPE(stack_desc)));
status = acpi_ex_read_data_from_field (walk_state, stack_desc, &obj_desc);
status =
acpi_ex_read_data_from_field(walk_state, stack_desc,
&obj_desc);
*stack_ptr = (void *)obj_desc;
break;
@@ -319,7 +305,6 @@ acpi_ex_resolve_object_to_value (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_multiple
@@ -337,8 +322,7 @@ acpi_ex_resolve_object_to_value (
******************************************************************************/
acpi_status
acpi_ex_resolve_multiple (
struct acpi_walk_state *walk_state,
acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
union acpi_operand_object *operand,
acpi_object_type * return_type,
union acpi_operand_object **return_desc)
@@ -348,10 +332,8 @@ acpi_ex_resolve_multiple (
acpi_object_type type;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple");
/* Operand can be either a namespace node or an operand descriptor */
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
@@ -361,13 +343,18 @@ acpi_ex_resolve_multiple (
case ACPI_DESC_TYPE_NAMED:
type = ((struct acpi_namespace_node *)obj_desc)->type;
obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc);
obj_desc =
acpi_ns_get_attached_object((struct acpi_namespace_node *)
obj_desc);
/* If we had an Alias node, use the attached object for type info */
if (type == ACPI_TYPE_LOCAL_ALIAS) {
type = ((struct acpi_namespace_node *)obj_desc)->type;
obj_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) obj_desc);
obj_desc =
acpi_ns_get_attached_object((struct
acpi_namespace_node *)
obj_desc);
}
break;
@@ -397,10 +384,9 @@ acpi_ex_resolve_multiple (
/* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE (node) != 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)));
if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
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)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -421,7 +407,6 @@ acpi_ex_resolve_multiple (
}
break;
case AML_INDEX_OP:
/* Get the type of this reference (index into another object) */
@@ -447,7 +432,6 @@ acpi_ex_resolve_multiple (
}
break;
case AML_INT_NAMEPATH_OP:
/* Dereference the reference pointer */
@@ -456,10 +440,9 @@ acpi_ex_resolve_multiple (
/* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE (node) != 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)));
if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
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)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -480,21 +463,33 @@ acpi_ex_resolve_multiple (
}
break;
case AML_LOCAL_OP:
case AML_ARG_OP:
if (return_desc) {
status = acpi_ds_method_data_get_value (obj_desc->reference.opcode,
obj_desc->reference.offset, walk_state, &obj_desc);
status =
acpi_ds_method_data_get_value(obj_desc->
reference.
opcode,
obj_desc->
reference.
offset,
walk_state,
&obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
acpi_ut_remove_reference(obj_desc);
}
else {
status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
obj_desc->reference.offset, walk_state, &node);
} else {
status =
acpi_ds_method_data_get_node(obj_desc->
reference.
opcode,
obj_desc->
reference.
offset,
walk_state,
&node);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -507,7 +502,6 @@ acpi_ex_resolve_multiple (
}
break;
case AML_DEBUG_OP:
/* The Debug Object is of type "debug_object" */
@@ -515,12 +509,9 @@ acpi_ex_resolve_multiple (
type = ACPI_TYPE_DEBUG_OBJECT;
goto exit;
default:
ACPI_REPORT_ERROR ((
"acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
obj_desc->reference.opcode));
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
}
@@ -531,7 +522,6 @@ acpi_ex_resolve_multiple (
*/
type = ACPI_GET_OBJECT_TYPE(obj_desc);
exit:
/* Convert internal types to external types */
@@ -561,5 +551,3 @@ exit:
}
return_ACPI_STATUS(AE_OK);
}

View File

@@ -42,24 +42,18 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acparser.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exresop")
/* Local prototypes */
static acpi_status
acpi_ex_check_object_type (
acpi_object_type type_needed,
acpi_object_type this_type,
void *object);
acpi_ex_check_object_type(acpi_object_type type_needed,
acpi_object_type this_type, void *object);
/*******************************************************************************
*
@@ -76,14 +70,11 @@ acpi_ex_check_object_type (
******************************************************************************/
static acpi_status
acpi_ex_check_object_type (
acpi_object_type type_needed,
acpi_object_type this_type,
void *object)
acpi_ex_check_object_type(acpi_object_type type_needed,
acpi_object_type this_type, void *object)
{
ACPI_FUNCTION_NAME("ex_check_object_type");
if (type_needed == ACPI_TYPE_ANY) {
/* All types OK, so we don't perform any typechecks */
@@ -97,7 +88,8 @@ acpi_ex_check_object_type (
* specification, a store to a constant is a noop.)
*/
if ((this_type == ACPI_TYPE_INTEGER) &&
(((union acpi_operand_object *) object)->common.flags & AOPOBJ_AML_CONSTANT)) {
(((union acpi_operand_object *)object)->common.
flags & AOPOBJ_AML_CONSTANT)) {
return (AE_OK);
}
}
@@ -114,7 +106,6 @@ acpi_ex_check_object_type (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_operands
@@ -137,8 +128,7 @@ acpi_ex_check_object_type (
******************************************************************************/
acpi_status
acpi_ex_resolve_operands (
u16 opcode,
acpi_ex_resolve_operands(u16 opcode,
union acpi_operand_object ** stack_ptr,
struct acpi_walk_state * walk_state)
{
@@ -152,10 +142,8 @@ acpi_ex_resolve_operands (
acpi_object_type type_needed;
u16 target_op = 0;
ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
op_info = acpi_ps_get_opcode_info(opcode);
if (op_info->class == AML_CLASS_UNKNOWN) {
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
@@ -163,8 +151,7 @@ acpi_ex_resolve_operands (
arg_types = op_info->runtime_args;
if (arg_types == ARGI_INVALID_OPCODE) {
ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n",
opcode));
ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -182,8 +169,7 @@ acpi_ex_resolve_operands (
*/
while (GET_CURRENT_ARG_TYPE(arg_types)) {
if (!stack_ptr || !*stack_ptr) {
ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n",
stack_ptr));
ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -199,10 +185,10 @@ acpi_ex_resolve_operands (
/* Namespace Node */
object_type = ((struct acpi_namespace_node *) obj_desc)->type;
object_type =
((struct acpi_namespace_node *)obj_desc)->type;
break;
case ACPI_DESC_TYPE_OPERAND:
/* ACPI internal object */
@@ -241,30 +227,39 @@ acpi_ex_resolve_operands (
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT
((ACPI_DB_EXEC,
"Operand is a Reference, ref_opcode [%s]\n",
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)));
(acpi_ps_get_opcode_info
(obj_desc->
reference.
opcode))->
name)));
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
obj_desc->reference.opcode,
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
obj_desc->reference.
opcode,
(acpi_ps_get_opcode_info
(obj_desc->reference.
opcode))->name));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
}
break;
default:
/* Invalid descriptor */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid descriptor %p [%s]\n",
obj_desc, acpi_ut_get_descriptor_name (obj_desc)));
obj_desc,
acpi_ut_get_descriptor_name
(obj_desc)));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -281,8 +276,10 @@ acpi_ex_resolve_operands (
switch (this_arg_type) {
case ARGI_REF_OR_STRING: /* Can be a String or Reference */
if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
ACPI_DESC_TYPE_OPERAND)
&& (ACPI_GET_OBJECT_TYPE(obj_desc) ==
ACPI_TYPE_STRING)) {
/*
* String found - the string references a named object and
* must be resolved to a node
@@ -308,11 +305,13 @@ acpi_ex_resolve_operands (
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
* A Namespace Node is OK as-is
*/
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_NAMED) {
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
ACPI_DESC_TYPE_NAMED) {
goto next_operand;
}
status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE,
status =
acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
object_type, obj_desc);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -327,7 +326,6 @@ acpi_ex_resolve_operands (
}
goto next_operand;
case ARGI_DATAREFOBJ: /* Store operator only */
/*
@@ -337,8 +335,10 @@ acpi_ex_resolve_operands (
* -- All others must be resolved below.
*/
if ((opcode == AML_STORE_OP) &&
(ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) &&
((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
(ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& ((*stack_ptr)->reference.opcode ==
AML_INDEX_OP)) {
goto next_operand;
}
break;
@@ -403,7 +403,6 @@ acpi_ex_resolve_operands (
type_needed = ACPI_TYPE_LOCAL_REFERENCE;
break;
/*
* The more complex cases allow multiple resolved object types
*/
@@ -414,12 +413,15 @@ acpi_ex_resolve_operands (
* But we can implicitly convert from a STRING or BUFFER
* Aka - "Implicit Source Operand Conversion"
*/
status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16);
status =
acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
if (ACPI_FAILURE(status)) {
if (status == AE_TYPE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc),
obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -432,7 +434,6 @@ acpi_ex_resolve_operands (
}
goto next_operand;
case ARGI_BUFFER:
/*
@@ -445,7 +446,9 @@ acpi_ex_resolve_operands (
if (status == AE_TYPE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc),
obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -458,7 +461,6 @@ acpi_ex_resolve_operands (
}
goto next_operand;
case ARGI_STRING:
/*
@@ -472,7 +474,9 @@ acpi_ex_resolve_operands (
if (status == AE_TYPE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc),
obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -485,7 +489,6 @@ acpi_ex_resolve_operands (
}
goto next_operand;
case ARGI_COMPUTEDATA:
/* Need an operand of type INTEGER, STRING or BUFFER */
@@ -501,13 +504,13 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
goto next_operand;
case ARGI_BUFFER_OR_STRING:
/* Need an operand of type STRING or BUFFER */
@@ -523,7 +526,9 @@ acpi_ex_resolve_operands (
/* Highest priority conversion is to type Buffer */
status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
status =
acpi_ex_convert_to_buffer(obj_desc,
stack_ptr);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -536,13 +541,13 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Integer/String/Buffer], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
goto next_operand;
case ARGI_DATAOBJECT:
/*
* ARGI_DATAOBJECT is only used by the size_of operator.
@@ -563,13 +568,13 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Buffer/String/Package/Reference], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
goto next_operand;
case ARGI_COMPLEXOBJ:
/* Need a buffer or package or (ACPI 2.0) String */
@@ -585,13 +590,13 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Buffer/String/Package], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
goto next_operand;
case ARGI_REGION_OR_FIELD:
/* Need an operand of type REGION or a FIELD in a region */
@@ -608,13 +613,13 @@ acpi_ex_resolve_operands (
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed [Region/region_field], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
goto next_operand;
case ARGI_DATAREFOBJ:
/* Used by the Store() operator only */
@@ -653,13 +658,13 @@ acpi_ex_resolve_operands (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
acpi_ut_get_object_type_name (obj_desc), obj_desc));
acpi_ut_get_object_type_name
(obj_desc), obj_desc));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
goto next_operand;
default:
/* Unknown type */
@@ -676,7 +681,8 @@ acpi_ex_resolve_operands (
* required object type (Simple cases only).
*/
status = acpi_ex_check_object_type(type_needed,
ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
ACPI_GET_OBJECT_TYPE
(*stack_ptr), *stack_ptr);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -693,5 +699,3 @@ next_operand:
return_ACPI_STATUS(status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
@@ -50,25 +49,19 @@
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exstore")
/* Local prototypes */
static void
acpi_ex_do_debug_object (
union acpi_operand_object *source_desc,
u32 level,
u32 index);
acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
u32 level, u32 index);
static acpi_status
acpi_ex_store_object_to_index (
union acpi_operand_object *val_desc,
acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
union acpi_operand_object *dest_desc,
struct acpi_walk_state *walk_state);
/*******************************************************************************
*
* FUNCTION: acpi_ex_do_debug_object
@@ -84,17 +77,13 @@ acpi_ex_store_object_to_index (
******************************************************************************/
static void
acpi_ex_do_debug_object (
union acpi_operand_object *source_desc,
u32 level,
u32 index)
acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
u32 level, u32 index)
{
u32 i;
ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
level, " "));
@@ -112,21 +101,25 @@ acpi_ex_do_debug_object (
if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: ",
acpi_ut_get_object_type_name (source_desc)));
acpi_ut_get_object_type_name
(source_desc)));
if (!acpi_ut_valid_internal_object(source_desc)) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
"%p, Invalid Internal Object!\n", source_desc));
return_VOID;
}
}
else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
"%p, Invalid Internal Object!\n",
source_desc));
return_VOID;
}
else {
} else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
ACPI_DESC_TYPE_NAMED) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
acpi_ut_get_type_name(((struct
acpi_namespace_node
*)source_desc)->
type),
source_desc));
return_VOID;
} else {
return_VOID;
}
@@ -137,11 +130,14 @@ acpi_ex_do_debug_object (
if (acpi_gbl_integer_byte_width == 4) {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
(u32) source_desc->integer.value));
}
else {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (source_desc->integer.value)));
(u32) source_desc->integer.
value));
} else {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
"0x%8.8X%8.8X\n",
ACPI_FORMAT_UINT64(source_desc->
integer.
value)));
}
break;
@@ -150,62 +146,70 @@ acpi_ex_do_debug_object (
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
(u32) source_desc->buffer.length));
ACPI_DUMP_BUFFER(source_desc->buffer.pointer,
(source_desc->buffer.length < 32) ? source_desc->buffer.length : 32);
(source_desc->buffer.length <
32) ? source_desc->buffer.length : 32);
break;
case ACPI_TYPE_STRING:
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
source_desc->string.length, source_desc->string.pointer));
source_desc->string.length,
source_desc->string.pointer));
break;
case ACPI_TYPE_PACKAGE:
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
"[0x%.2X Elements]\n",
source_desc->package.count));
/* Output the entire contents of the package */
for (i = 0; i < source_desc->package.count; i++) {
acpi_ex_do_debug_object (source_desc->package.elements[i],
level+4, i+1);
acpi_ex_do_debug_object(source_desc->package.
elements[i], level + 4, i + 1);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
if (source_desc->reference.opcode == AML_INDEX_OP) {
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
acpi_ps_get_opcode_name (source_desc->reference.opcode),
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
"[%s, 0x%X]\n",
acpi_ps_get_opcode_name
(source_desc->reference.opcode),
source_desc->reference.offset));
}
else {
} else {
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
acpi_ps_get_opcode_name
(source_desc->reference.opcode)));
}
if (source_desc->reference.object) {
if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
if (ACPI_GET_DESCRIPTOR_TYPE
(source_desc->reference.object) ==
ACPI_DESC_TYPE_NAMED) {
acpi_ex_do_debug_object (((struct acpi_namespace_node *)
source_desc->reference.object)->object,
acpi_ex_do_debug_object(((struct
acpi_namespace_node *)
source_desc->reference.
object)->object,
level + 4, 0);
} else {
acpi_ex_do_debug_object(source_desc->reference.
object, level + 4, 0);
}
else {
acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
}
}
else if (source_desc->reference.node) {
acpi_ex_do_debug_object ((source_desc->reference.node)->object,
level+4, 0);
} else if (source_desc->reference.node) {
acpi_ex_do_debug_object((source_desc->reference.node)->
object, level + 4, 0);
}
break;
default:
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
source_desc, acpi_ut_get_object_type_name (source_desc)));
source_desc,
acpi_ut_get_object_type_name
(source_desc)));
break;
}
@@ -213,7 +217,6 @@ acpi_ex_do_debug_object (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_store
@@ -235,18 +238,15 @@ acpi_ex_do_debug_object (
******************************************************************************/
acpi_status
acpi_ex_store (
union acpi_operand_object *source_desc,
acpi_ex_store(union acpi_operand_object *source_desc,
union acpi_operand_object *dest_desc,
struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
union acpi_operand_object *ref_desc = dest_desc;
ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc);
/* Validate parameters */
if (!source_desc || !dest_desc) {
@@ -262,7 +262,9 @@ acpi_ex_store (
* Storing an object into a Named node.
*/
status = acpi_ex_store_object_to_node(source_desc,
(struct acpi_namespace_node *) dest_desc, walk_state,
(struct
acpi_namespace_node *)
dest_desc, walk_state,
ACPI_IMPLICIT_CONVERSION);
return_ACPI_STATUS(status);
@@ -290,12 +292,14 @@ acpi_ex_store (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Target is not a Reference or Constant object - %s [%p]\n",
acpi_ut_get_object_type_name (dest_desc), dest_desc));
acpi_ut_get_object_type_name(dest_desc),
dest_desc));
ACPI_DUMP_STACK_ENTRY(source_desc);
ACPI_DUMP_STACK_ENTRY(dest_desc);
ACPI_DUMP_OPERANDS(&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
2, "Target is not a Reference or Constant object");
2,
"Target is not a Reference or Constant object");
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}
@@ -315,29 +319,31 @@ acpi_ex_store (
/* Storing an object into a Name "container" */
status = acpi_ex_store_object_to_node(source_desc,
ref_desc->reference.object,
walk_state, ACPI_IMPLICIT_CONVERSION);
ref_desc->reference.
object, walk_state,
ACPI_IMPLICIT_CONVERSION);
break;
case AML_INDEX_OP:
/* Storing to an Index (pointer into a packager or buffer) */
status = acpi_ex_store_object_to_index (source_desc, ref_desc, walk_state);
status =
acpi_ex_store_object_to_index(source_desc, ref_desc,
walk_state);
break;
case AML_LOCAL_OP:
case AML_ARG_OP:
/* Store to a method local/arg */
status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
ref_desc->reference.offset, source_desc, walk_state);
status =
acpi_ds_store_object_to_local(ref_desc->reference.opcode,
ref_desc->reference.offset,
source_desc, walk_state);
break;
case AML_DEBUG_OP:
/*
@@ -346,12 +352,12 @@ acpi_ex_store (
*/
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"**** Write to Debug Object: Object %p %s ****:\n\n",
source_desc, acpi_ut_get_object_type_name (source_desc)));
source_desc,
acpi_ut_get_object_type_name(source_desc)));
acpi_ex_do_debug_object(source_desc, 0, 0);
break;
default:
ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n",
@@ -365,7 +371,6 @@ acpi_ex_store (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_store_object_to_index
@@ -381,8 +386,7 @@ acpi_ex_store (
******************************************************************************/
static acpi_status
acpi_ex_store_object_to_index (
union acpi_operand_object *source_desc,
acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
union acpi_operand_object *index_desc,
struct acpi_walk_state *walk_state)
{
@@ -392,10 +396,8 @@ acpi_ex_store_object_to_index (
u8 value = 0;
u32 i;
ACPI_FUNCTION_TRACE("ex_store_object_to_index");
/*
* Destination must be a reference pointer, and
* must point to either a buffer or a package
@@ -413,7 +415,9 @@ acpi_ex_store_object_to_index (
*/
obj_desc = *(index_desc->reference.where);
status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state);
status =
acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -421,10 +425,9 @@ acpi_ex_store_object_to_index (
if (obj_desc) {
/* Decrement reference count by the ref count of the parent package */
for (i = 0;
i < ((union acpi_operand_object *)
index_desc->reference.object)->common.reference_count;
i++) {
for (i = 0; i < ((union acpi_operand_object *)
index_desc->reference.object)->common.
reference_count; i++) {
acpi_ut_remove_reference(obj_desc);
}
}
@@ -433,16 +436,14 @@ acpi_ex_store_object_to_index (
/* Increment ref count by the ref count of the parent package-1 */
for (i = 1;
i < ((union acpi_operand_object *)
index_desc->reference.object)->common.reference_count;
i++) {
for (i = 1; i < ((union acpi_operand_object *)
index_desc->reference.object)->common.
reference_count; i++) {
acpi_ut_add_reference(new_desc);
}
break;
case ACPI_TYPE_BUFFER_FIELD:
/*
@@ -491,7 +492,8 @@ acpi_ex_store_object_to_index (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Source must be Integer/Buffer/String type, not %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);
}
@@ -500,7 +502,6 @@ acpi_ex_store_object_to_index (
obj_desc->buffer.pointer[index_desc->reference.offset] = value;
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Target is not a Package or buffer_field\n"));
@@ -511,7 +512,6 @@ acpi_ex_store_object_to_index (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_store_object_to_node
@@ -539,8 +539,7 @@ acpi_ex_store_object_to_index (
******************************************************************************/
acpi_status
acpi_ex_store_object_to_node (
union acpi_operand_object *source_desc,
acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
struct acpi_namespace_node *node,
struct acpi_walk_state *walk_state,
u8 implicit_conversion)
@@ -550,18 +549,17 @@ acpi_ex_store_object_to_node (
union acpi_operand_object *new_desc;
acpi_object_type target_type;
ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc);
/* Get current type of the node, and object attached to Node */
target_type = acpi_ns_get_type(node);
target_desc = acpi_ns_get_attached_object(node);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
source_desc, acpi_ut_get_object_type_name (source_desc),
node, acpi_ut_get_type_name (target_type)));
source_desc,
acpi_ut_get_object_type_name(source_desc), node,
acpi_ut_get_type_name(target_type)));
/*
* Resolve the source object to an actual value
@@ -594,7 +592,6 @@ acpi_ex_store_object_to_node (
&walk_state->result_obj);
break;
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
@@ -605,7 +602,8 @@ acpi_ex_store_object_to_node (
*
* Copy and/or convert the source object to a new target object
*/
status = acpi_ex_store_object_to_object (source_desc, target_desc,
status =
acpi_ex_store_object_to_object(source_desc, target_desc,
&new_desc, walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -621,30 +619,33 @@ acpi_ex_store_object_to_node (
* has been performed such that the node/object type has been
* changed.
*/
status = acpi_ns_attach_object (node, new_desc, new_desc->common.type);
status =
acpi_ns_attach_object(node, new_desc,
new_desc->common.type);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_object_type_name (new_desc)));
acpi_ut_get_object_type_name
(source_desc),
acpi_ut_get_object_type_name
(new_desc)));
}
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Storing %s (%p) directly into node (%p) with no implicit conversion\n",
acpi_ut_get_object_type_name (source_desc), source_desc, node));
acpi_ut_get_object_type_name(source_desc),
source_desc, node));
/* No conversions for all other types. Just attach the source object */
status = acpi_ns_attach_object(node, source_desc,
ACPI_GET_OBJECT_TYPE (source_desc));
ACPI_GET_OBJECT_TYPE
(source_desc));
break;
}
return_ACPI_STATUS(status);
}

View File

@@ -43,16 +43,13 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exstoren")
/*******************************************************************************
*
* FUNCTION: acpi_ex_resolve_object
@@ -67,20 +64,16 @@
* it and return the actual object in the source_desc_ptr.
*
******************************************************************************/
acpi_status
acpi_ex_resolve_object (
union acpi_operand_object **source_desc_ptr,
acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
acpi_object_type target_type,
struct acpi_walk_state *walk_state)
{
union acpi_operand_object *source_desc = *source_desc_ptr;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_resolve_object");
/* Ensure we have a Target that can be stored to */
switch (target_type) {
@@ -102,10 +95,13 @@ acpi_ex_resolve_object (
* are all essentially the same. This case handles the
* "interchangeable" types Integer, String, and Buffer.
*/
if (ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
if (ACPI_GET_OBJECT_TYPE(source_desc) ==
ACPI_TYPE_LOCAL_REFERENCE) {
/* Resolve a reference object first */
status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
status =
acpi_ex_resolve_to_value(source_desc_ptr,
walk_state);
if (ACPI_FAILURE(status)) {
break;
}
@@ -122,18 +118,20 @@ acpi_ex_resolve_object (
if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
!((ACPI_GET_OBJECT_TYPE(source_desc) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& (source_desc->reference.opcode == AML_LOAD_OP))) {
/* Conversion successful but still not a valid type */
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
acpi_ut_get_object_type_name (source_desc),
acpi_ut_get_object_type_name
(source_desc),
acpi_ut_get_type_name(target_type)));
status = AE_AML_OPERAND_TYPE;
}
break;
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
@@ -143,7 +141,6 @@ acpi_ex_resolve_object (
status = AE_AML_INTERNAL;
break;
case ACPI_TYPE_PACKAGE:
default:
@@ -157,7 +154,6 @@ acpi_ex_resolve_object (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_store_object_to_object
@@ -194,8 +190,7 @@ acpi_ex_resolve_object (
******************************************************************************/
acpi_status
acpi_ex_store_object_to_object (
union acpi_operand_object *source_desc,
acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
union acpi_operand_object *dest_desc,
union acpi_operand_object **new_desc,
struct acpi_walk_state *walk_state)
@@ -203,10 +198,8 @@ acpi_ex_store_object_to_object (
union acpi_operand_object *actual_src_desc;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
actual_src_desc = source_desc;
if (!dest_desc) {
/*
@@ -214,11 +207,14 @@ acpi_ex_store_object_to_object (
* package element), so we can simply copy the source object
* creating a new destination object
*/
status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state);
status =
acpi_ut_copy_iobject_to_iobject(actual_src_desc, new_desc,
walk_state);
return_ACPI_STATUS(status);
}
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_GET_OBJECT_TYPE (dest_desc)) {
if (ACPI_GET_OBJECT_TYPE(source_desc) !=
ACPI_GET_OBJECT_TYPE(dest_desc)) {
/*
* The source type does not match the type of the destination.
* Perform the "implicit conversion" of the source to the current type
@@ -228,8 +224,11 @@ acpi_ex_store_object_to_object (
* Otherwise, actual_src_desc is a temporary object to hold the
* converted object.
*/
status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc),
source_desc, &actual_src_desc, walk_state);
status =
acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE
(dest_desc), source_desc,
&actual_src_desc,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -260,17 +259,20 @@ acpi_ex_store_object_to_object (
case ACPI_TYPE_STRING:
status = acpi_ex_store_string_to_string (actual_src_desc, dest_desc);
status =
acpi_ex_store_string_to_string(actual_src_desc, dest_desc);
break;
case ACPI_TYPE_BUFFER:
status = acpi_ex_store_buffer_to_buffer (actual_src_desc, dest_desc);
status =
acpi_ex_store_buffer_to_buffer(actual_src_desc, dest_desc);
break;
case ACPI_TYPE_PACKAGE:
status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc,
status =
acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
walk_state);
break;
@@ -278,7 +280,8 @@ acpi_ex_store_object_to_object (
/*
* All other types come here.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Store into type %s not implemented\n",
acpi_ut_get_object_type_name(dest_desc)));
status = AE_NOT_IMPLEMENTED;
@@ -294,5 +297,3 @@ acpi_ex_store_object_to_object (
*new_desc = dest_desc;
return_ACPI_STATUS(status);
}

View File

@@ -42,15 +42,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exstorob")
/*******************************************************************************
*
* FUNCTION: acpi_ex_store_buffer_to_buffer
@@ -63,19 +60,15 @@
* DESCRIPTION: Copy a buffer object to another buffer object.
*
******************************************************************************/
acpi_status
acpi_ex_store_buffer_to_buffer (
union acpi_operand_object *source_desc,
acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc)
{
u32 length;
u8 *buffer;
ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc);
/* We know that source_desc is a buffer by now */
buffer = (u8 *) source_desc->buffer.pointer;
@@ -100,7 +93,8 @@ acpi_ex_store_buffer_to_buffer (
if (length <= target_desc->buffer.length) {
/* Clear existing buffer and copy in the new one */
ACPI_MEMSET (target_desc->buffer.pointer, 0, target_desc->buffer.length);
ACPI_MEMSET(target_desc->buffer.pointer, 0,
target_desc->buffer.length);
ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
#ifdef ACPI_OBSOLETE_BEHAVIOR
@@ -124,8 +118,7 @@ acpi_ex_store_buffer_to_buffer (
target_desc->buffer.length = length;
}
#endif
}
else {
} else {
/* Truncate the source, copy only what will fit */
ACPI_MEMCPY(target_desc->buffer.pointer, buffer,
@@ -143,7 +136,6 @@ acpi_ex_store_buffer_to_buffer (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_store_string_to_string
@@ -158,17 +150,14 @@ acpi_ex_store_buffer_to_buffer (
******************************************************************************/
acpi_status
acpi_ex_store_string_to_string (
union acpi_operand_object *source_desc,
acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc)
{
u32 length;
u8 *buffer;
ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc);
/* We know that source_desc is a string by now */
buffer = (u8 *) source_desc->string.pointer;
@@ -187,8 +176,7 @@ acpi_ex_store_string_to_string (
ACPI_MEMSET(target_desc->string.pointer, 0,
(acpi_size) target_desc->string.length + 1);
ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
}
else {
} else {
/*
* Free the current buffer, then allocate a new buffer
* large enough to hold the value
@@ -200,8 +188,8 @@ acpi_ex_store_string_to_string (
ACPI_MEM_FREE(target_desc->string.pointer);
}
target_desc->string.pointer = ACPI_MEM_CALLOCATE (
(acpi_size) length + 1);
target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size)
length + 1);
if (!target_desc->string.pointer) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -215,5 +203,3 @@ acpi_ex_store_string_to_string (
target_desc->string.length = length;
return_ACPI_STATUS(AE_OK);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acinterp.h>
#include <acpi/acevents.h>
@@ -50,7 +49,6 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME("exsystem")
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_wait_semaphore
@@ -65,19 +63,13 @@
* interpreter is released.
*
******************************************************************************/
acpi_status
acpi_ex_system_wait_semaphore (
acpi_handle semaphore,
u16 timeout)
acpi_status acpi_ex_system_wait_semaphore(acpi_handle semaphore, u16 timeout)
{
acpi_status status;
acpi_status status2;
ACPI_FUNCTION_TRACE("ex_system_wait_semaphore");
status = acpi_os_wait_semaphore(semaphore, 1, 0);
if (ACPI_SUCCESS(status)) {
return_ACPI_STATUS(status);
@@ -107,7 +99,6 @@ acpi_ex_system_wait_semaphore (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_do_stall
@@ -125,17 +116,13 @@ acpi_ex_system_wait_semaphore (
*
******************************************************************************/
acpi_status
acpi_ex_system_do_stall (
u32 how_long)
acpi_status acpi_ex_system_do_stall(u32 how_long)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_ENTRY();
if (how_long > 255) /* 255 microseconds */ {
if (how_long > 255) { /* 255 microseconds */
/*
* Longer than 255 usec, this is an error
*
@@ -145,15 +132,13 @@ acpi_ex_system_do_stall (
ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n",
how_long));
status = AE_AML_OPERAND_VALUE;
}
else {
} else {
acpi_os_stall(how_long);
}
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_do_suspend
@@ -167,16 +152,12 @@ acpi_ex_system_do_stall (
*
******************************************************************************/
acpi_status
acpi_ex_system_do_suspend (
acpi_integer how_long)
acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
{
acpi_status status;
ACPI_FUNCTION_ENTRY();
/* Since this thread will sleep, we must release the interpreter */
acpi_ex_exit_interpreter();
@@ -189,7 +170,6 @@ acpi_ex_system_do_suspend (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_acquire_mutex
@@ -206,16 +186,13 @@ acpi_ex_system_do_suspend (
******************************************************************************/
acpi_status
acpi_ex_system_acquire_mutex (
union acpi_operand_object *time_desc,
acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
union acpi_operand_object * obj_desc)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc);
if (!obj_desc) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -223,7 +200,8 @@ acpi_ex_system_acquire_mutex (
/* Support for the _GL_ Mutex object -- go get the global lock */
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
status =
acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
return_ACPI_STATUS(status);
}
@@ -232,7 +210,6 @@ acpi_ex_system_acquire_mutex (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_release_mutex
@@ -248,16 +225,12 @@ acpi_ex_system_acquire_mutex (
*
******************************************************************************/
acpi_status
acpi_ex_system_release_mutex (
union acpi_operand_object *obj_desc)
acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_system_release_mutex");
if (!obj_desc) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -273,7 +246,6 @@ acpi_ex_system_release_mutex (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_signal_event
@@ -287,16 +259,12 @@ acpi_ex_system_release_mutex (
*
******************************************************************************/
acpi_status
acpi_ex_system_signal_event (
union acpi_operand_object *obj_desc)
acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_system_signal_event");
if (obj_desc) {
status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
}
@@ -304,7 +272,6 @@ acpi_ex_system_signal_event (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_wait_event
@@ -321,25 +288,23 @@ acpi_ex_system_signal_event (
******************************************************************************/
acpi_status
acpi_ex_system_wait_event (
union acpi_operand_object *time_desc,
acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
union acpi_operand_object *obj_desc)
{
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE("ex_system_wait_event");
if (obj_desc) {
status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
(u16) time_desc->integer.value);
status =
acpi_ex_system_wait_semaphore(obj_desc->event.semaphore,
(u16) time_desc->integer.
value);
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_system_reset_event
@@ -352,22 +317,19 @@ acpi_ex_system_wait_event (
*
******************************************************************************/
acpi_status
acpi_ex_system_reset_event (
union acpi_operand_object *obj_desc)
acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
{
acpi_status status = AE_OK;
void *temp_semaphore;
ACPI_FUNCTION_ENTRY();
/*
* We are going to simply delete the existing semaphore and
* create a new one!
*/
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
status =
acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
if (ACPI_SUCCESS(status)) {
(void)acpi_os_delete_semaphore(obj_desc->event.semaphore);
obj_desc->event.semaphore = temp_semaphore;
@@ -375,4 +337,3 @@ acpi_ex_system_reset_event (
return (status);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
/*
* DEFINE_AML_GLOBALS is tested in amlcode.h
* to determine whether certain global names should be "defined" or only
@@ -68,12 +67,7 @@
ACPI_MODULE_NAME("exutils")
/* Local prototypes */
static u32
acpi_ex_digits_needed (
acpi_integer value,
u32 base);
static u32 acpi_ex_digits_needed(acpi_integer value, u32 base);
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
@@ -89,15 +83,12 @@ acpi_ex_digits_needed (
*
******************************************************************************/
acpi_status
acpi_ex_enter_interpreter (
void)
acpi_status acpi_ex_enter_interpreter(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ex_enter_interpreter");
status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n"));
@@ -106,7 +97,6 @@ acpi_ex_enter_interpreter (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_exit_interpreter
@@ -129,16 +119,12 @@ acpi_ex_enter_interpreter (
*
******************************************************************************/
void
acpi_ex_exit_interpreter (
void)
void acpi_ex_exit_interpreter(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ex_exit_interpreter");
status = acpi_ut_release_mutex(ACPI_MTX_EXECUTE);
if (ACPI_FAILURE(status)) {
ACPI_REPORT_ERROR(("Could not release interpreter mutex\n"));
@@ -147,7 +133,6 @@ acpi_ex_exit_interpreter (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_truncate_for32bit_table
@@ -161,14 +146,11 @@ acpi_ex_exit_interpreter (
*
******************************************************************************/
void
acpi_ex_truncate_for32bit_table (
union acpi_operand_object *obj_desc)
void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
{
ACPI_FUNCTION_ENTRY();
/*
* Object must be a valid number and we must be executing
* a control method
@@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table (
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_acquire_global_lock
@@ -203,17 +184,13 @@ acpi_ex_truncate_for32bit_table (
*
******************************************************************************/
u8
acpi_ex_acquire_global_lock (
u32 field_flags)
u8 acpi_ex_acquire_global_lock(u32 field_flags)
{
u8 locked = FALSE;
acpi_status status;
ACPI_FUNCTION_TRACE("ex_acquire_global_lock");
/* Only attempt lock if the always_lock bit is set */
if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
@@ -222,8 +199,7 @@ acpi_ex_acquire_global_lock (
status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
if (ACPI_SUCCESS(status)) {
locked = TRUE;
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not acquire Global Lock, %s\n",
acpi_format_exception(status)));
@@ -233,7 +209,6 @@ acpi_ex_acquire_global_lock (
return_VALUE(locked);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_release_global_lock
@@ -247,16 +222,12 @@ acpi_ex_acquire_global_lock (
*
******************************************************************************/
void
acpi_ex_release_global_lock (
u8 locked_by_me)
void acpi_ex_release_global_lock(u8 locked_by_me)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ex_release_global_lock");
/* Only attempt unlock if the caller locked it */
if (locked_by_me) {
@@ -266,15 +237,13 @@ acpi_ex_release_global_lock (
if (ACPI_FAILURE(status)) {
/* 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_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status)));
}
}
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_digits_needed
@@ -289,18 +258,13 @@ acpi_ex_release_global_lock (
*
******************************************************************************/
static u32
acpi_ex_digits_needed (
acpi_integer value,
u32 base)
static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
{
u32 num_digits;
acpi_integer current_value;
ACPI_FUNCTION_TRACE("ex_digits_needed");
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */
if (value == 0) {
@@ -313,14 +277,14 @@ acpi_ex_digits_needed (
/* Count the digits in the requested base */
while (current_value) {
(void) acpi_ut_short_divide (current_value, base, &current_value, NULL);
(void)acpi_ut_short_divide(current_value, base, &current_value,
NULL);
num_digits++;
}
return_VALUE(num_digits);
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_eisa_id_to_string
@@ -334,17 +298,12 @@ acpi_ex_digits_needed (
*
******************************************************************************/
void
acpi_ex_eisa_id_to_string (
u32 numeric_id,
char *out_string)
void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string)
{
u32 eisa_id;
ACPI_FUNCTION_ENTRY();
/* Swap ID to big-endian to get contiguous bits */
eisa_id = acpi_ut_dword_byte_swap(numeric_id);
@@ -359,7 +318,6 @@ acpi_ex_eisa_id_to_string (
out_string[7] = 0;
}
/*******************************************************************************
*
* FUNCTION: acpi_ex_unsigned_integer_to_string
@@ -374,25 +332,20 @@ acpi_ex_eisa_id_to_string (
*
******************************************************************************/
void
acpi_ex_unsigned_integer_to_string (
acpi_integer value,
char *out_string)
void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string)
{
u32 count;
u32 digits_needed;
u32 remainder;
ACPI_FUNCTION_ENTRY();
digits_needed = acpi_ex_digits_needed(value, 10);
out_string[digits_needed] = 0;
for (count = digits_needed; count > 0; count--) {
(void)acpi_ut_short_divide(value, 10, &value, &remainder);
out_string[count-1] = (char) ('0' + remainder);\
out_string[count - 1] = (char)('0' + remainder);
}
}

View File

@@ -34,7 +34,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define ACPI_FAN_COMPONENT 0x00200000
#define ACPI_FAN_CLASS "fan"
#define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver"
@@ -64,16 +63,13 @@ struct acpi_fan {
acpi_handle handle;
};
/* --------------------------------------------------------------------------
FS Interface (/proc)
-------------------------------------------------------------------------- */
static struct proc_dir_entry *acpi_fan_dir;
static int
acpi_fan_read_state(struct seq_file *seq, void *offset)
static int acpi_fan_read_state(struct seq_file *seq, void *offset)
{
struct acpi_fan *fan = seq->private;
int state = 0;
@@ -131,8 +127,7 @@ static struct file_operations acpi_fan_state_ops = {
.owner = THIS_MODULE,
};
static int
acpi_fan_add_fs(struct acpi_device *device)
static int acpi_fan_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *entry = NULL;
@@ -151,7 +146,8 @@ acpi_fan_add_fs(struct acpi_device *device)
/* 'status' [R/W] */
entry = create_proc_entry(ACPI_FAN_FILE_STATE,
S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device));
S_IFREG | S_IRUGO | S_IWUSR,
acpi_device_dir(device));
if (!entry)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to create '%s' fs entry\n",
@@ -165,15 +161,12 @@ acpi_fan_add_fs(struct acpi_device *device)
return_VALUE(0);
}
static int
acpi_fan_remove_fs(struct acpi_device *device)
static int acpi_fan_remove_fs(struct acpi_device *device)
{
ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
if (acpi_device_dir(device)) {
remove_proc_entry(ACPI_FAN_FILE_STATE,
acpi_device_dir(device));
remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
acpi_device_dir(device) = NULL;
}
@@ -181,13 +174,11 @@ acpi_fan_remove_fs(struct acpi_device *device)
return_VALUE(0);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static int
acpi_fan_add(struct acpi_device *device)
static int acpi_fan_add(struct acpi_device *device)
{
int result = 0;
struct acpi_fan *fan = NULL;
@@ -230,9 +221,7 @@ end:
return_VALUE(result);
}
static int
acpi_fan_remove(struct acpi_device *device, int type)
static int acpi_fan_remove(struct acpi_device *device, int type)
{
struct acpi_fan *fan = NULL;
@@ -250,9 +239,7 @@ acpi_fan_remove(struct acpi_device *device, int type)
return_VALUE(0);
}
static int __init
acpi_fan_init(void)
static int __init acpi_fan_init(void)
{
int result = 0;
@@ -272,9 +259,7 @@ acpi_fan_init(void)
return_VALUE(0);
}
static void __exit
acpi_fan_exit(void)
static void __exit acpi_fan_exit(void)
{
ACPI_FUNCTION_TRACE("acpi_fan_exit");
@@ -285,7 +270,5 @@ acpi_fan_exit(void)
return_VOID;
}
module_init(acpi_fan_init);
module_exit(acpi_fan_exit);

View File

@@ -29,7 +29,8 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
down_write(&bus_type_sem);
list_add_tail(&type->list, &bus_type_list);
up_write(&bus_type_sem);
printk(KERN_INFO PREFIX "bus type %s registered\n", type->bus->name);
printk(KERN_INFO PREFIX "bus type %s registered\n",
type->bus->name);
return 0;
}
return -ENODEV;
@@ -45,7 +46,8 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
down_write(&bus_type_sem);
list_del_init(&type->list);
up_write(&bus_type_sem);
printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", type->bus->name);
printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n",
type->bus->name);
return 0;
}
return -ENODEV;

View File

@@ -42,14 +42,11 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwacpi")
/******************************************************************************
*
* FUNCTION: acpi_hw_initialize
@@ -62,17 +59,12 @@
* the FADT.
*
******************************************************************************/
acpi_status
acpi_hw_initialize (
void)
acpi_status acpi_hw_initialize(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("hw_initialize");
/* We must have the ACPI tables by the time we get here */
if (!acpi_gbl_FADT) {
@@ -91,7 +83,6 @@ acpi_hw_initialize (
return_ACPI_STATUS(AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_set_mode
@@ -104,15 +95,12 @@ acpi_hw_initialize (
*
******************************************************************************/
acpi_status
acpi_hw_set_mode (
u32 mode)
acpi_status acpi_hw_set_mode(u32 mode)
{
acpi_status status;
u32 retry;
ACPI_FUNCTION_TRACE("hw_set_mode");
/*
@@ -132,8 +120,7 @@ acpi_hw_set_mode (
* transitions are not supported.
*/
if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
ACPI_REPORT_ERROR ((
"No ACPI mode transition supported in this system (enable/disable both zero)\n"));
ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n"));
return_ACPI_STATUS(AE_OK);
}
@@ -143,8 +130,10 @@ acpi_hw_set_mode (
/* BIOS should have disabled ALL fixed and GP events */
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
(u32) acpi_gbl_FADT->acpi_enable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
(u32) acpi_gbl_FADT->acpi_enable,
8);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Attempting to enable ACPI mode\n"));
break;
case ACPI_SYS_MODE_LEGACY:
@@ -154,7 +143,8 @@ acpi_hw_set_mode (
* enable bits to default
*/
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
(u32) acpi_gbl_FADT->acpi_disable, 8);
(u32) acpi_gbl_FADT->acpi_disable,
8);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
break;
@@ -176,7 +166,8 @@ acpi_hw_set_mode (
retry = 3000;
while (retry) {
if (acpi_hw_get_mode() == mode) {
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Mode %X successfully enabled\n",
mode));
return_ACPI_STATUS(AE_OK);
}
@@ -188,7 +179,6 @@ acpi_hw_set_mode (
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
}
/*******************************************************************************
*
* FUNCTION: acpi_hw_get_mode
@@ -202,17 +192,13 @@ acpi_hw_set_mode (
*
******************************************************************************/
u32
acpi_hw_get_mode (
void)
u32 acpi_hw_get_mode(void)
{
acpi_status status;
u32 value;
ACPI_FUNCTION_TRACE("hw_get_mode");
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
@@ -221,15 +207,15 @@ acpi_hw_get_mode (
return_VALUE(ACPI_SYS_MODE_ACPI);
}
status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
status =
acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
if (ACPI_FAILURE(status)) {
return_VALUE(ACPI_SYS_MODE_LEGACY);
}
if (value) {
return_VALUE(ACPI_SYS_MODE_ACPI);
}
else {
} else {
return_VALUE(ACPI_SYS_MODE_LEGACY);
}
}

View File

@@ -49,13 +49,10 @@
ACPI_MODULE_NAME("hwgpe")
/* Local prototypes */
static acpi_status
acpi_hw_enable_wakeup_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block);
/******************************************************************************
*
* FUNCTION: acpi_hw_write_gpe_enable_reg
@@ -71,16 +68,13 @@ acpi_hw_enable_wakeup_gpe_block (
******************************************************************************/
acpi_status
acpi_hw_write_gpe_enable_reg (
struct acpi_gpe_event_info *gpe_event_info)
acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
{
struct acpi_gpe_register_info *gpe_register_info;
acpi_status status;
ACPI_FUNCTION_ENTRY();
/* Get the info block for the entire GPE register */
gpe_register_info = gpe_event_info->register_info;
@@ -96,7 +90,6 @@ acpi_hw_write_gpe_enable_reg (
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_clear_gpe
@@ -109,27 +102,23 @@ acpi_hw_write_gpe_enable_reg (
*
******************************************************************************/
acpi_status
acpi_hw_clear_gpe (
struct acpi_gpe_event_info *gpe_event_info)
acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
{
acpi_status status;
ACPI_FUNCTION_ENTRY();
/*
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
status = acpi_hw_low_level_write(8, gpe_event_info->register_bit,
&gpe_event_info->register_info->status_address);
&gpe_event_info->register_info->
status_address);
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_get_gpe_status
@@ -145,8 +134,7 @@ acpi_hw_clear_gpe (
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_hw_get_gpe_status (
struct acpi_gpe_event_info *gpe_event_info,
acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
acpi_event_status * event_status)
{
u32 in_byte;
@@ -155,10 +143,8 @@ acpi_hw_get_gpe_status (
acpi_status status;
acpi_event_status local_event_status = 0;
ACPI_FUNCTION_ENTRY();
if (!event_status) {
return (AE_BAD_PARAMETER);
}
@@ -185,7 +171,9 @@ acpi_hw_get_gpe_status (
/* GPE currently active (status bit == 1)? */
status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address);
status =
acpi_hw_low_level_read(8, &in_byte,
&gpe_register_info->status_address);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
@@ -198,13 +186,11 @@ acpi_hw_get_gpe_status (
(*event_status) = local_event_status;
unlock_and_exit:
return (status);
}
#endif /* ACPI_FUTURE_USAGE */
/******************************************************************************
*
* FUNCTION: acpi_hw_disable_gpe_block
@@ -219,21 +205,20 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_hw_disable_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
struct acpi_gpe_block_info * gpe_block)
{
u32 i;
acpi_status status;
/* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) {
/* Disable all GPEs in this register */
status = acpi_hw_low_level_write(8, 0x00,
&gpe_block->register_info[i].enable_address);
&gpe_block->register_info[i].
enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -242,7 +227,6 @@ acpi_hw_disable_gpe_block (
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_clear_gpe_block
@@ -257,21 +241,20 @@ acpi_hw_disable_gpe_block (
******************************************************************************/
acpi_status
acpi_hw_clear_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
struct acpi_gpe_block_info * gpe_block)
{
u32 i;
acpi_status status;
/* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) {
/* Clear status on all GPEs in this register */
status = acpi_hw_low_level_write(8, 0xFF,
&gpe_block->register_info[i].status_address);
&gpe_block->register_info[i].
status_address);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -280,7 +263,6 @@ acpi_hw_clear_gpe_block (
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_enable_runtime_gpe_block
@@ -296,14 +278,12 @@ acpi_hw_clear_gpe_block (
******************************************************************************/
acpi_status
acpi_hw_enable_runtime_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
struct acpi_gpe_block_info * gpe_block)
{
u32 i;
acpi_status status;
/* NOTE: assumes that all GPEs are currently disabled */
/* Examine each GPE Register within the block */
@@ -315,8 +295,12 @@ acpi_hw_enable_runtime_gpe_block (
/* Enable all "runtime" GPEs in this register */
status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_run,
&gpe_block->register_info[i].enable_address);
status =
acpi_hw_low_level_write(8,
gpe_block->register_info[i].
enable_for_run,
&gpe_block->register_info[i].
enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -325,7 +309,6 @@ acpi_hw_enable_runtime_gpe_block (
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_enable_wakeup_gpe_block
@@ -341,14 +324,12 @@ acpi_hw_enable_runtime_gpe_block (
******************************************************************************/
static acpi_status
acpi_hw_enable_wakeup_gpe_block (
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block)
{
u32 i;
acpi_status status;
/* Examine each GPE Register within the block */
for (i = 0; i < gpe_block->register_count; i++) {
@@ -359,8 +340,10 @@ acpi_hw_enable_wakeup_gpe_block (
/* Enable all "wake" GPEs in this register */
status = acpi_hw_low_level_write(8,
gpe_block->register_info[i].enable_for_wake,
&gpe_block->register_info[i].enable_address);
gpe_block->register_info[i].
enable_for_wake,
&gpe_block->register_info[i].
enable_address);
if (ACPI_FAILURE(status)) {
return (status);
}
@@ -369,7 +352,6 @@ acpi_hw_enable_wakeup_gpe_block (
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_disable_all_gpes
@@ -382,22 +364,17 @@ acpi_hw_enable_wakeup_gpe_block (
*
******************************************************************************/
acpi_status
acpi_hw_disable_all_gpes (
void)
acpi_status acpi_hw_disable_all_gpes(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_enable_all_runtime_gpes
@@ -410,21 +387,16 @@ acpi_hw_disable_all_gpes (
*
******************************************************************************/
acpi_status
acpi_hw_enable_all_runtime_gpes (
void)
acpi_status acpi_hw_enable_all_runtime_gpes(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_enable_all_wakeup_gpes
@@ -437,17 +409,12 @@ acpi_hw_enable_all_runtime_gpes (
*
******************************************************************************/
acpi_status
acpi_hw_enable_all_wakeup_gpes (
void)
acpi_status acpi_hw_enable_all_wakeup_gpes(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
return_ACPI_STATUS(status);
}

View File

@@ -52,7 +52,6 @@
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwregs")
/*******************************************************************************
*
* FUNCTION: acpi_hw_clear_acpi_status
@@ -65,17 +64,12 @@
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
*
******************************************************************************/
acpi_status
acpi_hw_clear_acpi_status (
u32 flags)
acpi_status acpi_hw_clear_acpi_status(u32 flags)
{
acpi_status status;
ACPI_FUNCTION_TRACE("hw_clear_acpi_status");
ACPI_DEBUG_PRINT((ACPI_DB_IO, "About to write %04X to %04X\n",
ACPI_BITMASK_ALL_FIXED_STATUS,
(u16) acpi_gbl_FADT->xpm1a_evt_blk.address));
@@ -97,7 +91,8 @@ acpi_hw_clear_acpi_status (
/* Clear the fixed events */
if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
status =
acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
&acpi_gbl_FADT->xpm1b_evt_blk);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
@@ -115,7 +110,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_get_sleep_type_data
@@ -132,23 +126,17 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_get_sleep_type_data (
u8 sleep_state,
u8 *sleep_type_a,
u8 *sleep_type_b)
acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
{
acpi_status status = AE_OK;
struct acpi_parameter_info info;
char *sleep_state_name;
ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data");
/* Validate parameters */
if ((sleep_state > ACPI_S_STATES_MAX) ||
!sleep_type_a || !sleep_type_b) {
if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -162,7 +150,8 @@ acpi_get_sleep_type_data (
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"%s while evaluating sleep_state [%s]\n",
acpi_format_exception (status), sleep_state_name));
acpi_format_exception(status),
sleep_state_name));
return_ACPI_STATUS(status);
}
@@ -190,8 +179,7 @@ acpi_get_sleep_type_data (
* one per sleep type (A/B).
*/
else if (info.return_object->package.count < 2) {
ACPI_REPORT_ERROR ((
"Sleep State return package does not have at least two elements\n"));
ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n"));
status = AE_AML_NO_OPERAND;
}
@@ -201,13 +189,9 @@ acpi_get_sleep_type_data (
!= ACPI_TYPE_INTEGER) ||
(ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
!= ACPI_TYPE_INTEGER)) {
ACPI_REPORT_ERROR ((
"Sleep State return package elements are not both Integers (%s, %s)\n",
acpi_ut_get_object_type_name (info.return_object->package.elements[0]),
acpi_ut_get_object_type_name (info.return_object->package.elements[1])));
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])));
status = AE_AML_OPERAND_TYPE;
}
else {
} else {
/* Valid _Sx_ package size, type, and value */
*sleep_type_a = (u8)
@@ -221,14 +205,15 @@ acpi_get_sleep_type_data (
"%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
acpi_format_exception(status),
sleep_state_name, info.return_object,
acpi_ut_get_object_type_name (info.return_object)));
acpi_ut_get_object_type_name(info.
return_object)));
}
acpi_ut_remove_reference(info.return_object);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_get_sleep_type_data);
EXPORT_SYMBOL(acpi_get_sleep_type_data);
/*******************************************************************************
*
@@ -242,22 +227,20 @@ 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");
if (register_id > ACPI_BITREG_MAX) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid bit_register ID: %X\n", register_id));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid bit_register ID: %X\n",
register_id));
return (NULL);
}
return (&acpi_gbl_bit_register_info[register_id]);
}
/*******************************************************************************
*
* FUNCTION: acpi_get_register
@@ -273,20 +256,14 @@ acpi_hw_get_bit_register_info (
*
******************************************************************************/
acpi_status
acpi_get_register (
u32 register_id,
u32 *return_value,
u32 flags)
acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
{
u32 register_value = 0;
struct acpi_bit_register_info *bit_reg_info;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_get_register");
/* Get the info structure corresponding to the requested ACPI Register */
bit_reg_info = acpi_hw_get_bit_register_info(register_id);
@@ -304,7 +281,8 @@ acpi_get_register (
/* Read from the register */
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
bit_reg_info->parent_register, &register_value);
bit_reg_info->parent_register,
&register_value);
if (flags & ACPI_MTX_LOCK) {
(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
@@ -313,19 +291,21 @@ acpi_get_register (
if (ACPI_SUCCESS(status)) {
/* Normalize the value that was read */
register_value = ((register_value & bit_reg_info->access_bit_mask)
register_value =
((register_value & bit_reg_info->access_bit_mask)
>> bit_reg_info->bit_position);
*return_value = register_value;
ACPI_DEBUG_PRINT((ACPI_DB_IO, "Read value %8.8X register %X\n",
register_value, bit_reg_info->parent_register));
register_value,
bit_reg_info->parent_register));
}
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_get_register);
EXPORT_SYMBOL(acpi_get_register);
/*******************************************************************************
*
@@ -342,25 +322,20 @@ EXPORT_SYMBOL(acpi_get_register);
*
******************************************************************************/
acpi_status
acpi_set_register (
u32 register_id,
u32 value,
u32 flags)
acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
{
u32 register_value = 0;
struct acpi_bit_register_info *bit_reg_info;
acpi_status status;
ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id);
/* Get the info structure corresponding to the requested ACPI Register */
bit_reg_info = acpi_hw_get_bit_register_info(register_id);
if (!bit_reg_info) {
ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id));
ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n",
register_id));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -374,7 +349,8 @@ acpi_set_register (
/* Always do a register read first so we can insert the new bits */
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
bit_reg_info->parent_register, &register_value);
bit_reg_info->parent_register,
&register_value);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
@@ -396,25 +372,29 @@ acpi_set_register (
* be written as 0 so they will be left unchanged.
*/
value = ACPI_REGISTER_PREPARE_BITS(value,
bit_reg_info->bit_position, bit_reg_info->access_bit_mask);
bit_reg_info->bit_position,
bit_reg_info->
access_bit_mask);
if (value) {
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_STATUS, (u16) value);
ACPI_REGISTER_PM1_STATUS,
(u16) value);
register_value = 0;
}
break;
case ACPI_REGISTER_PM1_ENABLE:
ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
bit_reg_info->access_bit_mask, value);
ACPI_REGISTER_INSERT_VALUE(register_value,
bit_reg_info->bit_position,
bit_reg_info->access_bit_mask,
value);
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_ENABLE, (u16) register_value);
ACPI_REGISTER_PM1_ENABLE,
(u16) register_value);
break;
case ACPI_REGISTER_PM1_CONTROL:
/*
@@ -422,47 +402,54 @@ acpi_set_register (
* Note that at this level, the fact that there are actually TWO
* registers (A and B - and B may not exist) is abstracted.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", register_value));
ACPI_DEBUG_PRINT((ACPI_DB_IO, "PM1 control: Read %X\n",
register_value));
ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
bit_reg_info->access_bit_mask, value);
ACPI_REGISTER_INSERT_VALUE(register_value,
bit_reg_info->bit_position,
bit_reg_info->access_bit_mask,
value);
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, (u16) register_value);
ACPI_REGISTER_PM1_CONTROL,
(u16) register_value);
break;
case ACPI_REGISTER_PM2_CONTROL:
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM2_CONTROL, &register_value);
ACPI_REGISTER_PM2_CONTROL,
&register_value);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"PM2 control: Read %X from %8.8X%8.8X\n",
register_value,
ACPI_FORMAT_UINT64 (
acpi_gbl_FADT->xpm2_cnt_blk.address)));
ACPI_FORMAT_UINT64(acpi_gbl_FADT->
xpm2_cnt_blk.address)));
ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
bit_reg_info->access_bit_mask, value);
ACPI_REGISTER_INSERT_VALUE(register_value,
bit_reg_info->bit_position,
bit_reg_info->access_bit_mask,
value);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"About to write %4.4X to %8.8X%8.8X\n",
register_value,
ACPI_FORMAT_UINT64 (
acpi_gbl_FADT->xpm2_cnt_blk.address)));
ACPI_FORMAT_UINT64(acpi_gbl_FADT->
xpm2_cnt_blk.address)));
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
ACPI_REGISTER_PM2_CONTROL,
(u8) (register_value));
break;
default:
break;
}
unlock_and_exit:
if (flags & ACPI_MTX_LOCK) {
@@ -475,12 +462,13 @@ unlock_and_exit:
((register_value & bit_reg_info->access_bit_mask) >>
bit_reg_info->bit_position));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
value, register_value, bit_reg_info->parent_register));
ACPI_DEBUG_PRINT((ACPI_DB_IO,
"Set bits: %8.8X actual %8.8X register %X\n", value,
register_value, bit_reg_info->parent_register));
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_set_register);
EXPORT_SYMBOL(acpi_set_register);
/******************************************************************************
*
@@ -498,19 +486,14 @@ EXPORT_SYMBOL(acpi_set_register);
******************************************************************************/
acpi_status
acpi_hw_register_read (
u8 use_lock,
u32 register_id,
u32 *return_value)
acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
{
u32 value1 = 0;
u32 value2 = 0;
acpi_status status;
ACPI_FUNCTION_TRACE("hw_register_read");
if (ACPI_MTX_LOCK == use_lock) {
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
if (ACPI_FAILURE(status)) {
@@ -521,53 +504,63 @@ acpi_hw_register_read (
switch (register_id) {
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_evt_blk);
status =
acpi_hw_low_level_read(16, &value1,
&acpi_gbl_FADT->xpm1a_evt_blk);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* PM1B is optional */
status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_evt_blk);
status =
acpi_hw_low_level_read(16, &value2,
&acpi_gbl_FADT->xpm1b_evt_blk);
value1 |= value2;
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_xpm1a_enable);
status =
acpi_hw_low_level_read(16, &value1, &acpi_gbl_xpm1a_enable);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* PM1B is optional */
status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_xpm1b_enable);
status =
acpi_hw_low_level_read(16, &value2, &acpi_gbl_xpm1b_enable);
value1 |= value2;
break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_cnt_blk);
status =
acpi_hw_low_level_read(16, &value1,
&acpi_gbl_FADT->xpm1a_cnt_blk);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
status = acpi_hw_low_level_read (16, &value2, &acpi_gbl_FADT->xpm1b_cnt_blk);
status =
acpi_hw_low_level_read(16, &value2,
&acpi_gbl_FADT->xpm1b_cnt_blk);
value1 |= value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->xpm2_cnt_blk);
status =
acpi_hw_low_level_read(8, &value1,
&acpi_gbl_FADT->xpm2_cnt_blk);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->xpm_tmr_blk);
status =
acpi_hw_low_level_read(32, &value1,
&acpi_gbl_FADT->xpm_tmr_blk);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
@@ -594,7 +587,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_register_write
@@ -610,18 +602,12 @@ unlock_and_exit:
*
******************************************************************************/
acpi_status
acpi_hw_register_write (
u8 use_lock,
u32 register_id,
u32 value)
acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
{
acpi_status status;
ACPI_FUNCTION_TRACE("hw_register_write");
if (ACPI_MTX_LOCK == use_lock) {
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
if (ACPI_FAILURE(status)) {
@@ -632,65 +618,76 @@ acpi_hw_register_write (
switch (register_id) {
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_evt_blk);
status =
acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1a_evt_blk);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* PM1B is optional */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_evt_blk);
status =
acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1b_evt_blk);
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1a_enable);
status =
acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1a_enable);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
/* PM1B is optional */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_xpm1b_enable);
status =
acpi_hw_low_level_write(16, value, &acpi_gbl_xpm1b_enable);
break;
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
status =
acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1a_cnt_blk);
if (ACPI_FAILURE(status)) {
goto unlock_and_exit;
}
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
status =
acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1b_cnt_blk);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
status =
acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1a_cnt_blk);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
status =
acpi_hw_low_level_write(16, value,
&acpi_gbl_FADT->xpm1b_cnt_blk);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->xpm2_cnt_blk);
status =
acpi_hw_low_level_write(8, value,
&acpi_gbl_FADT->xpm2_cnt_blk);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->xpm_tmr_blk);
status =
acpi_hw_low_level_write(32, value,
&acpi_gbl_FADT->xpm_tmr_blk);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
/* SMI_CMD is currently always in IO space */
@@ -698,7 +695,6 @@ acpi_hw_register_write (
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8);
break;
default:
status = AE_BAD_PARAMETER;
break;
@@ -712,7 +708,6 @@ unlock_and_exit:
return_ACPI_STATUS(status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_low_level_read
@@ -728,18 +723,13 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_hw_low_level_read (
u32 width,
u32 *value,
struct acpi_generic_address *reg)
acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
{
u64 address;
acpi_status status;
ACPI_FUNCTION_NAME("hw_low_level_read");
/*
* Must have a valid pointer to a GAS structure, and
* a non-zero address within. However, don't return an error
@@ -764,22 +754,20 @@ acpi_hw_low_level_read (
switch (reg->address_space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
status = acpi_os_read_memory (
(acpi_physical_address) address,
status = acpi_os_read_memory((acpi_physical_address) address,
value, width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
status = acpi_os_read_port((acpi_io_address) address,
value, width);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unsupported address space: %X\n", reg->address_space_id));
"Unsupported address space: %X\n",
reg->address_space_id));
return (AE_BAD_PARAMETER);
}
@@ -792,7 +780,6 @@ acpi_hw_low_level_read (
return (status);
}
/******************************************************************************
*
* FUNCTION: acpi_hw_low_level_write
@@ -808,18 +795,13 @@ acpi_hw_low_level_read (
******************************************************************************/
acpi_status
acpi_hw_low_level_write (
u32 width,
u32 value,
struct acpi_generic_address *reg)
acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
{
u64 address;
acpi_status status;
ACPI_FUNCTION_NAME("hw_low_level_write");
/*
* Must have a valid pointer to a GAS structure, and
* a non-zero address within. However, don't return an error
@@ -843,22 +825,20 @@ acpi_hw_low_level_write (
switch (reg->address_space_id) {
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
status = acpi_os_write_memory (
(acpi_physical_address) address,
status = acpi_os_write_memory((acpi_physical_address) address,
value, width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
status = acpi_os_write_port((acpi_io_address) address,
value, width);
break;
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unsupported address space: %X\n", reg->address_space_id));
"Unsupported address space: %X\n",
reg->address_space_id));
return (AE_BAD_PARAMETER);
}

View File

@@ -48,7 +48,6 @@
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwsleep")
/*******************************************************************************
*
* FUNCTION: acpi_set_firmware_waking_vector
@@ -61,30 +60,25 @@
* DESCRIPTION: Access function for the firmware_waking_vector field in FACS
*
******************************************************************************/
acpi_status
acpi_set_firmware_waking_vector (
acpi_physical_address physical_address)
acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
{
ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector");
/* Set the vector */
if (acpi_gbl_common_fACS.vector_width == 32) {
*(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector))
*(ACPI_CAST_PTR
(u32, acpi_gbl_common_fACS.firmware_waking_vector))
= (u32) physical_address;
}
else {
*acpi_gbl_common_fACS.firmware_waking_vector
= physical_address;
} else {
*acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
}
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_get_firmware_waking_vector
@@ -101,13 +95,11 @@ acpi_set_firmware_waking_vector (
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_get_firmware_waking_vector (
acpi_physical_address *physical_address)
acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
{
ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector");
if (!physical_address) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -116,9 +108,10 @@ acpi_get_firmware_waking_vector (
if (acpi_gbl_common_fACS.vector_width == 32) {
*physical_address = (acpi_physical_address)
*(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector));
}
else {
*
(ACPI_CAST_PTR
(u32, acpi_gbl_common_fACS.firmware_waking_vector));
} else {
*physical_address =
*acpi_gbl_common_fACS.firmware_waking_vector;
}
@@ -127,7 +120,6 @@ acpi_get_firmware_waking_vector (
}
#endif
/*******************************************************************************
*
* FUNCTION: acpi_enter_sleep_state_prep
@@ -143,23 +135,20 @@ acpi_get_firmware_waking_vector (
*
******************************************************************************/
acpi_status
acpi_enter_sleep_state_prep (
u8 sleep_state)
acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
{
acpi_status status;
struct acpi_object_list arg_list;
union acpi_object arg;
ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep");
/*
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
*/
status = acpi_get_sleep_type_data(sleep_state,
&acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
&acpi_gbl_sleep_type_a,
&acpi_gbl_sleep_type_b);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -217,7 +206,6 @@ acpi_enter_sleep_state_prep (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_enter_sleep_state
@@ -231,9 +219,7 @@ acpi_enter_sleep_state_prep (
*
******************************************************************************/
acpi_status asmlinkage
acpi_enter_sleep_state (
u8 sleep_state)
acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
{
u32 PM1Acontrol;
u32 PM1Bcontrol;
@@ -242,23 +228,25 @@ acpi_enter_sleep_state (
u32 in_value;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_enter_sleep_state");
if ((acpi_gbl_sleep_type_a > 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_gbl_sleep_type_a, acpi_gbl_sleep_type_b));
acpi_gbl_sleep_type_a,
acpi_gbl_sleep_type_b));
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
}
sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
sleep_type_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
sleep_enable_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
/* Clear wake status */
status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
status =
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -303,8 +291,10 @@ acpi_enter_sleep_state (
/* Insert SLP_TYP bits */
PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
PM1Acontrol |=
(acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
PM1Bcontrol |=
(acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
/*
* We split the writes of SLP_TYP and SLP_EN to workaround
@@ -314,13 +304,15 @@ acpi_enter_sleep_state (
/* Write #1: fill in SLP_TYP data */
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
ACPI_REGISTER_PM1A_CONTROL,
PM1Acontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
ACPI_REGISTER_PM1B_CONTROL,
PM1Bcontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -335,13 +327,15 @@ acpi_enter_sleep_state (
ACPI_FLUSH_CPU_CACHE();
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
ACPI_REGISTER_PM1A_CONTROL,
PM1Acontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
ACPI_REGISTER_PM1B_CONTROL,
PM1Bcontrol);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -362,7 +356,8 @@ acpi_enter_sleep_state (
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL,
sleep_enable_reg_info->access_bit_mask);
sleep_enable_reg_info->
access_bit_mask);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -383,8 +378,8 @@ acpi_enter_sleep_state (
return_ACPI_STATUS(AE_OK);
}
EXPORT_SYMBOL(acpi_enter_sleep_state);
EXPORT_SYMBOL(acpi_enter_sleep_state);
/*******************************************************************************
*
@@ -399,18 +394,15 @@ EXPORT_SYMBOL(acpi_enter_sleep_state);
*
******************************************************************************/
acpi_status asmlinkage
acpi_enter_sleep_state_s4bios (
void)
acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
{
u32 in_value;
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios");
status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
status =
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -451,8 +443,8 @@ acpi_enter_sleep_state_s4bios (
return_ACPI_STATUS(AE_OK);
}
EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
/*******************************************************************************
*
@@ -467,9 +459,7 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
*
******************************************************************************/
acpi_status
acpi_leave_sleep_state (
u8 sleep_state)
acpi_status acpi_leave_sleep_state(u8 sleep_state)
{
struct acpi_object_list arg_list;
union acpi_object arg;
@@ -479,43 +469,52 @@ acpi_leave_sleep_state (
u32 PM1Acontrol;
u32 PM1Bcontrol;
ACPI_FUNCTION_TRACE("acpi_leave_sleep_state");
/*
* Set SLP_TYPE and SLP_EN to state S0.
* This is unclear from the ACPI Spec, but it is required
* by some machines.
*/
status = acpi_get_sleep_type_data(ACPI_STATE_S0,
&acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
&acpi_gbl_sleep_type_a,
&acpi_gbl_sleep_type_b);
if (ACPI_SUCCESS(status)) {
sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
sleep_type_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_TYPE_A);
sleep_enable_reg_info =
acpi_hw_get_bit_register_info(ACPI_BITREG_SLEEP_ENABLE);
/* Get current value of PM1A control */
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
ACPI_REGISTER_PM1_CONTROL,
&PM1Acontrol);
if (ACPI_SUCCESS(status)) {
/* Clear SLP_EN and SLP_TYP fields */
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
sleep_enable_reg_info->access_bit_mask);
sleep_enable_reg_info->
access_bit_mask);
PM1Bcontrol = PM1Acontrol;
/* Insert SLP_TYP bits */
PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
PM1Acontrol |=
(acpi_gbl_sleep_type_a << sleep_type_reg_info->
bit_position);
PM1Bcontrol |=
(acpi_gbl_sleep_type_b << sleep_type_reg_info->
bit_position);
/* Just ignore any errors */
(void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
ACPI_REGISTER_PM1A_CONTROL,
PM1Acontrol);
(void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
ACPI_REGISTER_PM1B_CONTROL,
PM1Bcontrol);
}
}
@@ -570,13 +569,15 @@ acpi_leave_sleep_state (
/* Enable power button */
(void) acpi_set_register(
acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
1, ACPI_MTX_DO_NOT_LOCK);
(void)
acpi_set_register(acpi_gbl_fixed_event_info
[ACPI_EVENT_POWER_BUTTON].enable_register_id, 1,
ACPI_MTX_DO_NOT_LOCK);
(void) acpi_set_register(
acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
1, ACPI_MTX_DO_NOT_LOCK);
(void)
acpi_set_register(acpi_gbl_fixed_event_info
[ACPI_EVENT_POWER_BUTTON].status_register_id, 1,
ACPI_MTX_DO_NOT_LOCK);
arg.integer.value = ACPI_SST_WORKING;
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);

View File

@@ -48,7 +48,6 @@
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME("hwtimer")
/******************************************************************************
*
* FUNCTION: acpi_get_timer_resolution
@@ -60,29 +59,23 @@
* DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits).
*
******************************************************************************/
acpi_status
acpi_get_timer_resolution (
u32 *resolution)
acpi_status acpi_get_timer_resolution(u32 * resolution)
{
ACPI_FUNCTION_TRACE("acpi_get_timer_resolution");
if (!resolution) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
if (0 == acpi_gbl_FADT->tmr_val_ext) {
*resolution = 24;
}
else {
} else {
*resolution = 32;
}
return_ACPI_STATUS(AE_OK);
}
/******************************************************************************
*
* FUNCTION: acpi_get_timer
@@ -95,16 +88,12 @@ acpi_get_timer_resolution (
*
******************************************************************************/
acpi_status
acpi_get_timer (
u32 *ticks)
acpi_status acpi_get_timer(u32 * ticks)
{
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_get_timer");
if (!ticks) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -113,8 +102,8 @@ acpi_get_timer (
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_get_timer);
EXPORT_SYMBOL(acpi_get_timer);
/******************************************************************************
*
@@ -146,19 +135,14 @@ EXPORT_SYMBOL(acpi_get_timer);
******************************************************************************/
acpi_status
acpi_get_timer_duration (
u32 start_ticks,
u32 end_ticks,
u32 *time_elapsed)
acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
{
acpi_status status;
u32 delta_ticks;
acpi_integer quotient;
ACPI_FUNCTION_TRACE("acpi_get_timer_duration");
if (!time_elapsed) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -169,20 +153,20 @@ acpi_get_timer_duration (
*/
if (start_ticks < end_ticks) {
delta_ticks = end_ticks - start_ticks;
}
else if (start_ticks > end_ticks) {
} else if (start_ticks > end_ticks) {
if (0 == acpi_gbl_FADT->tmr_val_ext) {
/* 24-bit Timer */
delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
}
else {
delta_ticks =
(((0x00FFFFFF - start_ticks) +
end_ticks) & 0x00FFFFFF);
} else {
/* 32-bit Timer */
delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
}
}
else /* start_ticks == end_ticks */ {
} else { /* start_ticks == end_ticks */
*time_elapsed = 0;
return_ACPI_STATUS(AE_OK);
}
@@ -200,4 +184,3 @@ acpi_get_timer_duration (
}
EXPORT_SYMBOL(acpi_get_timer_duration);

View File

@@ -496,14 +496,12 @@ static void free_hotkey_device(union acpi_hotkey *key)
return_VOID;
}
static void
free_hotkey_buffer(union acpi_hotkey *key)
static void free_hotkey_buffer(union acpi_hotkey *key)
{
kfree(key->event_hotkey.action_method);
}
static void
free_poll_hotkey_buffer(union acpi_hotkey *key)
static void free_poll_hotkey_buffer(union acpi_hotkey *key)
{
kfree(key->poll_hotkey.action_method);
kfree(key->poll_hotkey.poll_method);
@@ -529,11 +527,14 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
key->event_hotkey.flag = 0;
key->event_hotkey.action_method = method;
status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle));
status =
acpi_get_handle(NULL, bus_str, &(key->event_hotkey.bus_handle));
if (ACPI_FAILURE(status))
goto do_fail;
key->event_hotkey.external_hotkey_num = external_num;
status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle));
status =
acpi_get_handle(NULL, action_str,
&(key->event_hotkey.action_handle));
if (ACPI_FAILURE(status))
goto do_fail;
status = acpi_get_handle(key->event_hotkey.action_handle,
@@ -568,14 +569,17 @@ init_poll_hotkey_device(union acpi_hotkey *key,
key->poll_hotkey.poll_method = poll_method;
key->poll_hotkey.action_method = action_method;
status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle));
status =
acpi_get_handle(NULL, poll_str, &(key->poll_hotkey.poll_handle));
if (ACPI_FAILURE(status))
goto do_fail;
status = acpi_get_handle(key->poll_hotkey.poll_handle,
poll_method, &tmp_handle);
if (ACPI_FAILURE(status))
goto do_fail;
status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle));
status =
acpi_get_handle(NULL, action_str,
&(key->poll_hotkey.action_handle));
if (ACPI_FAILURE(status))
goto do_fail;
status = acpi_get_handle(key->poll_hotkey.action_handle,
@@ -591,7 +595,6 @@ do_fail:
return_VALUE(-ENODEV);
}
static int hotkey_open_config(struct inode *inode, struct file *file)
{
ACPI_FUNCTION_TRACE("hotkey_open_config");
@@ -680,7 +683,8 @@ get_parms(char *config_record,
sscanf(config_record, "%d", cmd);
if (*cmd == 1) {
if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2)
if (sscanf(config_record, "%d:%d", cmd, internal_event_num) !=
2)
goto do_fail;
else
return (6);
@@ -734,7 +738,8 @@ get_parms(char *config_record,
strncpy(*method, tmp, count);
*(*method + count) = 0;
if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0)
if (sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num) <=
0)
goto do_fail;
return_VALUE(6);
@@ -807,7 +812,8 @@ do_fail:
if (IS_EVENT(internal_event_num)) {
kfree(bus_method);
ret = init_hotkey_device(key, bus_handle, action_handle, method,
internal_event_num, external_event_num);
internal_event_num,
external_event_num);
} else
ret = init_poll_hotkey_device(key, bus_handle, bus_method,
action_handle, method,
@@ -830,7 +836,8 @@ cont_cmd:
switch (cmd) {
case 0:
if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num))
if (get_hotkey_by_event
(&global_hotkey_list, key->link.hotkey_standard_num))
goto fail_out;
else
hotkey_add(key);
@@ -882,7 +889,8 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
return_VALUE(status == AE_OK);
}
static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val)
static int read_acpi_int(acpi_handle handle, const char *method,
union acpi_object *val)
{
struct acpi_buffer output;
union acpi_object out_obj;
@@ -948,7 +956,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
return_VALUE(-EINVAL);
}
if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) {
if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) !=
4) {
kfree(arg);
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
return_VALUE(-EINVAL);
@@ -960,7 +969,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
goto do_fail;
if (IS_EVENT(event))
write_acpi_int(key->event_hotkey.action_handle,
key->event_hotkey.action_method, value, NULL);
key->event_hotkey.action_method, value,
NULL);
else if (IS_POLL(event)) {
if (method_type == POLL_METHOD)
read_acpi_int(key->poll_hotkey.poll_handle,
@@ -968,7 +978,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
key->poll_hotkey.poll_result);
else if (method_type == ACTION_METHOD)
write_acpi_int(key->poll_hotkey.action_handle,
key->poll_hotkey.action_method, value, NULL);
key->poll_hotkey.action_method,
value, NULL);
else
goto do_fail;

View File

@@ -86,32 +86,26 @@ static acpi_handle root_handle = NULL;
static acpi_handle *object##_parent = &parent##_handle; \
static char *object##_paths[] = { paths }
IBM_HANDLE(ec, root,
"\\_SB.PCI0.ISA.EC", /* A21e, A22p, T20, T21, X20 */
IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC", /* A21e, A22p, T20, T21, X20 */
"\\_SB.PCI0.LPC.EC", /* all others */
);
IBM_HANDLE(vid, root,
"\\_SB.PCI0.VID", /* A21e, G40, X30, X40 */
IBM_HANDLE(vid, root, "\\_SB.PCI0.VID", /* A21e, G40, X30, X40 */
"\\_SB.PCI0.AGP.VID", /* all others */
);
IBM_HANDLE(cmos, root,
"\\UCMS", /* R50, R50p, R51, T4x, X31, X40 */
IBM_HANDLE(cmos, root, "\\UCMS", /* R50, R50p, R51, T4x, X31, X40 */
"\\CMOS", /* A3x, G40, R32, T23, T30, X22, X24, X30 */
"\\CMS", /* R40, R40e */
); /* A21e, A22p, T20, T21, X20 */
IBM_HANDLE(dock, root,
"\\_SB.GDCK", /* X30, X31, X40 */
IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */
"\\_SB.PCI0.DOCK", /* A22p, T20, T21, X20 */
"\\_SB.PCI0.PCI1.DOCK", /* all others */
); /* A21e, G40, R32, R40, R40e */
IBM_HANDLE(bay, root,
"\\_SB.PCI0.IDE0.SCND.MSTR"); /* all except A21e */
IBM_HANDLE(bayej, root,
"\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */
IBM_HANDLE(bay, root, "\\_SB.PCI0.IDE0.SCND.MSTR"); /* all except A21e */
IBM_HANDLE(bayej, root, "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */
IBM_HANDLE(lght, root, "\\LGHT"); /* A21e, A22p, T20, T21, X20 */
IBM_HANDLE(hkey, ec, "HKEY"); /* all */
@@ -318,8 +312,7 @@ static int hotkey_init(struct ibm_struct *ibm)
ibm->supported = 1;
ret = hotkey_get(ibm,
&ibm->state.hotkey.status,
&ibm->state.hotkey.mask);
&ibm->state.hotkey.status, &ibm->state.hotkey.mask);
if (ret < 0) {
/* mask not supported on A21e, A22p, T20, T21, X20, X22, X24 */
ibm->supported = 0;
@@ -463,8 +456,7 @@ static int bluetooth_write(struct ibm_struct *ibm, char *buf)
static int video_init(struct ibm_struct *ibm)
{
if (!acpi_evalf(vid_handle,
&ibm->state.video.autoswitch, "^VDEE", "d"))
if (!acpi_evalf(vid_handle, &ibm->state.video.autoswitch, "^VDEE", "d"))
return -ENODEV;
return 0;
@@ -566,8 +558,7 @@ static int video_write(struct ibm_struct *ibm, char *buf)
static void video_exit(struct ibm_struct *ibm)
{
acpi_evalf(vid_handle, NULL, "_DOS", "vd",
ibm->state.video.autoswitch);
acpi_evalf(vid_handle, NULL, "_DOS", "vd", ibm->state.video.autoswitch);
}
static int light_init(struct ibm_struct *ibm)
@@ -928,6 +919,7 @@ static struct ibm_struct ibms[] = {
.experimental = 1,
},
};
#define NUM_IBMS (sizeof(ibms)/sizeof(ibms[0]))
static int dispatch_read(char *page, char **start, off_t off, int count,
@@ -1146,7 +1138,6 @@ static int ibm_handle_init(char *name,
ibm_handle_init(#object, &object##_handle, *object##_parent, \
object##_paths, sizeof(object##_paths)/sizeof(char*), required)
static int set_ibm_param(const char *val, struct kernel_param *kp)
{
unsigned int i;
@@ -1192,8 +1183,7 @@ static int __init acpi_ibm_init(void)
/* these handles are required */
if (IBM_HANDLE_INIT(ec, 1) < 0 ||
IBM_HANDLE_INIT(hkey, 1) < 0 ||
IBM_HANDLE_INIT(vid, 1) < 0 ||
IBM_HANDLE_INIT(beep, 1) < 0)
IBM_HANDLE_INIT(vid, 1) < 0 || IBM_HANDLE_INIT(beep, 1) < 0)
return -ENODEV;
/* these handles have alternatives */

View File

@@ -35,7 +35,6 @@ ACPI_MODULE_NAME ("acpi_motherboard")
/* Dell use PNP0C01 instead of PNP0C02 */
#define ACPI_MB_HID1 "PNP0C01"
#define ACPI_MB_HID2 "PNP0C02"
/**
* Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
* Doesn't care about the failure of 'request_region', since other may reserve
@@ -44,15 +43,12 @@ ACPI_MODULE_NAME ("acpi_motherboard")
#define IS_RESERVED_ADDR(base, len) \
(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
&& ((base) + (len) > 0x1000))
/*
* Clearing the flag (IORESOURCE_BUSY) allows drivers to use
* the io ports if they really know they can use it, while
* still preventing hotplug PCI devices from using it.
*/
static acpi_status
acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
static acpi_status acpi_reserve_io_ranges(struct acpi_resource *res, void *data)
{
struct resource *requested_res = NULL;
@@ -63,22 +59,32 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
if (io_res->min_base_address != io_res->max_base_address)
return_VALUE(AE_OK);
if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
if (IS_RESERVED_ADDR
(io_res->min_base_address, io_res->range_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n",
io_res->min_base_address,
io_res->min_base_address + io_res->range_length));
requested_res = request_region(io_res->min_base_address,
io_res->min_base_address +
io_res->range_length));
requested_res =
request_region(io_res->min_base_address,
io_res->range_length, "motherboard");
}
} else if (res->id == ACPI_RSTYPE_FIXED_IO) {
struct acpi_resource_fixed_io *fixed_io_res = &res->data.fixed_io;
struct acpi_resource_fixed_io *fixed_io_res =
&res->data.fixed_io;
if (IS_RESERVED_ADDR(fixed_io_res->base_address, fixed_io_res->range_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
if (IS_RESERVED_ADDR
(fixed_io_res->base_address, fixed_io_res->range_length)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Motherboard resources 0x%08x - 0x%08x\n",
fixed_io_res->base_address,
fixed_io_res->base_address + fixed_io_res->range_length));
requested_res = request_region(fixed_io_res->base_address,
fixed_io_res->range_length, "motherboard");
fixed_io_res->base_address +
fixed_io_res->range_length));
requested_res =
request_region(fixed_io_res->base_address,
fixed_io_res->range_length,
"motherboard");
}
} else {
/* Memory mapped IO? */
@@ -117,8 +123,7 @@ static struct acpi_driver acpi_motherboard_driver2 = {
},
};
static void __init
acpi_reserve_resources (void)
static void __init acpi_reserve_resources(void)
{
if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
@@ -137,8 +142,7 @@ acpi_reserve_resources (void)
acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
4, "PM_TMR");
request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR");
if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,

View File

@@ -41,17 +41,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsaccess")
/*******************************************************************************
*
* FUNCTION: acpi_ns_root_initialize
@@ -65,10 +62,7 @@
* MUTEX: Locks namespace for entire execution
*
******************************************************************************/
acpi_status
acpi_ns_root_initialize (
void)
acpi_status acpi_ns_root_initialize(void)
{
acpi_status status;
const struct acpi_predefined_names *init_val = NULL;
@@ -76,10 +70,8 @@ acpi_ns_root_initialize (
union acpi_operand_object *obj_desc;
acpi_string val = NULL;
ACPI_FUNCTION_TRACE("ns_root_initialize");
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -108,18 +100,20 @@ acpi_ns_root_initialize (
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
/* _OSI is optional for now, will be permanent later */
if (!ACPI_STRCMP (init_val->name, "_OSI") && !acpi_gbl_create_osi_method) {
if (!ACPI_STRCMP(init_val->name, "_OSI")
&& !acpi_gbl_create_osi_method) {
continue;
}
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
NULL, &new_node);
ACPI_IMODE_LOAD_PASS2,
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,
"Could not create predefined name %s, %s\n",
init_val->name, acpi_format_exception (status)));
init_val->name,
acpi_format_exception(status)));
}
/*
@@ -143,7 +137,8 @@ acpi_ns_root_initialize (
* Entry requests an initial value, allocate a
* descriptor for it.
*/
obj_desc = acpi_ut_create_internal_object (init_val->type);
obj_desc =
acpi_ut_create_internal_object(init_val->type);
if (!obj_desc) {
status = AE_NO_MEMORY;
goto unlock_and_exit;
@@ -156,7 +151,8 @@ acpi_ns_root_initialize (
*/
switch (init_val->type) {
case ACPI_TYPE_METHOD:
obj_desc->method.param_count = (u8) ACPI_TO_INTEGER (val);
obj_desc->method.param_count =
(u8) ACPI_TO_INTEGER(val);
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
#if defined (ACPI_ASL_COMPILER)
@@ -167,10 +163,12 @@ acpi_ns_root_initialize (
#else
/* Mark this as a very SPECIAL method */
obj_desc->method.method_flags = AML_METHOD_INTERNAL_ONLY;
obj_desc->method.method_flags =
AML_METHOD_INTERNAL_ONLY;
#ifndef ACPI_DUMP_APP
obj_desc->method.implementation = acpi_ut_osi_implementation;
obj_desc->method.implementation =
acpi_ut_osi_implementation;
#endif
#endif
break;
@@ -180,32 +178,35 @@ acpi_ns_root_initialize (
obj_desc->integer.value = ACPI_TO_INTEGER(val);
break;
case ACPI_TYPE_STRING:
/*
* Build an object around the static string
*/
obj_desc->string.length = (u32) ACPI_STRLEN (val);
obj_desc->string.length =
(u32) ACPI_STRLEN(val);
obj_desc->string.pointer = val;
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
break;
case ACPI_TYPE_MUTEX:
obj_desc->mutex.node = new_node;
obj_desc->mutex.sync_level = (u8) (ACPI_TO_INTEGER (val) - 1);
obj_desc->mutex.sync_level =
(u8) (ACPI_TO_INTEGER(val) - 1);
if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
/*
* Create a counting semaphore for the
* global lock
*/
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT,
1, &obj_desc->mutex.semaphore);
status =
acpi_os_create_semaphore
(ACPI_NO_UNIT_LIMIT, 1,
&obj_desc->mutex.semaphore);
if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference (obj_desc);
acpi_ut_remove_reference
(obj_desc);
goto unlock_and_exit;
}
@@ -213,25 +214,26 @@ acpi_ns_root_initialize (
* We just created the mutex for the
* global lock, save it
*/
acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
}
else {
acpi_gbl_global_lock_semaphore =
obj_desc->mutex.semaphore;
} else {
/* Create a mutex */
status = acpi_os_create_semaphore(1, 1,
&obj_desc->mutex.semaphore);
&obj_desc->
mutex.
semaphore);
if (ACPI_FAILURE(status)) {
acpi_ut_remove_reference (obj_desc);
acpi_ut_remove_reference
(obj_desc);
goto unlock_and_exit;
}
}
break;
default:
ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
init_val->type));
ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type));
acpi_ut_remove_reference(obj_desc);
obj_desc = NULL;
continue;
@@ -240,7 +242,8 @@ acpi_ns_root_initialize (
/* Store pointer to value descriptor in the Node */
status = acpi_ns_attach_object(new_node, obj_desc,
ACPI_GET_OBJECT_TYPE (obj_desc));
ACPI_GET_OBJECT_TYPE
(obj_desc));
/* Remove local reference to the object */
@@ -248,21 +251,21 @@ acpi_ns_root_initialize (
}
}
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
/* Save a handle to "_GPE", it is always present */
if (ACPI_SUCCESS(status)) {
status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
status =
acpi_ns_get_node_by_path("\\_GPE", NULL,
ACPI_NS_NO_UPSEARCH,
&acpi_gbl_fadt_gpe_device);
}
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_lookup
@@ -287,8 +290,7 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_ns_lookup (
union acpi_generic_state *scope_info,
acpi_ns_lookup(union acpi_generic_state *scope_info,
char *pathname,
acpi_object_type type,
acpi_interpreter_mode interpreter_mode,
@@ -310,10 +312,8 @@ acpi_ns_lookup (
u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
ACPI_NS_SEARCH_PARENT);
ACPI_FUNCTION_TRACE("ns_lookup");
if (!return_node) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -329,19 +329,17 @@ acpi_ns_lookup (
* Get the prefix scope.
* A null scope means use the root scope
*/
if ((!scope_info) ||
(!scope_info->scope.node)) {
if ((!scope_info) || (!scope_info->scope.node)) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Null scope prefix, using root node (%p)\n",
acpi_gbl_root_node));
prefix_node = acpi_gbl_root_node;
}
else {
} else {
prefix_node = scope_info->scope.node;
if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != 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)));
if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
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)));
return_ACPI_STATUS(AE_AML_INTERNAL);
}
@@ -371,9 +369,9 @@ acpi_ns_lookup (
path = "";
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Null Pathname (Zero segments), Flags=%X\n", flags));
}
else {
"Null Pathname (Zero segments), Flags=%X\n",
flags));
} else {
/*
* Name pointer is valid (and must be in internal name format)
*
@@ -398,14 +396,15 @@ acpi_ns_lookup (
path++;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Path is absolute from root [%p]\n", this_node));
}
else {
"Path is absolute from root [%p]\n",
this_node));
} else {
/* Pathname is relative to current scope, start there */
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Searching relative to prefix scope [%4.4s] (%p)\n",
acpi_ut_get_node_name (prefix_node), prefix_node));
acpi_ut_get_node_name(prefix_node),
prefix_node));
/*
* Handle multiple Parent Prefixes (carat) by just getting
@@ -430,8 +429,7 @@ acpi_ns_lookup (
if (!this_node) {
/* Current scope has no parent scope */
ACPI_REPORT_ERROR (
("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
return_ACPI_STATUS(AE_NOT_FOUND);
}
}
@@ -439,7 +437,8 @@ acpi_ns_lookup (
if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Search scope is [%4.4s], path has %d carat(s)\n",
acpi_ut_get_node_name (this_node), num_carats));
acpi_ut_get_node_name
(this_node), num_carats));
}
}
@@ -482,7 +481,8 @@ acpi_ns_lookup (
path++;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Dual Pathname (2 segments, Flags=%X)\n", flags));
"Dual Pathname (2 segments, Flags=%X)\n",
flags));
break;
case AML_MULTI_NAME_PREFIX_OP:
@@ -510,14 +510,14 @@ acpi_ns_lookup (
num_segments = 1;
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Simple Pathname (1 segment, Flags=%X)\n", flags));
"Simple Pathname (1 segment, Flags=%X)\n",
flags));
break;
}
ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path));
}
/*
* Search namespace for each segment of the name. Loop through and
* verify (or add to the namespace) each name segment.
@@ -558,15 +558,19 @@ acpi_ns_lookup (
/* Try to find the single (4 character) ACPI name */
status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
interpreter_mode, this_search_type, local_flags, &this_node);
status =
acpi_ns_search_and_enter(simple_name, walk_state,
current_node, interpreter_mode,
this_search_type, local_flags,
&this_node);
if (ACPI_FAILURE(status)) {
if (status == AE_NOT_FOUND) {
/* Name not found in ACPI namespace */
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Name [%4.4s] not found in scope [%4.4s] %p\n",
(char *) &simple_name, (char *) &current_node->name,
(char *)&simple_name,
(char *)&current_node->name,
current_node));
}
@@ -596,10 +600,7 @@ acpi_ns_lookup (
(this_node->type != type_to_check_for)) {
/* 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_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)));
}
/*
@@ -626,7 +627,9 @@ acpi_ns_lookup (
* scope stack.
*/
if (acpi_ns_opens_scope(type)) {
status = acpi_ds_scope_stack_push (this_node, type, walk_state);
status =
acpi_ds_scope_stack_push(this_node, type,
walk_state);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -636,4 +639,3 @@ acpi_ns_lookup (
*return_node = this_node;
return_ACPI_STATUS(AE_OK);
}

View File

@@ -41,20 +41,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsalloc")
/* Local prototypes */
static void
acpi_ns_remove_reference (
struct acpi_namespace_node *node);
static void acpi_ns_remove_reference(struct acpi_namespace_node *node);
/*******************************************************************************
*
@@ -68,16 +62,12 @@ acpi_ns_remove_reference (
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_create_node (
u32 name)
struct acpi_namespace_node *acpi_ns_create_node(u32 name)
{
struct acpi_namespace_node *node;
ACPI_FUNCTION_TRACE("ns_create_node");
node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node));
if (!node) {
return_PTR(NULL);
@@ -92,7 +82,6 @@ acpi_ns_create_node (
return_PTR(node);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_node
@@ -105,18 +94,14 @@ acpi_ns_create_node (
*
******************************************************************************/
void
acpi_ns_delete_node (
struct acpi_namespace_node *node)
void acpi_ns_delete_node(struct acpi_namespace_node *node)
{
struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *prev_node;
struct acpi_namespace_node *next_node;
ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node);
parent_node = acpi_ns_get_parent_node(node);
prev_node = NULL;
@@ -136,16 +121,14 @@ acpi_ns_delete_node (
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
prev_node->flags |= ANOBJ_END_OF_PEER_LIST;
}
}
else {
} else {
/* Node is first child (has no previous peer) */
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
/* No peers at all */
parent_node->child = NULL;
}
else { /* Link peer list to parent */
} else { /* Link peer list to parent */
parent_node->child = next_node->peer;
}
@@ -161,7 +144,6 @@ acpi_ns_delete_node (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_install_node
@@ -182,20 +164,15 @@ acpi_ns_delete_node (
*
******************************************************************************/
void
acpi_ns_install_node (
struct acpi_walk_state *walk_state,
struct acpi_namespace_node *parent_node, /* Parent */
void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node, /* Parent */
struct acpi_namespace_node *node, /* New Child */
acpi_object_type type)
{
acpi_owner_id owner_id = 0;
struct acpi_namespace_node *child_node;
ACPI_FUNCTION_TRACE("ns_install_node");
/*
* Get the owner ID from the Walk state
* The owner ID is used to track table deletion and
@@ -212,8 +189,7 @@ acpi_ns_install_node (
parent_node->child = node;
node->flags |= ANOBJ_END_OF_PEER_LIST;
node->peer = parent_node;
}
else {
} else {
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
child_node = child_node->peer;
}
@@ -234,8 +210,10 @@ acpi_ns_install_node (
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
acpi_ut_get_node_name (node), acpi_ut_get_type_name (node->type), node, owner_id,
acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type),
acpi_ut_get_node_name(node),
acpi_ut_get_type_name(node->type), node, owner_id,
acpi_ut_get_node_name(parent_node),
acpi_ut_get_type_name(parent_node->type),
parent_node));
/*
@@ -249,7 +227,6 @@ acpi_ns_install_node (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_children
@@ -263,19 +240,15 @@ acpi_ns_install_node (
*
******************************************************************************/
void
acpi_ns_delete_children (
struct acpi_namespace_node *parent_node)
void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
{
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *next_node;
struct acpi_namespace_node *node;
u8 flags;
ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
if (!parent_node) {
return_VOID;
}
@@ -299,7 +272,8 @@ acpi_ns_delete_children (
/* Grandchildren should have all been deleted already */
if (child_node->child) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Found a grandchild! P=%p C=%p\n",
parent_node, child_node));
}
@@ -307,8 +281,9 @@ acpi_ns_delete_children (
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
child_node, acpi_gbl_current_node_count));
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
"Object %p, Remaining %X\n", child_node,
acpi_gbl_current_node_count));
/*
* Detach an object if there is one, then free the child node
@@ -327,9 +302,7 @@ acpi_ns_delete_children (
/* There should be only one reference remaining on this node */
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_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node));
}
/* Now we can delete the node */
@@ -342,7 +315,6 @@ acpi_ns_delete_children (
} while (!(flags & ANOBJ_END_OF_PEER_LIST));
/* Clear the parent's child pointer */
parent_node->child = NULL;
@@ -350,7 +322,6 @@ acpi_ns_delete_children (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_namespace_subtree
@@ -364,17 +335,13 @@ acpi_ns_delete_children (
*
******************************************************************************/
void
acpi_ns_delete_namespace_subtree (
struct acpi_namespace_node *parent_node)
void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
{
struct acpi_namespace_node *child_node = NULL;
u32 level = 1;
ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree");
if (!parent_node) {
return_VOID;
}
@@ -395,7 +362,8 @@ acpi_ns_delete_namespace_subtree (
/* Check if this node has any children */
if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
if (acpi_ns_get_next_node
(ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this node,
* visit the node
@@ -404,8 +372,7 @@ acpi_ns_delete_namespace_subtree (
parent_node = child_node;
child_node = NULL;
}
}
else {
} else {
/*
* No more children of this parent node.
* Move up to the grandparent.
@@ -431,7 +398,6 @@ acpi_ns_delete_namespace_subtree (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_remove_reference
@@ -447,17 +413,13 @@ acpi_ns_delete_namespace_subtree (
*
******************************************************************************/
static void
acpi_ns_remove_reference (
struct acpi_namespace_node *node)
static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
{
struct acpi_namespace_node *parent_node;
struct acpi_namespace_node *this_node;
ACPI_FUNCTION_ENTRY();
/*
* Decrement the reference count(s) of this node and all
* nodes up to the root, Delete anything with zero remaining references.
@@ -485,7 +447,6 @@ acpi_ns_remove_reference (
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_delete_namespace_by_owner
@@ -500,19 +461,15 @@ acpi_ns_remove_reference (
*
******************************************************************************/
void
acpi_ns_delete_namespace_by_owner (
acpi_owner_id owner_id)
void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
{
struct acpi_namespace_node *child_node;
struct acpi_namespace_node *deletion_node;
u32 level;
struct acpi_namespace_node *parent_node;
ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id);
if (owner_id == 0) {
return_VOID;
}
@@ -531,7 +488,9 @@ acpi_ns_delete_namespace_by_owner (
* Get the next child of this parent node. When child_node is NULL,
* the first child of the parent is returned
*/
child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
child_node =
acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
child_node);
if (deletion_node) {
acpi_ns_remove_reference(deletion_node);
@@ -547,7 +506,8 @@ acpi_ns_delete_namespace_by_owner (
/* Check if this node has any children */
if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
if (acpi_ns_get_next_node
(ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this node,
* visit the node
@@ -555,12 +515,10 @@ acpi_ns_delete_namespace_by_owner (
level++;
parent_node = child_node;
child_node = NULL;
}
else if (child_node->owner_id == owner_id) {
} else if (child_node->owner_id == owner_id) {
deletion_node = child_node;
}
}
else {
} else {
/*
* No more children of this parent node.
* Move up to the grandparent.
@@ -584,5 +542,3 @@ acpi_ns_delete_namespace_by_owner (
return_VOID;
}

View File

@@ -41,31 +41,22 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsdump")
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
void
acpi_ns_dump_root_devices (
void);
void acpi_ns_dump_root_devices(void);
static acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
acpi_ns_dump_one_device(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
#endif
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
@@ -80,18 +71,14 @@ acpi_ns_dump_one_device (
*
******************************************************************************/
void
acpi_ns_print_pathname (
u32 num_segments,
char *pathname)
void acpi_ns_print_pathname(u32 num_segments, char *pathname)
{
acpi_native_uint i;
ACPI_FUNCTION_NAME("ns_print_pathname");
if (!(acpi_dbg_level & ACPI_LV_NAMES) || !(acpi_dbg_layer & ACPI_NAMESPACE)) {
if (!(acpi_dbg_level & ACPI_LV_NAMES)
|| !(acpi_dbg_layer & ACPI_NAMESPACE)) {
return;
}
@@ -116,7 +103,6 @@ acpi_ns_print_pathname (
acpi_os_printf("]\n");
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_pathname
@@ -134,16 +120,11 @@ acpi_ns_print_pathname (
******************************************************************************/
void
acpi_ns_dump_pathname (
acpi_handle handle,
char *msg,
u32 level,
u32 component)
acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
{
ACPI_FUNCTION_TRACE("ns_dump_pathname");
/* Do this only if the requested debug level and component are enabled */
if (!(acpi_dbg_level & level) || !(acpi_dbg_layer & component)) {
@@ -157,7 +138,6 @@ acpi_ns_dump_pathname (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_one_object
@@ -175,11 +155,8 @@ acpi_ns_dump_pathname (
******************************************************************************/
acpi_status
acpi_ns_dump_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ns_dump_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
struct acpi_walk_info *info = (struct acpi_walk_info *)context;
struct acpi_namespace_node *this_node;
@@ -190,10 +167,8 @@ acpi_ns_dump_one_object (
u32 dbg_level;
u32 i;
ACPI_FUNCTION_NAME("ns_dump_one_object");
/* Is output enabled? */
if (!(acpi_dbg_level & info->debug_level)) {
@@ -237,8 +212,7 @@ acpi_ns_dump_one_object (
/*
* 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 ", acpi_ut_get_type_name(type), this_node);
dbg_level = acpi_dbg_level;
acpi_dbg_level = 0;
@@ -259,44 +233,41 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_PROCESSOR:
acpi_os_printf("ID %X Len %.4X Addr %p\n",
obj_desc->processor.proc_id, obj_desc->processor.length,
obj_desc->processor.proc_id,
obj_desc->processor.length,
(char *)obj_desc->processor.address);
break;
case ACPI_TYPE_DEVICE:
acpi_os_printf("Notify Object: %p\n", obj_desc);
break;
case ACPI_TYPE_METHOD:
acpi_os_printf("Args %X Len %.4X Aml %p\n",
(u32) obj_desc->method.param_count,
obj_desc->method.aml_length, obj_desc->method.aml_start);
obj_desc->method.aml_length,
obj_desc->method.aml_start);
break;
case ACPI_TYPE_INTEGER:
acpi_os_printf("= %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
ACPI_FORMAT_UINT64(obj_desc->integer.
value));
break;
case ACPI_TYPE_PACKAGE:
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf("Elements %.2X\n",
obj_desc->package.count);
}
else {
} else {
acpi_os_printf("[Length not yet evaluated]\n");
}
break;
case ACPI_TYPE_BUFFER:
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
@@ -307,18 +278,20 @@ acpi_ns_dump_one_object (
if (obj_desc->buffer.length > 0) {
acpi_os_printf(" =");
for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]);
for (i = 0;
(i < obj_desc->buffer.length
&& i < 12); i++) {
acpi_os_printf(" %.2hX",
obj_desc->buffer.
pointer[i]);
}
}
acpi_os_printf("\n");
}
else {
} else {
acpi_os_printf("[Length not yet evaluated]\n");
}
break;
case ACPI_TYPE_STRING:
acpi_os_printf("Len %.2X ", obj_desc->string.length);
@@ -326,67 +299,87 @@ acpi_ns_dump_one_object (
acpi_os_printf("\n");
break;
case ACPI_TYPE_REGION:
acpi_os_printf("[%s]",
acpi_ut_get_region_name (obj_desc->region.space_id));
acpi_ut_get_region_name(obj_desc->region.
space_id));
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
ACPI_FORMAT_UINT64 (obj_desc->region.address),
ACPI_FORMAT_UINT64(obj_desc->
region.
address),
obj_desc->region.length);
}
else {
acpi_os_printf (" [Address/Length not yet evaluated]\n");
} else {
acpi_os_printf
(" [Address/Length not yet evaluated]\n");
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
acpi_os_printf("[%s]\n",
acpi_ps_get_opcode_name (obj_desc->reference.opcode));
acpi_ps_get_opcode_name(obj_desc->
reference.
opcode));
break;
case ACPI_TYPE_BUFFER_FIELD:
if (obj_desc->buffer_field.buffer_obj &&
obj_desc->buffer_field.buffer_obj->buffer.node) {
acpi_os_printf("Buf [%4.4s]",
acpi_ut_get_node_name (obj_desc->buffer_field.buffer_obj->buffer.node));
acpi_ut_get_node_name(obj_desc->
buffer_field.
buffer_obj->
buffer.
node));
}
break;
case ACPI_TYPE_LOCAL_REGION_FIELD:
acpi_os_printf("Rgn [%4.4s]",
acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node));
acpi_ut_get_node_name(obj_desc->
common_field.
region_obj->region.
node));
break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]",
acpi_ut_get_node_name (obj_desc->common_field.region_obj->region.node),
acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
acpi_ut_get_node_name(obj_desc->
common_field.
region_obj->region.
node),
acpi_ut_get_node_name(obj_desc->
bank_field.
bank_obj->
common_field.
node));
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf("Idx [%4.4s] Dat [%4.4s]",
acpi_ut_get_node_name (obj_desc->index_field.index_obj->common_field.node),
acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
acpi_ut_get_node_name(obj_desc->
index_field.
index_obj->
common_field.node),
acpi_ut_get_node_name(obj_desc->
index_field.
data_obj->
common_field.
node));
break;
case ACPI_TYPE_LOCAL_ALIAS:
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
acpi_os_printf("Target %4.4s (%p)\n",
acpi_ut_get_node_name (obj_desc), obj_desc);
acpi_ut_get_node_name(obj_desc),
obj_desc);
break;
default:
@@ -404,10 +397,14 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_LOCAL_INDEX_FIELD:
acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n",
(obj_desc->common_field.base_byte_offset * 8)
+ obj_desc->common_field.start_field_bit_offset,
(obj_desc->common_field.
base_byte_offset * 8)
+
obj_desc->common_field.
start_field_bit_offset,
obj_desc->common_field.bit_length,
obj_desc->common_field.access_byte_width);
obj_desc->common_field.
access_byte_width);
break;
default:
@@ -415,7 +412,6 @@ acpi_ns_dump_one_object (
}
break;
case ACPI_DISPLAY_OBJECTS:
acpi_os_printf("O:%p", obj_desc);
@@ -440,7 +436,8 @@ acpi_ns_dump_one_object (
case ACPI_TYPE_INTEGER:
acpi_os_printf(" I:%8.8X8.8%X\n",
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
ACPI_FORMAT_UINT64(obj_desc->integer.
value));
break;
case ACPI_TYPE_STRING:
@@ -462,7 +459,6 @@ acpi_ns_dump_one_object (
}
break;
default:
acpi_os_printf("\n");
break;
@@ -474,7 +470,6 @@ acpi_ns_dump_one_object (
return (AE_OK);
}
/* If there is an attached object, display it */
dbg_level = acpi_dbg_level;
@@ -503,14 +498,16 @@ acpi_ns_dump_one_object (
obj_type = ACPI_GET_OBJECT_TYPE(obj_desc);
if (obj_type > ACPI_TYPE_LOCAL_MAX) {
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
acpi_os_printf
("(Ptr to ACPI Object type %X [UNKNOWN])\n",
obj_type);
bytes_to_dump = 32;
}
else {
acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n",
} else {
acpi_os_printf
("(Ptr to ACPI Object type %X [%s])\n",
obj_type, acpi_ut_get_type_name(obj_type));
bytes_to_dump = sizeof (union acpi_operand_object);
bytes_to_dump =
sizeof(union acpi_operand_object);
}
ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
@@ -523,7 +520,8 @@ acpi_ns_dump_one_object (
/* If value is NOT an internal object, we are done */
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) != ACPI_DESC_TYPE_OPERAND) {
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) !=
ACPI_DESC_TYPE_OPERAND) {
goto cleanup;
}
@@ -544,7 +542,9 @@ acpi_ns_dump_one_object (
goto cleanup;
case ACPI_TYPE_BUFFER_FIELD:
obj_desc = (union acpi_operand_object *) obj_desc->buffer_field.buffer_obj;
obj_desc =
(union acpi_operand_object *)obj_desc->buffer_field.
buffer_obj;
break;
case ACPI_TYPE_PACKAGE:
@@ -579,7 +579,6 @@ cleanup:
return (AE_OK);
}
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
@@ -601,30 +600,26 @@ cleanup:
******************************************************************************/
void
acpi_ns_dump_objects (
acpi_object_type type,
acpi_ns_dump_objects(acpi_object_type type,
u8 display_type,
u32 max_depth,
acpi_owner_id owner_id,
acpi_handle start_handle)
acpi_owner_id owner_id, acpi_handle start_handle)
{
struct acpi_walk_info info;
ACPI_FUNCTION_ENTRY();
info.debug_level = ACPI_LV_TABLES;
info.owner_id = owner_id;
info.display_type = display_type;
(void)acpi_ns_walk_namespace(type, start_handle, max_depth,
ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
(void *) &info, NULL);
ACPI_NS_WALK_NO_UNLOCK,
acpi_ns_dump_one_object, (void *)&info,
NULL);
}
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_entry
@@ -638,17 +633,12 @@ acpi_ns_dump_objects (
*
******************************************************************************/
void
acpi_ns_dump_entry (
acpi_handle handle,
u32 debug_level)
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
{
struct acpi_walk_info info;
ACPI_FUNCTION_ENTRY();
info.debug_level = debug_level;
info.owner_id = ACPI_OWNER_ID_MAX;
info.display_type = ACPI_DISPLAY_SUMMARY;
@@ -656,7 +646,6 @@ acpi_ns_dump_entry (
(void)acpi_ns_dump_one_object(handle, 1, &info, NULL);
}
#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
@@ -673,23 +662,19 @@ acpi_ns_dump_entry (
*
******************************************************************************/
void
acpi_ns_dump_tables (
acpi_handle search_base,
u32 max_depth)
void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
{
acpi_handle search_handle = search_base;
ACPI_FUNCTION_TRACE("ns_dump_tables");
if (!acpi_gbl_root_node) {
/*
* If the name space has not been initialized,
* there is nothing to dump.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
"namespace not initialized!\n"));
return_VOID;
}

View File

@@ -41,20 +41,15 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
/* TBD: This entire module is apparently obsolete and should be removed */
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsdumpdv")
#ifdef ACPI_OBSOLETE_FUNCTIONS
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
#include <acpi/acnamesp.h>
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_one_device
@@ -70,24 +65,19 @@
* This procedure is a user_function called by acpi_ns_walk_namespace.
*
******************************************************************************/
static acpi_status
acpi_ns_dump_one_device (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ns_dump_one_device(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
struct acpi_buffer buffer;
struct acpi_device_info *info;
acpi_status status;
u32 i;
ACPI_FUNCTION_NAME("ns_dump_one_device");
status = acpi_ns_dump_one_object (obj_handle, level, context, return_value);
status =
acpi_ns_dump_one_object(obj_handle, level, context, return_value);
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
status = acpi_get_object_info(obj_handle, &buffer);
@@ -99,7 +89,8 @@ acpi_ns_dump_one_device (
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
" HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
info->hardware_id.value,
ACPI_FORMAT_UINT64(info->address),
info->current_status));
ACPI_MEM_FREE(info);
}
@@ -107,7 +98,6 @@ acpi_ns_dump_one_device (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_dump_root_devices
@@ -120,17 +110,13 @@ acpi_ns_dump_one_device (
*
******************************************************************************/
void
acpi_ns_dump_root_devices (
void)
void acpi_ns_dump_root_devices(void)
{
acpi_handle sys_bus_handle;
acpi_status status;
ACPI_FUNCTION_NAME("ns_dump_root_devices");
/* Only dump the table if tracing is enabled */
if (!(ACPI_LV_TABLES & acpi_dbg_level)) {
@@ -152,5 +138,3 @@ acpi_ns_dump_root_devices (
#endif
#endif

View File

@@ -42,26 +42,19 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acinterp.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nseval")
/* Local prototypes */
static acpi_status
acpi_ns_execute_control_method (
struct acpi_parameter_info *info);
static acpi_status
acpi_ns_get_object_value (
struct acpi_parameter_info *info);
acpi_ns_execute_control_method(struct acpi_parameter_info *info);
static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info);
/*******************************************************************************
*
@@ -85,19 +78,15 @@ acpi_ns_get_object_value (
******************************************************************************/
acpi_status
acpi_ns_evaluate_relative (
char *pathname,
struct acpi_parameter_info *info)
acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info)
{
acpi_status status;
struct acpi_namespace_node *node = NULL;
union acpi_generic_state *scope_info;
char *internal_path = NULL;
ACPI_FUNCTION_TRACE("ns_evaluate_relative");
/*
* Must have a valid object handle
*/
@@ -155,8 +144,8 @@ acpi_ns_evaluate_relative (
info->node = node;
status = acpi_ns_evaluate_by_handle(info);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
pathname));
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"*** Completed eval of object %s ***\n", pathname));
cleanup:
acpi_ut_delete_generic_state(scope_info);
@@ -166,7 +155,6 @@ cleanup1:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_evaluate_by_name
@@ -189,17 +177,13 @@ cleanup1:
******************************************************************************/
acpi_status
acpi_ns_evaluate_by_name (
char *pathname,
struct acpi_parameter_info *info)
acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
{
acpi_status status;
char *internal_path = NULL;
ACPI_FUNCTION_TRACE("ns_evaluate_by_name");
/* Build an internal name string for the method */
status = acpi_ns_internalize_name(pathname, &internal_path);
@@ -231,13 +215,13 @@ acpi_ns_evaluate_by_name (
* Now that we have a handle to the object, we can attempt to evaluate it.
*/
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
pathname, info->node, acpi_ns_get_attached_object (info->node)));
pathname, info->node,
acpi_ns_get_attached_object(info->node)));
status = acpi_ns_evaluate_by_handle(info);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
pathname));
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"*** Completed eval of object %s ***\n", pathname));
cleanup:
@@ -250,7 +234,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_evaluate_by_handle
@@ -275,16 +258,12 @@ cleanup:
*
******************************************************************************/
acpi_status
acpi_ns_evaluate_by_handle (
struct acpi_parameter_info *info)
acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ns_evaluate_by_handle");
/* Check if namespace has been initialized */
if (!acpi_gbl_root_node) {
@@ -319,7 +298,9 @@ acpi_ns_evaluate_by_handle (
* scoping context will be established before execution.
*/
if (acpi_ns_get_type(info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
info->node = ACPI_CAST_PTR (struct acpi_namespace_node, info->node->object);
info->node =
ACPI_CAST_PTR(struct acpi_namespace_node,
info->node->object);
}
/*
@@ -334,8 +315,7 @@ acpi_ns_evaluate_by_handle (
* Case 1) We have an actual control method to execute
*/
status = acpi_ns_execute_control_method(info);
}
else {
} else {
/*
* Case 2) Object is NOT a method, just return its current value
*/
@@ -358,7 +338,6 @@ acpi_ns_evaluate_by_handle (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_execute_control_method
@@ -384,20 +363,18 @@ acpi_ns_evaluate_by_handle (
******************************************************************************/
static acpi_status
acpi_ns_execute_control_method (
struct acpi_parameter_info *info)
acpi_ns_execute_control_method(struct acpi_parameter_info *info)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ns_execute_control_method");
/* Verify that there is a method associated with this object */
info->obj_desc = acpi_ns_get_attached_object(info->node);
if (!info->obj_desc) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"No attached method object\n"));
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(AE_NULL_OBJECT);
@@ -407,7 +384,8 @@ acpi_ns_execute_control_method (
ACPI_LV_INFO, _COMPONENT);
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
info->obj_desc->method.aml_start + 1, info->obj_desc->method.aml_length - 1));
info->obj_desc->method.aml_start + 1,
info->obj_desc->method.aml_length - 1));
/*
* Unlock the namespace before execution. This allows namespace access
@@ -436,7 +414,6 @@ acpi_ns_execute_control_method (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_object_value
@@ -454,17 +431,13 @@ acpi_ns_execute_control_method (
*
******************************************************************************/
static acpi_status
acpi_ns_get_object_value (
struct acpi_parameter_info *info)
static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
{
acpi_status status = AE_OK;
struct acpi_namespace_node *resolved_node = info->node;
ACPI_FUNCTION_TRACE("ns_get_object_value");
/*
* Objects require additional resolution steps (e.g., the Node may be a
* field that must be read, etc.) -- we can't just grab the object out of
@@ -504,9 +477,11 @@ acpi_ns_get_object_value (
status = AE_CTRL_RETURN_VALUE;
info->return_object = ACPI_CAST_PTR
(union acpi_operand_object, resolved_node);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Returning object %p [%s]\n",
info->return_object,
acpi_ut_get_object_type_name (info->return_object)));
acpi_ut_get_object_type_name(info->
return_object)));
}
}
@@ -514,4 +489,3 @@ acpi_ns_get_object_value (
return_ACPI_STATUS(status);
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
@@ -51,21 +50,13 @@
ACPI_MODULE_NAME("nsinit")
/* Local prototypes */
static acpi_status
acpi_ns_init_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
static acpi_status
acpi_ns_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value);
static acpi_status
acpi_ns_init_one_device (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value);
acpi_ns_init_one_device(acpi_handle obj_handle,
u32 nesting_level, void *context, void **return_value);
/*******************************************************************************
*
@@ -80,17 +71,13 @@ acpi_ns_init_one_device (
*
******************************************************************************/
acpi_status
acpi_ns_initialize_objects (
void)
acpi_status acpi_ns_initialize_objects(void)
{
acpi_status status;
struct acpi_init_walk_info info;
ACPI_FUNCTION_TRACE("ns_initialize_objects");
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
@@ -115,7 +102,8 @@ acpi_ns_initialize_objects (
info.op_region_init, info.op_region_count,
info.field_init, info.field_count,
info.buffer_init, info.buffer_count,
info.package_init, info.package_count, info.object_count));
info.package_init, info.package_count,
info.object_count));
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
"%hd Control Methods found\n", info.method_count));
@@ -125,7 +113,6 @@ acpi_ns_initialize_objects (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_initialize_devices
@@ -142,17 +129,13 @@ acpi_ns_initialize_objects (
*
******************************************************************************/
acpi_status
acpi_ns_initialize_devices (
void)
acpi_status acpi_ns_initialize_devices(void)
{
acpi_status status;
struct acpi_device_walk_info info;
ACPI_FUNCTION_TRACE("ns_initialize_devices");
/* Init counters */
info.device_count = 0;
@@ -170,7 +153,8 @@ acpi_ns_initialize_devices (
/* Walk namespace for all objects */
status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, TRUE, acpi_ns_init_one_device, &info, NULL);
ACPI_UINT32_MAX, TRUE,
acpi_ns_init_one_device, &info, NULL);
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
@@ -186,7 +170,6 @@ acpi_ns_initialize_devices (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_init_one_object
@@ -208,22 +191,19 @@ acpi_ns_initialize_devices (
******************************************************************************/
static acpi_status
acpi_ns_init_one_object (
acpi_handle obj_handle,
u32 level,
void *context,
void **return_value)
acpi_ns_init_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value)
{
acpi_object_type type;
acpi_status status;
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
struct acpi_init_walk_info *info =
(struct acpi_init_walk_info *)context;
struct acpi_namespace_node *node =
(struct acpi_namespace_node *)obj_handle;
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_NAME("ns_init_one_object");
info->object_count++;
/* And even then, we are only interested in a few object types */
@@ -312,7 +292,8 @@ acpi_ns_init_one_object (
ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Could not execute arguments for [%4.4s] (%s), %s\n",
acpi_ut_get_node_name (node), acpi_ut_get_type_name (type),
acpi_ut_get_node_name(node),
acpi_ut_get_type_name(type),
acpi_format_exception(status)));
}
@@ -332,7 +313,6 @@ acpi_ns_init_one_object (
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_init_one_device
@@ -348,21 +328,17 @@ acpi_ns_init_one_object (
******************************************************************************/
static acpi_status
acpi_ns_init_one_device (
acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
acpi_ns_init_one_device(acpi_handle obj_handle,
u32 nesting_level, void *context, void **return_value)
{
struct acpi_device_walk_info *info = (struct acpi_device_walk_info *) context;
struct acpi_device_walk_info *info =
(struct acpi_device_walk_info *)context;
struct acpi_parameter_info pinfo;
u32 flags;
acpi_status status;
ACPI_FUNCTION_TRACE("ns_init_one_device");
pinfo.parameters = NULL;
pinfo.parameter_type = ACPI_PARAM_ARGS;
@@ -391,7 +367,8 @@ acpi_ns_init_one_device (
* Run _STA to determine if we can run _INI on the device.
*/
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
pinfo.node, METHOD_NAME__STA));
pinfo.node,
METHOD_NAME__STA));
status = acpi_ut_execute_STA(pinfo.node, &flags);
if (ACPI_FAILURE(status)) {
@@ -402,8 +379,7 @@ acpi_ns_init_one_device (
}
/* _STA is not required for Processor or thermal_zone objects */
}
else {
} else {
info->num_STA++;
if (!(flags & 0x01)) {
@@ -417,7 +393,8 @@ acpi_ns_init_one_device (
* The device is present. Run _INI.
*/
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
pinfo.node, METHOD_NAME__INI));
pinfo.node,
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 */
@@ -426,18 +403,19 @@ acpi_ns_init_one_device (
/* Ignore error and move on to next device */
#ifdef ACPI_DEBUG_OUTPUT
char *scope_name = acpi_ns_get_external_pathname (pinfo.node);
char *scope_name =
acpi_ns_get_external_pathname(pinfo.node);
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "%s._INI failed: %s\n",
scope_name, acpi_format_exception (status)));
scope_name,
acpi_format_exception(status)));
ACPI_MEM_FREE(scope_name);
#endif
}
status = AE_OK;
}
else {
} else {
/* Delete any return object (especially if implicit_return is enabled) */
if (pinfo.return_object) {
@@ -452,7 +430,8 @@ acpi_ns_init_one_device (
if (acpi_gbl_init_handler) {
/* External initialization handler is present, call it */
status = acpi_gbl_init_handler (pinfo.node, ACPI_INIT_DEVICE_INI);
status =
acpi_gbl_init_handler(pinfo.node, ACPI_INIT_DEVICE_INI);
}
return_ACPI_STATUS(status);

View File

@@ -41,32 +41,22 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsload")
/* Local prototypes */
static acpi_status
acpi_ns_load_table_by_type (
acpi_table_type table_type);
static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type);
#ifdef ACPI_FUTURE_IMPLEMENTATION
acpi_status
acpi_ns_unload_namespace (
acpi_handle handle);
acpi_status acpi_ns_unload_namespace(acpi_handle handle);
static acpi_status
acpi_ns_delete_subtree (
acpi_handle start_handle);
static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
#endif
#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
@@ -82,19 +72,18 @@ acpi_ns_delete_subtree (
******************************************************************************/
acpi_status
acpi_ns_load_table (
struct acpi_table_desc *table_desc,
acpi_ns_load_table(struct acpi_table_desc *table_desc,
struct acpi_namespace_node *node)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ns_load_table");
/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
if (!(acpi_gbl_table_data[table_desc->type].flags & ACPI_TABLE_EXECUTABLE)) {
if (!
(acpi_gbl_table_data[table_desc->type].
flags & ACPI_TABLE_EXECUTABLE)) {
/* Just ignore this table */
return_ACPI_STATUS(AE_OK);
@@ -159,7 +148,6 @@ acpi_ns_load_table (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_load_table_by_type
@@ -174,18 +162,14 @@ acpi_ns_load_table (
*
******************************************************************************/
static acpi_status
acpi_ns_load_table_by_type (
acpi_table_type table_type)
static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
{
u32 i;
acpi_status status;
struct acpi_table_desc *table_desc;
ACPI_FUNCTION_TRACE("ns_load_table_by_type");
status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
@@ -216,11 +200,11 @@ acpi_ns_load_table_by_type (
}
break;
case ACPI_TABLE_SSDT:
case ACPI_TABLE_PSDT:
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Namespace load: %d SSDT or PSDTs\n",
acpi_gbl_table_lists[table_type].count));
/*
@@ -233,7 +217,9 @@ acpi_ns_load_table_by_type (
* already loaded!
*/
if (!table_desc->loaded_into_namespace) {
status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
status =
acpi_ns_load_table(table_desc,
acpi_gbl_root_node);
if (ACPI_FAILURE(status)) {
break;
}
@@ -245,19 +231,16 @@ acpi_ns_load_table_by_type (
}
break;
default:
status = AE_SUPPORT;
break;
}
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_load_namespace
@@ -271,16 +254,12 @@ unlock_and_exit:
*
******************************************************************************/
acpi_status
acpi_ns_load_namespace (
void)
acpi_status acpi_ns_load_namespace(void)
{
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_load_name_space");
/* There must be at least a DSDT installed */
if (acpi_gbl_DSDT == NULL) {
@@ -309,7 +288,6 @@ acpi_ns_load_namespace (
return_ACPI_STATUS(status);
}
#ifdef ACPI_FUTURE_IMPLEMENTATION
/*******************************************************************************
*
@@ -327,9 +305,7 @@ acpi_ns_load_namespace (
*
******************************************************************************/
static acpi_status
acpi_ns_delete_subtree (
acpi_handle start_handle)
static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
{
acpi_status status;
acpi_handle child_handle;
@@ -338,10 +314,8 @@ acpi_ns_delete_subtree (
acpi_handle dummy;
u32 level;
ACPI_FUNCTION_TRACE("ns_delete_subtree");
parent_handle = start_handle;
child_handle = NULL;
level = 1;
@@ -363,8 +337,9 @@ acpi_ns_delete_subtree (
if (ACPI_SUCCESS(status)) {
/* Check if this object has any children */
if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle,
NULL, &dummy))) {
if (ACPI_SUCCESS
(acpi_get_next_object
(ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
/*
* There is at least one child of this object,
* visit the object
@@ -373,8 +348,7 @@ acpi_ns_delete_subtree (
parent_handle = child_handle;
child_handle = NULL;
}
}
else {
} else {
/*
* No more children in this object, go back up to
* the object's parent
@@ -400,7 +374,6 @@ acpi_ns_delete_subtree (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_unload_name_space
@@ -415,16 +388,12 @@ acpi_ns_delete_subtree (
*
******************************************************************************/
acpi_status
acpi_ns_unload_namespace (
acpi_handle handle)
acpi_status acpi_ns_unload_namespace(acpi_handle handle)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ns_unload_name_space");
/* Parameter validation */
if (!acpi_gbl_root_node) {
@@ -443,4 +412,3 @@ acpi_ns_unload_namespace (
}
#endif
#endif

View File

@@ -41,23 +41,17 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/amlcode.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsnames")
/* Local prototypes */
static void
acpi_ns_build_external_path (
struct acpi_namespace_node *node,
acpi_size size,
char *name_buffer);
acpi_ns_build_external_path(struct acpi_namespace_node *node,
acpi_size size, char *name_buffer);
/*******************************************************************************
*
@@ -75,18 +69,14 @@ acpi_ns_build_external_path (
******************************************************************************/
static void
acpi_ns_build_external_path (
struct acpi_namespace_node *node,
acpi_size size,
char *name_buffer)
acpi_ns_build_external_path(struct acpi_namespace_node *node,
acpi_size size, char *name_buffer)
{
acpi_size index;
struct acpi_namespace_node *parent_node;
ACPI_FUNCTION_NAME("ns_build_external_path");
/* Special case for root */
index = size - 1;
@@ -128,7 +118,6 @@ acpi_ns_build_external_path (
return;
}
#ifdef ACPI_DEBUG_OUTPUT
/*******************************************************************************
*
@@ -144,17 +133,13 @@ acpi_ns_build_external_path (
*
******************************************************************************/
char *
acpi_ns_get_external_pathname (
struct acpi_namespace_node *node)
char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
{
char *name_buffer;
acpi_size size;
ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node);
/* Calculate required buffer size based on depth below root */
size = acpi_ns_get_pathname_length(node);
@@ -174,7 +159,6 @@ acpi_ns_get_external_pathname (
}
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_pathname_length
@@ -187,17 +171,13 @@ acpi_ns_get_external_pathname (
*
******************************************************************************/
acpi_size
acpi_ns_get_pathname_length (
struct acpi_namespace_node *node)
acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
{
acpi_size size;
struct acpi_namespace_node *next_node;
ACPI_FUNCTION_ENTRY();
/*
* Compute length of pathname as 5 * number of name segments.
* Go back up the parent tree to the root
@@ -217,7 +197,6 @@ acpi_ns_get_pathname_length (
return (size + 1); /* +1 for null string terminator */
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_handle_to_pathname
@@ -233,18 +212,15 @@ acpi_ns_get_pathname_length (
******************************************************************************/
acpi_status
acpi_ns_handle_to_pathname (
acpi_handle target_handle,
acpi_ns_handle_to_pathname(acpi_handle target_handle,
struct acpi_buffer * buffer)
{
acpi_status status;
struct acpi_namespace_node *node;
acpi_size required_size;
ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle);
node = acpi_ns_map_handle_to_node(target_handle);
if (!node) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -269,5 +245,3 @@ acpi_ns_handle_to_pathname (
(char *)buffer->pointer, (u32) required_size));
return_ACPI_STATUS(AE_OK);
}

View File

@@ -42,15 +42,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsobject")
/*******************************************************************************
*
* FUNCTION: acpi_ns_attach_object
@@ -71,21 +68,16 @@
* MUTEX: Assumes namespace is locked
*
******************************************************************************/
acpi_status
acpi_ns_attach_object (
struct acpi_namespace_node *node,
union acpi_operand_object *object,
acpi_object_type type)
acpi_ns_attach_object(struct acpi_namespace_node *node,
union acpi_operand_object *object, acpi_object_type type)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *last_obj_desc;
acpi_object_type object_type = ACPI_TYPE_ANY;
ACPI_FUNCTION_TRACE("ns_attach_object");
/*
* Parameter validation
*/
@@ -99,8 +91,7 @@ acpi_ns_attach_object (
if (!object && (ACPI_TYPE_ANY != type)) {
/* Null object */
ACPI_REPORT_ERROR ((
"ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -191,7 +182,6 @@ acpi_ns_attach_object (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_detach_object
@@ -206,16 +196,12 @@ acpi_ns_attach_object (
*
******************************************************************************/
void
acpi_ns_detach_object (
struct acpi_namespace_node *node)
void acpi_ns_detach_object(struct acpi_namespace_node *node)
{
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE("ns_detach_object");
obj_desc = node->object;
if (!obj_desc ||
@@ -229,7 +215,8 @@ acpi_ns_detach_object (
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
node->object = obj_desc->common.next_object;
if (node->object &&
(ACPI_GET_OBJECT_TYPE (node->object) != ACPI_TYPE_LOCAL_DATA)) {
(ACPI_GET_OBJECT_TYPE(node->object) !=
ACPI_TYPE_LOCAL_DATA)) {
node->object = node->object->common.next_object;
}
}
@@ -247,7 +234,6 @@ acpi_ns_detach_object (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_attached_object
@@ -261,29 +247,28 @@ acpi_ns_detach_object (
*
******************************************************************************/
union acpi_operand_object *
acpi_ns_get_attached_object (
struct acpi_namespace_node *node)
union acpi_operand_object *acpi_ns_get_attached_object(struct
acpi_namespace_node
*node)
{
ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
if (!node) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n"));
return_PTR(NULL);
}
if (!node->object ||
((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
(ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
(ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) {
((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
&& (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
ACPI_DESC_TYPE_NAMED))
|| (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) {
return_PTR(NULL);
}
return_PTR(node->object);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_secondary_object
@@ -297,24 +282,23 @@ acpi_ns_get_attached_object (
*
******************************************************************************/
union acpi_operand_object *
acpi_ns_get_secondary_object (
union acpi_operand_object *obj_desc)
union acpi_operand_object *acpi_ns_get_secondary_object(union
acpi_operand_object
*obj_desc)
{
ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc);
if ((!obj_desc) ||
(ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
(!obj_desc->common.next_object) ||
(ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) {
(ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) ==
ACPI_TYPE_LOCAL_DATA)) {
return_PTR(NULL);
}
return_PTR(obj_desc->common.next_object);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_attach_data
@@ -330,16 +314,13 @@ acpi_ns_get_secondary_object (
******************************************************************************/
acpi_status
acpi_ns_attach_data (
struct acpi_namespace_node *node,
acpi_object_handler handler,
void *data)
acpi_ns_attach_data(struct acpi_namespace_node *node,
acpi_object_handler handler, void *data)
{
union acpi_operand_object *prev_obj_desc;
union acpi_operand_object *obj_desc;
union acpi_operand_object *data_desc;
/* We only allow one attachment per handler */
prev_obj_desc = NULL;
@@ -368,15 +349,13 @@ acpi_ns_attach_data (
if (prev_obj_desc) {
prev_obj_desc->common.next_object = data_desc;
}
else {
} else {
node->object = data_desc;
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_detach_data
@@ -392,23 +371,21 @@ acpi_ns_attach_data (
******************************************************************************/
acpi_status
acpi_ns_detach_data (
struct acpi_namespace_node *node,
acpi_ns_detach_data(struct acpi_namespace_node * node,
acpi_object_handler handler)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *prev_obj_desc;
prev_obj_desc = NULL;
obj_desc = node->object;
while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
(obj_desc->data.handler == handler)) {
if (prev_obj_desc) {
prev_obj_desc->common.next_object = obj_desc->common.next_object;
}
else {
prev_obj_desc->common.next_object =
obj_desc->common.next_object;
} else {
node->object = obj_desc->common.next_object;
}
@@ -423,7 +400,6 @@ acpi_ns_detach_data (
return (AE_NOT_FOUND);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_attached_data
@@ -440,14 +416,11 @@ acpi_ns_detach_data (
******************************************************************************/
acpi_status
acpi_ns_get_attached_data (
struct acpi_namespace_node *node,
acpi_object_handler handler,
void **data)
acpi_ns_get_attached_data(struct acpi_namespace_node * node,
acpi_object_handler handler, void **data)
{
union acpi_operand_object *obj_desc;
obj_desc = node->object;
while (obj_desc) {
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
@@ -461,5 +434,3 @@ acpi_ns_get_attached_data (
return (AE_NOT_FOUND);
}

View File

@@ -41,17 +41,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsparse")
/*******************************************************************************
*
* FUNCTION: ns_one_complete_parse
@@ -64,20 +61,15 @@
* DESCRIPTION: Perform one complete parse of an ACPI/AML table.
*
******************************************************************************/
acpi_status
acpi_ns_one_complete_parse (
u8 pass_number,
struct acpi_table_desc *table_desc)
acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc)
{
union acpi_parse_object *parse_root;
acpi_status status;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE("ns_one_complete_parse");
/* Create and init a Root Node */
parse_root = acpi_ps_create_scope_op();
@@ -95,8 +87,9 @@ acpi_ns_one_complete_parse (
}
status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
table_desc->aml_start, table_desc->aml_length,
NULL, pass_number);
table_desc->aml_start,
table_desc->aml_length, NULL,
pass_number);
if (ACPI_FAILURE(status)) {
acpi_ds_delete_walk_state(walk_state);
return_ACPI_STATUS(status);
@@ -104,14 +97,14 @@ acpi_ns_one_complete_parse (
/* Parse the AML */
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", pass_number));
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %d parse\n",
pass_number));
status = acpi_ps_parse_aml(walk_state);
acpi_ps_delete_parse_tree(parse_root);
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_parse_table
@@ -126,16 +119,13 @@ acpi_ns_one_complete_parse (
******************************************************************************/
acpi_status
acpi_ns_parse_table (
struct acpi_table_desc *table_desc,
acpi_ns_parse_table(struct acpi_table_desc *table_desc,
struct acpi_namespace_node *start_node)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ns_parse_table");
/*
* AML Parse, pass 1
*
@@ -169,5 +159,3 @@ acpi_ns_parse_table (
return_ACPI_STATUS(status);
}

View File

@@ -41,24 +41,19 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nssearch")
/* Local prototypes */
static acpi_status
acpi_ns_search_parent_tree (
u32 target_name,
acpi_ns_search_parent_tree(u32 target_name,
struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_namespace_node **return_node);
/*******************************************************************************
*
* FUNCTION: acpi_ns_search_node
@@ -87,18 +82,15 @@ acpi_ns_search_parent_tree (
******************************************************************************/
acpi_status
acpi_ns_search_node (
u32 target_name,
acpi_ns_search_node(u32 target_name,
struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_namespace_node **return_node)
{
struct acpi_namespace_node *next_node;
ACPI_FUNCTION_TRACE("ns_search_node");
#ifdef ACPI_DEBUG_OUTPUT
if (ACPI_LV_NAMES & acpi_dbg_level) {
char *scope_name;
@@ -107,7 +99,8 @@ acpi_ns_search_node (
if (scope_name) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Searching %s (%p) For [%4.4s] (%s)\n",
scope_name, node, (char *) &target_name,
scope_name, node,
(char *)&target_name,
acpi_ut_get_type_name(type)));
ACPI_MEM_FREE(scope_name);
@@ -126,8 +119,11 @@ acpi_ns_search_node (
if (next_node->name.integer == target_name) {
/* Resolve a control method alias if any */
if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object);
if (acpi_ns_get_type(next_node) ==
ACPI_TYPE_LOCAL_METHOD_ALIAS) {
next_node =
ACPI_CAST_PTR(struct acpi_namespace_node,
next_node->object);
}
/*
@@ -135,8 +131,11 @@ acpi_ns_search_node (
*/
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
(char *) &target_name, acpi_ut_get_type_name (next_node->type),
next_node, acpi_ut_get_node_name (node), node));
(char *)&target_name,
acpi_ut_get_type_name(next_node->
type),
next_node,
acpi_ut_get_node_name(node), node));
*return_node = next_node;
return_ACPI_STATUS(AE_OK);
@@ -167,7 +166,6 @@ acpi_ns_search_node (
return_ACPI_STATUS(AE_NOT_FOUND);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_search_parent_tree
@@ -194,8 +192,7 @@ acpi_ns_search_node (
******************************************************************************/
static acpi_status
acpi_ns_search_parent_tree (
u32 target_name,
acpi_ns_search_parent_tree(u32 target_name,
struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_namespace_node **return_node)
@@ -203,10 +200,8 @@ acpi_ns_search_parent_tree (
acpi_status status;
struct acpi_namespace_node *parent_node;
ACPI_FUNCTION_TRACE("ns_search_parent_tree");
parent_node = acpi_ns_get_parent_node(node);
/*
@@ -222,7 +217,8 @@ acpi_ns_search_parent_tree (
if (acpi_ns_local(type)) {
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
(char *) &target_name, acpi_ut_get_type_name (type)));
(char *)&target_name,
acpi_ut_get_type_name(type)));
return_ACPI_STATUS(AE_NOT_FOUND);
}
@@ -230,7 +226,8 @@ acpi_ns_search_parent_tree (
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
"Searching parent [%4.4s] for [%4.4s]\n",
acpi_ut_get_node_name (parent_node), (char *) &target_name));
acpi_ut_get_node_name(parent_node),
(char *)&target_name));
/*
* Search parents until target is found or we have backed up to the root
@@ -259,7 +256,6 @@ acpi_ns_search_parent_tree (
return_ACPI_STATUS(AE_NOT_FOUND);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_search_and_enter
@@ -286,22 +282,18 @@ acpi_ns_search_parent_tree (
******************************************************************************/
acpi_status
acpi_ns_search_and_enter (
u32 target_name,
acpi_ns_search_and_enter(u32 target_name,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node *node,
acpi_interpreter_mode interpreter_mode,
acpi_object_type type,
u32 flags,
struct acpi_namespace_node **return_node)
u32 flags, struct acpi_namespace_node **return_node)
{
acpi_status status;
struct acpi_namespace_node *new_node;
ACPI_FUNCTION_TRACE("ns_search_and_enter");
/* Parameter validation */
if (!node || !target_name || !return_node) {
@@ -316,8 +308,7 @@ acpi_ns_search_and_enter (
/* Name must consist of printable characters */
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_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name));
return_ACPI_STATUS(AE_BAD_CHARACTER);
}
@@ -330,8 +321,7 @@ acpi_ns_search_and_enter (
* If we found it AND the request specifies that a find is an error,
* return the error
*/
if ((status == AE_OK) &&
(flags & ACPI_NS_ERROR_IF_FOUND)) {
if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
status = AE_ALREADY_EXISTS;
}
@@ -356,7 +346,9 @@ acpi_ns_search_and_enter (
* Not found at this level - search parent tree according to the
* ACPI specification
*/
status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
status =
acpi_ns_search_parent_tree(target_name, node, type,
return_node);
if (ACPI_SUCCESS(status)) {
return_ACPI_STATUS(status);
}
@@ -387,4 +379,3 @@ acpi_ns_search_and_enter (
return_ACPI_STATUS(AE_OK);
}

View File

@@ -42,7 +42,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#include <acpi/amlcode.h>
@@ -52,18 +51,12 @@
ACPI_MODULE_NAME("nsutils")
/* Local prototypes */
static u8
acpi_ns_valid_path_separator (
char sep);
static u8 acpi_ns_valid_path_separator(char sep);
#ifdef ACPI_OBSOLETE_FUNCTIONS
acpi_name
acpi_ns_find_parent_name (
struct acpi_namespace_node *node_to_search);
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ns_report_error
@@ -81,17 +74,14 @@ acpi_ns_find_parent_name (
******************************************************************************/
void
acpi_ns_report_error (
char *module_name,
acpi_ns_report_error(char *module_name,
u32 line_number,
u32 component_id,
char *internal_name,
acpi_status lookup_status)
char *internal_name, acpi_status lookup_status)
{
acpi_status status;
char *name = NULL;
acpi_os_printf("%8s-%04d: *** Error: Looking up ",
module_name, line_number);
@@ -100,8 +90,7 @@ acpi_ns_report_error (
acpi_os_printf("[0x%4.4X] (NON-ASCII)\n",
*(ACPI_CAST_PTR(u32, internal_name)));
}
else {
} else {
/* Convert path to external format */
status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
@@ -111,8 +100,7 @@ acpi_ns_report_error (
if (ACPI_SUCCESS(status)) {
acpi_os_printf("[%s]", name);
}
else {
} else {
acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
}
@@ -125,7 +113,6 @@ acpi_ns_report_error (
acpi_format_exception(lookup_status));
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_report_method_error
@@ -145,24 +132,22 @@ acpi_ns_report_error (
******************************************************************************/
void
acpi_ns_report_method_error (
char *module_name,
acpi_ns_report_method_error(char *module_name,
u32 line_number,
u32 component_id,
char *message,
struct acpi_namespace_node *prefix_node,
char *path,
acpi_status method_status)
char *path, acpi_status method_status)
{
acpi_status status;
struct acpi_namespace_node *node = prefix_node;
if (path) {
status = acpi_ns_get_node_by_path(path, prefix_node,
ACPI_NS_NO_UPSEARCH, &node);
if (ACPI_FAILURE(status)) {
acpi_os_printf ("report_method_error: Could not get node\n");
acpi_os_printf
("report_method_error: Could not get node\n");
return;
}
}
@@ -172,7 +157,6 @@ acpi_ns_report_method_error (
acpi_os_printf(", %s\n", acpi_format_exception(method_status));
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_print_node_pathname
@@ -186,14 +170,11 @@ acpi_ns_report_method_error (
******************************************************************************/
void
acpi_ns_print_node_pathname (
struct acpi_namespace_node *node,
char *message)
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
{
struct acpi_buffer buffer;
acpi_status status;
if (!node) {
acpi_os_printf("[NULL NAME]");
return;
@@ -214,7 +195,6 @@ acpi_ns_print_node_pathname (
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_valid_root_prefix
@@ -227,15 +207,12 @@ acpi_ns_print_node_pathname (
*
******************************************************************************/
u8
acpi_ns_valid_root_prefix (
char prefix)
u8 acpi_ns_valid_root_prefix(char prefix)
{
return ((u8) (prefix == '\\'));
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_valid_path_separator
@@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix (
*
******************************************************************************/
static u8
acpi_ns_valid_path_separator (
char sep)
static u8 acpi_ns_valid_path_separator(char sep)
{
return ((u8) (sep == '.'));
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_type
@@ -269,13 +243,10 @@ acpi_ns_valid_path_separator (
*
******************************************************************************/
acpi_object_type
acpi_ns_get_type (
struct acpi_namespace_node *node)
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
{
ACPI_FUNCTION_TRACE("ns_get_type");
if (!node) {
ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
return_VALUE(ACPI_TYPE_ANY);
@@ -284,7 +255,6 @@ acpi_ns_get_type (
return_VALUE((acpi_object_type) node->type);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_local
@@ -298,13 +268,10 @@ acpi_ns_get_type (
*
******************************************************************************/
u32
acpi_ns_local (
acpi_object_type type)
u32 acpi_ns_local(acpi_object_type type)
{
ACPI_FUNCTION_TRACE("ns_local");
if (!acpi_ut_valid_object_type(type)) {
/* Type code out of range */
@@ -315,7 +282,6 @@ acpi_ns_local (
return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_internal_name_length
@@ -330,17 +296,13 @@ acpi_ns_local (
*
******************************************************************************/
void
acpi_ns_get_internal_name_length (
struct acpi_namestring_info *info)
void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
{
char *next_external_char;
u32 i;
ACPI_FUNCTION_ENTRY();
next_external_char = info->external_name;
info->num_carats = 0;
info->num_segments = 0;
@@ -356,8 +318,7 @@ acpi_ns_get_internal_name_length (
if (acpi_ns_valid_root_prefix(next_external_char[0])) {
info->fully_qualified = TRUE;
next_external_char++;
}
else {
} else {
/*
* Handle Carat prefixes
*/
@@ -387,7 +348,6 @@ acpi_ns_get_internal_name_length (
info->next_external_char = next_external_char;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_build_internal_name
@@ -401,9 +361,7 @@ acpi_ns_get_internal_name_length (
*
******************************************************************************/
acpi_status
acpi_ns_build_internal_name (
struct acpi_namestring_info *info)
acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
{
u32 num_segments = info->num_segments;
char *internal_name = info->internal_name;
@@ -411,10 +369,8 @@ acpi_ns_build_internal_name (
char *result = NULL;
acpi_native_uint i;
ACPI_FUNCTION_TRACE("ns_build_internal_name");
/* Setup the correct prefixes, counts, and pointers */
if (info->fully_qualified) {
@@ -422,18 +378,15 @@ acpi_ns_build_internal_name (
if (num_segments <= 1) {
result = &internal_name[1];
}
else if (num_segments == 2) {
} else if (num_segments == 2) {
internal_name[1] = AML_DUAL_NAME_PREFIX;
result = &internal_name[2];
}
else {
} else {
internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
internal_name[2] = (char)num_segments;
result = &internal_name[3];
}
}
else {
} else {
/*
* Not fully qualified.
* Handle Carats first, then append the name segments
@@ -447,14 +400,13 @@ acpi_ns_build_internal_name (
if (num_segments <= 1) {
result = &internal_name[i];
}
else if (num_segments == 2) {
} else if (num_segments == 2) {
internal_name[i] = AML_DUAL_NAME_PREFIX;
result = &internal_name[(acpi_native_uint) (i + 1)];
}
else {
} else {
internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
internal_name[(acpi_native_uint) (i+1)] = (char) num_segments;
internal_name[(acpi_native_uint) (i + 1)] =
(char)num_segments;
result = &internal_name[(acpi_native_uint) (i + 2)];
}
}
@@ -468,11 +420,11 @@ acpi_ns_build_internal_name (
/* Pad the segment with underscore(s) if segment is short */
result[i] = '_';
}
else {
} else {
/* Convert the character to uppercase and save it */
result[i] = (char) ACPI_TOUPPER ((int) *external_name);
result[i] =
(char)ACPI_TOUPPER((int)*external_name);
external_name++;
}
}
@@ -495,10 +447,10 @@ acpi_ns_build_internal_name (
*result = 0;
if (info->fully_qualified) {
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Returning [%p] (abs) \"\\%s\"\n",
internal_name, internal_name));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
internal_name, internal_name));
}
@@ -506,7 +458,6 @@ acpi_ns_build_internal_name (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_internalize_name
@@ -522,22 +473,15 @@ acpi_ns_build_internal_name (
*
*******************************************************************************/
acpi_status
acpi_ns_internalize_name (
char *external_name,
char **converted_name)
acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
{
char *internal_name;
struct acpi_namestring_info info;
acpi_status status;
ACPI_FUNCTION_TRACE("ns_internalize_name");
if ((!external_name) ||
(*external_name == 0) ||
(!converted_name)) {
if ((!external_name) || (*external_name == 0) || (!converted_name)) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -566,7 +510,6 @@ acpi_ns_internalize_name (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_externalize_name
@@ -585,11 +528,9 @@ acpi_ns_internalize_name (
******************************************************************************/
acpi_status
acpi_ns_externalize_name (
u32 internal_name_length,
acpi_ns_externalize_name(u32 internal_name_length,
char *internal_name,
u32 *converted_name_length,
char **converted_name)
u32 * converted_name_length, char **converted_name)
{
acpi_native_uint names_index = 0;
acpi_native_uint num_segments = 0;
@@ -598,13 +539,9 @@ acpi_ns_externalize_name (
acpi_native_uint i = 0;
acpi_native_uint j = 0;
ACPI_FUNCTION_TRACE("ns_externalize_name");
if (!internal_name_length ||
!internal_name ||
!converted_name) {
if (!internal_name_length || !internal_name || !converted_name) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -620,8 +557,7 @@ acpi_ns_externalize_name (
for (i = 0; i < internal_name_length; i++) {
if (internal_name[i] == '^') {
prefix_length = i + 1;
}
else {
} else {
break;
}
}
@@ -648,7 +584,8 @@ acpi_ns_externalize_name (
names_index = prefix_length + 2;
num_segments = (acpi_native_uint) (u8)
internal_name[(acpi_native_uint) (prefix_length + 1)];
internal_name[(acpi_native_uint)
(prefix_length + 1)];
break;
case AML_DUAL_NAME_PREFIX:
@@ -728,7 +665,6 @@ acpi_ns_externalize_name (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_map_handle_to_node
@@ -745,14 +681,11 @@ acpi_ns_externalize_name (
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_map_handle_to_node (
acpi_handle handle)
struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
{
ACPI_FUNCTION_ENTRY();
/*
* Simple implementation.
*/
@@ -773,7 +706,6 @@ acpi_ns_map_handle_to_node (
return ((struct acpi_namespace_node *)handle);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_convert_entry_to_handle
@@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node (
*
******************************************************************************/
acpi_handle
acpi_ns_convert_entry_to_handle (
struct acpi_namespace_node *node)
acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
{
/*
* Simple implementation for now;
*/
return ((acpi_handle) node);
/* Example future implementation ---------------------
if (!Node)
@@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle (
return (ACPI_ROOT_OBJECT);
}
return ((acpi_handle) Node);
------------------------------------------------------*/
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_terminate
@@ -828,16 +754,12 @@ acpi_ns_convert_entry_to_handle (
*
******************************************************************************/
void
acpi_ns_terminate (
void)
void acpi_ns_terminate(void)
{
union acpi_operand_object *obj_desc;
ACPI_FUNCTION_TRACE("ns_terminate");
/*
* 1) Free the entire namespace -- all nodes and objects
*
@@ -863,7 +785,6 @@ acpi_ns_terminate (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_opens_scope
@@ -875,24 +796,21 @@ acpi_ns_terminate (
*
******************************************************************************/
u32
acpi_ns_opens_scope (
acpi_object_type type)
u32 acpi_ns_opens_scope(acpi_object_type type)
{
ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
if (!acpi_ut_valid_object_type(type)) {
/* type code out of range */
ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type));
ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
type));
return_VALUE(ACPI_NS_NORMAL);
}
return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_node_by_path
@@ -916,20 +834,16 @@ acpi_ns_opens_scope (
******************************************************************************/
acpi_status
acpi_ns_get_node_by_path (
char *pathname,
acpi_ns_get_node_by_path(char *pathname,
struct acpi_namespace_node *start_node,
u32 flags,
struct acpi_namespace_node **return_node)
u32 flags, struct acpi_namespace_node **return_node)
{
union acpi_generic_state scope_info;
acpi_status status;
char *internal_path = NULL;
ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
if (pathname) {
/* Convert path to internal representation */
@@ -958,7 +872,8 @@ acpi_ns_get_node_by_path (
NULL, return_node);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s, %s\n",
internal_path, acpi_format_exception (status)));
internal_path,
acpi_format_exception(status)));
}
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
@@ -970,7 +885,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_parent_node
@@ -983,13 +897,11 @@ cleanup:
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_parent_node (
struct acpi_namespace_node *node)
struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
*node)
{
ACPI_FUNCTION_ENTRY();
if (!node) {
return (NULL);
}
@@ -1006,7 +918,6 @@ acpi_ns_get_parent_node (
return (node->peer);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_next_valid_node
@@ -1021,9 +932,9 @@ acpi_ns_get_parent_node (
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_next_valid_node (
struct acpi_namespace_node *node)
struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
acpi_namespace_node
*node)
{
/* If we are at the end of this peer list, return NULL */
@@ -1037,7 +948,6 @@ acpi_ns_get_next_valid_node (
return (node->peer);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
@@ -1053,16 +963,12 @@ acpi_ns_get_next_valid_node (
*
******************************************************************************/
acpi_name
acpi_ns_find_parent_name (
struct acpi_namespace_node *child_node)
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
{
struct acpi_namespace_node *parent_node;
ACPI_FUNCTION_TRACE("ns_find_parent_name");
if (child_node) {
/* Valid entry. Get the parent Node */
@@ -1070,21 +976,23 @@ acpi_ns_find_parent_name (
if (parent_node) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Parent of %p [%4.4s] is %p [%4.4s]\n",
child_node, acpi_ut_get_node_name (child_node),
parent_node, acpi_ut_get_node_name (parent_node)));
child_node,
acpi_ut_get_node_name(child_node),
parent_node,
acpi_ut_get_node_name(parent_node)));
if (parent_node->name.integer) {
return_VALUE ((acpi_name) parent_node->name.integer);
return_VALUE((acpi_name) parent_node->name.
integer);
}
}
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Unable to find parent of %p (%4.4s)\n",
child_node, acpi_ut_get_node_name (child_node)));
child_node,
acpi_ut_get_node_name(child_node)));
}
return_VALUE(ACPI_UNKNOWN_NAME);
}
#endif

View File

@@ -41,15 +41,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nswalk")
/*******************************************************************************
*
* FUNCTION: acpi_ns_get_next_node
@@ -68,19 +65,16 @@
* within Scope is returned.
*
******************************************************************************/
struct acpi_namespace_node *
acpi_ns_get_next_node (
acpi_object_type type,
struct acpi_namespace_node *parent_node,
struct acpi_namespace_node *child_node)
struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
struct acpi_namespace_node
*parent_node,
struct acpi_namespace_node
*child_node)
{
struct acpi_namespace_node *next_node = NULL;
ACPI_FUNCTION_ENTRY();
if (!child_node) {
/* It's really the parent's _scope_ that we want */
@@ -122,7 +116,6 @@ acpi_ns_get_next_node (
return (NULL);
}
/*******************************************************************************
*
* FUNCTION: acpi_ns_walk_namespace
@@ -154,14 +147,12 @@ acpi_ns_get_next_node (
******************************************************************************/
acpi_status
acpi_ns_walk_namespace (
acpi_object_type type,
acpi_ns_walk_namespace(acpi_object_type type,
acpi_handle start_node,
u32 max_depth,
u8 unlock_before_callback,
acpi_walk_callback user_function,
void *context,
void **return_value)
void *context, void **return_value)
{
acpi_status status;
acpi_status mutex_status;
@@ -170,10 +161,8 @@ acpi_ns_walk_namespace (
acpi_object_type child_type;
u32 level;
ACPI_FUNCTION_TRACE("ns_walk_namespace");
/* Special case for the namespace Root Node */
if (start_node == ACPI_ROOT_OBJECT) {
@@ -196,7 +185,9 @@ acpi_ns_walk_namespace (
/* Get the next node in this scope. Null if not found */
status = AE_OK;
child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node, child_node);
child_node =
acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
child_node);
if (child_node) {
/*
* Found node, Get the type if we are not
@@ -212,9 +203,12 @@ acpi_ns_walk_namespace (
* callback function
*/
if (unlock_before_callback) {
mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
mutex_status =
acpi_ut_release_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(mutex_status)) {
return_ACPI_STATUS (mutex_status);
return_ACPI_STATUS
(mutex_status);
}
}
@@ -222,9 +216,12 @@ acpi_ns_walk_namespace (
context, return_value);
if (unlock_before_callback) {
mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
mutex_status =
acpi_ut_acquire_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(mutex_status)) {
return_ACPI_STATUS (mutex_status);
return_ACPI_STATUS
(mutex_status);
}
}
@@ -258,7 +255,8 @@ acpi_ns_walk_namespace (
* maximum depth has been reached.
*/
if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
if (acpi_ns_get_next_node (ACPI_TYPE_ANY, child_node, NULL)) {
if (acpi_ns_get_next_node
(ACPI_TYPE_ANY, child_node, NULL)) {
/*
* There is at least one child of this
* node, visit the onde
@@ -268,8 +266,7 @@ acpi_ns_walk_namespace (
child_node = NULL;
}
}
}
else {
} else {
/*
* No more children of this node (acpi_ns_get_next_node
* failed), go back upwards in the namespace tree to
@@ -285,5 +282,3 @@ acpi_ns_walk_namespace (
return_ACPI_STATUS(AE_OK);
}

View File

@@ -48,11 +48,9 @@
#include <acpi/acnamesp.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsxfeval")
/*******************************************************************************
*
* FUNCTION: acpi_evaluate_object_typed
@@ -73,11 +71,9 @@
* be valid (non-null)
*
******************************************************************************/
#ifdef ACPI_FUTURE_USAGE
acpi_status
acpi_evaluate_object_typed (
acpi_handle handle,
acpi_evaluate_object_typed(acpi_handle handle,
acpi_string pathname,
struct acpi_object_list *external_params,
struct acpi_buffer *return_buffer,
@@ -86,10 +82,8 @@ acpi_evaluate_object_typed (
acpi_status status;
u8 must_free = FALSE;
ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
/* Return buffer must be valid */
if (!return_buffer) {
@@ -102,7 +96,9 @@ acpi_evaluate_object_typed (
/* Evaluate the object */
status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
status =
acpi_evaluate_object(handle, pathname, external_params,
return_buffer);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -116,8 +112,7 @@ acpi_evaluate_object_typed (
if (return_buffer->length == 0) {
/* Error because caller specifically asked for a return value */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"No return value\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n"));
return_ACPI_STATUS(AE_NULL_OBJECT);
}
@@ -132,7 +127,8 @@ acpi_evaluate_object_typed (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Incorrect return type [%s] requested [%s]\n",
acpi_ut_get_type_name (((union acpi_object *) return_buffer->pointer)->type),
acpi_ut_get_type_name(((union acpi_object *)
return_buffer->pointer)->type),
acpi_ut_get_type_name(return_type)));
if (must_free) {
@@ -147,7 +143,6 @@ acpi_evaluate_object_typed (
}
#endif /* ACPI_FUTURE_USAGE */
/*******************************************************************************
*
* FUNCTION: acpi_evaluate_object
@@ -169,8 +164,7 @@ acpi_evaluate_object_typed (
******************************************************************************/
acpi_status
acpi_evaluate_object (
acpi_handle handle,
acpi_evaluate_object(acpi_handle handle,
acpi_string pathname,
struct acpi_object_list *external_params,
struct acpi_buffer *return_buffer)
@@ -181,10 +175,8 @@ acpi_evaluate_object (
acpi_size buffer_space_needed;
u32 i;
ACPI_FUNCTION_TRACE("acpi_evaluate_object");
info.node = handle;
info.parameters = NULL;
info.return_object = NULL;
@@ -200,9 +192,9 @@ acpi_evaluate_object (
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
info.parameters = ACPI_MEM_CALLOCATE (
((acpi_size) external_params->count + 1) *
sizeof (void *));
info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
external_params->count +
1) * sizeof(void *));
if (!info.parameters) {
return_ACPI_STATUS(AE_NO_MEMORY);
}
@@ -212,31 +204,32 @@ acpi_evaluate_object (
* internal object
*/
for (i = 0; i < external_params->count; i++) {
status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
&info.parameters[i]);
status =
acpi_ut_copy_eobject_to_iobject(&external_params->
pointer[i],
&info.
parameters[i]);
if (ACPI_FAILURE(status)) {
acpi_ut_delete_internal_object_list (info.parameters);
acpi_ut_delete_internal_object_list(info.
parameters);
return_ACPI_STATUS(status);
}
}
info.parameters[external_params->count] = NULL;
}
/*
* Three major cases:
* 1) Fully qualified pathname
* 2) No handle, not fully qualified pathname (error)
* 3) Valid handle
*/
if ((pathname) &&
(acpi_ns_valid_root_prefix (pathname[0]))) {
if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
/*
* The path is fully qualified, just evaluate by name
*/
status = acpi_ns_evaluate_by_name(pathname, &info);
}
else if (!handle) {
} else if (!handle) {
/*
* A handle is optional iff a fully qualified pathname
* is specified. Since we've already handled fully
@@ -245,15 +238,13 @@ acpi_evaluate_object (
if (!pathname) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Both Handle and Pathname are NULL\n"));
}
else {
} else {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Handle is NULL and Pathname is relative\n"));
}
status = AE_BAD_PARAMETER;
}
else {
} else {
/*
* We get here if we have a handle -- and if we have a
* pathname it is relative. The handle will be validated
@@ -265,8 +256,7 @@ acpi_evaluate_object (
* the actual object to be evaluated
*/
status = acpi_ns_evaluate_by_handle(&info);
}
else {
} else {
/*
* Both a Handle and a relative Pathname
*/
@@ -274,7 +264,6 @@ acpi_evaluate_object (
}
}
/*
* If we are expecting a return value, and all went well above,
* copy the return value to an external object.
@@ -282,9 +271,9 @@ acpi_evaluate_object (
if (return_buffer) {
if (!info.return_object) {
return_buffer->length = 0;
}
else {
if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) {
} else {
if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
ACPI_DESC_TYPE_NAMED) {
/*
* If we received a NS Node as a return object, this means that
* the object we are evaluating has nothing interesting to
@@ -303,12 +292,15 @@ acpi_evaluate_object (
* Find out how large a buffer is needed
* to contain the returned object
*/
status = acpi_ut_get_object_size (info.return_object,
status =
acpi_ut_get_object_size(info.return_object,
&buffer_space_needed);
if (ACPI_SUCCESS(status)) {
/* Validate/Allocate/Clear caller buffer */
status = acpi_ut_initialize_buffer (return_buffer,
status =
acpi_ut_initialize_buffer
(return_buffer,
buffer_space_needed);
if (ACPI_FAILURE(status)) {
/*
@@ -316,14 +308,17 @@ acpi_evaluate_object (
*/
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
(u32) buffer_space_needed,
acpi_format_exception (status)));
}
else {
(u32)
buffer_space_needed,
acpi_format_exception
(status)));
} else {
/*
* We have enough space for the object, build it
*/
status = acpi_ut_copy_iobject_to_eobject (info.return_object,
status =
acpi_ut_copy_iobject_to_eobject
(info.return_object,
return_buffer);
}
}
@@ -358,8 +353,8 @@ acpi_evaluate_object (
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_evaluate_object);
EXPORT_SYMBOL(acpi_evaluate_object);
/*******************************************************************************
*
@@ -392,25 +387,19 @@ EXPORT_SYMBOL(acpi_evaluate_object);
******************************************************************************/
acpi_status
acpi_walk_namespace (
acpi_object_type type,
acpi_walk_namespace(acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
acpi_walk_callback user_function,
void *context,
void **return_value)
void *context, void **return_value)
{
acpi_status status;
ACPI_FUNCTION_TRACE("acpi_walk_namespace");
/* Parameter validation */
if ((type > ACPI_TYPE_EXTERNAL_MAX) ||
(!max_depth) ||
(!user_function)) {
if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -432,8 +421,8 @@ acpi_walk_namespace (
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_walk_namespace);
EXPORT_SYMBOL(acpi_walk_namespace);
/*******************************************************************************
*
@@ -450,11 +439,9 @@ EXPORT_SYMBOL(acpi_walk_namespace);
******************************************************************************/
static acpi_status
acpi_ns_get_device_callback (
acpi_handle obj_handle,
acpi_ns_get_device_callback(acpi_handle obj_handle,
u32 nesting_level,
void *context,
void **return_value)
void *context, void **return_value)
{
struct acpi_get_devices_info *info = context;
acpi_status status;
@@ -464,7 +451,6 @@ acpi_ns_get_device_callback (
struct acpi_compatible_id_list *cid;
acpi_native_uint i;
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return (status);
@@ -499,8 +485,7 @@ acpi_ns_get_device_callback (
status = acpi_ut_execute_HID(node, &hid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
else if (ACPI_FAILURE (status)) {
} else if (ACPI_FAILURE(status)) {
return (AE_CTRL_DEPTH);
}
@@ -510,8 +495,7 @@ acpi_ns_get_device_callback (
status = acpi_ut_execute_CID(node, &cid);
if (status == AE_NOT_FOUND) {
return (AE_OK);
}
else if (ACPI_FAILURE (status)) {
} else if (ACPI_FAILURE(status)) {
return (AE_CTRL_DEPTH);
}
@@ -519,7 +503,9 @@ acpi_ns_get_device_callback (
for (i = 0; i < cid->count; i++) {
if (ACPI_STRNCMP(cid->id[i].value, info->hid,
sizeof (struct acpi_compatible_id)) != 0) {
sizeof(struct
acpi_compatible_id)) !=
0) {
ACPI_MEM_FREE(cid);
return (AE_OK);
}
@@ -533,7 +519,6 @@ acpi_ns_get_device_callback (
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_get_devices
@@ -560,19 +545,15 @@ acpi_ns_get_device_callback (
******************************************************************************/
acpi_status
acpi_get_devices (
char *HID,
acpi_get_devices(char *HID,
acpi_walk_callback user_function,
void *context,
void **return_value)
void *context, void **return_value)
{
acpi_status status;
struct acpi_get_devices_info info;
ACPI_FUNCTION_TRACE("acpi_get_devices");
/* Parameter validation */
if (!user_function) {
@@ -607,8 +588,8 @@ acpi_get_devices (
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_get_devices);
EXPORT_SYMBOL(acpi_get_devices);
/*******************************************************************************
*
@@ -625,20 +606,15 @@ EXPORT_SYMBOL(acpi_get_devices);
******************************************************************************/
acpi_status
acpi_attach_data (
acpi_handle obj_handle,
acpi_object_handler handler,
void *data)
acpi_attach_data(acpi_handle obj_handle,
acpi_object_handler handler, void *data)
{
struct acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler ||
!data) {
if (!obj_handle || !handler || !data) {
return (AE_BAD_PARAMETER);
}
@@ -662,7 +638,6 @@ unlock_and_exit:
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_detach_data
@@ -677,18 +652,14 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_detach_data (
acpi_handle obj_handle,
acpi_object_handler handler)
acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
{
struct acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler) {
if (!obj_handle || !handler) {
return (AE_BAD_PARAMETER);
}
@@ -712,7 +683,6 @@ unlock_and_exit:
return (status);
}
/*******************************************************************************
*
* FUNCTION: acpi_get_data
@@ -728,20 +698,14 @@ unlock_and_exit:
******************************************************************************/
acpi_status
acpi_get_data (
acpi_handle obj_handle,
acpi_object_handler handler,
void **data)
acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
{
struct acpi_namespace_node *node;
acpi_status status;
/* Parameter validation */
if (!obj_handle ||
!handler ||
!data) {
if (!obj_handle || !handler || !data) {
return (AE_BAD_PARAMETER);
}
@@ -764,5 +728,3 @@ unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}

View File

@@ -47,11 +47,9 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsxfname")
/******************************************************************************
*
* FUNCTION: acpi_get_handle
@@ -69,21 +67,16 @@
* namespace handle.
*
******************************************************************************/
acpi_status
acpi_get_handle (
acpi_handle parent,
acpi_string pathname,
acpi_handle *ret_handle)
acpi_get_handle(acpi_handle parent,
acpi_string pathname, acpi_handle * ret_handle)
{
acpi_status status;
struct acpi_namespace_node *node = NULL;
struct acpi_namespace_node *prefix_node = NULL;
ACPI_FUNCTION_ENTRY();
/* Parameter Validation */
if (!ret_handle || !pathname) {
@@ -113,14 +106,16 @@ acpi_get_handle (
/* Special case for root, since we can't search for it */
if (ACPI_STRCMP(pathname, ACPI_NS_ROOT_PATH) == 0) {
*ret_handle = acpi_ns_convert_entry_to_handle (acpi_gbl_root_node);
*ret_handle =
acpi_ns_convert_entry_to_handle(acpi_gbl_root_node);
return (AE_OK);
}
/*
* Find the Node and convert to a handle
*/
status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
status =
acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
&node);
*ret_handle = NULL;
@@ -130,8 +125,8 @@ acpi_get_handle (
return (status);
}
EXPORT_SYMBOL(acpi_get_handle);
EXPORT_SYMBOL(acpi_get_handle);
/******************************************************************************
*
@@ -150,15 +145,11 @@ EXPORT_SYMBOL(acpi_get_handle);
******************************************************************************/
acpi_status
acpi_get_name (
acpi_handle handle,
u32 name_type,
struct acpi_buffer *buffer)
acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
{
acpi_status status;
struct acpi_namespace_node *node;
/* Parameter validation */
if (name_type > ACPI_NAME_TYPE_MAX) {
@@ -206,14 +197,13 @@ acpi_get_name (
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
status = AE_OK;
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
EXPORT_SYMBOL(acpi_get_name);
EXPORT_SYMBOL(acpi_get_name);
/******************************************************************************
*
@@ -231,9 +221,7 @@ EXPORT_SYMBOL(acpi_get_name);
******************************************************************************/
acpi_status
acpi_get_object_info (
acpi_handle handle,
struct acpi_buffer *buffer)
acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
{
acpi_status status;
struct acpi_namespace_node *node;
@@ -242,7 +230,6 @@ acpi_get_object_info (
struct acpi_compatible_id_list *cid_list = NULL;
acpi_size size;
/* Parameter validation */
if (!handle || !buffer) {
@@ -354,10 +341,10 @@ acpi_get_object_info (
ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
if (cid_list) {
ACPI_MEMCPY (&return_info->compatibility_id, cid_list, cid_list->size);
ACPI_MEMCPY(&return_info->compatibility_id, cid_list,
cid_list->size);
}
cleanup:
ACPI_MEM_FREE(info);
if (cid_list) {
@@ -365,5 +352,5 @@ cleanup:
}
return (status);
}
EXPORT_SYMBOL(acpi_get_object_info);
EXPORT_SYMBOL(acpi_get_object_info);

View File

@@ -47,7 +47,6 @@
#include <acpi/acpi.h>
#include <acpi/acnamesp.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME("nsxfobj")
@@ -63,16 +62,11 @@
* DESCRIPTION: This routine returns the type associatd with a particular handle
*
******************************************************************************/
acpi_status
acpi_get_type (
acpi_handle handle,
acpi_object_type *ret_type)
acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type)
{
struct acpi_namespace_node *node;
acpi_status status;
/* Parameter Validation */
if (!ret_type) {
@@ -103,12 +97,11 @@ acpi_get_type (
*ret_type = node->type;
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
EXPORT_SYMBOL(acpi_get_type);
EXPORT_SYMBOL(acpi_get_type);
/*******************************************************************************
*
@@ -124,15 +117,11 @@ EXPORT_SYMBOL(acpi_get_type);
*
******************************************************************************/
acpi_status
acpi_get_parent (
acpi_handle handle,
acpi_handle *ret_handle)
acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
{
struct acpi_namespace_node *node;
acpi_status status;
if (!ret_handle) {
return (AE_BAD_PARAMETER);
}
@@ -167,14 +156,13 @@ acpi_get_parent (
status = AE_NULL_ENTRY;
}
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
return (status);
}
EXPORT_SYMBOL(acpi_get_parent);
EXPORT_SYMBOL(acpi_get_parent);
/*******************************************************************************
*
@@ -195,18 +183,15 @@ EXPORT_SYMBOL(acpi_get_parent);
******************************************************************************/
acpi_status
acpi_get_next_object (
acpi_object_type type,
acpi_get_next_object(acpi_object_type type,
acpi_handle parent,
acpi_handle child,
acpi_handle *ret_handle)
acpi_handle child, acpi_handle * ret_handle)
{
acpi_status status;
struct acpi_namespace_node *node;
struct acpi_namespace_node *parent_node = NULL;
struct acpi_namespace_node *child_node = NULL;
/* Parameter validation */
if (type > ACPI_TYPE_EXTERNAL_MAX) {
@@ -228,8 +213,7 @@ acpi_get_next_object (
status = AE_BAD_PARAMETER;
goto unlock_and_exit;
}
}
else {
} else {
/* Non-null handle, ignore the parent */
/* Convert and validate the handle */
@@ -252,7 +236,6 @@ acpi_get_next_object (
*ret_handle = acpi_ns_convert_entry_to_handle(node);
}
unlock_and_exit:
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);

View File

@@ -36,11 +36,13 @@
#define _COMPONENT ACPI_NUMA
ACPI_MODULE_NAME("numa")
extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
extern int __init acpi_table_parse_madt_family(enum acpi_table_id id,
unsigned long madt_size,
int entry_id,
acpi_madt_entry_handler handler,
unsigned int max_entries);
void __init
acpi_table_print_srat_entry (
acpi_table_entry_header *header)
void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
{
ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
@@ -55,9 +57,12 @@ acpi_table_print_srat_entry (
{
struct acpi_table_processor_affinity *p =
(struct acpi_table_processor_affinity *)header;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
p->apic_id, p->lsapic_eid, p->proximity_domain,
p->flags.enabled?"enabled":"disabled"));
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
p->apic_id, p->lsapic_eid,
p->proximity_domain,
p->flags.
enabled ? "enabled" : "disabled"));
}
#endif /* ACPI_DEBUG_OUTPUT */
break;
@@ -67,25 +72,29 @@ acpi_table_print_srat_entry (
{
struct acpi_table_memory_affinity *p =
(struct acpi_table_memory_affinity *)header;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
p->base_addr_hi, p->base_addr_lo,
p->length_hi, p->length_lo,
p->memory_type, p->proximity_domain,
p->flags.enabled ? "enabled" : "disabled",
p->flags.hot_pluggable ? " hot-pluggable" : ""));
p->flags.
enabled ? "enabled" : "disabled",
p->flags.
hot_pluggable ? " hot-pluggable" :
""));
}
#endif /* ACPI_DEBUG_OUTPUT */
break;
default:
printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
printk(KERN_WARNING PREFIX
"Found unsupported SRAT entry (type = 0x%x)\n",
header->type);
break;
}
}
static int __init
acpi_parse_slit (unsigned long phys_addr, unsigned long size)
static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size)
{
struct acpi_table_slit *slit;
u32 localities;
@@ -103,10 +112,8 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size)
return 0;
}
static int __init
acpi_parse_processor_affinity (
acpi_table_entry_header *header,
acpi_parse_processor_affinity(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_processor_affinity *processor_affinity;
@@ -123,10 +130,8 @@ acpi_parse_processor_affinity (
return 0;
}
static int __init
acpi_parse_memory_affinity (
acpi_table_entry_header *header,
acpi_parse_memory_affinity(acpi_table_entry_header * header,
const unsigned long end)
{
struct acpi_table_memory_affinity *memory_affinity;
@@ -143,9 +148,7 @@ acpi_parse_memory_affinity (
return 0;
}
static int __init
acpi_parse_srat (unsigned long phys_addr, unsigned long size)
static int __init acpi_parse_srat(unsigned long phys_addr, unsigned long size)
{
struct acpi_table_srat *srat;
@@ -157,20 +160,16 @@ acpi_parse_srat (unsigned long phys_addr, unsigned long size)
return 0;
}
int __init
acpi_table_parse_srat (
enum acpi_srat_entry_id id,
acpi_madt_entry_handler handler,
unsigned int max_entries)
acpi_table_parse_srat(enum acpi_srat_entry_id id,
acpi_madt_entry_handler handler, unsigned int max_entries)
{
return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
id, handler, max_entries);
return acpi_table_parse_madt_family(ACPI_SRAT,
sizeof(struct acpi_table_srat), id,
handler, max_entries);
}
int __init
acpi_numa_init(void)
int __init acpi_numa_init(void)
{
int result;
@@ -181,9 +180,7 @@ acpi_numa_init(void)
result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
acpi_parse_processor_affinity,
NR_CPUS);
result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
acpi_parse_memory_affinity,
NR_NODE_MEMBLKS); // IA64 specific
result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
}
/* SLIT: System Locality Information Table */
@@ -193,8 +190,7 @@ acpi_numa_init(void)
return 0;
}
int
acpi_get_pxm(acpi_handle h)
int acpi_get_pxm(acpi_handle h)
{
unsigned long pxm;
acpi_status status;
@@ -210,4 +206,5 @@ acpi_get_pxm(acpi_handle h)
} while (ACPI_SUCCESS(status));
return -1;
}
EXPORT_SYMBOL(acpi_get_pxm);

View File

@@ -45,14 +45,10 @@
#include <linux/efi.h>
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME("osl")
#define PREFIX "ACPI: "
struct acpi_os_dpc
{
struct acpi_os_dpc {
acpi_osd_exec_callback function;
void *context;
};
@@ -79,14 +75,12 @@ static acpi_osd_handler acpi_irq_handler;
static void *acpi_irq_context;
static struct workqueue_struct *kacpid_wq;
acpi_status
acpi_os_initialize(void)
acpi_status acpi_os_initialize(void)
{
return AE_OK;
}
acpi_status
acpi_os_initialize1(void)
acpi_status acpi_os_initialize1(void)
{
/*
* Initialize PCI configuration space access, as we'll need to access
@@ -94,7 +88,8 @@ acpi_os_initialize1(void)
*/
#ifdef CONFIG_ACPI_PCI
if (!raw_pci_ops) {
printk(KERN_ERR PREFIX "Access to PCI configuration space unavailable\n");
printk(KERN_ERR PREFIX
"Access to PCI configuration space unavailable\n");
return AE_NULL_ENTRY;
}
#endif
@@ -104,8 +99,7 @@ acpi_os_initialize1(void)
return AE_OK;
}
acpi_status
acpi_os_terminate(void)
acpi_status acpi_os_terminate(void)
{
if (acpi_irq_handler) {
acpi_os_remove_interrupt_handler(acpi_irq_irq,
@@ -117,18 +111,17 @@ acpi_os_terminate(void)
return AE_OK;
}
void
acpi_os_printf(const char *fmt,...)
void acpi_os_printf(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
acpi_os_vprintf(fmt, args);
va_end(args);
}
EXPORT_SYMBOL(acpi_os_printf);
void
acpi_os_vprintf(const char *fmt, va_list args)
void acpi_os_vprintf(const char *fmt, va_list args)
{
static char buffer[512];
@@ -146,8 +139,7 @@ acpi_os_vprintf(const char *fmt, va_list args)
}
extern int acpi_in_resume;
void *
acpi_os_allocate(acpi_size size)
void *acpi_os_allocate(acpi_size size)
{
if (acpi_in_resume)
return kmalloc(size, GFP_ATOMIC);
@@ -155,15 +147,14 @@ acpi_os_allocate(acpi_size size)
return kmalloc(size, GFP_KERNEL);
}
void
acpi_os_free(void *ptr)
void acpi_os_free(void *ptr)
{
kfree(ptr);
}
EXPORT_SYMBOL(acpi_os_free);
acpi_status
acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
acpi_status acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
{
if (efi_enabled) {
addr->pointer_type = ACPI_PHYSICAL_POINTER;
@@ -174,12 +165,14 @@ acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
addr->pointer.physical =
(acpi_physical_address) virt_to_phys(efi.acpi);
else {
printk(KERN_ERR PREFIX "System description tables not found\n");
printk(KERN_ERR PREFIX
"System description tables not found\n");
return AE_NOT_FOUND;
}
} else {
if (ACPI_FAILURE(acpi_find_root_pointer(flags, addr))) {
printk(KERN_ERR PREFIX "System description tables not found\n");
printk(KERN_ERR PREFIX
"System description tables not found\n");
return AE_NOT_FOUND;
}
}
@@ -188,7 +181,8 @@ acpi_os_get_root_pointer(u32 flags, struct acpi_pointer *addr)
}
acpi_status
acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **virt)
acpi_os_map_memory(acpi_physical_address phys, acpi_size size,
void __iomem ** virt)
{
if (efi_enabled) {
if (EFI_MEMORY_WB & efi_mem_attributes(phys)) {
@@ -213,8 +207,7 @@ acpi_os_map_memory(acpi_physical_address phys, acpi_size size, void __iomem **vi
return AE_OK;
}
void
acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
{
iounmap(virt);
}
@@ -271,14 +264,14 @@ acpi_os_table_override (struct acpi_table_header *existing_table,
return AE_OK;
}
static irqreturn_t
acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t acpi_irq(int irq, void *dev_id, struct pt_regs *regs)
{
return (*acpi_irq_handler) (acpi_irq_context) ? IRQ_HANDLED : IRQ_NONE;
}
acpi_status
acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *context)
acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler,
void *context)
{
unsigned int irq;
@@ -305,8 +298,7 @@ acpi_os_install_interrupt_handler(u32 gsi, acpi_osd_handler handler, void *conte
return AE_OK;
}
acpi_status
acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
{
if (irq) {
free_irq(irq, acpi_irq);
@@ -321,16 +313,15 @@ acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
* Running in interpreter thread context, safe to sleep
*/
void
acpi_os_sleep(acpi_integer ms)
void acpi_os_sleep(acpi_integer ms)
{
current->state = TASK_INTERRUPTIBLE;
schedule_timeout(((signed long)ms * HZ) / 1000);
}
EXPORT_SYMBOL(acpi_os_sleep);
void
acpi_os_stall(u32 us)
void acpi_os_stall(u32 us)
{
while (us) {
u32 delay = 1000;
@@ -342,6 +333,7 @@ acpi_os_stall(u32 us)
us -= delay;
}
}
EXPORT_SYMBOL(acpi_os_stall);
/*
@@ -349,8 +341,7 @@ EXPORT_SYMBOL(acpi_os_stall);
* Returns 64-bit free-running, monotonically increasing timer
* with 100ns granularity
*/
u64
acpi_os_get_timer (void)
u64 acpi_os_get_timer(void)
{
static u64 t;
@@ -367,19 +358,14 @@ acpi_os_get_timer (void)
return ++t;
}
acpi_status
acpi_os_read_port(
acpi_io_address port,
u32 *value,
u32 width)
acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
{
u32 dummy;
if (!value)
value = &dummy;
switch (width)
{
switch (width) {
case 8:
*(u8 *) value = inb(port);
break;
@@ -395,16 +381,12 @@ acpi_os_read_port(
return AE_OK;
}
EXPORT_SYMBOL(acpi_os_read_port);
acpi_status
acpi_os_write_port(
acpi_io_address port,
u32 value,
u32 width)
{
switch (width)
acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width)
{
switch (width) {
case 8:
outb(value, port);
break;
@@ -420,13 +402,11 @@ acpi_os_write_port(
return AE_OK;
}
EXPORT_SYMBOL(acpi_os_write_port);
acpi_status
acpi_os_read_memory(
acpi_physical_address phys_addr,
u32 *value,
u32 width)
acpi_os_read_memory(acpi_physical_address phys_addr, u32 * value, u32 width)
{
u32 dummy;
void __iomem *virt_addr;
@@ -468,10 +448,7 @@ acpi_os_read_memory(
}
acpi_status
acpi_os_write_memory(
acpi_physical_address phys_addr,
u32 value,
u32 width)
acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
{
void __iomem *virt_addr;
int iomem = 0;
@@ -510,7 +487,8 @@ acpi_os_write_memory(
#ifdef CONFIG_ACPI_PCI
acpi_status
acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value, u32 width)
acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
void *value, u32 width)
{
int result, size;
@@ -539,10 +517,12 @@ acpi_os_read_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, void *value
return (result ? AE_ERROR : AE_OK);
}
EXPORT_SYMBOL(acpi_os_read_pci_configuration);
acpi_status
acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integer value, u32 width)
acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
acpi_integer value, u32 width)
{
int result, size;
@@ -570,13 +550,10 @@ acpi_os_write_pci_configuration (struct acpi_pci_id *pci_id, u32 reg, acpi_integ
}
/* TODO: Change code to take advantage of driver model more */
static void
acpi_os_derive_pci_id_2 (
acpi_handle rhandle, /* upper bound */
static void acpi_os_derive_pci_id_2(acpi_handle rhandle, /* upper bound */
acpi_handle chandle, /* current node */
struct acpi_pci_id **id,
int *is_bridge,
u8 *bus_number)
int *is_bridge, u8 * bus_number)
{
acpi_handle handle;
struct acpi_pci_id *pci_id = *id;
@@ -587,13 +564,16 @@ acpi_os_derive_pci_id_2 (
acpi_get_parent(chandle, &handle);
if (handle != rhandle) {
acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge, bus_number);
acpi_os_derive_pci_id_2(rhandle, handle, &pci_id, is_bridge,
bus_number);
status = acpi_get_type(handle, &type);
if ((ACPI_FAILURE(status)) || (type != ACPI_TYPE_DEVICE))
return;
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &temp);
status =
acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL,
&temp);
if (ACPI_SUCCESS(status)) {
pci_id->device = ACPI_HIWORD(ACPI_LODWORD(temp));
pci_id->function = ACPI_LOWORD(ACPI_LODWORD(temp));
@@ -602,17 +582,23 @@ acpi_os_derive_pci_id_2 (
pci_id->bus = *bus_number;
/* any nicer way to get bus number of bridge ? */
status = acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8, 8);
if (ACPI_SUCCESS(status) &&
((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
status = acpi_os_read_pci_configuration(pci_id, 0x18, &tu8, 8);
status =
acpi_os_read_pci_configuration(pci_id, 0x0e, &tu8,
8);
if (ACPI_SUCCESS(status)
&& ((tu8 & 0x7f) == 1 || (tu8 & 0x7f) == 2)) {
status =
acpi_os_read_pci_configuration(pci_id, 0x18,
&tu8, 8);
if (!ACPI_SUCCESS(status)) {
/* Certainly broken... FIX ME */
return;
}
*is_bridge = 1;
pci_id->bus = tu8;
status = acpi_os_read_pci_configuration(pci_id, 0x19, &tu8, 8);
status =
acpi_os_read_pci_configuration(pci_id, 0x19,
&tu8, 8);
if (ACPI_SUCCESS(status)) {
*bus_number = tu8;
}
@@ -622,9 +608,7 @@ acpi_os_derive_pci_id_2 (
}
}
void
acpi_os_derive_pci_id (
acpi_handle rhandle, /* upper bound */
void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
acpi_handle chandle, /* current node */
struct acpi_pci_id **id)
{
@@ -637,28 +621,20 @@ acpi_os_derive_pci_id (
#else /*!CONFIG_ACPI_PCI */
acpi_status
acpi_os_write_pci_configuration (
struct acpi_pci_id *pci_id,
u32 reg,
acpi_integer value,
u32 width)
acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id,
u32 reg, acpi_integer value, u32 width)
{
return AE_SUPPORT;
}
acpi_status
acpi_os_read_pci_configuration (
struct acpi_pci_id *pci_id,
u32 reg,
void *value,
u32 width)
acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id,
u32 reg, void *value, u32 width)
{
return AE_SUPPORT;
}
void
acpi_os_derive_pci_id (
acpi_handle rhandle, /* upper bound */
void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */
acpi_handle chandle, /* current node */
struct acpi_pci_id **id)
{
@@ -666,9 +642,7 @@ acpi_os_derive_pci_id (
#endif /*CONFIG_ACPI_PCI */
static void
acpi_os_execute_deferred (
void *context)
static void acpi_os_execute_deferred(void *context)
{
struct acpi_os_dpc *dpc = NULL;
@@ -688,10 +662,8 @@ acpi_os_execute_deferred (
}
acpi_status
acpi_os_queue_for_execution(
u32 priority,
acpi_osd_exec_callback function,
void *context)
acpi_os_queue_for_execution(u32 priority,
acpi_osd_exec_callback function, void *context)
{
acpi_status status = AE_OK;
struct acpi_os_dpc *dpc;
@@ -699,7 +671,9 @@ acpi_os_queue_for_execution(
ACPI_FUNCTION_TRACE("os_queue_for_execution");
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Scheduling function [%p(%p)] for deferred execution.\n", function, context));
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Scheduling function [%p(%p)] for deferred execution.\n",
function, context));
if (!function)
return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -715,7 +689,9 @@ acpi_os_queue_for_execution(
* from the same memory.
*/
dpc = kmalloc(sizeof(struct acpi_os_dpc)+sizeof(struct work_struct), GFP_ATOMIC);
dpc =
kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct),
GFP_ATOMIC);
if (!dpc)
return_ACPI_STATUS(AE_NO_MEMORY);
@@ -726,29 +702,28 @@ acpi_os_queue_for_execution(
INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);
if (!queue_work(kacpid_wq, task)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Call to queue_work() failed.\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Call to queue_work() failed.\n"));
kfree(dpc);
status = AE_ERROR;
}
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_os_queue_for_execution);
void
acpi_os_wait_events_complete(
void *context)
void acpi_os_wait_events_complete(void *context)
{
flush_workqueue(kacpid_wq);
}
EXPORT_SYMBOL(acpi_os_wait_events_complete);
/*
* Allocate the memory for a spinlock and initialize it.
*/
acpi_status
acpi_os_create_lock (
acpi_handle *out_handle)
acpi_status acpi_os_create_lock(acpi_handle * out_handle)
{
spinlock_t *lock_ptr;
@@ -765,13 +740,10 @@ acpi_os_create_lock (
return_ACPI_STATUS(AE_OK);
}
/*
* Deallocate the memory for a spinlock.
*/
void
acpi_os_delete_lock (
acpi_handle handle)
void acpi_os_delete_lock(acpi_handle handle)
{
ACPI_FUNCTION_TRACE("os_create_lock");
@@ -783,10 +755,7 @@ acpi_os_delete_lock (
}
acpi_status
acpi_os_create_semaphore(
u32 max_units,
u32 initial_units,
acpi_handle *handle)
acpi_os_create_semaphore(u32 max_units, u32 initial_units, acpi_handle * handle)
{
struct semaphore *sem = NULL;
@@ -801,12 +770,13 @@ acpi_os_create_semaphore(
*handle = (acpi_handle *) sem;
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n", *handle, initial_units));
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Creating semaphore[%p|%d].\n",
*handle, initial_units));
return_ACPI_STATUS(AE_OK);
}
EXPORT_SYMBOL(acpi_os_create_semaphore);
EXPORT_SYMBOL(acpi_os_create_semaphore);
/*
* TODO: A better way to delete semaphores? Linux doesn't have a
@@ -815,9 +785,7 @@ EXPORT_SYMBOL(acpi_os_create_semaphore);
* we at least check for blocked threads and signal/cancel them?
*/
acpi_status
acpi_os_delete_semaphore(
acpi_handle handle)
acpi_status acpi_os_delete_semaphore(acpi_handle handle)
{
struct semaphore *sem = (struct semaphore *)handle;
@@ -828,12 +796,13 @@ acpi_os_delete_semaphore(
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Deleting semaphore[%p].\n", handle));
acpi_os_free(sem); sem = NULL;
acpi_os_free(sem);
sem = NULL;
return_ACPI_STATUS(AE_OK);
}
EXPORT_SYMBOL(acpi_os_delete_semaphore);
EXPORT_SYMBOL(acpi_os_delete_semaphore);
/*
* TODO: The kernel doesn't have a 'down_timeout' function -- had to
@@ -844,11 +813,7 @@ EXPORT_SYMBOL(acpi_os_delete_semaphore);
*
* TODO: Support for units > 1?
*/
acpi_status
acpi_os_wait_semaphore(
acpi_handle handle,
u32 units,
u16 timeout)
acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
{
acpi_status status = AE_OK;
struct semaphore *sem = (struct semaphore *)handle;
@@ -862,13 +827,13 @@ acpi_os_wait_semaphore(
if (units > 1)
return_ACPI_STATUS(AE_SUPPORT);
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n", handle, units, timeout));
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
handle, units, timeout));
if (in_atomic())
timeout = 0;
switch (timeout)
{
switch (timeout) {
/*
* No Wait:
* --------
@@ -913,25 +878,25 @@ acpi_os_wait_semaphore(
}
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failed to acquire semaphore[%p|%d|%d], %s\n",
handle, units, timeout, acpi_format_exception(status)));
}
else {
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Acquired semaphore[%p|%d|%d]\n", handle, units, timeout));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Failed to acquire semaphore[%p|%d|%d], %s\n",
handle, units, timeout,
acpi_format_exception(status)));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
"Acquired semaphore[%p|%d|%d]\n", handle,
units, timeout));
}
return_ACPI_STATUS(status);
}
EXPORT_SYMBOL(acpi_os_wait_semaphore);
EXPORT_SYMBOL(acpi_os_wait_semaphore);
/*
* TODO: Support for units > 1?
*/
acpi_status
acpi_os_signal_semaphore(
acpi_handle handle,
u32 units)
acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
{
struct semaphore *sem = (struct semaphore *)handle;
@@ -943,17 +908,18 @@ acpi_os_signal_semaphore(
if (units > 1)
return_ACPI_STATUS(AE_SUPPORT);
ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle, units));
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
units));
up(sem);
return_ACPI_STATUS(AE_OK);
}
EXPORT_SYMBOL(acpi_os_signal_semaphore);
#ifdef ACPI_FUTURE_USAGE
u32
acpi_os_get_line(char *buffer)
u32 acpi_os_get_line(char *buffer)
{
#ifdef ENABLE_DEBUGGER
@@ -973,19 +939,18 @@ acpi_os_get_line(char *buffer)
#endif /* ACPI_FUTURE_USAGE */
/* Assumes no unreadable holes inbetween */
u8
acpi_os_readable(void *ptr, acpi_size len)
u8 acpi_os_readable(void *ptr, acpi_size len)
{
#if defined(__i386__) || defined(__x86_64__)
char tmp;
return !__get_user(tmp, (char __user *)ptr) && !__get_user(tmp, (char __user *)ptr + len - 1);
return !__get_user(tmp, (char __user *)ptr)
&& !__get_user(tmp, (char __user *)ptr + len - 1);
#endif
return 1;
}
#ifdef ACPI_FUTURE_USAGE
u8
acpi_os_writable(void *ptr, acpi_size len)
u8 acpi_os_writable(void *ptr, acpi_size len)
{
/* could do dummy write (racy) or a kernel page table lookup.
The later may be difficult at early boot when kmap doesn't work yet. */
@@ -993,8 +958,7 @@ acpi_os_writable(void *ptr, acpi_size len)
}
#endif
u32
acpi_os_get_thread_id (void)
u32 acpi_os_get_thread_id(void)
{
if (!in_atomic())
return current->pid;
@@ -1002,13 +966,9 @@ acpi_os_get_thread_id (void)
return 0;
}
acpi_status
acpi_os_signal (
u32 function,
void *info)
{
switch (function)
acpi_status acpi_os_signal(u32 function, void *info)
{
switch (function) {
case ACPI_SIGNAL_FATAL:
printk(KERN_ERR PREFIX "Fatal opcode executed\n");
break;
@@ -1028,10 +988,10 @@ acpi_os_signal (
return AE_OK;
}
EXPORT_SYMBOL(acpi_os_signal);
static int __init
acpi_os_name_setup(char *str)
static int __init acpi_os_name_setup(char *str)
{
char *p = acpi_os_name;
int count = ACPI_MAX_OVERRIDE_LEN - 1;
@@ -1060,16 +1020,15 @@ __setup("acpi_os_name=", acpi_os_name_setup);
* empty string disables _OSI
* TBD additional string adds to _OSI
*/
static int __init
acpi_osi_setup(char *str)
static int __init acpi_osi_setup(char *str)
{
if (str == NULL || *str == '\0') {
printk(KERN_INFO PREFIX "_OSI method disabled\n");
acpi_gbl_create_osi_method = FALSE;
} else
{
} else {
/* TBD */
printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n", str);
printk(KERN_ERR PREFIX "_OSI additional string ignored -- %s\n",
str);
}
return 1;
@@ -1078,8 +1037,7 @@ acpi_osi_setup(char *str)
__setup("acpi_osi=", acpi_osi_setup);
/* enable serialization to combat AE_ALREADY_EXISTS errors */
static int __init
acpi_serialize_setup(char *str)
static int __init acpi_serialize_setup(char *str)
{
printk(KERN_INFO PREFIX "serialize enabled\n");
@@ -1099,8 +1057,7 @@ __setup("acpi_serialize", acpi_serialize_setup);
* Run-time events on the same GPE this flag is available
* to tell Linux to keep the wake-time GPEs enabled at run-time.
*/
static int __init
acpi_wake_gpes_always_on_setup(char *str)
static int __init acpi_wake_gpes_always_on_setup(char *str)
{
printk(KERN_INFO PREFIX "wake GPEs not disabled\n");
@@ -1111,8 +1068,7 @@ acpi_wake_gpes_always_on_setup(char *str)
__setup("acpi_wake_gpes_always_on", acpi_wake_gpes_always_on_setup);
int __init
acpi_hotkey_setup(char *str)
int __init acpi_hotkey_setup(char *str)
{
acpi_specific_hotkey_enabled = TRUE;
return 1;
@@ -1126,7 +1082,6 @@ __setup("acpi_specific_hotkey", acpi_hotkey_setup);
*/
unsigned int max_cstate = ACPI_PROCESSOR_MAX_POWER;
EXPORT_SYMBOL(max_cstate);
/*
@@ -1137,9 +1092,7 @@ EXPORT_SYMBOL(max_cstate);
* that indicates whether we are at interrupt level.
*/
unsigned long
acpi_os_acquire_lock (
acpi_handle handle)
unsigned long acpi_os_acquire_lock(acpi_handle handle)
{
unsigned long flags;
spin_lock_irqsave((spinlock_t *) handle, flags);
@@ -1150,15 +1103,11 @@ acpi_os_acquire_lock (
* Release a spinlock. See above.
*/
void
acpi_os_release_lock (
acpi_handle handle,
unsigned long flags)
void acpi_os_release_lock(acpi_handle handle, unsigned long flags)
{
spin_unlock_irqrestore((spinlock_t *) handle, flags);
}
#ifndef ACPI_USE_LOCAL_CACHE
/*******************************************************************************
@@ -1177,11 +1126,7 @@ acpi_os_release_lock (
******************************************************************************/
acpi_status
acpi_os_create_cache (
char *name,
u16 size,
u16 depth,
acpi_cache_t **cache)
acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache)
{
*cache = kmem_cache_create(name, size, 0, 0, NULL, NULL);
return AE_OK;
@@ -1199,9 +1144,7 @@ acpi_os_create_cache (
*
******************************************************************************/
acpi_status
acpi_os_purge_cache (
acpi_cache_t *cache)
acpi_status acpi_os_purge_cache(acpi_cache_t * cache)
{
(void)kmem_cache_shrink(cache);
return (AE_OK);
@@ -1220,9 +1163,7 @@ acpi_os_purge_cache (
*
******************************************************************************/
acpi_status
acpi_os_delete_cache (
acpi_cache_t *cache)
acpi_status acpi_os_delete_cache(acpi_cache_t * cache)
{
(void)kmem_cache_destroy(cache);
return (AE_OK);
@@ -1242,10 +1183,7 @@ acpi_os_delete_cache (
*
******************************************************************************/
acpi_status
acpi_os_release_object (
acpi_cache_t *cache,
void *object)
acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object)
{
kmem_cache_free(cache, object);
return (AE_OK);
@@ -1265,9 +1203,7 @@ acpi_os_release_object (
*
******************************************************************************/
void *
acpi_os_acquire_object (
acpi_cache_t *cache)
void *acpi_os_acquire_object(acpi_cache_t * cache)
{
void *object = kmem_cache_alloc(cache, GFP_KERNEL);
WARN_ON(!object);
@@ -1275,4 +1211,3 @@ acpi_os_acquire_object (
}
#endif

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -51,15 +50,11 @@
ACPI_MODULE_NAME("psargs")
/* Local prototypes */
static u32
acpi_ps_get_next_package_length (
struct acpi_parse_state *parser_state);
static union acpi_parse_object *
acpi_ps_get_next_field (
struct acpi_parse_state *parser_state);
acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
*parser_state);
/*******************************************************************************
*
@@ -75,26 +70,22 @@ acpi_ps_get_next_field (
******************************************************************************/
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;
u32 length = 0;
ACPI_FUNCTION_TRACE("ps_get_next_package_length");
encoded_length = (u32) ACPI_GET8(parser_state->aml);
parser_state->aml++;
switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */
case 0: /* 1-byte encoding (bits 0-5) */
length = (encoded_length & 0x3F);
break;
case 1: /* 2-byte encoding (next byte + bits 0-3) */
length = ((ACPI_GET8(parser_state->aml) << 04) |
@@ -102,7 +93,6 @@ acpi_ps_get_next_package_length (
parser_state->aml++;
break;
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
@@ -111,7 +101,6 @@ acpi_ps_get_next_package_length (
parser_state->aml += 2;
break;
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
length = ((ACPI_GET8(parser_state->aml + 2) << 20) |
@@ -130,7 +119,6 @@ acpi_ps_get_next_package_length (
return_VALUE(length);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_next_package_end
@@ -144,25 +132,21 @@ acpi_ps_get_next_package_length (
*
******************************************************************************/
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;
acpi_native_uint length;
ACPI_FUNCTION_TRACE("ps_get_next_package_end");
/* Function below changes parser_state->Aml */
length = (acpi_native_uint) acpi_ps_get_next_package_length (parser_state);
length =
(acpi_native_uint) acpi_ps_get_next_package_length(parser_state);
return_PTR(start + length); /* end of package */
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_next_namestring
@@ -178,17 +162,13 @@ acpi_ps_get_next_package_end (
*
******************************************************************************/
char *
acpi_ps_get_next_namestring (
struct acpi_parse_state *parser_state)
char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
{
u8 *start = parser_state->aml;
u8 *end = parser_state->aml;
ACPI_FUNCTION_TRACE("ps_get_next_namestring");
/* Handle multiple prefix characters */
while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
@@ -236,7 +216,6 @@ acpi_ps_get_next_namestring (
return_PTR((char *)start);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_next_namepath
@@ -259,11 +238,9 @@ acpi_ps_get_next_namestring (
******************************************************************************/
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,
union acpi_parse_object *arg,
u8 method_call)
union acpi_parse_object *arg, u8 method_call)
{
char *path;
union acpi_parse_object *name_op;
@@ -272,10 +249,8 @@ acpi_ps_get_next_namepath (
struct acpi_namespace_node *node;
union acpi_generic_state scope_info;
ACPI_FUNCTION_TRACE("ps_get_next_namepath");
path = acpi_ps_get_next_namestring(parser_state);
/* Null path case is allowed */
@@ -298,8 +273,8 @@ acpi_ps_get_next_namepath (
*/
status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY,
ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &node);
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 */
@@ -325,19 +300,20 @@ acpi_ps_get_next_namepath (
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));
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));
node,
method_desc->method.
param_count));
/* Get the number of arguments to expect */
walk_state->arg_count = method_desc->method.param_count;
walk_state->arg_count =
method_desc->method.param_count;
return_ACPI_STATUS(AE_OK);
}
@@ -354,19 +330,20 @@ acpi_ps_get_next_namepath (
* 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)) {
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);
acpi_os_printf
("search_node %p start_node %p return_node %p\n",
scope_info.scope.node,
parser_state->start_node, node);
}
else {
} else {
/*
* We got a NOT_FOUND during table load or we encountered
* a cond_ref_of(x) where the target does not exist.
@@ -387,7 +364,6 @@ acpi_ps_get_next_namepath (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_next_simple_arg
@@ -403,15 +379,12 @@ acpi_ps_get_next_namepath (
******************************************************************************/
void
acpi_ps_get_next_simple_arg (
struct acpi_parse_state *parser_state,
u32 arg_type,
union acpi_parse_object *arg)
acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
u32 arg_type, union acpi_parse_object *arg)
{
ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
switch (arg_type) {
case ARGP_BYTEDATA:
@@ -420,40 +393,39 @@ acpi_ps_get_next_simple_arg (
parser_state->aml++;
break;
case ARGP_WORDDATA:
acpi_ps_init_op(arg, AML_WORD_OP);
/* Get 2 bytes from the AML stream */
ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml);
ACPI_MOVE_16_TO_32(&arg->common.value.integer,
parser_state->aml);
parser_state->aml += 2;
break;
case ARGP_DWORDDATA:
acpi_ps_init_op(arg, AML_DWORD_OP);
/* Get 4 bytes from the AML stream */
ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml);
ACPI_MOVE_32_TO_32(&arg->common.value.integer,
parser_state->aml);
parser_state->aml += 4;
break;
case ARGP_QWORDDATA:
acpi_ps_init_op(arg, AML_QWORD_OP);
/* Get 8 bytes from the AML stream */
ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml);
ACPI_MOVE_64_TO_64(&arg->common.value.integer,
parser_state->aml);
parser_state->aml += 8;
break;
case ARGP_CHARLIST:
acpi_ps_init_op(arg, AML_STRING_OP);
@@ -465,15 +437,14 @@ acpi_ps_get_next_simple_arg (
parser_state->aml++;
break;
case ARGP_NAME:
case ARGP_NAMESTRING:
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
arg->common.value.name = acpi_ps_get_next_namestring (parser_state);
arg->common.value.name =
acpi_ps_get_next_namestring(parser_state);
break;
default:
ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type));
@@ -483,7 +454,6 @@ acpi_ps_get_next_simple_arg (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_next_field
@@ -496,9 +466,8 @@ acpi_ps_get_next_simple_arg (
*
******************************************************************************/
static union acpi_parse_object *
acpi_ps_get_next_field (
struct acpi_parse_state *parser_state)
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
*parser_state)
{
u32 aml_offset = (u32)
ACPI_PTR_DIFF(parser_state->aml,
@@ -507,10 +476,8 @@ acpi_ps_get_next_field (
u16 opcode;
u32 name;
ACPI_FUNCTION_TRACE("ps_get_next_field");
/* Determine field type */
switch (ACPI_GET8(parser_state->aml)) {
@@ -554,25 +521,26 @@ acpi_ps_get_next_field (
/* Get the length which is encoded as a package length */
field->common.value.size = acpi_ps_get_next_package_length (parser_state);
field->common.value.size =
acpi_ps_get_next_package_length(parser_state);
break;
case AML_INT_RESERVEDFIELD_OP:
/* Get the length which is encoded as a package length */
field->common.value.size = acpi_ps_get_next_package_length (parser_state);
field->common.value.size =
acpi_ps_get_next_package_length(parser_state);
break;
case AML_INT_ACCESSFIELD_OP:
/*
* Get access_type and access_attrib and merge into the field Op
* access_type is first operand, access_attribute is second
*/
field->common.value.integer = (ACPI_GET8 (parser_state->aml) << 8);
field->common.value.integer =
(ACPI_GET8(parser_state->aml) << 8);
parser_state->aml++;
field->common.value.integer |= ACPI_GET8(parser_state->aml);
parser_state->aml++;
@@ -587,7 +555,6 @@ acpi_ps_get_next_field (
return_PTR(field);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_next_arg
@@ -605,11 +572,9 @@ acpi_ps_get_next_field (
******************************************************************************/
acpi_status
acpi_ps_get_next_arg (
struct acpi_walk_state *walk_state,
acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
struct acpi_parse_state *parser_state,
u32 arg_type,
union acpi_parse_object **return_arg)
u32 arg_type, union acpi_parse_object **return_arg)
{
union acpi_parse_object *arg = NULL;
union acpi_parse_object *prev = NULL;
@@ -617,10 +582,8 @@ acpi_ps_get_next_arg (
u32 subop;
acpi_status status = AE_OK;
ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state);
switch (arg_type) {
case ARGP_BYTEDATA:
case ARGP_WORDDATA:
@@ -638,15 +601,14 @@ acpi_ps_get_next_arg (
acpi_ps_get_next_simple_arg(parser_state, arg_type, arg);
break;
case ARGP_PKGLENGTH:
/* Package length, nothing returned */
parser_state->pkg_end = acpi_ps_get_next_package_end (parser_state);
parser_state->pkg_end =
acpi_ps_get_next_package_end(parser_state);
break;
case ARGP_FIELDLIST:
if (parser_state->aml < parser_state->pkg_end) {
@@ -660,8 +622,7 @@ acpi_ps_get_next_arg (
if (prev) {
prev->common.next = field;
}
else {
} else {
arg = field;
}
prev = field;
@@ -673,7 +634,6 @@ acpi_ps_get_next_arg (
}
break;
case ARGP_BYTELIST:
if (parser_state->aml < parser_state->pkg_end) {
@@ -687,7 +647,8 @@ acpi_ps_get_next_arg (
/* Fill in bytelist data */
arg->common.value.size = (u32)
ACPI_PTR_DIFF (parser_state->pkg_end, parser_state->aml);
ACPI_PTR_DIFF(parser_state->pkg_end,
parser_state->aml);
arg->named.data = parser_state->aml;
/* Skip to End of byte data */
@@ -696,7 +657,6 @@ acpi_ps_get_next_arg (
}
break;
case ARGP_TARGET:
case ARGP_SUPERNAME:
case ARGP_SIMPLENAME:
@@ -712,16 +672,16 @@ acpi_ps_get_next_arg (
return_ACPI_STATUS(AE_NO_MEMORY);
}
status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
}
else {
status =
acpi_ps_get_next_namepath(walk_state, parser_state,
arg, 0);
} else {
/* Single complex argument, nothing returned */
walk_state->arg_count = 1;
}
break;
case ARGP_DATAOBJ:
case ARGP_TERMARG:
@@ -730,7 +690,6 @@ acpi_ps_get_next_arg (
walk_state->arg_count = 1;
break;
case ARGP_DATAOBJLIST:
case ARGP_TERMLIST:
case ARGP_OBJLIST:
@@ -742,7 +701,6 @@ acpi_ps_get_next_arg (
}
break;
default:
ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type));

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
/*
* Parse the AML and build an operation tree as most interpreters,
* like Perl, do. Parsing is done by hand rather than with a YACC
@@ -61,7 +60,6 @@
static u32 acpi_gbl_depth = 0;
/*******************************************************************************
*
* FUNCTION: acpi_ps_parse_loop
@@ -75,9 +73,7 @@ static u32 acpi_gbl_depth = 0;
*
******************************************************************************/
acpi_status
acpi_ps_parse_loop (
struct acpi_walk_state *walk_state)
acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
{
acpi_status status = AE_OK;
acpi_status status2;
@@ -87,7 +83,6 @@ acpi_ps_parse_loop (
struct acpi_parse_state *parser_state;
u8 *aml_op_start = NULL;
ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state);
if (walk_state->descending_callback == NULL) {
@@ -108,39 +103,50 @@ acpi_ps_parse_loop (
* was just completed
*/
if ((parser_state->scope->parse_scope.op) &&
((parser_state->scope->parse_scope.op->common.aml_opcode == AML_IF_OP) ||
(parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
(walk_state->control_state) &&
(walk_state->control_state->common.state ==
((parser_state->scope->parse_scope.op->common.
aml_opcode == AML_IF_OP)
|| (parser_state->scope->parse_scope.op->common.
aml_opcode == AML_WHILE_OP))
&& (walk_state->control_state)
&& (walk_state->control_state->common.state ==
ACPI_CONTROL_PREDICATE_EXECUTING)) {
/*
* A predicate was just completed, get the value of the
* predicate and branch based on that value
*/
walk_state->op = NULL;
status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
if (ACPI_FAILURE (status) &&
((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
status =
acpi_ds_get_predicate_value(walk_state,
ACPI_TO_POINTER
(TRUE));
if (ACPI_FAILURE(status)
&& ((status & AE_CODE_MASK) !=
AE_CODE_CONTROL)) {
if (status == AE_AML_NO_RETURN_VALUE) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invoked method did not return a value, %s\n",
acpi_format_exception (status)));
acpi_format_exception
(status)));
}
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"get_predicate Failed, %s\n",
acpi_format_exception (status)));
acpi_format_exception
(status)));
return_ACPI_STATUS(status);
}
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
acpi_ps_next_parse_state(walk_state, op,
status);
}
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
}
else if (walk_state->prev_op) {
&walk_state->arg_types,
&walk_state->arg_count);
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Popped scope, Op=%p\n", op));
} else if (walk_state->prev_op) {
/* We were in the middle of an op */
op = walk_state->prev_op;
@@ -156,7 +162,8 @@ acpi_ps_parse_loop (
if (!op) {
/* Get the next opcode from the AML stream */
walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
walk_state->aml_offset =
(u32) ACPI_PTR_DIFF(parser_state->aml,
parser_state->aml_start);
walk_state->opcode = acpi_ps_peek_opcode(parser_state);
@@ -166,7 +173,8 @@ acpi_ps_parse_loop (
* 2) A name string
* 3) An unknown/invalid opcode
*/
walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(walk_state->opcode);
switch (walk_state->op_info->class) {
case AML_CLASS_ASCII:
case AML_CLASS_PREFIX:
@@ -184,7 +192,9 @@ acpi_ps_parse_loop (
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Found unknown opcode %X at AML address %p offset %X, ignoring\n",
walk_state->opcode, parser_state->aml, walk_state->aml_offset));
walk_state->opcode,
parser_state->aml,
walk_state->aml_offset));
ACPI_DUMP_BUFFER(parser_state->aml, 128);
@@ -197,8 +207,10 @@ acpi_ps_parse_loop (
/* Found opcode info, this is a normal opcode */
parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
walk_state->arg_types = walk_state->op_info->parse_args;
parser_state->aml +=
acpi_ps_get_opcode_size(walk_state->opcode);
walk_state->arg_types =
walk_state->op_info->parse_args;
break;
}
@@ -208,7 +220,9 @@ acpi_ps_parse_loop (
/* Allocate a new pre_op if necessary */
if (!pre_op) {
pre_op = acpi_ps_alloc_op (walk_state->opcode);
pre_op =
acpi_ps_alloc_op(walk_state->
opcode);
if (!pre_op) {
status = AE_NO_MEMORY;
goto close_this_op;
@@ -222,23 +236,33 @@ acpi_ps_parse_loop (
* Get and append arguments until we find the node that contains
* the name (the type ARGP_NAME).
*/
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
(GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
status = acpi_ps_get_next_arg (walk_state, parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
while (GET_CURRENT_ARG_TYPE
(walk_state->arg_types)
&&
(GET_CURRENT_ARG_TYPE
(walk_state->arg_types) != ARGP_NAME)) {
status =
acpi_ps_get_next_arg(walk_state,
parser_state,
GET_CURRENT_ARG_TYPE
(walk_state->
arg_types),
&arg);
if (ACPI_FAILURE(status)) {
goto close_this_op;
}
acpi_ps_append_arg(pre_op, arg);
INCREMENT_ARG_LIST (walk_state->arg_types);
INCREMENT_ARG_LIST(walk_state->
arg_types);
}
/*
* Make sure that we found a NAME and didn't run out of
* arguments
*/
if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
if (!GET_CURRENT_ARG_TYPE
(walk_state->arg_types)) {
status = AE_AML_NO_OPERAND;
goto close_this_op;
}
@@ -253,11 +277,14 @@ acpi_ps_parse_loop (
*/
walk_state->op = NULL;
status = walk_state->descending_callback (walk_state, &op);
status =
walk_state->descending_callback(walk_state,
&op);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"During name lookup/catalog, %s\n",
acpi_format_exception (status)));
acpi_format_exception
(status)));
goto close_this_op;
}
@@ -265,7 +292,9 @@ acpi_ps_parse_loop (
continue;
}
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
acpi_ps_next_parse_state(walk_state, op,
status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
goto close_this_op;
@@ -275,7 +304,8 @@ acpi_ps_parse_loop (
goto close_this_op;
}
acpi_ps_append_arg (op, pre_op->common.value.arg);
acpi_ps_append_arg(op,
pre_op->common.value.arg);
acpi_gbl_depth++;
if (op->common.aml_opcode == AML_REGION_OP) {
@@ -294,11 +324,11 @@ acpi_ps_parse_loop (
op->named.data = aml_op_start;
op->named.length = 0;
}
}
else {
} else {
/* Not a named opcode, just allocate Op and append to parent */
walk_state->op_info = acpi_ps_get_opcode_info (walk_state->opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(walk_state->opcode);
op = acpi_ps_alloc_op(walk_state->opcode);
if (!op) {
status = AE_NO_MEMORY;
@@ -314,7 +344,8 @@ acpi_ps_parse_loop (
op->named.length = 0;
}
acpi_ps_append_arg (acpi_ps_get_parent_scope (parser_state), op);
acpi_ps_append_arg(acpi_ps_get_parent_scope
(parser_state), op);
if ((walk_state->descending_callback != NULL)) {
/*
@@ -323,8 +354,14 @@ acpi_ps_parse_loop (
*/
walk_state->op = op;
status = walk_state->descending_callback (walk_state, &op);
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
walk_state->
descending_callback(walk_state,
&op);
status =
acpi_ps_next_parse_state(walk_state,
op,
status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
goto close_this_op;
@@ -341,12 +378,13 @@ acpi_ps_parse_loop (
if (walk_state->op_info) {
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
(u32) op->common.aml_opcode, walk_state->op_info->name,
op, parser_state->aml, op->common.aml_offset));
(u32) op->common.aml_opcode,
walk_state->op_info->name, op,
parser_state->aml,
op->common.aml_offset));
}
}
/*
* Start arg_count at zero because we don't know if there are
* any args yet
@@ -368,12 +406,17 @@ acpi_ps_parse_loop (
/* Fill in constant or string argument directly */
acpi_ps_get_next_simple_arg(parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types), op);
GET_CURRENT_ARG_TYPE
(walk_state->
arg_types), op);
break;
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
status =
acpi_ps_get_next_namepath(walk_state,
parser_state, op,
1);
if (ACPI_FAILURE(status)) {
goto close_this_op;
}
@@ -386,34 +429,46 @@ acpi_ps_parse_loop (
* Op is not a constant or string, append each argument
* to the Op
*/
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
!walk_state->arg_count) {
while (GET_CURRENT_ARG_TYPE
(walk_state->arg_types)
&& !walk_state->arg_count) {
walk_state->aml_offset = (u32)
ACPI_PTR_DIFF (parser_state->aml, parser_state->aml_start);
ACPI_PTR_DIFF(parser_state->aml,
parser_state->
aml_start);
status = acpi_ps_get_next_arg (walk_state, parser_state,
GET_CURRENT_ARG_TYPE (walk_state->arg_types),
status =
acpi_ps_get_next_arg(walk_state,
parser_state,
GET_CURRENT_ARG_TYPE
(walk_state->
arg_types),
&arg);
if (ACPI_FAILURE(status)) {
goto close_this_op;
}
if (arg) {
arg->common.aml_offset = walk_state->aml_offset;
arg->common.aml_offset =
walk_state->aml_offset;
acpi_ps_append_arg(op, arg);
}
INCREMENT_ARG_LIST (walk_state->arg_types);
INCREMENT_ARG_LIST(walk_state->
arg_types);
}
/* Special processing for certain opcodes */
/* TBD (remove): Temporary mechanism to disable this code if needed */
#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
if ((walk_state->pass_number <=
ACPI_IMODE_LOAD_PASS1)
&&
((walk_state->
parse_flags & ACPI_PARSE_DISASSEMBLE) ==
0)) {
/*
* We want to skip If/Else/While constructs during Pass1
* because we want to actually conditionally execute the
@@ -432,7 +487,8 @@ acpi_ps_parse_loop (
/* Skip body of if/else/while in pass 1 */
parser_state->aml = parser_state->pkg_end;
parser_state->aml =
parser_state->pkg_end;
walk_state->arg_count = 0;
break;
@@ -452,12 +508,14 @@ acpi_ps_parse_loop (
* Save the length and address of the body
*/
op->named.data = parser_state->aml;
op->named.length = (u32) (parser_state->pkg_end -
op->named.length =
(u32) (parser_state->pkg_end -
parser_state->aml);
/* Skip body of method */
parser_state->aml = parser_state->pkg_end;
parser_state->aml =
parser_state->pkg_end;
walk_state->arg_count = 0;
break;
@@ -466,20 +524,25 @@ acpi_ps_parse_loop (
case AML_VAR_PACKAGE_OP:
if ((op->common.parent) &&
(op->common.parent->common.aml_opcode == AML_NAME_OP) &&
(walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
(op->common.parent->common.
aml_opcode == AML_NAME_OP)
&& (walk_state->pass_number <=
ACPI_IMODE_LOAD_PASS2)) {
/*
* Skip parsing of Buffers and Packages
* because we don't have enough info in the first pass
* to parse them correctly.
*/
op->named.data = aml_op_start;
op->named.length = (u32) (parser_state->pkg_end -
op->named.length =
(u32) (parser_state->
pkg_end -
aml_op_start);
/* Skip body */
parser_state->aml = parser_state->pkg_end;
parser_state->aml =
parser_state->pkg_end;
walk_state->arg_count = 0;
}
break;
@@ -487,7 +550,8 @@ acpi_ps_parse_loop (
case AML_WHILE_OP:
if (walk_state->control_state) {
walk_state->control_state->control.package_end =
walk_state->control_state->
control.package_end =
parser_state->pkg_end;
}
break;
@@ -509,7 +573,8 @@ acpi_ps_parse_loop (
* prepare for argument
*/
status = acpi_ps_push_scope(parser_state, op,
walk_state->arg_types, walk_state->arg_count);
walk_state->arg_types,
walk_state->arg_count);
if (ACPI_FAILURE(status)) {
goto close_this_op;
}
@@ -521,7 +586,8 @@ acpi_ps_parse_loop (
* All arguments have been processed -- Op is complete,
* prepare for next
*/
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(op->common.aml_opcode);
if (walk_state->op_info->flags & AML_NAMED) {
if (acpi_gbl_depth) {
acpi_gbl_depth--;
@@ -536,7 +602,8 @@ acpi_ps_parse_loop (
* Completed parsing an op_region declaration, we now
* know the length.
*/
op->named.length = (u32) (parser_state->aml - op->named.data);
op->named.length =
(u32) (parser_state->aml - op->named.data);
}
}
@@ -547,7 +614,8 @@ acpi_ps_parse_loop (
*
* body_length is unknown until we parse the body
*/
op->named.length = (u32) (parser_state->aml - op->named.data);
op->named.length =
(u32) (parser_state->aml - op->named.data);
}
/* This op complete, notify the dispatcher */
@@ -557,14 +625,14 @@ acpi_ps_parse_loop (
walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback(walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
acpi_ps_next_parse_state(walk_state, op, status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
goto close_this_op;
}
}
close_this_op:
/*
* Finished one argument of the containing scope
@@ -590,7 +658,6 @@ close_this_op:
case AE_OK:
break;
case AE_CTRL_TRANSFER:
/* We are about to transfer to a called method. */
@@ -599,21 +666,27 @@ close_this_op:
walk_state->prev_arg_types = walk_state->arg_types;
return_ACPI_STATUS(status);
case AE_CTRL_END:
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
&walk_state->arg_types,
&walk_state->arg_count);
if (op) {
walk_state->op = op;
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(op->common.
aml_opcode);
walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
walk_state->ascending_callback(walk_state);
status =
acpi_ps_next_parse_state(walk_state, op,
status);
status2 = acpi_ps_complete_this_op (walk_state, op);
status2 =
acpi_ps_complete_this_op(walk_state, op);
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
@@ -622,7 +695,6 @@ close_this_op:
status = AE_OK;
break;
case AE_CTRL_BREAK:
case AE_CTRL_CONTINUE:
@@ -630,17 +702,20 @@ close_this_op:
while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
&walk_state->arg_types,
&walk_state->arg_count);
}
/* Close this iteration of the While loop */
walk_state->op = op;
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(op->common.aml_opcode);
walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback(walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
acpi_ps_next_parse_state(walk_state, op, status);
status2 = acpi_ps_complete_this_op(walk_state, op);
if (ACPI_FAILURE(status2)) {
@@ -651,7 +726,6 @@ close_this_op:
status = AE_OK;
break;
case AE_CTRL_TERMINATE:
status = AE_OK;
@@ -659,41 +733,46 @@ close_this_op:
/* Clean up */
do {
if (op) {
status2 = acpi_ps_complete_this_op (walk_state, op);
status2 =
acpi_ps_complete_this_op(walk_state,
op);
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
}
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
&walk_state->arg_types,
&walk_state->arg_count);
} while (op);
return_ACPI_STATUS(status);
default: /* All other non-AE_OK status */
do {
if (op) {
status2 = acpi_ps_complete_this_op (walk_state, op);
status2 =
acpi_ps_complete_this_op(walk_state,
op);
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
}
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
&walk_state->arg_types,
&walk_state->arg_count);
} while (op);
/*
* TBD: Cleanup parse ops on error
*/
#if 0
if (op == NULL) {
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
&walk_state->arg_types,
&walk_state->arg_count);
}
#endif
walk_state->prev_op = op;
@@ -705,32 +784,38 @@ close_this_op:
if (acpi_ps_has_completed_scope(parser_state)) {
acpi_ps_pop_scope(parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
}
else {
&walk_state->arg_types,
&walk_state->arg_count);
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Popped scope, Op=%p\n", op));
} else {
op = NULL;
}
} /* while parser_state->Aml */
/*
* Complete the last Op (if not completed), and clear the scope stack.
* It is easily possible to end an AML "package" with an unbounded number
* of open scopes (such as when several ASL blocks are closed with
* sequential closing braces). We want to terminate each one cleanly.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", op));
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "AML package complete at Op %p\n",
op));
do {
if (op) {
if (walk_state->ascending_callback != NULL) {
walk_state->op = op;
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
walk_state->op_info =
acpi_ps_get_opcode_info(op->common.
aml_opcode);
walk_state->opcode = op->common.aml_opcode;
status = walk_state->ascending_callback (walk_state);
status = acpi_ps_next_parse_state (walk_state, op, status);
status =
walk_state->ascending_callback(walk_state);
status =
acpi_ps_next_parse_state(walk_state, op,
status);
if (status == AE_CTRL_PENDING) {
status = AE_OK;
goto close_this_op;
@@ -742,14 +827,22 @@ close_this_op:
/* Clean up */
do {
if (op) {
status2 = acpi_ps_complete_this_op (walk_state, op);
if (ACPI_FAILURE (status2)) {
return_ACPI_STATUS (status2);
status2 =
acpi_ps_complete_this_op
(walk_state, op);
if (ACPI_FAILURE
(status2)) {
return_ACPI_STATUS
(status2);
}
}
acpi_ps_pop_scope (parser_state, &op,
&walk_state->arg_types, &walk_state->arg_count);
acpi_ps_pop_scope(parser_state,
&op,
&walk_state->
arg_types,
&walk_state->
arg_count);
} while (op);
@@ -759,7 +852,9 @@ close_this_op:
else if (ACPI_FAILURE(status)) {
/* First error is most important */
(void) acpi_ps_complete_this_op (walk_state, op);
(void)
acpi_ps_complete_this_op(walk_state,
op);
return_ACPI_STATUS(status);
}
}
@@ -777,5 +872,3 @@ close_this_op:
return_ACPI_STATUS(status);
}

View File

@@ -41,17 +41,14 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acopcode.h>
#include <acpi/amlcode.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psopcode")
/*******************************************************************************
*
* NAME: acpi_gbl_aml_op_info
@@ -62,7 +59,6 @@
* the operand type.
*
******************************************************************************/
/*
* Summary of opcode types/flags
*
@@ -180,156 +176,468 @@
AML_CREATE_QWORD_FIELD_OP
******************************************************************************/
/*
* Master Opcode information table. A summary of everything we know about each
* opcode, all in one place.
*/
const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
{
const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
/*! [Begin] no source code translation */
/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
/* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER,
AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER,
AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP,
ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_SIMPLE,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY,
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP,
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, AML_CONSTANT),
/* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP,
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, AML_CONSTANT),
/* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP,
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, AML_CONSTANT),
/* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP,
ACPI_TYPE_STRING, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, AML_CONSTANT),
/* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_NO_OBJ,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP,
ACPI_TYPE_BUFFER, AML_CLASS_CREATE,
AML_TYPE_CREATE_OBJECT,
AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP,
ACPI_TYPE_PACKAGE, AML_CLASS_CREATE,
AML_TYPE_CREATE_OBJECT,
AML_HAS_ARGS | AML_DEFER | AML_CONSTANT),
/* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP,
ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_COMPLEX,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED | AML_DEFER),
/* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LOCAL_VARIABLE, 0),
/* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_METHOD_ARGUMENT, 0),
/* 1B */ ACPI_OP("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R),
/* 1C */ ACPI_OP("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
AML_FLAGS_EXEC_1A_0T_1R),
/* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_1R,
AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_1R,
AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_2T_1R,
AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT),
/* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 26 */ ACPI_OP("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 28 */ ACPI_OP("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 29 */ ACPI_OP("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 2A */ ACPI_OP("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT),
/* 2B */ ACPI_OP("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP,
ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,
ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
/* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_1R,
AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* 31 */ ACPI_OP("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R),
/* 32 */ ACPI_OP("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R,
AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
/* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,
ARGI_CREATE_DWORD_FIELD_OP,
ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
AML_TYPE_CREATE_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_CREATE),
/* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP,
ARGI_CREATE_WORD_FIELD_OP,
ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
AML_TYPE_CREATE_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_CREATE),
/* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP,
ARGI_CREATE_BYTE_FIELD_OP,
ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
AML_TYPE_CREATE_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_CREATE),
/* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP,
ARGI_CREATE_BIT_FIELD_OP,
ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
AML_TYPE_CREATE_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_CREATE),
/* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_1R,
AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* 38 */ ACPI_OP("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
AML_CONSTANT),
/* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC |
AML_CONSTANT),
/* 3A */ ACPI_OP("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R,
AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
/* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_0T_1R,
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_0T_1R,
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3D */ ACPI_OP("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT),
/* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY,
AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 3F */ ACPI_OP("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY,
AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 40 */ ACPI_OP("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY,
AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 41 */ ACPI_OP("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY,
AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP,
ACPI_TYPE_ANY, AML_CLASS_CONTROL,
AML_TYPE_CONTROL, AML_HAS_ARGS),
/* 43 */ ACPI_OP("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY,
AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP,
ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 45 */ ACPI_OP("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER,
AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
/* Prefixed opcodes (Two-byte opcodes with a prefix op) */
/* 46 */ ACPI_OP ("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_FIELD | AML_CREATE),
/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, AML_FLAGS_EXEC_1A_1T_0R),
/* 4B */ ACPI_OP ("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
/* 4E */ ACPI_OP ("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
/* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
/* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R),
/* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER),
/* 59 */ ACPI_OP ("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 5A */ ACPI_OP ("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP, ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5B */ ACPI_OP ("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP, ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5C */ ACPI_OP ("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP, ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5D */ ACPI_OP ("ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 5E */ ACPI_OP ("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 5F */ ACPI_OP ("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD),
/* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX,
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT,
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP,
ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,
AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_FIELD | AML_CREATE),
/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R,
AML_FLAGS_EXEC_1A_1T_0R),
/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
AML_FLAGS_EXEC_1A_0T_0R),
/* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
AML_FLAGS_EXEC_1A_0T_0R),
/* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),
/* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 4F */ ACPI_OP("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R,
AML_FLAGS_EXEC_2A_0T_1R),
/* 50 */ ACPI_OP("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
AML_FLAGS_EXEC_1A_0T_0R),
/* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 53 */ ACPI_OP("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP,
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
AML_TYPE_CONSTANT, 0),
/* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_CONSTANT, 0),
/* 57 */ ACPI_OP("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R,
AML_FLAGS_EXEC_3A_0T_0R),
/* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP,
ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_COMPLEX,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED | AML_DEFER),
/* 59 */ ACPI_OP("Field", ARGP_FIELD_OP, ARGI_FIELD_OP, ACPI_TYPE_ANY,
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_FIELD),
/* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
ACPI_TYPE_DEVICE, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_NO_OBJ,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP,
ACPI_TYPE_PROCESSOR, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_SIMPLE,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP,
ACPI_TYPE_POWER, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_SIMPLE,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP,
ARGI_THERMAL_ZONE_OP, ACPI_TYPE_THERMAL,
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_FIELD),
/* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_FIELD),
/* Internal opcodes that map to invalid AML opcodes */
/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 63 */ ACPI_OP ("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ),
/* 64 */ ACPI_OP ("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
/* 65 */ ACPI_OP ("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
/* 66 */ ACPI_OP ("-ReservedField-", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 67 */ ACPI_OP ("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
/* 68 */ ACPI_OP ("-AccessField-", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 69 */ ACPI_OP ("-StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 6A */ ACPI_OP ("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN, AML_HAS_ARGS | AML_HAS_RETVAL),
/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP,
ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP,
ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
/* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP,
ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY,
AML_CLASS_INTERNAL, AML_TYPE_BOGUS,
AML_HAS_ARGS | AML_CONSTANT),
/* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP,
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE),
/* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP,
ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL,
AML_TYPE_METHOD_CALL,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE),
/* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP,
ACPI_TYPE_ANY, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, 0),
/* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP,
ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY,
AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP,
ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
AML_TYPE_BOGUS,
AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP,
ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY,
AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP,
ARGI_STATICSTRING_OP, ACPI_TYPE_ANY,
AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
/* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
AML_CLASS_RETURN_VALUE, AML_TYPE_RETURN,
AML_HAS_ARGS | AML_HAS_RETVAL),
/* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID,
AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
/* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
/* 7D */ ACPI_OP ("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE),
/* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP,
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
AML_TYPE_LITERAL, AML_CONSTANT),
/* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP,
ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE,
AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT,
AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,
ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,
ARGI_CREATE_QWORD_FIELD_OP,
ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE,
AML_TYPE_CREATE_FIELD,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_CREATE),
/* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP,
ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_2A_1T_1R,
AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R,
AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT),
/* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP,
ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
/* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP,
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R),
/* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP,
ARGI_DATA_REGION_OP, ACPI_TYPE_REGION,
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE | AML_NAMED),
/* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT,
AML_TYPE_NAMED_NO_OBJ,
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
AML_NSNODE),
/* ACPI 3.0 opcodes */
/* 7E */ ACPI_OP ("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R)
/* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R,
AML_FLAGS_EXEC_0A_0T_1R)
/*! [End] no source code translation !*/
};
@@ -338,8 +646,7 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
* This table is directly indexed by the opcodes, and returns an
* index into the table above
*/
static const u8 acpi_gbl_short_op_index[256] =
{
static const u8 acpi_gbl_short_op_index[256] = {
/* 0 1 2 3 4 5 6 7 */
/* 8 9 A B C D E F */
/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
@@ -380,8 +687,7 @@ static const u8 acpi_gbl_short_op_index[256] =
* This table is indexed by the second opcode of the extended opcode
* pair. It returns an index into the opcode table (acpi_gbl_aml_op_info)
*/
static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
{
static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
/* 0 1 2 3 4 5 6 7 */
/* 8 9 A B C D E F */
/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
@@ -404,7 +710,6 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
/* 0x88 */ 0x7C,
};
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_opcode_info
@@ -418,27 +723,26 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
*
******************************************************************************/
const struct acpi_opcode_info *
acpi_ps_get_opcode_info (
u16 opcode)
const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
{
ACPI_FUNCTION_NAME("ps_get_opcode_info");
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
if (!(opcode & 0xFF00)) {
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&acpi_gbl_aml_op_info [acpi_gbl_short_op_index [(u8) opcode]]);
return (&acpi_gbl_aml_op_info
[acpi_gbl_short_op_index[(u8) opcode]]);
}
if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
(((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
/* Valid extended (16-bit) opcode */
return (&acpi_gbl_aml_op_info [acpi_gbl_long_op_index [(u8) opcode]]);
return (&acpi_gbl_aml_op_info
[acpi_gbl_long_op_index[(u8) opcode]]);
}
/* Unknown AML opcode */
@@ -449,7 +753,6 @@ acpi_ps_get_opcode_info (
return (&acpi_gbl_aml_op_info[_UNK]);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_opcode_name
@@ -463,15 +766,12 @@ acpi_ps_get_opcode_info (
*
******************************************************************************/
char *
acpi_ps_get_opcode_name (
u16 opcode)
char *acpi_ps_get_opcode_name(u16 opcode)
{
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
const struct acpi_opcode_info *op;
op = acpi_ps_get_opcode_info(opcode);
/* Always guaranteed to return a valid pointer */
@@ -483,4 +783,3 @@ acpi_ps_get_opcode_name (
#endif
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
/*
* Parse the AML and build an operation tree as most interpreters,
* like Perl, do. Parsing is done by hand rather than with a YACC
@@ -61,7 +60,6 @@
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psparse")
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_opcode_size
@@ -73,10 +71,7 @@
* DESCRIPTION: Get the size of the current opcode.
*
******************************************************************************/
u32
acpi_ps_get_opcode_size (
u32 opcode)
u32 acpi_ps_get_opcode_size(u32 opcode)
{
/* Extended (2-byte) opcode if > 255 */
@@ -90,7 +85,6 @@ acpi_ps_get_opcode_size (
return (1);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_peek_opcode
@@ -103,14 +97,11 @@ acpi_ps_get_opcode_size (
*
******************************************************************************/
u16
acpi_ps_peek_opcode (
struct acpi_parse_state *parser_state)
u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
{
u8 *aml;
u16 opcode;
aml = parser_state->aml;
opcode = (u16) ACPI_GET8(aml);
@@ -124,7 +115,6 @@ acpi_ps_peek_opcode (
return (opcode);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_complete_this_op
@@ -139,8 +129,7 @@ acpi_ps_peek_opcode (
******************************************************************************/
acpi_status
acpi_ps_complete_this_op (
struct acpi_walk_state *walk_state,
acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
union acpi_parse_object * op)
{
union acpi_parse_object *prev;
@@ -148,10 +137,8 @@ acpi_ps_complete_this_op (
const struct acpi_opcode_info *parent_info;
union acpi_parse_object *replacement_op = NULL;
ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op);
/* Check for null Op, can happen if AML code is corrupt */
if (!op) {
@@ -160,8 +147,9 @@ acpi_ps_complete_this_op (
/* Delete this op and the subtree below it if asked to */
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
(walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) !=
ACPI_PARSE_DELETE_TREE)
|| (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
return_ACPI_STATUS(AE_OK);
}
@@ -179,7 +167,9 @@ acpi_ps_complete_this_op (
* Check if we need to replace the operator and its subtree
* with a return value op (placeholder op)
*/
parent_info = acpi_ps_get_opcode_info (op->common.parent->common.aml_opcode);
parent_info =
acpi_ps_get_opcode_info(op->common.parent->common.
aml_opcode);
switch (parent_info->class) {
case AML_CLASS_CONTROL:
@@ -191,7 +181,8 @@ acpi_ps_complete_this_op (
* These opcodes contain term_arg operands. The current
* op must be replaced by a placeholder return op
*/
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
replacement_op =
acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
goto allocate_error;
}
@@ -203,35 +194,49 @@ acpi_ps_complete_this_op (
* These opcodes contain term_arg operands. The current
* op must be replaced by a placeholder return op
*/
if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
(op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
(op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
(op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
(op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
if ((op->common.parent->common.aml_opcode ==
AML_REGION_OP)
|| (op->common.parent->common.aml_opcode ==
AML_DATA_REGION_OP)
|| (op->common.parent->common.aml_opcode ==
AML_BUFFER_OP)
|| (op->common.parent->common.aml_opcode ==
AML_PACKAGE_OP)
|| (op->common.parent->common.aml_opcode ==
AML_VAR_PACKAGE_OP)) {
replacement_op =
acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
goto allocate_error;
}
}
else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
(walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
if ((op->common.aml_opcode == AML_BUFFER_OP) ||
(op->common.aml_opcode == AML_PACKAGE_OP) ||
(op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
} else
if ((op->common.parent->common.aml_opcode ==
AML_NAME_OP)
&& (walk_state->pass_number <=
ACPI_IMODE_LOAD_PASS2)) {
if ((op->common.aml_opcode == AML_BUFFER_OP)
|| (op->common.aml_opcode == AML_PACKAGE_OP)
|| (op->common.aml_opcode ==
AML_VAR_PACKAGE_OP)) {
replacement_op =
acpi_ps_alloc_op(op->common.
aml_opcode);
if (!replacement_op) {
goto allocate_error;
}
replacement_op->named.data = op->named.data;
replacement_op->named.length = op->named.length;
replacement_op->named.data =
op->named.data;
replacement_op->named.length =
op->named.length;
}
}
break;
default:
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
replacement_op =
acpi_ps_alloc_op(AML_INT_RETURN_VALUE_OP);
if (!replacement_op) {
goto allocate_error;
}
@@ -243,34 +248,42 @@ acpi_ps_complete_this_op (
/* This op is the first in the list */
if (replacement_op) {
replacement_op->common.parent = op->common.parent;
replacement_op->common.parent =
op->common.parent;
replacement_op->common.value.arg = NULL;
replacement_op->common.node = op->common.node;
op->common.parent->common.value.arg = replacement_op;
op->common.parent->common.value.arg =
replacement_op;
replacement_op->common.next = op->common.next;
}
else {
op->common.parent->common.value.arg = op->common.next;
} else {
op->common.parent->common.value.arg =
op->common.next;
}
}
/* Search the parent list */
else while (prev) {
else
while (prev) {
/* Traverse all siblings in the parent's argument list */
next = prev->common.next;
if (next == op) {
if (replacement_op) {
replacement_op->common.parent = op->common.parent;
replacement_op->common.value.arg = NULL;
replacement_op->common.node = op->common.node;
prev->common.next = replacement_op;
replacement_op->common.next = op->common.next;
replacement_op->common.parent =
op->common.parent;
replacement_op->common.value.
arg = NULL;
replacement_op->common.node =
op->common.node;
prev->common.next =
replacement_op;
replacement_op->common.next =
op->common.next;
next = NULL;
}
else {
prev->common.next = op->common.next;
} else {
prev->common.next =
op->common.next;
next = NULL;
}
}
@@ -278,7 +291,6 @@ acpi_ps_complete_this_op (
}
}
cleanup:
/* Now we can actually delete the subtree rooted at Op */
@@ -286,7 +298,6 @@ cleanup:
acpi_ps_delete_parse_tree(op);
return_ACPI_STATUS(AE_OK);
allocate_error:
/* Always delete the subtree, even on error */
@@ -295,7 +306,6 @@ allocate_error:
return_ACPI_STATUS(AE_NO_MEMORY);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_next_parse_state
@@ -312,18 +322,15 @@ allocate_error:
******************************************************************************/
acpi_status
acpi_ps_next_parse_state (
struct acpi_walk_state *walk_state,
acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
acpi_status callback_status)
{
struct acpi_parse_state *parser_state = &walk_state->parser_state;
acpi_status status = AE_CTRL_PENDING;
ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op);
switch (callback_status) {
case AE_CTRL_TERMINATE:
@@ -335,7 +342,6 @@ acpi_ps_next_parse_state (
status = AE_CTRL_TERMINATE;
break;
case AE_CTRL_BREAK:
parser_state->aml = walk_state->aml_last_while;
@@ -345,7 +351,6 @@ acpi_ps_next_parse_state (
case AE_CTRL_CONTINUE:
parser_state->aml = walk_state->aml_last_while;
status = AE_CTRL_CONTINUE;
break;
@@ -372,7 +377,6 @@ acpi_ps_next_parse_state (
parser_state->aml = acpi_ps_get_next_package_end(parser_state);
break;
case AE_CTRL_FALSE:
/*
@@ -390,7 +394,6 @@ acpi_ps_next_parse_state (
status = AE_CTRL_END;
break;
case AE_CTRL_TRANSFER:
/* A method call (invocation) -- transfer control */
@@ -398,14 +401,15 @@ acpi_ps_next_parse_state (
status = AE_CTRL_TRANSFER;
walk_state->prev_op = op;
walk_state->method_call_op = op;
walk_state->method_call_node = (op->common.value.arg)->common.node;
walk_state->method_call_node =
(op->common.value.arg)->common.node;
/* Will return value (if any) be used by the caller? */
walk_state->return_used = acpi_ds_is_result_used (op, walk_state);
walk_state->return_used =
acpi_ds_is_result_used(op, walk_state);
break;
default:
status = callback_status;
@@ -418,7 +422,6 @@ acpi_ps_next_parse_state (
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_parse_aml
@@ -432,9 +435,7 @@ acpi_ps_next_parse_state (
*
******************************************************************************/
acpi_status
acpi_ps_parse_aml (
struct acpi_walk_state *walk_state)
acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
{
acpi_status status;
acpi_status terminate_status;
@@ -442,7 +443,6 @@ acpi_ps_parse_aml (
struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
struct acpi_walk_state *previous_walk_state;
ACPI_FUNCTION_TRACE("ps_parse_aml");
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
@@ -450,7 +450,6 @@ acpi_ps_parse_aml (
walk_state, walk_state->parser_state.aml,
walk_state->parser_state.aml_size));
/* Create and initialize a new thread state */
thread = acpi_ut_create_thread_state();
@@ -492,7 +491,9 @@ acpi_ps_parse_aml (
* A method call was detected.
* Transfer control to the called control method
*/
status = acpi_ds_call_control_method (thread, walk_state, NULL);
status =
acpi_ds_call_control_method(thread, walk_state,
NULL);
/*
* If the transfer to the new method method call worked, a new walk
@@ -500,13 +501,12 @@ acpi_ps_parse_aml (
*/
walk_state = acpi_ds_get_current_walk_state(thread);
continue;
}
else if (status == AE_CTRL_TERMINATE) {
} else if (status == AE_CTRL_TERMINATE) {
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",
walk_state->method_node, NULL, status);
walk_state->method_node, NULL,
status);
/* Check for possible multi-thread reentrancy problem */
@@ -518,7 +518,8 @@ acpi_ps_parse_aml (
* We will workaround this by marking the method permanently
* as Serialized.
*/
walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
walk_state->method_desc->method.method_flags |=
AML_METHOD_SERIALIZED;
walk_state->method_desc->method.concurrency = 1;
}
}
@@ -543,11 +544,12 @@ acpi_ps_parse_aml (
* If we just returned from the execution of a control method,
* there's lots of cleanup to do
*/
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
terminate_status = acpi_ds_terminate_control_method (walk_state);
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE) {
terminate_status =
acpi_ds_terminate_control_method(walk_state);
if (ACPI_FAILURE(terminate_status)) {
ACPI_REPORT_ERROR ((
"Could not terminate control method properly\n"));
ACPI_REPORT_ERROR(("Could not terminate control method properly\n"));
/* Ignore error and continue */
}
@@ -561,7 +563,8 @@ acpi_ps_parse_aml (
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"return_value=%p, implicit_value=%p State=%p\n",
walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
walk_state->return_desc,
walk_state->implicit_return_obj, walk_state));
/* Check if we have restarted a preempted walk */
@@ -574,27 +577,33 @@ acpi_ps_parse_aml (
* The object is deleted
*/
if (!previous_walk_state->return_desc) {
status = acpi_ds_restart_control_method (walk_state,
previous_walk_state->implicit_return_obj);
}
else {
status =
acpi_ds_restart_control_method
(walk_state,
previous_walk_state->
implicit_return_obj);
} else {
/*
* We have a valid return value, delete any implicit
* return value.
*/
acpi_ds_clear_implicit_return (previous_walk_state);
acpi_ds_clear_implicit_return
(previous_walk_state);
status = acpi_ds_restart_control_method (walk_state,
status =
acpi_ds_restart_control_method
(walk_state,
previous_walk_state->return_desc);
}
if (ACPI_SUCCESS(status)) {
walk_state->walk_type |= ACPI_WALK_METHOD_RESTART;
walk_state->walk_type |=
ACPI_WALK_METHOD_RESTART;
}
}
else {
} else {
/* On error, delete any return object */
acpi_ut_remove_reference (previous_walk_state->return_desc);
acpi_ut_remove_reference(previous_walk_state->
return_desc);
}
}
@@ -606,24 +615,24 @@ acpi_ps_parse_aml (
if (previous_walk_state->implicit_return_obj) {
*(previous_walk_state->caller_return_desc) =
previous_walk_state->implicit_return_obj;
}
else {
} else {
/* NULL if no return value */
*(previous_walk_state->caller_return_desc) =
previous_walk_state->return_desc;
}
}
else {
} else {
if (previous_walk_state->return_desc) {
/* Caller doesn't want it, must delete it */
acpi_ut_remove_reference (previous_walk_state->return_desc);
acpi_ut_remove_reference(previous_walk_state->
return_desc);
}
if (previous_walk_state->implicit_return_obj) {
/* Caller doesn't want it, must delete it */
acpi_ut_remove_reference (previous_walk_state->implicit_return_obj);
acpi_ut_remove_reference(previous_walk_state->
implicit_return_obj);
}
}
@@ -633,9 +642,8 @@ acpi_ps_parse_aml (
/* Normal exit */
acpi_ex_release_all_mutexes(thread);
acpi_ut_delete_generic_state (ACPI_CAST_PTR (union acpi_generic_state, thread));
acpi_ut_delete_generic_state(ACPI_CAST_PTR
(union acpi_generic_state, thread));
acpi_gbl_current_walk_list = prev_walk_list;
return_ACPI_STATUS(status);
}

View File

@@ -41,14 +41,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psscope")
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_parent_scope
@@ -60,16 +58,13 @@
* DESCRIPTION: Get parent of current op being parsed
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_get_parent_scope (
struct acpi_parse_state *parser_state)
union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
*parser_state)
{
return (parser_state->scope->parse_scope.op);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_has_completed_scope
@@ -84,17 +79,14 @@ acpi_ps_get_parent_scope (
*
******************************************************************************/
u8
acpi_ps_has_completed_scope (
struct acpi_parse_state *parser_state)
u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state)
{
return ((u8)
((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
!parser_state->scope->parse_scope.arg_count)));
((parser_state->aml >= parser_state->scope->parse_scope.arg_end
|| !parser_state->scope->parse_scope.arg_count)));
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_init_scope
@@ -109,16 +101,13 @@ acpi_ps_has_completed_scope (
******************************************************************************/
acpi_status
acpi_ps_init_scope (
struct acpi_parse_state *parser_state,
acpi_ps_init_scope(struct acpi_parse_state * parser_state,
union acpi_parse_object * root_op)
{
union acpi_generic_state *scope;
ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op);
scope = acpi_ut_create_generic_state();
if (!scope) {
return_ACPI_STATUS(AE_NO_MEMORY);
@@ -136,7 +125,6 @@ acpi_ps_init_scope (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_push_scope
@@ -153,18 +141,14 @@ acpi_ps_init_scope (
******************************************************************************/
acpi_status
acpi_ps_push_scope (
struct acpi_parse_state *parser_state,
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *op,
u32 remaining_args,
u32 arg_count)
u32 remaining_args, u32 arg_count)
{
union acpi_generic_state *scope;
ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op);
scope = acpi_ut_create_generic_state();
if (!scope) {
return_ACPI_STATUS(AE_NO_MEMORY);
@@ -184,8 +168,7 @@ acpi_ps_push_scope (
/* Multiple arguments */
scope->parse_scope.arg_end = parser_state->pkg_end;
}
else {
} else {
/* Single argument */
scope->parse_scope.arg_end = ACPI_TO_POINTER(ACPI_MAX_PTR);
@@ -194,7 +177,6 @@ acpi_ps_push_scope (
return_ACPI_STATUS(AE_OK);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_pop_scope
@@ -212,18 +194,13 @@ acpi_ps_push_scope (
******************************************************************************/
void
acpi_ps_pop_scope (
struct acpi_parse_state *parser_state,
union acpi_parse_object **op,
u32 *arg_list,
u32 *arg_count)
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
{
union acpi_generic_state *scope = parser_state->scope;
ACPI_FUNCTION_TRACE("ps_pop_scope");
/* Only pop the scope if there is in fact a next scope */
if (scope->common.next) {
@@ -239,8 +216,7 @@ acpi_ps_pop_scope (
/* All done with this scope state structure */
acpi_ut_delete_generic_state(scope);
}
else {
} else {
/* empty parse stack, prepare to fetch next opcode */
*op = NULL;
@@ -253,7 +229,6 @@ acpi_ps_pop_scope (
return_VOID;
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_cleanup_scope
@@ -267,16 +242,12 @@ acpi_ps_pop_scope (
*
******************************************************************************/
void
acpi_ps_cleanup_scope (
struct acpi_parse_state *parser_state)
void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state)
{
union acpi_generic_state *scope;
ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state);
if (!parser_state) {
return_VOID;
}
@@ -290,4 +261,3 @@ acpi_ps_cleanup_scope (
return_VOID;
}

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -50,14 +49,10 @@
ACPI_MODULE_NAME("pstree")
/* Local prototypes */
#ifdef ACPI_OBSOLETE_FUNCTIONS
union acpi_parse_object *
acpi_ps_get_child (
union acpi_parse_object *op);
union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
#endif
/*******************************************************************************
*
* FUNCTION: acpi_ps_get_arg
@@ -71,18 +66,13 @@ acpi_ps_get_child (
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_get_arg (
union acpi_parse_object *op,
u32 argn)
union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
{
union acpi_parse_object *arg = NULL;
const struct acpi_opcode_info *op_info;
ACPI_FUNCTION_ENTRY();
/* Get the info structure for this opcode */
op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
@@ -111,7 +101,6 @@ acpi_ps_get_arg (
return (arg);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_append_arg
@@ -126,17 +115,13 @@ acpi_ps_get_arg (
******************************************************************************/
void
acpi_ps_append_arg (
union acpi_parse_object *op,
union acpi_parse_object *arg)
acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
{
union acpi_parse_object *prev_arg;
const struct acpi_opcode_info *op_info;
ACPI_FUNCTION_ENTRY();
if (!op) {
return;
}
@@ -147,8 +132,7 @@ acpi_ps_append_arg (
if (op_info->class == AML_CLASS_UNKNOWN) {
/* Invalid opcode */
ACPI_REPORT_ERROR (("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n",
op->common.aml_opcode));
ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode));
return;
}
@@ -170,8 +154,7 @@ acpi_ps_append_arg (
prev_arg = prev_arg->common.next;
}
prev_arg->common.next = arg;
}
else {
} else {
/* No argument list, this will be the first argument */
op->common.value.arg = arg;
@@ -185,7 +168,6 @@ acpi_ps_append_arg (
}
}
#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
@@ -201,19 +183,15 @@ acpi_ps_append_arg (
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_get_depth_next (
union acpi_parse_object *origin,
union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
union acpi_parse_object *op)
{
union acpi_parse_object *next = NULL;
union acpi_parse_object *parent;
union acpi_parse_object *arg;
ACPI_FUNCTION_ENTRY();
if (!op) {
return (NULL);
}
@@ -261,7 +239,6 @@ acpi_ps_get_depth_next (
return (next);
}
#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
@@ -275,16 +252,12 @@ acpi_ps_get_depth_next (
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_get_child (
union acpi_parse_object *op)
union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
{
union acpi_parse_object *child = NULL;
ACPI_FUNCTION_ENTRY();
switch (op->common.aml_opcode) {
case AML_SCOPE_OP:
case AML_ELSE_OP:
@@ -295,7 +268,6 @@ acpi_ps_get_child (
child = acpi_ps_get_arg(op, 0);
break;
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
case AML_METHOD_OP:
@@ -306,21 +278,18 @@ acpi_ps_get_child (
child = acpi_ps_get_arg(op, 1);
break;
case AML_POWER_RES_OP:
case AML_INDEX_FIELD_OP:
child = acpi_ps_get_arg(op, 2);
break;
case AML_PROCESSOR_OP:
case AML_BANK_FIELD_OP:
child = acpi_ps_get_arg(op, 3);
break;
default:
/* All others have no children */
break;
@@ -331,4 +300,3 @@ acpi_ps_get_child (
#endif
#endif /* ACPI_FUTURE_USAGE */

View File

@@ -41,7 +41,6 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/amlcode.h>
@@ -49,7 +48,6 @@
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psutils")
/*******************************************************************************
*
* FUNCTION: acpi_ps_create_scope_op
@@ -61,14 +59,10 @@
* DESCRIPTION: Create a Scope and associated namepath op with the root name
*
******************************************************************************/
union acpi_parse_object *
acpi_ps_create_scope_op (
void)
union acpi_parse_object *acpi_ps_create_scope_op(void)
{
union acpi_parse_object *scope_op;
scope_op = acpi_ps_alloc_op(AML_SCOPE_OP);
if (!scope_op) {
return (NULL);
@@ -78,7 +72,6 @@ acpi_ps_create_scope_op (
return (scope_op);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_init_op
@@ -92,23 +85,19 @@ acpi_ps_create_scope_op (
*
******************************************************************************/
void
acpi_ps_init_op (
union acpi_parse_object *op,
u16 opcode)
void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
{
ACPI_FUNCTION_ENTRY();
op->common.data_type = ACPI_DESC_TYPE_PARSER;
op->common.aml_opcode = opcode;
ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
(acpi_ps_get_opcode_info (opcode))->name,
(acpi_ps_get_opcode_info
(opcode))->name,
sizeof(op->common.aml_op_name)));
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_alloc_op
@@ -123,29 +112,23 @@ acpi_ps_init_op (
*
******************************************************************************/
union acpi_parse_object*
acpi_ps_alloc_op (
u16 opcode)
union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
{
union acpi_parse_object *op;
const struct acpi_opcode_info *op_info;
u8 flags = ACPI_PARSEOP_GENERIC;
ACPI_FUNCTION_ENTRY();
op_info = acpi_ps_get_opcode_info(opcode);
/* Determine type of parse_op required */
if (op_info->flags & AML_DEFER) {
flags = ACPI_PARSEOP_DEFERRED;
}
else if (op_info->flags & AML_NAMED) {
} else if (op_info->flags & AML_NAMED) {
flags = ACPI_PARSEOP_NAMED;
}
else if (opcode == AML_INT_BYTELIST_OP) {
} else if (opcode == AML_INT_BYTELIST_OP) {
flags = ACPI_PARSEOP_BYTELIST;
}
@@ -156,8 +139,7 @@ acpi_ps_alloc_op (
op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
memset(op, 0, sizeof(struct acpi_parse_obj_common));
}
else {
} else {
/* Extended parseop */
op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
@@ -174,7 +156,6 @@ acpi_ps_alloc_op (
return (op);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_free_op
@@ -188,26 +169,22 @@ acpi_ps_alloc_op (
*
******************************************************************************/
void
acpi_ps_free_op (
union acpi_parse_object *op)
void acpi_ps_free_op(union acpi_parse_object *op)
{
ACPI_FUNCTION_NAME("ps_free_op");
if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) {
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", op));
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n",
op));
}
if (op->common.flags & ACPI_PARSEOP_GENERIC) {
(void)acpi_os_release_object(acpi_gbl_ps_node_cache, op);
}
else {
} else {
(void)acpi_os_release_object(acpi_gbl_ps_node_ext_cache, op);
}
}
/*******************************************************************************
*
* FUNCTION: Utility functions
@@ -216,36 +193,27 @@ acpi_ps_free_op (
*
******************************************************************************/
/*
* Is "c" a namestring lead character?
*/
u8
acpi_ps_is_leading_char (
u32 c)
u8 acpi_ps_is_leading_char(u32 c)
{
return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
}
/*
* Is "c" a namestring prefix character?
*/
u8
acpi_ps_is_prefix_char (
u32 c)
u8 acpi_ps_is_prefix_char(u32 c)
{
return ((u8) (c == '\\' || c == '^'));
}
/*
* Get op's name (4-byte name segment) or 0 if unnamed
*/
#ifdef ACPI_FUTURE_USAGE
u32
acpi_ps_get_name (
union acpi_parse_object *op)
u32 acpi_ps_get_name(union acpi_parse_object * op)
{
/* The "generic" object has no name associated with it */
@@ -260,14 +228,10 @@ acpi_ps_get_name (
}
#endif /* ACPI_FUTURE_USAGE */
/*
* Set op's name
*/
void
acpi_ps_set_name (
union acpi_parse_object *op,
u32 name)
void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
{
/* The "generic" object has no name associated with it */
@@ -278,4 +242,3 @@ acpi_ps_set_name (
op->named.name = name;
}

View File

@@ -41,14 +41,12 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("pswalk")
/*******************************************************************************
*
* FUNCTION: acpi_ps_delete_parse_tree
@@ -60,19 +58,14 @@
* DESCRIPTION: Delete a portion of or an entire parse tree.
*
******************************************************************************/
void
acpi_ps_delete_parse_tree (
union acpi_parse_object *subtree_root)
void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root)
{
union acpi_parse_object *op = subtree_root;
union acpi_parse_object *next = NULL;
union acpi_parse_object *parent = NULL;
ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root);
/* Visit all nodes in the subtree */
while (op) {
@@ -104,8 +97,7 @@ acpi_ps_delete_parse_tree (
}
if (next) {
op = next;
}
else {
} else {
op = parent;
}
}

View File

@@ -41,27 +41,19 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
#include <acpi/acpi.h>
#include <acpi/acparser.h>
#include <acpi/acdispat.h>
#include <acpi/acinterp.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME("psxface")
/* Local Prototypes */
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
acpi_ps_update_parameter_list (
struct acpi_parameter_info *info,
u16 action);
acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
/*******************************************************************************
*
@@ -86,16 +78,12 @@ acpi_ps_update_parameter_list (
*
******************************************************************************/
acpi_status
acpi_ps_execute_method (
struct acpi_parameter_info *info)
acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
{
acpi_status status;
ACPI_FUNCTION_TRACE("ps_execute_method");
/* Validate the Info and method Node */
if (!info || !info->node) {
@@ -104,7 +92,8 @@ acpi_ps_execute_method (
/* Init for new method, wait on concurrency semaphore */
status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL);
status =
acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
@@ -149,7 +138,6 @@ acpi_ps_execute_method (
info->pass_number = 3;
status = acpi_ps_execute_pass(info);
cleanup:
if (info->obj_desc->method.owner_id) {
acpi_ut_release_owner_id(&info->obj_desc->method.owner_id);
@@ -170,7 +158,8 @@ cleanup:
* a control exception code
*/
if (info->return_object) {
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
"Method returned obj_desc=%p\n",
info->return_object));
ACPI_DUMP_STACK_ENTRY(info->return_object);
@@ -180,7 +169,6 @@ cleanup:
return_ACPI_STATUS(status);
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_update_parameter_list
@@ -196,26 +184,23 @@ cleanup:
******************************************************************************/
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)
{
acpi_native_uint i;
if ((info->parameter_type == ACPI_PARAM_ARGS) &&
(info->parameters)) {
if ((info->parameter_type == ACPI_PARAM_ARGS) && (info->parameters)) {
/* Update reference count for each parameter */
for (i = 0; info->parameters[i]; i++) {
/* Ignore errors, just do them all */
(void) acpi_ut_update_object_reference (info->parameters[i], action);
(void)acpi_ut_update_object_reference(info->
parameters[i],
action);
}
}
}
/*******************************************************************************
*
* FUNCTION: acpi_ps_execute_pass
@@ -229,18 +214,14 @@ acpi_ps_update_parameter_list (
*
******************************************************************************/
static acpi_status
acpi_ps_execute_pass (
struct acpi_parameter_info *info)
static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
{
acpi_status status;
union acpi_parse_object *op;
struct acpi_walk_state *walk_state;
ACPI_FUNCTION_TRACE("ps_execute_pass");
/* Create and init a Root Node */
op = acpi_ps_create_scope_op();
@@ -250,8 +231,9 @@ acpi_ps_execute_pass (
/* Create and initialize a new walk state */
walk_state = acpi_ds_create_walk_state (
info->obj_desc->method.owner_id, NULL, NULL, NULL);
walk_state =
acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
NULL, NULL);
if (!walk_state) {
status = AE_NO_MEMORY;
goto cleanup;
@@ -277,5 +259,3 @@ cleanup:
acpi_ps_delete_parse_tree(op);
return_ACPI_STATUS(status);
}

View File

@@ -35,7 +35,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_PCI_COMPONENT
ACPI_MODULE_NAME("pci_bind")
@@ -45,12 +44,7 @@ struct acpi_pci_data {
struct pci_dev *dev;
};
void
acpi_pci_data_handler (
acpi_handle handle,
u32 function,
void *context)
void acpi_pci_data_handler(acpi_handle handle, u32 function, void *context)
{
ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
@@ -59,7 +53,6 @@ acpi_pci_data_handler (
return_VOID;
}
/**
* acpi_get_pci_id
* ------------------
@@ -67,10 +60,7 @@ acpi_pci_data_handler (
* to resolve PCI information for ACPI-PCI devices defined in the namespace.
* This typically occurs when resolving PCI operation region information.
*/
acpi_status
acpi_get_pci_id (
acpi_handle handle,
struct acpi_pci_id *id)
acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
{
int result = 0;
acpi_status status = AE_OK;
@@ -114,12 +104,10 @@ acpi_get_pci_id (
return_ACPI_STATUS(AE_OK);
}
EXPORT_SYMBOL(acpi_get_pci_id);
int
acpi_pci_bind (
struct acpi_device *device)
int acpi_pci_bind(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
@@ -283,8 +271,7 @@ end:
return_VALUE(result);
}
int acpi_pci_unbind(
struct acpi_device *device)
int acpi_pci_unbind(struct acpi_device *device)
{
int result = 0;
acpi_status status = AE_OK;
@@ -309,7 +296,9 @@ int acpi_pci_unbind(
pathname));
kfree(pathname);
status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data);
status =
acpi_get_data(device->handle, acpi_pci_data_handler,
(void **)&data);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to get data from device %s\n",
@@ -336,10 +325,8 @@ end:
}
int
acpi_pci_bind_root (
struct acpi_device *device,
struct acpi_pci_id *id,
struct pci_bus *bus)
acpi_pci_bind_root(struct acpi_device *device,
struct acpi_pci_id *id, struct pci_bus *bus)
{
int result = 0;
acpi_status status = AE_OK;

View File

@@ -38,7 +38,6 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_PCI_COMPONENT
ACPI_MODULE_NAME("pci_irq")
@@ -49,12 +48,9 @@ static DEFINE_SPINLOCK(acpi_prt_lock);
PCI IRQ Routing Table (PRT) Support
-------------------------------------------------------------------------- */
static struct acpi_prt_entry *
acpi_pci_irq_find_prt_entry (
int segment,
static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
int bus,
int device,
int pin)
int device, int pin)
{
struct list_head *node = NULL;
struct acpi_prt_entry *entry = NULL;
@@ -85,13 +81,9 @@ acpi_pci_irq_find_prt_entry (
return_PTR(NULL);
}
static int
acpi_pci_irq_add_entry (
acpi_handle handle,
int segment,
int bus,
struct acpi_pci_routing_table *prt)
acpi_pci_irq_add_entry(acpi_handle handle,
int segment, int bus, struct acpi_pci_routing_table *prt)
{
struct acpi_prt_entry *entry = NULL;
@@ -140,8 +132,9 @@ acpi_pci_irq_add_entry (
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
" %02X:%02X:%02X[%c] -> %s[%d]\n",
entry->id.segment, entry->id.bus, entry->id.device,
('A' + entry->pin), prt->source, entry->link.index));
entry->id.segment, entry->id.bus,
entry->id.device, ('A' + entry->pin), prt->source,
entry->link.index));
spin_lock(&acpi_prt_lock);
list_add_tail(&entry->node, &acpi_prt.entries);
@@ -151,12 +144,8 @@ acpi_pci_irq_add_entry (
return_VALUE(0);
}
static void
acpi_pci_irq_del_entry (
int segment,
int bus,
struct acpi_prt_entry *entry)
acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
{
if (segment == entry->id.segment && bus == entry->id.bus) {
acpi_prt.count--;
@@ -165,12 +154,7 @@ acpi_pci_irq_del_entry (
}
}
int
acpi_pci_irq_add_prt (
acpi_handle handle,
int segment,
int bus)
int acpi_pci_irq_add_prt(acpi_handle handle, int segment, int bus)
{
acpi_status status = AE_OK;
char *pathname = NULL;
@@ -246,8 +230,7 @@ acpi_pci_irq_add_prt (
return_VALUE(0);
}
void
acpi_pci_irq_del_prt (int segment, int bus)
void acpi_pci_irq_del_prt(int segment, int bus)
{
struct list_head *node = NULL, *n = NULL;
struct acpi_prt_entry *entry = NULL;
@@ -256,8 +239,9 @@ acpi_pci_irq_del_prt (int segment, int bus)
return;
}
printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n",
segment, bus);
printk(KERN_DEBUG
"ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment,
bus);
spin_lock(&acpi_prt_lock);
list_for_each_safe(node, n, &acpi_prt.entries) {
entry = list_entry(node, struct acpi_prt_entry, node);
@@ -266,6 +250,7 @@ acpi_pci_irq_del_prt (int segment, int bus)
}
spin_unlock(&acpi_prt_lock);
}
/* --------------------------------------------------------------------------
PCI Interrupt Routing Support
-------------------------------------------------------------------------- */
@@ -273,9 +258,7 @@ typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **);
static int
acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
int *edge_level,
int *active_high_low,
char **link)
int *edge_level, int *active_high_low, char **link)
{
int irq;
@@ -283,9 +266,11 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
if (entry->link.handle) {
irq = acpi_pci_link_allocate_irq(entry->link.handle,
entry->link.index, edge_level, active_high_low, link);
entry->link.index, edge_level,
active_high_low, link);
if (irq < 0) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Invalid IRQ link routing entry\n"));
return_VALUE(-1);
}
} else {
@@ -300,9 +285,7 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
static int
acpi_pci_free_irq(struct acpi_prt_entry *entry,
int *edge_level,
int *active_high_low,
char **link)
int *edge_level, int *active_high_low, char **link)
{
int irq;
@@ -314,20 +297,18 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
}
return_VALUE(irq);
}
/*
* acpi_pci_irq_lookup
* success: return IRQ >= 0
* failure: return -1
*/
static int
acpi_pci_irq_lookup (
struct pci_bus *bus,
acpi_pci_irq_lookup(struct pci_bus *bus,
int device,
int pin,
int *edge_level,
int *active_high_low,
char **link,
irq_lookup_func func)
int *active_high_low, char **link, irq_lookup_func func)
{
struct acpi_prt_entry *entry = NULL;
int segment = pci_domain_nr(bus);
@@ -356,13 +337,10 @@ acpi_pci_irq_lookup (
* failure: return < 0
*/
static int
acpi_pci_irq_derive (
struct pci_dev *dev,
acpi_pci_irq_derive(struct pci_dev *dev,
int pin,
int *edge_level,
int *active_high_low,
char **link,
irq_lookup_func func)
int *active_high_low, char **link, irq_lookup_func func)
{
struct pci_dev *bridge = dev;
int irq = -1;
@@ -383,10 +361,12 @@ acpi_pci_irq_derive (
if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
/* PC card has the same IRQ as its cardbridge */
pci_read_config_byte(bridge, PCI_INTERRUPT_PIN, &bridge_pin);
pci_read_config_byte(bridge, PCI_INTERRUPT_PIN,
&bridge_pin);
if (!bridge_pin) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"No interrupt pin configured for device %s\n", pci_name(bridge)));
"No interrupt pin configured for device %s\n",
pci_name(bridge)));
return_VALUE(-1);
}
/* Pin is from 0 to 3 */
@@ -395,11 +375,14 @@ acpi_pci_irq_derive (
}
irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
pin, edge_level, active_high_low, link, func);
pin, edge_level, active_high_low,
link, func);
}
if (irq < 0) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Unable to derive IRQ for device %s\n", pci_name(dev)));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Unable to derive IRQ for device %s\n",
pci_name(dev)));
return_VALUE(-1);
}
@@ -415,9 +398,7 @@ acpi_pci_irq_derive (
* failure: return < 0
*/
int
acpi_pci_irq_enable (
struct pci_dev *dev)
int acpi_pci_irq_enable(struct pci_dev *dev)
{
int irq = 0;
u8 pin = 0;
@@ -433,13 +414,16 @@ acpi_pci_irq_enable (
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
if (!pin) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No interrupt pin configured for device %s\n", pci_name(dev)));
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"No interrupt pin configured for device %s\n",
pci_name(dev)));
return_VALUE(0);
}
pin--;
if (!dev->bus) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid (NULL) 'bus' field\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid (NULL) 'bus' field\n"));
return_VALUE(-ENODEV);
}
@@ -448,7 +432,8 @@ acpi_pci_irq_enable (
* values override any BIOS-assigned IRQs set during boot.
*/
irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
&edge_level, &active_high_low, &link, acpi_pci_allocate_irq);
&edge_level, &active_high_low, &link,
acpi_pci_allocate_irq);
/*
* If no PRT entry was found, we'll try to derive an IRQ from the
@@ -456,7 +441,8 @@ acpi_pci_irq_enable (
*/
if (irq < 0)
irq = acpi_pci_irq_derive(dev, pin, &edge_level,
&active_high_low, &link, acpi_pci_allocate_irq);
&active_high_low, &link,
acpi_pci_allocate_irq);
/*
* No IRQ known to the ACPI subsystem - maybe the BIOS /
@@ -468,10 +454,10 @@ acpi_pci_irq_enable (
/* Interrupt Line values above 0xF are forbidden */
if (dev->irq > 0 && (dev->irq <= 0xF)) {
printk(" - using IRQ %d\n", dev->irq);
acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW);
acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE,
ACPI_ACTIVE_LOW);
return_VALUE(0);
}
else {
} else {
printk("\n");
return_VALUE(0);
}
@@ -493,20 +479,19 @@ acpi_pci_irq_enable (
printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
(edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
(active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high",
dev->irq);
(active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_pci_irq_enable);
/* FIXME: implement x86/x86_64 version */
void __attribute__((weak)) acpi_unregister_gsi(u32 i) {}
void __attribute__ ((weak)) acpi_unregister_gsi(u32 i)
{
}
void
acpi_pci_irq_disable (
struct pci_dev *dev)
void acpi_pci_irq_disable(struct pci_dev *dev)
{
int gsi = 0;
u8 pin = 0;
@@ -530,14 +515,16 @@ acpi_pci_irq_disable (
* First we check the PCI IRQ routing table (PRT) for an IRQ.
*/
gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
&edge_level, &active_high_low, NULL, acpi_pci_free_irq);
&edge_level, &active_high_low, NULL,
acpi_pci_free_irq);
/*
* If no PRT entry was found, we'll try to derive an IRQ from the
* device's parent bridge.
*/
if (gsi < 0)
gsi = acpi_pci_irq_derive(dev, pin,
&edge_level, &active_high_low, NULL, acpi_pci_free_irq);
&edge_level, &active_high_low, NULL,
acpi_pci_free_irq);
if (gsi < 0)
return_VOID;

View File

@@ -42,19 +42,15 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#define _COMPONENT ACPI_PCI_COMPONENT
ACPI_MODULE_NAME("pci_link")
#define ACPI_PCI_LINK_CLASS "pci_irq_routing"
#define ACPI_PCI_LINK_HID "PNP0C0F"
#define ACPI_PCI_LINK_DRIVER_NAME "ACPI PCI Interrupt Link Driver"
#define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"
#define ACPI_PCI_LINK_FILE_INFO "info"
#define ACPI_PCI_LINK_FILE_STATUS "state"
#define ACPI_PCI_LINK_MAX_POSSIBLE 16
static int acpi_pci_link_add(struct acpi_device *device);
static int acpi_pci_link_remove(struct acpi_device *device, int type);
@@ -97,7 +93,6 @@ static struct {
} acpi_link;
DECLARE_MUTEX(acpi_link_lock);
/* --------------------------------------------------------------------------
PCI Link Device Management
-------------------------------------------------------------------------- */
@@ -106,9 +101,7 @@ DECLARE_MUTEX(acpi_link_lock);
* set context (link) possible list from resource list
*/
static acpi_status
acpi_pci_link_check_possible (
struct acpi_resource *resource,
void *context)
acpi_pci_link_check_possible(struct acpi_resource *resource, void *context)
{
struct acpi_pci_link *link = (struct acpi_pci_link *)context;
u32 i = 0;
@@ -122,12 +115,17 @@ acpi_pci_link_check_possible (
{
struct acpi_resource_irq *p = &resource->data.irq;
if (!p || !p->number_of_interrupts) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Blank IRQ resource\n"));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Blank IRQ resource\n"));
return_ACPI_STATUS(AE_OK);
}
for (i = 0; (i<p->number_of_interrupts && i<ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
for (i = 0;
(i < p->number_of_interrupts
&& i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
if (!p->interrupts[i]) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i]));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Invalid IRQ %d\n",
p->interrupts[i]));
continue;
}
link->irq.possible[i] = p->interrupts[i];
@@ -140,15 +138,20 @@ acpi_pci_link_check_possible (
}
case ACPI_RSTYPE_EXT_IRQ:
{
struct acpi_resource_ext_irq *p = &resource->data.extended_irq;
struct acpi_resource_ext_irq *p =
&resource->data.extended_irq;
if (!p || !p->number_of_interrupts) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Blank EXT IRQ resource\n"));
return_ACPI_STATUS(AE_OK);
}
for (i = 0; (i<p->number_of_interrupts && i<ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
for (i = 0;
(i < p->number_of_interrupts
&& i < ACPI_PCI_LINK_MAX_POSSIBLE); i++) {
if (!p->interrupts[i]) {
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ %d\n", p->interrupts[i]));
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
"Invalid IRQ %d\n",
p->interrupts[i]));
continue;
}
link->irq.possible[i] = p->interrupts[i];
@@ -168,10 +171,7 @@ acpi_pci_link_check_possible (
return_ACPI_STATUS(AE_CTRL_TERMINATE);
}
static int
acpi_pci_link_get_possible (
struct acpi_pci_link *link)
static int acpi_pci_link_get_possible(struct acpi_pci_link *link)
{
acpi_status status;
@@ -188,16 +188,14 @@ acpi_pci_link_get_possible (
}
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Found %d possible IRQs\n", link->irq.possible_count));
"Found %d possible IRQs\n",
link->irq.possible_count));
return_VALUE(0);
}
static acpi_status
acpi_pci_link_check_current (
struct acpi_resource *resource,
void *context)
acpi_pci_link_check_current(struct acpi_resource *resource, void *context)
{
int *irq = (int *)context;
@@ -221,7 +219,8 @@ acpi_pci_link_check_current (
}
case ACPI_RSTYPE_EXT_IRQ:
{
struct acpi_resource_ext_irq *p = &resource->data.extended_irq;
struct acpi_resource_ext_irq *p =
&resource->data.extended_irq;
if (!p || !p->number_of_interrupts) {
/*
* extended IRQ descriptors must
@@ -235,8 +234,7 @@ acpi_pci_link_check_current (
break;
}
default:
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Resource isn't an IRQ\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Resource isn't an IRQ\n"));
return_ACPI_STATUS(AE_OK);
}
return_ACPI_STATUS(AE_CTRL_TERMINATE);
@@ -249,9 +247,7 @@ acpi_pci_link_check_current (
* 0 - success
* !0 - failure
*/
static int
acpi_pci_link_get_current (
struct acpi_pci_link *link)
static int acpi_pci_link_get_current(struct acpi_pci_link *link)
{
int result = 0;
acpi_status status = AE_OK;
@@ -269,7 +265,8 @@ acpi_pci_link_get_current (
/* Query _STA, set link->device->status */
result = acpi_bus_get_status(link->device);
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unable to read status\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Unable to read status\n"));
goto end;
}
@@ -304,10 +301,7 @@ end:
return_VALUE(result);
}
static int
acpi_pci_link_set (
struct acpi_pci_link *link,
int irq)
static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
{
int result = 0;
acpi_status status = AE_OK;
@@ -335,9 +329,11 @@ acpi_pci_link_set (
resource->res.id = ACPI_RSTYPE_IRQ;
resource->res.length = sizeof(struct acpi_resource);
resource->res.data.irq.edge_level = link->irq.edge_level;
resource->res.data.irq.active_high_low = link->irq.active_high_low;
resource->res.data.irq.active_high_low =
link->irq.active_high_low;
if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE;
resource->res.data.irq.shared_exclusive =
ACPI_EXCLUSIVE;
else
resource->res.data.irq.shared_exclusive = ACPI_SHARED;
resource->res.data.irq.number_of_interrupts = 1;
@@ -347,11 +343,15 @@ acpi_pci_link_set (
case ACPI_RSTYPE_EXT_IRQ:
resource->res.id = ACPI_RSTYPE_EXT_IRQ;
resource->res.length = sizeof(struct acpi_resource);
resource->res.data.extended_irq.producer_consumer = ACPI_CONSUMER;
resource->res.data.extended_irq.edge_level = link->irq.edge_level;
resource->res.data.extended_irq.active_high_low = link->irq.active_high_low;
resource->res.data.extended_irq.producer_consumer =
ACPI_CONSUMER;
resource->res.data.extended_irq.edge_level =
link->irq.edge_level;
resource->res.data.extended_irq.active_high_low =
link->irq.active_high_low;
if (link->irq.edge_level == ACPI_EDGE_SENSITIVE)
resource->res.data.irq.shared_exclusive = ACPI_EXCLUSIVE;
resource->res.data.irq.shared_exclusive =
ACPI_EXCLUSIVE;
else
resource->res.data.irq.shared_exclusive = ACPI_SHARED;
resource->res.data.extended_irq.number_of_interrupts = 1;
@@ -407,8 +407,7 @@ acpi_pci_link_set (
printk(KERN_WARNING PREFIX
"%s [%s] BIOS reported IRQ %d, using IRQ %d\n",
acpi_device_name(link->device),
acpi_device_bid(link->device),
link->irq.active, irq);
acpi_device_bid(link->device), link->irq.active, irq);
link->irq.active = irq;
}
@@ -419,7 +418,6 @@ end:
return_VALUE(result);
}
/* --------------------------------------------------------------------------
PCI Link IRQ Management
-------------------------------------------------------------------------- */
@@ -485,8 +483,7 @@ static int acpi_irq_penalty[ACPI_MAX_IRQS] = {
/* >IRQ15 */
};
int __init
acpi_irq_penalty_init(void)
int __init acpi_irq_penalty_init(void)
{
struct list_head *node = NULL;
struct acpi_pci_link *link = NULL;
@@ -501,7 +498,8 @@ acpi_irq_penalty_init(void)
link = list_entry(node, struct acpi_pci_link, node);
if (!link) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n"));
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Invalid link context\n"));
continue;
}
@@ -510,15 +508,20 @@ acpi_irq_penalty_init(void)
* useful for breaking ties.
*/
if (link->irq.possible_count) {
int penalty = PIRQ_PENALTY_PCI_POSSIBLE / link->irq.possible_count;
int penalty =
PIRQ_PENALTY_PCI_POSSIBLE /
link->irq.possible_count;
for (i = 0; i < link->irq.possible_count; i++) {
if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ)
acpi_irq_penalty[link->irq.possible[i]] += penalty;
acpi_irq_penalty[link->irq.
possible[i]] +=
penalty;
}
} else if (link->irq.active) {
acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_POSSIBLE;
acpi_irq_penalty[link->irq.active] +=
PIRQ_PENALTY_PCI_POSSIBLE;
}
}
/* Add a penalty for the SCI */
@@ -575,14 +578,16 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
* the use of IRQs 9, 10, 11, and >15.
*/
for (i = (link->irq.possible_count - 1); i >= 0; i--) {
if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]])
if (acpi_irq_penalty[irq] >
acpi_irq_penalty[link->irq.possible[i]])
irq = link->irq.possible[i];
}
}
/* Attempt to enable the link device at this IRQ. */
if (acpi_pci_link_set(link, irq)) {
printk(PREFIX "Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n"
printk(PREFIX
"Unable to set IRQ for %s [%s] (likely buggy ACPI BIOS).\n"
"Try pci=noacpi or acpi=off\n",
acpi_device_name(link->device),
acpi_device_bid(link->device));
@@ -606,12 +611,9 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
*/
int
acpi_pci_link_allocate_irq (
acpi_handle handle,
acpi_pci_link_allocate_irq(acpi_handle handle,
int index,
int *edge_level,
int *active_high_low,
char **name)
int *edge_level, int *active_high_low, char **name)
{
int result = 0;
struct acpi_device *device = NULL;
@@ -651,11 +653,15 @@ acpi_pci_link_allocate_irq (
link->refcnt++;
up(&acpi_link_lock);
if (edge_level) *edge_level = link->irq.edge_level;
if (active_high_low) *active_high_low = link->irq.active_high_low;
if (name) *name = acpi_device_bid(link->device);
if (edge_level)
*edge_level = link->irq.edge_level;
if (active_high_low)
*active_high_low = link->irq.active_high_low;
if (name)
*name = acpi_device_bid(link->device);
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Link %s is referenced\n", acpi_device_bid(link->device)));
"Link %s is referenced\n",
acpi_device_bid(link->device)));
return_VALUE(link->irq.active);
}
@@ -663,8 +669,7 @@ acpi_pci_link_allocate_irq (
* We don't change link's irq information here. After it is reenabled, we
* continue use the info
*/
int
acpi_pci_link_free_irq(acpi_handle handle)
int acpi_pci_link_free_irq(acpi_handle handle)
{
struct acpi_device *device = NULL;
struct acpi_pci_link *link = NULL;
@@ -690,7 +695,6 @@ acpi_pci_link_free_irq(acpi_handle handle)
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n"));
return_VALUE(-1);
}
#ifdef FUTURE_USE
/*
* The Link reference count allows us to _DISable an unused link
@@ -704,7 +708,8 @@ acpi_pci_link_free_irq(acpi_handle handle)
link->refcnt--;
#endif
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Link %s is dereferenced\n", acpi_device_bid(link->device)));
"Link %s is dereferenced\n",
acpi_device_bid(link->device)));
if (link->refcnt == 0) {
acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL);
@@ -712,12 +717,12 @@ acpi_pci_link_free_irq(acpi_handle handle)
up(&acpi_link_lock);
return_VALUE(link->irq.active);
}
/* --------------------------------------------------------------------------
Driver Interface
-------------------------------------------------------------------------- */
static int
acpi_pci_link_add(struct acpi_device *device)
static int acpi_pci_link_add(struct acpi_device *device)
{
int result = 0;
struct acpi_pci_link *link = NULL;
@@ -754,8 +759,7 @@ acpi_pci_link_add(struct acpi_device *device)
if (link->irq.active == link->irq.possible[i]) {
printk(" *%d", link->irq.possible[i]);
found = 1;
}
else
} else
printk(" %d", link->irq.possible[i]);
}
@@ -784,9 +788,7 @@ end:
return_VALUE(result);
}
static int
acpi_pci_link_resume(
struct acpi_pci_link *link)
static int acpi_pci_link_resume(struct acpi_pci_link *link)
{
ACPI_FUNCTION_TRACE("acpi_pci_link_resume");
@@ -801,8 +803,7 @@ acpi_pci_link_resume(
* after every device calls pci_disable_device in .resume.
*/
int acpi_in_resume;
static int
irqrouter_resume(struct sys_device *dev)
static int irqrouter_resume(struct sys_device *dev)
{
struct list_head *node = NULL;
struct acpi_pci_link *link = NULL;
@@ -823,9 +824,7 @@ irqrouter_resume(struct sys_device *dev)
return_VALUE(0);
}
static int
acpi_pci_link_remove(struct acpi_device *device, int type)
static int acpi_pci_link_remove(struct acpi_device *device, int type)
{
struct acpi_pci_link *link = NULL;
@@ -902,6 +901,7 @@ static int __init acpi_irq_isa(char *str)
{
return acpi_irq_penalty_update(str, 1);
}
__setup("acpi_irq_isa=", acpi_irq_isa);
/*
@@ -913,6 +913,7 @@ static int __init acpi_irq_pci(char *str)
{
return acpi_irq_penalty_update(str, 0);
}
__setup("acpi_irq_pci=", acpi_irq_pci);
static int __init acpi_irq_nobalance_set(char *str)
@@ -920,6 +921,7 @@ static int __init acpi_irq_nobalance_set(char *str)
acpi_irq_balance = 0;
return 1;
}
__setup("acpi_irq_nobalance", acpi_irq_nobalance_set);
int __init acpi_irq_balance_set(char *str)
@@ -927,8 +929,8 @@ int __init acpi_irq_balance_set(char *str)
acpi_irq_balance = 1;
return 1;
}
__setup("acpi_irq_balance", acpi_irq_balance_set);
__setup("acpi_irq_balance", acpi_irq_balance_set);
/* FIXME: we will remove this interface after all drivers call pci_disable_device */
static struct sysdev_class irqrouter_sysdev_class = {
@@ -936,13 +938,11 @@ static struct sysdev_class irqrouter_sysdev_class = {
.resume = irqrouter_resume,
};
static struct sys_device device_irqrouter = {
.id = 0,
.cls = &irqrouter_sysdev_class,
};
static int __init irqrouter_init_sysfs(void)
{
int error;
@@ -961,7 +961,6 @@ static int __init irqrouter_init_sysfs(void)
device_initcall(irqrouter_init_sysfs);
static int __init acpi_pci_link_init(void)
{
ACPI_FUNCTION_TRACE("acpi_pci_link_init");

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