[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ static int __init check_bridge(int vendor, int device)
|
|||||||
|
|
||||||
void __init check_acpi_pci(void)
|
void __init check_acpi_pci(void)
|
||||||
{
|
{
|
||||||
int num,slot,func;
|
int num, slot, func;
|
||||||
|
|
||||||
/* Assume the machine supports type 1. If not it will
|
/* Assume the machine supports type 1. If not it will
|
||||||
always read ffffffff and should not have any side effect. */
|
always read ffffffff and should not have any side effect. */
|
||||||
@@ -31,7 +31,7 @@ void __init check_acpi_pci(void)
|
|||||||
for (func = 0; func < 8; func++) {
|
for (func = 0; func < 8; func++) {
|
||||||
u32 class;
|
u32 class;
|
||||||
u32 vendor;
|
u32 vendor;
|
||||||
class = read_pci_config(num,slot,func,
|
class = read_pci_config(num, slot, func,
|
||||||
PCI_CLASS_REVISION);
|
PCI_CLASS_REVISION);
|
||||||
if (class == 0xffffffff)
|
if (class == 0xffffffff)
|
||||||
break;
|
break;
|
||||||
@@ -42,7 +42,7 @@ void __init check_acpi_pci(void)
|
|||||||
vendor = read_pci_config(num, slot, func,
|
vendor = read_pci_config(num, slot, func,
|
||||||
PCI_VENDOR_ID);
|
PCI_VENDOR_ID);
|
||||||
|
|
||||||
if (check_bridge(vendor&0xffff, vendor >> 16))
|
if (check_bridge(vendor & 0xffff, vendor >> 16))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,13 @@ extern void zap_low_mappings(void);
|
|||||||
|
|
||||||
extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
|
extern unsigned long FASTCALL(acpi_copy_wakeup_routine(unsigned long));
|
||||||
|
|
||||||
static void init_low_mapping(pgd_t *pgd, int pgd_limit)
|
static void init_low_mapping(pgd_t * pgd, int pgd_limit)
|
||||||
{
|
{
|
||||||
int pgd_ofs = 0;
|
int pgd_ofs = 0;
|
||||||
|
|
||||||
while ((pgd_ofs < pgd_limit) && (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
|
while ((pgd_ofs < pgd_limit)
|
||||||
set_pgd(pgd, *(pgd+USER_PTRS_PER_PGD));
|
&& (pgd_ofs + USER_PTRS_PER_PGD < PTRS_PER_PGD)) {
|
||||||
|
set_pgd(pgd, *(pgd + USER_PTRS_PER_PGD));
|
||||||
pgd_ofs++, pgd++;
|
pgd_ofs++, pgd++;
|
||||||
}
|
}
|
||||||
flush_tlb_all();
|
flush_tlb_all();
|
||||||
@@ -37,12 +38,13 @@ static void init_low_mapping(pgd_t *pgd, int pgd_limit)
|
|||||||
* Create an identity mapped page table and copy the wakeup routine to
|
* Create an identity mapped page table and copy the wakeup routine to
|
||||||
* low memory.
|
* low memory.
|
||||||
*/
|
*/
|
||||||
int acpi_save_state_mem (void)
|
int acpi_save_state_mem(void)
|
||||||
{
|
{
|
||||||
if (!acpi_wakeup_address)
|
if (!acpi_wakeup_address)
|
||||||
return 1;
|
return 1;
|
||||||
init_low_mapping(swapper_pg_dir, USER_PTRS_PER_PGD);
|
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);
|
acpi_copy_wakeup_routine(acpi_wakeup_address);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -51,7 +53,7 @@ int acpi_save_state_mem (void)
|
|||||||
/*
|
/*
|
||||||
* acpi_restore_state - undo effects of acpi_save_state_mem
|
* acpi_restore_state - undo effects of acpi_save_state_mem
|
||||||
*/
|
*/
|
||||||
void acpi_restore_state_mem (void)
|
void acpi_restore_state_mem(void)
|
||||||
{
|
{
|
||||||
zap_low_mappings();
|
zap_low_mappings();
|
||||||
}
|
}
|
||||||
@@ -67,7 +69,8 @@ void acpi_restore_state_mem (void)
|
|||||||
void __init acpi_reserve_bootmem(void)
|
void __init acpi_reserve_bootmem(void)
|
||||||
{
|
{
|
||||||
if ((&wakeup_end - &wakeup_start) > PAGE_SIZE) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,10 +93,8 @@ static int __init acpi_sleep_setup(char *str)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
__setup("acpi_sleep=", acpi_sleep_setup);
|
__setup("acpi_sleep=", acpi_sleep_setup);
|
||||||
|
|
||||||
|
|
||||||
static __init int reset_videomode_after_s3(struct dmi_system_id *d)
|
static __init int reset_videomode_after_s3(struct dmi_system_id *d)
|
||||||
{
|
{
|
||||||
acpi_video_flags |= 2;
|
acpi_video_flags |= 2;
|
||||||
@@ -101,14 +102,14 @@ static __init int reset_videomode_after_s3(struct dmi_system_id *d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
|
static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
|
||||||
{ /* Reset video mode after returning from ACPI S3 sleep */
|
{ /* Reset video mode after returning from ACPI S3 sleep */
|
||||||
.callback = reset_videomode_after_s3,
|
.callback = reset_videomode_after_s3,
|
||||||
.ident = "Toshiba Satellite 4030cdt",
|
.ident = "Toshiba Satellite 4030cdt",
|
||||||
.matches = {
|
.matches = {
|
||||||
DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
|
DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ }
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init acpisleep_dmi_init(void)
|
static int __init acpisleep_dmi_init(void)
|
||||||
|
|||||||
@@ -17,20 +17,20 @@
|
|||||||
#include <asm/acpi-ext.h>
|
#include <asm/acpi-ext.h>
|
||||||
|
|
||||||
struct acpi_vendor_descriptor {
|
struct acpi_vendor_descriptor {
|
||||||
u8 guid_id;
|
u8 guid_id;
|
||||||
efi_guid_t guid;
|
efi_guid_t guid;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_vendor_info {
|
struct acpi_vendor_info {
|
||||||
struct acpi_vendor_descriptor *descriptor;
|
struct acpi_vendor_descriptor *descriptor;
|
||||||
u8 *data;
|
u8 *data;
|
||||||
u32 length;
|
u32 length;
|
||||||
};
|
};
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
||||||
{
|
{
|
||||||
struct acpi_vendor_info *info = (struct acpi_vendor_info *) context;
|
struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
|
||||||
struct acpi_resource_vendor *vendor;
|
struct acpi_resource_vendor *vendor;
|
||||||
struct acpi_vendor_descriptor *descriptor;
|
struct acpi_vendor_descriptor *descriptor;
|
||||||
u32 length;
|
u32 length;
|
||||||
@@ -38,8 +38,8 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
|||||||
if (resource->id != ACPI_RSTYPE_VENDOR)
|
if (resource->id != ACPI_RSTYPE_VENDOR)
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
|
|
||||||
vendor = (struct acpi_resource_vendor *) &resource->data;
|
vendor = (struct acpi_resource_vendor *)&resource->data;
|
||||||
descriptor = (struct acpi_vendor_descriptor *) vendor->reserved;
|
descriptor = (struct acpi_vendor_descriptor *)vendor->reserved;
|
||||||
if (vendor->length <= sizeof(*info->descriptor) ||
|
if (vendor->length <= sizeof(*info->descriptor) ||
|
||||||
descriptor->guid_id != info->descriptor->guid_id ||
|
descriptor->guid_id != info->descriptor->guid_id ||
|
||||||
efi_guidcmp(descriptor->guid, info->descriptor->guid))
|
efi_guidcmp(descriptor->guid, info->descriptor->guid))
|
||||||
@@ -50,21 +50,24 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
|
|||||||
if (!info->data)
|
if (!info->data)
|
||||||
return AE_NO_MEMORY;
|
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;
|
info->length = length;
|
||||||
return AE_CTRL_TERMINATE;
|
return AE_CTRL_TERMINATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor *id,
|
acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
|
||||||
u8 **data, u32 *length)
|
u8 ** data, u32 * length)
|
||||||
{
|
{
|
||||||
struct acpi_vendor_info info;
|
struct acpi_vendor_info info;
|
||||||
|
|
||||||
info.descriptor = id;
|
info.descriptor = id;
|
||||||
info.data = NULL;
|
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)
|
if (!info.data)
|
||||||
return AE_NOT_FOUND;
|
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 = {
|
struct acpi_vendor_descriptor hp_ccsr_descriptor = {
|
||||||
.guid_id = 2,
|
.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
|
acpi_status hp_acpi_csr_space(acpi_handle obj, u64 * csr_base, u64 * csr_length)
|
||||||
hp_acpi_csr_space(acpi_handle obj, u64 *csr_base, u64 *csr_length)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u8 *data;
|
u8 *data;
|
||||||
u32 length;
|
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)
|
if (ACPI_FAILURE(status) || length != 16)
|
||||||
return AE_NOT_FOUND;
|
return AE_NOT_FOUND;
|
||||||
|
|||||||
@@ -74,12 +74,11 @@ unsigned int acpi_cpei_override;
|
|||||||
unsigned int acpi_cpei_phys_cpuid;
|
unsigned int acpi_cpei_phys_cpuid;
|
||||||
|
|
||||||
#define MAX_SAPICS 256
|
#define MAX_SAPICS 256
|
||||||
u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
|
u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = {[0...MAX_SAPICS - 1] = -1 };
|
||||||
{ [0 ... MAX_SAPICS - 1] = -1 };
|
|
||||||
EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
|
EXPORT_SYMBOL(ia64_acpiid_to_sapicid);
|
||||||
|
|
||||||
const char *
|
const char *acpi_get_sysname(void)
|
||||||
acpi_get_sysname (void)
|
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_IA64_GENERIC
|
#ifdef CONFIG_IA64_GENERIC
|
||||||
unsigned long rsdp_phys;
|
unsigned long rsdp_phys;
|
||||||
@@ -89,27 +88,29 @@ acpi_get_sysname (void)
|
|||||||
|
|
||||||
rsdp_phys = acpi_find_rsdp();
|
rsdp_phys = acpi_find_rsdp();
|
||||||
if (!rsdp_phys) {
|
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";
|
return "dig";
|
||||||
}
|
}
|
||||||
|
|
||||||
rsdp = (struct acpi20_table_rsdp *) __va(rsdp_phys);
|
rsdp = (struct acpi20_table_rsdp *)__va(rsdp_phys);
|
||||||
if (strncmp(rsdp->signature, RSDP_SIG, sizeof(RSDP_SIG) - 1)) {
|
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";
|
return "dig";
|
||||||
}
|
}
|
||||||
|
|
||||||
xsdt = (struct acpi_table_xsdt *) __va(rsdp->xsdt_address);
|
xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address);
|
||||||
hdr = &xsdt->header;
|
hdr = &xsdt->header;
|
||||||
if (strncmp(hdr->signature, XSDT_SIG, sizeof(XSDT_SIG) - 1)) {
|
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";
|
return "dig";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(hdr->oem_id, "HP")) {
|
if (!strcmp(hdr->oem_id, "HP")) {
|
||||||
return "hpzx1";
|
return "hpzx1";
|
||||||
}
|
} else if (!strcmp(hdr->oem_id, "SGI")) {
|
||||||
else if (!strcmp(hdr->oem_id, "SGI")) {
|
|
||||||
return "sn2";
|
return "sn2";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ acpi_get_sysname (void)
|
|||||||
|
|
||||||
/* Array to record platform interrupt vectors for generic interrupt routing. */
|
/* Array to record platform interrupt vectors for generic interrupt routing. */
|
||||||
int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
|
int platform_intr_list[ACPI_MAX_PLATFORM_INTERRUPTS] = {
|
||||||
[0 ... ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
|
[0...ACPI_MAX_PLATFORM_INTERRUPTS - 1] = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
|
enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_IOSAPIC;
|
||||||
@@ -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
|
* Interrupt routing API for device drivers. Provides interrupt vector for
|
||||||
* a generic platform event. Currently only CPEI is implemented.
|
* a generic platform event. Currently only CPEI is implemented.
|
||||||
*/
|
*/
|
||||||
int
|
int acpi_request_vector(u32 int_type)
|
||||||
acpi_request_vector (u32 int_type)
|
|
||||||
{
|
{
|
||||||
int vector = -1;
|
int vector = -1;
|
||||||
|
|
||||||
@@ -155,12 +155,12 @@ acpi_request_vector (u32 int_type)
|
|||||||
/* corrected platform error interrupt */
|
/* corrected platform error interrupt */
|
||||||
vector = platform_intr_list[int_type];
|
vector = platform_intr_list[int_type];
|
||||||
} else
|
} else
|
||||||
printk(KERN_ERR "acpi_request_vector(): invalid interrupt type\n");
|
printk(KERN_ERR
|
||||||
|
"acpi_request_vector(): invalid interrupt type\n");
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
|
||||||
__acpi_map_table (unsigned long phys_addr, unsigned long size)
|
|
||||||
{
|
{
|
||||||
return __va(phys_addr);
|
return __va(phys_addr);
|
||||||
}
|
}
|
||||||
@@ -169,19 +169,18 @@ __acpi_map_table (unsigned long phys_addr, unsigned long size)
|
|||||||
Boot-time Table Parsing
|
Boot-time Table Parsing
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int total_cpus __initdata;
|
static int total_cpus __initdata;
|
||||||
static int available_cpus __initdata;
|
static int available_cpus __initdata;
|
||||||
struct acpi_table_madt * acpi_madt __initdata;
|
struct acpi_table_madt *acpi_madt __initdata;
|
||||||
static u8 has_8259;
|
static u8 has_8259;
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_lapic_addr_ovr (
|
acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
|
||||||
acpi_table_entry_header *header, const unsigned long end)
|
const unsigned long end)
|
||||||
{
|
{
|
||||||
struct acpi_table_lapic_addr_ovr *lapic;
|
struct acpi_table_lapic_addr_ovr *lapic;
|
||||||
|
|
||||||
lapic = (struct acpi_table_lapic_addr_ovr *) header;
|
lapic = (struct acpi_table_lapic_addr_ovr *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(lapic, end))
|
if (BAD_MADT_ENTRY(lapic, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -193,22 +192,23 @@ acpi_parse_lapic_addr_ovr (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
|
acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
|
||||||
{
|
{
|
||||||
struct acpi_table_lsapic *lsapic;
|
struct acpi_table_lsapic *lsapic;
|
||||||
|
|
||||||
lsapic = (struct acpi_table_lsapic *) header;
|
lsapic = (struct acpi_table_lsapic *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(lsapic, end))
|
if (BAD_MADT_ENTRY(lsapic, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (lsapic->flags.enabled) {
|
if (lsapic->flags.enabled) {
|
||||||
#ifdef CONFIG_SMP
|
#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
|
#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;
|
++available_cpus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,13 +216,12 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
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 *lacpi_nmi;
|
struct acpi_table_lapic_nmi *lacpi_nmi;
|
||||||
|
|
||||||
lacpi_nmi = (struct acpi_table_lapic_nmi*) header;
|
lacpi_nmi = (struct acpi_table_lapic_nmi *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(lacpi_nmi, end))
|
if (BAD_MADT_ENTRY(lacpi_nmi, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -231,13 +230,12 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
|
acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
|
||||||
{
|
{
|
||||||
struct acpi_table_iosapic *iosapic;
|
struct acpi_table_iosapic *iosapic;
|
||||||
|
|
||||||
iosapic = (struct acpi_table_iosapic *) header;
|
iosapic = (struct acpi_table_iosapic *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(iosapic, end))
|
if (BAD_MADT_ENTRY(iosapic, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -245,15 +243,14 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
|
|||||||
return iosapic_init(iosapic->address, iosapic->global_irq_base);
|
return iosapic_init(iosapic->address, iosapic->global_irq_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_plat_int_src (
|
acpi_parse_plat_int_src(acpi_table_entry_header * header,
|
||||||
acpi_table_entry_header *header, const unsigned long end)
|
const unsigned long end)
|
||||||
{
|
{
|
||||||
struct acpi_table_plat_int_src *plintsrc;
|
struct acpi_table_plat_int_src *plintsrc;
|
||||||
int vector;
|
int vector;
|
||||||
|
|
||||||
plintsrc = (struct acpi_table_plat_int_src *) header;
|
plintsrc = (struct acpi_table_plat_int_src *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(plintsrc, end))
|
if (BAD_MADT_ENTRY(plintsrc, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -267,8 +264,12 @@ acpi_parse_plat_int_src (
|
|||||||
plintsrc->iosapic_vector,
|
plintsrc->iosapic_vector,
|
||||||
plintsrc->eid,
|
plintsrc->eid,
|
||||||
plintsrc->id,
|
plintsrc->id,
|
||||||
(plintsrc->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
|
(plintsrc->flags.polarity ==
|
||||||
(plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
|
1) ? IOSAPIC_POL_HIGH :
|
||||||
|
IOSAPIC_POL_LOW,
|
||||||
|
(plintsrc->flags.trigger ==
|
||||||
|
1) ? IOSAPIC_EDGE :
|
||||||
|
IOSAPIC_LEVEL);
|
||||||
|
|
||||||
platform_intr_list[plintsrc->type] = vector;
|
platform_intr_list[plintsrc->type] = vector;
|
||||||
if (acpi_madt_rev > 1) {
|
if (acpi_madt_rev > 1) {
|
||||||
@@ -283,7 +284,6 @@ acpi_parse_plat_int_src (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned int can_cpei_retarget(void)
|
unsigned int can_cpei_retarget(void)
|
||||||
{
|
{
|
||||||
extern int cpe_vector;
|
extern int cpe_vector;
|
||||||
@@ -322,29 +322,30 @@ unsigned int get_cpei_target_cpu(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_int_src_ovr (
|
acpi_parse_int_src_ovr(acpi_table_entry_header * header,
|
||||||
acpi_table_entry_header *header, const unsigned long end)
|
const unsigned long end)
|
||||||
{
|
{
|
||||||
struct acpi_table_int_src_ovr *p;
|
struct acpi_table_int_src_ovr *p;
|
||||||
|
|
||||||
p = (struct acpi_table_int_src_ovr *) header;
|
p = (struct acpi_table_int_src_ovr *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(p, end))
|
if (BAD_MADT_ENTRY(p, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
iosapic_override_isa_irq(p->bus_irq, p->global_irq,
|
iosapic_override_isa_irq(p->bus_irq, p->global_irq,
|
||||||
(p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
|
(p->flags.polarity ==
|
||||||
(p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
|
1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
|
||||||
|
(p->flags.trigger ==
|
||||||
|
1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
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;
|
struct acpi_table_nmi_src *nmi_src;
|
||||||
|
|
||||||
nmi_src = (struct acpi_table_nmi_src*) header;
|
nmi_src = (struct acpi_table_nmi_src *)header;
|
||||||
|
|
||||||
if (BAD_MADT_ENTRY(nmi_src, end))
|
if (BAD_MADT_ENTRY(nmi_src, end))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -353,11 +354,9 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init
|
static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
|
||||||
acpi_madt_oem_check (char *oem_id, char *oem_table_id)
|
|
||||||
{
|
{
|
||||||
if (!strncmp(oem_id, "IBM", 3) &&
|
if (!strncmp(oem_id, "IBM", 3) && (!strncmp(oem_table_id, "SERMOW", 6))) {
|
||||||
(!strncmp(oem_table_id, "SERMOW", 6))) {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unfortunately ITC_DRIFT is not yet part of the
|
* Unfortunately ITC_DRIFT is not yet part of the
|
||||||
@@ -370,19 +369,18 @@ acpi_madt_oem_check (char *oem_id, char *oem_table_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
|
||||||
acpi_parse_madt (unsigned long phys_addr, unsigned long size)
|
|
||||||
{
|
{
|
||||||
if (!phys_addr || !size)
|
if (!phys_addr || !size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
|
acpi_madt = (struct acpi_table_madt *)__va(phys_addr);
|
||||||
|
|
||||||
acpi_madt_rev = acpi_madt->header.revision;
|
acpi_madt_rev = acpi_madt->header.revision;
|
||||||
|
|
||||||
/* remember the value for reference after free_initmem() */
|
/* remember the value for reference after free_initmem() */
|
||||||
#ifdef CONFIG_ITANIUM
|
#ifdef CONFIG_ITANIUM
|
||||||
has_8259 = 1; /* Firmware on old Itanium systems is broken */
|
has_8259 = 1; /* Firmware on old Itanium systems is broken */
|
||||||
#else
|
#else
|
||||||
has_8259 = acpi_madt->flags.pcat_compat;
|
has_8259 = acpi_madt->flags.pcat_compat;
|
||||||
#endif
|
#endif
|
||||||
@@ -396,19 +394,18 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
|
|||||||
printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
|
printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
|
||||||
|
|
||||||
acpi_madt_oem_check(acpi_madt->header.oem_id,
|
acpi_madt_oem_check(acpi_madt->header.oem_id,
|
||||||
acpi_madt->header.oem_table_id);
|
acpi_madt->header.oem_table_id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_NUMA
|
#ifdef CONFIG_ACPI_NUMA
|
||||||
|
|
||||||
#undef SLIT_DEBUG
|
#undef SLIT_DEBUG
|
||||||
|
|
||||||
#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
|
#define PXM_FLAG_LEN ((MAX_PXM_DOMAINS + 1)/32)
|
||||||
|
|
||||||
static int __initdata srat_num_cpus; /* number of cpus */
|
static int __initdata srat_num_cpus; /* number of cpus */
|
||||||
static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
|
static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
|
||||||
#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
|
#define pxm_bit_set(bit) (set_bit(bit,(void *)pxm_flag))
|
||||||
#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
|
#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
|
||||||
@@ -421,15 +418,15 @@ static struct acpi_table_slit __initdata *slit_table;
|
|||||||
* ACPI 2.0 SLIT (System Locality Information Table)
|
* ACPI 2.0 SLIT (System Locality Information Table)
|
||||||
* http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
|
* http://devresource.hp.com/devresource/Docs/TechPapers/IA64/slit.pdf
|
||||||
*/
|
*/
|
||||||
void __init
|
void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
|
||||||
acpi_numa_slit_init (struct acpi_table_slit *slit)
|
|
||||||
{
|
{
|
||||||
u32 len;
|
u32 len;
|
||||||
|
|
||||||
len = sizeof(struct acpi_table_header) + 8
|
len = sizeof(struct acpi_table_header) + 8
|
||||||
+ slit->localities * slit->localities;
|
+ slit->localities * slit->localities;
|
||||||
if (slit->header.length != len) {
|
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);
|
len, slit->header.length);
|
||||||
memset(numa_slit, 10, sizeof(numa_slit));
|
memset(numa_slit, 10, sizeof(numa_slit));
|
||||||
return;
|
return;
|
||||||
@@ -438,19 +435,20 @@ acpi_numa_slit_init (struct acpi_table_slit *slit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void __init
|
void __init
|
||||||
acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa)
|
acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
|
||||||
{
|
{
|
||||||
/* record this node in proximity bitmap */
|
/* record this node in proximity bitmap */
|
||||||
pxm_bit_set(pa->proximity_domain);
|
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 */
|
/* nid should be overridden as logical node id later */
|
||||||
node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
|
node_cpuid[srat_num_cpus].nid = pa->proximity_domain;
|
||||||
srat_num_cpus++;
|
srat_num_cpus++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init
|
void __init
|
||||||
acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
|
acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
|
||||||
{
|
{
|
||||||
unsigned long paddr, size;
|
unsigned long paddr, size;
|
||||||
u8 pxm;
|
u8 pxm;
|
||||||
@@ -487,8 +485,7 @@ acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma)
|
|||||||
num_node_memblks++;
|
num_node_memblks++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init
|
void __init acpi_numa_arch_fixup(void)
|
||||||
acpi_numa_arch_fixup (void)
|
|
||||||
{
|
{
|
||||||
int i, j, node_from, node_to;
|
int i, j, node_from, node_to;
|
||||||
|
|
||||||
@@ -534,21 +531,24 @@ acpi_numa_arch_fixup (void)
|
|||||||
for (i = 0; i < srat_num_cpus; i++)
|
for (i = 0; i < srat_num_cpus; i++)
|
||||||
node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
|
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 logical nodes in system = %d\n",
|
||||||
printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
|
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));
|
memset(numa_slit, -1, sizeof(numa_slit));
|
||||||
for (i=0; i<slit_table->localities; i++) {
|
for (i = 0; i < slit_table->localities; i++) {
|
||||||
if (!pxm_bit_test(i))
|
if (!pxm_bit_test(i))
|
||||||
continue;
|
continue;
|
||||||
node_from = pxm_to_nid_map[i];
|
node_from = pxm_to_nid_map[i];
|
||||||
for (j=0; j<slit_table->localities; j++) {
|
for (j = 0; j < slit_table->localities; j++) {
|
||||||
if (!pxm_bit_test(j))
|
if (!pxm_bit_test(j))
|
||||||
continue;
|
continue;
|
||||||
node_to = pxm_to_nid_map[j];
|
node_to = pxm_to_nid_map[j];
|
||||||
node_distance(node_from, node_to) =
|
node_distance(node_from, node_to) =
|
||||||
slit_table->entry[i*slit_table->localities + j];
|
slit_table->entry[i * slit_table->localities + j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -556,40 +556,43 @@ acpi_numa_arch_fixup (void)
|
|||||||
printk("ACPI 2.0 SLIT locality table:\n");
|
printk("ACPI 2.0 SLIT locality table:\n");
|
||||||
for_each_online_node(i) {
|
for_each_online_node(i) {
|
||||||
for_each_online_node(j)
|
for_each_online_node(j)
|
||||||
printk("%03d ", node_distance(i,j));
|
printk("%03d ", node_distance(i, j));
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_ACPI_NUMA */
|
#endif /* CONFIG_ACPI_NUMA */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* success: return IRQ number (>=0)
|
* success: return IRQ number (>=0)
|
||||||
* failure: return < 0
|
* failure: return < 0
|
||||||
*/
|
*/
|
||||||
int
|
int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
|
||||||
acpi_register_gsi (u32 gsi, int edge_level, int active_high_low)
|
|
||||||
{
|
{
|
||||||
if (has_8259 && gsi < 16)
|
if (has_8259 && gsi < 16)
|
||||||
return isa_irq_to_vector(gsi);
|
return isa_irq_to_vector(gsi);
|
||||||
|
|
||||||
return iosapic_register_intr(gsi,
|
return iosapic_register_intr(gsi,
|
||||||
(active_high_low == ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
|
(active_high_low ==
|
||||||
(edge_level == ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
|
ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
|
||||||
|
IOSAPIC_POL_LOW,
|
||||||
|
(edge_level ==
|
||||||
|
ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
|
||||||
|
IOSAPIC_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_register_gsi);
|
EXPORT_SYMBOL(acpi_register_gsi);
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
|
#ifdef CONFIG_ACPI_DEALLOCATE_IRQ
|
||||||
void
|
void acpi_unregister_gsi(u32 gsi)
|
||||||
acpi_unregister_gsi (u32 gsi)
|
|
||||||
{
|
{
|
||||||
iosapic_unregister_intr(gsi);
|
iosapic_unregister_intr(gsi);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_unregister_gsi);
|
|
||||||
#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
|
|
||||||
|
|
||||||
static int __init
|
EXPORT_SYMBOL(acpi_unregister_gsi);
|
||||||
acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
|
#endif /* CONFIG_ACPI_DEALLOCATE_IRQ */
|
||||||
|
|
||||||
|
static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size)
|
||||||
{
|
{
|
||||||
struct acpi_table_header *fadt_header;
|
struct acpi_table_header *fadt_header;
|
||||||
struct fadt_descriptor_rev2 *fadt;
|
struct fadt_descriptor_rev2 *fadt;
|
||||||
@@ -597,11 +600,11 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
|
|||||||
if (!phys_addr || !size)
|
if (!phys_addr || !size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
fadt_header = (struct acpi_table_header *) __va(phys_addr);
|
fadt_header = (struct acpi_table_header *)__va(phys_addr);
|
||||||
if (fadt_header->revision != 3)
|
if (fadt_header->revision != 3)
|
||||||
return -ENODEV; /* Only deal with ACPI 2.0 FADT */
|
return -ENODEV; /* Only deal with ACPI 2.0 FADT */
|
||||||
|
|
||||||
fadt = (struct fadt_descriptor_rev2 *) fadt_header;
|
fadt = (struct fadt_descriptor_rev2 *)fadt_header;
|
||||||
|
|
||||||
if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
|
if (!(fadt->iapc_boot_arch & BAF_8042_KEYBOARD_CONTROLLER))
|
||||||
acpi_kbd_controller_present = 0;
|
acpi_kbd_controller_present = 0;
|
||||||
@@ -613,22 +616,19 @@ acpi_parse_fadt (unsigned long phys_addr, unsigned long size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long __init acpi_find_rsdp(void)
|
||||||
unsigned long __init
|
|
||||||
acpi_find_rsdp (void)
|
|
||||||
{
|
{
|
||||||
unsigned long rsdp_phys = 0;
|
unsigned long rsdp_phys = 0;
|
||||||
|
|
||||||
if (efi.acpi20)
|
if (efi.acpi20)
|
||||||
rsdp_phys = __pa(efi.acpi20);
|
rsdp_phys = __pa(efi.acpi20);
|
||||||
else if (efi.acpi)
|
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;
|
return rsdp_phys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __init acpi_boot_init(void)
|
||||||
int __init
|
|
||||||
acpi_boot_init (void)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -646,31 +646,43 @@ acpi_boot_init (void)
|
|||||||
|
|
||||||
/* Local APIC */
|
/* Local APIC */
|
||||||
|
|
||||||
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0)
|
if (acpi_table_parse_madt
|
||||||
printk(KERN_ERR PREFIX "Error parsing LAPIC address override entry\n");
|
(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)
|
if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS)
|
||||||
printk(KERN_ERR PREFIX "Error parsing MADT - no LAPIC entries\n");
|
< 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");
|
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
|
||||||
|
|
||||||
/* I/O APIC */
|
/* I/O APIC */
|
||||||
|
|
||||||
if (acpi_table_parse_madt(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
|
if (acpi_table_parse_madt
|
||||||
printk(KERN_ERR PREFIX "Error parsing MADT - no IOSAPIC entries\n");
|
(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
|
||||||
|
printk(KERN_ERR PREFIX
|
||||||
|
"Error parsing MADT - no IOSAPIC entries\n");
|
||||||
|
|
||||||
/* System-Level Interrupt Routing */
|
/* System-Level Interrupt Routing */
|
||||||
|
|
||||||
if (acpi_table_parse_madt(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
|
if (acpi_table_parse_madt
|
||||||
printk(KERN_ERR PREFIX "Error parsing platform interrupt source entry\n");
|
(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)
|
if (acpi_table_parse_madt
|
||||||
printk(KERN_ERR PREFIX "Error parsing interrupt source overrides entry\n");
|
(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)
|
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");
|
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
|
||||||
skip_madt:
|
skip_madt:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FADT says whether a legacy keyboard controller is present.
|
* FADT says whether a legacy keyboard controller is present.
|
||||||
@@ -685,8 +697,9 @@ acpi_boot_init (void)
|
|||||||
if (available_cpus == 0) {
|
if (available_cpus == 0) {
|
||||||
printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
|
printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
|
||||||
printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
|
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] =
|
||||||
available_cpus = 1; /* We've got at least one of these, no? */
|
hard_smp_processor_id();
|
||||||
|
available_cpus = 1; /* We've got at least one of these, no? */
|
||||||
}
|
}
|
||||||
smp_boot_data.cpu_count = available_cpus;
|
smp_boot_data.cpu_count = available_cpus;
|
||||||
|
|
||||||
@@ -695,8 +708,10 @@ acpi_boot_init (void)
|
|||||||
if (srat_num_cpus == 0) {
|
if (srat_num_cpus == 0) {
|
||||||
int cpu, i = 1;
|
int cpu, i = 1;
|
||||||
for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
|
for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
|
||||||
if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
|
if (smp_boot_data.cpu_phys_id[cpu] !=
|
||||||
node_cpuid[i++].phys_id = 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
|
||||||
#endif
|
#endif
|
||||||
@@ -704,12 +719,12 @@ acpi_boot_init (void)
|
|||||||
build_cpu_to_node_map();
|
build_cpu_to_node_map();
|
||||||
#endif
|
#endif
|
||||||
/* Make boot-up look pretty */
|
/* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
|
||||||
acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
|
|
||||||
{
|
{
|
||||||
int vector;
|
int vector;
|
||||||
|
|
||||||
@@ -730,11 +745,10 @@ acpi_gsi_to_irq (u32 gsi, unsigned int *irq)
|
|||||||
*/
|
*/
|
||||||
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
||||||
static
|
static
|
||||||
int
|
int acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
|
||||||
acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
|
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ACPI_NUMA
|
#ifdef CONFIG_ACPI_NUMA
|
||||||
int pxm_id;
|
int pxm_id;
|
||||||
|
|
||||||
pxm_id = acpi_get_pxm(handle);
|
pxm_id = acpi_get_pxm(handle);
|
||||||
|
|
||||||
@@ -742,19 +756,16 @@ acpi_map_cpu2node(acpi_handle handle, int cpu, long physid)
|
|||||||
* Assuming that the container driver would have set the proximity
|
* Assuming that the container driver would have set the proximity
|
||||||
* domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
|
* domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
|
||||||
*/
|
*/
|
||||||
node_cpuid[cpu].nid = (pxm_id < 0) ? 0:
|
node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
|
||||||
pxm_to_nid_map[pxm_id];
|
|
||||||
|
|
||||||
node_cpuid[cpu].phys_id = physid;
|
node_cpuid[cpu].phys_id = physid;
|
||||||
#endif
|
#endif
|
||||||
return(0);
|
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};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
struct acpi_table_lsapic *lsapic;
|
struct acpi_table_lsapic *lsapic;
|
||||||
cpumask_t tmp_map;
|
cpumask_t tmp_map;
|
||||||
@@ -764,7 +775,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
|
|||||||
if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
|
if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!buffer.length || !buffer.pointer)
|
if (!buffer.length || !buffer.pointer)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
obj = buffer.pointer;
|
obj = buffer.pointer;
|
||||||
@@ -782,7 +793,7 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
physid = ((lsapic->id <<8) | (lsapic->eid));
|
physid = ((lsapic->id << 8) | (lsapic->eid));
|
||||||
|
|
||||||
acpi_os_free(buffer.pointer);
|
acpi_os_free(buffer.pointer);
|
||||||
buffer.length = ACPI_ALLOCATE_BUFFER;
|
buffer.length = ACPI_ALLOCATE_BUFFER;
|
||||||
@@ -790,50 +801,49 @@ acpi_map_lsapic(acpi_handle handle, int *pcpu)
|
|||||||
|
|
||||||
cpus_complement(tmp_map, cpu_present_map);
|
cpus_complement(tmp_map, cpu_present_map);
|
||||||
cpu = first_cpu(tmp_map);
|
cpu = first_cpu(tmp_map);
|
||||||
if(cpu >= NR_CPUS)
|
if (cpu >= NR_CPUS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
acpi_map_cpu2node(handle, cpu, physid);
|
acpi_map_cpu2node(handle, cpu, physid);
|
||||||
|
|
||||||
cpu_set(cpu, cpu_present_map);
|
cpu_set(cpu, cpu_present_map);
|
||||||
ia64_cpu_to_sapicid[cpu] = physid;
|
ia64_cpu_to_sapicid[cpu] = physid;
|
||||||
ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
|
ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu];
|
||||||
|
|
||||||
*pcpu = cpu;
|
*pcpu = cpu;
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_map_lsapic);
|
EXPORT_SYMBOL(acpi_map_lsapic);
|
||||||
|
|
||||||
|
int acpi_unmap_lsapic(int cpu)
|
||||||
int
|
|
||||||
acpi_unmap_lsapic(int cpu)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i<MAX_SAPICS; i++) {
|
for (i = 0; i < MAX_SAPICS; i++) {
|
||||||
if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
|
if (ia64_acpiid_to_sapicid[i] == ia64_cpu_to_sapicid[cpu]) {
|
||||||
ia64_acpiid_to_sapicid[i] = -1;
|
ia64_acpiid_to_sapicid[i] = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ia64_cpu_to_sapicid[cpu] = -1;
|
ia64_cpu_to_sapicid[cpu] = -1;
|
||||||
cpu_clear(cpu,cpu_present_map);
|
cpu_clear(cpu, cpu_present_map);
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_NUMA
|
#ifdef CONFIG_ACPI_NUMA
|
||||||
/* NUMA specific cleanup's */
|
/* NUMA specific cleanup's */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_unmap_lsapic);
|
|
||||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_unmap_lsapic);
|
||||||
|
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_NUMA
|
#ifdef CONFIG_ACPI_NUMA
|
||||||
acpi_status __devinit
|
acpi_status __devinit
|
||||||
acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
|
acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
|
||||||
{
|
{
|
||||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
struct acpi_table_iosapic *iosapic;
|
struct acpi_table_iosapic *iosapic;
|
||||||
unsigned int gsi_base;
|
unsigned int gsi_base;
|
||||||
@@ -882,10 +892,9 @@ acpi_map_iosapic (acpi_handle handle, u32 depth, void *context, void **ret)
|
|||||||
map_iosapic_to_node(gsi_base, node);
|
map_iosapic_to_node(gsi_base, node);
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NUMA */
|
#endif /* CONFIG_NUMA */
|
||||||
|
|
||||||
int
|
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base)
|
||||||
acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
|
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -894,17 +903,18 @@ acpi_register_ioapic (acpi_handle handle, u64 phys_addr, u32 gsi_base)
|
|||||||
|
|
||||||
#if CONFIG_ACPI_NUMA
|
#if CONFIG_ACPI_NUMA
|
||||||
acpi_map_iosapic(handle, 0, NULL, NULL);
|
acpi_map_iosapic(handle, 0, NULL, NULL);
|
||||||
#endif /* CONFIG_ACPI_NUMA */
|
#endif /* CONFIG_ACPI_NUMA */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_register_ioapic);
|
EXPORT_SYMBOL(acpi_register_ioapic);
|
||||||
|
|
||||||
int
|
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base)
|
||||||
acpi_unregister_ioapic (acpi_handle handle, u32 gsi_base)
|
|
||||||
{
|
{
|
||||||
return iosapic_remove(gsi_base);
|
return iosapic_remove(gsi_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_unregister_ioapic);
|
EXPORT_SYMBOL(acpi_unregister_ioapic);
|
||||||
|
|
||||||
#endif /* CONFIG_ACPI_BOOT */
|
#endif /* CONFIG_ACPI_BOOT */
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
#include <asm/proto.h>
|
#include <asm/proto.h>
|
||||||
#include <asm/tlbflush.h>
|
#include <asm/tlbflush.h>
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Low-Level Sleep Support
|
Low-Level Sleep Support
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
@@ -77,11 +76,12 @@ static void init_low_mapping(void)
|
|||||||
* Create an identity mapped page table and copy the wakeup routine to
|
* Create an identity mapped page table and copy the wakeup routine to
|
||||||
* low memory.
|
* low memory.
|
||||||
*/
|
*/
|
||||||
int acpi_save_state_mem (void)
|
int acpi_save_state_mem(void)
|
||||||
{
|
{
|
||||||
init_low_mapping();
|
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);
|
acpi_copy_wakeup_routine(acpi_wakeup_address);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -90,7 +90,7 @@ int acpi_save_state_mem (void)
|
|||||||
/*
|
/*
|
||||||
* acpi_restore_state
|
* acpi_restore_state
|
||||||
*/
|
*/
|
||||||
void acpi_restore_state_mem (void)
|
void acpi_restore_state_mem(void)
|
||||||
{
|
{
|
||||||
set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
|
set_pgd(pgd_offset(current->mm, 0UL), low_ptr);
|
||||||
flush_tlb_all();
|
flush_tlb_all();
|
||||||
@@ -108,7 +108,8 @@ void __init acpi_reserve_bootmem(void)
|
|||||||
{
|
{
|
||||||
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
|
acpi_wakeup_address = (unsigned long)alloc_bootmem_low(PAGE_SIZE);
|
||||||
if ((&wakeup_end - &wakeup_start) > 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)
|
static int __init acpi_sleep_setup(char *str)
|
||||||
@@ -127,6 +128,8 @@ static int __init acpi_sleep_setup(char *str)
|
|||||||
|
|
||||||
__setup("acpi_sleep=", acpi_sleep_setup);
|
__setup("acpi_sleep=", acpi_sleep_setup);
|
||||||
|
|
||||||
#endif /*CONFIG_ACPI_SLEEP*/
|
#endif /*CONFIG_ACPI_SLEEP */
|
||||||
|
|
||||||
void acpi_pci_link_exit(void) {}
|
void acpi_pci_link_exit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define ACPI_AC_COMPONENT 0x00020000
|
#define ACPI_AC_COMPONENT 0x00020000
|
||||||
#define ACPI_AC_CLASS "ac_adapter"
|
#define ACPI_AC_CLASS "ac_adapter"
|
||||||
#define ACPI_AC_HID "ACPI0003"
|
#define ACPI_AC_HID "ACPI0003"
|
||||||
@@ -45,47 +44,45 @@
|
|||||||
#define ACPI_AC_STATUS_UNKNOWN 0xFF
|
#define ACPI_AC_STATUS_UNKNOWN 0xFF
|
||||||
|
|
||||||
#define _COMPONENT ACPI_AC_COMPONENT
|
#define _COMPONENT ACPI_AC_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_ac")
|
ACPI_MODULE_NAME("acpi_ac")
|
||||||
|
|
||||||
MODULE_AUTHOR("Paul Diefenbaugh");
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
||||||
MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
|
MODULE_DESCRIPTION(ACPI_AC_DRIVER_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
static int acpi_ac_add (struct acpi_device *device);
|
static int acpi_ac_add(struct acpi_device *device);
|
||||||
static int acpi_ac_remove (struct acpi_device *device, int type);
|
static int acpi_ac_remove(struct acpi_device *device, int type);
|
||||||
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
|
static int acpi_ac_open_fs(struct inode *inode, struct file *file);
|
||||||
|
|
||||||
static struct acpi_driver acpi_ac_driver = {
|
static struct acpi_driver acpi_ac_driver = {
|
||||||
.name = ACPI_AC_DRIVER_NAME,
|
.name = ACPI_AC_DRIVER_NAME,
|
||||||
.class = ACPI_AC_CLASS,
|
.class = ACPI_AC_CLASS,
|
||||||
.ids = ACPI_AC_HID,
|
.ids = ACPI_AC_HID,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_ac_add,
|
.add = acpi_ac_add,
|
||||||
.remove = acpi_ac_remove,
|
.remove = acpi_ac_remove,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_ac {
|
struct acpi_ac {
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
unsigned long state;
|
unsigned long state;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct file_operations acpi_ac_fops = {
|
static struct file_operations acpi_ac_fops = {
|
||||||
.open = acpi_ac_open_fs,
|
.open = acpi_ac_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
AC Adapter Management
|
AC Adapter Management
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int acpi_ac_get_state(struct acpi_ac *ac)
|
||||||
acpi_ac_get_state (
|
|
||||||
struct acpi_ac *ac)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_get_state");
|
ACPI_FUNCTION_TRACE("acpi_ac_get_state");
|
||||||
|
|
||||||
@@ -95,7 +92,7 @@ acpi_ac_get_state (
|
|||||||
status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
|
status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error reading AC Adapter state\n"));
|
"Error reading AC Adapter state\n"));
|
||||||
ac->state = ACPI_AC_STATUS_UNKNOWN;
|
ac->state = ACPI_AC_STATUS_UNKNOWN;
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
@@ -103,16 +100,15 @@ acpi_ac_get_state (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
FS Interface (/proc)
|
FS Interface (/proc)
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct proc_dir_entry *acpi_ac_dir;
|
static struct proc_dir_entry *acpi_ac_dir;
|
||||||
|
|
||||||
static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
|
static int acpi_ac_seq_show(struct seq_file *seq, void *offset)
|
||||||
{
|
{
|
||||||
struct acpi_ac *ac = (struct acpi_ac *) seq->private;
|
struct acpi_ac *ac = (struct acpi_ac *)seq->private;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
|
ACPI_FUNCTION_TRACE("acpi_ac_seq_show");
|
||||||
|
|
||||||
@@ -145,17 +141,15 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file)
|
|||||||
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
|
return single_open(file, acpi_ac_seq_show, PDE(inode)->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_ac_add_fs(struct acpi_device *device)
|
||||||
acpi_ac_add_fs (
|
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry = NULL;
|
struct proc_dir_entry *entry = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
|
ACPI_FUNCTION_TRACE("acpi_ac_add_fs");
|
||||||
|
|
||||||
if (!acpi_device_dir(device)) {
|
if (!acpi_device_dir(device)) {
|
||||||
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
||||||
acpi_ac_dir);
|
acpi_ac_dir);
|
||||||
if (!acpi_device_dir(device))
|
if (!acpi_device_dir(device))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
acpi_device_dir(device)->owner = THIS_MODULE;
|
acpi_device_dir(device)->owner = THIS_MODULE;
|
||||||
@@ -163,11 +157,11 @@ acpi_ac_add_fs (
|
|||||||
|
|
||||||
/* 'state' [R] */
|
/* 'state' [R] */
|
||||||
entry = create_proc_entry(ACPI_AC_FILE_STATE,
|
entry = create_proc_entry(ACPI_AC_FILE_STATE,
|
||||||
S_IRUGO, acpi_device_dir(device));
|
S_IRUGO, acpi_device_dir(device));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_AC_FILE_STATE));
|
ACPI_AC_FILE_STATE));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_ac_fops;
|
entry->proc_fops = &acpi_ac_fops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -177,16 +171,12 @@ acpi_ac_add_fs (
|
|||||||
return_VALUE(0);
|
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");
|
ACPI_FUNCTION_TRACE("acpi_ac_remove_fs");
|
||||||
|
|
||||||
if (acpi_device_dir(device)) {
|
if (acpi_device_dir(device)) {
|
||||||
remove_proc_entry(ACPI_AC_FILE_STATE,
|
remove_proc_entry(ACPI_AC_FILE_STATE, acpi_device_dir(device));
|
||||||
acpi_device_dir(device));
|
|
||||||
|
|
||||||
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
|
remove_proc_entry(acpi_device_bid(device), acpi_ac_dir);
|
||||||
acpi_device_dir(device) = NULL;
|
acpi_device_dir(device) = NULL;
|
||||||
@@ -195,19 +185,14 @@ acpi_ac_remove_fs (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Driver Model
|
Driver Model
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
|
||||||
acpi_ac_notify (
|
|
||||||
acpi_handle handle,
|
|
||||||
u32 event,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
struct acpi_ac *ac = (struct acpi_ac *) data;
|
struct acpi_ac *ac = (struct acpi_ac *)data;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_notify");
|
ACPI_FUNCTION_TRACE("acpi_ac_notify");
|
||||||
|
|
||||||
@@ -224,21 +209,18 @@ acpi_ac_notify (
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Unsupported event [0x%x]\n", event));
|
"Unsupported event [0x%x]\n", event));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int acpi_ac_add(struct acpi_device *device)
|
||||||
static int
|
|
||||||
acpi_ac_add (
|
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_ac *ac = NULL;
|
struct acpi_ac *ac = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_add");
|
ACPI_FUNCTION_TRACE("acpi_ac_add");
|
||||||
|
|
||||||
@@ -264,19 +246,20 @@ acpi_ac_add (
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
status = acpi_install_notify_handler(ac->handle,
|
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)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error installing notify handler\n"));
|
"Error installing notify handler\n"));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
||||||
acpi_device_name(device), acpi_device_bid(device),
|
acpi_device_name(device), acpi_device_bid(device),
|
||||||
ac->state?"on-line":"off-line");
|
ac->state ? "on-line" : "off-line");
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (result) {
|
if (result) {
|
||||||
acpi_ac_remove_fs(device);
|
acpi_ac_remove_fs(device);
|
||||||
kfree(ac);
|
kfree(ac);
|
||||||
@@ -285,27 +268,23 @@ end:
|
|||||||
return_VALUE(result);
|
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;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_ac *ac = NULL;
|
struct acpi_ac *ac = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_remove");
|
ACPI_FUNCTION_TRACE("acpi_ac_remove");
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
ac = (struct acpi_ac *) acpi_driver_data(device);
|
ac = (struct acpi_ac *)acpi_driver_data(device);
|
||||||
|
|
||||||
status = acpi_remove_notify_handler(ac->handle,
|
status = acpi_remove_notify_handler(ac->handle,
|
||||||
ACPI_DEVICE_NOTIFY, acpi_ac_notify);
|
ACPI_DEVICE_NOTIFY, acpi_ac_notify);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error removing notify handler\n"));
|
"Error removing notify handler\n"));
|
||||||
|
|
||||||
acpi_ac_remove_fs(device);
|
acpi_ac_remove_fs(device);
|
||||||
|
|
||||||
@@ -314,11 +293,9 @@ acpi_ac_remove (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init acpi_ac_init(void)
|
||||||
static int __init
|
|
||||||
acpi_ac_init (void)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_init");
|
ACPI_FUNCTION_TRACE("acpi_ac_init");
|
||||||
|
|
||||||
@@ -336,9 +313,7 @@ acpi_ac_init (void)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __exit acpi_ac_exit(void)
|
||||||
static void __exit
|
|
||||||
acpi_ac_exit (void)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("acpi_ac_exit");
|
ACPI_FUNCTION_TRACE("acpi_ac_exit");
|
||||||
|
|
||||||
@@ -349,6 +324,5 @@ acpi_ac_exit (void)
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module_init(acpi_ac_init);
|
module_init(acpi_ac_init);
|
||||||
module_exit(acpi_ac_exit);
|
module_exit(acpi_ac_exit);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <linux/memory_hotplug.h>
|
#include <linux/memory_hotplug.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
|
#define ACPI_MEMORY_DEVICE_COMPONENT 0x08000000UL
|
||||||
#define ACPI_MEMORY_DEVICE_CLASS "memory"
|
#define ACPI_MEMORY_DEVICE_CLASS "memory"
|
||||||
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
|
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
|
||||||
@@ -41,8 +40,8 @@
|
|||||||
|
|
||||||
#define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT
|
#define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT
|
||||||
|
|
||||||
ACPI_MODULE_NAME ("acpi_memory")
|
ACPI_MODULE_NAME("acpi_memory")
|
||||||
MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
|
MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>");
|
||||||
MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
|
MODULE_DESCRIPTION(ACPI_MEMORY_DEVICE_DRIVER_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
@@ -56,34 +55,33 @@ MODULE_LICENSE("GPL");
|
|||||||
#define MEMORY_POWER_ON_STATE 1
|
#define MEMORY_POWER_ON_STATE 1
|
||||||
#define MEMORY_POWER_OFF_STATE 2
|
#define MEMORY_POWER_OFF_STATE 2
|
||||||
|
|
||||||
static int acpi_memory_device_add (struct acpi_device *device);
|
static int acpi_memory_device_add(struct acpi_device *device);
|
||||||
static int acpi_memory_device_remove (struct acpi_device *device, int type);
|
static int acpi_memory_device_remove(struct acpi_device *device, int type);
|
||||||
|
|
||||||
static struct acpi_driver acpi_memory_device_driver = {
|
static struct acpi_driver acpi_memory_device_driver = {
|
||||||
.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
|
.name = ACPI_MEMORY_DEVICE_DRIVER_NAME,
|
||||||
.class = ACPI_MEMORY_DEVICE_CLASS,
|
.class = ACPI_MEMORY_DEVICE_CLASS,
|
||||||
.ids = ACPI_MEMORY_DEVICE_HID,
|
.ids = ACPI_MEMORY_DEVICE_HID,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_memory_device_add,
|
.add = acpi_memory_device_add,
|
||||||
.remove = acpi_memory_device_remove,
|
.remove = acpi_memory_device_remove,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_memory_device {
|
struct acpi_memory_device {
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
unsigned int state; /* State of the memory device */
|
unsigned int state; /* State of the memory device */
|
||||||
unsigned short cache_attribute; /* memory cache attribute */
|
unsigned short cache_attribute; /* memory cache attribute */
|
||||||
unsigned short read_write_attribute;/* memory read/write attribute */
|
unsigned short read_write_attribute; /* memory read/write attribute */
|
||||||
u64 start_addr; /* Memory Range start physical addr */
|
u64 start_addr; /* Memory Range start physical addr */
|
||||||
u64 end_addr; /* Memory Range end physical addr */
|
u64 end_addr; /* Memory Range end physical addr */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
struct acpi_resource *resource = NULL;
|
struct acpi_resource *resource = NULL;
|
||||||
struct acpi_resource_address64 address64;
|
struct acpi_resource_address64 address64;
|
||||||
|
|
||||||
@@ -94,15 +92,15 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
|||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
resource = (struct acpi_resource *) buffer.pointer;
|
resource = (struct acpi_resource *)buffer.pointer;
|
||||||
status = acpi_resource_to_address64(resource, &address64);
|
status = acpi_resource_to_address64(resource, &address64);
|
||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
if (address64.resource_type == ACPI_MEMORY_RANGE) {
|
if (address64.resource_type == ACPI_MEMORY_RANGE) {
|
||||||
/* Populate the structure */
|
/* Populate the structure */
|
||||||
mem_device->cache_attribute =
|
mem_device->cache_attribute =
|
||||||
address64.attribute.memory.cache_attribute;
|
address64.attribute.memory.cache_attribute;
|
||||||
mem_device->read_write_attribute =
|
mem_device->read_write_attribute =
|
||||||
address64.attribute.memory.read_write_attribute;
|
address64.attribute.memory.read_write_attribute;
|
||||||
mem_device->start_addr = address64.min_address_range;
|
mem_device->start_addr = address64.min_address_range;
|
||||||
mem_device->end_addr = address64.max_address_range;
|
mem_device->end_addr = address64.max_address_range;
|
||||||
}
|
}
|
||||||
@@ -114,7 +112,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_memory_get_device(acpi_handle handle,
|
acpi_memory_get_device(acpi_handle handle,
|
||||||
struct acpi_memory_device **mem_device)
|
struct acpi_memory_device **mem_device)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_handle phandle;
|
acpi_handle phandle;
|
||||||
@@ -128,8 +126,7 @@ acpi_memory_get_device(acpi_handle handle,
|
|||||||
|
|
||||||
status = acpi_get_parent(handle, &phandle);
|
status = acpi_get_parent(handle, &phandle);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n"));
|
||||||
"Error in acpi_get_parent\n"));
|
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +134,7 @@ acpi_memory_get_device(acpi_handle handle,
|
|||||||
status = acpi_bus_get_device(phandle, &pdevice);
|
status = acpi_bus_get_device(phandle, &pdevice);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error in acpi_bus_get_device\n"));
|
"Error in acpi_bus_get_device\n"));
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,23 +144,21 @@ acpi_memory_get_device(acpi_handle handle,
|
|||||||
*/
|
*/
|
||||||
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
|
status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n"));
|
||||||
"Error in acpi_bus_add\n"));
|
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
*mem_device = acpi_driver_data(device);
|
*mem_device = acpi_driver_data(device);
|
||||||
if (!(*mem_device)) {
|
if (!(*mem_device)) {
|
||||||
printk(KERN_ERR "\n driver data not found" );
|
printk(KERN_ERR "\n driver data not found");
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
||||||
acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
|
||||||
{
|
{
|
||||||
unsigned long current_status;
|
unsigned long current_status;
|
||||||
|
|
||||||
@@ -171,22 +166,21 @@ acpi_memory_check_device(struct acpi_memory_device *mem_device)
|
|||||||
|
|
||||||
/* Get device present/absent information from the _STA */
|
/* Get device present/absent information from the _STA */
|
||||||
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
|
if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
|
||||||
NULL, ¤t_status)))
|
NULL, ¤t_status)))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
/*
|
/*
|
||||||
* Check for device status. Device should be
|
* Check for device status. Device should be
|
||||||
* present/enabled/functioning.
|
* present/enabled/functioning.
|
||||||
*/
|
*/
|
||||||
if (!((current_status & ACPI_MEMORY_STA_PRESENT)
|
if (!((current_status & ACPI_MEMORY_STA_PRESENT)
|
||||||
&& (current_status & ACPI_MEMORY_STA_ENABLED)
|
&& (current_status & ACPI_MEMORY_STA_ENABLED)
|
||||||
&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
|
&& (current_status & ACPI_MEMORY_STA_FUNCTIONAL)))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
||||||
acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@@ -196,7 +190,7 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
|||||||
result = acpi_memory_get_device_resources(mem_device);
|
result = acpi_memory_get_device_resources(mem_device);
|
||||||
if (result) {
|
if (result) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"\nget_device_resources failed\n"));
|
"\nget_device_resources failed\n"));
|
||||||
mem_device->state = MEMORY_INVALID_STATE;
|
mem_device->state = MEMORY_INVALID_STATE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -206,11 +200,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
|||||||
* Note: Assume that this function returns zero on success
|
* Note: Assume that this function returns zero on success
|
||||||
*/
|
*/
|
||||||
result = add_memory(mem_device->start_addr,
|
result = add_memory(mem_device->start_addr,
|
||||||
(mem_device->end_addr - mem_device->start_addr) + 1,
|
(mem_device->end_addr - mem_device->start_addr) + 1,
|
||||||
mem_device->read_write_attribute);
|
mem_device->read_write_attribute);
|
||||||
if (result) {
|
if (result) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n"));
|
||||||
"\nadd_memory failed\n"));
|
|
||||||
mem_device->state = MEMORY_INVALID_STATE;
|
mem_device->state = MEMORY_INVALID_STATE;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -218,11 +211,10 @@ acpi_memory_enable_device(struct acpi_memory_device *mem_device)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
||||||
acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_object_list arg_list;
|
struct acpi_object_list arg_list;
|
||||||
union acpi_object arg;
|
union acpi_object arg;
|
||||||
unsigned long current_status;
|
unsigned long current_status;
|
||||||
|
|
||||||
@@ -234,16 +226,16 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
|||||||
arg.type = ACPI_TYPE_INTEGER;
|
arg.type = ACPI_TYPE_INTEGER;
|
||||||
arg.integer.value = 1;
|
arg.integer.value = 1;
|
||||||
status = acpi_evaluate_object(mem_device->handle,
|
status = acpi_evaluate_object(mem_device->handle,
|
||||||
"_EJ0", &arg_list, NULL);
|
"_EJ0", &arg_list, NULL);
|
||||||
/* Return on _EJ0 failure */
|
/* Return on _EJ0 failure */
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"_EJ0 failed.\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n"));
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evalute _STA to check if the device is disabled */
|
/* Evalute _STA to check if the device is disabled */
|
||||||
status = acpi_evaluate_integer(mem_device->handle, "_STA",
|
status = acpi_evaluate_integer(mem_device->handle, "_STA",
|
||||||
NULL, ¤t_status);
|
NULL, ¤t_status);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
|
|
||||||
@@ -254,8 +246,7 @@ acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
||||||
acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
u64 start = mem_device->start_addr;
|
u64 start = mem_device->start_addr;
|
||||||
@@ -278,7 +269,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
|||||||
result = acpi_memory_powerdown_device(mem_device);
|
result = acpi_memory_powerdown_device(mem_device);
|
||||||
if (result) {
|
if (result) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Device Power Down failed.\n"));
|
"Device Power Down failed.\n"));
|
||||||
/* Set the status of the device to invalid */
|
/* Set the status of the device to invalid */
|
||||||
mem_device->state = MEMORY_INVALID_STATE;
|
mem_device->state = MEMORY_INVALID_STATE;
|
||||||
return result;
|
return result;
|
||||||
@@ -288,8 +279,7 @@ acpi_memory_disable_device(struct acpi_memory_device *mem_device)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
||||||
acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
|
||||||
{
|
{
|
||||||
struct acpi_memory_device *mem_device;
|
struct acpi_memory_device *mem_device;
|
||||||
struct acpi_device *device;
|
struct acpi_device *device;
|
||||||
@@ -299,37 +289,37 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
case ACPI_NOTIFY_BUS_CHECK:
|
case ACPI_NOTIFY_BUS_CHECK:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"\nReceived BUS CHECK notification for device\n"));
|
"\nReceived BUS CHECK notification for device\n"));
|
||||||
/* Fall Through */
|
/* Fall Through */
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||||
if (event == ACPI_NOTIFY_DEVICE_CHECK)
|
if (event == ACPI_NOTIFY_DEVICE_CHECK)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"\nReceived DEVICE CHECK notification for device\n"));
|
"\nReceived DEVICE CHECK notification for device\n"));
|
||||||
if (acpi_memory_get_device(handle, &mem_device)) {
|
if (acpi_memory_get_device(handle, &mem_device)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error in finding driver data\n"));
|
"Error in finding driver data\n"));
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!acpi_memory_check_device(mem_device)) {
|
if (!acpi_memory_check_device(mem_device)) {
|
||||||
if (acpi_memory_enable_device(mem_device))
|
if (acpi_memory_enable_device(mem_device))
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error in acpi_memory_enable_device\n"));
|
"Error in acpi_memory_enable_device\n"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACPI_NOTIFY_EJECT_REQUEST:
|
case ACPI_NOTIFY_EJECT_REQUEST:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"\nReceived EJECT REQUEST notification for device\n"));
|
"\nReceived EJECT REQUEST notification for device\n"));
|
||||||
|
|
||||||
if (acpi_bus_get_device(handle, &device)) {
|
if (acpi_bus_get_device(handle, &device)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Device doesn't exist\n"));
|
"Device doesn't exist\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mem_device = acpi_driver_data(device);
|
mem_device = acpi_driver_data(device);
|
||||||
if (!mem_device) {
|
if (!mem_device) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Driver Data is NULL\n"));
|
"Driver Data is NULL\n"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,26 +327,25 @@ acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
|
|||||||
* Currently disabling memory device from kernel mode
|
* Currently disabling memory device from kernel mode
|
||||||
* TBD: Can also be disabled from user mode scripts
|
* TBD: Can also be disabled from user mode scripts
|
||||||
* TBD: Can also be disabled by Callback registration
|
* TBD: Can also be disabled by Callback registration
|
||||||
* with generic sysfs driver
|
* with generic sysfs driver
|
||||||
*/
|
*/
|
||||||
if (acpi_memory_disable_device(mem_device))
|
if (acpi_memory_disable_device(mem_device))
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error in acpi_memory_disable_device\n"));
|
"Error in acpi_memory_disable_device\n"));
|
||||||
/*
|
/*
|
||||||
* TBD: Invoke acpi_bus_remove to cleanup data structures
|
* TBD: Invoke acpi_bus_remove to cleanup data structures
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Unsupported event [0x%x]\n", event));
|
"Unsupported event [0x%x]\n", event));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_memory_device_add(struct acpi_device *device)
|
||||||
acpi_memory_device_add(struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct acpi_memory_device *mem_device = NULL;
|
struct acpi_memory_device *mem_device = NULL;
|
||||||
@@ -391,8 +380,7 @@ acpi_memory_device_add(struct acpi_device *device)
|
|||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_memory_device_remove(struct acpi_device *device, int type)
|
||||||
acpi_memory_device_remove (struct acpi_device *device, int type)
|
|
||||||
{
|
{
|
||||||
struct acpi_memory_device *mem_device = NULL;
|
struct acpi_memory_device *mem_device = NULL;
|
||||||
|
|
||||||
@@ -401,7 +389,7 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
|
|||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
mem_device = (struct acpi_memory_device *) acpi_driver_data(device);
|
mem_device = (struct acpi_memory_device *)acpi_driver_data(device);
|
||||||
kfree(mem_device);
|
kfree(mem_device);
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
@@ -410,12 +398,11 @@ acpi_memory_device_remove (struct acpi_device *device, int type)
|
|||||||
/*
|
/*
|
||||||
* Helper function to check for memory device
|
* Helper function to check for memory device
|
||||||
*/
|
*/
|
||||||
static acpi_status
|
static acpi_status is_memory_device(acpi_handle handle)
|
||||||
is_memory_device(acpi_handle handle)
|
|
||||||
{
|
{
|
||||||
char *hardware_id;
|
char *hardware_id;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
struct acpi_device_info *info;
|
struct acpi_device_info *info;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("is_memory_device");
|
ACPI_FUNCTION_TRACE("is_memory_device");
|
||||||
@@ -432,7 +419,7 @@ is_memory_device(acpi_handle handle)
|
|||||||
|
|
||||||
hardware_id = info->hardware_id.value;
|
hardware_id = info->hardware_id.value;
|
||||||
if ((hardware_id == NULL) ||
|
if ((hardware_id == NULL) ||
|
||||||
(strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
|
(strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
|
||||||
status = AE_ERROR;
|
status = AE_ERROR;
|
||||||
|
|
||||||
acpi_os_free(buffer.pointer);
|
acpi_os_free(buffer.pointer);
|
||||||
@@ -440,8 +427,8 @@ is_memory_device(acpi_handle handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_memory_register_notify_handler (acpi_handle handle,
|
acpi_memory_register_notify_handler(acpi_handle handle,
|
||||||
u32 level, void *ctxt, void **retv)
|
u32 level, void *ctxt, void **retv)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
@@ -452,10 +439,10 @@ acpi_memory_register_notify_handler (acpi_handle handle,
|
|||||||
return_ACPI_STATUS(AE_OK); /* continue */
|
return_ACPI_STATUS(AE_OK); /* continue */
|
||||||
|
|
||||||
status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
|
status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
|
||||||
acpi_memory_device_notify, NULL);
|
acpi_memory_device_notify, NULL);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error installing notify handler\n"));
|
"Error installing notify handler\n"));
|
||||||
return_ACPI_STATUS(AE_OK); /* continue */
|
return_ACPI_STATUS(AE_OK); /* continue */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,8 +450,8 @@ acpi_memory_register_notify_handler (acpi_handle handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_memory_deregister_notify_handler (acpi_handle handle,
|
acpi_memory_deregister_notify_handler(acpi_handle handle,
|
||||||
u32 level, void *ctxt, void **retv)
|
u32 level, void *ctxt, void **retv)
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
@@ -475,18 +462,18 @@ acpi_memory_deregister_notify_handler (acpi_handle handle,
|
|||||||
return_ACPI_STATUS(AE_OK); /* continue */
|
return_ACPI_STATUS(AE_OK); /* continue */
|
||||||
|
|
||||||
status = acpi_remove_notify_handler(handle,
|
status = acpi_remove_notify_handler(handle,
|
||||||
ACPI_SYSTEM_NOTIFY, acpi_memory_device_notify);
|
ACPI_SYSTEM_NOTIFY,
|
||||||
|
acpi_memory_device_notify);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error removing notify handler\n"));
|
"Error removing notify handler\n"));
|
||||||
return_ACPI_STATUS(AE_OK); /* continue */
|
return_ACPI_STATUS(AE_OK); /* continue */
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init acpi_memory_device_init(void)
|
||||||
acpi_memory_device_init (void)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
@@ -499,21 +486,20 @@ acpi_memory_device_init (void)
|
|||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
|
|
||||||
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||||
ACPI_UINT32_MAX,
|
ACPI_UINT32_MAX,
|
||||||
acpi_memory_register_notify_handler,
|
acpi_memory_register_notify_handler,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
||||||
acpi_bus_unregister_driver(&acpi_memory_device_driver);
|
acpi_bus_unregister_driver(&acpi_memory_device_driver);
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit
|
static void __exit acpi_memory_device_exit(void)
|
||||||
acpi_memory_device_exit (void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
@@ -524,12 +510,12 @@ acpi_memory_device_exit (void)
|
|||||||
* handles.
|
* handles.
|
||||||
*/
|
*/
|
||||||
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||||
ACPI_UINT32_MAX,
|
ACPI_UINT32_MAX,
|
||||||
acpi_memory_deregister_notify_handler,
|
acpi_memory_deregister_notify_handler,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status))
|
if (ACPI_FAILURE(status))
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n"));
|
||||||
|
|
||||||
acpi_bus_unregister_driver(&acpi_memory_device_driver);
|
acpi_bus_unregister_driver(&acpi_memory_device_driver);
|
||||||
|
|
||||||
@@ -538,5 +524,3 @@ acpi_memory_device_exit (void)
|
|||||||
|
|
||||||
module_init(acpi_memory_device_init);
|
module_init(acpi_memory_device_init);
|
||||||
module_exit(acpi_memory_device_exit);
|
module_exit(acpi_memory_device_exit);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,6 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
|
#define ACPI_BATTERY_VALUE_UNKNOWN 0xFFFFFFFF
|
||||||
|
|
||||||
#define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS"
|
#define ACPI_BATTERY_FORMAT_BIF "NNNNNNNNNSSSS"
|
||||||
@@ -53,87 +52,85 @@
|
|||||||
#define ACPI_BATTERY_UNITS_WATTS "mW"
|
#define ACPI_BATTERY_UNITS_WATTS "mW"
|
||||||
#define ACPI_BATTERY_UNITS_AMPS "mA"
|
#define ACPI_BATTERY_UNITS_AMPS "mA"
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_BATTERY_COMPONENT
|
#define _COMPONENT ACPI_BATTERY_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_battery")
|
ACPI_MODULE_NAME("acpi_battery")
|
||||||
|
|
||||||
MODULE_AUTHOR("Paul Diefenbaugh");
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
||||||
MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
|
MODULE_DESCRIPTION(ACPI_BATTERY_DRIVER_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
static int acpi_battery_add (struct acpi_device *device);
|
static int acpi_battery_add(struct acpi_device *device);
|
||||||
static int acpi_battery_remove (struct acpi_device *device, int type);
|
static int acpi_battery_remove(struct acpi_device *device, int type);
|
||||||
|
|
||||||
static struct acpi_driver acpi_battery_driver = {
|
static struct acpi_driver acpi_battery_driver = {
|
||||||
.name = ACPI_BATTERY_DRIVER_NAME,
|
.name = ACPI_BATTERY_DRIVER_NAME,
|
||||||
.class = ACPI_BATTERY_CLASS,
|
.class = ACPI_BATTERY_CLASS,
|
||||||
.ids = ACPI_BATTERY_HID,
|
.ids = ACPI_BATTERY_HID,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_battery_add,
|
.add = acpi_battery_add,
|
||||||
.remove = acpi_battery_remove,
|
.remove = acpi_battery_remove,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_battery_status {
|
struct acpi_battery_status {
|
||||||
acpi_integer state;
|
acpi_integer state;
|
||||||
acpi_integer present_rate;
|
acpi_integer present_rate;
|
||||||
acpi_integer remaining_capacity;
|
acpi_integer remaining_capacity;
|
||||||
acpi_integer present_voltage;
|
acpi_integer present_voltage;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_battery_info {
|
struct acpi_battery_info {
|
||||||
acpi_integer power_unit;
|
acpi_integer power_unit;
|
||||||
acpi_integer design_capacity;
|
acpi_integer design_capacity;
|
||||||
acpi_integer last_full_capacity;
|
acpi_integer last_full_capacity;
|
||||||
acpi_integer battery_technology;
|
acpi_integer battery_technology;
|
||||||
acpi_integer design_voltage;
|
acpi_integer design_voltage;
|
||||||
acpi_integer design_capacity_warning;
|
acpi_integer design_capacity_warning;
|
||||||
acpi_integer design_capacity_low;
|
acpi_integer design_capacity_low;
|
||||||
acpi_integer battery_capacity_granularity_1;
|
acpi_integer battery_capacity_granularity_1;
|
||||||
acpi_integer battery_capacity_granularity_2;
|
acpi_integer battery_capacity_granularity_2;
|
||||||
acpi_string model_number;
|
acpi_string model_number;
|
||||||
acpi_string serial_number;
|
acpi_string serial_number;
|
||||||
acpi_string battery_type;
|
acpi_string battery_type;
|
||||||
acpi_string oem_info;
|
acpi_string oem_info;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_battery_flags {
|
struct acpi_battery_flags {
|
||||||
u8 present:1; /* Bay occupied? */
|
u8 present:1; /* Bay occupied? */
|
||||||
u8 power_unit:1; /* 0=watts, 1=apms */
|
u8 power_unit:1; /* 0=watts, 1=apms */
|
||||||
u8 alarm:1; /* _BTP present? */
|
u8 alarm:1; /* _BTP present? */
|
||||||
u8 reserved:5;
|
u8 reserved:5;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_battery_trips {
|
struct acpi_battery_trips {
|
||||||
unsigned long warning;
|
unsigned long warning;
|
||||||
unsigned long low;
|
unsigned long low;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_battery {
|
struct acpi_battery {
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
struct acpi_battery_flags flags;
|
struct acpi_battery_flags flags;
|
||||||
struct acpi_battery_trips trips;
|
struct acpi_battery_trips trips;
|
||||||
unsigned long alarm;
|
unsigned long alarm;
|
||||||
struct acpi_battery_info *info;
|
struct acpi_battery_info *info;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Battery Management
|
Battery Management
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_battery_get_info (
|
acpi_battery_get_info(struct acpi_battery *battery,
|
||||||
struct acpi_battery *battery,
|
struct acpi_battery_info **bif)
|
||||||
struct acpi_battery_info **bif)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = 0;
|
acpi_status status = 0;
|
||||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BIF),
|
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;
|
struct acpi_buffer data = { 0, NULL };
|
||||||
|
union acpi_object *package = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_get_info");
|
ACPI_FUNCTION_TRACE("acpi_battery_get_info");
|
||||||
|
|
||||||
@@ -148,7 +145,7 @@ acpi_battery_get_info (
|
|||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
package = (union acpi_object *) buffer.pointer;
|
package = (union acpi_object *)buffer.pointer;
|
||||||
|
|
||||||
/* Extract Package Data */
|
/* Extract Package Data */
|
||||||
|
|
||||||
@@ -174,27 +171,27 @@ acpi_battery_get_info (
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
acpi_os_free(buffer.pointer);
|
acpi_os_free(buffer.pointer);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
(*bif) = (struct acpi_battery_info *) data.pointer;
|
(*bif) = (struct acpi_battery_info *)data.pointer;
|
||||||
|
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_battery_get_status (
|
acpi_battery_get_status(struct acpi_battery *battery,
|
||||||
struct acpi_battery *battery,
|
struct acpi_battery_status **bst)
|
||||||
struct acpi_battery_status **bst)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = 0;
|
acpi_status status = 0;
|
||||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
struct acpi_buffer format = {sizeof(ACPI_BATTERY_FORMAT_BST),
|
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;
|
struct acpi_buffer data = { 0, NULL };
|
||||||
|
union acpi_object *package = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_get_status");
|
ACPI_FUNCTION_TRACE("acpi_battery_get_status");
|
||||||
|
|
||||||
@@ -209,7 +206,7 @@ acpi_battery_get_status (
|
|||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
package = (union acpi_object *) buffer.pointer;
|
package = (union acpi_object *)buffer.pointer;
|
||||||
|
|
||||||
/* Extract Package Data */
|
/* Extract Package Data */
|
||||||
|
|
||||||
@@ -235,24 +232,21 @@ acpi_battery_get_status (
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
acpi_os_free(buffer.pointer);
|
acpi_os_free(buffer.pointer);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
(*bst) = (struct acpi_battery_status *) data.pointer;
|
(*bst) = (struct acpi_battery_status *)data.pointer;
|
||||||
|
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_battery_set_alarm (
|
acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)
|
||||||
struct acpi_battery *battery,
|
|
||||||
unsigned long alarm)
|
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
acpi_status status = 0;
|
||||||
union acpi_object arg0 = {ACPI_TYPE_INTEGER};
|
union acpi_object arg0 = { ACPI_TYPE_INTEGER };
|
||||||
struct acpi_object_list arg_list = {1, &arg0};
|
struct acpi_object_list arg_list = { 1, &arg0 };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
|
ACPI_FUNCTION_TRACE("acpi_battery_set_alarm");
|
||||||
|
|
||||||
@@ -275,15 +269,12 @@ acpi_battery_set_alarm (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int acpi_battery_check(struct acpi_battery *battery)
|
||||||
static int
|
|
||||||
acpi_battery_check (
|
|
||||||
struct acpi_battery *battery)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_handle handle = NULL;
|
acpi_handle handle = NULL;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
struct acpi_battery_info *bif = NULL;
|
struct acpi_battery_info *bif = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_check");
|
ACPI_FUNCTION_TRACE("acpi_battery_check");
|
||||||
@@ -336,18 +327,17 @@ acpi_battery_check (
|
|||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
FS Interface (/proc)
|
FS Interface (/proc)
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct proc_dir_entry *acpi_battery_dir;
|
static struct proc_dir_entry *acpi_battery_dir;
|
||||||
static int acpi_battery_read_info(struct seq_file *seq, void *offset)
|
static int acpi_battery_read_info(struct seq_file *seq, void *offset)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct acpi_battery *battery = (struct acpi_battery *) seq->private;
|
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
|
||||||
struct acpi_battery_info *bif = NULL;
|
struct acpi_battery_info *bif = NULL;
|
||||||
char *units = "?";
|
char *units = "?";
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_read_info");
|
ACPI_FUNCTION_TRACE("acpi_battery_read_info");
|
||||||
|
|
||||||
@@ -369,19 +359,21 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
|
|||||||
goto end;
|
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)
|
if (bif->design_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
|
||||||
seq_printf(seq, "design capacity: unknown\n");
|
seq_printf(seq, "design capacity: unknown\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "design capacity: %d %sh\n",
|
seq_printf(seq, "design capacity: %d %sh\n",
|
||||||
(u32) bif->design_capacity, units);
|
(u32) bif->design_capacity, units);
|
||||||
|
|
||||||
if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
|
if (bif->last_full_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
|
||||||
seq_printf(seq, "last full capacity: unknown\n");
|
seq_printf(seq, "last full capacity: unknown\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "last full capacity: %d %sh\n",
|
seq_printf(seq, "last full capacity: %d %sh\n",
|
||||||
(u32) bif->last_full_capacity, units);
|
(u32) bif->last_full_capacity, units);
|
||||||
|
|
||||||
switch ((u32) bif->battery_technology) {
|
switch ((u32) bif->battery_technology) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -399,26 +391,22 @@ static int acpi_battery_read_info(struct seq_file *seq, void *offset)
|
|||||||
seq_printf(seq, "design voltage: unknown\n");
|
seq_printf(seq, "design voltage: unknown\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "design voltage: %d mV\n",
|
seq_printf(seq, "design voltage: %d mV\n",
|
||||||
(u32) bif->design_voltage);
|
(u32) bif->design_voltage);
|
||||||
|
|
||||||
seq_printf(seq, "design capacity warning: %d %sh\n",
|
seq_printf(seq, "design capacity warning: %d %sh\n",
|
||||||
(u32) bif->design_capacity_warning, units);
|
(u32) bif->design_capacity_warning, units);
|
||||||
seq_printf(seq, "design capacity low: %d %sh\n",
|
seq_printf(seq, "design capacity low: %d %sh\n",
|
||||||
(u32) bif->design_capacity_low, units);
|
(u32) bif->design_capacity_low, units);
|
||||||
seq_printf(seq, "capacity granularity 1: %d %sh\n",
|
seq_printf(seq, "capacity granularity 1: %d %sh\n",
|
||||||
(u32) bif->battery_capacity_granularity_1, units);
|
(u32) bif->battery_capacity_granularity_1, units);
|
||||||
seq_printf(seq, "capacity granularity 2: %d %sh\n",
|
seq_printf(seq, "capacity granularity 2: %d %sh\n",
|
||||||
(u32) bif->battery_capacity_granularity_2, units);
|
(u32) bif->battery_capacity_granularity_2, units);
|
||||||
seq_printf(seq, "model number: %s\n",
|
seq_printf(seq, "model number: %s\n", bif->model_number);
|
||||||
bif->model_number);
|
seq_printf(seq, "serial number: %s\n", bif->serial_number);
|
||||||
seq_printf(seq, "serial number: %s\n",
|
seq_printf(seq, "battery type: %s\n", bif->battery_type);
|
||||||
bif->serial_number);
|
seq_printf(seq, "OEM info: %s\n", bif->oem_info);
|
||||||
seq_printf(seq, "battery type: %s\n",
|
|
||||||
bif->battery_type);
|
|
||||||
seq_printf(seq, "OEM info: %s\n",
|
|
||||||
bif->oem_info);
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
kfree(bif);
|
kfree(bif);
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
@@ -429,14 +417,12 @@ static int acpi_battery_info_open_fs(struct inode *inode, struct file *file)
|
|||||||
return single_open(file, acpi_battery_read_info, PDE(inode)->data);
|
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;
|
int result = 0;
|
||||||
struct acpi_battery *battery = (struct acpi_battery *) seq->private;
|
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
|
||||||
struct acpi_battery_status *bst = NULL;
|
struct acpi_battery_status *bst = NULL;
|
||||||
char *units = "?";
|
char *units = "?";
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_read_state");
|
ACPI_FUNCTION_TRACE("acpi_battery_read_state");
|
||||||
|
|
||||||
@@ -452,7 +438,9 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
|
|||||||
|
|
||||||
/* Battery Units */
|
/* 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) */
|
/* Battery Status (_BST) */
|
||||||
|
|
||||||
@@ -467,12 +455,12 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
|
|||||||
else
|
else
|
||||||
seq_printf(seq, "capacity state: critical\n");
|
seq_printf(seq, "capacity state: critical\n");
|
||||||
|
|
||||||
if ((bst->state & 0x01) && (bst->state & 0x02)){
|
if ((bst->state & 0x01) && (bst->state & 0x02)) {
|
||||||
seq_printf(seq, "charging state: charging/discharging\n");
|
seq_printf(seq,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
"charging state: charging/discharging\n");
|
||||||
"Battery Charging and 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");
|
seq_printf(seq, "charging state: discharging\n");
|
||||||
else if (bst->state & 0x02)
|
else if (bst->state & 0x02)
|
||||||
seq_printf(seq, "charging state: charging\n");
|
seq_printf(seq, "charging state: charging\n");
|
||||||
@@ -484,21 +472,21 @@ acpi_battery_read_state (struct seq_file *seq, void *offset)
|
|||||||
seq_printf(seq, "present rate: unknown\n");
|
seq_printf(seq, "present rate: unknown\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "present rate: %d %s\n",
|
seq_printf(seq, "present rate: %d %s\n",
|
||||||
(u32) bst->present_rate, units);
|
(u32) bst->present_rate, units);
|
||||||
|
|
||||||
if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
|
if (bst->remaining_capacity == ACPI_BATTERY_VALUE_UNKNOWN)
|
||||||
seq_printf(seq, "remaining capacity: unknown\n");
|
seq_printf(seq, "remaining capacity: unknown\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "remaining capacity: %d %sh\n",
|
seq_printf(seq, "remaining capacity: %d %sh\n",
|
||||||
(u32) bst->remaining_capacity, units);
|
(u32) bst->remaining_capacity, units);
|
||||||
|
|
||||||
if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
|
if (bst->present_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
|
||||||
seq_printf(seq, "present voltage: unknown\n");
|
seq_printf(seq, "present voltage: unknown\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "present voltage: %d mV\n",
|
seq_printf(seq, "present voltage: %d mV\n",
|
||||||
(u32) bst->present_voltage);
|
(u32) bst->present_voltage);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
kfree(bst);
|
kfree(bst);
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
@@ -509,12 +497,10 @@ static int acpi_battery_state_open_fs(struct inode *inode, struct file *file)
|
|||||||
return single_open(file, acpi_battery_read_state, PDE(inode)->data);
|
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;
|
struct acpi_battery *battery = (struct acpi_battery *)seq->private;
|
||||||
char *units = "?";
|
char *units = "?";
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
|
ACPI_FUNCTION_TRACE("acpi_battery_read_alarm");
|
||||||
|
|
||||||
@@ -528,7 +514,9 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
|
|||||||
|
|
||||||
/* Battery Units */
|
/* 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 */
|
/* Battery Alarm */
|
||||||
|
|
||||||
@@ -538,22 +526,19 @@ acpi_battery_read_alarm (struct seq_file *seq, void *offset)
|
|||||||
else
|
else
|
||||||
seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
|
seq_printf(seq, "%d %sh\n", (u32) battery->alarm, units);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
acpi_battery_write_alarm (
|
acpi_battery_write_alarm(struct file *file,
|
||||||
struct file *file,
|
const char __user * buffer,
|
||||||
const char __user *buffer,
|
size_t count, loff_t * ppos)
|
||||||
size_t count,
|
|
||||||
loff_t *ppos)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char alarm_string[12] = {'\0'};
|
char alarm_string[12] = { '\0' };
|
||||||
struct seq_file *m = (struct seq_file *)file->private_data;
|
struct seq_file *m = (struct seq_file *)file->private_data;
|
||||||
struct acpi_battery *battery = (struct acpi_battery *)m->private;
|
struct acpi_battery *battery = (struct acpi_battery *)m->private;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
|
ACPI_FUNCTION_TRACE("acpi_battery_write_alarm");
|
||||||
|
|
||||||
@@ -569,7 +554,7 @@ acpi_battery_write_alarm (
|
|||||||
alarm_string[count] = '\0';
|
alarm_string[count] = '\0';
|
||||||
|
|
||||||
result = acpi_battery_set_alarm(battery,
|
result = acpi_battery_set_alarm(battery,
|
||||||
simple_strtoul(alarm_string, NULL, 0));
|
simple_strtoul(alarm_string, NULL, 0));
|
||||||
if (result)
|
if (result)
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
|
|
||||||
@@ -582,41 +567,39 @@ static int acpi_battery_alarm_open_fs(struct inode *inode, struct file *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations acpi_battery_info_ops = {
|
static struct file_operations acpi_battery_info_ops = {
|
||||||
.open = acpi_battery_info_open_fs,
|
.open = acpi_battery_info_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct file_operations acpi_battery_state_ops = {
|
static struct file_operations acpi_battery_state_ops = {
|
||||||
.open = acpi_battery_state_open_fs,
|
.open = acpi_battery_state_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct file_operations acpi_battery_alarm_ops = {
|
static struct file_operations acpi_battery_alarm_ops = {
|
||||||
.open = acpi_battery_alarm_open_fs,
|
.open = acpi_battery_alarm_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.write = acpi_battery_write_alarm,
|
.write = acpi_battery_write_alarm,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int acpi_battery_add_fs(struct acpi_device *device)
|
||||||
acpi_battery_add_fs (
|
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry = NULL;
|
struct proc_dir_entry *entry = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
|
ACPI_FUNCTION_TRACE("acpi_battery_add_fs");
|
||||||
|
|
||||||
if (!acpi_device_dir(device)) {
|
if (!acpi_device_dir(device)) {
|
||||||
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
||||||
acpi_battery_dir);
|
acpi_battery_dir);
|
||||||
if (!acpi_device_dir(device))
|
if (!acpi_device_dir(device))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
acpi_device_dir(device)->owner = THIS_MODULE;
|
acpi_device_dir(device)->owner = THIS_MODULE;
|
||||||
@@ -624,11 +607,11 @@ acpi_battery_add_fs (
|
|||||||
|
|
||||||
/* 'info' [R] */
|
/* 'info' [R] */
|
||||||
entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
|
entry = create_proc_entry(ACPI_BATTERY_FILE_INFO,
|
||||||
S_IRUGO, acpi_device_dir(device));
|
S_IRUGO, acpi_device_dir(device));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_BATTERY_FILE_INFO));
|
ACPI_BATTERY_FILE_INFO));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_battery_info_ops;
|
entry->proc_fops = &acpi_battery_info_ops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -637,11 +620,11 @@ acpi_battery_add_fs (
|
|||||||
|
|
||||||
/* 'status' [R] */
|
/* 'status' [R] */
|
||||||
entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
|
entry = create_proc_entry(ACPI_BATTERY_FILE_STATUS,
|
||||||
S_IRUGO, acpi_device_dir(device));
|
S_IRUGO, acpi_device_dir(device));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_BATTERY_FILE_STATUS));
|
ACPI_BATTERY_FILE_STATUS));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_battery_state_ops;
|
entry->proc_fops = &acpi_battery_state_ops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -650,11 +633,12 @@ acpi_battery_add_fs (
|
|||||||
|
|
||||||
/* 'alarm' [R/W] */
|
/* 'alarm' [R/W] */
|
||||||
entry = create_proc_entry(ACPI_BATTERY_FILE_ALARM,
|
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)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_BATTERY_FILE_ALARM));
|
ACPI_BATTERY_FILE_ALARM));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_battery_alarm_ops;
|
entry->proc_fops = &acpi_battery_alarm_ops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -664,10 +648,7 @@ acpi_battery_add_fs (
|
|||||||
return_VALUE(0);
|
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");
|
ACPI_FUNCTION_TRACE("acpi_battery_remove_fs");
|
||||||
|
|
||||||
@@ -686,19 +667,14 @@ acpi_battery_remove_fs (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Driver Interface
|
Driver Interface
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
|
||||||
acpi_battery_notify (
|
|
||||||
acpi_handle handle,
|
|
||||||
u32 event,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
struct acpi_battery *battery = (struct acpi_battery *) data;
|
struct acpi_battery *battery = (struct acpi_battery *)data;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_notify");
|
ACPI_FUNCTION_TRACE("acpi_battery_notify");
|
||||||
|
|
||||||
@@ -716,21 +692,18 @@ acpi_battery_notify (
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Unsupported event [0x%x]\n", event));
|
"Unsupported event [0x%x]\n", event));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int acpi_battery_add(struct acpi_device *device)
|
||||||
static int
|
|
||||||
acpi_battery_add (
|
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = 0;
|
acpi_status status = 0;
|
||||||
struct acpi_battery *battery = NULL;
|
struct acpi_battery *battery = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_add");
|
ACPI_FUNCTION_TRACE("acpi_battery_add");
|
||||||
|
|
||||||
@@ -756,19 +729,20 @@ acpi_battery_add (
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
status = acpi_install_notify_handler(battery->handle,
|
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)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error installing notify handler\n"));
|
"Error installing notify handler\n"));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
|
printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
|
||||||
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
|
ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
|
||||||
device->status.battery_present?"present":"absent");
|
device->status.battery_present ? "present" : "absent");
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (result) {
|
if (result) {
|
||||||
acpi_battery_remove_fs(device);
|
acpi_battery_remove_fs(device);
|
||||||
kfree(battery);
|
kfree(battery);
|
||||||
@@ -777,27 +751,24 @@ end:
|
|||||||
return_VALUE(result);
|
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;
|
acpi_status status = 0;
|
||||||
struct acpi_battery *battery = NULL;
|
struct acpi_battery *battery = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_remove");
|
ACPI_FUNCTION_TRACE("acpi_battery_remove");
|
||||||
|
|
||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
battery = (struct acpi_battery *) acpi_driver_data(device);
|
battery = (struct acpi_battery *)acpi_driver_data(device);
|
||||||
|
|
||||||
status = acpi_remove_notify_handler(battery->handle,
|
status = acpi_remove_notify_handler(battery->handle,
|
||||||
ACPI_DEVICE_NOTIFY, acpi_battery_notify);
|
ACPI_DEVICE_NOTIFY,
|
||||||
|
acpi_battery_notify);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error removing notify handler\n"));
|
"Error removing notify handler\n"));
|
||||||
|
|
||||||
acpi_battery_remove_fs(device);
|
acpi_battery_remove_fs(device);
|
||||||
|
|
||||||
@@ -806,11 +777,9 @@ acpi_battery_remove (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init acpi_battery_init(void)
|
||||||
static int __init
|
|
||||||
acpi_battery_init (void)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_init");
|
ACPI_FUNCTION_TRACE("acpi_battery_init");
|
||||||
|
|
||||||
@@ -828,9 +797,7 @@ acpi_battery_init (void)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __exit acpi_battery_exit(void)
|
||||||
static void __exit
|
|
||||||
acpi_battery_exit (void)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("acpi_battery_exit");
|
ACPI_FUNCTION_TRACE("acpi_battery_exit");
|
||||||
|
|
||||||
@@ -841,6 +808,5 @@ acpi_battery_exit (void)
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module_init(acpi_battery_init);
|
module_init(acpi_battery_init);
|
||||||
module_exit(acpi_battery_exit);
|
module_exit(acpi_battery_exit);
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
@@ -34,49 +33,49 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
|
|
||||||
enum acpi_blacklist_predicates
|
enum acpi_blacklist_predicates {
|
||||||
{
|
all_versions,
|
||||||
all_versions,
|
less_than_or_equal,
|
||||||
less_than_or_equal,
|
equal,
|
||||||
equal,
|
greater_than_or_equal,
|
||||||
greater_than_or_equal,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_blacklist_item
|
struct acpi_blacklist_item {
|
||||||
{
|
char oem_id[7];
|
||||||
char oem_id[7];
|
char oem_table_id[9];
|
||||||
char oem_table_id[9];
|
u32 oem_revision;
|
||||||
u32 oem_revision;
|
acpi_table_type table;
|
||||||
acpi_table_type table;
|
enum acpi_blacklist_predicates oem_revision_predicate;
|
||||||
enum acpi_blacklist_predicates oem_revision_predicate;
|
char *reason;
|
||||||
char *reason;
|
u32 is_critical_error;
|
||||||
u32 is_critical_error;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POLICY: If *anything* doesn't work, put it on the blacklist.
|
* POLICY: If *anything* doesn't work, put it on the blacklist.
|
||||||
* If they are critical errors, mark it critical, and abort driver load.
|
* 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 */
|
/* 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 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 */
|
/* 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 600E - _ADR should return 7, but it returns 1 */
|
||||||
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal, "Incorrect _ADR", 1},
|
{"IBM ", "TP600E ", 0x00000105, ACPI_DSDT, less_than_or_equal,
|
||||||
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions, "Bogus PCI routing", 1},
|
"Incorrect _ADR", 1},
|
||||||
|
{"ASUS\0\0", "P2B-S ", 0, ACPI_DSDT, all_versions,
|
||||||
|
"Bogus PCI routing", 1},
|
||||||
|
|
||||||
{""}
|
{""}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_ACPI_BLACKLIST_YEAR
|
#if CONFIG_ACPI_BLACKLIST_YEAR
|
||||||
|
|
||||||
static int __init
|
static int __init blacklist_by_year(void)
|
||||||
blacklist_by_year(void)
|
|
||||||
{
|
{
|
||||||
int year;
|
int year;
|
||||||
char *s = dmi_get_system_info(DMI_BIOS_DATE);
|
char *s = dmi_get_system_info(DMI_BIOS_DATE);
|
||||||
@@ -92,9 +91,9 @@ blacklist_by_year(void)
|
|||||||
|
|
||||||
s += 1;
|
s += 1;
|
||||||
|
|
||||||
year = simple_strtoul(s,NULL,0);
|
year = simple_strtoul(s, NULL, 0);
|
||||||
|
|
||||||
if (year < 100) { /* 2-digit year */
|
if (year < 100) { /* 2-digit year */
|
||||||
year += 1900;
|
year += 1900;
|
||||||
if (year < 1996) /* no dates < spec 1.0 */
|
if (year < 1996) /* no dates < spec 1.0 */
|
||||||
year += 100;
|
year += 100;
|
||||||
@@ -102,26 +101,28 @@ blacklist_by_year(void)
|
|||||||
|
|
||||||
if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
|
if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
|
||||||
printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
|
printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
|
||||||
"acpi=force is required to enable ACPI\n",
|
"acpi=force is required to enable ACPI\n",
|
||||||
year, CONFIG_ACPI_BLACKLIST_YEAR);
|
year, CONFIG_ACPI_BLACKLIST_YEAR);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline int blacklist_by_year(void) { return 0; }
|
static inline int blacklist_by_year(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int __init
|
int __init acpi_blacklisted(void)
|
||||||
acpi_blacklisted(void)
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int blacklisted = 0;
|
int blacklisted = 0;
|
||||||
struct acpi_table_header *table_header;
|
struct acpi_table_header *table_header;
|
||||||
|
|
||||||
while (acpi_blacklist[i].oem_id[0] != '\0')
|
while (acpi_blacklist[i].oem_id[0] != '\0') {
|
||||||
{
|
if (acpi_get_table_header_early
|
||||||
if (acpi_get_table_header_early(acpi_blacklist[i].table, &table_header)) {
|
(acpi_blacklist[i].table, &table_header)) {
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -131,33 +132,43 @@ acpi_blacklisted(void)
|
|||||||
continue;
|
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++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
|
if ((acpi_blacklist[i].oem_revision_predicate == all_versions)
|
||||||
|| (acpi_blacklist[i].oem_revision_predicate == less_than_or_equal
|
|| (acpi_blacklist[i].oem_revision_predicate ==
|
||||||
&& table_header->oem_revision <= acpi_blacklist[i].oem_revision)
|
less_than_or_equal
|
||||||
|| (acpi_blacklist[i].oem_revision_predicate == greater_than_or_equal
|
&& table_header->oem_revision <=
|
||||||
&& table_header->oem_revision >= acpi_blacklist[i].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
|
|| (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
|
||||||
"Revision 0x%x has a known ACPI BIOS problem.\n",
|
"Vendor \"%6.6s\" System \"%8.8s\" "
|
||||||
acpi_blacklist[i].oem_id,
|
"Revision 0x%x has a known ACPI BIOS problem.\n",
|
||||||
acpi_blacklist[i].oem_table_id,
|
acpi_blacklist[i].oem_id,
|
||||||
acpi_blacklist[i].oem_revision);
|
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
|
||||||
acpi_blacklist[i].reason,
|
"Reason: %s. This is a %s error\n",
|
||||||
(acpi_blacklist[i].is_critical_error ? "non-recoverable" : "recoverable"));
|
acpi_blacklist[i].reason,
|
||||||
|
(acpi_blacklist[i].
|
||||||
|
is_critical_error ? "non-recoverable" :
|
||||||
|
"recoverable"));
|
||||||
|
|
||||||
blacklisted = acpi_blacklist[i].is_critical_error;
|
blacklisted = acpi_blacklist[i].is_critical_error;
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -166,4 +177,3 @@ acpi_blacklisted(void)
|
|||||||
|
|
||||||
return blacklisted;
|
return blacklisted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,19 +36,17 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_BUS_COMPONENT
|
#define _COMPONENT ACPI_BUS_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_bus")
|
ACPI_MODULE_NAME("acpi_bus")
|
||||||
|
|
||||||
#ifdef CONFIG_X86
|
#ifdef CONFIG_X86
|
||||||
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
|
extern void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FADT_DESCRIPTOR acpi_fadt;
|
FADT_DESCRIPTOR acpi_fadt;
|
||||||
EXPORT_SYMBOL(acpi_fadt);
|
EXPORT_SYMBOL(acpi_fadt);
|
||||||
|
|
||||||
struct acpi_device *acpi_root;
|
struct acpi_device *acpi_root;
|
||||||
struct proc_dir_entry *acpi_root_dir;
|
struct proc_dir_entry *acpi_root_dir;
|
||||||
EXPORT_SYMBOL(acpi_root_dir);
|
EXPORT_SYMBOL(acpi_root_dir);
|
||||||
|
|
||||||
#define STRUCT_TO_INT(s) (*((int*)&s))
|
#define STRUCT_TO_INT(s) (*((int*)&s))
|
||||||
@@ -57,12 +55,9 @@ EXPORT_SYMBOL(acpi_root_dir);
|
|||||||
Device Management
|
Device Management
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int acpi_bus_get_device(acpi_handle handle, struct acpi_device **device)
|
||||||
acpi_bus_get_device (
|
|
||||||
acpi_handle handle,
|
|
||||||
struct acpi_device **device)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_get_device");
|
ACPI_FUNCTION_TRACE("acpi_bus_get_device");
|
||||||
|
|
||||||
@@ -71,23 +66,22 @@ acpi_bus_get_device (
|
|||||||
|
|
||||||
/* TBD: Support fixed-feature devices */
|
/* TBD: Support fixed-feature devices */
|
||||||
|
|
||||||
status = acpi_get_data(handle, acpi_bus_data_handler, (void**) device);
|
status = acpi_get_data(handle, acpi_bus_data_handler, (void **)device);
|
||||||
if (ACPI_FAILURE(status) || !*device) {
|
if (ACPI_FAILURE(status) || !*device) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No context for object [%p]\n",
|
||||||
handle));
|
handle));
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_bus_get_device);
|
EXPORT_SYMBOL(acpi_bus_get_device);
|
||||||
|
|
||||||
int
|
int acpi_bus_get_status(struct acpi_device *device)
|
||||||
acpi_bus_get_status (
|
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
unsigned long sta = 0;
|
unsigned long sta = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_get_status");
|
ACPI_FUNCTION_TRACE("acpi_bus_get_status");
|
||||||
|
|
||||||
@@ -98,10 +92,11 @@ acpi_bus_get_status (
|
|||||||
* Evaluate _STA if present.
|
* Evaluate _STA if present.
|
||||||
*/
|
*/
|
||||||
if (device->flags.dynamic_status) {
|
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))
|
if (ACPI_FAILURE(status))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
STRUCT_TO_INT(device->status) = (int) sta;
|
STRUCT_TO_INT(device->status) = (int)sta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -115,33 +110,30 @@ acpi_bus_get_status (
|
|||||||
|
|
||||||
if (device->status.functional && !device->status.present) {
|
if (device->status.functional && !device->status.present) {
|
||||||
printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
|
printk(KERN_WARNING PREFIX "Device [%s] status [%08x]: "
|
||||||
"functional but not present; setting present\n",
|
"functional but not present; setting present\n",
|
||||||
device->pnp.bus_id,
|
device->pnp.bus_id, (u32) STRUCT_TO_INT(device->status));
|
||||||
(u32) STRUCT_TO_INT(device->status));
|
|
||||||
device->status.present = 1;
|
device->status.present = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] status [%08x]\n",
|
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);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_bus_get_status);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_bus_get_status);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Power Management
|
Power Management
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
int acpi_bus_get_power(acpi_handle handle, int *state)
|
||||||
acpi_bus_get_power (
|
|
||||||
acpi_handle handle,
|
|
||||||
int *state)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = 0;
|
acpi_status status = 0;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
unsigned long psc = 0;
|
unsigned long psc = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_get_power");
|
ACPI_FUNCTION_TRACE("acpi_bus_get_power");
|
||||||
|
|
||||||
@@ -157,20 +149,18 @@ acpi_bus_get_power (
|
|||||||
*state = device->parent->power.state;
|
*state = device->parent->power.state;
|
||||||
else
|
else
|
||||||
*state = ACPI_STATE_D0;
|
*state = ACPI_STATE_D0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Get the device's power state either directly (via _PSC) or
|
* Get the device's power state either directly (via _PSC) or
|
||||||
* indirectly (via power resources).
|
* indirectly (via power resources).
|
||||||
*/
|
*/
|
||||||
if (device->power.flags.explicit_get) {
|
if (device->power.flags.explicit_get) {
|
||||||
status = acpi_evaluate_integer(device->handle, "_PSC",
|
status = acpi_evaluate_integer(device->handle, "_PSC",
|
||||||
NULL, &psc);
|
NULL, &psc);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
device->power.state = (int) psc;
|
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);
|
result = acpi_power_get_inferred_state(device);
|
||||||
if (result)
|
if (result)
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
@@ -180,22 +170,19 @@ acpi_bus_get_power (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
|
||||||
device->pnp.bus_id, device->power.state));
|
device->pnp.bus_id, device->power.state));
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_bus_get_power);
|
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;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
char object_name[5] = {'_','P','S','0'+state,'\0'};
|
char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_set_power");
|
ACPI_FUNCTION_TRACE("acpi_bus_set_power");
|
||||||
|
|
||||||
@@ -209,7 +196,8 @@ acpi_bus_set_power (
|
|||||||
/* Make sure this is a valid target state */
|
/* Make sure this is a valid target state */
|
||||||
|
|
||||||
if (!device->flags.power_manageable) {
|
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);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -219,15 +207,18 @@ acpi_bus_set_power (
|
|||||||
if (device->power.state == ACPI_STATE_UNKNOWN)
|
if (device->power.state == ACPI_STATE_UNKNOWN)
|
||||||
acpi_bus_get_power(device->handle, &device->power.state);
|
acpi_bus_get_power(device->handle, &device->power.state);
|
||||||
if (state == device->power.state) {
|
if (state == device->power.state) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n", state));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
|
||||||
|
state));
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
if (!device->power.states[state].flags.valid) {
|
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);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
if (device->parent && (state < device->parent->power.state)) {
|
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);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,17 +237,16 @@ acpi_bus_set_power (
|
|||||||
}
|
}
|
||||||
if (device->power.states[state].flags.explicit_set) {
|
if (device->power.states[state].flags.explicit_set) {
|
||||||
status = acpi_evaluate_object(device->handle,
|
status = acpi_evaluate_object(device->handle,
|
||||||
object_name, NULL, NULL);
|
object_name, NULL, NULL);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (device->power.states[state].flags.explicit_set) {
|
if (device->power.states[state].flags.explicit_set) {
|
||||||
status = acpi_evaluate_object(device->handle,
|
status = acpi_evaluate_object(device->handle,
|
||||||
object_name, NULL, NULL);
|
object_name, NULL, NULL);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
@@ -269,20 +259,21 @@ acpi_bus_set_power (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (result)
|
if (result)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error transitioning device [%s] to D%d\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
device->pnp.bus_id, state));
|
"Error transitioning device [%s] to D%d\n",
|
||||||
|
device->pnp.bus_id, state));
|
||||||
else
|
else
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] transitioned to D%d\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id, state));
|
"Device [%s] transitioned to D%d\n",
|
||||||
|
device->pnp.bus_id, state));
|
||||||
|
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_bus_set_power);
|
EXPORT_SYMBOL(acpi_bus_set_power);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Event Management
|
Event Management
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
@@ -292,16 +283,12 @@ static DEFINE_SPINLOCK(acpi_bus_event_lock);
|
|||||||
LIST_HEAD(acpi_bus_event_list);
|
LIST_HEAD(acpi_bus_event_list);
|
||||||
DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
|
DECLARE_WAIT_QUEUE_HEAD(acpi_bus_event_queue);
|
||||||
|
|
||||||
extern int event_is_open;
|
extern int event_is_open;
|
||||||
|
|
||||||
int
|
int acpi_bus_generate_event(struct acpi_device *device, u8 type, int data)
|
||||||
acpi_bus_generate_event (
|
|
||||||
struct acpi_device *device,
|
|
||||||
u8 type,
|
|
||||||
int data)
|
|
||||||
{
|
{
|
||||||
struct acpi_bus_event *event = NULL;
|
struct acpi_bus_event *event = NULL;
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
|
ACPI_FUNCTION_TRACE("acpi_bus_generate_event");
|
||||||
|
|
||||||
@@ -329,14 +316,13 @@ acpi_bus_generate_event (
|
|||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_bus_generate_event);
|
EXPORT_SYMBOL(acpi_bus_generate_event);
|
||||||
|
|
||||||
int
|
int acpi_bus_receive_event(struct acpi_bus_event *event)
|
||||||
acpi_bus_receive_event (
|
|
||||||
struct acpi_bus_event *event)
|
|
||||||
{
|
{
|
||||||
unsigned long flags = 0;
|
unsigned long flags = 0;
|
||||||
struct acpi_bus_event *entry = NULL;
|
struct acpi_bus_event *entry = NULL;
|
||||||
|
|
||||||
DECLARE_WAITQUEUE(wait, current);
|
DECLARE_WAITQUEUE(wait, current);
|
||||||
|
|
||||||
@@ -361,7 +347,8 @@ acpi_bus_receive_event (
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&acpi_bus_event_lock, flags);
|
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)
|
if (entry)
|
||||||
list_del(&entry->node);
|
list_del(&entry->node);
|
||||||
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
|
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);
|
||||||
@@ -375,19 +362,17 @@ acpi_bus_receive_event (
|
|||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_bus_receive_event);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_bus_receive_event);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Notification Handling
|
Notification Handling
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_bus_check_device (
|
acpi_bus_check_device(struct acpi_device *device, int *status_changed)
|
||||||
struct acpi_device *device,
|
|
||||||
int *status_changed)
|
|
||||||
{
|
{
|
||||||
acpi_status status = 0;
|
acpi_status status = 0;
|
||||||
struct acpi_device_status old_status;
|
struct acpi_device_status old_status;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_check_device");
|
ACPI_FUNCTION_TRACE("acpi_bus_check_device");
|
||||||
@@ -429,8 +414,7 @@ acpi_bus_check_device (
|
|||||||
if ((device->status.present) && !(old_status.present)) {
|
if ((device->status.present) && !(old_status.present)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device insertion detected\n"));
|
||||||
/* TBD: Handle device insertion */
|
/* 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"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
|
||||||
/* TBD: Handle device removal */
|
/* TBD: Handle device removal */
|
||||||
}
|
}
|
||||||
@@ -438,13 +422,10 @@ acpi_bus_check_device (
|
|||||||
return_VALUE(0);
|
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 result = 0;
|
||||||
int status_changed = 0;
|
int status_changed = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
|
ACPI_FUNCTION_TRACE("acpi_bus_check_scope");
|
||||||
|
|
||||||
@@ -467,20 +448,15 @@ acpi_bus_check_scope (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* acpi_bus_notify
|
* acpi_bus_notify
|
||||||
* ---------------
|
* ---------------
|
||||||
* Callback for all 'system-level' device notifications (values 0x00-0x7F).
|
* Callback for all 'system-level' device notifications (values 0x00-0x7F).
|
||||||
*/
|
*/
|
||||||
static void
|
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
||||||
acpi_bus_notify (
|
|
||||||
acpi_handle handle,
|
|
||||||
u32 type,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_notify");
|
ACPI_FUNCTION_TRACE("acpi_bus_notify");
|
||||||
|
|
||||||
@@ -490,64 +466,73 @@ acpi_bus_notify (
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
||||||
case ACPI_NOTIFY_BUS_CHECK:
|
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,
|
||||||
device->pnp.bus_id));
|
"Received BUS CHECK notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
result = acpi_bus_check_scope(device);
|
result = acpi_bus_check_scope(device);
|
||||||
/*
|
/*
|
||||||
* TBD: We'll need to outsource certain events to non-ACPI
|
* TBD: We'll need to outsource certain events to non-ACPI
|
||||||
* drivers via the device manager (device.c).
|
* drivers via the device manager (device.c).
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
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,
|
||||||
device->pnp.bus_id));
|
"Received DEVICE CHECK notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
result = acpi_bus_check_device(device, NULL);
|
result = acpi_bus_check_device(device, NULL);
|
||||||
/*
|
/*
|
||||||
* TBD: We'll need to outsource certain events to non-ACPI
|
* TBD: We'll need to outsource certain events to non-ACPI
|
||||||
* drivers via the device manager (device.c).
|
* drivers via the device manager (device.c).
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_DEVICE_WAKE:
|
case ACPI_NOTIFY_DEVICE_WAKE:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE WAKE notification for device [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id));
|
"Received DEVICE WAKE notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_EJECT_REQUEST:
|
case ACPI_NOTIFY_EJECT_REQUEST:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received EJECT REQUEST notification for device [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id));
|
"Received EJECT REQUEST notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
|
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received DEVICE CHECK LIGHT notification for device [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id));
|
"Received DEVICE CHECK LIGHT notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
/* TBD: Exactly what does 'light' mean? */
|
/* TBD: Exactly what does 'light' mean? */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
|
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received FREQUENCY MISMATCH notification for device [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id));
|
"Received FREQUENCY MISMATCH notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
|
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received BUS MODE MISMATCH notification for device [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id));
|
"Received BUS MODE MISMATCH notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_NOTIFY_POWER_FAULT:
|
case ACPI_NOTIFY_POWER_FAULT:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received POWER FAULT notification for device [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
device->pnp.bus_id));
|
"Received POWER FAULT notification for device [%s]\n",
|
||||||
|
device->pnp.bus_id));
|
||||||
/* TBD */
|
/* TBD */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Received unknown/unsupported notification [%08x]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
type));
|
"Received unknown/unsupported notification [%08x]\n",
|
||||||
|
type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,13 +543,12 @@ acpi_bus_notify (
|
|||||||
Initialization/Cleanup
|
Initialization/Cleanup
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int __init
|
static int __init acpi_bus_init_irq(void)
|
||||||
acpi_bus_init_irq (void)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_object arg = {ACPI_TYPE_INTEGER};
|
union acpi_object arg = { ACPI_TYPE_INTEGER };
|
||||||
struct acpi_object_list arg_list = {1, &arg};
|
struct acpi_object_list arg_list = { 1, &arg };
|
||||||
char *message = NULL;
|
char *message = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
|
ACPI_FUNCTION_TRACE("acpi_bus_init_irq");
|
||||||
|
|
||||||
@@ -601,12 +585,10 @@ acpi_bus_init_irq (void)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __init acpi_early_init(void)
|
||||||
void __init
|
|
||||||
acpi_early_init (void)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_buffer buffer = {sizeof(acpi_fadt), &acpi_fadt};
|
struct acpi_buffer buffer = { sizeof(acpi_fadt), &acpi_fadt };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_early_init");
|
ACPI_FUNCTION_TRACE("acpi_early_init");
|
||||||
|
|
||||||
@@ -619,13 +601,15 @@ acpi_early_init (void)
|
|||||||
|
|
||||||
status = acpi_initialize_subsystem();
|
status = acpi_initialize_subsystem();
|
||||||
if (ACPI_FAILURE(status)) {
|
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;
|
goto error0;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_load_tables();
|
status = acpi_load_tables();
|
||||||
if (ACPI_FAILURE(status)) {
|
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;
|
goto error0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,7 +621,6 @@ acpi_early_init (void)
|
|||||||
printk(KERN_ERR PREFIX "Unable to get the FADT\n");
|
printk(KERN_ERR PREFIX "Unable to get the FADT\n");
|
||||||
goto error0;
|
goto error0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_X86
|
#ifdef CONFIG_X86
|
||||||
if (!acpi_ioapic) {
|
if (!acpi_ioapic) {
|
||||||
extern acpi_interrupt_flags acpi_sci_flags;
|
extern acpi_interrupt_flags acpi_sci_flags;
|
||||||
@@ -647,7 +630,8 @@ acpi_early_init (void)
|
|||||||
acpi_sci_flags.trigger = 3;
|
acpi_sci_flags.trigger = 3;
|
||||||
|
|
||||||
/* Set PIC-mode SCI trigger type */
|
/* 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 {
|
} else {
|
||||||
extern int acpi_sci_override_gsi;
|
extern int acpi_sci_override_gsi;
|
||||||
/*
|
/*
|
||||||
@@ -658,7 +642,10 @@ acpi_early_init (void)
|
|||||||
}
|
}
|
||||||
#endif
|
#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)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
|
printk(KERN_ERR PREFIX "Unable to enable ACPI\n");
|
||||||
goto error0;
|
goto error0;
|
||||||
@@ -666,30 +653,32 @@ acpi_early_init (void)
|
|||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
|
|
||||||
error0:
|
error0:
|
||||||
disable_acpi();
|
disable_acpi();
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init acpi_bus_init(void)
|
||||||
acpi_bus_init (void)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
extern acpi_status acpi_os_initialize1(void);
|
extern acpi_status acpi_os_initialize1(void);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_bus_init");
|
ACPI_FUNCTION_TRACE("acpi_bus_init");
|
||||||
|
|
||||||
status = acpi_os_initialize1();
|
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)) {
|
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;
|
goto error1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE(status)) {
|
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;
|
goto error1;
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_ACPI_EC
|
#ifdef CONFIG_ACPI_EC
|
||||||
@@ -723,9 +712,12 @@ acpi_bus_init (void)
|
|||||||
/*
|
/*
|
||||||
* Register the for all standard device notifications.
|
* 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)) {
|
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;
|
goto error1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,21 +729,20 @@ acpi_bus_init (void)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
|
|
||||||
/* Mimic structured exception handling */
|
/* Mimic structured exception handling */
|
||||||
error1:
|
error1:
|
||||||
acpi_terminate();
|
acpi_terminate();
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_subsys(acpi,NULL,NULL);
|
decl_subsys(acpi, NULL, NULL);
|
||||||
|
|
||||||
static int __init acpi_init (void)
|
static int __init acpi_init(void)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_init");
|
ACPI_FUNCTION_TRACE("acpi_init");
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "Subsystem revision %08x\n",
|
printk(KERN_INFO PREFIX "Subsystem revision %08x\n", ACPI_CA_VERSION);
|
||||||
ACPI_CA_VERSION);
|
|
||||||
|
|
||||||
if (acpi_disabled) {
|
if (acpi_disabled) {
|
||||||
printk(KERN_INFO PREFIX "Interpreter disabled.\n");
|
printk(KERN_INFO PREFIX "Interpreter disabled.\n");
|
||||||
@@ -767,7 +758,8 @@ static int __init acpi_init (void)
|
|||||||
if (!PM_IS_ACTIVE())
|
if (!PM_IS_ACTIVE())
|
||||||
pm_active = 1;
|
pm_active = 1;
|
||||||
else {
|
else {
|
||||||
printk(KERN_INFO PREFIX "APM is already active, exiting\n");
|
printk(KERN_INFO PREFIX
|
||||||
|
"APM is already active, exiting\n");
|
||||||
disable_acpi();
|
disable_acpi();
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define ACPI_BUTTON_COMPONENT 0x00080000
|
#define ACPI_BUTTON_COMPONENT 0x00080000
|
||||||
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
|
#define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver"
|
||||||
#define ACPI_BUTTON_CLASS "button"
|
#define ACPI_BUTTON_CLASS "button"
|
||||||
@@ -61,57 +60,57 @@
|
|||||||
#define ACPI_BUTTON_TYPE_LID 0x05
|
#define ACPI_BUTTON_TYPE_LID 0x05
|
||||||
|
|
||||||
#define _COMPONENT ACPI_BUTTON_COMPONENT
|
#define _COMPONENT ACPI_BUTTON_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_button")
|
ACPI_MODULE_NAME("acpi_button")
|
||||||
|
|
||||||
MODULE_AUTHOR("Paul Diefenbaugh");
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
||||||
MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
|
MODULE_DESCRIPTION(ACPI_BUTTON_DRIVER_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
|
static int acpi_button_add(struct acpi_device *device);
|
||||||
static int acpi_button_add (struct acpi_device *device);
|
static int acpi_button_remove(struct acpi_device *device, int type);
|
||||||
static int acpi_button_remove (struct acpi_device *device, int type);
|
|
||||||
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
|
static int acpi_button_info_open_fs(struct inode *inode, struct file *file);
|
||||||
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
|
static int acpi_button_state_open_fs(struct inode *inode, struct file *file);
|
||||||
|
|
||||||
static struct acpi_driver acpi_button_driver = {
|
static struct acpi_driver acpi_button_driver = {
|
||||||
.name = ACPI_BUTTON_DRIVER_NAME,
|
.name = ACPI_BUTTON_DRIVER_NAME,
|
||||||
.class = ACPI_BUTTON_CLASS,
|
.class = ACPI_BUTTON_CLASS,
|
||||||
.ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
|
.ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E",
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_button_add,
|
.add = acpi_button_add,
|
||||||
.remove = acpi_button_remove,
|
.remove = acpi_button_remove,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_button {
|
struct acpi_button {
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
struct acpi_device *device; /* Fixed button kludge */
|
struct acpi_device *device; /* Fixed button kludge */
|
||||||
u8 type;
|
u8 type;
|
||||||
unsigned long pushed;
|
unsigned long pushed;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct file_operations acpi_button_info_fops = {
|
static struct file_operations acpi_button_info_fops = {
|
||||||
.open = acpi_button_info_open_fs,
|
.open = acpi_button_info_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct file_operations acpi_button_state_fops = {
|
static struct file_operations acpi_button_state_fops = {
|
||||||
.open = acpi_button_state_open_fs,
|
.open = acpi_button_state_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
FS Interface (/proc)
|
FS Interface (/proc)
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct proc_dir_entry *acpi_button_dir;
|
static struct proc_dir_entry *acpi_button_dir;
|
||||||
|
|
||||||
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
|
static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
|
||||||
{
|
{
|
||||||
struct acpi_button *button = (struct acpi_button *) seq->private;
|
struct acpi_button *button = (struct acpi_button *)seq->private;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
|
ACPI_FUNCTION_TRACE("acpi_button_info_seq_show");
|
||||||
|
|
||||||
@@ -119,7 +118,7 @@ static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
|
|
||||||
seq_printf(seq, "type: %s\n",
|
seq_printf(seq, "type: %s\n",
|
||||||
acpi_device_name(button->device));
|
acpi_device_name(button->device));
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
@@ -131,21 +130,21 @@ static int acpi_button_info_open_fs(struct inode *inode, struct file *file)
|
|||||||
|
|
||||||
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
|
static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
|
||||||
{
|
{
|
||||||
struct acpi_button *button = (struct acpi_button *) seq->private;
|
struct acpi_button *button = (struct acpi_button *)seq->private;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
unsigned long state;
|
unsigned long state;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
|
ACPI_FUNCTION_TRACE("acpi_button_state_seq_show");
|
||||||
|
|
||||||
if (!button || !button->device)
|
if (!button || !button->device)
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
|
|
||||||
status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state);
|
status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
seq_printf(seq, "state: unsupported\n");
|
seq_printf(seq, "state: unsupported\n");
|
||||||
}
|
} else {
|
||||||
else{
|
seq_printf(seq, "state: %s\n",
|
||||||
seq_printf(seq, "state: %s\n", (state ? "open" : "closed"));
|
(state ? "open" : "closed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
@@ -160,12 +159,10 @@ static struct proc_dir_entry *acpi_power_dir;
|
|||||||
static struct proc_dir_entry *acpi_sleep_dir;
|
static struct proc_dir_entry *acpi_sleep_dir;
|
||||||
static struct proc_dir_entry *acpi_lid_dir;
|
static struct proc_dir_entry *acpi_lid_dir;
|
||||||
|
|
||||||
static int
|
static int acpi_button_add_fs(struct acpi_device *device)
|
||||||
acpi_button_add_fs (
|
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry = NULL;
|
struct proc_dir_entry *entry = NULL;
|
||||||
struct acpi_button *button = NULL;
|
struct acpi_button *button = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
|
ACPI_FUNCTION_TRACE("acpi_button_add_fs");
|
||||||
|
|
||||||
@@ -179,20 +176,20 @@ acpi_button_add_fs (
|
|||||||
case ACPI_BUTTON_TYPE_POWERF:
|
case ACPI_BUTTON_TYPE_POWERF:
|
||||||
if (!acpi_power_dir)
|
if (!acpi_power_dir)
|
||||||
acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
|
acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER,
|
||||||
acpi_button_dir);
|
acpi_button_dir);
|
||||||
entry = acpi_power_dir;
|
entry = acpi_power_dir;
|
||||||
break;
|
break;
|
||||||
case ACPI_BUTTON_TYPE_SLEEP:
|
case ACPI_BUTTON_TYPE_SLEEP:
|
||||||
case ACPI_BUTTON_TYPE_SLEEPF:
|
case ACPI_BUTTON_TYPE_SLEEPF:
|
||||||
if (!acpi_sleep_dir)
|
if (!acpi_sleep_dir)
|
||||||
acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
|
acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP,
|
||||||
acpi_button_dir);
|
acpi_button_dir);
|
||||||
entry = acpi_sleep_dir;
|
entry = acpi_sleep_dir;
|
||||||
break;
|
break;
|
||||||
case ACPI_BUTTON_TYPE_LID:
|
case ACPI_BUTTON_TYPE_LID:
|
||||||
if (!acpi_lid_dir)
|
if (!acpi_lid_dir)
|
||||||
acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
|
acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID,
|
||||||
acpi_button_dir);
|
acpi_button_dir);
|
||||||
entry = acpi_lid_dir;
|
entry = acpi_lid_dir;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -208,11 +205,11 @@ acpi_button_add_fs (
|
|||||||
|
|
||||||
/* 'info' [R] */
|
/* 'info' [R] */
|
||||||
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
|
entry = create_proc_entry(ACPI_BUTTON_FILE_INFO,
|
||||||
S_IRUGO, acpi_device_dir(device));
|
S_IRUGO, acpi_device_dir(device));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_BUTTON_FILE_INFO));
|
ACPI_BUTTON_FILE_INFO));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_button_info_fops;
|
entry->proc_fops = &acpi_button_info_fops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -222,11 +219,11 @@ acpi_button_add_fs (
|
|||||||
/* show lid state [R] */
|
/* show lid state [R] */
|
||||||
if (button->type == ACPI_BUTTON_TYPE_LID) {
|
if (button->type == ACPI_BUTTON_TYPE_LID) {
|
||||||
entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
|
entry = create_proc_entry(ACPI_BUTTON_FILE_STATE,
|
||||||
S_IRUGO, acpi_device_dir(device));
|
S_IRUGO, acpi_device_dir(device));
|
||||||
if (!entry)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_BUTTON_FILE_INFO));
|
ACPI_BUTTON_FILE_INFO));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_button_state_fops;
|
entry->proc_fops = &acpi_button_state_fops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -237,12 +234,9 @@ acpi_button_add_fs (
|
|||||||
return_VALUE(0);
|
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;
|
struct acpi_button *button = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
|
ACPI_FUNCTION_TRACE("acpi_button_remove_fs");
|
||||||
|
|
||||||
@@ -250,30 +244,25 @@ acpi_button_remove_fs (
|
|||||||
if (acpi_device_dir(device)) {
|
if (acpi_device_dir(device)) {
|
||||||
if (button->type == ACPI_BUTTON_TYPE_LID)
|
if (button->type == ACPI_BUTTON_TYPE_LID)
|
||||||
remove_proc_entry(ACPI_BUTTON_FILE_STATE,
|
remove_proc_entry(ACPI_BUTTON_FILE_STATE,
|
||||||
acpi_device_dir(device));
|
acpi_device_dir(device));
|
||||||
remove_proc_entry(ACPI_BUTTON_FILE_INFO,
|
remove_proc_entry(ACPI_BUTTON_FILE_INFO,
|
||||||
acpi_device_dir(device));
|
acpi_device_dir(device));
|
||||||
|
|
||||||
remove_proc_entry(acpi_device_bid(device),
|
remove_proc_entry(acpi_device_bid(device),
|
||||||
acpi_device_dir(device)->parent);
|
acpi_device_dir(device)->parent);
|
||||||
acpi_device_dir(device) = NULL;
|
acpi_device_dir(device) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Driver Interface
|
Driver Interface
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void
|
static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
|
||||||
acpi_button_notify (
|
|
||||||
acpi_handle handle,
|
|
||||||
u32 event,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
struct acpi_button *button = (struct acpi_button *) data;
|
struct acpi_button *button = (struct acpi_button *)data;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_notify");
|
ACPI_FUNCTION_TRACE("acpi_button_notify");
|
||||||
|
|
||||||
@@ -282,23 +271,21 @@ acpi_button_notify (
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ACPI_BUTTON_NOTIFY_STATUS:
|
case ACPI_BUTTON_NOTIFY_STATUS:
|
||||||
acpi_bus_generate_event(button->device, event, ++button->pushed);
|
acpi_bus_generate_event(button->device, event,
|
||||||
|
++button->pushed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Unsupported event [0x%x]\n", event));
|
"Unsupported event [0x%x]\n", event));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
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;
|
struct acpi_button *button = (struct acpi_button *)data;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
|
ACPI_FUNCTION_TRACE("acpi_button_notify_fixed");
|
||||||
|
|
||||||
@@ -310,14 +297,11 @@ acpi_button_notify_fixed (
|
|||||||
return_ACPI_STATUS(AE_OK);
|
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;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_button *button = NULL;
|
struct acpi_button *button = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_add");
|
ACPI_FUNCTION_TRACE("acpi_button_add");
|
||||||
|
|
||||||
@@ -339,42 +323,34 @@ acpi_button_add (
|
|||||||
*/
|
*/
|
||||||
if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
|
if (!strcmp(acpi_device_hid(device), ACPI_BUTTON_HID_POWER)) {
|
||||||
button->type = ACPI_BUTTON_TYPE_POWER;
|
button->type = ACPI_BUTTON_TYPE_POWER;
|
||||||
strcpy(acpi_device_name(device),
|
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_POWER);
|
||||||
ACPI_BUTTON_DEVICE_NAME_POWER);
|
|
||||||
sprintf(acpi_device_class(device), "%s/%s",
|
sprintf(acpi_device_class(device), "%s/%s",
|
||||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
|
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;
|
button->type = ACPI_BUTTON_TYPE_POWERF;
|
||||||
strcpy(acpi_device_name(device),
|
strcpy(acpi_device_name(device),
|
||||||
ACPI_BUTTON_DEVICE_NAME_POWERF);
|
ACPI_BUTTON_DEVICE_NAME_POWERF);
|
||||||
sprintf(acpi_device_class(device), "%s/%s",
|
sprintf(acpi_device_class(device), "%s/%s",
|
||||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
|
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;
|
button->type = ACPI_BUTTON_TYPE_SLEEP;
|
||||||
strcpy(acpi_device_name(device),
|
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_SLEEP);
|
||||||
ACPI_BUTTON_DEVICE_NAME_SLEEP);
|
|
||||||
sprintf(acpi_device_class(device), "%s/%s",
|
sprintf(acpi_device_class(device), "%s/%s",
|
||||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
|
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;
|
button->type = ACPI_BUTTON_TYPE_SLEEPF;
|
||||||
strcpy(acpi_device_name(device),
|
strcpy(acpi_device_name(device),
|
||||||
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
|
ACPI_BUTTON_DEVICE_NAME_SLEEPF);
|
||||||
sprintf(acpi_device_class(device), "%s/%s",
|
sprintf(acpi_device_class(device), "%s/%s",
|
||||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
|
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;
|
button->type = ACPI_BUTTON_TYPE_LID;
|
||||||
strcpy(acpi_device_name(device),
|
strcpy(acpi_device_name(device), ACPI_BUTTON_DEVICE_NAME_LID);
|
||||||
ACPI_BUTTON_DEVICE_NAME_LID);
|
|
||||||
sprintf(acpi_device_class(device), "%s/%s",
|
sprintf(acpi_device_class(device), "%s/%s",
|
||||||
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
|
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unsupported hid [%s]\n",
|
||||||
acpi_device_hid(device)));
|
acpi_device_hid(device)));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -385,29 +361,28 @@ acpi_button_add (
|
|||||||
|
|
||||||
switch (button->type) {
|
switch (button->type) {
|
||||||
case ACPI_BUTTON_TYPE_POWERF:
|
case ACPI_BUTTON_TYPE_POWERF:
|
||||||
status = acpi_install_fixed_event_handler (
|
status =
|
||||||
ACPI_EVENT_POWER_BUTTON,
|
acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
|
||||||
acpi_button_notify_fixed,
|
acpi_button_notify_fixed,
|
||||||
button);
|
button);
|
||||||
break;
|
break;
|
||||||
case ACPI_BUTTON_TYPE_SLEEPF:
|
case ACPI_BUTTON_TYPE_SLEEPF:
|
||||||
status = acpi_install_fixed_event_handler (
|
status =
|
||||||
ACPI_EVENT_SLEEP_BUTTON,
|
acpi_install_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
|
||||||
acpi_button_notify_fixed,
|
acpi_button_notify_fixed,
|
||||||
button);
|
button);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = acpi_install_notify_handler (
|
status = acpi_install_notify_handler(button->handle,
|
||||||
button->handle,
|
ACPI_DEVICE_NOTIFY,
|
||||||
ACPI_DEVICE_NOTIFY,
|
acpi_button_notify,
|
||||||
acpi_button_notify,
|
button);
|
||||||
button);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error installing notify handler\n"));
|
"Error installing notify handler\n"));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -415,16 +390,17 @@ acpi_button_add (
|
|||||||
if (device->wakeup.flags.valid) {
|
if (device->wakeup.flags.valid) {
|
||||||
/* Button's GPE is run-wake GPE */
|
/* Button's GPE is run-wake GPE */
|
||||||
acpi_set_gpe_type(device->wakeup.gpe_device,
|
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,
|
acpi_enable_gpe(device->wakeup.gpe_device,
|
||||||
device->wakeup.gpe_number, ACPI_NOT_ISR);
|
device->wakeup.gpe_number, ACPI_NOT_ISR);
|
||||||
device->wakeup.state.enabled = 1;
|
device->wakeup.state.enabled = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "%s [%s]\n",
|
printk(KERN_INFO PREFIX "%s [%s]\n",
|
||||||
acpi_device_name(device), acpi_device_bid(device));
|
acpi_device_name(device), acpi_device_bid(device));
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (result) {
|
if (result) {
|
||||||
acpi_button_remove_fs(device);
|
acpi_button_remove_fs(device);
|
||||||
kfree(button);
|
kfree(button);
|
||||||
@@ -433,12 +409,10 @@ end:
|
|||||||
return_VALUE(result);
|
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;
|
acpi_status status = 0;
|
||||||
struct acpi_button *button = NULL;
|
struct acpi_button *button = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_remove");
|
ACPI_FUNCTION_TRACE("acpi_button_remove");
|
||||||
|
|
||||||
@@ -450,22 +424,25 @@ acpi_button_remove (struct acpi_device *device, int type)
|
|||||||
/* Unregister for device notifications. */
|
/* Unregister for device notifications. */
|
||||||
switch (button->type) {
|
switch (button->type) {
|
||||||
case ACPI_BUTTON_TYPE_POWERF:
|
case ACPI_BUTTON_TYPE_POWERF:
|
||||||
status = acpi_remove_fixed_event_handler(
|
status =
|
||||||
ACPI_EVENT_POWER_BUTTON, acpi_button_notify_fixed);
|
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
|
||||||
|
acpi_button_notify_fixed);
|
||||||
break;
|
break;
|
||||||
case ACPI_BUTTON_TYPE_SLEEPF:
|
case ACPI_BUTTON_TYPE_SLEEPF:
|
||||||
status = acpi_remove_fixed_event_handler(
|
status =
|
||||||
ACPI_EVENT_SLEEP_BUTTON, acpi_button_notify_fixed);
|
acpi_remove_fixed_event_handler(ACPI_EVENT_SLEEP_BUTTON,
|
||||||
|
acpi_button_notify_fixed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
status = acpi_remove_notify_handler(button->handle,
|
status = acpi_remove_notify_handler(button->handle,
|
||||||
ACPI_DEVICE_NOTIFY, acpi_button_notify);
|
ACPI_DEVICE_NOTIFY,
|
||||||
|
acpi_button_notify);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error removing notify handler\n"));
|
"Error removing notify handler\n"));
|
||||||
|
|
||||||
acpi_button_remove_fs(device);
|
acpi_button_remove_fs(device);
|
||||||
|
|
||||||
@@ -474,11 +451,9 @@ acpi_button_remove (struct acpi_device *device, int type)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init acpi_button_init(void)
|
||||||
static int __init
|
|
||||||
acpi_button_init (void)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_init");
|
ACPI_FUNCTION_TRACE("acpi_button_init");
|
||||||
|
|
||||||
@@ -495,9 +470,7 @@ acpi_button_init (void)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __exit acpi_button_exit(void)
|
||||||
static void __exit
|
|
||||||
acpi_button_exit (void)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("acpi_button_exit");
|
ACPI_FUNCTION_TRACE("acpi_button_exit");
|
||||||
|
|
||||||
@@ -514,6 +487,5 @@ acpi_button_exit (void)
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module_init(acpi_button_init);
|
module_init(acpi_button_init);
|
||||||
module_exit(acpi_button_exit);
|
module_exit(acpi_button_exit);
|
||||||
|
|||||||
@@ -44,9 +44,9 @@
|
|||||||
|
|
||||||
#define ACPI_CONTAINER_COMPONENT 0x01000000
|
#define ACPI_CONTAINER_COMPONENT 0x01000000
|
||||||
#define _COMPONENT ACPI_CONTAINER_COMPONENT
|
#define _COMPONENT ACPI_CONTAINER_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_container")
|
ACPI_MODULE_NAME("acpi_container")
|
||||||
|
|
||||||
MODULE_AUTHOR("Anil S Keshavamurthy");
|
MODULE_AUTHOR("Anil S Keshavamurthy");
|
||||||
MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
|
MODULE_DESCRIPTION(ACPI_CONTAINER_DRIVER_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
@@ -56,41 +56,38 @@ static int acpi_container_add(struct acpi_device *device);
|
|||||||
static int acpi_container_remove(struct acpi_device *device, int type);
|
static int acpi_container_remove(struct acpi_device *device, int type);
|
||||||
|
|
||||||
static struct acpi_driver acpi_container_driver = {
|
static struct acpi_driver acpi_container_driver = {
|
||||||
.name = ACPI_CONTAINER_DRIVER_NAME,
|
.name = ACPI_CONTAINER_DRIVER_NAME,
|
||||||
.class = ACPI_CONTAINER_CLASS,
|
.class = ACPI_CONTAINER_CLASS,
|
||||||
.ids = "ACPI0004,PNP0A05,PNP0A06",
|
.ids = "ACPI0004,PNP0A05,PNP0A06",
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_container_add,
|
.add = acpi_container_add,
|
||||||
.remove = acpi_container_remove,
|
.remove = acpi_container_remove,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
|
|
||||||
static int
|
static int is_device_present(acpi_handle handle)
|
||||||
is_device_present(acpi_handle handle)
|
|
||||||
{
|
{
|
||||||
acpi_handle temp;
|
acpi_handle temp;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
unsigned long sta;
|
unsigned long sta;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("is_device_present");
|
ACPI_FUNCTION_TRACE("is_device_present");
|
||||||
|
|
||||||
status = acpi_get_handle(handle, "_STA", &temp);
|
status = acpi_get_handle(handle, "_STA", &temp);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return_VALUE(1); /* _STA not found, assmue device present */
|
return_VALUE(1); /* _STA not found, assmue device present */
|
||||||
|
|
||||||
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
|
status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return_VALUE(0); /* Firmware error */
|
return_VALUE(0); /* Firmware error */
|
||||||
|
|
||||||
return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
|
return_VALUE((sta & ACPI_STA_PRESENT) == ACPI_STA_PRESENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
static int
|
static int acpi_container_add(struct acpi_device *device)
|
||||||
acpi_container_add(struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
struct acpi_container *container;
|
struct acpi_container *container;
|
||||||
|
|
||||||
@@ -102,7 +99,7 @@ acpi_container_add(struct acpi_device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
|
container = kmalloc(sizeof(struct acpi_container), GFP_KERNEL);
|
||||||
if(!container)
|
if (!container)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
|
|
||||||
memset(container, 0, sizeof(struct acpi_container));
|
memset(container, 0, sizeof(struct acpi_container));
|
||||||
@@ -111,19 +108,17 @@ acpi_container_add(struct acpi_device *device)
|
|||||||
strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
|
strcpy(acpi_device_class(device), ACPI_CONTAINER_CLASS);
|
||||||
acpi_driver_data(device) = container;
|
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)));
|
acpi_device_name(device), acpi_device_bid(device)));
|
||||||
|
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_container_remove(struct acpi_device *device, int type)
|
||||||
acpi_container_remove(struct acpi_device *device, int type)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_container *pc = NULL;
|
struct acpi_container *pc = NULL;
|
||||||
pc = (struct acpi_container*) acpi_driver_data(device);
|
pc = (struct acpi_container *)acpi_driver_data(device);
|
||||||
|
|
||||||
if (pc)
|
if (pc)
|
||||||
kfree(pc);
|
kfree(pc);
|
||||||
@@ -131,9 +126,7 @@ acpi_container_remove(struct acpi_device *device, int type)
|
|||||||
return status;
|
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;
|
acpi_handle phandle;
|
||||||
struct acpi_device *pdev;
|
struct acpi_device *pdev;
|
||||||
@@ -158,10 +151,9 @@ container_device_add(struct acpi_device **device, acpi_handle handle)
|
|||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void container_notify_cb(acpi_handle handle, u32 type, void *context)
|
||||||
container_notify_cb(acpi_handle handle, u32 type, void *context)
|
|
||||||
{
|
{
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
int result;
|
int result;
|
||||||
int present;
|
int present;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
@@ -175,8 +167,8 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
|
|||||||
/* Fall through */
|
/* Fall through */
|
||||||
case ACPI_NOTIFY_DEVICE_CHECK:
|
case ACPI_NOTIFY_DEVICE_CHECK:
|
||||||
printk("Container driver received %s event\n",
|
printk("Container driver received %s event\n",
|
||||||
(type == ACPI_NOTIFY_BUS_CHECK)?
|
(type == ACPI_NOTIFY_BUS_CHECK) ?
|
||||||
"ACPI_NOTIFY_BUS_CHECK":"ACPI_NOTIFY_DEVICE_CHECK");
|
"ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
|
||||||
status = acpi_bus_get_device(handle, &device);
|
status = acpi_bus_get_device(handle, &device);
|
||||||
if (present) {
|
if (present) {
|
||||||
if (ACPI_FAILURE(status) || !device) {
|
if (ACPI_FAILURE(status) || !device) {
|
||||||
@@ -207,15 +199,13 @@ container_notify_cb(acpi_handle handle, u32 type, void *context)
|
|||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
container_walk_namespace_cb(acpi_handle handle,
|
container_walk_namespace_cb(acpi_handle handle,
|
||||||
u32 lvl,
|
u32 lvl, void *context, void **rv)
|
||||||
void *context,
|
|
||||||
void **rv)
|
|
||||||
{
|
{
|
||||||
char *hid = NULL;
|
char *hid = NULL;
|
||||||
struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
struct acpi_device_info *info;
|
struct acpi_device_info *info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
int *action = context;
|
int *action = context;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
|
ACPI_FUNCTION_TRACE("container_walk_namespace_cb");
|
||||||
|
|
||||||
@@ -233,66 +223,60 @@ container_walk_namespace_cb(acpi_handle handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
|
if (strcmp(hid, "ACPI0004") && strcmp(hid, "PNP0A05") &&
|
||||||
strcmp(hid, "PNP0A06")) {
|
strcmp(hid, "PNP0A06")) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(*action) {
|
switch (*action) {
|
||||||
case INSTALL_NOTIFY_HANDLER:
|
case INSTALL_NOTIFY_HANDLER:
|
||||||
acpi_install_notify_handler(handle,
|
acpi_install_notify_handler(handle,
|
||||||
ACPI_SYSTEM_NOTIFY,
|
ACPI_SYSTEM_NOTIFY,
|
||||||
container_notify_cb,
|
container_notify_cb, NULL);
|
||||||
NULL);
|
|
||||||
break;
|
break;
|
||||||
case UNINSTALL_NOTIFY_HANDLER:
|
case UNINSTALL_NOTIFY_HANDLER:
|
||||||
acpi_remove_notify_handler(handle,
|
acpi_remove_notify_handler(handle,
|
||||||
ACPI_SYSTEM_NOTIFY,
|
ACPI_SYSTEM_NOTIFY,
|
||||||
container_notify_cb);
|
container_notify_cb);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
acpi_os_free(buffer.pointer);
|
acpi_os_free(buffer.pointer);
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init acpi_container_init(void)
|
||||||
static int __init
|
|
||||||
acpi_container_init(void)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int action = INSTALL_NOTIFY_HANDLER;
|
int action = INSTALL_NOTIFY_HANDLER;
|
||||||
|
|
||||||
result = acpi_bus_register_driver(&acpi_container_driver);
|
result = acpi_bus_register_driver(&acpi_container_driver);
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return(result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* register notify handler to every container device */
|
/* register notify handler to every container device */
|
||||||
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
||||||
ACPI_ROOT_OBJECT,
|
ACPI_ROOT_OBJECT,
|
||||||
ACPI_UINT32_MAX,
|
ACPI_UINT32_MAX,
|
||||||
container_walk_namespace_cb,
|
container_walk_namespace_cb, &action, NULL);
|
||||||
&action, NULL);
|
|
||||||
|
|
||||||
return(0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit
|
static void __exit acpi_container_exit(void)
|
||||||
acpi_container_exit(void)
|
|
||||||
{
|
{
|
||||||
int action = UNINSTALL_NOTIFY_HANDLER;
|
int action = UNINSTALL_NOTIFY_HANDLER;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_container_exit");
|
ACPI_FUNCTION_TRACE("acpi_container_exit");
|
||||||
|
|
||||||
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
acpi_walk_namespace(ACPI_TYPE_DEVICE,
|
||||||
ACPI_ROOT_OBJECT,
|
ACPI_ROOT_OBJECT,
|
||||||
ACPI_UINT32_MAX,
|
ACPI_UINT32_MAX,
|
||||||
container_walk_namespace_cb,
|
container_walk_namespace_cb, &action, NULL);
|
||||||
&action, NULL);
|
|
||||||
|
|
||||||
acpi_bus_unregister_driver(&acpi_container_driver);
|
acpi_bus_unregister_driver(&acpi_container_driver);
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,14 @@
|
|||||||
#include <acpi/acglobal.h>
|
#include <acpi/acglobal.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||||
ACPI_MODULE_NAME ("debug")
|
ACPI_MODULE_NAME("debug")
|
||||||
|
|
||||||
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
|
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
|
||||||
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
|
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
|
||||||
|
|
||||||
#ifdef MODULE_PARAM_PREFIX
|
#ifdef MODULE_PARAM_PREFIX
|
||||||
#undef MODULE_PARAM_PREFIX
|
#undef MODULE_PARAM_PREFIX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MODULE_PARAM_PREFIX
|
#define MODULE_PARAM_PREFIX
|
||||||
module_param(acpi_dbg_layer, uint, 0400);
|
module_param(acpi_dbg_layer, uint, 0400);
|
||||||
module_param(acpi_dbg_level, uint, 0400);
|
module_param(acpi_dbg_level, uint, 0400);
|
||||||
|
|
||||||
struct acpi_dlayer {
|
struct acpi_dlayer {
|
||||||
@@ -35,8 +32,7 @@ struct acpi_dlevel {
|
|||||||
};
|
};
|
||||||
#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
|
#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_UTILITIES),
|
||||||
ACPI_DEBUG_INIT(ACPI_HARDWARE),
|
ACPI_DEBUG_INIT(ACPI_HARDWARE),
|
||||||
ACPI_DEBUG_INIT(ACPI_EVENTS),
|
ACPI_DEBUG_INIT(ACPI_EVENTS),
|
||||||
@@ -53,8 +49,7 @@ static const struct acpi_dlayer acpi_debug_layers[] =
|
|||||||
ACPI_DEBUG_INIT(ACPI_TOOLS),
|
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_ERROR),
|
||||||
ACPI_DEBUG_INIT(ACPI_LV_WARN),
|
ACPI_DEBUG_INIT(ACPI_LV_WARN),
|
||||||
ACPI_DEBUG_INIT(ACPI_LV_INIT),
|
ACPI_DEBUG_INIT(ACPI_LV_INIT),
|
||||||
@@ -92,77 +87,73 @@ static const struct acpi_dlevel acpi_debug_levels[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_system_read_debug (
|
acpi_system_read_debug(char *page,
|
||||||
char *page,
|
char **start, off_t off, int count, int *eof, void *data)
|
||||||
char **start,
|
|
||||||
off_t off,
|
|
||||||
int count,
|
|
||||||
int *eof,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
char *p = page;
|
char *p = page;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (off != 0)
|
if (off != 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
p += sprintf(p, "%-25s\tHex SET\n", "Description");
|
p += sprintf(p, "%-25s\tHex SET\n", "Description");
|
||||||
|
|
||||||
switch ((unsigned long) data) {
|
switch ((unsigned long)data) {
|
||||||
case 0:
|
case 0:
|
||||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
|
for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
|
||||||
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
|
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
|
||||||
acpi_debug_layers[i].name,
|
acpi_debug_layers[i].name,
|
||||||
acpi_debug_layers[i].value,
|
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",
|
p += sprintf(p, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
|
||||||
ACPI_ALL_DRIVERS,
|
ACPI_ALL_DRIVERS,
|
||||||
(acpi_dbg_layer & ACPI_ALL_DRIVERS) == ACPI_ALL_DRIVERS?
|
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
|
||||||
'*' : (acpi_dbg_layer & ACPI_ALL_DRIVERS) == 0 ?
|
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
|
||||||
' ' : '-');
|
ACPI_ALL_DRIVERS) ==
|
||||||
|
0 ? ' ' : '-');
|
||||||
p += sprintf(p,
|
p += sprintf(p,
|
||||||
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
|
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
|
||||||
acpi_dbg_layer);
|
acpi_dbg_layer);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
|
for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
|
||||||
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
|
p += sprintf(p, "%-25s\t0x%08lX [%c]\n",
|
||||||
acpi_debug_levels[i].name,
|
acpi_debug_levels[i].name,
|
||||||
acpi_debug_levels[i].value,
|
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",
|
p += sprintf(p, "--\ndebug_level = 0x%08X (* = enabled)\n",
|
||||||
acpi_dbg_level);
|
acpi_dbg_level);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
p += sprintf(p, "Invalid debug option\n");
|
p += sprintf(p, "Invalid debug option\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
size = (p - page);
|
size = (p - page);
|
||||||
if (size <= off+count) *eof = 1;
|
if (size <= off + count)
|
||||||
|
*eof = 1;
|
||||||
*start = page + off;
|
*start = page + off;
|
||||||
size -= off;
|
size -= off;
|
||||||
if (size>count) size = count;
|
if (size > count)
|
||||||
if (size<0) size = 0;
|
size = count;
|
||||||
|
if (size < 0)
|
||||||
|
size = 0;
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_system_write_debug (
|
acpi_system_write_debug(struct file *file,
|
||||||
struct file *file,
|
const char __user * buffer,
|
||||||
const char __user *buffer,
|
unsigned long count, void *data)
|
||||||
unsigned long count,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
char debug_string[12] = {'\0'};
|
char debug_string[12] = { '\0' };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
|
ACPI_FUNCTION_TRACE("acpi_system_write_debug");
|
||||||
|
|
||||||
@@ -174,7 +165,7 @@ acpi_system_write_debug (
|
|||||||
|
|
||||||
debug_string[count] = '\0';
|
debug_string[count] = '\0';
|
||||||
|
|
||||||
switch ((unsigned long) data) {
|
switch ((unsigned long)data) {
|
||||||
case 0:
|
case 0:
|
||||||
acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
|
acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
|
||||||
break;
|
break;
|
||||||
@@ -190,9 +181,9 @@ acpi_system_write_debug (
|
|||||||
|
|
||||||
static int __init acpi_debug_init(void)
|
static int __init acpi_debug_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry;
|
struct proc_dir_entry *entry;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
char * name;
|
char *name;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_debug_init");
|
ACPI_FUNCTION_TRACE("acpi_debug_init");
|
||||||
|
|
||||||
@@ -201,8 +192,10 @@ static int __init acpi_debug_init(void)
|
|||||||
|
|
||||||
/* 'debug_layer' [R/W] */
|
/* 'debug_layer' [R/W] */
|
||||||
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
|
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
|
||||||
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
|
entry =
|
||||||
acpi_system_read_debug,(void *)0);
|
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
|
||||||
|
acpi_root_dir, acpi_system_read_debug,
|
||||||
|
(void *)0);
|
||||||
if (entry)
|
if (entry)
|
||||||
entry->write_proc = acpi_system_write_debug;
|
entry->write_proc = acpi_system_write_debug;
|
||||||
else
|
else
|
||||||
@@ -210,19 +203,21 @@ static int __init acpi_debug_init(void)
|
|||||||
|
|
||||||
/* 'debug_level' [R/W] */
|
/* 'debug_level' [R/W] */
|
||||||
name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
|
name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
|
||||||
entry = create_proc_read_entry(name, S_IFREG|S_IRUGO|S_IWUSR, acpi_root_dir,
|
entry =
|
||||||
acpi_system_read_debug, (void *)1);
|
create_proc_read_entry(name, S_IFREG | S_IRUGO | S_IWUSR,
|
||||||
|
acpi_root_dir, acpi_system_read_debug,
|
||||||
|
(void *)1);
|
||||||
if (entry)
|
if (entry)
|
||||||
entry->write_proc = acpi_system_write_debug;
|
entry->write_proc = acpi_system_write_debug;
|
||||||
else
|
else
|
||||||
goto Error;
|
goto Error;
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
return_VALUE(error);
|
return_VALUE(error);
|
||||||
|
|
||||||
Error:
|
Error:
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' proc fs entry\n", name));
|
"Unable to create '%s' proc fs entry\n", name));
|
||||||
|
|
||||||
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
|
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
|
||||||
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
|
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
@@ -49,18 +48,14 @@
|
|||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dsfield")
|
ACPI_MODULE_NAME("dsfield")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_get_field_names (
|
acpi_ds_get_field_names(struct acpi_create_field_info *info,
|
||||||
struct acpi_create_field_info *info,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *arg);
|
||||||
union acpi_parse_object *arg);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -82,41 +77,36 @@ acpi_ds_get_field_names (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_buffer_field (
|
acpi_ds_create_buffer_field(union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *second_desc = NULL;
|
union acpi_operand_object *second_desc = NULL;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_create_buffer_field");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_create_buffer_field");
|
||||||
|
|
||||||
/* Get the name_string argument */
|
/* Get the name_string argument */
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
|
if (op->common.aml_opcode == AML_CREATE_FIELD_OP) {
|
||||||
arg = acpi_ps_get_arg (op, 3);
|
arg = acpi_ps_get_arg(op, 3);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Create Bit/Byte/Word/Dword field */
|
/* Create Bit/Byte/Word/Dword field */
|
||||||
|
|
||||||
arg = acpi_ps_get_arg (op, 2);
|
arg = acpi_ps_get_arg(op, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (walk_state->deferred_node) {
|
if (walk_state->deferred_node) {
|
||||||
node = walk_state->deferred_node;
|
node = walk_state->deferred_node;
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* During the load phase, we want to enter the name of the field into
|
* 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
|
* the namespace. During the execute phase (when we evaluate the size
|
||||||
@@ -124,21 +114,22 @@ acpi_ds_create_buffer_field (
|
|||||||
*/
|
*/
|
||||||
if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
|
if (walk_state->parse_flags & ACPI_PARSE_EXECUTE) {
|
||||||
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
|
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
|
flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
|
||||||
ACPI_NS_ERROR_IF_FOUND;
|
ACPI_NS_ERROR_IF_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enter the name_string into the namespace
|
* Enter the name_string into the namespace
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
|
status =
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1,
|
acpi_ns_lookup(walk_state->scope_info,
|
||||||
flags, walk_state, &(node));
|
arg->common.value.string, ACPI_TYPE_ANY,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.string, status);
|
&(node));
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(arg->common.value.string, status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,9 +144,9 @@ acpi_ds_create_buffer_field (
|
|||||||
* and we need to create the field object. Otherwise, this was a lookup
|
* and we need to create the field object. Otherwise, this was a lookup
|
||||||
* of an existing node and we don't want to create the field object again.
|
* of an existing node and we don't want to create the field object again.
|
||||||
*/
|
*/
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -165,7 +156,7 @@ acpi_ds_create_buffer_field (
|
|||||||
|
|
||||||
/* Create the buffer field object */
|
/* Create the buffer field object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER_FIELD);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER_FIELD);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -176,28 +167,26 @@ acpi_ds_create_buffer_field (
|
|||||||
* opcode and operands -- since the buffer and index
|
* opcode and operands -- since the buffer and index
|
||||||
* operands must be evaluated.
|
* operands must be evaluated.
|
||||||
*/
|
*/
|
||||||
second_desc = obj_desc->common.next_object;
|
second_desc = obj_desc->common.next_object;
|
||||||
second_desc->extra.aml_start = op->named.data;
|
second_desc->extra.aml_start = op->named.data;
|
||||||
second_desc->extra.aml_length = op->named.length;
|
second_desc->extra.aml_length = op->named.length;
|
||||||
obj_desc->buffer_field.node = node;
|
obj_desc->buffer_field.node = node;
|
||||||
|
|
||||||
/* Attach constructed field descriptors to parent node */
|
/* Attach constructed field descriptors to parent node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
|
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_BUFFER_FIELD);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_get_field_names
|
* FUNCTION: acpi_ds_get_field_names
|
||||||
@@ -214,17 +203,14 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_get_field_names (
|
acpi_ds_get_field_names(struct acpi_create_field_info *info,
|
||||||
struct acpi_create_field_info *info,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *arg)
|
||||||
union acpi_parse_object *arg)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_integer position;
|
acpi_integer position;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_get_field_names", info);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_get_field_names", info);
|
||||||
|
|
||||||
/* First field starts at bit zero */
|
/* First field starts at bit zero */
|
||||||
|
|
||||||
@@ -243,18 +229,16 @@ acpi_ds_get_field_names (
|
|||||||
case AML_INT_RESERVEDFIELD_OP:
|
case AML_INT_RESERVEDFIELD_OP:
|
||||||
|
|
||||||
position = (acpi_integer) info->field_bit_position
|
position = (acpi_integer) info->field_bit_position
|
||||||
+ (acpi_integer) arg->common.value.size;
|
+ (acpi_integer) arg->common.value.size;
|
||||||
|
|
||||||
if (position > ACPI_UINT32_MAX) {
|
if (position > ACPI_UINT32_MAX) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Bit offset within field too large (> 0xFFFFFFFF)\n"));
|
||||||
"Bit offset within field too large (> 0xFFFFFFFF)\n"));
|
return_ACPI_STATUS(AE_SUPPORT);
|
||||||
return_ACPI_STATUS (AE_SUPPORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info->field_bit_position = (u32) position;
|
info->field_bit_position = (u32) position;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INT_ACCESSFIELD_OP:
|
case AML_INT_ACCESSFIELD_OP:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -266,73 +250,70 @@ acpi_ds_get_field_names (
|
|||||||
* ACCESS_TYPE bits
|
* ACCESS_TYPE bits
|
||||||
*/
|
*/
|
||||||
info->field_flags = (u8)
|
info->field_flags = (u8)
|
||||||
((info->field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
|
((info->
|
||||||
((u8) ((u32) arg->common.value.integer >> 8)));
|
field_flags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
|
||||||
|
((u8) ((u32) arg->common.value.integer >> 8)));
|
||||||
|
|
||||||
info->attribute = (u8) (arg->common.value.integer);
|
info->attribute = (u8) (arg->common.value.integer);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INT_NAMEDFIELD_OP:
|
case AML_INT_NAMEDFIELD_OP:
|
||||||
|
|
||||||
/* Lookup the name */
|
/* Lookup the name */
|
||||||
|
|
||||||
status = acpi_ns_lookup (walk_state->scope_info,
|
status = acpi_ns_lookup(walk_state->scope_info,
|
||||||
(char *) &arg->named.name,
|
(char *)&arg->named.name,
|
||||||
info->field_type, ACPI_IMODE_EXECUTE,
|
info->field_type,
|
||||||
ACPI_NS_DONT_OPEN_SCOPE,
|
ACPI_IMODE_EXECUTE,
|
||||||
walk_state, &info->field_node);
|
ACPI_NS_DONT_OPEN_SCOPE,
|
||||||
if (ACPI_FAILURE (status)) {
|
walk_state, &info->field_node);
|
||||||
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR((char *)&arg->named.name,
|
||||||
|
status);
|
||||||
if (status != AE_ALREADY_EXISTS) {
|
if (status != AE_ALREADY_EXISTS) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Already exists, ignore error */
|
/* Already exists, ignore error */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
arg->common.node = info->field_node;
|
arg->common.node = info->field_node;
|
||||||
info->field_bit_length = arg->common.value.size;
|
info->field_bit_length = arg->common.value.size;
|
||||||
|
|
||||||
/* Create and initialize an object for the new Field Node */
|
/* Create and initialize an object for the new Field Node */
|
||||||
|
|
||||||
status = acpi_ex_prep_field_value (info);
|
status = acpi_ex_prep_field_value(info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep track of bit position for the next field */
|
/* Keep track of bit position for the next field */
|
||||||
|
|
||||||
position = (acpi_integer) info->field_bit_position
|
position = (acpi_integer) info->field_bit_position
|
||||||
+ (acpi_integer) arg->common.value.size;
|
+ (acpi_integer) arg->common.value.size;
|
||||||
|
|
||||||
if (position > ACPI_UINT32_MAX) {
|
if (position > ACPI_UINT32_MAX) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", (char *)&info->field_node->name));
|
||||||
"Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
|
return_ACPI_STATUS(AE_SUPPORT);
|
||||||
(char *) &info->field_node->name));
|
|
||||||
return_ACPI_STATUS (AE_SUPPORT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info->field_bit_position += info->field_bit_length;
|
info->field_bit_position += info->field_bit_length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Invalid opcode in field list: %X\n",
|
"Invalid opcode in field list: %X\n",
|
||||||
arg->common.aml_opcode));
|
arg->common.aml_opcode));
|
||||||
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = arg->common.next;
|
arg = arg->common.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_create_field
|
* FUNCTION: acpi_ds_create_field
|
||||||
@@ -348,29 +329,28 @@ acpi_ds_get_field_names (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_field (
|
acpi_ds_create_field(union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
struct acpi_namespace_node *region_node,
|
||||||
struct acpi_namespace_node *region_node,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
struct acpi_create_field_info info;
|
struct acpi_create_field_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_create_field", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_create_field", op);
|
||||||
|
|
||||||
/* First arg is the name of the parent op_region (must already exist) */
|
/* First arg is the name of the parent op_region (must already exist) */
|
||||||
|
|
||||||
arg = op->common.value.arg;
|
arg = op->common.value.arg;
|
||||||
if (!region_node) {
|
if (!region_node) {
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
|
status =
|
||||||
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
|
acpi_ns_lookup(walk_state->scope_info,
|
||||||
ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node);
|
arg->common.value.name, ACPI_TYPE_REGION,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.name, status);
|
walk_state, ®ion_node);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(arg->common.value.name, status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,12 +365,11 @@ acpi_ds_create_field (
|
|||||||
info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
|
info.field_type = ACPI_TYPE_LOCAL_REGION_FIELD;
|
||||||
info.region_node = region_node;
|
info.region_node = region_node;
|
||||||
|
|
||||||
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
|
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_init_field_objects
|
* FUNCTION: acpi_ds_init_field_objects
|
||||||
@@ -407,37 +386,34 @@ acpi_ds_create_field (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_init_field_objects (
|
acpi_ds_init_field_objects(union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_parse_object *arg = NULL;
|
union acpi_parse_object *arg = NULL;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
u8 type = 0;
|
u8 type = 0;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_init_field_objects", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_init_field_objects", op);
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_FIELD_OP:
|
case AML_FIELD_OP:
|
||||||
arg = acpi_ps_get_arg (op, 2);
|
arg = acpi_ps_get_arg(op, 2);
|
||||||
type = ACPI_TYPE_LOCAL_REGION_FIELD;
|
type = ACPI_TYPE_LOCAL_REGION_FIELD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_BANK_FIELD_OP:
|
case AML_BANK_FIELD_OP:
|
||||||
arg = acpi_ps_get_arg (op, 4);
|
arg = acpi_ps_get_arg(op, 4);
|
||||||
type = ACPI_TYPE_LOCAL_BANK_FIELD;
|
type = ACPI_TYPE_LOCAL_BANK_FIELD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_INDEX_FIELD_OP:
|
case AML_INDEX_FIELD_OP:
|
||||||
arg = acpi_ps_get_arg (op, 3);
|
arg = acpi_ps_get_arg(op, 3);
|
||||||
type = ACPI_TYPE_LOCAL_INDEX_FIELD;
|
type = ACPI_TYPE_LOCAL_INDEX_FIELD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -447,16 +423,18 @@ acpi_ds_init_field_objects (
|
|||||||
/* Ignore OFFSET and ACCESSAS terms here */
|
/* Ignore OFFSET and ACCESSAS terms here */
|
||||||
|
|
||||||
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
|
if (arg->common.aml_opcode == AML_INT_NAMEDFIELD_OP) {
|
||||||
status = acpi_ns_lookup (walk_state->scope_info,
|
status = acpi_ns_lookup(walk_state->scope_info,
|
||||||
(char *) &arg->named.name,
|
(char *)&arg->named.name,
|
||||||
type, ACPI_IMODE_LOAD_PASS1,
|
type, ACPI_IMODE_LOAD_PASS1,
|
||||||
ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
|
ACPI_NS_NO_UPSEARCH |
|
||||||
ACPI_NS_ERROR_IF_FOUND,
|
ACPI_NS_DONT_OPEN_SCOPE |
|
||||||
walk_state, &node);
|
ACPI_NS_ERROR_IF_FOUND,
|
||||||
if (ACPI_FAILURE (status)) {
|
walk_state, &node);
|
||||||
ACPI_REPORT_NSERROR ((char *) &arg->named.name, status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR((char *)&arg->named.name,
|
||||||
|
status);
|
||||||
if (status != AE_ALREADY_EXISTS) {
|
if (status != AE_ALREADY_EXISTS) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Name already exists, just ignore this error */
|
/* Name already exists, just ignore this error */
|
||||||
@@ -472,10 +450,9 @@ acpi_ds_init_field_objects (
|
|||||||
arg = arg->common.next;
|
arg = arg->common.next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_create_bank_field
|
* FUNCTION: acpi_ds_create_bank_field
|
||||||
@@ -491,41 +468,42 @@ acpi_ds_init_field_objects (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_bank_field (
|
acpi_ds_create_bank_field(union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
struct acpi_namespace_node *region_node,
|
||||||
struct acpi_namespace_node *region_node,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
struct acpi_create_field_info info;
|
struct acpi_create_field_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_create_bank_field", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_create_bank_field", op);
|
||||||
|
|
||||||
/* First arg is the name of the parent op_region (must already exist) */
|
/* First arg is the name of the parent op_region (must already exist) */
|
||||||
|
|
||||||
arg = op->common.value.arg;
|
arg = op->common.value.arg;
|
||||||
if (!region_node) {
|
if (!region_node) {
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.name,
|
status =
|
||||||
ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
|
acpi_ns_lookup(walk_state->scope_info,
|
||||||
ACPI_NS_SEARCH_PARENT, walk_state, ®ion_node);
|
arg->common.value.name, ACPI_TYPE_REGION,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.name, status);
|
walk_state, ®ion_node);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(arg->common.value.name, status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second arg is the Bank Register (Field) (must already exist) */
|
/* Second arg is the Bank Register (Field) (must already exist) */
|
||||||
|
|
||||||
arg = arg->common.next;
|
arg = arg->common.next;
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
|
status =
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
|
||||||
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.string, status);
|
&info.register_node);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(arg->common.value.string, status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Third arg is the bank_value */
|
/* Third arg is the bank_value */
|
||||||
@@ -543,12 +521,11 @@ acpi_ds_create_bank_field (
|
|||||||
info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
|
info.field_type = ACPI_TYPE_LOCAL_BANK_FIELD;
|
||||||
info.region_node = region_node;
|
info.region_node = region_node;
|
||||||
|
|
||||||
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
|
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_create_index_field
|
* FUNCTION: acpi_ds_create_index_field
|
||||||
@@ -564,39 +541,40 @@ acpi_ds_create_bank_field (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_index_field (
|
acpi_ds_create_index_field(union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
struct acpi_namespace_node *region_node,
|
||||||
struct acpi_namespace_node *region_node,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
struct acpi_create_field_info info;
|
struct acpi_create_field_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_create_index_field", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_create_index_field", op);
|
||||||
|
|
||||||
/* First arg is the name of the Index register (must already exist) */
|
/* First arg is the name of the Index register (must already exist) */
|
||||||
|
|
||||||
arg = op->common.value.arg;
|
arg = op->common.value.arg;
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
|
status =
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
|
||||||
ACPI_NS_SEARCH_PARENT, walk_state, &info.register_node);
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.string, status);
|
&info.register_node);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(arg->common.value.string, status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Second arg is the data register (must already exist) */
|
/* Second arg is the data register (must already exist) */
|
||||||
|
|
||||||
arg = arg->common.next;
|
arg = arg->common.next;
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
|
status =
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
acpi_ns_lookup(walk_state->scope_info, arg->common.value.string,
|
||||||
ACPI_NS_SEARCH_PARENT, walk_state, &info.data_register_node);
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.string, status);
|
&info.data_register_node);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(arg->common.value.string, status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Next arg is the field flags */
|
/* Next arg is the field flags */
|
||||||
@@ -609,9 +587,7 @@ acpi_ds_create_index_field (
|
|||||||
info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
|
info.field_type = ACPI_TYPE_LOCAL_INDEX_FIELD;
|
||||||
info.region_node = region_node;
|
info.region_node = region_node;
|
||||||
|
|
||||||
status = acpi_ds_get_field_names (&info, walk_state, arg->common.next);
|
status = acpi_ds_get_field_names(&info, walk_state, arg->common.next);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,23 +41,17 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dsinit")
|
ACPI_MODULE_NAME("dsinit")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_init_one_object (
|
acpi_ds_init_one_object(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 level, void *context, void **return_value);
|
||||||
u32 level,
|
|
||||||
void *context,
|
|
||||||
void **return_value);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -80,20 +74,17 @@ acpi_ds_init_one_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_init_one_object (
|
acpi_ds_init_one_object(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 level, void *context, void **return_value)
|
||||||
u32 level,
|
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
|
struct acpi_init_walk_info *info =
|
||||||
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
|
(struct acpi_init_walk_info *)context;
|
||||||
acpi_object_type type;
|
struct acpi_namespace_node *node =
|
||||||
acpi_status status;
|
(struct acpi_namespace_node *)obj_handle;
|
||||||
|
acpi_object_type type;
|
||||||
|
acpi_status status;
|
||||||
ACPI_FUNCTION_NAME ("ds_init_one_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ds_init_one_object");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are only interested in NS nodes owned by the table that
|
* We are only interested in NS nodes owned by the table that
|
||||||
@@ -107,23 +98,23 @@ acpi_ds_init_one_object (
|
|||||||
|
|
||||||
/* And even then, we are only interested in a few object types */
|
/* And even then, we are only interested in a few object types */
|
||||||
|
|
||||||
type = acpi_ns_get_type (obj_handle);
|
type = acpi_ns_get_type(obj_handle);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ACPI_TYPE_REGION:
|
case ACPI_TYPE_REGION:
|
||||||
|
|
||||||
status = acpi_ds_initialize_region (obj_handle);
|
status = acpi_ds_initialize_region(obj_handle);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Region %p [%4.4s] - Init failure, %s\n",
|
"Region %p [%4.4s] - Init failure, %s\n",
|
||||||
obj_handle, acpi_ut_get_node_name (obj_handle),
|
obj_handle,
|
||||||
acpi_format_exception (status)));
|
acpi_ut_get_node_name(obj_handle),
|
||||||
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
info->op_region_count++;
|
info->op_region_count++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -131,7 +122,7 @@ acpi_ds_init_one_object (
|
|||||||
* the entire pathname
|
* the entire pathname
|
||||||
*/
|
*/
|
||||||
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
|
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -148,12 +139,13 @@ acpi_ds_init_one_object (
|
|||||||
* Always parse methods to detect errors, we will delete
|
* Always parse methods to detect errors, we will delete
|
||||||
* the parse tree below
|
* the parse tree below
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_parse_method (obj_handle);
|
status = acpi_ds_parse_method(obj_handle);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"\n+Method %p [%4.4s] - parse failure, %s\n",
|
"\n+Method %p [%4.4s] - parse failure, %s\n",
|
||||||
obj_handle, acpi_ut_get_node_name (obj_handle),
|
obj_handle,
|
||||||
acpi_format_exception (status)));
|
acpi_ut_get_node_name(obj_handle),
|
||||||
|
acpi_format_exception(status)));
|
||||||
|
|
||||||
/* This parse failed, but we will continue parsing more methods */
|
/* This parse failed, but we will continue parsing more methods */
|
||||||
}
|
}
|
||||||
@@ -161,13 +153,11 @@ acpi_ds_init_one_object (
|
|||||||
info->method_count++;
|
info->method_count++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_DEVICE:
|
case ACPI_TYPE_DEVICE:
|
||||||
|
|
||||||
info->device_count++;
|
info->device_count++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -179,7 +169,6 @@ acpi_ds_init_one_object (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_initialize_objects
|
* FUNCTION: acpi_ds_initialize_objects
|
||||||
@@ -195,45 +184,43 @@ acpi_ds_init_one_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_initialize_objects (
|
acpi_ds_initialize_objects(struct acpi_table_desc * table_desc,
|
||||||
struct acpi_table_desc *table_desc,
|
struct acpi_namespace_node * start_node)
|
||||||
struct acpi_namespace_node *start_node)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_init_walk_info info;
|
struct acpi_init_walk_info info;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_initialize_objects");
|
||||||
|
|
||||||
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:"));
|
||||||
|
|
||||||
|
info.method_count = 0;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
|
||||||
"**** Starting initialization of namespace objects ****\n"));
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
|
|
||||||
|
|
||||||
info.method_count = 0;
|
|
||||||
info.op_region_count = 0;
|
info.op_region_count = 0;
|
||||||
info.object_count = 0;
|
info.object_count = 0;
|
||||||
info.device_count = 0;
|
info.device_count = 0;
|
||||||
info.table_desc = table_desc;
|
info.table_desc = table_desc;
|
||||||
|
|
||||||
/* Walk entire namespace from the supplied root */
|
/* Walk entire namespace from the supplied root */
|
||||||
|
|
||||||
status = acpi_walk_namespace (ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
|
status = acpi_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
|
||||||
acpi_ds_init_one_object, &info, NULL);
|
acpi_ds_init_one_object, &info, NULL);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||||
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
|
"\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,
|
table_desc->pointer->signature,
|
||||||
info.device_count, info.method_count, info.op_region_count));
|
table_desc->owner_id, info.object_count,
|
||||||
|
info.device_count, info.method_count,
|
||||||
|
info.op_region_count));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -49,10 +48,8 @@
|
|||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dsmethod")
|
ACPI_MODULE_NAME("dsmethod")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -67,45 +64,41 @@
|
|||||||
* MUTEX: Assumes parser is locked
|
* 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;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
struct acpi_walk_state *walk_state;
|
struct acpi_walk_state *walk_state;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_parse_method", node);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_parse_method", node);
|
||||||
|
|
||||||
/* Parameter Validation */
|
/* Parameter Validation */
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return_ACPI_STATUS (AE_NULL_ENTRY);
|
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,
|
||||||
acpi_ut_get_node_name (node), node));
|
"**** Parsing [%4.4s] **** named_obj=%p\n",
|
||||||
|
acpi_ut_get_node_name(node), node));
|
||||||
|
|
||||||
/* Extract the method object from the method Node */
|
/* Extract the method object from the method Node */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a mutex for the method if there is a concurrency limit */
|
/* Create a mutex for the method if there is a concurrency limit */
|
||||||
|
|
||||||
if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
|
if ((obj_desc->method.concurrency != ACPI_INFINITE_CONCURRENCY) &&
|
||||||
(!obj_desc->method.semaphore)) {
|
(!obj_desc->method.semaphore)) {
|
||||||
status = acpi_os_create_semaphore (obj_desc->method.concurrency,
|
status = acpi_os_create_semaphore(obj_desc->method.concurrency,
|
||||||
obj_desc->method.concurrency,
|
obj_desc->method.concurrency,
|
||||||
&obj_desc->method.semaphore);
|
&obj_desc->method.semaphore);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,14 +106,14 @@ acpi_ds_parse_method (
|
|||||||
* Allocate a new parser op to be the root of the parsed
|
* Allocate a new parser op to be the root of the parsed
|
||||||
* method tree
|
* method tree
|
||||||
*/
|
*/
|
||||||
op = acpi_ps_alloc_op (AML_METHOD_OP);
|
op = acpi_ps_alloc_op(AML_METHOD_OP);
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init new op with the method name and pointer back to the Node */
|
/* Init new op with the method name and pointer back to the Node */
|
||||||
|
|
||||||
acpi_ps_set_name (op, node->name.integer);
|
acpi_ps_set_name(op, node->name.integer);
|
||||||
op->common.node = node;
|
op->common.node = node;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,25 +121,26 @@ acpi_ds_parse_method (
|
|||||||
* objects (such as Operation Regions) can be created during the
|
* objects (such as Operation Regions) can be created during the
|
||||||
* first pass parse.
|
* first pass parse.
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
|
status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and initialize a new walk state */
|
/* Create and initialize a new walk state */
|
||||||
|
|
||||||
walk_state = acpi_ds_create_walk_state (
|
walk_state =
|
||||||
obj_desc->method.owner_id, NULL, NULL, NULL);
|
acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, NULL,
|
||||||
|
NULL);
|
||||||
if (!walk_state) {
|
if (!walk_state) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_init_aml_walk (walk_state, op, node,
|
status = acpi_ds_init_aml_walk(walk_state, op, node,
|
||||||
obj_desc->method.aml_start,
|
obj_desc->method.aml_start,
|
||||||
obj_desc->method.aml_length, NULL, 1);
|
obj_desc->method.aml_length, NULL, 1);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_ds_delete_walk_state (walk_state);
|
acpi_ds_delete_walk_state(walk_state);
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,32 +153,31 @@ acpi_ds_parse_method (
|
|||||||
* method so that operands to the named objects can take on dynamic
|
* method so that operands to the named objects can take on dynamic
|
||||||
* run-time values.
|
* run-time values.
|
||||||
*/
|
*/
|
||||||
status = acpi_ps_parse_aml (walk_state);
|
status = acpi_ps_parse_aml(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
|
"**** [%4.4s] Parsed **** named_obj=%p Op=%p\n",
|
||||||
acpi_ut_get_node_name (node), node, op));
|
acpi_ut_get_node_name(node), node, op));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete the parse tree. We simply re-parse the method for every
|
* Delete the parse tree. We simply re-parse the method for every
|
||||||
* execution since there isn't much overhead (compared to keeping lots
|
* execution since there isn't much overhead (compared to keeping lots
|
||||||
* of parse trees around)
|
* of parse trees around)
|
||||||
*/
|
*/
|
||||||
acpi_ns_delete_namespace_subtree (node);
|
acpi_ns_delete_namespace_subtree(node);
|
||||||
acpi_ns_delete_namespace_by_owner (obj_desc->method.owner_id);
|
acpi_ns_delete_namespace_by_owner(obj_desc->method.owner_id);
|
||||||
|
|
||||||
cleanup2:
|
cleanup2:
|
||||||
acpi_ut_release_owner_id (&obj_desc->method.owner_id);
|
acpi_ut_release_owner_id(&obj_desc->method.owner_id);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
acpi_ps_delete_parse_tree (op);
|
acpi_ps_delete_parse_tree(op);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_begin_method_execution
|
* FUNCTION: acpi_ds_begin_method_execution
|
||||||
@@ -202,19 +195,16 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_begin_method_execution (
|
acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
|
||||||
struct acpi_namespace_node *method_node,
|
union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
struct acpi_namespace_node *calling_method_node)
|
||||||
struct acpi_namespace_node *calling_method_node)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_begin_method_execution", method_node);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_begin_method_execution", method_node);
|
||||||
|
|
||||||
if (!method_node) {
|
if (!method_node) {
|
||||||
return_ACPI_STATUS (AE_NULL_ENTRY);
|
return_ACPI_STATUS(AE_NULL_ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -231,8 +221,9 @@ acpi_ds_begin_method_execution (
|
|||||||
* thread that is making recursive method calls.
|
* thread that is making recursive method calls.
|
||||||
*/
|
*/
|
||||||
if (method_node == calling_method_node) {
|
if (method_node == calling_method_node) {
|
||||||
if (obj_desc->method.thread_count >= obj_desc->method.concurrency) {
|
if (obj_desc->method.thread_count >=
|
||||||
return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
|
obj_desc->method.concurrency) {
|
||||||
|
return_ACPI_STATUS(AE_AML_METHOD_LIMIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,8 +231,9 @@ acpi_ds_begin_method_execution (
|
|||||||
* Get a unit from the method semaphore. This releases the
|
* Get a unit from the method semaphore. This releases the
|
||||||
* interpreter if we block
|
* interpreter if we block
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_system_wait_semaphore (obj_desc->method.semaphore,
|
status =
|
||||||
ACPI_WAIT_FOREVER);
|
acpi_ex_system_wait_semaphore(obj_desc->method.semaphore,
|
||||||
|
ACPI_WAIT_FOREVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -249,10 +241,9 @@ acpi_ds_begin_method_execution (
|
|||||||
* reentered one more time (even if it is the same thread)
|
* reentered one more time (even if it is the same thread)
|
||||||
*/
|
*/
|
||||||
obj_desc->method.thread_count++;
|
obj_desc->method.thread_count++;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_call_control_method
|
* FUNCTION: acpi_ds_call_control_method
|
||||||
@@ -268,85 +259,86 @@ acpi_ds_begin_method_execution (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_call_control_method (
|
acpi_ds_call_control_method(struct acpi_thread_state *thread,
|
||||||
struct acpi_thread_state *thread,
|
struct acpi_walk_state *this_walk_state,
|
||||||
struct acpi_walk_state *this_walk_state,
|
union acpi_parse_object *op)
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *method_node;
|
struct acpi_namespace_node *method_node;
|
||||||
struct acpi_walk_state *next_walk_state = NULL;
|
struct acpi_walk_state *next_walk_state = NULL;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_parameter_info info;
|
struct acpi_parameter_info info;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_call_control_method", this_walk_state);
|
||||||
|
|
||||||
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));
|
||||||
this_walk_state->prev_op, this_walk_state));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the namespace entry for the control method we are about to call
|
* Get the namespace entry for the control method we are about to call
|
||||||
*/
|
*/
|
||||||
method_node = this_walk_state->method_call_node;
|
method_node = this_walk_state->method_call_node;
|
||||||
if (!method_node) {
|
if (!method_node) {
|
||||||
return_ACPI_STATUS (AE_NULL_ENTRY);
|
return_ACPI_STATUS(AE_NULL_ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (method_node);
|
obj_desc = acpi_ns_get_attached_object(method_node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_allocate_owner_id (&obj_desc->method.owner_id);
|
status = acpi_ut_allocate_owner_id(&obj_desc->method.owner_id);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init for new method, wait on concurrency semaphore */
|
/* Init for new method, wait on concurrency semaphore */
|
||||||
|
|
||||||
status = acpi_ds_begin_method_execution (method_node, obj_desc,
|
status = acpi_ds_begin_method_execution(method_node, obj_desc,
|
||||||
this_walk_state->method_node);
|
this_walk_state->method_node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
|
if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
|
||||||
/* 1) Parse: Create a new walk state for the preempting walk */
|
/* 1) Parse: Create a new walk state for the preempting walk */
|
||||||
|
|
||||||
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
|
next_walk_state =
|
||||||
op, obj_desc, NULL);
|
acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
|
||||||
|
obj_desc, NULL);
|
||||||
if (!next_walk_state) {
|
if (!next_walk_state) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and init a Root Node */
|
/* Create and init a Root Node */
|
||||||
|
|
||||||
op = acpi_ps_create_scope_op ();
|
op = acpi_ps_create_scope_op();
|
||||||
if (!op) {
|
if (!op) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_init_aml_walk (next_walk_state, op, method_node,
|
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,
|
||||||
NULL, 1);
|
obj_desc->method.aml_length,
|
||||||
if (ACPI_FAILURE (status)) {
|
NULL, 1);
|
||||||
acpi_ds_delete_walk_state (next_walk_state);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_ds_delete_walk_state(next_walk_state);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Begin AML parse */
|
/* Begin AML parse */
|
||||||
|
|
||||||
status = acpi_ps_parse_aml (next_walk_state);
|
status = acpi_ps_parse_aml(next_walk_state);
|
||||||
acpi_ps_delete_parse_tree (op);
|
acpi_ps_delete_parse_tree(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2) Execute: Create a new state for the preempting walk */
|
/* 2) Execute: Create a new state for the preempting walk */
|
||||||
|
|
||||||
next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owner_id,
|
next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
|
||||||
NULL, obj_desc, thread);
|
NULL, obj_desc, thread);
|
||||||
if (!next_walk_state) {
|
if (!next_walk_state) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -357,15 +349,15 @@ acpi_ds_call_control_method (
|
|||||||
* start at index 0.
|
* start at index 0.
|
||||||
* Null terminate the list of arguments
|
* Null terminate the list of arguments
|
||||||
*/
|
*/
|
||||||
this_walk_state->operands [this_walk_state->num_operands] = NULL;
|
this_walk_state->operands[this_walk_state->num_operands] = NULL;
|
||||||
|
|
||||||
info.parameters = &this_walk_state->operands[0];
|
info.parameters = &this_walk_state->operands[0];
|
||||||
info.parameter_type = ACPI_PARAM_ARGS;
|
info.parameter_type = ACPI_PARAM_ARGS;
|
||||||
|
|
||||||
status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node,
|
status = acpi_ds_init_aml_walk(next_walk_state, NULL, method_node,
|
||||||
obj_desc->method.aml_start, obj_desc->method.aml_length,
|
obj_desc->method.aml_start,
|
||||||
&info, 3);
|
obj_desc->method.aml_length, &info, 3);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,40 +366,39 @@ acpi_ds_call_control_method (
|
|||||||
* (they were copied to new objects)
|
* (they were copied to new objects)
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < obj_desc->method.param_count; i++) {
|
for (i = 0; i < obj_desc->method.param_count; i++) {
|
||||||
acpi_ut_remove_reference (this_walk_state->operands [i]);
|
acpi_ut_remove_reference(this_walk_state->operands[i]);
|
||||||
this_walk_state->operands [i] = NULL;
|
this_walk_state->operands[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the operand stack */
|
/* Clear the operand stack */
|
||||||
|
|
||||||
this_walk_state->num_operands = 0;
|
this_walk_state->num_operands = 0;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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) {
|
if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {
|
||||||
status = obj_desc->method.implementation (next_walk_state);
|
status = obj_desc->method.implementation(next_walk_state);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
|
|
||||||
/* On error, we must delete the new walk state */
|
/* On error, we must delete the new walk state */
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
acpi_ut_release_owner_id (&obj_desc->method.owner_id);
|
acpi_ut_release_owner_id(&obj_desc->method.owner_id);
|
||||||
if (next_walk_state && (next_walk_state->method_desc)) {
|
if (next_walk_state && (next_walk_state->method_desc)) {
|
||||||
/* Decrement the thread count on the method parse tree */
|
/* Decrement the thread count on the method parse tree */
|
||||||
|
|
||||||
next_walk_state->method_desc->method.thread_count--;
|
next_walk_state->method_desc->method.thread_count--;
|
||||||
}
|
}
|
||||||
(void) acpi_ds_terminate_control_method (next_walk_state);
|
(void)acpi_ds_terminate_control_method(next_walk_state);
|
||||||
acpi_ds_delete_walk_state (next_walk_state);
|
acpi_ds_delete_walk_state(next_walk_state);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_restart_control_method
|
* FUNCTION: acpi_ds_restart_control_method
|
||||||
@@ -423,25 +414,22 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_restart_control_method (
|
acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_operand_object *return_desc)
|
||||||
union acpi_operand_object *return_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_restart_control_method", walk_state);
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
" return_from_this_method_used?=%X res_stack %p Walk %p\n",
|
||||||
"****Restart [%4.4s] Op %p return_value_from_callee %p\n",
|
walk_state->return_used,
|
||||||
(char *) &walk_state->method_node->name, walk_state->method_call_op,
|
walk_state->results, walk_state));
|
||||||
return_desc));
|
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
|
||||||
" return_from_this_method_used?=%X res_stack %p Walk %p\n",
|
|
||||||
walk_state->return_used,
|
|
||||||
walk_state->results, walk_state));
|
|
||||||
|
|
||||||
/* Did the called method return a value? */
|
/* Did the called method return a value? */
|
||||||
|
|
||||||
@@ -451,10 +439,10 @@ acpi_ds_restart_control_method (
|
|||||||
if (walk_state->return_used) {
|
if (walk_state->return_used) {
|
||||||
/* Save the return value from the previous method */
|
/* Save the return value from the previous method */
|
||||||
|
|
||||||
status = acpi_ds_result_push (return_desc, walk_state);
|
status = acpi_ds_result_push(return_desc, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_ut_remove_reference (return_desc);
|
acpi_ut_remove_reference(return_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -472,19 +460,19 @@ acpi_ds_restart_control_method (
|
|||||||
* NOTE: this is optional because the ASL language does not actually
|
* NOTE: this is optional because the ASL language does not actually
|
||||||
* support this behavior.
|
* support this behavior.
|
||||||
*/
|
*/
|
||||||
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
|
* Delete the return value if it will not be used by the
|
||||||
* calling method
|
* calling method
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (return_desc);
|
acpi_ut_remove_reference(return_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_terminate_control_method
|
* FUNCTION: acpi_ds_terminate_control_method
|
||||||
@@ -499,17 +487,13 @@ acpi_ds_restart_control_method (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ds_terminate_control_method(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_terminate_control_method (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_namespace_node *method_node;
|
struct acpi_namespace_node *method_node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_terminate_control_method", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_terminate_control_method", walk_state);
|
||||||
|
|
||||||
if (!walk_state) {
|
if (!walk_state) {
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
@@ -519,30 +503,31 @@ acpi_ds_terminate_control_method (
|
|||||||
|
|
||||||
obj_desc = walk_state->method_desc;
|
obj_desc = walk_state->method_desc;
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete all arguments and locals */
|
/* Delete all arguments and locals */
|
||||||
|
|
||||||
acpi_ds_method_data_delete_all (walk_state);
|
acpi_ds_method_data_delete_all(walk_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock the parser while we terminate this method.
|
* Lock the parser while we terminate this method.
|
||||||
* If this is the last thread executing the method,
|
* If this is the last thread executing the method,
|
||||||
* we have additional cleanup to perform
|
* we have additional cleanup to perform
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_PARSER);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Signal completion of the execution of this method if necessary */
|
/* Signal completion of the execution of this method if necessary */
|
||||||
|
|
||||||
if (walk_state->method_desc->method.semaphore) {
|
if (walk_state->method_desc->method.semaphore) {
|
||||||
status = acpi_os_signal_semaphore (
|
status =
|
||||||
walk_state->method_desc->method.semaphore, 1);
|
acpi_os_signal_semaphore(walk_state->method_desc->method.
|
||||||
if (ACPI_FAILURE (status)) {
|
semaphore, 1);
|
||||||
ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_ERROR(("Could not signal method semaphore\n"));
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
|
|
||||||
/* Ignore error and continue cleanup */
|
/* Ignore error and continue cleanup */
|
||||||
@@ -550,9 +535,10 @@ acpi_ds_terminate_control_method (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (walk_state->method_desc->method.thread_count) {
|
if (walk_state->method_desc->method.thread_count) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"*** Not deleting method namespace, there are still %d threads\n",
|
"*** 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) {
|
if (!walk_state->method_desc->method.thread_count) {
|
||||||
@@ -567,9 +553,11 @@ acpi_ds_terminate_control_method (
|
|||||||
* before creating the synchronization semaphore.
|
* before creating the synchronization semaphore.
|
||||||
*/
|
*/
|
||||||
if ((walk_state->method_desc->method.concurrency == 1) &&
|
if ((walk_state->method_desc->method.concurrency == 1) &&
|
||||||
(!walk_state->method_desc->method.semaphore)) {
|
(!walk_state->method_desc->method.semaphore)) {
|
||||||
status = acpi_os_create_semaphore (1, 1,
|
status = acpi_os_create_semaphore(1, 1,
|
||||||
&walk_state->method_desc->method.semaphore);
|
&walk_state->
|
||||||
|
method_desc->method.
|
||||||
|
semaphore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -584,30 +572,30 @@ acpi_ds_terminate_control_method (
|
|||||||
* Delete any namespace entries created immediately underneath
|
* Delete any namespace entries created immediately underneath
|
||||||
* the method
|
* the method
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method_node->child) {
|
if (method_node->child) {
|
||||||
acpi_ns_delete_namespace_subtree (method_node);
|
acpi_ns_delete_namespace_subtree(method_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete any namespace entries created anywhere else within
|
* Delete any namespace entries created anywhere else within
|
||||||
* the namespace
|
* 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->
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
method.owner_id);
|
||||||
acpi_ut_release_owner_id (&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);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_PARSER);
|
status = acpi_ut_release_mutex(ACPI_MTX_PARSER);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,41 +41,32 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dsmthdat")
|
ACPI_MODULE_NAME("dsmthdat")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ds_method_data_delete_value (
|
acpi_ds_method_data_delete_value(u16 opcode,
|
||||||
u16 opcode,
|
u32 index, struct acpi_walk_state *walk_state);
|
||||||
u32 index,
|
|
||||||
struct acpi_walk_state *walk_state);
|
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_method_data_set_value (
|
acpi_ds_method_data_set_value(u16 opcode,
|
||||||
u16 opcode,
|
u32 index,
|
||||||
u32 index,
|
union acpi_operand_object *object,
|
||||||
union acpi_operand_object *object,
|
struct acpi_walk_state *walk_state);
|
||||||
struct acpi_walk_state *walk_state);
|
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
acpi_object_type
|
acpi_object_type
|
||||||
acpi_ds_method_data_get_type (
|
acpi_ds_method_data_get_type(u16 opcode,
|
||||||
u16 opcode,
|
u32 index, struct acpi_walk_state *walk_state);
|
||||||
u32 index,
|
|
||||||
struct acpi_walk_state *walk_state);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_init
|
* FUNCTION: acpi_ds_method_data_init
|
||||||
@@ -97,45 +88,41 @@ acpi_ds_method_data_get_type (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ds_method_data_init(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_method_data_init (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_method_data_init");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_method_data_init");
|
||||||
|
|
||||||
/* Init the method arguments */
|
/* Init the method arguments */
|
||||||
|
|
||||||
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
|
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) {
|
||||||
ACPI_MOVE_32_TO_32 (&walk_state->arguments[i].name,
|
ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name,
|
||||||
NAMEOF_ARG_NTE);
|
NAMEOF_ARG_NTE);
|
||||||
walk_state->arguments[i].name.integer |= (i << 24);
|
walk_state->arguments[i].name.integer |= (i << 24);
|
||||||
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
|
walk_state->arguments[i].descriptor = ACPI_DESC_TYPE_NAMED;
|
||||||
walk_state->arguments[i].type = ACPI_TYPE_ANY;
|
walk_state->arguments[i].type = ACPI_TYPE_ANY;
|
||||||
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
|
walk_state->arguments[i].flags = ANOBJ_END_OF_PEER_LIST |
|
||||||
ANOBJ_METHOD_ARG;
|
ANOBJ_METHOD_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init the method locals */
|
/* Init the method locals */
|
||||||
|
|
||||||
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
|
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) {
|
||||||
ACPI_MOVE_32_TO_32 (&walk_state->local_variables[i].name,
|
ACPI_MOVE_32_TO_32(&walk_state->local_variables[i].name,
|
||||||
NAMEOF_LOCAL_NTE);
|
NAMEOF_LOCAL_NTE);
|
||||||
|
|
||||||
walk_state->local_variables[i].name.integer |= (i << 24);
|
walk_state->local_variables[i].name.integer |= (i << 24);
|
||||||
walk_state->local_variables[i].descriptor = ACPI_DESC_TYPE_NAMED;
|
walk_state->local_variables[i].descriptor =
|
||||||
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
|
ACPI_DESC_TYPE_NAMED;
|
||||||
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
|
walk_state->local_variables[i].type = ACPI_TYPE_ANY;
|
||||||
ANOBJ_METHOD_LOCAL;
|
walk_state->local_variables[i].flags = ANOBJ_END_OF_PEER_LIST |
|
||||||
|
ANOBJ_METHOD_LOCAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_delete_all
|
* FUNCTION: acpi_ds_method_data_delete_all
|
||||||
@@ -149,26 +136,25 @@ acpi_ds_method_data_init (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_method_data_delete_all (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
u32 index;
|
u32 index;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_method_data_delete_all");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_method_data_delete_all");
|
||||||
|
|
||||||
/* Detach the locals */
|
/* Detach the locals */
|
||||||
|
|
||||||
for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
|
for (index = 0; index < ACPI_METHOD_NUM_LOCALS; index++) {
|
||||||
if (walk_state->local_variables[index].object) {
|
if (walk_state->local_variables[index].object) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Local%d=%p\n",
|
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 */
|
/* 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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,19 +162,19 @@ acpi_ds_method_data_delete_all (
|
|||||||
|
|
||||||
for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
|
for (index = 0; index < ACPI_METHOD_NUM_ARGS; index++) {
|
||||||
if (walk_state->arguments[index].object) {
|
if (walk_state->arguments[index].object) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Deleting Arg%d=%p\n",
|
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 */
|
/* Detach object (if present) and remove a reference */
|
||||||
|
|
||||||
acpi_ns_detach_object (&walk_state->arguments[index]);
|
acpi_ns_detach_object(&walk_state->arguments[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_init_args
|
* FUNCTION: acpi_ds_method_data_init_args
|
||||||
@@ -206,47 +192,44 @@ acpi_ds_method_data_delete_all (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_method_data_init_args (
|
acpi_ds_method_data_init_args(union acpi_operand_object **params,
|
||||||
union acpi_operand_object **params,
|
u32 max_param_count,
|
||||||
u32 max_param_count,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 index = 0;
|
u32 index = 0;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_method_data_init_args", params);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_method_data_init_args", params);
|
||||||
|
|
||||||
if (!params) {
|
if (!params) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "No param list passed to method\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
return_ACPI_STATUS (AE_OK);
|
"No param list passed to method\n"));
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy passed parameters into the new method stack frame */
|
/* Copy passed parameters into the new method stack frame */
|
||||||
|
|
||||||
while ((index < ACPI_METHOD_NUM_ARGS) &&
|
while ((index < ACPI_METHOD_NUM_ARGS) &&
|
||||||
(index < max_param_count) &&
|
(index < max_param_count) && params[index]) {
|
||||||
params[index]) {
|
|
||||||
/*
|
/*
|
||||||
* A valid parameter.
|
* A valid parameter.
|
||||||
* Store the argument in the method/walk descriptor.
|
* Store the argument in the method/walk descriptor.
|
||||||
* Do not copy the arg in order to implement call by reference
|
* Do not copy the arg in order to implement call by reference
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_method_data_set_value (AML_ARG_OP, index,
|
status = acpi_ds_method_data_set_value(AML_ARG_OP, index,
|
||||||
params[index], walk_state);
|
params[index],
|
||||||
if (ACPI_FAILURE (status)) {
|
walk_state);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%d args passed to method\n", index));
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%d args passed to method\n", index));
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_get_node
|
* FUNCTION: acpi_ds_method_data_get_node
|
||||||
@@ -263,14 +246,12 @@ acpi_ds_method_data_init_args (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_method_data_get_node (
|
acpi_ds_method_data_get_node(u16 opcode,
|
||||||
u16 opcode,
|
u32 index,
|
||||||
u32 index,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
struct acpi_namespace_node **node)
|
||||||
struct acpi_namespace_node **node)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ds_method_data_get_node");
|
ACPI_FUNCTION_TRACE("ds_method_data_get_node");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Method Locals and Arguments are supported
|
* Method Locals and Arguments are supported
|
||||||
@@ -279,10 +260,10 @@ acpi_ds_method_data_get_node (
|
|||||||
case AML_LOCAL_OP:
|
case AML_LOCAL_OP:
|
||||||
|
|
||||||
if (index > ACPI_METHOD_MAX_LOCAL) {
|
if (index > ACPI_METHOD_MAX_LOCAL) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Local index %d is invalid (max %d)\n",
|
"Local index %d is invalid (max %d)\n",
|
||||||
index, ACPI_METHOD_MAX_LOCAL));
|
index, ACPI_METHOD_MAX_LOCAL));
|
||||||
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
|
return_ACPI_STATUS(AE_AML_INVALID_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a pointer to the pseudo-node */
|
/* Return a pointer to the pseudo-node */
|
||||||
@@ -293,10 +274,10 @@ acpi_ds_method_data_get_node (
|
|||||||
case AML_ARG_OP:
|
case AML_ARG_OP:
|
||||||
|
|
||||||
if (index > ACPI_METHOD_MAX_ARG) {
|
if (index > ACPI_METHOD_MAX_ARG) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Arg index %d is invalid (max %d)\n",
|
"Arg index %d is invalid (max %d)\n",
|
||||||
index, ACPI_METHOD_MAX_ARG));
|
index, ACPI_METHOD_MAX_ARG));
|
||||||
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
|
return_ACPI_STATUS(AE_AML_INVALID_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a pointer to the pseudo-node */
|
/* Return a pointer to the pseudo-node */
|
||||||
@@ -305,14 +286,14 @@ acpi_ds_method_data_get_node (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", opcode));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Opcode %d is invalid\n",
|
||||||
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
|
opcode));
|
||||||
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_set_value
|
* FUNCTION: acpi_ds_method_data_set_value
|
||||||
@@ -330,29 +311,26 @@ acpi_ds_method_data_get_node (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_method_data_set_value (
|
acpi_ds_method_data_set_value(u16 opcode,
|
||||||
u16 opcode,
|
u32 index,
|
||||||
u32 index,
|
union acpi_operand_object *object,
|
||||||
union acpi_operand_object *object,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_method_data_set_value");
|
||||||
|
|
||||||
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,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
acpi_ut_get_type_name(object->common.type)));
|
||||||
"new_obj %p Opcode %X, Refs=%d [%s]\n", object,
|
|
||||||
opcode, object->common.reference_count,
|
|
||||||
acpi_ut_get_type_name (object->common.type)));
|
|
||||||
|
|
||||||
/* Get the namespace node for the arg/local */
|
/* Get the namespace node for the arg/local */
|
||||||
|
|
||||||
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
|
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -361,15 +339,14 @@ acpi_ds_method_data_set_value (
|
|||||||
* reference semantics of ACPI Control Method invocation.
|
* reference semantics of ACPI Control Method invocation.
|
||||||
* (See ACPI specification 2.0_c)
|
* (See ACPI specification 2.0_c)
|
||||||
*/
|
*/
|
||||||
acpi_ut_add_reference (object);
|
acpi_ut_add_reference(object);
|
||||||
|
|
||||||
/* Install the object */
|
/* Install the object */
|
||||||
|
|
||||||
node->object = object;
|
node->object = object;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_get_value
|
* FUNCTION: acpi_ds_method_data_get_value
|
||||||
@@ -387,32 +364,30 @@ acpi_ds_method_data_set_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_method_data_get_value (
|
acpi_ds_method_data_get_value(u16 opcode,
|
||||||
u16 opcode,
|
u32 index,
|
||||||
u32 index,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_operand_object **dest_desc)
|
||||||
union acpi_operand_object **dest_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_operand_object *object;
|
union acpi_operand_object *object;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_method_data_get_value");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_method_data_get_value");
|
||||||
|
|
||||||
/* Validate the object descriptor */
|
/* Validate the object descriptor */
|
||||||
|
|
||||||
if (!dest_desc) {
|
if (!dest_desc) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
"Null object descriptor pointer\n"));
|
||||||
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the namespace node for the arg/local */
|
/* Get the namespace node for the arg/local */
|
||||||
|
|
||||||
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
|
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the object from the node */
|
/* Get the object from the node */
|
||||||
@@ -433,9 +408,10 @@ acpi_ds_method_data_get_value (
|
|||||||
/* If slack enabled, init the local_x/arg_x to an Integer of value zero */
|
/* If slack enabled, init the local_x/arg_x to an Integer of value zero */
|
||||||
|
|
||||||
if (acpi_gbl_enable_interpreter_slack) {
|
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) {
|
if (!object) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
object->integer.value = 0;
|
object->integer.value = 0;
|
||||||
@@ -444,27 +420,29 @@ acpi_ds_method_data_get_value (
|
|||||||
|
|
||||||
/* Otherwise, return the error */
|
/* Otherwise, return the error */
|
||||||
|
|
||||||
else switch (opcode) {
|
else
|
||||||
case AML_ARG_OP:
|
switch (opcode) {
|
||||||
|
case AML_ARG_OP:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Uninitialized Arg[%d] at node %p\n",
|
"Uninitialized Arg[%d] at node %p\n",
|
||||||
index, node));
|
index, node));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
|
return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
|
||||||
|
|
||||||
case AML_LOCAL_OP:
|
case AML_LOCAL_OP:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Uninitialized Local[%d] at node %p\n",
|
"Uninitialized Local[%d] at node %p\n",
|
||||||
index, node));
|
index, node));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
|
return_ACPI_STATUS(AE_AML_UNINITIALIZED_LOCAL);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", opcode));
|
ACPI_REPORT_ERROR(("Not Arg/Local opcode: %X\n",
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
opcode));
|
||||||
}
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -472,12 +450,11 @@ acpi_ds_method_data_get_value (
|
|||||||
* Return an additional reference to the object
|
* Return an additional reference to the object
|
||||||
*/
|
*/
|
||||||
*dest_desc = object;
|
*dest_desc = object;
|
||||||
acpi_ut_add_reference (object);
|
acpi_ut_add_reference(object);
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_method_data_delete_value
|
* FUNCTION: acpi_ds_method_data_delete_value
|
||||||
@@ -494,29 +471,25 @@ acpi_ds_method_data_get_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ds_method_data_delete_value (
|
acpi_ds_method_data_delete_value(u16 opcode,
|
||||||
u16 opcode,
|
u32 index, struct acpi_walk_state *walk_state)
|
||||||
u32 index,
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_operand_object *object;
|
union acpi_operand_object *object;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_method_data_delete_value");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_method_data_delete_value");
|
||||||
|
|
||||||
/* Get the namespace node for the arg/local */
|
/* Get the namespace node for the arg/local */
|
||||||
|
|
||||||
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
|
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the associated object */
|
/* Get the associated object */
|
||||||
|
|
||||||
object = acpi_ns_get_attached_object (node);
|
object = acpi_ns_get_attached_object(node);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Undefine the Arg or Local by setting its descriptor
|
* Undefine the Arg or Local by setting its descriptor
|
||||||
@@ -526,19 +499,18 @@ acpi_ds_method_data_delete_value (
|
|||||||
node->object = NULL;
|
node->object = NULL;
|
||||||
|
|
||||||
if ((object) &&
|
if ((object) &&
|
||||||
(ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_OPERAND)) {
|
(ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_OPERAND)) {
|
||||||
/*
|
/*
|
||||||
* There is a valid object.
|
* There is a valid object.
|
||||||
* Decrement the reference count by one to balance the
|
* Decrement the reference count by one to balance the
|
||||||
* increment when the object was stored.
|
* increment when the object was stored.
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (object);
|
acpi_ut_remove_reference(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_store_object_to_local
|
* FUNCTION: acpi_ds_store_object_to_local
|
||||||
@@ -557,40 +529,38 @@ acpi_ds_method_data_delete_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_store_object_to_local (
|
acpi_ds_store_object_to_local(u16 opcode,
|
||||||
u16 opcode,
|
u32 index,
|
||||||
u32 index,
|
union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_operand_object *current_obj_desc;
|
union acpi_operand_object *current_obj_desc;
|
||||||
union acpi_operand_object *new_obj_desc;
|
union acpi_operand_object *new_obj_desc;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_store_object_to_local");
|
||||||
ACPI_FUNCTION_TRACE ("ds_store_object_to_local");
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
|
opcode, index, obj_desc));
|
||||||
opcode, index, obj_desc));
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the namespace node for the arg/local */
|
/* Get the namespace node for the arg/local */
|
||||||
|
|
||||||
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
|
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_obj_desc = acpi_ns_get_attached_object (node);
|
current_obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (current_obj_desc == obj_desc) {
|
if (current_obj_desc == obj_desc) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p already installed!\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p already installed!\n",
|
||||||
obj_desc));
|
obj_desc));
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -602,9 +572,11 @@ acpi_ds_store_object_to_local (
|
|||||||
*/
|
*/
|
||||||
new_obj_desc = obj_desc;
|
new_obj_desc = obj_desc;
|
||||||
if (obj_desc->common.reference_count > 1) {
|
if (obj_desc->common.reference_count > 1) {
|
||||||
status = acpi_ut_copy_iobject_to_iobject (obj_desc, &new_obj_desc, walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ut_copy_iobject_to_iobject(obj_desc, &new_obj_desc,
|
||||||
return_ACPI_STATUS (status);
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,28 +608,36 @@ acpi_ds_store_object_to_local (
|
|||||||
* If we have a valid reference object that came from ref_of(),
|
* If we have a valid reference object that came from ref_of(),
|
||||||
* do the indirect store
|
* do the indirect store
|
||||||
*/
|
*/
|
||||||
if ((ACPI_GET_DESCRIPTOR_TYPE (current_obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
|
if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) ==
|
||||||
(current_obj_desc->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
|
ACPI_DESC_TYPE_OPERAND)
|
||||||
(current_obj_desc->reference.opcode == AML_REF_OF_OP)) {
|
&& (current_obj_desc->common.type ==
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_TYPE_LOCAL_REFERENCE)
|
||||||
"Arg (%p) is an obj_ref(Node), storing in node %p\n",
|
&& (current_obj_desc->reference.opcode ==
|
||||||
new_obj_desc, current_obj_desc));
|
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));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Store this object to the Node (perform the indirect store)
|
* Store this object to the Node (perform the indirect store)
|
||||||
* NOTE: No implicit conversion is performed, as per the ACPI
|
* NOTE: No implicit conversion is performed, as per the ACPI
|
||||||
* specification rules on storing to Locals/Args.
|
* specification rules on storing to Locals/Args.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_store_object_to_node (new_obj_desc,
|
status =
|
||||||
current_obj_desc->reference.object, walk_state,
|
acpi_ex_store_object_to_node(new_obj_desc,
|
||||||
ACPI_NO_IMPLICIT_CONVERSION);
|
current_obj_desc->
|
||||||
|
reference.
|
||||||
|
object,
|
||||||
|
walk_state,
|
||||||
|
ACPI_NO_IMPLICIT_CONVERSION);
|
||||||
|
|
||||||
/* Remove local reference if we copied the object above */
|
/* Remove local reference if we copied the object above */
|
||||||
|
|
||||||
if (new_obj_desc != obj_desc) {
|
if (new_obj_desc != obj_desc) {
|
||||||
acpi_ut_remove_reference (new_obj_desc);
|
acpi_ut_remove_reference(new_obj_desc);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,7 +645,7 @@ acpi_ds_store_object_to_local (
|
|||||||
* Delete the existing object
|
* Delete the existing object
|
||||||
* before storing the new one
|
* before storing the new one
|
||||||
*/
|
*/
|
||||||
acpi_ds_method_data_delete_value (opcode, index, walk_state);
|
acpi_ds_method_data_delete_value(opcode, index, walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -673,18 +653,19 @@ acpi_ds_store_object_to_local (
|
|||||||
* the descriptor for the Arg or Local.
|
* the descriptor for the Arg or Local.
|
||||||
* (increments the object reference count by one)
|
* (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 */
|
/* Remove local reference if we copied the object above */
|
||||||
|
|
||||||
if (new_obj_desc != obj_desc) {
|
if (new_obj_desc != obj_desc) {
|
||||||
acpi_ut_remove_reference (new_obj_desc);
|
acpi_ut_remove_reference(new_obj_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -701,39 +682,33 @@ acpi_ds_store_object_to_local (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_object_type
|
acpi_object_type
|
||||||
acpi_ds_method_data_get_type (
|
acpi_ds_method_data_get_type(u16 opcode,
|
||||||
u16 opcode,
|
u32 index, struct acpi_walk_state *walk_state)
|
||||||
u32 index,
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_operand_object *object;
|
union acpi_operand_object *object;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_method_data_get_type");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_method_data_get_type");
|
||||||
|
|
||||||
/* Get the namespace node for the arg/local */
|
/* Get the namespace node for the arg/local */
|
||||||
|
|
||||||
status = acpi_ds_method_data_get_node (opcode, index, walk_state, &node);
|
status = acpi_ds_method_data_get_node(opcode, index, walk_state, &node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_VALUE ((ACPI_TYPE_NOT_FOUND));
|
return_VALUE((ACPI_TYPE_NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the object */
|
/* Get the object */
|
||||||
|
|
||||||
object = acpi_ns_get_attached_object (node);
|
object = acpi_ns_get_attached_object(node);
|
||||||
if (!object) {
|
if (!object) {
|
||||||
/* Uninitialized local/arg, return TYPE_ANY */
|
/* Uninitialized local/arg, return TYPE_ANY */
|
||||||
|
|
||||||
return_VALUE (ACPI_TYPE_ANY);
|
return_VALUE(ACPI_TYPE_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the object type */
|
/* Get the object type */
|
||||||
|
|
||||||
return_VALUE (ACPI_GET_OBJECT_TYPE (object));
|
return_VALUE(ACPI_GET_OBJECT_TYPE(object));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -50,14 +49,12 @@
|
|||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dsobject")
|
ACPI_MODULE_NAME("dsobject")
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_build_internal_object (
|
acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
union acpi_operand_object **obj_desc_ptr);
|
||||||
union acpi_operand_object **obj_desc_ptr);
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -76,17 +73,14 @@ acpi_ds_build_internal_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ds_build_internal_object (
|
acpi_ds_build_internal_object(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
union acpi_operand_object **obj_desc_ptr)
|
||||||
union acpi_operand_object **obj_desc_ptr)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_build_internal_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_build_internal_object");
|
||||||
|
|
||||||
*obj_desc_ptr = NULL;
|
*obj_desc_ptr = NULL;
|
||||||
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
||||||
@@ -96,40 +90,44 @@ acpi_ds_build_internal_object (
|
|||||||
* Otherwise, go ahead and look it up now
|
* Otherwise, go ahead and look it up now
|
||||||
*/
|
*/
|
||||||
if (!op->common.node) {
|
if (!op->common.node) {
|
||||||
status = acpi_ns_lookup (walk_state->scope_info,
|
status = acpi_ns_lookup(walk_state->scope_info,
|
||||||
op->common.value.string,
|
op->common.value.string,
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
ACPI_TYPE_ANY,
|
||||||
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
|
ACPI_IMODE_EXECUTE,
|
||||||
NULL,
|
ACPI_NS_SEARCH_PARENT |
|
||||||
(struct acpi_namespace_node **) &(op->common.node));
|
ACPI_NS_DONT_OPEN_SCOPE, NULL,
|
||||||
|
(struct acpi_namespace_node **)
|
||||||
|
&(op->common.node));
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_NSERROR (op->common.value.string, status);
|
ACPI_REPORT_NSERROR(op->common.value.string,
|
||||||
return_ACPI_STATUS (status);
|
status);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and init the internal ACPI object */
|
/* Create and init the internal ACPI object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (
|
obj_desc = acpi_ut_create_internal_object((acpi_ps_get_opcode_info
|
||||||
(acpi_ps_get_opcode_info (op->common.aml_opcode))->object_type);
|
(op->common.aml_opcode))->
|
||||||
|
object_type);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_init_object_from_op (walk_state, op, op->common.aml_opcode,
|
status =
|
||||||
&obj_desc);
|
acpi_ds_init_object_from_op(walk_state, op, op->common.aml_opcode,
|
||||||
if (ACPI_FAILURE (status)) {
|
&obj_desc);
|
||||||
acpi_ut_remove_reference (obj_desc);
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
*obj_desc_ptr = obj_desc;
|
*obj_desc_ptr = obj_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_build_internal_buffer_obj
|
* FUNCTION: acpi_ds_build_internal_buffer_obj
|
||||||
@@ -147,20 +145,17 @@ acpi_ds_build_internal_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_build_internal_buffer_obj (
|
acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
u32 buffer_length,
|
||||||
u32 buffer_length,
|
union acpi_operand_object **obj_desc_ptr)
|
||||||
union acpi_operand_object **obj_desc_ptr)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_parse_object *byte_list;
|
union acpi_parse_object *byte_list;
|
||||||
u32 byte_list_length = 0;
|
u32 byte_list_length = 0;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_build_internal_buffer_obj");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_build_internal_buffer_obj");
|
||||||
|
|
||||||
obj_desc = *obj_desc_ptr;
|
obj_desc = *obj_desc_ptr;
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
@@ -168,14 +163,13 @@ acpi_ds_build_internal_buffer_obj (
|
|||||||
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
|
* We are evaluating a Named buffer object "Name (xxxx, Buffer)".
|
||||||
* The buffer object already exists (from the NS node)
|
* The buffer object already exists (from the NS node)
|
||||||
*/
|
*/
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Create a new buffer object */
|
/* Create a new buffer object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_BUFFER);
|
||||||
*obj_desc_ptr = obj_desc;
|
*obj_desc_ptr = obj_desc;
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,16 +178,17 @@ acpi_ds_build_internal_buffer_obj (
|
|||||||
* individual bytes or a string initializer. In either case, a
|
* individual bytes or a string initializer. In either case, a
|
||||||
* byte_list appears in the AML.
|
* byte_list appears in the AML.
|
||||||
*/
|
*/
|
||||||
arg = op->common.value.arg; /* skip first arg */
|
arg = op->common.value.arg; /* skip first arg */
|
||||||
|
|
||||||
byte_list = arg->named.next;
|
byte_list = arg->named.next;
|
||||||
if (byte_list) {
|
if (byte_list) {
|
||||||
if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
|
if (byte_list->common.aml_opcode != AML_INT_BYTELIST_OP) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Expecting bytelist, got AML opcode %X in op %p\n",
|
"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);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return (AE_TYPE);
|
return (AE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,31 +209,29 @@ acpi_ds_build_internal_buffer_obj (
|
|||||||
|
|
||||||
if (obj_desc->buffer.length == 0) {
|
if (obj_desc->buffer.length == 0) {
|
||||||
obj_desc->buffer.pointer = NULL;
|
obj_desc->buffer.pointer = NULL;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Buffer defined with zero length in AML, creating\n"));
|
"Buffer defined with zero length in AML, creating\n"));
|
||||||
}
|
} else {
|
||||||
else {
|
obj_desc->buffer.pointer =
|
||||||
obj_desc->buffer.pointer = ACPI_MEM_CALLOCATE (
|
ACPI_MEM_CALLOCATE(obj_desc->buffer.length);
|
||||||
obj_desc->buffer.length);
|
|
||||||
if (!obj_desc->buffer.pointer) {
|
if (!obj_desc->buffer.pointer) {
|
||||||
acpi_ut_delete_object_desc (obj_desc);
|
acpi_ut_delete_object_desc(obj_desc);
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize buffer from the byte_list (if present) */
|
/* Initialize buffer from the byte_list (if present) */
|
||||||
|
|
||||||
if (byte_list) {
|
if (byte_list) {
|
||||||
ACPI_MEMCPY (obj_desc->buffer.pointer, byte_list->named.data,
|
ACPI_MEMCPY(obj_desc->buffer.pointer,
|
||||||
byte_list_length);
|
byte_list->named.data, byte_list_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
|
obj_desc->buffer.flags |= AOPOBJ_DATA_VALID;
|
||||||
op->common.node = (struct acpi_namespace_node *) obj_desc;
|
op->common.node = (struct acpi_namespace_node *)obj_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_build_internal_package_obj
|
* FUNCTION: acpi_ds_build_internal_package_obj
|
||||||
@@ -256,28 +249,25 @@ acpi_ds_build_internal_buffer_obj (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_build_internal_package_obj (
|
acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
u32 package_length,
|
||||||
u32 package_length,
|
union acpi_operand_object **obj_desc_ptr)
|
||||||
union acpi_operand_object **obj_desc_ptr)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
union acpi_parse_object *parent;
|
union acpi_parse_object *parent;
|
||||||
union acpi_operand_object *obj_desc = NULL;
|
union acpi_operand_object *obj_desc = NULL;
|
||||||
u32 package_list_length;
|
u32 package_list_length;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_build_internal_package_obj");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_build_internal_package_obj");
|
||||||
|
|
||||||
/* Find the parent of a possibly nested package */
|
/* Find the parent of a possibly nested package */
|
||||||
|
|
||||||
parent = op->common.parent;
|
parent = op->common.parent;
|
||||||
while ((parent->common.aml_opcode == AML_PACKAGE_OP) ||
|
while ((parent->common.aml_opcode == AML_PACKAGE_OP) ||
|
||||||
(parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
|
(parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
|
||||||
parent = parent->common.parent;
|
parent = parent->common.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,12 +277,11 @@ acpi_ds_build_internal_package_obj (
|
|||||||
* We are evaluating a Named package object "Name (xxxx, Package)".
|
* We are evaluating a Named package object "Name (xxxx, Package)".
|
||||||
* Get the existing package object from the NS node
|
* Get the existing package object from the NS node
|
||||||
*/
|
*/
|
||||||
}
|
} else {
|
||||||
else {
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PACKAGE);
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PACKAGE);
|
|
||||||
*obj_desc_ptr = obj_desc;
|
*obj_desc_ptr = obj_desc;
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_desc->package.node = parent->common.node;
|
obj_desc->package.node = parent->common.node;
|
||||||
@@ -323,12 +312,13 @@ acpi_ds_build_internal_package_obj (
|
|||||||
* individual objects). Add an extra pointer slot so
|
* individual objects). Add an extra pointer slot so
|
||||||
* that the list is always null terminated.
|
* that the list is always null terminated.
|
||||||
*/
|
*/
|
||||||
obj_desc->package.elements = ACPI_MEM_CALLOCATE (
|
obj_desc->package.elements = ACPI_MEM_CALLOCATE(((acpi_size) obj_desc->
|
||||||
((acpi_size) obj_desc->package.count + 1) * sizeof (void *));
|
package.count +
|
||||||
|
1) * sizeof(void *));
|
||||||
|
|
||||||
if (!obj_desc->package.elements) {
|
if (!obj_desc->package.elements) {
|
||||||
acpi_ut_delete_object_desc (obj_desc);
|
acpi_ut_delete_object_desc(obj_desc);
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -342,11 +332,13 @@ acpi_ds_build_internal_package_obj (
|
|||||||
/* Object (package or buffer) is already built */
|
/* Object (package or buffer) is already built */
|
||||||
|
|
||||||
obj_desc->package.elements[i] =
|
obj_desc->package.elements[i] =
|
||||||
ACPI_CAST_PTR (union acpi_operand_object, arg->common.node);
|
ACPI_CAST_PTR(union acpi_operand_object,
|
||||||
}
|
arg->common.node);
|
||||||
else {
|
} else {
|
||||||
status = acpi_ds_build_internal_object (walk_state, arg,
|
status = acpi_ds_build_internal_object(walk_state, arg,
|
||||||
&obj_desc->package.elements[i]);
|
&obj_desc->
|
||||||
|
package.
|
||||||
|
elements[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@@ -354,11 +346,10 @@ acpi_ds_build_internal_package_obj (
|
|||||||
}
|
}
|
||||||
|
|
||||||
obj_desc->package.flags |= AOPOBJ_DATA_VALID;
|
obj_desc->package.flags |= AOPOBJ_DATA_VALID;
|
||||||
op->common.node = (struct acpi_namespace_node *) obj_desc;
|
op->common.node = (struct acpi_namespace_node *)obj_desc;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_create_node
|
* FUNCTION: acpi_ds_create_node
|
||||||
@@ -374,57 +365,53 @@ acpi_ds_build_internal_package_obj (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_node (
|
acpi_ds_create_node(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
union acpi_parse_object *op)
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_create_node", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_create_node", op);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Because of the execution pass through the non-control-method
|
* Because of the execution pass through the non-control-method
|
||||||
* parts of the table, we can arrive here twice. Only init
|
* parts of the table, we can arrive here twice. Only init
|
||||||
* the named object node the first time through
|
* the named object node the first time through
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_get_attached_object (node)) {
|
if (acpi_ns_get_attached_object(node)) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!op->common.value.arg) {
|
if (!op->common.value.arg) {
|
||||||
/* No arguments, there is nothing to do */
|
/* No arguments, there is nothing to do */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build an internal object for the argument(s) */
|
/* Build an internal object for the argument(s) */
|
||||||
|
|
||||||
status = acpi_ds_build_internal_object (walk_state, op->common.value.arg,
|
status = acpi_ds_build_internal_object(walk_state, op->common.value.arg,
|
||||||
&obj_desc);
|
&obj_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-type the object according to its argument */
|
/* Re-type the object according to its argument */
|
||||||
|
|
||||||
node->type = ACPI_GET_OBJECT_TYPE (obj_desc);
|
node->type = ACPI_GET_OBJECT_TYPE(obj_desc);
|
||||||
|
|
||||||
/* Attach obj to node */
|
/* Attach obj to node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object (node, obj_desc, node->type);
|
status = acpi_ns_attach_object(node, obj_desc, node->type);
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -444,55 +431,50 @@ acpi_ds_create_node (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_init_object_from_op (
|
acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
u16 opcode,
|
||||||
u16 opcode,
|
union acpi_operand_object **ret_obj_desc)
|
||||||
union acpi_operand_object **ret_obj_desc)
|
|
||||||
{
|
{
|
||||||
const struct acpi_opcode_info *op_info;
|
const struct acpi_opcode_info *op_info;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_init_object_from_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_init_object_from_op");
|
||||||
|
|
||||||
obj_desc = *ret_obj_desc;
|
obj_desc = *ret_obj_desc;
|
||||||
op_info = acpi_ps_get_opcode_info (opcode);
|
op_info = acpi_ps_get_opcode_info(opcode);
|
||||||
if (op_info->class == AML_CLASS_UNKNOWN) {
|
if (op_info->class == AML_CLASS_UNKNOWN) {
|
||||||
/* Unknown opcode */
|
/* Unknown opcode */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_TYPE);
|
return_ACPI_STATUS(AE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform per-object initialization */
|
/* Perform per-object initialization */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defer evaluation of Buffer term_arg operand
|
* Defer evaluation of Buffer term_arg operand
|
||||||
*/
|
*/
|
||||||
obj_desc->buffer.node = (struct acpi_namespace_node *)
|
obj_desc->buffer.node = (struct acpi_namespace_node *)
|
||||||
walk_state->operands[0];
|
walk_state->operands[0];
|
||||||
obj_desc->buffer.aml_start = op->named.data;
|
obj_desc->buffer.aml_start = op->named.data;
|
||||||
obj_desc->buffer.aml_length = op->named.length;
|
obj_desc->buffer.aml_length = op->named.length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defer evaluation of Package term_arg operand
|
* Defer evaluation of Package term_arg operand
|
||||||
*/
|
*/
|
||||||
obj_desc->package.node = (struct acpi_namespace_node *)
|
obj_desc->package.node = (struct acpi_namespace_node *)
|
||||||
walk_state->operands[0];
|
walk_state->operands[0];
|
||||||
obj_desc->package.aml_start = op->named.data;
|
obj_desc->package.aml_start = op->named.data;
|
||||||
obj_desc->package.aml_length = op->named.length;
|
obj_desc->package.aml_length = op->named.length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
switch (op_info->type) {
|
switch (op_info->type) {
|
||||||
@@ -525,7 +507,7 @@ acpi_ds_init_object_from_op (
|
|||||||
/* Truncate value if we are executing from a 32-bit ACPI table */
|
/* Truncate value if we are executing from a 32-bit ACPI table */
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
acpi_ex_truncate_for32bit_table (obj_desc);
|
acpi_ex_truncate_for32bit_table(obj_desc);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -536,36 +518,36 @@ acpi_ds_init_object_from_op (
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unknown constant opcode %X\n", opcode));
|
"Unknown constant opcode %X\n",
|
||||||
|
opcode));
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_LITERAL:
|
case AML_TYPE_LITERAL:
|
||||||
|
|
||||||
obj_desc->integer.value = op->common.value.integer;
|
obj_desc->integer.value = op->common.value.integer;
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
acpi_ex_truncate_for32bit_table (obj_desc);
|
acpi_ex_truncate_for32bit_table(obj_desc);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
op_info->type));
|
"Unknown Integer type %X\n",
|
||||||
|
op_info->type));
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
obj_desc->string.pointer = op->common.value.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
|
* 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;
|
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||||
|
|
||||||
switch (op_info->type) {
|
switch (op_info->type) {
|
||||||
@@ -590,14 +570,17 @@ acpi_ds_init_object_from_op (
|
|||||||
obj_desc->reference.offset = opcode - AML_LOCAL_OP;
|
obj_desc->reference.offset = opcode - AML_LOCAL_OP;
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
status = acpi_ds_method_data_get_node (AML_LOCAL_OP,
|
status = acpi_ds_method_data_get_node(AML_LOCAL_OP,
|
||||||
obj_desc->reference.offset,
|
obj_desc->
|
||||||
walk_state,
|
reference.offset,
|
||||||
(struct acpi_namespace_node **) &obj_desc->reference.object);
|
walk_state,
|
||||||
|
(struct
|
||||||
|
acpi_namespace_node
|
||||||
|
**)&obj_desc->
|
||||||
|
reference.object);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_METHOD_ARGUMENT:
|
case AML_TYPE_METHOD_ARGUMENT:
|
||||||
|
|
||||||
/* Split the opcode into a base opcode + offset */
|
/* Split the opcode into a base opcode + offset */
|
||||||
@@ -606,14 +589,18 @@ acpi_ds_init_object_from_op (
|
|||||||
obj_desc->reference.offset = opcode - AML_ARG_OP;
|
obj_desc->reference.offset = opcode - AML_ARG_OP;
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
status = acpi_ds_method_data_get_node (AML_ARG_OP,
|
status = acpi_ds_method_data_get_node(AML_ARG_OP,
|
||||||
obj_desc->reference.offset,
|
obj_desc->
|
||||||
walk_state,
|
reference.offset,
|
||||||
(struct acpi_namespace_node **) &obj_desc->reference.object);
|
walk_state,
|
||||||
|
(struct
|
||||||
|
acpi_namespace_node
|
||||||
|
**)&obj_desc->
|
||||||
|
reference.object);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* Other literals, etc.. */
|
default: /* Other literals, etc.. */
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
if (op->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
||||||
/* Node was saved in Op */
|
/* Node was saved in Op */
|
||||||
@@ -626,17 +613,15 @@ acpi_ds_init_object_from_op (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
ACPI_GET_OBJECT_TYPE (obj_desc)));
|
"Unimplemented data type: %X\n",
|
||||||
|
ACPI_GET_OBJECT_TYPE(obj_desc)));
|
||||||
|
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -51,8 +50,7 @@
|
|||||||
#include <acpi/acdebug.h>
|
#include <acpi/acdebug.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dsutils")
|
ACPI_MODULE_NAME("dsutils")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -68,13 +66,9 @@
|
|||||||
* parent method exits.)
|
* 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");
|
ACPI_FUNCTION_NAME("ds_clear_implicit_return");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Slack must be enabled for this feature
|
* Slack must be enabled for this feature
|
||||||
@@ -89,16 +83,15 @@ acpi_ds_clear_implicit_return (
|
|||||||
* complex statements, the implicit return value can be
|
* complex statements, the implicit return value can be
|
||||||
* bubbled up several levels.
|
* bubbled up several levels.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"Removing reference on stale implicit return obj %p\n",
|
"Removing reference on stale implicit return obj %p\n",
|
||||||
walk_state->implicit_return_obj));
|
walk_state->implicit_return_obj));
|
||||||
|
|
||||||
acpi_ut_remove_reference (walk_state->implicit_return_obj);
|
acpi_ut_remove_reference(walk_state->implicit_return_obj);
|
||||||
walk_state->implicit_return_obj = NULL;
|
walk_state->implicit_return_obj = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -119,27 +112,22 @@ acpi_ds_clear_implicit_return (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8
|
u8
|
||||||
acpi_ds_do_implicit_return (
|
acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
|
||||||
union acpi_operand_object *return_desc,
|
struct acpi_walk_state *walk_state, u8 add_reference)
|
||||||
struct acpi_walk_state *walk_state,
|
|
||||||
u8 add_reference)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_NAME ("ds_do_implicit_return");
|
ACPI_FUNCTION_NAME("ds_do_implicit_return");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Slack must be enabled for this feature, and we must
|
* Slack must be enabled for this feature, and we must
|
||||||
* have a valid return object
|
* have a valid return object
|
||||||
*/
|
*/
|
||||||
if ((!acpi_gbl_enable_interpreter_slack) ||
|
if ((!acpi_gbl_enable_interpreter_slack) || (!return_desc)) {
|
||||||
(!return_desc)) {
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"Result %p will be implicitly returned; Prev=%p\n",
|
"Result %p will be implicitly returned; Prev=%p\n",
|
||||||
return_desc,
|
return_desc, walk_state->implicit_return_obj));
|
||||||
walk_state->implicit_return_obj));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete any "stale" implicit return value first. However, in
|
* Delete any "stale" implicit return value first. However, in
|
||||||
@@ -151,20 +139,19 @@ acpi_ds_do_implicit_return (
|
|||||||
if (walk_state->implicit_return_obj == return_desc) {
|
if (walk_state->implicit_return_obj == return_desc) {
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
acpi_ds_clear_implicit_return (walk_state);
|
acpi_ds_clear_implicit_return(walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the implicit return value, add a reference if requested */
|
/* Save the implicit return value, add a reference if requested */
|
||||||
|
|
||||||
walk_state->implicit_return_obj = return_desc;
|
walk_state->implicit_return_obj = return_desc;
|
||||||
if (add_reference) {
|
if (add_reference) {
|
||||||
acpi_ut_add_reference (return_desc);
|
acpi_ut_add_reference(return_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_is_result_used
|
* FUNCTION: acpi_ds_is_result_used
|
||||||
@@ -179,20 +166,18 @@ acpi_ds_do_implicit_return (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8
|
u8
|
||||||
acpi_ds_is_result_used (
|
acpi_ds_is_result_used(union acpi_parse_object * op,
|
||||||
union acpi_parse_object *op,
|
struct acpi_walk_state * walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
const struct acpi_opcode_info *parent_info;
|
const struct acpi_opcode_info *parent_info;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_is_result_used", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_is_result_used", op);
|
||||||
|
|
||||||
/* Must have both an Op and a Result Object */
|
/* Must have both an Op and a Result Object */
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
|
||||||
return_VALUE (TRUE);
|
return_VALUE(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -204,7 +189,8 @@ acpi_ds_is_result_used (
|
|||||||
* NOTE: this is optional because the ASL language does not actually
|
* NOTE: this is optional because the ASL language does not actually
|
||||||
* support this behavior.
|
* support this behavior.
|
||||||
*/
|
*/
|
||||||
(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
|
* Now determine if the parent will use the result
|
||||||
@@ -215,22 +201,24 @@ acpi_ds_is_result_used (
|
|||||||
* via execute_control_method has a scope_op as the parent.
|
* via execute_control_method has a scope_op as the parent.
|
||||||
*/
|
*/
|
||||||
if ((!op->common.parent) ||
|
if ((!op->common.parent) ||
|
||||||
(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
|
(op->common.parent->common.aml_opcode == AML_SCOPE_OP)) {
|
||||||
/* No parent, the return value cannot possibly be used */
|
/* No parent, the return value cannot possibly be used */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"At Method level, result of [%s] not used\n",
|
"At Method level, result of [%s] not used\n",
|
||||||
acpi_ps_get_opcode_name (op->common.aml_opcode)));
|
acpi_ps_get_opcode_name(op->common.
|
||||||
return_VALUE (FALSE);
|
aml_opcode)));
|
||||||
|
return_VALUE(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get info on the parent. The root_op is AML_SCOPE */
|
/* 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) {
|
if (parent_info->class == AML_CLASS_UNKNOWN) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unknown parent opcode. Op=%p\n", op));
|
"Unknown parent opcode. Op=%p\n", op));
|
||||||
return_VALUE (FALSE);
|
return_VALUE(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -256,8 +244,10 @@ acpi_ds_is_result_used (
|
|||||||
* If we are executing the predicate AND this is the predicate op,
|
* If we are executing the predicate AND this is the predicate op,
|
||||||
* we will use the return value
|
* we will use the return value
|
||||||
*/
|
*/
|
||||||
if ((walk_state->control_state->common.state == ACPI_CONTROL_PREDICATE_EXECUTING) &&
|
if ((walk_state->control_state->common.state ==
|
||||||
(walk_state->control_state->control.predicate_op == op)) {
|
ACPI_CONTROL_PREDICATE_EXECUTING)
|
||||||
|
&& (walk_state->control_state->control.
|
||||||
|
predicate_op == op)) {
|
||||||
goto result_used;
|
goto result_used;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -271,7 +261,6 @@ acpi_ds_is_result_used (
|
|||||||
|
|
||||||
goto result_not_used;
|
goto result_not_used;
|
||||||
|
|
||||||
|
|
||||||
case AML_CLASS_CREATE:
|
case AML_CLASS_CREATE:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -280,15 +269,16 @@ acpi_ds_is_result_used (
|
|||||||
*/
|
*/
|
||||||
goto result_used;
|
goto result_used;
|
||||||
|
|
||||||
|
|
||||||
case AML_CLASS_NAMED_OBJECT:
|
case AML_CLASS_NAMED_OBJECT:
|
||||||
|
|
||||||
if ((op->common.parent->common.aml_opcode == AML_REGION_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_DATA_REGION_OP)
|
||||||
(op->common.parent->common.aml_opcode == AML_PACKAGE_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 ==
|
||||||
(op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
|
AML_VAR_PACKAGE_OP)
|
||||||
(op->common.parent->common.aml_opcode == AML_INT_EVAL_SUBTREE_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
|
* These opcodes allow term_arg(s) as operands and therefore
|
||||||
* the operands can be method calls. The result is used.
|
* the operands can be method calls. The result is used.
|
||||||
@@ -298,7 +288,6 @@ acpi_ds_is_result_used (
|
|||||||
|
|
||||||
goto result_not_used;
|
goto result_not_used;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -308,26 +297,25 @@ acpi_ds_is_result_used (
|
|||||||
goto 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));
|
||||||
|
|
||||||
result_used:
|
return_VALUE(TRUE);
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
|
||||||
"Result of [%s] used by Parent [%s] Op=%p\n",
|
|
||||||
acpi_ps_get_opcode_name (op->common.aml_opcode),
|
|
||||||
acpi_ps_get_opcode_name (op->common.parent->common.aml_opcode), op));
|
|
||||||
|
|
||||||
return_VALUE (TRUE);
|
result_not_used:
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
|
"Result of [%s] not used by Parent [%s] Op=%p\n",
|
||||||
|
acpi_ps_get_opcode_name(op->common.aml_opcode),
|
||||||
|
acpi_ps_get_opcode_name(op->common.parent->common.
|
||||||
|
aml_opcode), op));
|
||||||
|
|
||||||
|
return_VALUE(FALSE);
|
||||||
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));
|
|
||||||
|
|
||||||
return_VALUE (FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_delete_result_if_not_used
|
* FUNCTION: acpi_ds_delete_result_if_not_used
|
||||||
@@ -346,20 +334,17 @@ result_not_used:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ds_delete_result_if_not_used (
|
acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
union acpi_operand_object *result_obj,
|
||||||
union acpi_operand_object *result_obj,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_delete_result_if_not_used", result_obj);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_delete_result_if_not_used", result_obj);
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null Op\n"));
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,19 +352,18 @@ acpi_ds_delete_result_if_not_used (
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!acpi_ds_is_result_used (op, walk_state)) {
|
if (!acpi_ds_is_result_used(op, walk_state)) {
|
||||||
/* Must pop the result stack (obj_desc should be equal to result_obj) */
|
/* Must pop the result stack (obj_desc should be equal to result_obj) */
|
||||||
|
|
||||||
status = acpi_ds_result_pop (&obj_desc, walk_state);
|
status = acpi_ds_result_pop(&obj_desc, walk_state);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
acpi_ut_remove_reference (result_obj);
|
acpi_ut_remove_reference(result_obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_resolve_operands
|
* FUNCTION: acpi_ds_resolve_operands
|
||||||
@@ -394,16 +378,12 @@ acpi_ds_delete_result_if_not_used (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_resolve_operands (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_resolve_operands", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_resolve_operands", walk_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to resolve each of the valid operands
|
* Attempt to resolve each of the valid operands
|
||||||
@@ -411,16 +391,17 @@ acpi_ds_resolve_operands (
|
|||||||
* that the actual objects are passed, not copies of the objects.
|
* that the actual objects are passed, not copies of the objects.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < walk_state->num_operands; i++) {
|
for (i = 0; i < walk_state->num_operands; i++) {
|
||||||
status = acpi_ex_resolve_to_value (&walk_state->operands[i], walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ex_resolve_to_value(&walk_state->operands[i],
|
||||||
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_clear_operands
|
* FUNCTION: acpi_ds_clear_operands
|
||||||
@@ -433,15 +414,11 @@ acpi_ds_resolve_operands (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_clear_operands (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_clear_operands", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_clear_operands", walk_state);
|
||||||
|
|
||||||
/* Remove a reference on each operand on the stack */
|
/* Remove a reference on each operand on the stack */
|
||||||
|
|
||||||
@@ -450,7 +427,7 @@ acpi_ds_clear_operands (
|
|||||||
* Remove a reference to all operands, including both
|
* Remove a reference to all operands, including both
|
||||||
* "Arguments" and "Targets".
|
* "Arguments" and "Targets".
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (walk_state->operands[i]);
|
acpi_ut_remove_reference(walk_state->operands[i]);
|
||||||
walk_state->operands[i] = NULL;
|
walk_state->operands[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -459,7 +436,6 @@ acpi_ds_clear_operands (
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_create_operand
|
* FUNCTION: acpi_ds_create_operand
|
||||||
@@ -478,37 +454,36 @@ acpi_ds_clear_operands (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_operand (
|
acpi_ds_create_operand(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *arg, u32 arg_index)
|
||||||
union acpi_parse_object *arg,
|
|
||||||
u32 arg_index)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
char *name_string;
|
char *name_string;
|
||||||
u32 name_length;
|
u32 name_length;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_parse_object *parent_op;
|
union acpi_parse_object *parent_op;
|
||||||
u16 opcode;
|
u16 opcode;
|
||||||
acpi_interpreter_mode interpreter_mode;
|
acpi_interpreter_mode interpreter_mode;
|
||||||
const struct acpi_opcode_info *op_info;
|
const struct acpi_opcode_info *op_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_create_operand", arg);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_create_operand", arg);
|
||||||
|
|
||||||
/* A valid name must be looked up in the namespace */
|
/* A valid name must be looked up in the namespace */
|
||||||
|
|
||||||
if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
|
if ((arg->common.aml_opcode == AML_INT_NAMEPATH_OP) &&
|
||||||
(arg->common.value.string)) {
|
(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 */
|
/* Get the entire name string from the AML stream */
|
||||||
|
|
||||||
status = acpi_ex_get_name_string (ACPI_TYPE_ANY, arg->common.value.buffer,
|
status =
|
||||||
&name_string, &name_length);
|
acpi_ex_get_name_string(ACPI_TYPE_ANY,
|
||||||
|
arg->common.value.buffer,
|
||||||
|
&name_string, &name_length);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All prefixes have been handled, and the name is in name_string */
|
/* All prefixes have been handled, and the name is in name_string */
|
||||||
@@ -523,13 +498,14 @@ acpi_ds_create_operand (
|
|||||||
* actual opcode exists.
|
* actual opcode exists.
|
||||||
*/
|
*/
|
||||||
if ((walk_state->deferred_node) &&
|
if ((walk_state->deferred_node) &&
|
||||||
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) &&
|
(walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD)
|
||||||
(arg_index != 0)) {
|
&& (arg_index != 0)) {
|
||||||
obj_desc = ACPI_CAST_PTR (
|
obj_desc =
|
||||||
union acpi_operand_object, walk_state->deferred_node);
|
ACPI_CAST_PTR(union acpi_operand_object,
|
||||||
|
walk_state->deferred_node);
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else { /* All other opcodes */
|
||||||
else /* All other opcodes */ {
|
|
||||||
/*
|
/*
|
||||||
* Differentiate between a namespace "create" operation
|
* Differentiate between a namespace "create" operation
|
||||||
* versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
|
* versus a "lookup" operation (IMODE_LOAD_PASS2 vs.
|
||||||
@@ -537,43 +513,51 @@ acpi_ds_create_operand (
|
|||||||
* namespace objects during the execution of control methods.
|
* namespace objects during the execution of control methods.
|
||||||
*/
|
*/
|
||||||
parent_op = arg->common.parent;
|
parent_op = arg->common.parent;
|
||||||
op_info = acpi_ps_get_opcode_info (parent_op->common.aml_opcode);
|
op_info =
|
||||||
if ((op_info->flags & AML_NSNODE) &&
|
acpi_ps_get_opcode_info(parent_op->common.
|
||||||
(parent_op->common.aml_opcode != AML_INT_METHODCALL_OP) &&
|
aml_opcode);
|
||||||
(parent_op->common.aml_opcode != AML_REGION_OP) &&
|
if ((op_info->flags & AML_NSNODE)
|
||||||
(parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) {
|
&& (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 */
|
/* Enter name into namespace if not found */
|
||||||
|
|
||||||
interpreter_mode = ACPI_IMODE_LOAD_PASS2;
|
interpreter_mode = ACPI_IMODE_LOAD_PASS2;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Return a failure if name not found */
|
/* Return a failure if name not found */
|
||||||
|
|
||||||
interpreter_mode = ACPI_IMODE_EXECUTE;
|
interpreter_mode = ACPI_IMODE_EXECUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, name_string,
|
status =
|
||||||
ACPI_TYPE_ANY, interpreter_mode,
|
acpi_ns_lookup(walk_state->scope_info, name_string,
|
||||||
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
|
ACPI_TYPE_ANY, interpreter_mode,
|
||||||
walk_state,
|
ACPI_NS_SEARCH_PARENT |
|
||||||
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &obj_desc));
|
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
|
* The only case where we pass through (ignore) a NOT_FOUND
|
||||||
* error is for the cond_ref_of opcode.
|
* error is for the cond_ref_of opcode.
|
||||||
*/
|
*/
|
||||||
if (status == AE_NOT_FOUND) {
|
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
|
* For the Conditional Reference op, it's OK if
|
||||||
* the name is not found; We just need a way to
|
* the name is not found; We just need a way to
|
||||||
* indicate this to the interpreter, set the
|
* indicate this to the interpreter, set the
|
||||||
* object to the root
|
* object to the root
|
||||||
*/
|
*/
|
||||||
obj_desc = ACPI_CAST_PTR (
|
obj_desc =
|
||||||
union acpi_operand_object, acpi_gbl_root_node);
|
ACPI_CAST_PTR(union
|
||||||
|
acpi_operand_object,
|
||||||
|
acpi_gbl_root_node);
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* We just plain didn't find it -- which is a
|
* We just plain didn't find it -- which is a
|
||||||
* very serious error at this point
|
* very serious error at this point
|
||||||
@@ -582,30 +566,30 @@ acpi_ds_create_operand (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_NSERROR (name_string, status);
|
ACPI_REPORT_NSERROR(name_string, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free the namestring created above */
|
/* Free the namestring created above */
|
||||||
|
|
||||||
ACPI_MEM_FREE (name_string);
|
ACPI_MEM_FREE(name_string);
|
||||||
|
|
||||||
/* Check status from the lookup */
|
/* Check status from the lookup */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the resulting object onto the current object stack */
|
/* Put the resulting object onto the current object stack */
|
||||||
|
|
||||||
status = acpi_ds_obj_stack_push (obj_desc, walk_state);
|
status = acpi_ds_obj_stack_push(obj_desc, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
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));
|
||||||
else {
|
} else {
|
||||||
/* Check for null name case */
|
/* Check for null name case */
|
||||||
|
|
||||||
if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
if (arg->common.aml_opcode == AML_INT_NAMEPATH_OP) {
|
||||||
@@ -615,77 +599,83 @@ acpi_ds_create_operand (
|
|||||||
* in the original ASL. Create a Zero Constant for a
|
* in the original ASL. Create a Zero Constant for a
|
||||||
* placeholder. (Store to a constant is a Noop.)
|
* placeholder. (Store to a constant is a Noop.)
|
||||||
*/
|
*/
|
||||||
opcode = AML_ZERO_OP; /* Has no arguments! */
|
opcode = AML_ZERO_OP; /* Has no arguments! */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"Null namepath: Arg=%p\n", arg));
|
"Null namepath: Arg=%p\n", arg));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
opcode = arg->common.aml_opcode;
|
opcode = arg->common.aml_opcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the object type of the argument */
|
/* Get the object type of the argument */
|
||||||
|
|
||||||
op_info = acpi_ps_get_opcode_info (opcode);
|
op_info = acpi_ps_get_opcode_info(opcode);
|
||||||
if (op_info->object_type == ACPI_TYPE_INVALID) {
|
if (op_info->object_type == ACPI_TYPE_INVALID) {
|
||||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op_info->flags & AML_HAS_RETVAL) {
|
if (op_info->flags & AML_HAS_RETVAL) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"Argument previously created, already stacked \n"));
|
"Argument previously created, already stacked \n"));
|
||||||
|
|
||||||
ACPI_DEBUGGER_EXEC (acpi_db_display_argument_object (
|
ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object
|
||||||
walk_state->operands [walk_state->num_operands - 1], walk_state));
|
(walk_state->
|
||||||
|
operands[walk_state->num_operands -
|
||||||
|
1], walk_state));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use value that was already previously returned
|
* Use value that was already previously returned
|
||||||
* by the evaluation of this argument
|
* by the evaluation of this argument
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_result_pop_from_bottom (&obj_desc, walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ds_result_pop_from_bottom(&obj_desc,
|
||||||
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
/*
|
/*
|
||||||
* Only error is underflow, and this indicates
|
* Only error is underflow, and this indicates
|
||||||
* a missing or null operand!
|
* a missing or null operand!
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Missing or null operand, %s\n",
|
"Missing or null operand, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception
|
||||||
return_ACPI_STATUS (status);
|
(status)));
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Create an ACPI_INTERNAL_OBJECT for the argument */
|
/* 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) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the new object */
|
/* Initialize the new object */
|
||||||
|
|
||||||
status = acpi_ds_init_object_from_op (
|
status =
|
||||||
walk_state, arg, opcode, &obj_desc);
|
acpi_ds_init_object_from_op(walk_state, arg, opcode,
|
||||||
if (ACPI_FAILURE (status)) {
|
&obj_desc);
|
||||||
acpi_ut_delete_object_desc (obj_desc);
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
acpi_ut_delete_object_desc(obj_desc);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the operand object on the object stack */
|
/* Put the operand object on the object stack */
|
||||||
|
|
||||||
status = acpi_ds_obj_stack_push (obj_desc, walk_state);
|
status = acpi_ds_obj_stack_push(obj_desc, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
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);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_create_operands
|
* FUNCTION: acpi_ds_create_operands
|
||||||
@@ -702,29 +692,27 @@ acpi_ds_create_operand (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_create_operands (
|
acpi_ds_create_operands(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *first_arg)
|
||||||
union acpi_parse_object *first_arg)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
u32 arg_count = 0;
|
u32 arg_count = 0;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_create_operands", first_arg);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_create_operands", first_arg);
|
||||||
|
|
||||||
/* For all arguments in the list... */
|
/* For all arguments in the list... */
|
||||||
|
|
||||||
arg = first_arg;
|
arg = first_arg;
|
||||||
while (arg) {
|
while (arg) {
|
||||||
status = acpi_ds_create_operand (walk_state, arg, arg_count);
|
status = acpi_ds_create_operand(walk_state, arg, arg_count);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
arg_count, arg, first_arg));
|
"Arg #%d (%p) done, Arg1=%p\n", arg_count,
|
||||||
|
arg, first_arg));
|
||||||
|
|
||||||
/* Move on to next argument, if any */
|
/* Move on to next argument, if any */
|
||||||
|
|
||||||
@@ -732,20 +720,17 @@ acpi_ds_create_operands (
|
|||||||
arg_count++;
|
arg_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
/*
|
/*
|
||||||
* We must undo everything done above; meaning that we must
|
* We must undo everything done above; meaning that we must
|
||||||
* pop everything off of the operand stack and delete those
|
* pop everything off of the operand stack and delete those
|
||||||
* objects
|
* objects
|
||||||
*/
|
*/
|
||||||
(void) acpi_ds_obj_stack_pop_and_delete (arg_count, walk_state);
|
(void)acpi_ds_obj_stack_pop_and_delete(arg_count, walk_state);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
|
||||||
(arg_count + 1), acpi_format_exception (status)));
|
(arg_count + 1), acpi_format_exception(status)));
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -52,27 +51,26 @@
|
|||||||
#include <acpi/acdebug.h>
|
#include <acpi/acdebug.h>
|
||||||
#include <acpi/acdisasm.h>
|
#include <acpi/acdisasm.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dswexec")
|
ACPI_MODULE_NAME("dswexec")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch table for opcode classes
|
* Dispatch table for opcode classes
|
||||||
*/
|
*/
|
||||||
static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
|
static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch[] = {
|
||||||
acpi_ex_opcode_0A_0T_1R,
|
acpi_ex_opcode_0A_0T_1R,
|
||||||
acpi_ex_opcode_1A_0T_0R,
|
acpi_ex_opcode_1A_0T_0R,
|
||||||
acpi_ex_opcode_1A_0T_1R,
|
acpi_ex_opcode_1A_0T_1R,
|
||||||
acpi_ex_opcode_1A_1T_0R,
|
acpi_ex_opcode_1A_1T_0R,
|
||||||
acpi_ex_opcode_1A_1T_1R,
|
acpi_ex_opcode_1A_1T_1R,
|
||||||
acpi_ex_opcode_2A_0T_0R,
|
acpi_ex_opcode_2A_0T_0R,
|
||||||
acpi_ex_opcode_2A_0T_1R,
|
acpi_ex_opcode_2A_0T_1R,
|
||||||
acpi_ex_opcode_2A_1T_1R,
|
acpi_ex_opcode_2A_1T_1R,
|
||||||
acpi_ex_opcode_2A_2T_1R,
|
acpi_ex_opcode_2A_2T_1R,
|
||||||
acpi_ex_opcode_3A_0T_0R,
|
acpi_ex_opcode_3A_0T_0R,
|
||||||
acpi_ex_opcode_3A_1T_1R,
|
acpi_ex_opcode_3A_1T_1R,
|
||||||
acpi_ex_opcode_6A_0T_1R};
|
acpi_ex_opcode_6A_0T_1R
|
||||||
|
};
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
@@ -88,64 +86,64 @@ static ACPI_EXECUTE_OP acpi_gbl_op_type_dispatch [] = {
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_get_predicate_value (
|
acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_operand_object *result_obj)
|
||||||
union acpi_operand_object *result_obj) {
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *local_obj_desc = NULL;
|
union acpi_operand_object *local_obj_desc = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_get_predicate_value", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_get_predicate_value", walk_state);
|
||||||
|
|
||||||
walk_state->control_state->common.state = 0;
|
walk_state->control_state->common.state = 0;
|
||||||
|
|
||||||
if (result_obj) {
|
if (result_obj) {
|
||||||
status = acpi_ds_result_pop (&obj_desc, walk_state);
|
status = acpi_ds_result_pop(&obj_desc, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not get result from predicate evaluation, %s\n",
|
"Could not get result from predicate evaluation, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
status = acpi_ds_create_operand(walk_state, walk_state->op, 0);
|
||||||
status = acpi_ds_create_operand (walk_state, walk_state->op, 0);
|
if (ACPI_FAILURE(status)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_resolve_to_value (&walk_state->operands [0], walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ex_resolve_to_value(&walk_state->operands[0],
|
||||||
return_ACPI_STATUS (status);
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_desc = walk_state->operands [0];
|
obj_desc = walk_state->operands[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"No predicate obj_desc=%p State=%p\n",
|
"No predicate obj_desc=%p State=%p\n",
|
||||||
obj_desc, walk_state));
|
obj_desc, walk_state));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Result of predicate evaluation must be an Integer
|
* Result of predicate evaluation must be an Integer
|
||||||
* object. Implicitly convert the argument if necessary.
|
* object. Implicitly convert the argument if necessary.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_integer (obj_desc, &local_obj_desc, 16);
|
status = acpi_ex_convert_to_integer(obj_desc, &local_obj_desc, 16);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (local_obj_desc) != ACPI_TYPE_INTEGER) {
|
if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\n",
|
"Bad predicate (not an integer) obj_desc=%p State=%p Type=%X\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;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -153,7 +151,7 @@ acpi_ds_get_predicate_value (
|
|||||||
|
|
||||||
/* Truncate the predicate to 32-bits if necessary */
|
/* Truncate the predicate to 32-bits if necessary */
|
||||||
|
|
||||||
acpi_ex_truncate_for32bit_table (local_obj_desc);
|
acpi_ex_truncate_for32bit_table(local_obj_desc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save the result of the predicate evaluation on
|
* Save the result of the predicate evaluation on
|
||||||
@@ -161,8 +159,7 @@ acpi_ds_get_predicate_value (
|
|||||||
*/
|
*/
|
||||||
if (local_obj_desc->integer.value) {
|
if (local_obj_desc->integer.value) {
|
||||||
walk_state->control_state->common.value = TRUE;
|
walk_state->control_state->common.value = TRUE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Predicate is FALSE, we will just toss the
|
* Predicate is FALSE, we will just toss the
|
||||||
* rest of the package
|
* rest of the package
|
||||||
@@ -171,30 +168,30 @@ acpi_ds_get_predicate_value (
|
|||||||
status = AE_CTRL_FALSE;
|
status = AE_CTRL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
|
||||||
cleanup:
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
|
||||||
|
walk_state->control_state->common.value,
|
||||||
|
walk_state->op));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n",
|
/* Break to debugger to display result */
|
||||||
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
|
* Delete the predicate result object (we know that
|
||||||
* we don't need it anymore)
|
* we don't need it anymore)
|
||||||
*/
|
*/
|
||||||
if (local_obj_desc != obj_desc) {
|
if (local_obj_desc != obj_desc) {
|
||||||
acpi_ut_remove_reference (local_obj_desc);
|
acpi_ut_remove_reference(local_obj_desc);
|
||||||
}
|
}
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
|
|
||||||
walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
|
walk_state->control_state->common.state = ACPI_CONTROL_NORMAL;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_exec_begin_op
|
* FUNCTION: acpi_ds_exec_begin_op
|
||||||
@@ -211,38 +208,39 @@ cleanup:
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_exec_begin_op (
|
acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object **out_op)
|
||||||
union acpi_parse_object **out_op)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 opcode_class;
|
u32 opcode_class;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_exec_begin_op", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_exec_begin_op", walk_state);
|
||||||
|
|
||||||
op = walk_state->op;
|
op = walk_state->op;
|
||||||
if (!op) {
|
if (!op) {
|
||||||
status = acpi_ds_load2_begin_op (walk_state, out_op);
|
status = acpi_ds_load2_begin_op(walk_state, out_op);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
op = *out_op;
|
op = *out_op;
|
||||||
walk_state->op = op;
|
walk_state->op = op;
|
||||||
walk_state->opcode = op->common.aml_opcode;
|
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)) {
|
if (acpi_ns_opens_scope(walk_state->op_info->object_type)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"(%s) Popping scope for Op %p\n",
|
"(%s) Popping scope for Op %p\n",
|
||||||
acpi_ut_get_type_name (walk_state->op_info->object_type), op));
|
acpi_ut_get_type_name(walk_state->
|
||||||
|
op_info->
|
||||||
|
object_type),
|
||||||
|
op));
|
||||||
|
|
||||||
status = acpi_ds_scope_stack_pop (walk_state);
|
status = acpi_ds_scope_stack_pop(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,7 +250,7 @@ acpi_ds_exec_begin_op (
|
|||||||
*out_op = op;
|
*out_op = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -261,19 +259,20 @@ acpi_ds_exec_begin_op (
|
|||||||
* Save this knowledge in the current scope descriptor
|
* Save this knowledge in the current scope descriptor
|
||||||
*/
|
*/
|
||||||
if ((walk_state->control_state) &&
|
if ((walk_state->control_state) &&
|
||||||
(walk_state->control_state->common.state ==
|
(walk_state->control_state->common.state ==
|
||||||
ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
|
ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Exec predicate Op=%p State=%p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
op, walk_state));
|
"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 */
|
/* Save start of predicate */
|
||||||
|
|
||||||
walk_state->control_state->control.predicate_op = op;
|
walk_state->control_state->control.predicate_op = op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
opcode_class = walk_state->op_info->class;
|
opcode_class = walk_state->op_info->class;
|
||||||
|
|
||||||
/* We want to send namepaths to the load code */
|
/* We want to send namepaths to the load code */
|
||||||
@@ -288,15 +287,14 @@ acpi_ds_exec_begin_op (
|
|||||||
switch (opcode_class) {
|
switch (opcode_class) {
|
||||||
case AML_CLASS_CONTROL:
|
case AML_CLASS_CONTROL:
|
||||||
|
|
||||||
status = acpi_ds_result_stack_push (walk_state);
|
status = acpi_ds_result_stack_push(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_exec_begin_control_op (walk_state, op);
|
status = acpi_ds_exec_begin_control_op(walk_state, op);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_CLASS_NAMED_OBJECT:
|
case AML_CLASS_NAMED_OBJECT:
|
||||||
|
|
||||||
if (walk_state->walk_type == ACPI_WALK_METHOD) {
|
if (walk_state->walk_type == ACPI_WALK_METHOD) {
|
||||||
@@ -306,15 +304,14 @@ acpi_ds_exec_begin_op (
|
|||||||
* object is temporary and will be deleted upon completion of
|
* object is temporary and will be deleted upon completion of
|
||||||
* the execution of this method.
|
* the execution of this method.
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_load2_begin_op (walk_state, NULL);
|
status = acpi_ds_load2_begin_op(walk_state, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_REGION_OP) {
|
if (op->common.aml_opcode == AML_REGION_OP) {
|
||||||
status = acpi_ds_result_stack_push (walk_state);
|
status = acpi_ds_result_stack_push(walk_state);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_CLASS_EXECUTE:
|
case AML_CLASS_EXECUTE:
|
||||||
case AML_CLASS_CREATE:
|
case AML_CLASS_CREATE:
|
||||||
|
|
||||||
@@ -322,20 +319,18 @@ acpi_ds_exec_begin_op (
|
|||||||
* Most operators with arguments.
|
* Most operators with arguments.
|
||||||
* Start a new result/operand state
|
* Start a new result/operand state
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_result_stack_push (walk_state);
|
status = acpi_ds_result_stack_push(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Nothing to do here during method execution */
|
/* Nothing to do here during method execution */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_exec_end_op
|
* FUNCTION: acpi_ds_exec_end_op
|
||||||
@@ -350,28 +345,25 @@ acpi_ds_exec_begin_op (
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_exec_end_op (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 op_type;
|
u32 op_type;
|
||||||
u32 op_class;
|
u32 op_class;
|
||||||
union acpi_parse_object *next_op;
|
union acpi_parse_object *next_op;
|
||||||
union acpi_parse_object *first_arg;
|
union acpi_parse_object *first_arg;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ds_exec_end_op", walk_state);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ds_exec_end_op", walk_state);
|
op = walk_state->op;
|
||||||
|
|
||||||
|
|
||||||
op = walk_state->op;
|
|
||||||
op_type = walk_state->op_info->type;
|
op_type = walk_state->op_info->type;
|
||||||
op_class = walk_state->op_info->class;
|
op_class = walk_state->op_info->class;
|
||||||
|
|
||||||
if (op_class == AML_CLASS_UNKNOWN) {
|
if (op_class == AML_CLASS_UNKNOWN) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", op->common.aml_opcode));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown opcode %X\n",
|
||||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
op->common.aml_opcode));
|
||||||
|
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
first_arg = op->common.value.arg;
|
first_arg = op->common.value.arg;
|
||||||
@@ -384,29 +376,31 @@ acpi_ds_exec_end_op (
|
|||||||
|
|
||||||
/* Call debugger for single step support (DEBUG build only) */
|
/* 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(status =
|
||||||
ACPI_DEBUGGER_EXEC (if (ACPI_FAILURE (status)) {return_ACPI_STATUS (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 */
|
/* Decode the Opcode Class */
|
||||||
|
|
||||||
switch (op_class) {
|
switch (op_class) {
|
||||||
case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
|
case AML_CLASS_ARGUMENT: /* constants, literals, etc. - do nothing */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_CLASS_EXECUTE: /* most operators with arguments */
|
||||||
case AML_CLASS_EXECUTE: /* most operators with arguments */
|
|
||||||
|
|
||||||
/* Build resolved operand stack */
|
/* Build resolved operand stack */
|
||||||
|
|
||||||
status = acpi_ds_create_operands (walk_state, first_arg);
|
status = acpi_ds_create_operands(walk_state, first_arg);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done with this result state (Now that operand stack is built) */
|
/* Done with this result state (Now that operand stack is built) */
|
||||||
|
|
||||||
status = acpi_ds_result_stack_pop (walk_state);
|
status = acpi_ds_result_stack_pop(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,86 +411,93 @@ acpi_ds_exec_end_op (
|
|||||||
if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
|
if (!(walk_state->op_info->flags & AML_NO_OPERAND_RESOLVE)) {
|
||||||
/* Resolve all operands */
|
/* Resolve all operands */
|
||||||
|
|
||||||
status = acpi_ex_resolve_operands (walk_state->opcode,
|
status = acpi_ex_resolve_operands(walk_state->opcode,
|
||||||
&(walk_state->operands [walk_state->num_operands -1]),
|
&(walk_state->
|
||||||
walk_state);
|
operands
|
||||||
if (ACPI_SUCCESS (status)) {
|
[walk_state->
|
||||||
ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
|
num_operands - 1]),
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode),
|
walk_state);
|
||||||
walk_state->num_operands, "after ex_resolve_operands");
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/*
|
/*
|
||||||
* Dispatch the request to the appropriate interpreter handler
|
* Dispatch the request to the appropriate interpreter handler
|
||||||
* routine. There is one routine per opcode "type" based upon the
|
* routine. There is one routine per opcode "type" based upon the
|
||||||
* number of opcode arguments and return type.
|
* number of opcode arguments and return type.
|
||||||
*/
|
*/
|
||||||
status = acpi_gbl_op_type_dispatch[op_type] (walk_state);
|
status =
|
||||||
}
|
acpi_gbl_op_type_dispatch[op_type] (walk_state);
|
||||||
else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Treat constructs of the form "Store(local_x,local_x)" as noops when the
|
* Treat constructs of the form "Store(local_x,local_x)" as noops when the
|
||||||
* Local is uninitialized.
|
* Local is uninitialized.
|
||||||
*/
|
*/
|
||||||
if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
|
if ((status == AE_AML_UNINITIALIZED_LOCAL) &&
|
||||||
(walk_state->opcode == AML_STORE_OP) &&
|
(walk_state->opcode == AML_STORE_OP) &&
|
||||||
(walk_state->operands[0]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
|
(walk_state->operands[0]->common.type ==
|
||||||
(walk_state->operands[1]->common.type == ACPI_TYPE_LOCAL_REFERENCE) &&
|
ACPI_TYPE_LOCAL_REFERENCE)
|
||||||
(walk_state->operands[0]->reference.opcode ==
|
&& (walk_state->operands[1]->common.type ==
|
||||||
walk_state->operands[1]->reference.opcode) &&
|
ACPI_TYPE_LOCAL_REFERENCE)
|
||||||
(walk_state->operands[0]->reference.offset ==
|
&& (walk_state->operands[0]->reference.opcode ==
|
||||||
walk_state->operands[1]->reference.offset)) {
|
walk_state->operands[1]->reference.opcode)
|
||||||
|
&& (walk_state->operands[0]->reference.offset ==
|
||||||
|
walk_state->operands[1]->reference.offset)) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
"[%s]: Could not resolve operands, %s\n",
|
||||||
"[%s]: Could not resolve operands, %s\n",
|
acpi_ps_get_opcode_name
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode),
|
(walk_state->opcode),
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception
|
||||||
|
(status)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always delete the argument objects and clear the operand stack */
|
/* Always delete the argument objects and clear the operand stack */
|
||||||
|
|
||||||
acpi_ds_clear_operands (walk_state);
|
acpi_ds_clear_operands(walk_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a result object was returned from above, push it on the
|
* If a result object was returned from above, push it on the
|
||||||
* current result stack
|
* current result stack
|
||||||
*/
|
*/
|
||||||
if (ACPI_SUCCESS (status) &&
|
if (ACPI_SUCCESS(status) && walk_state->result_obj) {
|
||||||
walk_state->result_obj) {
|
status =
|
||||||
status = acpi_ds_result_push (walk_state->result_obj, walk_state);
|
acpi_ds_result_push(walk_state->result_obj,
|
||||||
|
walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
switch (op_type) {
|
switch (op_type) {
|
||||||
case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
|
case AML_TYPE_CONTROL: /* Type 1 opcode, IF/ELSE/WHILE/NOOP */
|
||||||
|
|
||||||
/* 1 Operand, 0 external_result, 0 internal_result */
|
/* 1 Operand, 0 external_result, 0 internal_result */
|
||||||
|
|
||||||
status = acpi_ds_exec_end_control_op (walk_state, op);
|
status = acpi_ds_exec_end_control_op(walk_state, op);
|
||||||
|
|
||||||
/* Make sure to properly pop the result stack */
|
/* Make sure to properly pop the result stack */
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
status = acpi_ds_result_stack_pop (walk_state);
|
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);
|
||||||
status = acpi_ds_result_stack_pop (walk_state);
|
if (ACPI_SUCCESS(status)) {
|
||||||
if (ACPI_SUCCESS (status)) {
|
|
||||||
status = AE_CTRL_PENDING;
|
status = AE_CTRL_PENDING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_METHOD_CALL:
|
case AML_TYPE_METHOD_CALL:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -505,16 +506,22 @@ acpi_ds_exec_end_op (
|
|||||||
* a reference to it.
|
* a reference to it.
|
||||||
*/
|
*/
|
||||||
if ((op->asl.parent) &&
|
if ((op->asl.parent) &&
|
||||||
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP) ||
|
((op->asl.parent->asl.aml_opcode == AML_PACKAGE_OP)
|
||||||
(op->asl.parent->asl.aml_opcode == AML_VAR_PACKAGE_OP))) {
|
|| (op->asl.parent->asl.aml_opcode ==
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
AML_VAR_PACKAGE_OP))) {
|
||||||
"Method Reference in a Package, Op=%p\n", op));
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
op->common.node = (struct acpi_namespace_node *) op->asl.value.arg->asl.node->object;
|
"Method Reference in a Package, Op=%p\n",
|
||||||
acpi_ut_add_reference (op->asl.value.arg->asl.node->object);
|
op));
|
||||||
return_ACPI_STATUS (AE_OK);
|
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
|
* (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
|
||||||
@@ -531,8 +538,8 @@ acpi_ds_exec_end_op (
|
|||||||
/*
|
/*
|
||||||
* Get the method's arguments and put them on the operand stack
|
* Get the method's arguments and put them on the operand stack
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_create_operands (walk_state, next_op);
|
status = acpi_ds_create_operands(walk_state, next_op);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,11 +548,11 @@ acpi_ds_exec_end_op (
|
|||||||
* we must resolve all local references here (Local variables,
|
* we must resolve all local references here (Local variables,
|
||||||
* arguments to *this* method, etc.)
|
* arguments to *this* method, etc.)
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_resolve_operands (walk_state);
|
status = acpi_ds_resolve_operands(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/* On error, clear all resolved operands */
|
/* On error, clear all resolved operands */
|
||||||
|
|
||||||
acpi_ds_clear_operands (walk_state);
|
acpi_ds_clear_operands(walk_state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -559,27 +566,28 @@ acpi_ds_exec_end_op (
|
|||||||
* Return now; we don't want to disturb anything,
|
* Return now; we don't want to disturb anything,
|
||||||
* especially the operand count!
|
* especially the operand count!
|
||||||
*/
|
*/
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_CREATE_FIELD:
|
case AML_TYPE_CREATE_FIELD:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
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);
|
status = acpi_ds_load2_end_op(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_eval_buffer_field_operands (walk_state, op);
|
status =
|
||||||
|
acpi_ds_eval_buffer_field_operands(walk_state, op);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_CREATE_OBJECT:
|
case AML_TYPE_CREATE_OBJECT:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
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) {
|
switch (op->common.parent->common.aml_opcode) {
|
||||||
case AML_NAME_OP:
|
case AML_NAME_OP:
|
||||||
@@ -588,13 +596,15 @@ acpi_ds_exec_end_op (
|
|||||||
* Put the Node on the object stack (Contains the ACPI Name
|
* Put the Node on the object stack (Contains the ACPI Name
|
||||||
* of this object)
|
* of this object)
|
||||||
*/
|
*/
|
||||||
walk_state->operands[0] = (void *) op->common.parent->common.node;
|
walk_state->operands[0] =
|
||||||
|
(void *)op->common.parent->common.node;
|
||||||
walk_state->num_operands = 1;
|
walk_state->num_operands = 1;
|
||||||
|
|
||||||
status = acpi_ds_create_node (walk_state,
|
status = acpi_ds_create_node(walk_state,
|
||||||
op->common.parent->common.node,
|
op->common.parent->
|
||||||
op->common.parent);
|
common.node,
|
||||||
if (ACPI_FAILURE (status)) {
|
op->common.parent);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,20 +613,26 @@ acpi_ds_exec_end_op (
|
|||||||
|
|
||||||
case AML_INT_EVAL_SUBTREE_OP:
|
case AML_INT_EVAL_SUBTREE_OP:
|
||||||
|
|
||||||
status = acpi_ds_eval_data_object_operands (walk_state, op,
|
status =
|
||||||
acpi_ns_get_attached_object (op->common.parent->common.node));
|
acpi_ds_eval_data_object_operands
|
||||||
|
(walk_state, op,
|
||||||
|
acpi_ns_get_attached_object(op->common.
|
||||||
|
parent->common.
|
||||||
|
node));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
status = acpi_ds_eval_data_object_operands (walk_state, op, NULL);
|
status =
|
||||||
|
acpi_ds_eval_data_object_operands
|
||||||
|
(walk_state, op, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Done with result state (Now that operand stack is built) */
|
/* Done with result state (Now that operand stack is built) */
|
||||||
|
|
||||||
status = acpi_ds_result_stack_pop (walk_state);
|
status = acpi_ds_result_stack_pop(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,56 +641,58 @@ acpi_ds_exec_end_op (
|
|||||||
* current result stack
|
* current result stack
|
||||||
*/
|
*/
|
||||||
if (walk_state->result_obj) {
|
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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_NAMED_FIELD:
|
case AML_TYPE_NAMED_FIELD:
|
||||||
case AML_TYPE_NAMED_COMPLEX:
|
case AML_TYPE_NAMED_COMPLEX:
|
||||||
case AML_TYPE_NAMED_SIMPLE:
|
case AML_TYPE_NAMED_SIMPLE:
|
||||||
case AML_TYPE_NAMED_NO_OBJ:
|
case AML_TYPE_NAMED_NO_OBJ:
|
||||||
|
|
||||||
status = acpi_ds_load2_end_op (walk_state);
|
status = acpi_ds_load2_end_op(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_REGION_OP) {
|
if (op->common.aml_opcode == AML_REGION_OP) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
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 =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ds_eval_region_operands(walk_state,
|
||||||
|
op);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_result_stack_pop (walk_state);
|
status = acpi_ds_result_stack_pop(walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_UNDEFINED:
|
case AML_TYPE_UNDEFINED:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Undefined opcode type Op=%p\n", op));
|
"Undefined opcode type Op=%p\n", op));
|
||||||
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
|
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
|
||||||
|
|
||||||
|
|
||||||
case AML_TYPE_BOGUS:
|
case AML_TYPE_BOGUS:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"Internal opcode=%X type Op=%p\n",
|
"Internal opcode=%X type Op=%p\n",
|
||||||
walk_state->opcode, op));
|
walk_state->opcode, op));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
|
"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;
|
status = AE_NOT_IMPLEMENTED;
|
||||||
break;
|
break;
|
||||||
@@ -685,55 +703,58 @@ acpi_ds_exec_end_op (
|
|||||||
* ACPI 2.0 support for 64-bit integers: Truncate numeric
|
* ACPI 2.0 support for 64-bit integers: Truncate numeric
|
||||||
* result value if we are executing from a 32-bit ACPI table
|
* result value if we are executing from a 32-bit ACPI table
|
||||||
*/
|
*/
|
||||||
acpi_ex_truncate_for32bit_table (walk_state->result_obj);
|
acpi_ex_truncate_for32bit_table(walk_state->result_obj);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if we just completed the evaluation of a
|
* Check if we just completed the evaluation of a
|
||||||
* conditional predicate
|
* conditional predicate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((ACPI_SUCCESS (status)) &&
|
if ((ACPI_SUCCESS(status)) &&
|
||||||
(walk_state->control_state) &&
|
(walk_state->control_state) &&
|
||||||
(walk_state->control_state->common.state ==
|
(walk_state->control_state->common.state ==
|
||||||
ACPI_CONTROL_PREDICATE_EXECUTING) &&
|
ACPI_CONTROL_PREDICATE_EXECUTING) &&
|
||||||
(walk_state->control_state->control.predicate_op == op)) {
|
(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;
|
walk_state->result_obj = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Invoke exception handler on error */
|
/* Invoke exception handler on error */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status) &&
|
if (ACPI_FAILURE(status) &&
|
||||||
acpi_gbl_exception_handler &&
|
acpi_gbl_exception_handler && !(status & AE_CODE_CONTROL)) {
|
||||||
!(status & AE_CODE_CONTROL)) {
|
acpi_ex_exit_interpreter();
|
||||||
acpi_ex_exit_interpreter ();
|
status = acpi_gbl_exception_handler(status,
|
||||||
status = acpi_gbl_exception_handler (status,
|
walk_state->method_node->
|
||||||
walk_state->method_node->name.integer, walk_state->opcode,
|
name.integer,
|
||||||
walk_state->aml_offset, NULL);
|
walk_state->opcode,
|
||||||
(void) acpi_ex_enter_interpreter ();
|
walk_state->aml_offset,
|
||||||
|
NULL);
|
||||||
|
(void)acpi_ex_enter_interpreter();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (walk_state->result_obj) {
|
if (walk_state->result_obj) {
|
||||||
/* Break to debugger to display result */
|
/* Break to debugger to display result */
|
||||||
|
|
||||||
ACPI_DEBUGGER_EXEC (acpi_db_display_result_object (walk_state->result_obj,
|
ACPI_DEBUGGER_EXEC(acpi_db_display_result_object
|
||||||
walk_state));
|
(walk_state->result_obj, walk_state));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete the result op if and only if:
|
* Delete the result op if and only if:
|
||||||
* Parent will not use the result -- such as any
|
* Parent will not use the result -- such as any
|
||||||
* non-nested type2 op in a method (parent will be method)
|
* 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
|
#ifdef _UNDER_DEVELOPMENT
|
||||||
|
|
||||||
if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
|
if (walk_state->parser_state.aml == walk_state->parser_state.aml_end) {
|
||||||
acpi_db_method_end (walk_state);
|
acpi_db_method_end(walk_state);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -745,12 +766,10 @@ cleanup:
|
|||||||
|
|
||||||
/* On error, display method locals/args */
|
/* On error, display method locals/args */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_dm_dump_method_info (status, walk_state, op);
|
acpi_dm_dump_method_info(status, walk_state, op);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -55,8 +54,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dswload")
|
ACPI_MODULE_NAME("dswload")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -70,32 +68,29 @@
|
|||||||
* DESCRIPTION: Init walk state callbacks
|
* DESCRIPTION: Init walk state callbacks
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_init_callbacks (
|
acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number)
|
||||||
struct acpi_walk_state *walk_state,
|
|
||||||
u32 pass_number)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (pass_number) {
|
switch (pass_number) {
|
||||||
case 1:
|
case 1:
|
||||||
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
|
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
|
||||||
ACPI_PARSE_DELETE_TREE;
|
ACPI_PARSE_DELETE_TREE;
|
||||||
walk_state->descending_callback = acpi_ds_load1_begin_op;
|
walk_state->descending_callback = acpi_ds_load1_begin_op;
|
||||||
walk_state->ascending_callback = acpi_ds_load1_end_op;
|
walk_state->ascending_callback = acpi_ds_load1_end_op;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
|
walk_state->parse_flags = ACPI_PARSE_LOAD_PASS1 |
|
||||||
ACPI_PARSE_DELETE_TREE;
|
ACPI_PARSE_DELETE_TREE;
|
||||||
walk_state->descending_callback = acpi_ds_load2_begin_op;
|
walk_state->descending_callback = acpi_ds_load2_begin_op;
|
||||||
walk_state->ascending_callback = acpi_ds_load2_end_op;
|
walk_state->ascending_callback = acpi_ds_load2_end_op;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
|
walk_state->parse_flags |= ACPI_PARSE_EXECUTE |
|
||||||
ACPI_PARSE_DELETE_TREE;
|
ACPI_PARSE_DELETE_TREE;
|
||||||
walk_state->descending_callback = acpi_ds_exec_begin_op;
|
walk_state->descending_callback = acpi_ds_exec_begin_op;
|
||||||
walk_state->ascending_callback = acpi_ds_exec_end_op;
|
walk_state->ascending_callback = acpi_ds_exec_end_op;
|
||||||
#endif
|
#endif
|
||||||
@@ -108,7 +103,6 @@ acpi_ds_init_callbacks (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_load1_begin_op
|
* FUNCTION: acpi_ds_load1_begin_op
|
||||||
@@ -123,23 +117,21 @@ acpi_ds_init_callbacks (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_load1_begin_op (
|
acpi_ds_load1_begin_op(struct acpi_walk_state * walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object ** out_op)
|
||||||
union acpi_parse_object **out_op)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_object_type object_type;
|
acpi_object_type object_type;
|
||||||
char *path;
|
char *path;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ds_load1_begin_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ds_load1_begin_op");
|
||||||
|
|
||||||
op = walk_state->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 */
|
/* We are only interested in opcodes that have an associated name */
|
||||||
|
|
||||||
@@ -157,14 +149,15 @@ acpi_ds_load1_begin_op (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path = acpi_ps_get_next_namestring (&walk_state->parser_state);
|
path = acpi_ps_get_next_namestring(&walk_state->parser_state);
|
||||||
|
|
||||||
/* Map the raw opcode into an internal object type */
|
/* Map the raw opcode into an internal object type */
|
||||||
|
|
||||||
object_type = walk_state->op_info->object_type;
|
object_type = walk_state->op_info->object_type;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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) {
|
switch (walk_state->opcode) {
|
||||||
case AML_SCOPE_OP:
|
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.
|
* that we can actually open the scope to enter new names underneath it.
|
||||||
* Allow search-to-root for single namesegs.
|
* Allow search-to-root for single namesegs.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
|
status =
|
||||||
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
|
acpi_ns_lookup(walk_state->scope_info, path, object_type,
|
||||||
|
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
||||||
|
walk_state, &(node));
|
||||||
#ifdef ACPI_ASL_COMPILER
|
#ifdef ACPI_ASL_COMPILER
|
||||||
if (status == AE_NOT_FOUND) {
|
if (status == AE_NOT_FOUND) {
|
||||||
/*
|
/*
|
||||||
@@ -183,14 +178,16 @@ acpi_ds_load1_begin_op (
|
|||||||
* Target of Scope() not found. Generate an External for it, and
|
* Target of Scope() not found. Generate an External for it, and
|
||||||
* insert the name into the namespace.
|
* insert the name into the namespace.
|
||||||
*/
|
*/
|
||||||
acpi_dm_add_to_external_list (path);
|
acpi_dm_add_to_external_list(path);
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
|
status =
|
||||||
ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
|
acpi_ns_lookup(walk_state->scope_info, path,
|
||||||
walk_state, &(node));
|
object_type, ACPI_IMODE_LOAD_PASS1,
|
||||||
|
ACPI_NS_SEARCH_PARENT, walk_state,
|
||||||
|
&(node));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_NSERROR (path, status);
|
ACPI_REPORT_NSERROR(path, status);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,7 +196,7 @@ acpi_ds_load1_begin_op (
|
|||||||
* one of the opcodes that actually opens a scope
|
* one of the opcodes that actually opens a scope
|
||||||
*/
|
*/
|
||||||
switch (node->type) {
|
switch (node->type) {
|
||||||
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
|
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
|
||||||
case ACPI_TYPE_DEVICE:
|
case ACPI_TYPE_DEVICE:
|
||||||
case ACPI_TYPE_POWER:
|
case ACPI_TYPE_POWER:
|
||||||
case ACPI_TYPE_PROCESSOR:
|
case ACPI_TYPE_PROCESSOR:
|
||||||
@@ -223,9 +220,10 @@ acpi_ds_load1_begin_op (
|
|||||||
* a warning
|
* a warning
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
|
"Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
|
||||||
path, acpi_ut_get_type_name (node->type)));
|
path,
|
||||||
|
acpi_ut_get_type_name(node->type)));
|
||||||
|
|
||||||
node->type = ACPI_TYPE_ANY;
|
node->type = ACPI_TYPE_ANY;
|
||||||
walk_state->scope_info->common.value = 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 */
|
/* All other types are an error */
|
||||||
|
|
||||||
ACPI_REPORT_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));
|
||||||
"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);
|
return (AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -272,15 +267,15 @@ acpi_ds_load1_begin_op (
|
|||||||
|
|
||||||
flags = ACPI_NS_NO_UPSEARCH;
|
flags = ACPI_NS_NO_UPSEARCH;
|
||||||
if ((walk_state->opcode != AML_SCOPE_OP) &&
|
if ((walk_state->opcode != AML_SCOPE_OP) &&
|
||||||
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
|
(!(walk_state->parse_flags & ACPI_PARSE_DEFERRED_OP))) {
|
||||||
flags |= ACPI_NS_ERROR_IF_FOUND;
|
flags |= ACPI_NS_ERROR_IF_FOUND;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Cannot already exist\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
acpi_ut_get_type_name (object_type)));
|
"[%s] Cannot already exist\n",
|
||||||
}
|
acpi_ut_get_type_name(object_type)));
|
||||||
else {
|
} else {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"[%s] Both Find or Create allowed\n",
|
"[%s] Both Find or Create allowed\n",
|
||||||
acpi_ut_get_type_name (object_type)));
|
acpi_ut_get_type_name(object_type)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -289,22 +284,23 @@ acpi_ds_load1_begin_op (
|
|||||||
* involve arguments to the opcode must be created as we go back up the
|
* involve arguments to the opcode must be created as we go back up the
|
||||||
* parse tree later.
|
* parse tree later.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
|
status =
|
||||||
ACPI_IMODE_LOAD_PASS1, flags, walk_state, &(node));
|
acpi_ns_lookup(walk_state->scope_info, path, object_type,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_IMODE_LOAD_PASS1, flags, walk_state,
|
||||||
ACPI_REPORT_NSERROR (path, status);
|
&(node));
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_NSERROR(path, status);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Common exit */
|
/* Common exit */
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
/* Create a new op */
|
/* Create a new op */
|
||||||
|
|
||||||
op = acpi_ps_alloc_op (walk_state->opcode);
|
op = acpi_ps_alloc_op(walk_state->opcode);
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return (AE_NO_MEMORY);
|
return (AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
@@ -318,19 +314,18 @@ acpi_ds_load1_begin_op (
|
|||||||
op->named.path = (u8 *) path;
|
op->named.path = (u8 *) path;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put the Node in the "op" object that the parser uses, so we
|
* Put the Node in the "op" object that the parser uses, so we
|
||||||
* can get it again quickly when this scope is closed
|
* can get it again quickly when this scope is closed
|
||||||
*/
|
*/
|
||||||
op->common.node = node;
|
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;
|
*out_op = op;
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_load1_end_op
|
* FUNCTION: acpi_ds_load1_end_op
|
||||||
@@ -344,20 +339,17 @@ acpi_ds_load1_begin_op (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ds_load1_end_op(struct acpi_walk_state * walk_state)
|
||||||
acpi_ds_load1_end_op (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
acpi_object_type object_type;
|
acpi_object_type object_type;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ds_load1_end_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ds_load1_end_op");
|
||||||
|
|
||||||
op = walk_state->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 */
|
/* We are only interested in opcodes that have an associated name */
|
||||||
|
|
||||||
@@ -371,21 +363,20 @@ acpi_ds_load1_end_op (
|
|||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
if (walk_state->op_info->flags & AML_FIELD) {
|
if (walk_state->op_info->flags & AML_FIELD) {
|
||||||
if (walk_state->opcode == AML_FIELD_OP ||
|
if (walk_state->opcode == AML_FIELD_OP ||
|
||||||
walk_state->opcode == AML_BANK_FIELD_OP ||
|
walk_state->opcode == AML_BANK_FIELD_OP ||
|
||||||
walk_state->opcode == AML_INDEX_FIELD_OP) {
|
walk_state->opcode == AML_INDEX_FIELD_OP) {
|
||||||
status = acpi_ds_init_field_objects (op, walk_state);
|
status = acpi_ds_init_field_objects(op, walk_state);
|
||||||
}
|
}
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_REGION_OP) {
|
if (op->common.aml_opcode == AML_REGION_OP) {
|
||||||
status = acpi_ex_create_region (op->named.data, op->named.length,
|
status = acpi_ex_create_region(op->named.data, op->named.length,
|
||||||
(acpi_adr_space_type)
|
(acpi_adr_space_type)
|
||||||
((op->common.value.arg)->common.value.integer),
|
((op->common.value.arg)->common.
|
||||||
walk_state);
|
value.integer), walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -395,8 +386,11 @@ acpi_ds_load1_end_op (
|
|||||||
/* For Name opcode, get the object type from the argument */
|
/* For Name opcode, get the object type from the argument */
|
||||||
|
|
||||||
if (op->common.value.arg) {
|
if (op->common.value.arg) {
|
||||||
object_type = (acpi_ps_get_opcode_info (
|
object_type = (acpi_ps_get_opcode_info((op->common.
|
||||||
(op->common.value.arg)->common.aml_opcode))->object_type;
|
value.arg)->
|
||||||
|
common.
|
||||||
|
aml_opcode))->
|
||||||
|
object_type;
|
||||||
op->common.node->type = (u8) object_type;
|
op->common.node->type = (u8) object_type;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -410,23 +404,26 @@ acpi_ds_load1_end_op (
|
|||||||
* of invocations of the method (need to know the number of
|
* of invocations of the method (need to know the number of
|
||||||
* arguments.)
|
* arguments.)
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"LOADING-Method: State=%p Op=%p named_obj=%p\n",
|
"LOADING-Method: State=%p Op=%p named_obj=%p\n",
|
||||||
walk_state, op, op->named.node));
|
walk_state, op, op->named.node));
|
||||||
|
|
||||||
if (!acpi_ns_get_attached_object (op->named.node)) {
|
if (!acpi_ns_get_attached_object(op->named.node)) {
|
||||||
walk_state->operands[0] = (void *) op->named.node;
|
walk_state->operands[0] = (void *)op->named.node;
|
||||||
walk_state->num_operands = 1;
|
walk_state->num_operands = 1;
|
||||||
|
|
||||||
status = acpi_ds_create_operands (walk_state, op->common.value.arg);
|
status =
|
||||||
if (ACPI_SUCCESS (status)) {
|
acpi_ds_create_operands(walk_state,
|
||||||
status = acpi_ex_create_method (op->named.data,
|
op->common.value.arg);
|
||||||
op->named.length, walk_state);
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
status = acpi_ex_create_method(op->named.data,
|
||||||
|
op->named.length,
|
||||||
|
walk_state);
|
||||||
}
|
}
|
||||||
walk_state->operands[0] = NULL;
|
walk_state->operands[0] = NULL;
|
||||||
walk_state->num_operands = 0;
|
walk_state->num_operands = 0;
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,17 +431,17 @@ acpi_ds_load1_end_op (
|
|||||||
|
|
||||||
/* Pop the scope stack */
|
/* Pop the scope stack */
|
||||||
|
|
||||||
if (acpi_ns_opens_scope (object_type)) {
|
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,
|
||||||
acpi_ut_get_type_name (object_type), op));
|
"(%s): Popping scope for Op %p\n",
|
||||||
|
acpi_ut_get_type_name(object_type), op));
|
||||||
|
|
||||||
status = acpi_ds_scope_stack_pop (walk_state);
|
status = acpi_ds_scope_stack_pop(walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_load2_begin_op
|
* FUNCTION: acpi_ds_load2_begin_op
|
||||||
@@ -459,50 +456,50 @@ acpi_ds_load1_end_op (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_load2_begin_op (
|
acpi_ds_load2_begin_op(struct acpi_walk_state * walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object ** out_op)
|
||||||
union acpi_parse_object **out_op)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_object_type object_type;
|
acpi_object_type object_type;
|
||||||
char *buffer_ptr;
|
char *buffer_ptr;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_load2_begin_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_load2_begin_op");
|
||||||
|
|
||||||
op = walk_state->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 (op) {
|
||||||
if ((walk_state->control_state) &&
|
if ((walk_state->control_state) &&
|
||||||
(walk_state->control_state->common.state ==
|
(walk_state->control_state->common.state ==
|
||||||
ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
|
ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
|
||||||
/* We are executing a while loop outside of a method */
|
/* We are executing a while loop 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(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only care about Namespace opcodes here */
|
/* We only care about Namespace opcodes here */
|
||||||
|
|
||||||
if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
|
if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
|
||||||
(walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
|
(walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
|
||||||
(!(walk_state->op_info->flags & AML_NAMED))) {
|
(!(walk_state->op_info->flags & AML_NAMED))) {
|
||||||
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
|
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
|
||||||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
|
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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->flags));
|
walk_state->op_info->name,
|
||||||
|
walk_state->op_info->flags));
|
||||||
|
|
||||||
/* Executing a type1 or type2 opcode outside of a method */
|
/* Executing a type1 or type2 opcode outside of a method */
|
||||||
|
|
||||||
status = acpi_ds_exec_begin_op (walk_state, out_op);
|
status =
|
||||||
return_ACPI_STATUS (status);
|
acpi_ds_exec_begin_op(walk_state, out_op);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the name we are going to enter or lookup in the namespace */
|
/* Get the name we are going to enter or lookup in the namespace */
|
||||||
@@ -514,28 +511,27 @@ acpi_ds_load2_begin_op (
|
|||||||
if (!buffer_ptr) {
|
if (!buffer_ptr) {
|
||||||
/* No name, just exit */
|
/* No name, just exit */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Get name from the op */
|
/* Get name from the op */
|
||||||
|
|
||||||
buffer_ptr = (char *) &op->named.name;
|
buffer_ptr = (char *)&op->named.name;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Get the namestring from the raw AML */
|
/* 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 */
|
/* Map the opcode into an internal object type */
|
||||||
|
|
||||||
object_type = walk_state->op_info->object_type;
|
object_type = walk_state->op_info->object_type;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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) {
|
switch (walk_state->opcode) {
|
||||||
case AML_FIELD_OP:
|
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
|
* Don't enter the name into the namespace, but look it up
|
||||||
* for use later.
|
* for use later.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
|
status =
|
||||||
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
|
||||||
walk_state, &(node));
|
object_type, ACPI_IMODE_EXECUTE,
|
||||||
|
ACPI_NS_SEARCH_PARENT, walk_state, &(node));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_SCOPE_OP:
|
case AML_SCOPE_OP:
|
||||||
@@ -565,28 +562,28 @@ acpi_ds_load2_begin_op (
|
|||||||
* Don't enter the name into the namespace, but look it up
|
* Don't enter the name into the namespace, but look it up
|
||||||
* for use later.
|
* for use later.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
|
status =
|
||||||
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
|
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
|
||||||
walk_state, &(node));
|
object_type, ACPI_IMODE_EXECUTE,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_NS_SEARCH_PARENT, walk_state, &(node));
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
#ifdef ACPI_ASL_COMPILER
|
#ifdef ACPI_ASL_COMPILER
|
||||||
if (status == AE_NOT_FOUND) {
|
if (status == AE_NOT_FOUND) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_REPORT_NSERROR(buffer_ptr, status);
|
||||||
ACPI_REPORT_NSERROR (buffer_ptr, status);
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ACPI_REPORT_NSERROR (buffer_ptr, status);
|
ACPI_REPORT_NSERROR(buffer_ptr, status);
|
||||||
#endif
|
#endif
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* We must check to make sure that the target is
|
* We must check to make sure that the target is
|
||||||
* one of the opcodes that actually opens a scope
|
* one of the opcodes that actually opens a scope
|
||||||
*/
|
*/
|
||||||
switch (node->type) {
|
switch (node->type) {
|
||||||
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
|
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
|
||||||
case ACPI_TYPE_DEVICE:
|
case ACPI_TYPE_DEVICE:
|
||||||
case ACPI_TYPE_POWER:
|
case ACPI_TYPE_POWER:
|
||||||
case ACPI_TYPE_PROCESSOR:
|
case ACPI_TYPE_PROCESSOR:
|
||||||
@@ -607,9 +604,7 @@ acpi_ds_load2_begin_op (
|
|||||||
* Scope (DEB) { ... }
|
* Scope (DEB) { ... }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ACPI_REPORT_WARNING ((
|
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)));
|
||||||
"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;
|
node->type = ACPI_TYPE_ANY;
|
||||||
walk_state->scope_info->common.value = 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 */
|
/* All other types are an error */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Invalid type (%s) for target of Scope operator [%4.4s]\n", acpi_ut_get_type_name(node->type), buffer_ptr));
|
||||||
"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);
|
return (AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
@@ -636,14 +629,16 @@ acpi_ds_load2_begin_op (
|
|||||||
|
|
||||||
node = op->common.node;
|
node = op->common.node;
|
||||||
|
|
||||||
if (acpi_ns_opens_scope (object_type)) {
|
if (acpi_ns_opens_scope(object_type)) {
|
||||||
status = acpi_ds_scope_stack_push (node, object_type, walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ds_scope_stack_push(node, object_type,
|
||||||
return_ACPI_STATUS (status);
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -664,23 +659,24 @@ acpi_ds_load2_begin_op (
|
|||||||
|
|
||||||
/* Add new entry into namespace */
|
/* Add new entry into namespace */
|
||||||
|
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
|
status =
|
||||||
ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
|
acpi_ns_lookup(walk_state->scope_info, buffer_ptr,
|
||||||
walk_state, &(node));
|
object_type, ACPI_IMODE_LOAD_PASS2,
|
||||||
|
ACPI_NS_NO_UPSEARCH, walk_state, &(node));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_NSERROR (buffer_ptr, status);
|
ACPI_REPORT_NSERROR(buffer_ptr, status);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
/* Create a new op */
|
/* Create a new op */
|
||||||
|
|
||||||
op = acpi_ps_alloc_op (walk_state->opcode);
|
op = acpi_ps_alloc_op(walk_state->opcode);
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the new op */
|
/* Initialize the new op */
|
||||||
@@ -697,10 +693,9 @@ acpi_ds_load2_begin_op (
|
|||||||
*/
|
*/
|
||||||
op->common.node = node;
|
op->common.node = node;
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_load2_end_op
|
* FUNCTION: acpi_ds_load2_end_op
|
||||||
@@ -714,26 +709,23 @@ acpi_ds_load2_begin_op (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_load2_end_op (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_object_type object_type;
|
acpi_object_type object_type;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
struct acpi_namespace_node *new_node;
|
struct acpi_namespace_node *new_node;
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
u32 i;
|
u32 i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_load2_end_op");
|
||||||
ACPI_FUNCTION_TRACE ("ds_load2_end_op");
|
|
||||||
|
|
||||||
op = walk_state->op;
|
op = walk_state->op;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
|
||||||
walk_state->op_info->name, op, walk_state));
|
walk_state->op_info->name, op, walk_state));
|
||||||
|
|
||||||
/* Check if opcode had an associated namespace object */
|
/* Check if opcode had an associated namespace object */
|
||||||
|
|
||||||
@@ -742,23 +734,25 @@ acpi_ds_load2_end_op (
|
|||||||
/* No namespace object. Executable opcode? */
|
/* No namespace object. Executable opcode? */
|
||||||
|
|
||||||
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
|
if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
|
||||||
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
|
(walk_state->op_info->class == AML_CLASS_CONTROL)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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->flags));
|
walk_state->op_info->name,
|
||||||
|
walk_state->op_info->flags));
|
||||||
|
|
||||||
/* Executing a type1 or type2 opcode outside of a method */
|
/* Executing a type1 or type2 opcode outside of a method */
|
||||||
|
|
||||||
status = acpi_ds_exec_end_op (walk_state);
|
status = acpi_ds_exec_end_op(walk_state);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_SCOPE_OP) {
|
if (op->common.aml_opcode == AML_SCOPE_OP) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
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;
|
object_type = walk_state->op_info->object_type;
|
||||||
@@ -773,18 +767,19 @@ acpi_ds_load2_end_op (
|
|||||||
* Put the Node on the object stack (Contains the ACPI Name of
|
* Put the Node on the object stack (Contains the ACPI Name of
|
||||||
* this object)
|
* this object)
|
||||||
*/
|
*/
|
||||||
walk_state->operands[0] = (void *) node;
|
walk_state->operands[0] = (void *)node;
|
||||||
walk_state->num_operands = 1;
|
walk_state->num_operands = 1;
|
||||||
|
|
||||||
/* Pop the scope stack */
|
/* Pop the scope stack */
|
||||||
|
|
||||||
if (acpi_ns_opens_scope (object_type) &&
|
if (acpi_ns_opens_scope(object_type) &&
|
||||||
(op->common.aml_opcode != AML_INT_METHODCALL_OP)) {
|
(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,
|
||||||
acpi_ut_get_type_name (object_type), op));
|
"(%s) Popping scope for Op %p\n",
|
||||||
|
acpi_ut_get_type_name(object_type), op));
|
||||||
|
|
||||||
status = acpi_ds_scope_stack_pop (walk_state);
|
status = acpi_ds_scope_stack_pop(walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -817,9 +812,10 @@ acpi_ds_load2_end_op (
|
|||||||
* AML_THERMALZONE
|
* AML_THERMALZONE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"Create-Load [%s] State=%p Op=%p named_obj=%p\n",
|
"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 */
|
/* Decode the opcode */
|
||||||
|
|
||||||
@@ -834,27 +830,32 @@ acpi_ds_load2_end_op (
|
|||||||
* Create the field object, but the field buffer and index must
|
* Create the field object, but the field buffer and index must
|
||||||
* be evaluated later during the execution phase
|
* be evaluated later during the execution phase
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_create_buffer_field (op, walk_state);
|
status = acpi_ds_create_buffer_field(op, walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_TYPE_NAMED_FIELD:
|
||||||
case AML_TYPE_NAMED_FIELD:
|
|
||||||
|
|
||||||
switch (op->common.aml_opcode) {
|
switch (op->common.aml_opcode) {
|
||||||
case AML_INDEX_FIELD_OP:
|
case AML_INDEX_FIELD_OP:
|
||||||
|
|
||||||
status = acpi_ds_create_index_field (op, (acpi_handle) arg->common.node,
|
status =
|
||||||
walk_state);
|
acpi_ds_create_index_field(op,
|
||||||
|
(acpi_handle) arg->
|
||||||
|
common.node, walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_BANK_FIELD_OP:
|
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;
|
break;
|
||||||
|
|
||||||
case AML_FIELD_OP:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -863,43 +864,42 @@ acpi_ds_load2_end_op (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_TYPE_NAMED_SIMPLE:
|
||||||
|
|
||||||
case AML_TYPE_NAMED_SIMPLE:
|
status = acpi_ds_create_operands(walk_state, arg);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
status = acpi_ds_create_operands (walk_state, arg);
|
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (op->common.aml_opcode) {
|
switch (op->common.aml_opcode) {
|
||||||
case AML_PROCESSOR_OP:
|
case AML_PROCESSOR_OP:
|
||||||
|
|
||||||
status = acpi_ex_create_processor (walk_state);
|
status = acpi_ex_create_processor(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_POWER_RES_OP:
|
case AML_POWER_RES_OP:
|
||||||
|
|
||||||
status = acpi_ex_create_power_resource (walk_state);
|
status = acpi_ex_create_power_resource(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_MUTEX_OP:
|
case AML_MUTEX_OP:
|
||||||
|
|
||||||
status = acpi_ex_create_mutex (walk_state);
|
status = acpi_ex_create_mutex(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_EVENT_OP:
|
case AML_EVENT_OP:
|
||||||
|
|
||||||
status = acpi_ex_create_event (walk_state);
|
status = acpi_ex_create_event(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_DATA_REGION_OP:
|
case AML_DATA_REGION_OP:
|
||||||
|
|
||||||
status = acpi_ex_create_table_region (walk_state);
|
status = acpi_ex_create_table_region(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_ALIAS_OP:
|
case AML_ALIAS_OP:
|
||||||
|
|
||||||
status = acpi_ex_create_alias (walk_state);
|
status = acpi_ex_create_alias(walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -912,12 +912,12 @@ acpi_ds_load2_end_op (
|
|||||||
/* Delete operands */
|
/* Delete operands */
|
||||||
|
|
||||||
for (i = 1; i < walk_state->num_operands; i++) {
|
for (i = 1; i < walk_state->num_operands; i++) {
|
||||||
acpi_ut_remove_reference (walk_state->operands[i]);
|
acpi_ut_remove_reference(walk_state->operands[i]);
|
||||||
walk_state->operands[i] = NULL;
|
walk_state->operands[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||||
|
|
||||||
case AML_TYPE_NAMED_COMPLEX:
|
case AML_TYPE_NAMED_COMPLEX:
|
||||||
|
|
||||||
@@ -933,9 +933,10 @@ acpi_ds_load2_end_op (
|
|||||||
* If we have a valid region, initialize it
|
* If we have a valid region, initialize it
|
||||||
* Namespace is NOT locked at this point.
|
* Namespace is NOT locked at this point.
|
||||||
*/
|
*/
|
||||||
status = acpi_ev_initialize_region (acpi_ns_get_attached_object (node),
|
status =
|
||||||
FALSE);
|
acpi_ev_initialize_region
|
||||||
if (ACPI_FAILURE (status)) {
|
(acpi_ns_get_attached_object(node), FALSE);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
/*
|
/*
|
||||||
* If AE_NOT_EXIST is returned, it is not fatal
|
* If AE_NOT_EXIST is returned, it is not fatal
|
||||||
* because many regions get created before a handler
|
* because many regions get created before a handler
|
||||||
@@ -947,13 +948,11 @@ acpi_ds_load2_end_op (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_NAME_OP:
|
case AML_NAME_OP:
|
||||||
|
|
||||||
status = acpi_ds_create_node (walk_state, node, op);
|
status = acpi_ds_create_node(walk_state, node, op);
|
||||||
break;
|
break;
|
||||||
#endif /* ACPI_NO_METHOD_EXECUTION */
|
#endif /* ACPI_NO_METHOD_EXECUTION */
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* All NAMED_COMPLEX opcodes must be handled above */
|
/* All NAMED_COMPLEX opcodes must be handled above */
|
||||||
@@ -962,27 +961,28 @@ acpi_ds_load2_end_op (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_CLASS_INTERNAL:
|
case AML_CLASS_INTERNAL:
|
||||||
|
|
||||||
/* case AML_INT_NAMEPATH_OP: */
|
/* case AML_INT_NAMEPATH_OP: */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_CLASS_METHOD_CALL:
|
case AML_CLASS_METHOD_CALL:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
|
"RESOLVING-method_call: State=%p Op=%p named_obj=%p\n",
|
||||||
walk_state, op, node));
|
walk_state, op, node));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lookup the method name and save the Node
|
* Lookup the method name and save the Node
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (walk_state->scope_info, arg->common.value.string,
|
status =
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
|
acpi_ns_lookup(walk_state->scope_info,
|
||||||
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
|
arg->common.value.string, ACPI_TYPE_ANY,
|
||||||
walk_state, &(new_node));
|
ACPI_IMODE_LOAD_PASS2,
|
||||||
if (ACPI_SUCCESS (status)) {
|
ACPI_NS_SEARCH_PARENT |
|
||||||
|
ACPI_NS_DONT_OPEN_SCOPE, walk_state,
|
||||||
|
&(new_node));
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that what we found is indeed a method
|
* Make sure that what we found is indeed a method
|
||||||
@@ -998,24 +998,20 @@ acpi_ds_load2_end_op (
|
|||||||
* parser uses, so we can get it again at the end of this scope
|
* parser uses, so we can get it again at the end of this scope
|
||||||
*/
|
*/
|
||||||
op->common.node = new_node;
|
op->common.node = new_node;
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_REPORT_NSERROR(arg->common.value.string, status);
|
||||||
ACPI_REPORT_NSERROR (arg->common.value.string, status);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
/* Remove the Node pushed at the very beginning */
|
/* Remove the Node pushed at the very beginning */
|
||||||
|
|
||||||
walk_state->operands[0] = NULL;
|
walk_state->operands[0] = NULL;
|
||||||
walk_state->num_operands = 0;
|
walk_state->num_operands = 0;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_DISPATCHER
|
#define _COMPONENT ACPI_DISPATCHER
|
||||||
ACPI_MODULE_NAME ("dswscope")
|
ACPI_MODULE_NAME("dswscope")
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
@@ -62,15 +59,11 @@
|
|||||||
* root scope object (which remains at the stack top.)
|
* 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;
|
union acpi_generic_state *scope_info;
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ds_scope_stack_clear");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ds_scope_stack_clear");
|
||||||
|
|
||||||
while (walk_state->scope_info) {
|
while (walk_state->scope_info) {
|
||||||
/* Pop a scope off the stack */
|
/* Pop a scope off the stack */
|
||||||
@@ -78,14 +71,14 @@ acpi_ds_scope_stack_clear (
|
|||||||
scope_info = walk_state->scope_info;
|
scope_info = walk_state->scope_info;
|
||||||
walk_state->scope_info = scope_info->scope.next;
|
walk_state->scope_info = scope_info->scope.next;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Popped object type (%s)\n",
|
"Popped object type (%s)\n",
|
||||||
acpi_ut_get_type_name (scope_info->common.value)));
|
acpi_ut_get_type_name(scope_info->common.
|
||||||
acpi_ut_delete_generic_state (scope_info);
|
value)));
|
||||||
|
acpi_ut_delete_generic_state(scope_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_scope_stack_push
|
* FUNCTION: acpi_ds_scope_stack_push
|
||||||
@@ -102,74 +95,70 @@ acpi_ds_scope_stack_clear (
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ds_scope_stack_push (
|
acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_type type,
|
||||||
acpi_object_type type,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *scope_info;
|
union acpi_generic_state *scope_info;
|
||||||
union acpi_generic_state *old_scope_info;
|
union acpi_generic_state *old_scope_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_scope_stack_push");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_scope_stack_push");
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
/* Invalid scope */
|
/* Invalid scope */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("ds_scope_stack_push: null scope passed\n"));
|
ACPI_REPORT_ERROR(("ds_scope_stack_push: null scope passed\n"));
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure object type is valid */
|
/* Make sure object type is valid */
|
||||||
|
|
||||||
if (!acpi_ut_valid_object_type (type)) {
|
if (!acpi_ut_valid_object_type(type)) {
|
||||||
ACPI_REPORT_WARNING ((
|
ACPI_REPORT_WARNING(("ds_scope_stack_push: Invalid object type: 0x%X\n", type));
|
||||||
"ds_scope_stack_push: Invalid object type: 0x%X\n", type));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a new scope object */
|
/* Allocate a new scope object */
|
||||||
|
|
||||||
scope_info = acpi_ut_create_generic_state ();
|
scope_info = acpi_ut_create_generic_state();
|
||||||
if (!scope_info) {
|
if (!scope_info) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init new scope object */
|
/* Init new scope object */
|
||||||
|
|
||||||
scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
|
scope_info->common.data_type = ACPI_DESC_TYPE_STATE_WSCOPE;
|
||||||
scope_info->scope.node = node;
|
scope_info->scope.node = node;
|
||||||
scope_info->common.value = (u16) type;
|
scope_info->common.value = (u16) type;
|
||||||
|
|
||||||
walk_state->scope_depth++;
|
walk_state->scope_depth++;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
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;
|
old_scope_info = walk_state->scope_info;
|
||||||
if (old_scope_info) {
|
if (old_scope_info) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
|
||||||
"[%4.4s] (%s)",
|
"[%4.4s] (%s)",
|
||||||
acpi_ut_get_node_name (old_scope_info->scope.node),
|
acpi_ut_get_node_name(old_scope_info->
|
||||||
acpi_ut_get_type_name (old_scope_info->common.value)));
|
scope.node),
|
||||||
}
|
acpi_ut_get_type_name(old_scope_info->
|
||||||
else {
|
common.value)));
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
} else {
|
||||||
"[\\___] (%s)", "ROOT"));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (%s)", "ROOT"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
|
||||||
", New scope -> [%4.4s] (%s)\n",
|
", New scope -> [%4.4s] (%s)\n",
|
||||||
acpi_ut_get_node_name (scope_info->scope.node),
|
acpi_ut_get_node_name(scope_info->scope.node),
|
||||||
acpi_ut_get_type_name (scope_info->common.value)));
|
acpi_ut_get_type_name(scope_info->common.value)));
|
||||||
|
|
||||||
/* Push new scope object onto stack */
|
/* Push new scope object onto stack */
|
||||||
|
|
||||||
acpi_ut_push_generic_state (&walk_state->scope_info, scope_info);
|
acpi_ut_push_generic_state(&walk_state->scope_info, scope_info);
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ds_scope_stack_pop
|
* FUNCTION: acpi_ds_scope_stack_pop
|
||||||
@@ -182,47 +171,41 @@ acpi_ds_scope_stack_push (
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state)
|
||||||
acpi_ds_scope_stack_pop (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *scope_info;
|
union acpi_generic_state *scope_info;
|
||||||
union acpi_generic_state *new_scope_info;
|
union acpi_generic_state *new_scope_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ds_scope_stack_pop");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ds_scope_stack_pop");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pop scope info object off the stack.
|
* Pop scope info object off the stack.
|
||||||
*/
|
*/
|
||||||
scope_info = acpi_ut_pop_generic_state (&walk_state->scope_info);
|
scope_info = acpi_ut_pop_generic_state(&walk_state->scope_info);
|
||||||
if (!scope_info) {
|
if (!scope_info) {
|
||||||
return_ACPI_STATUS (AE_STACK_UNDERFLOW);
|
return_ACPI_STATUS(AE_STACK_UNDERFLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
walk_state->scope_depth--;
|
walk_state->scope_depth--;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
|
"[%.2d] Popped scope [%4.4s] (%s), New scope -> ",
|
||||||
(u32) walk_state->scope_depth,
|
(u32) walk_state->scope_depth,
|
||||||
acpi_ut_get_node_name (scope_info->scope.node),
|
acpi_ut_get_node_name(scope_info->scope.node),
|
||||||
acpi_ut_get_type_name (scope_info->common.value)));
|
acpi_ut_get_type_name(scope_info->common.value)));
|
||||||
|
|
||||||
new_scope_info = walk_state->scope_info;
|
new_scope_info = walk_state->scope_info;
|
||||||
if (new_scope_info) {
|
if (new_scope_info) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC,
|
||||||
"[%4.4s] (%s)\n",
|
"[%4.4s] (%s)\n",
|
||||||
acpi_ut_get_node_name (new_scope_info->scope.node),
|
acpi_ut_get_node_name(new_scope_info->
|
||||||
acpi_ut_get_type_name (new_scope_info->common.value)));
|
scope.node),
|
||||||
}
|
acpi_ut_get_type_name(new_scope_info->
|
||||||
else {
|
common.value)));
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC,
|
} else {
|
||||||
"[\\___] (ROOT)\n"));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "[\\___] (ROOT)\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ut_delete_generic_state (scope_info);
|
acpi_ut_delete_generic_state(scope_info);
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -13,16 +13,15 @@
|
|||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||||
ACPI_MODULE_NAME ("event")
|
ACPI_MODULE_NAME("event")
|
||||||
|
|
||||||
/* Global vars for handling event proc entry */
|
/* Global vars for handling event proc entry */
|
||||||
static DEFINE_SPINLOCK(acpi_system_event_lock);
|
static DEFINE_SPINLOCK(acpi_system_event_lock);
|
||||||
int event_is_open = 0;
|
int event_is_open = 0;
|
||||||
extern struct list_head acpi_bus_event_list;
|
extern struct list_head acpi_bus_event_list;
|
||||||
extern wait_queue_head_t acpi_bus_event_queue;
|
extern wait_queue_head_t acpi_bus_event_queue;
|
||||||
|
|
||||||
static int
|
static int acpi_system_open_event(struct inode *inode, struct file *file)
|
||||||
acpi_system_open_event(struct inode *inode, struct file *file)
|
|
||||||
{
|
{
|
||||||
spin_lock_irq(&acpi_system_event_lock);
|
spin_lock_irq(&acpi_system_event_lock);
|
||||||
|
|
||||||
@@ -34,20 +33,20 @@ acpi_system_open_event(struct inode *inode, struct file *file)
|
|||||||
spin_unlock_irq(&acpi_system_event_lock);
|
spin_unlock_irq(&acpi_system_event_lock);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_busy:
|
out_busy:
|
||||||
spin_unlock_irq(&acpi_system_event_lock);
|
spin_unlock_irq(&acpi_system_event_lock);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
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;
|
int result = 0;
|
||||||
struct acpi_bus_event event;
|
struct acpi_bus_event event;
|
||||||
static char str[ACPI_MAX_STRING];
|
static char str[ACPI_MAX_STRING];
|
||||||
static int chars_remaining = 0;
|
static int chars_remaining = 0;
|
||||||
static char *ptr;
|
static char *ptr;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_system_read_event");
|
ACPI_FUNCTION_TRACE("acpi_system_read_event");
|
||||||
|
|
||||||
@@ -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",
|
chars_remaining = sprintf(str, "%s %s %08x %08x\n",
|
||||||
event.device_class?event.device_class:"<unknown>",
|
event.device_class ? event.
|
||||||
event.bus_id?event.bus_id:"<unknown>",
|
device_class : "<unknown>",
|
||||||
event.type, event.data);
|
event.bus_id ? event.
|
||||||
|
bus_id : "<unknown>", event.type,
|
||||||
|
event.data);
|
||||||
ptr = str;
|
ptr = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,17 +85,15 @@ acpi_system_read_event(struct file *file, char __user *buffer, size_t count, lof
|
|||||||
return_VALUE(count);
|
return_VALUE(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int acpi_system_close_event(struct inode *inode, struct file *file)
|
||||||
acpi_system_close_event(struct inode *inode, struct file *file)
|
|
||||||
{
|
{
|
||||||
spin_lock_irq (&acpi_system_event_lock);
|
spin_lock_irq(&acpi_system_event_lock);
|
||||||
event_is_open = 0;
|
event_is_open = 0;
|
||||||
spin_unlock_irq (&acpi_system_event_lock);
|
spin_unlock_irq(&acpi_system_event_lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int acpi_system_poll_event(struct file *file, poll_table * wait)
|
||||||
acpi_system_poll_event(struct file *file, poll_table *wait)
|
|
||||||
{
|
{
|
||||||
poll_wait(file, &acpi_bus_event_queue, wait);
|
poll_wait(file, &acpi_bus_event_queue, wait);
|
||||||
if (!list_empty(&acpi_bus_event_list))
|
if (!list_empty(&acpi_bus_event_list))
|
||||||
@@ -103,15 +102,15 @@ acpi_system_poll_event(struct file *file, poll_table *wait)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations acpi_system_event_ops = {
|
static struct file_operations acpi_system_event_ops = {
|
||||||
.open = acpi_system_open_event,
|
.open = acpi_system_open_event,
|
||||||
.read = acpi_system_read_event,
|
.read = acpi_system_read_event,
|
||||||
.release = acpi_system_close_event,
|
.release = acpi_system_close_event,
|
||||||
.poll = acpi_system_poll_event,
|
.poll = acpi_system_poll_event,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init acpi_event_init(void)
|
static int __init acpi_event_init(void)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry;
|
struct proc_dir_entry *entry;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_event_init");
|
ACPI_FUNCTION_TRACE("acpi_event_init");
|
||||||
@@ -125,7 +124,8 @@ static int __init acpi_event_init(void)
|
|||||||
entry->proc_fops = &acpi_system_event_ops;
|
entry->proc_fops = &acpi_system_event_ops;
|
||||||
else {
|
else {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
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;
|
error = -EFAULT;
|
||||||
}
|
}
|
||||||
return_VALUE(error);
|
return_VALUE(error);
|
||||||
|
|||||||
@@ -45,18 +45,12 @@
|
|||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evevent")
|
ACPI_MODULE_NAME("evevent")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
static acpi_status acpi_ev_fixed_event_initialize(void);
|
||||||
|
|
||||||
static acpi_status
|
static u32 acpi_ev_fixed_event_dispatch(u32 event);
|
||||||
acpi_ev_fixed_event_initialize (
|
|
||||||
void);
|
|
||||||
|
|
||||||
static u32
|
|
||||||
acpi_ev_fixed_event_dispatch (
|
|
||||||
u32 event);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -70,21 +64,17 @@ acpi_ev_fixed_event_dispatch (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_initialize_events(void)
|
||||||
acpi_ev_initialize_events (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_initialize_events");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_initialize_events");
|
||||||
|
|
||||||
/* Make sure we have ACPI tables */
|
/* Make sure we have ACPI tables */
|
||||||
|
|
||||||
if (!acpi_gbl_DSDT) {
|
if (!acpi_gbl_DSDT) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "No ACPI tables present!\n"));
|
||||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -92,26 +82,22 @@ acpi_ev_initialize_events (
|
|||||||
* enabling SCIs to prevent interrupts from occurring before the handlers are
|
* enabling SCIs to prevent interrupts from occurring before the handlers are
|
||||||
* installed.
|
* installed.
|
||||||
*/
|
*/
|
||||||
status = acpi_ev_fixed_event_initialize ();
|
status = acpi_ev_fixed_event_initialize();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Unable to initialize fixed events, %s\n",
|
||||||
"Unable to initialize fixed events, %s\n",
|
acpi_format_exception(status)));
|
||||||
acpi_format_exception (status)));
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ev_gpe_initialize ();
|
status = acpi_ev_gpe_initialize();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Unable to initialize general purpose events, %s\n", acpi_format_exception(status)));
|
||||||
"Unable to initialize general purpose events, %s\n",
|
return_ACPI_STATUS(status);
|
||||||
acpi_format_exception (status)));
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_install_xrupt_handlers
|
* FUNCTION: acpi_ev_install_xrupt_handlers
|
||||||
@@ -124,41 +110,32 @@ acpi_ev_initialize_events (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_install_xrupt_handlers(void)
|
||||||
acpi_ev_install_xrupt_handlers (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_install_xrupt_handlers");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_install_xrupt_handlers");
|
||||||
|
|
||||||
/* Install the SCI handler */
|
/* Install the SCI handler */
|
||||||
|
|
||||||
status = acpi_ev_install_sci_handler ();
|
status = acpi_ev_install_sci_handler();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Unable to install System Control Interrupt Handler, %s\n", acpi_format_exception(status)));
|
||||||
"Unable to install System Control Interrupt Handler, %s\n",
|
return_ACPI_STATUS(status);
|
||||||
acpi_format_exception (status)));
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install the handler for the Global Lock */
|
/* Install the handler for the Global Lock */
|
||||||
|
|
||||||
status = acpi_ev_init_global_lock_handler ();
|
status = acpi_ev_init_global_lock_handler();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Unable to initialize Global Lock handler, %s\n", acpi_format_exception(status)));
|
||||||
"Unable to initialize Global Lock handler, %s\n",
|
return_ACPI_STATUS(status);
|
||||||
acpi_format_exception (status)));
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_gbl_events_initialized = TRUE;
|
acpi_gbl_events_initialized = TRUE;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_fixed_event_initialize
|
* FUNCTION: acpi_ev_fixed_event_initialize
|
||||||
@@ -171,13 +148,10 @@ acpi_ev_install_xrupt_handlers (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ev_fixed_event_initialize(void)
|
||||||
acpi_ev_fixed_event_initialize (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the structure that keeps track of fixed event handlers
|
* Initialize the structure that keeps track of fixed event handlers
|
||||||
@@ -190,10 +164,11 @@ acpi_ev_fixed_event_initialize (
|
|||||||
/* Enable the fixed event */
|
/* Enable the fixed event */
|
||||||
|
|
||||||
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
|
if (acpi_gbl_fixed_event_info[i].enable_register_id != 0xFF) {
|
||||||
status = acpi_set_register (
|
status =
|
||||||
acpi_gbl_fixed_event_info[i].enable_register_id,
|
acpi_set_register(acpi_gbl_fixed_event_info[i].
|
||||||
0, ACPI_MTX_LOCK);
|
enable_register_id, 0,
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_MTX_LOCK);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,7 +177,6 @@ acpi_ev_fixed_event_initialize (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_fixed_event_detect
|
* FUNCTION: acpi_ev_fixed_event_detect
|
||||||
@@ -215,31 +189,27 @@ acpi_ev_fixed_event_initialize (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32 acpi_ev_fixed_event_detect(void)
|
||||||
acpi_ev_fixed_event_detect (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
||||||
u32 fixed_status;
|
u32 fixed_status;
|
||||||
u32 fixed_enable;
|
u32 fixed_enable;
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ev_fixed_event_detect");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ev_fixed_event_detect");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the fixed feature status and enable registers, as all the cases
|
* Read the fixed feature status and enable registers, as all the cases
|
||||||
* depend on their values. Ignore errors here.
|
* depend on their values. Ignore errors here.
|
||||||
*/
|
*/
|
||||||
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
|
(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
&fixed_status);
|
ACPI_REGISTER_PM1_STATUS, &fixed_status);
|
||||||
(void) acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
|
(void)acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
&fixed_enable);
|
ACPI_REGISTER_PM1_ENABLE, &fixed_enable);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
|
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
||||||
"Fixed Event Block: Enable %08X Status %08X\n",
|
"Fixed Event Block: Enable %08X Status %08X\n",
|
||||||
fixed_enable, fixed_status));
|
fixed_enable, fixed_status));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for all possible Fixed Events and dispatch those that are active
|
* Check for all possible Fixed Events and dispatch those that are active
|
||||||
@@ -247,18 +217,19 @@ acpi_ev_fixed_event_detect (
|
|||||||
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
|
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
|
||||||
/* Both the status and enable bits must be on for this event */
|
/* Both the status and enable bits must be on for this event */
|
||||||
|
|
||||||
if ((fixed_status & acpi_gbl_fixed_event_info[i].status_bit_mask) &&
|
if ((fixed_status & acpi_gbl_fixed_event_info[i].
|
||||||
(fixed_enable & acpi_gbl_fixed_event_info[i].enable_bit_mask)) {
|
status_bit_mask)
|
||||||
|
&& (fixed_enable & acpi_gbl_fixed_event_info[i].
|
||||||
|
enable_bit_mask)) {
|
||||||
/* Found an active (signalled) event */
|
/* Found an active (signalled) event */
|
||||||
|
|
||||||
int_status |= acpi_ev_fixed_event_dispatch ((u32) i);
|
int_status |= acpi_ev_fixed_event_dispatch((u32) i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int_status);
|
return (int_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_fixed_event_dispatch
|
* FUNCTION: acpi_ev_fixed_event_dispatch
|
||||||
@@ -272,39 +243,32 @@ acpi_ev_fixed_event_detect (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32 acpi_ev_fixed_event_dispatch(u32 event)
|
||||||
acpi_ev_fixed_event_dispatch (
|
|
||||||
u32 event)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
|
||||||
/* Clear the status bit */
|
/* Clear the status bit */
|
||||||
|
|
||||||
(void) acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
|
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||||
1, ACPI_MTX_DO_NOT_LOCK);
|
status_register_id, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we've got a handler. If not, report an error.
|
* Make sure we've got a handler. If not, report an error.
|
||||||
* The event is disabled to prevent further interrupts.
|
* The event is disabled to prevent further interrupts.
|
||||||
*/
|
*/
|
||||||
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
|
if (NULL == acpi_gbl_fixed_event_handlers[event].handler) {
|
||||||
(void) acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
(void)acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||||
0, ACPI_MTX_DO_NOT_LOCK);
|
enable_register_id, 0,
|
||||||
|
ACPI_MTX_DO_NOT_LOCK);
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (
|
ACPI_REPORT_ERROR(("No installed handler for fixed event [%08X]\n", event));
|
||||||
("No installed handler for fixed event [%08X]\n",
|
|
||||||
event));
|
|
||||||
|
|
||||||
return (ACPI_INTERRUPT_NOT_HANDLED);
|
return (ACPI_INTERRUPT_NOT_HANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Invoke the Fixed Event handler */
|
/* Invoke the Fixed Event handler */
|
||||||
|
|
||||||
return ((acpi_gbl_fixed_event_handlers[event].handler)(
|
return ((acpi_gbl_fixed_event_handlers[event].
|
||||||
acpi_gbl_fixed_event_handlers[event].context));
|
handler) (acpi_gbl_fixed_event_handlers[event].context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,14 +46,10 @@
|
|||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evgpe")
|
ACPI_MODULE_NAME("evgpe")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* 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,15 +65,11 @@ acpi_ev_asynch_execute_gpe_method (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_set_gpe_type (
|
acpi_ev_set_gpe_type(struct acpi_gpe_event_info *gpe_event_info, u8 type)
|
||||||
struct acpi_gpe_event_info *gpe_event_info,
|
|
||||||
u8 type)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_set_gpe_type");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_set_gpe_type");
|
||||||
|
|
||||||
/* Validate type and update register enable masks */
|
/* Validate type and update register enable masks */
|
||||||
|
|
||||||
@@ -88,21 +80,20 @@ acpi_ev_set_gpe_type (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable the GPE if currently enabled */
|
/* Disable the GPE if currently enabled */
|
||||||
|
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
|
|
||||||
/* Type was validated above */
|
/* Type was validated above */
|
||||||
|
|
||||||
gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
|
gpe_event_info->flags &= ~ACPI_GPE_TYPE_MASK; /* Clear type bits */
|
||||||
gpe_event_info->flags |= type; /* Insert type */
|
gpe_event_info->flags |= type; /* Insert type */
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_update_gpe_enable_masks
|
* FUNCTION: acpi_ev_update_gpe_enable_masks
|
||||||
@@ -118,57 +109,55 @@ acpi_ev_set_gpe_type (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_update_gpe_enable_masks (
|
acpi_ev_update_gpe_enable_masks(struct acpi_gpe_event_info *gpe_event_info,
|
||||||
struct acpi_gpe_event_info *gpe_event_info,
|
u8 type)
|
||||||
u8 type)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_register_info *gpe_register_info;
|
struct acpi_gpe_register_info *gpe_register_info;
|
||||||
u8 register_bit;
|
u8 register_bit;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_update_gpe_enable_masks");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_update_gpe_enable_masks");
|
||||||
|
|
||||||
gpe_register_info = gpe_event_info->register_info;
|
gpe_register_info = gpe_event_info->register_info;
|
||||||
if (!gpe_register_info) {
|
if (!gpe_register_info) {
|
||||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
register_bit = gpe_event_info->register_bit;
|
register_bit = gpe_event_info->register_bit;
|
||||||
|
|
||||||
/* 1) Disable case. Simply clear all enable bits */
|
/* 1) Disable case. Simply clear all enable bits */
|
||||||
|
|
||||||
if (type == ACPI_GPE_DISABLE) {
|
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,
|
||||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
|
register_bit);
|
||||||
return_ACPI_STATUS (AE_OK);
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2) Enable case. Set/Clear the appropriate enable bits */
|
/* 2) Enable case. Set/Clear the appropriate enable bits */
|
||||||
|
|
||||||
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
||||||
case ACPI_GPE_TYPE_WAKE:
|
case ACPI_GPE_TYPE_WAKE:
|
||||||
ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit);
|
ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
|
||||||
ACPI_CLEAR_BIT (gpe_register_info->enable_for_run, register_bit);
|
ACPI_CLEAR_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_GPE_TYPE_RUNTIME:
|
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,
|
||||||
ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit);
|
register_bit);
|
||||||
|
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||||
ACPI_SET_BIT (gpe_register_info->enable_for_wake, register_bit);
|
ACPI_SET_BIT(gpe_register_info->enable_for_wake, register_bit);
|
||||||
ACPI_SET_BIT (gpe_register_info->enable_for_run, register_bit);
|
ACPI_SET_BIT(gpe_register_info->enable_for_run, register_bit);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_enable_gpe
|
* FUNCTION: acpi_ev_enable_gpe
|
||||||
@@ -184,21 +173,19 @@ acpi_ev_update_gpe_enable_masks (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_enable_gpe (
|
acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info,
|
||||||
struct acpi_gpe_event_info *gpe_event_info,
|
u8 write_to_hardware)
|
||||||
u8 write_to_hardware)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_enable_gpe");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_enable_gpe");
|
||||||
|
|
||||||
/* Make sure HW enable masks are updated */
|
/* Make sure HW enable masks are updated */
|
||||||
|
|
||||||
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_ENABLE);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_ENABLE);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark wake-enabled or HW enable, or both */
|
/* Mark wake-enabled or HW enable, or both */
|
||||||
@@ -206,41 +193,40 @@ acpi_ev_enable_gpe (
|
|||||||
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
||||||
case ACPI_GPE_TYPE_WAKE:
|
case ACPI_GPE_TYPE_WAKE:
|
||||||
|
|
||||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||||
|
|
||||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||||
|
|
||||||
/*lint -fallthrough */
|
/*lint -fallthrough */
|
||||||
|
|
||||||
case ACPI_GPE_TYPE_RUNTIME:
|
case ACPI_GPE_TYPE_RUNTIME:
|
||||||
|
|
||||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
ACPI_SET_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
||||||
|
|
||||||
if (write_to_hardware) {
|
if (write_to_hardware) {
|
||||||
/* Clear the GPE (of stale events), then enable it */
|
/* Clear the GPE (of stale events), then enable it */
|
||||||
|
|
||||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable the requested runtime GPE */
|
/* Enable the requested runtime GPE */
|
||||||
|
|
||||||
status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
|
status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_disable_gpe
|
* FUNCTION: acpi_ev_disable_gpe
|
||||||
@@ -253,36 +239,33 @@ acpi_ev_enable_gpe (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
acpi_ev_disable_gpe (
|
|
||||||
struct acpi_gpe_event_info *gpe_event_info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_disable_gpe");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_disable_gpe");
|
||||||
|
|
||||||
if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
|
if (!(gpe_event_info->flags & ACPI_GPE_ENABLE_MASK)) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure HW enable masks are updated */
|
/* Make sure HW enable masks are updated */
|
||||||
|
|
||||||
status = acpi_ev_update_gpe_enable_masks (gpe_event_info, ACPI_GPE_DISABLE);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ev_update_gpe_enable_masks(gpe_event_info, ACPI_GPE_DISABLE);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark wake-disabled or HW disable, or both */
|
/* Mark wake-disabled or HW disable, or both */
|
||||||
|
|
||||||
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
switch (gpe_event_info->flags & ACPI_GPE_TYPE_MASK) {
|
||||||
case ACPI_GPE_TYPE_WAKE:
|
case ACPI_GPE_TYPE_WAKE:
|
||||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_GPE_TYPE_WAKE_RUN:
|
case ACPI_GPE_TYPE_WAKE_RUN:
|
||||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_WAKE_ENABLED);
|
||||||
|
|
||||||
/*lint -fallthrough */
|
/*lint -fallthrough */
|
||||||
|
|
||||||
@@ -290,18 +273,17 @@ acpi_ev_disable_gpe (
|
|||||||
|
|
||||||
/* Disable the requested runtime GPE */
|
/* Disable the requested runtime GPE */
|
||||||
|
|
||||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
ACPI_CLEAR_BIT(gpe_event_info->flags, ACPI_GPE_RUN_ENABLED);
|
||||||
status = acpi_hw_write_gpe_enable_reg (gpe_event_info);
|
status = acpi_hw_write_gpe_enable_reg(gpe_event_info);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_get_gpe_event_info
|
* FUNCTION: acpi_ev_get_gpe_event_info
|
||||||
@@ -319,18 +301,14 @@ acpi_ev_disable_gpe (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
struct acpi_gpe_event_info *
|
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
||||||
acpi_ev_get_gpe_event_info (
|
u32 gpe_number)
|
||||||
acpi_handle gpe_device,
|
|
||||||
u32 gpe_number)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_gpe_block_info *gpe_block;
|
struct acpi_gpe_block_info *gpe_block;
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* A NULL gpe_block means use the FADT-defined GPE block(s) */
|
/* A NULL gpe_block means use the FADT-defined GPE block(s) */
|
||||||
|
|
||||||
@@ -340,11 +318,14 @@ acpi_ev_get_gpe_event_info (
|
|||||||
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
|
for (i = 0; i < ACPI_MAX_GPE_BLOCKS; i++) {
|
||||||
gpe_block = acpi_gbl_gpe_fadt_blocks[i];
|
gpe_block = acpi_gbl_gpe_fadt_blocks[i];
|
||||||
if (gpe_block) {
|
if (gpe_block) {
|
||||||
if ((gpe_number >= gpe_block->block_base_number) &&
|
if ((gpe_number >= gpe_block->block_base_number)
|
||||||
(gpe_number < gpe_block->block_base_number +
|
&& (gpe_number <
|
||||||
(gpe_block->register_count * 8))) {
|
gpe_block->block_base_number +
|
||||||
return (&gpe_block->event_info[gpe_number -
|
(gpe_block->register_count * 8))) {
|
||||||
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 */
|
/* 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);
|
obj_desc =
|
||||||
if (!obj_desc ||
|
acpi_ns_get_attached_object((struct acpi_namespace_node *)
|
||||||
!obj_desc->device.gpe_block) {
|
gpe_device);
|
||||||
|
if (!obj_desc || !obj_desc->device.gpe_block) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gpe_block = obj_desc->device.gpe_block;
|
gpe_block = obj_desc->device.gpe_block;
|
||||||
|
|
||||||
if ((gpe_number >= gpe_block->block_base_number) &&
|
if ((gpe_number >= gpe_block->block_base_number) &&
|
||||||
(gpe_number < gpe_block->block_base_number + (gpe_block->register_count * 8))) {
|
(gpe_number <
|
||||||
return (&gpe_block->event_info[gpe_number - gpe_block->block_base_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);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_gpe_detect
|
* FUNCTION: acpi_ev_gpe_detect
|
||||||
@@ -387,23 +370,20 @@ acpi_ev_get_gpe_event_info (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list)
|
||||||
acpi_ev_gpe_detect (
|
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list)
|
|
||||||
{
|
{
|
||||||
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
u32 int_status = ACPI_INTERRUPT_NOT_HANDLED;
|
||||||
u8 enabled_status_byte;
|
u8 enabled_status_byte;
|
||||||
struct acpi_gpe_register_info *gpe_register_info;
|
struct acpi_gpe_register_info *gpe_register_info;
|
||||||
u32 status_reg;
|
u32 status_reg;
|
||||||
u32 enable_reg;
|
u32 enable_reg;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_gpe_block_info *gpe_block;
|
struct acpi_gpe_block_info *gpe_block;
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
acpi_native_uint j;
|
acpi_native_uint j;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ev_gpe_detect");
|
||||||
ACPI_FUNCTION_NAME ("ev_gpe_detect");
|
|
||||||
|
|
||||||
/* Check for the case where there are no GPEs */
|
/* Check for the case where there are no GPEs */
|
||||||
|
|
||||||
@@ -413,7 +393,7 @@ acpi_ev_gpe_detect (
|
|||||||
|
|
||||||
/* Examine all GPE blocks attached to this interrupt level */
|
/* Examine all GPE blocks attached to this interrupt level */
|
||||||
|
|
||||||
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||||
gpe_block = gpe_xrupt_list->gpe_block_list_head;
|
gpe_block = gpe_xrupt_list->gpe_block_list_head;
|
||||||
while (gpe_block) {
|
while (gpe_block) {
|
||||||
/*
|
/*
|
||||||
@@ -428,23 +408,30 @@ acpi_ev_gpe_detect (
|
|||||||
|
|
||||||
/* Read the Status Register */
|
/* Read the Status Register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &status_reg,
|
status =
|
||||||
&gpe_register_info->status_address);
|
acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
|
||||||
if (ACPI_FAILURE (status)) {
|
&status_reg,
|
||||||
|
&gpe_register_info->
|
||||||
|
status_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the Enable Register */
|
/* Read the Enable Register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_read (ACPI_GPE_REGISTER_WIDTH, &enable_reg,
|
status =
|
||||||
&gpe_register_info->enable_address);
|
acpi_hw_low_level_read(ACPI_GPE_REGISTER_WIDTH,
|
||||||
if (ACPI_FAILURE (status)) {
|
&enable_reg,
|
||||||
|
&gpe_register_info->
|
||||||
|
enable_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
|
ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
|
||||||
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
|
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
|
||||||
gpe_register_info->base_gpe_number, status_reg, enable_reg));
|
gpe_register_info->base_gpe_number,
|
||||||
|
status_reg, enable_reg));
|
||||||
|
|
||||||
/* Check if there is anything active at all in this register */
|
/* 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++) {
|
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
|
||||||
/* Examine one GPE bit */
|
/* 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
|
* Found an active GPE. Dispatch the event to a handler
|
||||||
* or method.
|
* or method.
|
||||||
*/
|
*/
|
||||||
int_status |= acpi_ev_gpe_dispatch (
|
int_status |=
|
||||||
&gpe_block->event_info[(i * ACPI_GPE_REGISTER_WIDTH) + j],
|
acpi_ev_gpe_dispatch(&gpe_block->
|
||||||
(u32) j + gpe_register_info->base_gpe_number);
|
event_info[(i *
|
||||||
|
ACPI_GPE_REGISTER_WIDTH)
|
||||||
|
+
|
||||||
|
j],
|
||||||
|
(u32) j +
|
||||||
|
gpe_register_info->
|
||||||
|
base_gpe_number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -475,13 +469,12 @@ acpi_ev_gpe_detect (
|
|||||||
gpe_block = gpe_block->next;
|
gpe_block = gpe_block->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
|
|
||||||
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||||
return (int_status);
|
return (int_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_asynch_execute_gpe_method
|
* FUNCTION: acpi_ev_asynch_execute_gpe_method
|
||||||
@@ -498,45 +491,41 @@ unlock_and_exit:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void ACPI_SYSTEM_XFACE
|
static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context)
|
||||||
acpi_ev_asynch_execute_gpe_method (
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_event_info *gpe_event_info = (void *) context;
|
struct acpi_gpe_event_info *gpe_event_info = (void *)context;
|
||||||
u32 gpe_number = 0;
|
u32 gpe_number = 0;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_gpe_event_info local_gpe_event_info;
|
struct acpi_gpe_event_info local_gpe_event_info;
|
||||||
struct acpi_parameter_info info;
|
struct acpi_parameter_info info;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_asynch_execute_gpe_method");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_asynch_execute_gpe_method");
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must revalidate the gpe_number/gpe_block */
|
/* Must revalidate the gpe_number/gpe_block */
|
||||||
|
|
||||||
if (!acpi_ev_valid_gpe_event (gpe_event_info)) {
|
if (!acpi_ev_valid_gpe_event(gpe_event_info)) {
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the GPE flags for return to enabled state */
|
/* Set the GPE flags for return to enabled state */
|
||||||
|
|
||||||
(void) acpi_ev_enable_gpe (gpe_event_info, FALSE);
|
(void)acpi_ev_enable_gpe(gpe_event_info, FALSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Take a snapshot of the GPE info for this level - we copy the
|
* Take a snapshot of the GPE info for this level - we copy the
|
||||||
* info to prevent a race condition with remove_handler/remove_block.
|
* info to prevent a race condition with remove_handler/remove_block.
|
||||||
*/
|
*/
|
||||||
ACPI_MEMCPY (&local_gpe_event_info, gpe_event_info,
|
ACPI_MEMCPY(&local_gpe_event_info, gpe_event_info,
|
||||||
sizeof (struct acpi_gpe_event_info));
|
sizeof(struct acpi_gpe_event_info));
|
||||||
|
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,44 +534,40 @@ acpi_ev_asynch_execute_gpe_method (
|
|||||||
* time to avoid race with ev_gpe_install_handler
|
* time to avoid race with ev_gpe_install_handler
|
||||||
*/
|
*/
|
||||||
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
|
if ((local_gpe_event_info.flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||||
ACPI_GPE_DISPATCH_METHOD) {
|
ACPI_GPE_DISPATCH_METHOD) {
|
||||||
/*
|
/*
|
||||||
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
|
* Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
|
||||||
* control method that corresponds to this GPE
|
* control method that corresponds to this GPE
|
||||||
*/
|
*/
|
||||||
info.node = local_gpe_event_info.dispatch.method_node;
|
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;
|
info.parameter_type = ACPI_PARAM_GPE;
|
||||||
|
|
||||||
status = acpi_ns_evaluate_by_handle (&info);
|
status = acpi_ns_evaluate_by_handle(&info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
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));
|
||||||
"%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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
if ((local_gpe_event_info.flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
||||||
ACPI_GPE_LEVEL_TRIGGERED) {
|
ACPI_GPE_LEVEL_TRIGGERED) {
|
||||||
/*
|
/*
|
||||||
* GPE is level-triggered, we clear the GPE status bit after
|
* GPE is level-triggered, we clear the GPE status bit after
|
||||||
* handling the event.
|
* handling the event.
|
||||||
*/
|
*/
|
||||||
status = acpi_hw_clear_gpe (&local_gpe_event_info);
|
status = acpi_hw_clear_gpe(&local_gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable this GPE */
|
/* Enable this GPE */
|
||||||
|
|
||||||
(void) acpi_hw_write_gpe_enable_reg (&local_gpe_event_info);
|
(void)acpi_hw_write_gpe_enable_reg(&local_gpe_event_info);
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_gpe_dispatch
|
* FUNCTION: acpi_ev_gpe_dispatch
|
||||||
@@ -600,38 +585,31 @@ acpi_ev_asynch_execute_gpe_method (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32
|
||||||
acpi_ev_gpe_dispatch (
|
acpi_ev_gpe_dispatch(struct acpi_gpe_event_info *gpe_event_info, u32 gpe_number)
|
||||||
struct acpi_gpe_event_info *gpe_event_info,
|
|
||||||
u32 gpe_number)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_gpe_dispatch");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_gpe_dispatch");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If edge-triggered, clear the GPE status bit now. Note that
|
* If edge-triggered, clear the GPE status bit now. Note that
|
||||||
* level-triggered events are cleared after the GPE is serviced.
|
* level-triggered events are cleared after the GPE is serviced.
|
||||||
*/
|
*/
|
||||||
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
||||||
ACPI_GPE_EDGE_TRIGGERED) {
|
ACPI_GPE_EDGE_TRIGGERED) {
|
||||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||||
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
|
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||||
acpi_format_exception (status), gpe_number));
|
|
||||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save current system state */
|
/* Save current system state */
|
||||||
|
|
||||||
if (acpi_gbl_system_awake_and_running) {
|
if (acpi_gbl_system_awake_and_running) {
|
||||||
ACPI_SET_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_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);
|
||||||
ACPI_CLEAR_BIT (gpe_event_info->flags, ACPI_GPE_SYSTEM_RUNNING);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -648,19 +626,19 @@ acpi_ev_gpe_dispatch (
|
|||||||
* Invoke the installed handler (at interrupt level)
|
* Invoke the installed handler (at interrupt level)
|
||||||
* Ignore return status for now. TBD: leave GPE disabled on error?
|
* Ignore return status for now. TBD: leave GPE disabled on error?
|
||||||
*/
|
*/
|
||||||
(void) gpe_event_info->dispatch.handler->address (
|
(void)gpe_event_info->dispatch.handler->address(gpe_event_info->
|
||||||
gpe_event_info->dispatch.handler->context);
|
dispatch.
|
||||||
|
handler->
|
||||||
|
context);
|
||||||
|
|
||||||
/* It is now safe to clear level-triggered events. */
|
/* It is now safe to clear level-triggered events. */
|
||||||
|
|
||||||
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
|
||||||
ACPI_GPE_LEVEL_TRIGGERED) {
|
ACPI_GPE_LEVEL_TRIGGERED) {
|
||||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||||
"acpi_ev_gpe_dispatch: %s, Unable to clear GPE[%2X]\n",
|
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||||
acpi_format_exception (status), gpe_number));
|
|
||||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -671,24 +649,21 @@ acpi_ev_gpe_dispatch (
|
|||||||
* Disable GPE, so it doesn't keep firing before the method has a
|
* Disable GPE, so it doesn't keep firing before the method has a
|
||||||
* chance to run.
|
* chance to run.
|
||||||
*/
|
*/
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||||
"acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
|
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||||
acpi_format_exception (status), gpe_number));
|
|
||||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute the method associated with the GPE
|
* Execute the method associated with the GPE
|
||||||
* NOTE: Level-triggered GPEs are cleared after the method completes.
|
* NOTE: Level-triggered GPEs are cleared after the method completes.
|
||||||
*/
|
*/
|
||||||
status = acpi_os_queue_for_execution (OSD_PRIORITY_GPE,
|
status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE,
|
||||||
acpi_ev_asynch_execute_gpe_method, gpe_event_info);
|
acpi_ev_asynch_execute_gpe_method,
|
||||||
if (ACPI_FAILURE (status)) {
|
gpe_event_info);
|
||||||
ACPI_REPORT_ERROR ((
|
if (ACPI_FAILURE(status)) {
|
||||||
"acpi_ev_gpe_dispatch: %s, Unable to queue handler for GPE[%2X] - event disabled\n",
|
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_format_exception (status), gpe_number));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -696,28 +671,23 @@ acpi_ev_gpe_dispatch (
|
|||||||
|
|
||||||
/* No handler or method to run! */
|
/* No handler or method to run! */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: No handler or method for GPE[%2X], disabling event\n", gpe_number));
|
||||||
"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
|
* Disable the GPE. The GPE will remain disabled until the ACPI
|
||||||
* Core Subsystem is restarted, or a handler is installed.
|
* Core Subsystem is restarted, or a handler is installed.
|
||||||
*/
|
*/
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n", acpi_format_exception(status), gpe_number));
|
||||||
"acpi_ev_gpe_dispatch: %s, Unable to disable GPE[%2X]\n",
|
return_VALUE(ACPI_INTERRUPT_NOT_HANDLED);
|
||||||
acpi_format_exception (status), gpe_number));
|
|
||||||
return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE (ACPI_INTERRUPT_HANDLED);
|
return_VALUE(ACPI_INTERRUPT_HANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
|
* TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
|
||||||
@@ -736,35 +706,29 @@ acpi_ev_gpe_dispatch (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_check_for_wake_only_gpe (
|
acpi_ev_check_for_wake_only_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
struct acpi_gpe_event_info *gpe_event_info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_check_for_wake_only_gpe");
|
||||||
|
|
||||||
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 */
|
||||||
|
|
||||||
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 */ {
|
|
||||||
/* This must be a wake-only GPE, disable it */
|
/* This must be a wake-only GPE, disable it */
|
||||||
|
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
|
|
||||||
/* Set GPE to wake-only. Do not change wake disabled/enabled status */
|
/* Set GPE to wake-only. Do not change wake disabled/enabled status */
|
||||||
|
|
||||||
acpi_ev_set_gpe_type (gpe_event_info, ACPI_GPE_TYPE_WAKE);
|
acpi_ev_set_gpe_type(gpe_event_info, ACPI_GPE_TYPE_WAKE);
|
||||||
|
|
||||||
ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
|
ACPI_REPORT_INFO(("GPE %p was updated from wake/run to wake-only\n", gpe_event_info));
|
||||||
gpe_event_info));
|
|
||||||
|
|
||||||
/* This was a wake-only GPE */
|
/* This was a wake-only GPE */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
|
return_ACPI_STATUS(AE_WAKE_ONLY_GPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -47,12 +47,10 @@
|
|||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evmisc")
|
ACPI_MODULE_NAME("evmisc")
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
static const char *acpi_notify_value_names[] =
|
static const char *acpi_notify_value_names[] = {
|
||||||
{
|
|
||||||
"Bus Check",
|
"Bus Check",
|
||||||
"Device Check",
|
"Device Check",
|
||||||
"Device Wake",
|
"Device Wake",
|
||||||
@@ -66,18 +64,11 @@ static const char *acpi_notify_value_names[] =
|
|||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static void ACPI_SYSTEM_XFACE
|
static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context);
|
||||||
acpi_ev_notify_dispatch (
|
|
||||||
void *context);
|
|
||||||
|
|
||||||
static void ACPI_SYSTEM_XFACE
|
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context);
|
||||||
acpi_ev_global_lock_thread (
|
|
||||||
void *context);
|
|
||||||
|
|
||||||
static u32
|
|
||||||
acpi_ev_global_lock_handler (
|
|
||||||
void *context);
|
|
||||||
|
|
||||||
|
static u32 acpi_ev_global_lock_handler(void *context);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -93,9 +84,7 @@ acpi_ev_global_lock_handler (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8
|
u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node)
|
||||||
acpi_ev_is_notify_object (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
switch (node->type) {
|
switch (node->type) {
|
||||||
case ACPI_TYPE_DEVICE:
|
case ACPI_TYPE_DEVICE:
|
||||||
@@ -112,7 +101,6 @@ acpi_ev_is_notify_object (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_queue_notify_request
|
* FUNCTION: acpi_ev_queue_notify_request
|
||||||
@@ -128,18 +116,15 @@ acpi_ev_is_notify_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_queue_notify_request (
|
acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
|
||||||
struct acpi_namespace_node *node,
|
u32 notify_value)
|
||||||
u32 notify_value)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *handler_obj = NULL;
|
union acpi_operand_object *handler_obj = NULL;
|
||||||
union acpi_generic_state *notify_info;
|
union acpi_generic_state *notify_info;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ev_queue_notify_request");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ev_queue_notify_request");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For value 3 (Ejection Request), some device method may need to be run.
|
* For value 3 (Ejection Request), some device method may need to be run.
|
||||||
@@ -148,22 +133,22 @@ acpi_ev_queue_notify_request (
|
|||||||
* For value 0x80 (Status Change) on the power button or sleep button,
|
* For value 0x80 (Status Change) on the power button or sleep button,
|
||||||
* initiate soft-off or sleep operation?
|
* initiate soft-off or sleep operation?
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
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) {
|
if (notify_value <= 7) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notify value: %s\n",
|
||||||
acpi_notify_value_names[notify_value]));
|
acpi_notify_value_names[notify_value]));
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
"Notify value: 0x%2.2X **Device Specific**\n",
|
||||||
"Notify value: 0x%2.2X **Device Specific**\n",
|
notify_value));
|
||||||
notify_value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the notify object attached to the NS Node */
|
/* Get the notify object attached to the NS Node */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
/* We have the notify object, Get the right handler */
|
/* We have the notify object, Get the right handler */
|
||||||
|
|
||||||
@@ -174,10 +159,11 @@ acpi_ev_queue_notify_request (
|
|||||||
case ACPI_TYPE_POWER:
|
case ACPI_TYPE_POWER:
|
||||||
|
|
||||||
if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
|
if (notify_value <= ACPI_MAX_SYS_NOTIFY) {
|
||||||
handler_obj = obj_desc->common_notify.system_notify;
|
handler_obj =
|
||||||
}
|
obj_desc->common_notify.system_notify;
|
||||||
else {
|
} else {
|
||||||
handler_obj = obj_desc->common_notify.device_notify;
|
handler_obj =
|
||||||
|
obj_desc->common_notify.device_notify;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -189,23 +175,25 @@ acpi_ev_queue_notify_request (
|
|||||||
|
|
||||||
/* If there is any handler to run, schedule the dispatcher */
|
/* If there is any handler to run, schedule the dispatcher */
|
||||||
|
|
||||||
if ((acpi_gbl_system_notify.handler && (notify_value <= ACPI_MAX_SYS_NOTIFY)) ||
|
if ((acpi_gbl_system_notify.handler
|
||||||
(acpi_gbl_device_notify.handler && (notify_value > ACPI_MAX_SYS_NOTIFY)) ||
|
&& (notify_value <= ACPI_MAX_SYS_NOTIFY))
|
||||||
handler_obj) {
|
|| (acpi_gbl_device_notify.handler
|
||||||
notify_info = acpi_ut_create_generic_state ();
|
&& (notify_value > ACPI_MAX_SYS_NOTIFY)) || handler_obj) {
|
||||||
|
notify_info = acpi_ut_create_generic_state();
|
||||||
if (!notify_info) {
|
if (!notify_info) {
|
||||||
return (AE_NO_MEMORY);
|
return (AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
|
notify_info->common.data_type = ACPI_DESC_TYPE_STATE_NOTIFY;
|
||||||
notify_info->notify.node = node;
|
notify_info->notify.node = node;
|
||||||
notify_info->notify.value = (u16) notify_value;
|
notify_info->notify.value = (u16) notify_value;
|
||||||
notify_info->notify.handler_obj = handler_obj;
|
notify_info->notify.handler_obj = handler_obj;
|
||||||
|
|
||||||
status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
|
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
|
||||||
acpi_ev_notify_dispatch, notify_info);
|
acpi_ev_notify_dispatch,
|
||||||
if (ACPI_FAILURE (status)) {
|
notify_info);
|
||||||
acpi_ut_delete_generic_state (notify_info);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_ut_delete_generic_state(notify_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,15 +202,15 @@ acpi_ev_queue_notify_request (
|
|||||||
* There is no per-device notify handler for this device.
|
* There is no per-device notify handler for this device.
|
||||||
* This may or may not be a problem.
|
* This may or may not be a problem.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"No notify handler for Notify(%4.4s, %X) node %p\n",
|
"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);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_notify_dispatch
|
* FUNCTION: acpi_ev_notify_dispatch
|
||||||
@@ -236,18 +224,15 @@ acpi_ev_queue_notify_request (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void ACPI_SYSTEM_XFACE
|
static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context)
|
||||||
acpi_ev_notify_dispatch (
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *notify_info = (union acpi_generic_state *) context;
|
union acpi_generic_state *notify_info =
|
||||||
acpi_notify_handler global_handler = NULL;
|
(union acpi_generic_state *)context;
|
||||||
void *global_context = NULL;
|
acpi_notify_handler global_handler = NULL;
|
||||||
union acpi_operand_object *handler_obj;
|
void *global_context = NULL;
|
||||||
|
union acpi_operand_object *handler_obj;
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We will invoke a global notify handler if installed.
|
* We will invoke a global notify handler if installed.
|
||||||
@@ -261,8 +246,7 @@ acpi_ev_notify_dispatch (
|
|||||||
global_handler = acpi_gbl_system_notify.handler;
|
global_handler = acpi_gbl_system_notify.handler;
|
||||||
global_context = acpi_gbl_system_notify.context;
|
global_context = acpi_gbl_system_notify.context;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Global driver notification handler */
|
/* Global driver notification handler */
|
||||||
|
|
||||||
if (acpi_gbl_device_notify.handler) {
|
if (acpi_gbl_device_notify.handler) {
|
||||||
@@ -274,25 +258,24 @@ acpi_ev_notify_dispatch (
|
|||||||
/* Invoke the system handler first, if present */
|
/* Invoke the system handler first, if present */
|
||||||
|
|
||||||
if (global_handler) {
|
if (global_handler) {
|
||||||
global_handler (notify_info->notify.node, notify_info->notify.value,
|
global_handler(notify_info->notify.node,
|
||||||
global_context);
|
notify_info->notify.value, global_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now invoke the per-device handler, if present */
|
/* Now invoke the per-device handler, if present */
|
||||||
|
|
||||||
handler_obj = notify_info->notify.handler_obj;
|
handler_obj = notify_info->notify.handler_obj;
|
||||||
if (handler_obj) {
|
if (handler_obj) {
|
||||||
handler_obj->notify.handler (notify_info->notify.node,
|
handler_obj->notify.handler(notify_info->notify.node,
|
||||||
notify_info->notify.value,
|
notify_info->notify.value,
|
||||||
handler_obj->notify.context);
|
handler_obj->notify.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All done with the info object */
|
/* All done with the info object */
|
||||||
|
|
||||||
acpi_ut_delete_generic_state (notify_info);
|
acpi_ut_delete_generic_state(notify_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_global_lock_thread
|
* FUNCTION: acpi_ev_global_lock_thread
|
||||||
@@ -307,27 +290,24 @@ acpi_ev_notify_dispatch (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void ACPI_SYSTEM_XFACE
|
static void ACPI_SYSTEM_XFACE acpi_ev_global_lock_thread(void *context)
|
||||||
acpi_ev_global_lock_thread (
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Signal threads that are waiting for the lock */
|
/* Signal threads that are waiting for the lock */
|
||||||
|
|
||||||
if (acpi_gbl_global_lock_thread_count) {
|
if (acpi_gbl_global_lock_thread_count) {
|
||||||
/* Send sufficient units to the semaphore */
|
/* Send sufficient units to the semaphore */
|
||||||
|
|
||||||
status = acpi_os_signal_semaphore (acpi_gbl_global_lock_semaphore,
|
status =
|
||||||
acpi_gbl_global_lock_thread_count);
|
acpi_os_signal_semaphore(acpi_gbl_global_lock_semaphore,
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_gbl_global_lock_thread_count);
|
||||||
ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
|
if (ACPI_FAILURE(status)) {
|
||||||
|
ACPI_REPORT_ERROR(("Could not signal Global Lock semaphore\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_global_lock_handler
|
* FUNCTION: acpi_ev_global_lock_handler
|
||||||
@@ -342,20 +322,17 @@ acpi_ev_global_lock_thread (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32 acpi_ev_global_lock_handler(void *context)
|
||||||
acpi_ev_global_lock_handler (
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
u8 acquired = FALSE;
|
u8 acquired = FALSE;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to get the lock
|
* Attempt to get the lock
|
||||||
* If we don't get it now, it will be marked pending and we will
|
* If we don't get it now, it will be marked pending and we will
|
||||||
* take another interrupt when it becomes free.
|
* take another interrupt when it becomes free.
|
||||||
*/
|
*/
|
||||||
ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
|
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
|
||||||
if (acquired) {
|
if (acquired) {
|
||||||
/* Got the lock, now wake all threads waiting for it */
|
/* Got the lock, now wake all threads waiting for it */
|
||||||
|
|
||||||
@@ -363,11 +340,11 @@ acpi_ev_global_lock_handler (
|
|||||||
|
|
||||||
/* Run the Global Lock thread which will signal all waiting threads */
|
/* Run the Global Lock thread which will signal all waiting threads */
|
||||||
|
|
||||||
status = acpi_os_queue_for_execution (OSD_PRIORITY_HIGH,
|
status = acpi_os_queue_for_execution(OSD_PRIORITY_HIGH,
|
||||||
acpi_ev_global_lock_thread, context);
|
acpi_ev_global_lock_thread,
|
||||||
if (ACPI_FAILURE (status)) {
|
context);
|
||||||
ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_format_exception (status)));
|
ACPI_REPORT_ERROR(("Could not queue Global Lock thread, %s\n", acpi_format_exception(status)));
|
||||||
|
|
||||||
return (ACPI_INTERRUPT_NOT_HANDLED);
|
return (ACPI_INTERRUPT_NOT_HANDLED);
|
||||||
}
|
}
|
||||||
@@ -376,7 +353,6 @@ acpi_ev_global_lock_handler (
|
|||||||
return (ACPI_INTERRUPT_HANDLED);
|
return (ACPI_INTERRUPT_HANDLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_init_global_lock_handler
|
* FUNCTION: acpi_ev_init_global_lock_handler
|
||||||
@@ -389,19 +365,16 @@ acpi_ev_global_lock_handler (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_init_global_lock_handler(void)
|
||||||
acpi_ev_init_global_lock_handler (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_init_global_lock_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_init_global_lock_handler");
|
||||||
|
|
||||||
acpi_gbl_global_lock_present = TRUE;
|
acpi_gbl_global_lock_present = TRUE;
|
||||||
status = acpi_install_fixed_event_handler (ACPI_EVENT_GLOBAL,
|
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
|
* If the global lock does not exist on this platform, the attempt
|
||||||
@@ -411,17 +384,15 @@ acpi_ev_init_global_lock_handler (
|
|||||||
* with an error.
|
* with an error.
|
||||||
*/
|
*/
|
||||||
if (status == AE_NO_HARDWARE_RESPONSE) {
|
if (status == AE_NO_HARDWARE_RESPONSE) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("No response from Global Lock hardware, disabling lock\n"));
|
||||||
"No response from Global Lock hardware, disabling lock\n"));
|
|
||||||
|
|
||||||
acpi_gbl_global_lock_present = FALSE;
|
acpi_gbl_global_lock_present = FALSE;
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_acquire_global_lock
|
* FUNCTION: acpi_ev_acquire_global_lock
|
||||||
@@ -434,22 +405,18 @@ acpi_ev_init_global_lock_handler (
|
|||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_acquire_global_lock(u16 timeout)
|
||||||
acpi_ev_acquire_global_lock (
|
|
||||||
u16 timeout)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u8 acquired = FALSE;
|
u8 acquired = FALSE;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_acquire_global_lock");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_acquire_global_lock");
|
||||||
|
|
||||||
#ifndef ACPI_APPLICATION
|
#ifndef ACPI_APPLICATION
|
||||||
/* Make sure that we actually have a global lock */
|
/* Make sure that we actually have a global lock */
|
||||||
|
|
||||||
if (!acpi_gbl_global_lock_present) {
|
if (!acpi_gbl_global_lock_present) {
|
||||||
return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
|
return_ACPI_STATUS(AE_NO_GLOBAL_LOCK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -462,37 +429,37 @@ acpi_ev_acquire_global_lock (
|
|||||||
* we are done
|
* we are done
|
||||||
*/
|
*/
|
||||||
if (acpi_gbl_global_lock_acquired) {
|
if (acpi_gbl_global_lock_acquired) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We must acquire the actual hardware lock */
|
/* We must acquire the actual hardware lock */
|
||||||
|
|
||||||
ACPI_ACQUIRE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, acquired);
|
ACPI_ACQUIRE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, acquired);
|
||||||
if (acquired) {
|
if (acquired) {
|
||||||
/* We got the lock */
|
/* 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;
|
acpi_gbl_global_lock_acquired = TRUE;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Did not get the lock. The pending bit was set above, and we must now
|
* Did not get the lock. The pending bit was set above, and we must now
|
||||||
* wait until we get the global lock released interrupt.
|
* wait until we get the global lock released interrupt.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Acquire the global lock semaphore first.
|
* Acquire the global lock semaphore first.
|
||||||
* Since this wait will block, we must release the interpreter
|
* Since this wait will block, we must release the interpreter
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_system_wait_semaphore (acpi_gbl_global_lock_semaphore,
|
status = acpi_ex_system_wait_semaphore(acpi_gbl_global_lock_semaphore,
|
||||||
timeout);
|
timeout);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_release_global_lock
|
* FUNCTION: acpi_ev_release_global_lock
|
||||||
@@ -505,21 +472,16 @@ acpi_ev_acquire_global_lock (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_release_global_lock(void)
|
||||||
acpi_ev_release_global_lock (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
u8 pending = FALSE;
|
u8 pending = FALSE;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_release_global_lock");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_release_global_lock");
|
||||||
|
|
||||||
if (!acpi_gbl_global_lock_thread_count) {
|
if (!acpi_gbl_global_lock_thread_count) {
|
||||||
ACPI_REPORT_WARNING((
|
ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
|
||||||
"Cannot release HW Global Lock, it has not been acquired\n"));
|
return_ACPI_STATUS(AE_NOT_ACQUIRED);
|
||||||
return_ACPI_STATUS (AE_NOT_ACQUIRED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One fewer thread has the global lock */
|
/* One fewer thread has the global lock */
|
||||||
@@ -528,14 +490,14 @@ acpi_ev_release_global_lock (
|
|||||||
if (acpi_gbl_global_lock_thread_count) {
|
if (acpi_gbl_global_lock_thread_count) {
|
||||||
/* There are still some threads holding the lock, cannot release */
|
/* There are still some threads holding the lock, cannot release */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No more threads holding lock, we can do the actual hardware
|
* No more threads holding lock, we can do the actual hardware
|
||||||
* release
|
* release
|
||||||
*/
|
*/
|
||||||
ACPI_RELEASE_GLOBAL_LOCK (acpi_gbl_common_fACS.global_lock, pending);
|
ACPI_RELEASE_GLOBAL_LOCK(acpi_gbl_common_fACS.global_lock, pending);
|
||||||
acpi_gbl_global_lock_acquired = FALSE;
|
acpi_gbl_global_lock_acquired = FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -543,14 +505,13 @@ acpi_ev_release_global_lock (
|
|||||||
* register
|
* register
|
||||||
*/
|
*/
|
||||||
if (pending) {
|
if (pending) {
|
||||||
status = acpi_set_register (ACPI_BITREG_GLOBAL_LOCK_RELEASE,
|
status = acpi_set_register(ACPI_BITREG_GLOBAL_LOCK_RELEASE,
|
||||||
1, ACPI_MTX_LOCK);
|
1, ACPI_MTX_LOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_terminate
|
* FUNCTION: acpi_ev_terminate
|
||||||
@@ -563,16 +524,12 @@ acpi_ev_release_global_lock (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ev_terminate(void)
|
||||||
acpi_ev_terminate (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_terminate");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_terminate");
|
||||||
|
|
||||||
if (acpi_gbl_events_initialized) {
|
if (acpi_gbl_events_initialized) {
|
||||||
/*
|
/*
|
||||||
@@ -583,38 +540,39 @@ acpi_ev_terminate (
|
|||||||
/* Disable all fixed events */
|
/* Disable all fixed events */
|
||||||
|
|
||||||
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
|
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
|
||||||
status = acpi_disable_event ((u32) i, 0);
|
status = acpi_disable_event((u32) i, 0);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not disable fixed event %d\n", (u32) i));
|
"Could not disable fixed event %d\n",
|
||||||
|
(u32) i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable all GPEs in all GPE blocks */
|
/* Disable all GPEs in all GPE blocks */
|
||||||
|
|
||||||
status = acpi_ev_walk_gpe_list (acpi_hw_disable_gpe_block);
|
status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block);
|
||||||
|
|
||||||
/* Remove SCI handler */
|
/* Remove SCI handler */
|
||||||
|
|
||||||
status = acpi_ev_remove_sci_handler ();
|
status = acpi_ev_remove_sci_handler();
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not remove SCI handler\n"));
|
"Could not remove SCI handler\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Deallocate all handler objects installed within GPE info structs */
|
/* Deallocate all handler objects installed within GPE info structs */
|
||||||
|
|
||||||
status = acpi_ev_walk_gpe_list (acpi_ev_delete_gpe_handlers);
|
status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers);
|
||||||
|
|
||||||
/* Return to original mode if necessary */
|
/* Return to original mode if necessary */
|
||||||
|
|
||||||
if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
|
if (acpi_gbl_original_mode == ACPI_SYS_MODE_LEGACY) {
|
||||||
status = acpi_disable ();
|
status = acpi_disable();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "acpi_disable failed\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
|
"acpi_disable failed\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,14 +41,12 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evrgnini")
|
ACPI_MODULE_NAME("evrgnini")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -64,34 +62,31 @@
|
|||||||
* DESCRIPTION: Setup a system_memory operation region
|
* DESCRIPTION: Setup a system_memory operation region
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_system_memory_region_setup (
|
acpi_ev_system_memory_region_setup(acpi_handle handle,
|
||||||
acpi_handle handle,
|
u32 function,
|
||||||
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 =
|
||||||
struct acpi_mem_space_context *local_region_context;
|
(union acpi_operand_object *)handle;
|
||||||
|
struct acpi_mem_space_context *local_region_context;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_system_memory_region_setup");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_system_memory_region_setup");
|
||||||
|
|
||||||
if (function == ACPI_REGION_DEACTIVATE) {
|
if (function == ACPI_REGION_DEACTIVATE) {
|
||||||
if (*region_context) {
|
if (*region_context) {
|
||||||
ACPI_MEM_FREE (*region_context);
|
ACPI_MEM_FREE(*region_context);
|
||||||
*region_context = NULL;
|
*region_context = NULL;
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new context */
|
/* 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)) {
|
if (!(local_region_context)) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the region length and address for use in the handler */
|
/* Save the region length and address for use in the handler */
|
||||||
@@ -100,10 +95,9 @@ acpi_ev_system_memory_region_setup (
|
|||||||
local_region_context->address = region_desc->region.address;
|
local_region_context->address = region_desc->region.address;
|
||||||
|
|
||||||
*region_context = local_region_context;
|
*region_context = local_region_context;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_io_space_region_setup
|
* FUNCTION: acpi_ev_io_space_region_setup
|
||||||
@@ -120,26 +114,21 @@ acpi_ev_system_memory_region_setup (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_io_space_region_setup (
|
acpi_ev_io_space_region_setup(acpi_handle handle,
|
||||||
acpi_handle handle,
|
u32 function,
|
||||||
u32 function,
|
void *handler_context, void **region_context)
|
||||||
void *handler_context,
|
|
||||||
void **region_context)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ev_io_space_region_setup");
|
ACPI_FUNCTION_TRACE("ev_io_space_region_setup");
|
||||||
|
|
||||||
|
|
||||||
if (function == ACPI_REGION_DEACTIVATE) {
|
if (function == ACPI_REGION_DEACTIVATE) {
|
||||||
*region_context = NULL;
|
*region_context = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
*region_context = handler_context;
|
*region_context = handler_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_pci_config_region_setup
|
* FUNCTION: acpi_ev_pci_config_region_setup
|
||||||
@@ -158,24 +147,21 @@ acpi_ev_io_space_region_setup (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_pci_config_region_setup (
|
acpi_ev_pci_config_region_setup(acpi_handle handle,
|
||||||
acpi_handle handle,
|
u32 function,
|
||||||
u32 function,
|
void *handler_context, void **region_context)
|
||||||
void *handler_context,
|
|
||||||
void **region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_integer pci_value;
|
acpi_integer pci_value;
|
||||||
struct acpi_pci_id *pci_id = *region_context;
|
struct acpi_pci_id *pci_id = *region_context;
|
||||||
union acpi_operand_object *handler_obj;
|
union acpi_operand_object *handler_obj;
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
struct acpi_namespace_node *pci_root_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 =
|
||||||
struct acpi_device_id object_hID;
|
(union acpi_operand_object *)handle;
|
||||||
|
struct acpi_device_id object_hID;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_pci_config_region_setup");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_pci_config_region_setup");
|
||||||
|
|
||||||
handler_obj = region_obj->region.handler;
|
handler_obj = region_obj->region.handler;
|
||||||
if (!handler_obj) {
|
if (!handler_obj) {
|
||||||
@@ -183,20 +169,21 @@ acpi_ev_pci_config_region_setup (
|
|||||||
* No installed handler. This shouldn't happen because the dispatch
|
* No installed handler. This shouldn't happen because the dispatch
|
||||||
* routine checks before we get here, but we check again just in case.
|
* routine checks before we get here, but we check again just in case.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
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",
|
||||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
region_obj));
|
||||||
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
*region_context = NULL;
|
*region_context = NULL;
|
||||||
if (function == ACPI_REGION_DEACTIVATE) {
|
if (function == ACPI_REGION_DEACTIVATE) {
|
||||||
if (pci_id) {
|
if (pci_id) {
|
||||||
ACPI_MEM_FREE (pci_id);
|
ACPI_MEM_FREE(pci_id);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (region_obj->region.node);
|
parent_node = acpi_ns_get_parent_node(region_obj->region.node);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the _SEG and _BBN values from the device upon which the handler
|
* Get the _SEG and _BBN values from the device upon which the handler
|
||||||
@@ -216,22 +203,28 @@ acpi_ev_pci_config_region_setup (
|
|||||||
|
|
||||||
pci_root_node = parent_node;
|
pci_root_node = parent_node;
|
||||||
while (pci_root_node != acpi_gbl_root_node) {
|
while (pci_root_node != acpi_gbl_root_node) {
|
||||||
status = acpi_ut_execute_HID (pci_root_node, &object_hID);
|
status =
|
||||||
if (ACPI_SUCCESS (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.
|
* Got a valid _HID string, check if this is a PCI root.
|
||||||
* New for ACPI 3.0: check for a PCI Express root also.
|
* New for ACPI 3.0: check for a PCI Express root also.
|
||||||
*/
|
*/
|
||||||
if (!(ACPI_STRNCMP (object_hID.value, PCI_ROOT_HID_STRING,
|
if (!
|
||||||
sizeof (PCI_ROOT_HID_STRING)) ||
|
(ACPI_STRNCMP
|
||||||
!(ACPI_STRNCMP (object_hID.value, PCI_EXPRESS_ROOT_HID_STRING,
|
(object_hID.value, PCI_ROOT_HID_STRING,
|
||||||
sizeof (PCI_EXPRESS_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 */
|
/* Install a handler for this PCI root bridge */
|
||||||
|
|
||||||
status = acpi_install_address_space_handler ((acpi_handle) pci_root_node,
|
status =
|
||||||
ACPI_ADR_SPACE_PCI_CONFIG,
|
acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
|
||||||
ACPI_DEFAULT_HANDLER, NULL, NULL);
|
if (ACPI_FAILURE(status)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
if (status == AE_SAME_HANDLER) {
|
if (status == AE_SAME_HANDLER) {
|
||||||
/*
|
/*
|
||||||
* It is OK if the handler is already installed on the root
|
* It is OK if the handler is already installed on the root
|
||||||
@@ -239,23 +232,19 @@ acpi_ev_pci_config_region_setup (
|
|||||||
* new PCI_Config operation region, however.
|
* new PCI_Config operation region, however.
|
||||||
*/
|
*/
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_REPORT_ERROR(("Could not install pci_config handler for Root Bridge %4.4s, %s\n", acpi_ut_get_node_name(pci_root_node), acpi_format_exception(status)));
|
||||||
ACPI_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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_root_node = acpi_ns_get_parent_node (pci_root_node);
|
pci_root_node = acpi_ns_get_parent_node(pci_root_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PCI root bridge not found, use namespace root node */
|
/* PCI root bridge not found, use namespace root node */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pci_root_node = handler_obj->address_space.node;
|
pci_root_node = handler_obj->address_space.node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,14 +253,14 @@ acpi_ev_pci_config_region_setup (
|
|||||||
* (install_address_space_handler could have initialized it)
|
* (install_address_space_handler could have initialized it)
|
||||||
*/
|
*/
|
||||||
if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
|
if (region_obj->region.flags & AOPOBJ_SETUP_COMPLETE) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Region is still not initialized. Create a new context */
|
/* Region is still not initialized. Create a new context */
|
||||||
|
|
||||||
pci_id = ACPI_MEM_CALLOCATE (sizeof (struct acpi_pci_id));
|
pci_id = ACPI_MEM_CALLOCATE(sizeof(struct acpi_pci_id));
|
||||||
if (!pci_id) {
|
if (!pci_id) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -283,40 +272,45 @@ acpi_ev_pci_config_region_setup (
|
|||||||
* Get the PCI device and function numbers from the _ADR object
|
* Get the PCI device and function numbers from the _ADR object
|
||||||
* contained in the parent's scope.
|
* 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
|
* The default is zero, and since the allocation above zeroed
|
||||||
* the data, just do nothing on failure.
|
* the data, just do nothing on failure.
|
||||||
*/
|
*/
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
pci_id->device = ACPI_HIWORD (ACPI_LODWORD (pci_value));
|
pci_id->device = ACPI_HIWORD(ACPI_LODWORD(pci_value));
|
||||||
pci_id->function = ACPI_LOWORD (ACPI_LODWORD (pci_value));
|
pci_id->function = ACPI_LOWORD(ACPI_LODWORD(pci_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The PCI segment number comes from the _SEG method */
|
/* The PCI segment number comes from the _SEG method */
|
||||||
|
|
||||||
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__SEG, pci_root_node, &pci_value);
|
status =
|
||||||
if (ACPI_SUCCESS (status)) {
|
acpi_ut_evaluate_numeric_object(METHOD_NAME__SEG, pci_root_node,
|
||||||
pci_id->segment = ACPI_LOWORD (pci_value);
|
&pci_value);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
pci_id->segment = ACPI_LOWORD(pci_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The PCI bus number comes from the _BBN method */
|
/* The PCI bus number comes from the _BBN method */
|
||||||
|
|
||||||
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__BBN, pci_root_node, &pci_value);
|
status =
|
||||||
if (ACPI_SUCCESS (status)) {
|
acpi_ut_evaluate_numeric_object(METHOD_NAME__BBN, pci_root_node,
|
||||||
pci_id->bus = ACPI_LOWORD (pci_value);
|
&pci_value);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
pci_id->bus = ACPI_LOWORD(pci_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete this device's pci_id */
|
/* Complete this device's pci_id */
|
||||||
|
|
||||||
acpi_os_derive_pci_id (pci_root_node, region_obj->region.node, &pci_id);
|
acpi_os_derive_pci_id(pci_root_node, region_obj->region.node, &pci_id);
|
||||||
|
|
||||||
*region_context = pci_id;
|
*region_context = pci_id;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_pci_bar_region_setup
|
* FUNCTION: acpi_ev_pci_bar_region_setup
|
||||||
@@ -335,19 +329,15 @@ acpi_ev_pci_config_region_setup (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_pci_bar_region_setup (
|
acpi_ev_pci_bar_region_setup(acpi_handle handle,
|
||||||
acpi_handle handle,
|
u32 function,
|
||||||
u32 function,
|
void *handler_context, void **region_context)
|
||||||
void *handler_context,
|
|
||||||
void **region_context)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ev_pci_bar_region_setup");
|
ACPI_FUNCTION_TRACE("ev_pci_bar_region_setup");
|
||||||
|
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
return_ACPI_STATUS (AE_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_cmos_region_setup
|
* FUNCTION: acpi_ev_cmos_region_setup
|
||||||
@@ -366,19 +356,15 @@ acpi_ev_pci_bar_region_setup (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_cmos_region_setup (
|
acpi_ev_cmos_region_setup(acpi_handle handle,
|
||||||
acpi_handle handle,
|
u32 function,
|
||||||
u32 function,
|
void *handler_context, void **region_context)
|
||||||
void *handler_context,
|
|
||||||
void **region_context)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ev_cmos_region_setup");
|
ACPI_FUNCTION_TRACE("ev_cmos_region_setup");
|
||||||
|
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
return_ACPI_STATUS (AE_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_default_region_setup
|
* FUNCTION: acpi_ev_default_region_setup
|
||||||
@@ -395,26 +381,21 @@ acpi_ev_cmos_region_setup (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_default_region_setup (
|
acpi_ev_default_region_setup(acpi_handle handle,
|
||||||
acpi_handle handle,
|
u32 function,
|
||||||
u32 function,
|
void *handler_context, void **region_context)
|
||||||
void *handler_context,
|
|
||||||
void **region_context)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ev_default_region_setup");
|
ACPI_FUNCTION_TRACE("ev_default_region_setup");
|
||||||
|
|
||||||
|
|
||||||
if (function == ACPI_REGION_DEACTIVATE) {
|
if (function == ACPI_REGION_DEACTIVATE) {
|
||||||
*region_context = NULL;
|
*region_context = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
*region_context = handler_context;
|
*region_context = handler_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_initialize_region
|
* FUNCTION: acpi_ev_initialize_region
|
||||||
@@ -438,37 +419,34 @@ acpi_ev_default_region_setup (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ev_initialize_region (
|
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
|
||||||
union acpi_operand_object *region_obj,
|
u8 acpi_ns_locked)
|
||||||
u8 acpi_ns_locked)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *handler_obj;
|
union acpi_operand_object *handler_obj;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_adr_space_type space_id;
|
acpi_adr_space_type space_id;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *method_node;
|
struct acpi_namespace_node *method_node;
|
||||||
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
|
acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG;
|
||||||
union acpi_operand_object *region_obj2;
|
union acpi_operand_object *region_obj2;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_U32 ("ev_initialize_region", acpi_ns_locked);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_U32("ev_initialize_region", acpi_ns_locked);
|
||||||
|
|
||||||
if (!region_obj) {
|
if (!region_obj) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
|
if (region_obj->common.flags & AOPOBJ_OBJECT_INITIALIZED) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
region_obj2 = acpi_ns_get_secondary_object (region_obj);
|
region_obj2 = acpi_ns_get_secondary_object(region_obj);
|
||||||
if (!region_obj2) {
|
if (!region_obj2) {
|
||||||
return_ACPI_STATUS (AE_NOT_EXIST);
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_get_parent_node (region_obj->region.node);
|
node = acpi_ns_get_parent_node(region_obj->region.node);
|
||||||
space_id = region_obj->region.space_id;
|
space_id = region_obj->region.space_id;
|
||||||
|
|
||||||
/* Setup defaults */
|
/* Setup defaults */
|
||||||
@@ -480,9 +458,9 @@ acpi_ev_initialize_region (
|
|||||||
|
|
||||||
/* Find any "_REG" method associated with this region definition */
|
/* Find any "_REG" method associated with this region definition */
|
||||||
|
|
||||||
status = acpi_ns_search_node (*reg_name_ptr, node,
|
status = acpi_ns_search_node(*reg_name_ptr, node,
|
||||||
ACPI_TYPE_METHOD, &method_node);
|
ACPI_TYPE_METHOD, &method_node);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/*
|
/*
|
||||||
* The _REG method is optional and there can be only one per region
|
* The _REG method is optional and there can be only one per region
|
||||||
* definition. This will be executed when the handler is attached
|
* definition. This will be executed when the handler is attached
|
||||||
@@ -499,7 +477,7 @@ acpi_ev_initialize_region (
|
|||||||
/* Check to see if a handler exists */
|
/* Check to see if a handler exists */
|
||||||
|
|
||||||
handler_obj = NULL;
|
handler_obj = NULL;
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
/* Can only be a handler if the object exists */
|
/* Can only be a handler if the object exists */
|
||||||
|
|
||||||
@@ -527,37 +505,50 @@ acpi_ev_initialize_region (
|
|||||||
while (handler_obj) {
|
while (handler_obj) {
|
||||||
/* Is this handler of the correct type? */
|
/* 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 */
|
/* Found correct handler */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||||
"Found handler %p for region %p in obj %p\n",
|
"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_ns_locked);
|
acpi_ev_attach_region(handler_obj,
|
||||||
|
region_obj,
|
||||||
|
acpi_ns_locked);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tell all users that this region is usable by running the _REG
|
* Tell all users that this region is usable by running the _REG
|
||||||
* method
|
* method
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_locked) {
|
if (acpi_ns_locked) {
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ut_release_mutex
|
||||||
return_ACPI_STATUS (status);
|
(ACPI_MTX_NAMESPACE);
|
||||||
|
if (ACPI_FAILURE(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) {
|
if (acpi_ns_locked) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ut_acquire_mutex
|
||||||
return_ACPI_STATUS (status);
|
(ACPI_MTX_NAMESPACE);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS
|
||||||
|
(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try next handler in the list */
|
/* Try next handler in the list */
|
||||||
@@ -570,15 +561,15 @@ acpi_ev_initialize_region (
|
|||||||
* This node does not have the handler we need;
|
* This node does not have the handler we need;
|
||||||
* Pop up one level
|
* Pop up one level
|
||||||
*/
|
*/
|
||||||
node = acpi_ns_get_parent_node (node);
|
node = acpi_ns_get_parent_node(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we get here, there is no handler for this region */
|
/* If we get here, there is no handler for this region */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||||
"No handler for region_type %s(%X) (region_obj %p)\n",
|
"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);
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,16 +45,11 @@
|
|||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evsci")
|
ACPI_MODULE_NAME("evsci")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* 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
|
static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context)
|
||||||
acpi_ev_sci_xrupt_handler (
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
||||||
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
|
ACPI_FUNCTION_TRACE("ev_sci_xrupt_handler");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
||||||
* if this interrupt handler is installed, ACPI is enabled.
|
* if this interrupt handler is installed, ACPI is enabled.
|
||||||
@@ -89,18 +80,17 @@ acpi_ev_sci_xrupt_handler (
|
|||||||
* Fixed Events:
|
* Fixed Events:
|
||||||
* Check for and dispatch any Fixed Events that have occurred
|
* Check for and dispatch any Fixed Events that have occurred
|
||||||
*/
|
*/
|
||||||
interrupt_handled |= acpi_ev_fixed_event_detect ();
|
interrupt_handled |= acpi_ev_fixed_event_detect();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* General Purpose Events:
|
* General Purpose Events:
|
||||||
* Check for and dispatch any GPEs that have occurred
|
* Check for and dispatch any GPEs that have occurred
|
||||||
*/
|
*/
|
||||||
interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
|
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
||||||
|
|
||||||
return_VALUE (interrupt_handled);
|
return_VALUE(interrupt_handled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_gpe_xrupt_handler
|
* FUNCTION: acpi_ev_gpe_xrupt_handler
|
||||||
@@ -113,17 +103,13 @@ acpi_ev_sci_xrupt_handler (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32 ACPI_SYSTEM_XFACE
|
u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context)
|
||||||
acpi_ev_gpe_xrupt_handler (
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
struct acpi_gpe_xrupt_info *gpe_xrupt_list = context;
|
||||||
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
u32 interrupt_handled = ACPI_INTERRUPT_NOT_HANDLED;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
|
ACPI_FUNCTION_TRACE("ev_gpe_xrupt_handler");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
* We are guaranteed by the ACPI CA initialization/shutdown code that
|
||||||
* if this interrupt handler is installed, ACPI is enabled.
|
* if this interrupt handler is installed, ACPI is enabled.
|
||||||
@@ -133,12 +119,11 @@ acpi_ev_gpe_xrupt_handler (
|
|||||||
* GPEs:
|
* GPEs:
|
||||||
* Check for and dispatch any GPEs that have occurred
|
* Check for and dispatch any GPEs that have occurred
|
||||||
*/
|
*/
|
||||||
interrupt_handled |= acpi_ev_gpe_detect (gpe_xrupt_list);
|
interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list);
|
||||||
|
|
||||||
return_VALUE (interrupt_handled);
|
return_VALUE(interrupt_handled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_install_sci_handler
|
* FUNCTION: acpi_ev_install_sci_handler
|
||||||
@@ -151,22 +136,18 @@ acpi_ev_gpe_xrupt_handler (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32 acpi_ev_install_sci_handler(void)
|
||||||
acpi_ev_install_sci_handler (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
u32 status = AE_OK;
|
u32 status = AE_OK;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_install_sci_handler");
|
||||||
|
|
||||||
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);
|
||||||
status = acpi_os_install_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
|
return_ACPI_STATUS(status);
|
||||||
acpi_ev_sci_xrupt_handler, acpi_gbl_gpe_xrupt_list_head);
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ev_remove_sci_handler
|
* FUNCTION: acpi_ev_remove_sci_handler
|
||||||
@@ -186,22 +167,16 @@ acpi_ev_install_sci_handler (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ev_remove_sci_handler(void)
|
||||||
acpi_ev_remove_sci_handler (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ev_remove_sci_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ev_remove_sci_handler");
|
||||||
|
|
||||||
/* Just let the OS remove the handler and disable the level */
|
/* Just let the OS remove the handler and disable the level */
|
||||||
|
|
||||||
status = acpi_os_remove_interrupt_handler ((u32) acpi_gbl_FADT->sci_int,
|
status = acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT->sci_int,
|
||||||
acpi_ev_sci_xrupt_handler);
|
acpi_ev_sci_xrupt_handler);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,7 @@
|
|||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evxface")
|
ACPI_MODULE_NAME("evxface")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -64,21 +63,16 @@
|
|||||||
* DESCRIPTION: Saves the pointer to the handler function
|
* DESCRIPTION: Saves the pointer to the handler function
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
acpi_status
|
acpi_status acpi_install_exception_handler(acpi_exception_handler handler)
|
||||||
acpi_install_exception_handler (
|
|
||||||
acpi_exception_handler handler)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_install_exception_handler");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_install_exception_handler");
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow two handlers. */
|
/* Don't allow two handlers. */
|
||||||
@@ -92,12 +86,11 @@ acpi_install_exception_handler (
|
|||||||
|
|
||||||
acpi_gbl_exception_handler = handler;
|
acpi_gbl_exception_handler = handler;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -116,26 +109,22 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_install_fixed_event_handler (
|
acpi_install_fixed_event_handler(u32 event,
|
||||||
u32 event,
|
acpi_event_handler handler, void *context)
|
||||||
acpi_event_handler handler,
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_install_fixed_event_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_install_fixed_event_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (event > ACPI_EVENT_MAX) {
|
if (event > ACPI_EVENT_MAX) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow two handlers. */
|
/* Don't allow two handlers. */
|
||||||
@@ -150,29 +139,29 @@ acpi_install_fixed_event_handler (
|
|||||||
acpi_gbl_fixed_event_handlers[event].handler = handler;
|
acpi_gbl_fixed_event_handlers[event].handler = handler;
|
||||||
acpi_gbl_fixed_event_handlers[event].context = context;
|
acpi_gbl_fixed_event_handlers[event].context = context;
|
||||||
|
|
||||||
status = acpi_clear_event (event);
|
status = acpi_clear_event(event);
|
||||||
if (ACPI_SUCCESS(status))
|
if (ACPI_SUCCESS(status))
|
||||||
status = acpi_enable_event (event, 0);
|
status = acpi_enable_event(event, 0);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
|
"Could not enable fixed event.\n"));
|
||||||
|
|
||||||
/* Remove the handler */
|
/* Remove the handler */
|
||||||
|
|
||||||
acpi_gbl_fixed_event_handlers[event].handler = NULL;
|
acpi_gbl_fixed_event_handlers[event].handler = NULL;
|
||||||
acpi_gbl_fixed_event_handlers[event].context = NULL;
|
acpi_gbl_fixed_event_handlers[event].context = NULL;
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
"Enabled fixed event %X, Handler=%p\n", event,
|
||||||
"Enabled fixed event %X, Handler=%p\n", event, handler));
|
handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_install_fixed_event_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_install_fixed_event_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -188,49 +177,45 @@ EXPORT_SYMBOL(acpi_install_fixed_event_handler);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_remove_fixed_event_handler (
|
acpi_remove_fixed_event_handler(u32 event, acpi_event_handler handler)
|
||||||
u32 event,
|
|
||||||
acpi_event_handler handler)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_remove_fixed_event_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_remove_fixed_event_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (event > ACPI_EVENT_MAX) {
|
if (event > ACPI_EVENT_MAX) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable the event before removing the handler */
|
/* Disable the event before removing the handler */
|
||||||
|
|
||||||
status = acpi_disable_event (event, 0);
|
status = acpi_disable_event(event, 0);
|
||||||
|
|
||||||
/* Always Remove the handler */
|
/* Always Remove the handler */
|
||||||
|
|
||||||
acpi_gbl_fixed_event_handlers[event].handler = NULL;
|
acpi_gbl_fixed_event_handlers[event].handler = NULL;
|
||||||
acpi_gbl_fixed_event_handlers[event].context = NULL;
|
acpi_gbl_fixed_event_handlers[event].context = NULL;
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
"Could not write to fixed event enable register.\n"));
|
"Could not write to fixed event enable register.\n"));
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Disabled fixed event %X.\n",
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", event));
|
event));
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -251,37 +236,32 @@ EXPORT_SYMBOL(acpi_remove_fixed_event_handler);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_install_notify_handler (
|
acpi_install_notify_handler(acpi_handle device,
|
||||||
acpi_handle device,
|
u32 handler_type,
|
||||||
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 *obj_desc;
|
||||||
union acpi_operand_object *notify_obj;
|
union acpi_operand_object *notify_obj;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_install_notify_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_install_notify_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if ((!device) ||
|
if ((!device) ||
|
||||||
(!handler) ||
|
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the device handle */
|
/* Convert and validate the device handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (device);
|
node = acpi_ns_map_handle_to_node(device);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -297,21 +277,21 @@ acpi_install_notify_handler (
|
|||||||
/* Make sure the handler is not already installed */
|
/* Make sure the handler is not already installed */
|
||||||
|
|
||||||
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
||||||
acpi_gbl_system_notify.handler) ||
|
acpi_gbl_system_notify.handler) ||
|
||||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||||
acpi_gbl_device_notify.handler)) {
|
acpi_gbl_device_notify.handler)) {
|
||||||
status = AE_ALREADY_EXISTS;
|
status = AE_ALREADY_EXISTS;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
||||||
acpi_gbl_system_notify.node = node;
|
acpi_gbl_system_notify.node = node;
|
||||||
acpi_gbl_system_notify.handler = handler;
|
acpi_gbl_system_notify.handler = handler;
|
||||||
acpi_gbl_system_notify.context = context;
|
acpi_gbl_system_notify.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
||||||
acpi_gbl_device_notify.node = node;
|
acpi_gbl_device_notify.node = node;
|
||||||
acpi_gbl_device_notify.handler = handler;
|
acpi_gbl_device_notify.handler = handler;
|
||||||
acpi_gbl_device_notify.context = context;
|
acpi_gbl_device_notify.context = context;
|
||||||
}
|
}
|
||||||
@@ -327,29 +307,28 @@ acpi_install_notify_handler (
|
|||||||
else {
|
else {
|
||||||
/* Notifies allowed on this object? */
|
/* Notifies allowed on this object? */
|
||||||
|
|
||||||
if (!acpi_ev_is_notify_object (node)) {
|
if (!acpi_ev_is_notify_object(node)) {
|
||||||
status = AE_TYPE;
|
status = AE_TYPE;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for an existing internal object */
|
/* Check for an existing internal object */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
/* Object exists - make sure there's no handler */
|
/* Object exists - make sure there's no handler */
|
||||||
|
|
||||||
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
||||||
obj_desc->common_notify.system_notify) ||
|
obj_desc->common_notify.system_notify) ||
|
||||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||||
obj_desc->common_notify.device_notify)) {
|
obj_desc->common_notify.device_notify)) {
|
||||||
status = AE_ALREADY_EXISTS;
|
status = AE_ALREADY_EXISTS;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Create a new object */
|
/* Create a new object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (node->type);
|
obj_desc = acpi_ut_create_internal_object(node->type);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -357,25 +336,27 @@ acpi_install_notify_handler (
|
|||||||
|
|
||||||
/* Attach new object to the Node */
|
/* 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 */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install the 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) {
|
if (!notify_obj) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
notify_obj->notify.node = node;
|
notify_obj->notify.node = node;
|
||||||
notify_obj->notify.handler = handler;
|
notify_obj->notify.handler = handler;
|
||||||
notify_obj->notify.context = context;
|
notify_obj->notify.context = context;
|
||||||
|
|
||||||
@@ -390,17 +371,16 @@ acpi_install_notify_handler (
|
|||||||
if (handler_type == ACPI_ALL_NOTIFY) {
|
if (handler_type == ACPI_ALL_NOTIFY) {
|
||||||
/* Extra ref if installed in both */
|
/* Extra ref if installed in both */
|
||||||
|
|
||||||
acpi_ut_add_reference (notify_obj);
|
acpi_ut_add_reference(notify_obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_install_notify_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_install_notify_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -420,36 +400,31 @@ EXPORT_SYMBOL(acpi_install_notify_handler);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_remove_notify_handler (
|
acpi_remove_notify_handler(acpi_handle device,
|
||||||
acpi_handle device,
|
u32 handler_type, acpi_notify_handler handler)
|
||||||
u32 handler_type,
|
|
||||||
acpi_notify_handler handler)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *notify_obj;
|
union acpi_operand_object *notify_obj;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_remove_notify_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_remove_notify_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if ((!device) ||
|
if ((!device) ||
|
||||||
(!handler) ||
|
(!handler) || (handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
||||||
(handler_type > ACPI_MAX_NOTIFY_HANDLER_TYPE)) {
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the device handle */
|
/* Convert and validate the device handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (device);
|
node = acpi_ns_map_handle_to_node(device);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -458,34 +433,34 @@ acpi_remove_notify_handler (
|
|||||||
/* Root Object */
|
/* Root Object */
|
||||||
|
|
||||||
if (device == ACPI_ROOT_OBJECT) {
|
if (device == ACPI_ROOT_OBJECT) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Removing notify handler for ROOT object.\n"));
|
"Removing notify handler for ROOT object.\n"));
|
||||||
|
|
||||||
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
if (((handler_type & ACPI_SYSTEM_NOTIFY) &&
|
||||||
!acpi_gbl_system_notify.handler) ||
|
!acpi_gbl_system_notify.handler) ||
|
||||||
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
((handler_type & ACPI_DEVICE_NOTIFY) &&
|
||||||
!acpi_gbl_device_notify.handler)) {
|
!acpi_gbl_device_notify.handler)) {
|
||||||
status = AE_NOT_EXIST;
|
status = AE_NOT_EXIST;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure all deferred tasks are completed */
|
/* Make sure all deferred tasks are completed */
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
acpi_os_wait_events_complete(NULL);
|
acpi_os_wait_events_complete(NULL);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
||||||
acpi_gbl_system_notify.node = NULL;
|
acpi_gbl_system_notify.node = NULL;
|
||||||
acpi_gbl_system_notify.handler = NULL;
|
acpi_gbl_system_notify.handler = NULL;
|
||||||
acpi_gbl_system_notify.context = NULL;
|
acpi_gbl_system_notify.context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
||||||
acpi_gbl_device_notify.node = NULL;
|
acpi_gbl_device_notify.node = NULL;
|
||||||
acpi_gbl_device_notify.handler = NULL;
|
acpi_gbl_device_notify.handler = NULL;
|
||||||
acpi_gbl_device_notify.context = NULL;
|
acpi_gbl_device_notify.context = NULL;
|
||||||
}
|
}
|
||||||
@@ -496,14 +471,14 @@ acpi_remove_notify_handler (
|
|||||||
else {
|
else {
|
||||||
/* Notifies allowed on this object? */
|
/* Notifies allowed on this object? */
|
||||||
|
|
||||||
if (!acpi_ev_is_notify_object (node)) {
|
if (!acpi_ev_is_notify_object(node)) {
|
||||||
status = AE_TYPE;
|
status = AE_TYPE;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for an existing internal object */
|
/* Check for an existing internal object */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NOT_EXIST;
|
status = AE_NOT_EXIST;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -514,53 +489,52 @@ acpi_remove_notify_handler (
|
|||||||
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
if (handler_type & ACPI_SYSTEM_NOTIFY) {
|
||||||
notify_obj = obj_desc->common_notify.system_notify;
|
notify_obj = obj_desc->common_notify.system_notify;
|
||||||
if ((!notify_obj) ||
|
if ((!notify_obj) ||
|
||||||
(notify_obj->notify.handler != handler)) {
|
(notify_obj->notify.handler != handler)) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
/* Make sure all deferred tasks are completed */
|
/* Make sure all deferred tasks are completed */
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
acpi_os_wait_events_complete(NULL);
|
acpi_os_wait_events_complete(NULL);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the handler */
|
/* Remove the handler */
|
||||||
obj_desc->common_notify.system_notify = NULL;
|
obj_desc->common_notify.system_notify = NULL;
|
||||||
acpi_ut_remove_reference (notify_obj);
|
acpi_ut_remove_reference(notify_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
if (handler_type & ACPI_DEVICE_NOTIFY) {
|
||||||
notify_obj = obj_desc->common_notify.device_notify;
|
notify_obj = obj_desc->common_notify.device_notify;
|
||||||
if ((!notify_obj) ||
|
if ((!notify_obj) ||
|
||||||
(notify_obj->notify.handler != handler)) {
|
(notify_obj->notify.handler != handler)) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
/* Make sure all deferred tasks are completed */
|
/* Make sure all deferred tasks are completed */
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
acpi_os_wait_events_complete(NULL);
|
acpi_os_wait_events_complete(NULL);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the handler */
|
/* Remove the handler */
|
||||||
obj_desc->common_notify.device_notify = NULL;
|
obj_desc->common_notify.device_notify = NULL;
|
||||||
acpi_ut_remove_reference (notify_obj);
|
acpi_ut_remove_reference(notify_obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_remove_notify_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_remove_notify_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -581,36 +555,31 @@ EXPORT_SYMBOL(acpi_remove_notify_handler);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_install_gpe_handler (
|
acpi_install_gpe_handler(acpi_handle gpe_device,
|
||||||
acpi_handle gpe_device,
|
u32 gpe_number,
|
||||||
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_gpe_event_info *gpe_event_info;
|
||||||
struct acpi_handler_info *handler;
|
struct acpi_handler_info *handler;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_install_gpe_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_install_gpe_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
|
if ((!address) || (type > ACPI_GPE_XRUPT_TYPE_MASK)) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -618,49 +587,49 @@ acpi_install_gpe_handler (
|
|||||||
|
|
||||||
/* Make sure that there isn't a handler there already */
|
/* 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;
|
status = AE_ALREADY_EXISTS;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate and init handler object */
|
/* Allocate and init handler object */
|
||||||
|
|
||||||
handler = ACPI_MEM_CALLOCATE (sizeof (struct acpi_handler_info));
|
handler = ACPI_MEM_CALLOCATE(sizeof(struct acpi_handler_info));
|
||||||
if (!handler) {
|
if (!handler) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->address = address;
|
handler->address = address;
|
||||||
handler->context = context;
|
handler->context = context;
|
||||||
handler->method_node = gpe_event_info->dispatch.method_node;
|
handler->method_node = gpe_event_info->dispatch.method_node;
|
||||||
|
|
||||||
/* Disable the GPE before installing the handler */
|
/* Disable the GPE before installing the handler */
|
||||||
|
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install the handler */
|
/* Install the handler */
|
||||||
|
|
||||||
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||||
gpe_event_info->dispatch.handler = handler;
|
gpe_event_info->dispatch.handler = handler;
|
||||||
|
|
||||||
/* Setup up dispatch flags to indicate handler (vs. method) */
|
/* Setup up dispatch flags to indicate handler (vs. method) */
|
||||||
|
|
||||||
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
|
gpe_event_info->flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
|
||||||
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
|
gpe_event_info->flags |= (u8) (type | ACPI_GPE_DISPATCH_HANDLER);
|
||||||
|
|
||||||
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_install_gpe_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_install_gpe_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -678,34 +647,30 @@ EXPORT_SYMBOL(acpi_install_gpe_handler);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_remove_gpe_handler (
|
acpi_remove_gpe_handler(acpi_handle gpe_device,
|
||||||
acpi_handle gpe_device,
|
u32 gpe_number, acpi_event_handler address)
|
||||||
u32 gpe_number,
|
|
||||||
acpi_event_handler address)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
struct acpi_handler_info *handler;
|
struct acpi_handler_info *handler;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_remove_gpe_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_remove_gpe_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!address) {
|
if (!address) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -713,7 +678,8 @@ acpi_remove_gpe_handler (
|
|||||||
|
|
||||||
/* Make sure that a handler is indeed installed */
|
/* 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;
|
status = AE_NOT_EXIST;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
@@ -727,45 +693,44 @@ acpi_remove_gpe_handler (
|
|||||||
|
|
||||||
/* Disable the GPE before removing the handler */
|
/* Disable the GPE before removing the handler */
|
||||||
|
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure all deferred tasks are completed */
|
/* Make sure all deferred tasks are completed */
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
acpi_os_wait_events_complete(NULL);
|
acpi_os_wait_events_complete(NULL);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the handler */
|
/* Remove the handler */
|
||||||
|
|
||||||
flags = acpi_os_acquire_lock (acpi_gbl_gpe_lock);
|
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||||
handler = gpe_event_info->dispatch.handler;
|
handler = gpe_event_info->dispatch.handler;
|
||||||
|
|
||||||
/* Restore Method node (if any), set dispatch flags */
|
/* Restore Method node (if any), set dispatch flags */
|
||||||
|
|
||||||
gpe_event_info->dispatch.method_node = handler->method_node;
|
gpe_event_info->dispatch.method_node = handler->method_node;
|
||||||
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
|
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
|
||||||
if (handler->method_node) {
|
if (handler->method_node) {
|
||||||
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
|
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
|
||||||
}
|
}
|
||||||
acpi_os_release_lock (acpi_gbl_gpe_lock, flags);
|
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||||
|
|
||||||
/* Now we can free the handler object */
|
/* Now we can free the handler object */
|
||||||
|
|
||||||
ACPI_MEM_FREE (handler);
|
ACPI_MEM_FREE(handler);
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_remove_gpe_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_remove_gpe_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -781,35 +746,31 @@ EXPORT_SYMBOL(acpi_remove_gpe_handler);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
|
||||||
acpi_acquire_global_lock (
|
|
||||||
u16 timeout,
|
|
||||||
u32 *handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_enter_interpreter ();
|
status = acpi_ex_enter_interpreter();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ev_acquire_global_lock (timeout);
|
status = acpi_ev_acquire_global_lock(timeout);
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
acpi_gbl_global_lock_handle++;
|
acpi_gbl_global_lock_handle++;
|
||||||
*handle = acpi_gbl_global_lock_handle;
|
*handle = acpi_gbl_global_lock_handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_acquire_global_lock);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_acquire_global_lock);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -823,19 +784,16 @@ EXPORT_SYMBOL(acpi_acquire_global_lock);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_release_global_lock(u32 handle)
|
||||||
acpi_release_global_lock (
|
|
||||||
u32 handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
if (handle != acpi_gbl_global_lock_handle) {
|
if (handle != acpi_gbl_global_lock_handle) {
|
||||||
return (AE_NOT_ACQUIRED);
|
return (AE_NOT_ACQUIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ev_release_global_lock ();
|
status = acpi_ev_release_global_lock();
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_release_global_lock);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_release_global_lock);
|
||||||
|
|||||||
@@ -48,8 +48,7 @@
|
|||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evxfevnt")
|
ACPI_MODULE_NAME("evxfevnt")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -62,44 +61,39 @@
|
|||||||
* DESCRIPTION: Transfers the system into ACPI mode.
|
* DESCRIPTION: Transfers the system into ACPI mode.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
acpi_status acpi_enable(void)
|
||||||
acpi_status
|
|
||||||
acpi_enable (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_enable");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_enable");
|
/* Make sure we have the FADT */
|
||||||
|
|
||||||
|
|
||||||
/* Make sure we have the FADT*/
|
|
||||||
|
|
||||||
if (!acpi_gbl_FADT) {
|
if (!acpi_gbl_FADT) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
"No FADT information present!\n"));
|
||||||
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_ACPI) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||||
}
|
"System is already in ACPI mode\n"));
|
||||||
else {
|
} else {
|
||||||
/* Transition to ACPI mode */
|
/* Transition to ACPI mode */
|
||||||
|
|
||||||
status = acpi_hw_set_mode (ACPI_SYS_MODE_ACPI);
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_ACPI);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
|
ACPI_REPORT_ERROR(("Could not transition to ACPI mode.\n"));
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||||
"Transition to ACPI mode successful\n"));
|
"Transition to ACPI mode successful\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_disable
|
* FUNCTION: acpi_disable
|
||||||
@@ -112,43 +106,38 @@ acpi_enable (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_disable(void)
|
||||||
acpi_disable (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_disable");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_disable");
|
||||||
|
|
||||||
if (!acpi_gbl_FADT) {
|
if (!acpi_gbl_FADT) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
"No FADT information present!\n"));
|
||||||
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
if (acpi_hw_get_mode() == ACPI_SYS_MODE_LEGACY) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||||
"System is already in legacy (non-ACPI) mode\n"));
|
"System is already in legacy (non-ACPI) mode\n"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Transition to LEGACY mode */
|
/* Transition to LEGACY mode */
|
||||||
|
|
||||||
status = acpi_hw_set_mode (ACPI_SYS_MODE_LEGACY);
|
status = acpi_hw_set_mode(ACPI_SYS_MODE_LEGACY);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not exit ACPI mode to legacy mode"));
|
"Could not exit ACPI mode to legacy mode"));
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT, "ACPI mode disabled\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_enable_event
|
* FUNCTION: acpi_enable_event
|
||||||
@@ -162,52 +151,50 @@ acpi_disable (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_enable_event(u32 event, u32 flags)
|
||||||
acpi_enable_event (
|
|
||||||
u32 event,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_enable_event");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_enable_event");
|
||||||
|
|
||||||
/* Decode the Fixed Event */
|
/* Decode the Fixed Event */
|
||||||
|
|
||||||
if (event > ACPI_EVENT_MAX) {
|
if (event > ACPI_EVENT_MAX) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable the requested fixed event (by writing a one to the
|
* Enable the requested fixed event (by writing a one to the
|
||||||
* enable register bit)
|
* enable register bit)
|
||||||
*/
|
*/
|
||||||
status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
status =
|
||||||
1, ACPI_MTX_LOCK);
|
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||||
if (ACPI_FAILURE (status)) {
|
enable_register_id, 1, ACPI_MTX_LOCK);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the hardware responded */
|
/* Make sure that the hardware responded */
|
||||||
|
|
||||||
status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
status =
|
||||||
&value, ACPI_MTX_LOCK);
|
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||||
if (ACPI_FAILURE (status)) {
|
enable_register_id, &value, ACPI_MTX_LOCK);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != 1) {
|
if (value != 1) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not enable %s event\n", acpi_ut_get_event_name (event)));
|
"Could not enable %s event\n",
|
||||||
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
|
acpi_ut_get_event_name(event)));
|
||||||
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_enable_event);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_enable_event);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -223,40 +210,34 @@ EXPORT_SYMBOL(acpi_enable_event);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_set_gpe_type(acpi_handle gpe_device, u32 gpe_number, u8 type)
|
||||||
acpi_set_gpe_type (
|
|
||||||
acpi_handle gpe_device,
|
|
||||||
u32 gpe_number,
|
|
||||||
u8 type)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_set_gpe_type");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_set_gpe_type");
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
|
if ((gpe_event_info->flags & ACPI_GPE_TYPE_MASK) == type) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the new type (will disable GPE if currently enabled) */
|
/* Set the new type (will disable GPE if currently enabled) */
|
||||||
|
|
||||||
status = acpi_ev_set_gpe_type (gpe_event_info, type);
|
status = acpi_ev_set_gpe_type(gpe_event_info, type);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_set_gpe_type);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_set_gpe_type);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -273,31 +254,25 @@ EXPORT_SYMBOL(acpi_set_gpe_type);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
|
||||||
acpi_enable_gpe (
|
|
||||||
acpi_handle gpe_device,
|
|
||||||
u32 gpe_number,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_enable_gpe");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_enable_gpe");
|
||||||
|
|
||||||
/* Use semaphore lock if not executing at interrupt level */
|
/* Use semaphore lock if not executing at interrupt level */
|
||||||
|
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -305,16 +280,16 @@ acpi_enable_gpe (
|
|||||||
|
|
||||||
/* Perform the enable */
|
/* Perform the enable */
|
||||||
|
|
||||||
status = acpi_ev_enable_gpe (gpe_event_info, TRUE);
|
status = acpi_ev_enable_gpe(gpe_event_info, TRUE);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_enable_gpe);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_enable_gpe);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -331,46 +306,39 @@ EXPORT_SYMBOL(acpi_enable_gpe);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
|
||||||
acpi_disable_gpe (
|
|
||||||
acpi_handle gpe_device,
|
|
||||||
u32 gpe_number,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_disable_gpe");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_disable_gpe");
|
||||||
|
|
||||||
/* Use semaphore lock if not executing at interrupt level */
|
/* Use semaphore lock if not executing at interrupt level */
|
||||||
|
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ev_disable_gpe (gpe_event_info);
|
status = acpi_ev_disable_gpe(gpe_event_info);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_disable_event
|
* FUNCTION: acpi_disable_event
|
||||||
@@ -384,50 +352,48 @@ unlock_and_exit:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_disable_event(u32 event, u32 flags)
|
||||||
acpi_disable_event (
|
|
||||||
u32 event,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_disable_event");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_disable_event");
|
||||||
|
|
||||||
/* Decode the Fixed Event */
|
/* Decode the Fixed Event */
|
||||||
|
|
||||||
if (event > ACPI_EVENT_MAX) {
|
if (event > ACPI_EVENT_MAX) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable the requested fixed event (by writing a zero to the
|
* Disable the requested fixed event (by writing a zero to the
|
||||||
* enable register bit)
|
* enable register bit)
|
||||||
*/
|
*/
|
||||||
status = acpi_set_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
status =
|
||||||
0, ACPI_MTX_LOCK);
|
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||||
if (ACPI_FAILURE (status)) {
|
enable_register_id, 0, ACPI_MTX_LOCK);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_get_register (acpi_gbl_fixed_event_info[event].enable_register_id,
|
status =
|
||||||
&value, ACPI_MTX_LOCK);
|
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||||
if (ACPI_FAILURE (status)) {
|
enable_register_id, &value, ACPI_MTX_LOCK);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not disable %s events\n", acpi_ut_get_event_name (event)));
|
"Could not disable %s events\n",
|
||||||
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
|
acpi_ut_get_event_name(event)));
|
||||||
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_disable_event);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_disable_event);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -441,33 +407,30 @@ EXPORT_SYMBOL(acpi_disable_event);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_clear_event(u32 event)
|
||||||
acpi_clear_event (
|
|
||||||
u32 event)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_clear_event");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_clear_event");
|
||||||
|
|
||||||
/* Decode the Fixed Event */
|
/* Decode the Fixed Event */
|
||||||
|
|
||||||
if (event > ACPI_EVENT_MAX) {
|
if (event > ACPI_EVENT_MAX) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clear the requested fixed event (By writing a one to the
|
* Clear the requested fixed event (By writing a one to the
|
||||||
* status register bit)
|
* status register bit)
|
||||||
*/
|
*/
|
||||||
status = acpi_set_register (acpi_gbl_fixed_event_info[event].status_register_id,
|
status =
|
||||||
1, ACPI_MTX_LOCK);
|
acpi_set_register(acpi_gbl_fixed_event_info[event].
|
||||||
|
status_register_id, 1, ACPI_MTX_LOCK);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_clear_event);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_clear_event);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -483,46 +446,39 @@ EXPORT_SYMBOL(acpi_clear_event);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
|
||||||
acpi_clear_gpe (
|
|
||||||
acpi_handle gpe_device,
|
|
||||||
u32 gpe_number,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_clear_gpe");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_clear_gpe");
|
||||||
|
|
||||||
/* Use semaphore lock if not executing at interrupt level */
|
/* Use semaphore lock if not executing at interrupt level */
|
||||||
|
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_hw_clear_gpe (gpe_event_info);
|
status = acpi_hw_clear_gpe(gpe_event_info);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -538,36 +494,31 @@ unlock_and_exit:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_get_event_status(u32 event, acpi_event_status * event_status)
|
||||||
acpi_get_event_status (
|
|
||||||
u32 event,
|
|
||||||
acpi_event_status *event_status)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_event_status");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_event_status");
|
||||||
|
|
||||||
if (!event_status) {
|
if (!event_status) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decode the Fixed Event */
|
/* Decode the Fixed Event */
|
||||||
|
|
||||||
if (event > ACPI_EVENT_MAX) {
|
if (event > ACPI_EVENT_MAX) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the status of the requested fixed event */
|
/* Get the status of the requested fixed event */
|
||||||
|
|
||||||
status = acpi_get_register (acpi_gbl_fixed_event_info[event].status_register_id,
|
status =
|
||||||
event_status, ACPI_MTX_LOCK);
|
acpi_get_register(acpi_gbl_fixed_event_info[event].
|
||||||
|
status_register_id, event_status, ACPI_MTX_LOCK);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_gpe_status
|
* FUNCTION: acpi_get_gpe_status
|
||||||
@@ -585,31 +536,26 @@ acpi_get_event_status (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_gpe_status (
|
acpi_get_gpe_status(acpi_handle gpe_device,
|
||||||
acpi_handle gpe_device,
|
u32 gpe_number, u32 flags, acpi_event_status * event_status)
|
||||||
u32 gpe_number,
|
|
||||||
u32 flags,
|
|
||||||
acpi_event_status *event_status)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_gpe_event_info *gpe_event_info;
|
struct acpi_gpe_event_info *gpe_event_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_gpe_status");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_gpe_status");
|
||||||
|
|
||||||
/* Use semaphore lock if not executing at interrupt level */
|
/* Use semaphore lock if not executing at interrupt level */
|
||||||
|
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EVENTS);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure that we have a valid GPE number */
|
/* Ensure that we have a valid GPE number */
|
||||||
|
|
||||||
gpe_event_info = acpi_ev_get_gpe_event_info (gpe_device, gpe_number);
|
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||||
if (!gpe_event_info) {
|
if (!gpe_event_info) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -617,16 +563,15 @@ acpi_get_gpe_status (
|
|||||||
|
|
||||||
/* Obtain status on the requested GPE number */
|
/* Obtain status on the requested GPE number */
|
||||||
|
|
||||||
status = acpi_hw_get_gpe_status (gpe_event_info, event_status);
|
status = acpi_hw_get_gpe_status(gpe_event_info, event_status);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (flags & ACPI_NOT_ISR) {
|
if (flags & ACPI_NOT_ISR) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_EVENTS);
|
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -644,33 +589,27 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_install_gpe_block (
|
acpi_install_gpe_block(acpi_handle gpe_device,
|
||||||
acpi_handle gpe_device,
|
struct acpi_generic_address *gpe_block_address,
|
||||||
struct acpi_generic_address *gpe_block_address,
|
u32 register_count, u32 interrupt_number)
|
||||||
u32 register_count,
|
|
||||||
u32 interrupt_number)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
struct acpi_gpe_block_info *gpe_block;
|
struct acpi_gpe_block_info *gpe_block;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_install_gpe_block");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_install_gpe_block");
|
if ((!gpe_device) || (!gpe_block_address) || (!register_count)) {
|
||||||
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
|
|
||||||
if ((!gpe_device) ||
|
|
||||||
(!gpe_block_address) ||
|
|
||||||
(!register_count)) {
|
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (gpe_device);
|
node = acpi_ns_map_handle_to_node(gpe_device);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -680,31 +619,33 @@ acpi_install_gpe_block (
|
|||||||
* For user-installed GPE Block Devices, the gpe_block_base_number
|
* For user-installed GPE Block Devices, the gpe_block_base_number
|
||||||
* is always zero
|
* is always zero
|
||||||
*/
|
*/
|
||||||
status = acpi_ev_create_gpe_block (node, gpe_block_address, register_count,
|
status =
|
||||||
0, interrupt_number, &gpe_block);
|
acpi_ev_create_gpe_block(node, gpe_block_address, register_count, 0,
|
||||||
if (ACPI_FAILURE (status)) {
|
interrupt_number, &gpe_block);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the device_object attached to the node */
|
/* Get the device_object attached to the node */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
/* No object, create a new one */
|
/* No object, create a new one */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_DEVICE);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_DEVICE);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto unlock_and_exit;
|
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 */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -713,13 +654,12 @@ acpi_install_gpe_block (
|
|||||||
|
|
||||||
obj_desc->device.gpe_block = gpe_block;
|
obj_desc->device.gpe_block = gpe_block;
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_install_gpe_block);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_install_gpe_block);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -733,28 +673,24 @@ EXPORT_SYMBOL(acpi_install_gpe_block);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_remove_gpe_block(acpi_handle gpe_device)
|
||||||
acpi_remove_gpe_block (
|
|
||||||
acpi_handle gpe_device)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_remove_gpe_block");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_remove_gpe_block");
|
||||||
|
|
||||||
if (!gpe_device) {
|
if (!gpe_device) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (gpe_device);
|
node = acpi_ns_map_handle_to_node(gpe_device);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -762,22 +698,21 @@ acpi_remove_gpe_block (
|
|||||||
|
|
||||||
/* Get the device_object attached to the node */
|
/* Get the device_object attached to the node */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc ||
|
if (!obj_desc || !obj_desc->device.gpe_block) {
|
||||||
!obj_desc->device.gpe_block) {
|
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete the GPE block (but not the device_object) */
|
/* Delete the GPE block (but not the device_object) */
|
||||||
|
|
||||||
status = acpi_ev_delete_gpe_block (obj_desc->device.gpe_block);
|
status = acpi_ev_delete_gpe_block(obj_desc->device.gpe_block);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
obj_desc->device.gpe_block = NULL;
|
obj_desc->device.gpe_block = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_remove_gpe_block);
|
EXPORT_SYMBOL(acpi_remove_gpe_block);
|
||||||
|
|||||||
@@ -49,8 +49,7 @@
|
|||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EVENTS
|
#define _COMPONENT ACPI_EVENTS
|
||||||
ACPI_MODULE_NAME ("evxfregn")
|
ACPI_MODULE_NAME("evxfregn")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -67,36 +66,31 @@
|
|||||||
* DESCRIPTION: Install a handler for all op_regions of a given space_id.
|
* DESCRIPTION: Install a handler for all op_regions of a given space_id.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_install_address_space_handler (
|
acpi_install_address_space_handler(acpi_handle device,
|
||||||
acpi_handle device,
|
acpi_adr_space_type space_id,
|
||||||
acpi_adr_space_type space_id,
|
acpi_adr_space_handler handler,
|
||||||
acpi_adr_space_handler handler,
|
acpi_adr_space_setup setup, void *context)
|
||||||
acpi_adr_space_setup setup,
|
|
||||||
void *context)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_install_address_space_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_install_address_space_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the device handle */
|
/* Convert and validate the device handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (device);
|
node = acpi_ns_map_handle_to_node(device);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -104,21 +98,23 @@ acpi_install_address_space_handler (
|
|||||||
|
|
||||||
/* Install the handler for all Regions for this Space ID */
|
/* Install the handler for all Regions for this Space ID */
|
||||||
|
|
||||||
status = acpi_ev_install_space_handler (node, space_id, handler, setup, context);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ev_install_space_handler(node, space_id, handler, setup,
|
||||||
|
context);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Run all _REG methods for this address space */
|
/* Run all _REG methods for this address space */
|
||||||
|
|
||||||
status = acpi_ev_execute_reg_methods (node, space_id);
|
status = acpi_ev_execute_reg_methods(node, space_id);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_install_address_space_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_install_address_space_handler);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -135,36 +131,33 @@ EXPORT_SYMBOL(acpi_install_address_space_handler);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_remove_address_space_handler (
|
acpi_remove_address_space_handler(acpi_handle device,
|
||||||
acpi_handle device,
|
acpi_adr_space_type space_id,
|
||||||
acpi_adr_space_type space_id,
|
acpi_adr_space_handler handler)
|
||||||
acpi_adr_space_handler handler)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *handler_obj;
|
union acpi_operand_object *handler_obj;
|
||||||
union acpi_operand_object *region_obj;
|
union acpi_operand_object *region_obj;
|
||||||
union acpi_operand_object **last_obj_ptr;
|
union acpi_operand_object **last_obj_ptr;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_remove_address_space_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_remove_address_space_handler");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the device handle */
|
/* Convert and validate the device handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (device);
|
node = acpi_ns_map_handle_to_node(device);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -172,7 +165,7 @@ acpi_remove_address_space_handler (
|
|||||||
|
|
||||||
/* Make sure the internal object exists */
|
/* Make sure the internal object exists */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NOT_EXIST;
|
status = AE_NOT_EXIST;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -188,10 +181,11 @@ acpi_remove_address_space_handler (
|
|||||||
if (handler_obj->address_space.space_id == space_id) {
|
if (handler_obj->address_space.space_id == space_id) {
|
||||||
/* Matched space_id, first dereference this in the Regions */
|
/* Matched space_id, first dereference this in the Regions */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||||
"Removing address handler %p(%p) for region %s on Device %p(%p)\n",
|
"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,
|
||||||
node, obj_desc));
|
acpi_ut_get_region_name(space_id),
|
||||||
|
node, obj_desc));
|
||||||
|
|
||||||
region_obj = handler_obj->address_space.region_list;
|
region_obj = handler_obj->address_space.region_list;
|
||||||
|
|
||||||
@@ -205,13 +199,14 @@ acpi_remove_address_space_handler (
|
|||||||
* The region is just inaccessible as indicated to
|
* The region is just inaccessible as indicated to
|
||||||
* the _REG method
|
* the _REG method
|
||||||
*/
|
*/
|
||||||
acpi_ev_detach_region (region_obj, TRUE);
|
acpi_ev_detach_region(region_obj, TRUE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Walk the list: Just grab the head because the
|
* Walk the list: Just grab the head because the
|
||||||
* detach_region removed the previous head.
|
* detach_region removed the previous head.
|
||||||
*/
|
*/
|
||||||
region_obj = handler_obj->address_space.region_list;
|
region_obj =
|
||||||
|
handler_obj->address_space.region_list;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,7 +216,7 @@ acpi_remove_address_space_handler (
|
|||||||
|
|
||||||
/* Now we can delete the handler object */
|
/* Now we can delete the handler object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (handler_obj);
|
acpi_ut_remove_reference(handler_obj);
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,15 +228,16 @@ acpi_remove_address_space_handler (
|
|||||||
|
|
||||||
/* The handler does not exist */
|
/* The handler does not exist */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
|
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
|
||||||
"Unable to remove address handler %p for %s(%X), dev_node %p, obj %p\n",
|
"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;
|
status = AE_NOT_EXIST;
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_remove_address_space_handler);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_remove_address_space_handler);
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -50,18 +49,14 @@
|
|||||||
#include <acpi/actables.h>
|
#include <acpi/actables.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exconfig")
|
ACPI_MODULE_NAME("exconfig")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_add_table (
|
acpi_ex_add_table(struct acpi_table_header *table,
|
||||||
struct acpi_table_header *table,
|
struct acpi_namespace_node *parent_node,
|
||||||
struct acpi_namespace_node *parent_node,
|
union acpi_operand_object **ddb_handle);
|
||||||
union acpi_operand_object **ddb_handle);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -79,24 +74,21 @@ acpi_ex_add_table (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_add_table (
|
acpi_ex_add_table(struct acpi_table_header *table,
|
||||||
struct acpi_table_header *table,
|
struct acpi_namespace_node *parent_node,
|
||||||
struct acpi_namespace_node *parent_node,
|
union acpi_operand_object **ddb_handle)
|
||||||
union acpi_operand_object **ddb_handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_table_desc table_info;
|
struct acpi_table_desc table_info;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_add_table");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_add_table");
|
||||||
|
|
||||||
/* Create an object to be the table handle */
|
/* Create an object to be the table handle */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init the table handle */
|
/* Init the table handle */
|
||||||
@@ -106,45 +98,43 @@ acpi_ex_add_table (
|
|||||||
|
|
||||||
/* Install the new table into the local data structures */
|
/* Install the new table into the local data structures */
|
||||||
|
|
||||||
ACPI_MEMSET (&table_info, 0, sizeof (struct acpi_table_desc));
|
ACPI_MEMSET(&table_info, 0, sizeof(struct acpi_table_desc));
|
||||||
|
|
||||||
table_info.type = ACPI_TABLE_SSDT;
|
table_info.type = ACPI_TABLE_SSDT;
|
||||||
table_info.pointer = table;
|
table_info.pointer = table;
|
||||||
table_info.length = (acpi_size) table->length;
|
table_info.length = (acpi_size) table->length;
|
||||||
table_info.allocation = ACPI_MEM_ALLOCATED;
|
table_info.allocation = ACPI_MEM_ALLOCATED;
|
||||||
|
|
||||||
status = acpi_tb_install_table (&table_info);
|
status = acpi_tb_install_table(&table_info);
|
||||||
obj_desc->reference.object = table_info.installed_desc;
|
obj_desc->reference.object = table_info.installed_desc;
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_ALREADY_EXISTS) {
|
if (status == AE_ALREADY_EXISTS) {
|
||||||
/* Table already exists, just return the handle */
|
/* Table already exists, just return the handle */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the table to the namespace */
|
/* Add the table to the namespace */
|
||||||
|
|
||||||
status = acpi_ns_load_table (table_info.installed_desc, parent_node);
|
status = acpi_ns_load_table(table_info.installed_desc, parent_node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/* Uninstall table on error */
|
/* Uninstall table on error */
|
||||||
|
|
||||||
(void) acpi_tb_uninstall_table (table_info.installed_desc);
|
(void)acpi_tb_uninstall_table(table_info.installed_desc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
acpi_ut_remove_reference(obj_desc);
|
||||||
acpi_ut_remove_reference (obj_desc);
|
|
||||||
*ddb_handle = NULL;
|
*ddb_handle = NULL;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_load_table_op
|
* FUNCTION: acpi_ex_load_table_op
|
||||||
@@ -159,56 +149,53 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_load_table_op (
|
acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_operand_object **return_desc)
|
||||||
union acpi_operand_object **return_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object **operand = &walk_state->operands[0];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
struct acpi_table_header *table;
|
struct acpi_table_header *table;
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
struct acpi_namespace_node *start_node;
|
struct acpi_namespace_node *start_node;
|
||||||
struct acpi_namespace_node *parameter_node = NULL;
|
struct acpi_namespace_node *parameter_node = NULL;
|
||||||
union acpi_operand_object *ddb_handle;
|
union acpi_operand_object *ddb_handle;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_load_table_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_load_table_op");
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* Make sure that the signature does not match one of the tables that
|
* Make sure that the signature does not match one of the tables that
|
||||||
* is already loaded.
|
* is already loaded.
|
||||||
*/
|
*/
|
||||||
status = acpi_tb_match_signature (operand[0]->string.pointer, NULL);
|
status = acpi_tb_match_signature(operand[0]->string.pointer, NULL);
|
||||||
if (status == AE_OK) {
|
if (status == AE_OK) {
|
||||||
/* Signature matched -- don't allow override */
|
/* Signature matched -- don't allow override */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_ALREADY_EXISTS);
|
return_ACPI_STATUS(AE_ALREADY_EXISTS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Find the ACPI table */
|
/* Find the ACPI table */
|
||||||
|
|
||||||
status = acpi_tb_find_table (operand[0]->string.pointer,
|
status = acpi_tb_find_table(operand[0]->string.pointer,
|
||||||
operand[1]->string.pointer,
|
operand[1]->string.pointer,
|
||||||
operand[2]->string.pointer, &table);
|
operand[2]->string.pointer, &table);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status != AE_NOT_FOUND) {
|
if (status != AE_NOT_FOUND) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Table not found, return an Integer=0 and AE_OK */
|
/* Table not found, return an Integer=0 and AE_OK */
|
||||||
|
|
||||||
ddb_handle = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
ddb_handle = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!ddb_handle) {
|
if (!ddb_handle) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
ddb_handle->integer.value = 0;
|
ddb_handle->integer.value = 0;
|
||||||
*return_desc = ddb_handle;
|
*return_desc = ddb_handle;
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Default nodes */
|
/* Default nodes */
|
||||||
@@ -223,10 +210,12 @@ acpi_ex_load_table_op (
|
|||||||
* Find the node referenced by the root_path_string. This is the
|
* Find the node referenced by the root_path_string. This is the
|
||||||
* location within the namespace where the table will be loaded.
|
* location within the namespace where the table will be loaded.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_get_node_by_path (operand[3]->string.pointer, start_node,
|
status =
|
||||||
ACPI_NS_SEARCH_PARENT, &parent_node);
|
acpi_ns_get_node_by_path(operand[3]->string.pointer,
|
||||||
if (ACPI_FAILURE (status)) {
|
start_node, ACPI_NS_SEARCH_PARENT,
|
||||||
return_ACPI_STATUS (status);
|
&parent_node);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +223,7 @@ acpi_ex_load_table_op (
|
|||||||
|
|
||||||
if (operand[4]->string.length > 0) {
|
if (operand[4]->string.length > 0) {
|
||||||
if ((operand[4]->string.pointer[0] != '\\') &&
|
if ((operand[4]->string.pointer[0] != '\\') &&
|
||||||
(operand[4]->string.pointer[0] != '^')) {
|
(operand[4]->string.pointer[0] != '^')) {
|
||||||
/*
|
/*
|
||||||
* Path is not absolute, so it will be relative to the node
|
* Path is not absolute, so it will be relative to the node
|
||||||
* referenced by the root_path_string (or the NS root if omitted)
|
* referenced by the root_path_string (or the NS root if omitted)
|
||||||
@@ -244,18 +233,20 @@ acpi_ex_load_table_op (
|
|||||||
|
|
||||||
/* Find the node referenced by the parameter_path_string */
|
/* Find the node referenced by the parameter_path_string */
|
||||||
|
|
||||||
status = acpi_ns_get_node_by_path (operand[4]->string.pointer, start_node,
|
status =
|
||||||
ACPI_NS_SEARCH_PARENT, ¶meter_node);
|
acpi_ns_get_node_by_path(operand[4]->string.pointer,
|
||||||
if (ACPI_FAILURE (status)) {
|
start_node, ACPI_NS_SEARCH_PARENT,
|
||||||
return_ACPI_STATUS (status);
|
¶meter_node);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the table into the namespace */
|
/* Load the table into the namespace */
|
||||||
|
|
||||||
status = acpi_ex_add_table (table, parent_node, &ddb_handle);
|
status = acpi_ex_add_table(table, parent_node, &ddb_handle);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parameter Data (optional) */
|
/* Parameter Data (optional) */
|
||||||
@@ -263,20 +254,20 @@ acpi_ex_load_table_op (
|
|||||||
if (parameter_node) {
|
if (parameter_node) {
|
||||||
/* Store the parameter data into the optional parameter object */
|
/* Store the parameter data into the optional parameter object */
|
||||||
|
|
||||||
status = acpi_ex_store (operand[5],
|
status = acpi_ex_store(operand[5],
|
||||||
ACPI_CAST_PTR (union acpi_operand_object, parameter_node),
|
ACPI_CAST_PTR(union acpi_operand_object,
|
||||||
walk_state);
|
parameter_node),
|
||||||
if (ACPI_FAILURE (status)) {
|
walk_state);
|
||||||
(void) acpi_ex_unload_table (ddb_handle);
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
(void)acpi_ex_unload_table(ddb_handle);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*return_desc = ddb_handle;
|
*return_desc = ddb_handle;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_load_op
|
* FUNCTION: acpi_ex_load_op
|
||||||
@@ -293,38 +284,37 @@ acpi_ex_load_table_op (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_load_op (
|
acpi_ex_load_op(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object *target,
|
||||||
union acpi_operand_object *target,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *ddb_handle;
|
union acpi_operand_object *ddb_handle;
|
||||||
union acpi_operand_object *buffer_desc = NULL;
|
union acpi_operand_object *buffer_desc = NULL;
|
||||||
struct acpi_table_header *table_ptr = NULL;
|
struct acpi_table_header *table_ptr = NULL;
|
||||||
acpi_physical_address address;
|
acpi_physical_address address;
|
||||||
struct acpi_table_header table_header;
|
struct acpi_table_header table_header;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_load_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_load_op");
|
||||||
|
|
||||||
/* Object can be either an op_region or a Field */
|
/* Object can be either an op_region or a Field */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_REGION:
|
case ACPI_TYPE_REGION:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
|
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,
|
* If the Region Address and Length have not been previously evaluated,
|
||||||
* evaluate them now and save the results.
|
* evaluate them now and save the results.
|
||||||
*/
|
*/
|
||||||
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
|
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
|
||||||
status = acpi_ds_get_region_arguments (obj_desc);
|
status = acpi_ds_get_region_arguments(obj_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,121 +326,127 @@ acpi_ex_load_op (
|
|||||||
|
|
||||||
table_header.length = 0;
|
table_header.length = 0;
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
|
status =
|
||||||
(acpi_physical_address) (i + address), 8,
|
acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
|
||||||
((u8 *) &table_header) + i);
|
(acpi_physical_address)
|
||||||
if (ACPI_FAILURE (status)) {
|
(i + address), 8,
|
||||||
return_ACPI_STATUS (status);
|
((u8 *) &
|
||||||
|
table_header) + i);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check the table length */
|
/* Sanity check the table length */
|
||||||
|
|
||||||
if (table_header.length < sizeof (struct acpi_table_header)) {
|
if (table_header.length < sizeof(struct acpi_table_header)) {
|
||||||
return_ACPI_STATUS (AE_BAD_HEADER);
|
return_ACPI_STATUS(AE_BAD_HEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a buffer for the entire table */
|
/* Allocate a buffer for the entire table */
|
||||||
|
|
||||||
table_ptr = ACPI_MEM_ALLOCATE (table_header.length);
|
table_ptr = ACPI_MEM_ALLOCATE(table_header.length);
|
||||||
if (!table_ptr) {
|
if (!table_ptr) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the entire table from the op region */
|
/* Get the entire table from the op region */
|
||||||
|
|
||||||
for (i = 0; i < table_header.length; i++) {
|
for (i = 0; i < table_header.length; i++) {
|
||||||
status = acpi_ev_address_space_dispatch (obj_desc, ACPI_READ,
|
status =
|
||||||
(acpi_physical_address) (i + address), 8,
|
acpi_ev_address_space_dispatch(obj_desc, ACPI_READ,
|
||||||
((u8 *) table_ptr + i));
|
(acpi_physical_address)
|
||||||
if (ACPI_FAILURE (status)) {
|
(i + address), 8,
|
||||||
|
((u8 *) table_ptr +
|
||||||
|
i));
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
|
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.
|
* 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
|
* Read the entire field and thus the entire table. Buffer is
|
||||||
* allocated during the read.
|
* allocated during the read.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_read_data_from_field (walk_state, obj_desc, &buffer_desc);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ex_read_data_from_field(walk_state, obj_desc,
|
||||||
return_ACPI_STATUS (status);
|
&buffer_desc);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
table_ptr = ACPI_CAST_PTR (struct acpi_table_header,
|
table_ptr = ACPI_CAST_PTR(struct acpi_table_header,
|
||||||
buffer_desc->buffer.pointer);
|
buffer_desc->buffer.pointer);
|
||||||
|
|
||||||
/* All done with the buffer_desc, delete it */
|
/* All done with the buffer_desc, delete it */
|
||||||
|
|
||||||
buffer_desc->buffer.pointer = NULL;
|
buffer_desc->buffer.pointer = NULL;
|
||||||
acpi_ut_remove_reference (buffer_desc);
|
acpi_ut_remove_reference(buffer_desc);
|
||||||
|
|
||||||
/* Sanity check the table length */
|
/* Sanity check the table length */
|
||||||
|
|
||||||
if (table_ptr->length < sizeof (struct acpi_table_header)) {
|
if (table_ptr->length < sizeof(struct acpi_table_header)) {
|
||||||
status = AE_BAD_HEADER;
|
status = AE_BAD_HEADER;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The table must be either an SSDT or a PSDT */
|
/* The table must be either an SSDT or a PSDT */
|
||||||
|
|
||||||
if ((!ACPI_STRNCMP (table_ptr->signature,
|
if ((!ACPI_STRNCMP(table_ptr->signature,
|
||||||
acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
|
acpi_gbl_table_data[ACPI_TABLE_PSDT].signature,
|
||||||
acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
|
acpi_gbl_table_data[ACPI_TABLE_PSDT].sig_length)) &&
|
||||||
(!ACPI_STRNCMP (table_ptr->signature,
|
(!ACPI_STRNCMP(table_ptr->signature,
|
||||||
acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
|
acpi_gbl_table_data[ACPI_TABLE_SSDT].signature,
|
||||||
acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
|
acpi_gbl_table_data[ACPI_TABLE_SSDT].sig_length))) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
|
"Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
|
||||||
table_ptr->signature));
|
table_ptr->signature));
|
||||||
status = AE_BAD_SIGNATURE;
|
status = AE_BAD_SIGNATURE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install the new table into the local data structures */
|
/* Install the new table into the local data structures */
|
||||||
|
|
||||||
status = acpi_ex_add_table (table_ptr, acpi_gbl_root_node, &ddb_handle);
|
status = acpi_ex_add_table(table_ptr, acpi_gbl_root_node, &ddb_handle);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/* On error, table_ptr was deallocated above */
|
/* On error, table_ptr was deallocated above */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the ddb_handle into the Target operand */
|
/* Store the ddb_handle into the Target operand */
|
||||||
|
|
||||||
status = acpi_ex_store (ddb_handle, target, walk_state);
|
status = acpi_ex_store(ddb_handle, target, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
(void) acpi_ex_unload_table (ddb_handle);
|
(void)acpi_ex_unload_table(ddb_handle);
|
||||||
|
|
||||||
/* table_ptr was deallocated above */
|
/* table_ptr was deallocated above */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_MEM_FREE (table_ptr);
|
ACPI_MEM_FREE(table_ptr);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_unload_table
|
* FUNCTION: acpi_ex_unload_table
|
||||||
@@ -463,17 +459,13 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
|
||||||
acpi_ex_unload_table (
|
|
||||||
union acpi_operand_object *ddb_handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *table_desc = ddb_handle;
|
union acpi_operand_object *table_desc = ddb_handle;
|
||||||
struct acpi_table_desc *table_info;
|
struct acpi_table_desc *table_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_unload_table");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_unload_table");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate the handle
|
* Validate the handle
|
||||||
@@ -482,29 +474,28 @@ acpi_ex_unload_table (
|
|||||||
* validated here.
|
* validated here.
|
||||||
*/
|
*/
|
||||||
if ((!ddb_handle) ||
|
if ((!ddb_handle) ||
|
||||||
(ACPI_GET_DESCRIPTOR_TYPE (ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
|
(ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
|
||||||
(ACPI_GET_OBJECT_TYPE (ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
|
(ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the actual table descriptor from the ddb_handle */
|
/* Get the actual table descriptor from the ddb_handle */
|
||||||
|
|
||||||
table_info = (struct acpi_table_desc *) table_desc->reference.object;
|
table_info = (struct acpi_table_desc *)table_desc->reference.object;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete the entire namespace under this table Node
|
* Delete the entire namespace under this table Node
|
||||||
* (Offset contains the table_id)
|
* (Offset contains the table_id)
|
||||||
*/
|
*/
|
||||||
acpi_ns_delete_namespace_by_owner (table_info->owner_id);
|
acpi_ns_delete_namespace_by_owner(table_info->owner_id);
|
||||||
acpi_ut_release_owner_id (&table_info->owner_id);
|
acpi_ut_release_owner_id(&table_info->owner_id);
|
||||||
|
|
||||||
/* Delete the table itself */
|
/* Delete the table itself */
|
||||||
|
|
||||||
(void) acpi_tb_uninstall_table (table_info->installed_desc);
|
(void)acpi_tb_uninstall_table(table_info->installed_desc);
|
||||||
|
|
||||||
/* Delete the table descriptor (ddb_handle) */
|
/* Delete the table descriptor (ddb_handle) */
|
||||||
|
|
||||||
acpi_ut_remove_reference (table_desc);
|
acpi_ut_remove_reference(table_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,24 +41,17 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exconvrt")
|
ACPI_MODULE_NAME("exconvrt")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ex_convert_to_ascii (
|
acpi_ex_convert_to_ascii(acpi_integer integer,
|
||||||
acpi_integer integer,
|
u16 base, u8 * string, u8 max_length);
|
||||||
u16 base,
|
|
||||||
u8 *string,
|
|
||||||
u8 max_length);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -76,29 +69,25 @@ acpi_ex_convert_to_ascii (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_convert_to_integer (
|
acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object **result_desc, u32 flags)
|
||||||
union acpi_operand_object **result_desc,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *return_desc;
|
union acpi_operand_object *return_desc;
|
||||||
u8 *pointer;
|
u8 *pointer;
|
||||||
acpi_integer result;
|
acpi_integer result;
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 count;
|
u32 count;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_integer", obj_desc);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_integer", obj_desc);
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
|
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
/* No conversion necessary */
|
/* No conversion necessary */
|
||||||
|
|
||||||
*result_desc = obj_desc;
|
*result_desc = obj_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
@@ -106,11 +95,11 @@ acpi_ex_convert_to_integer (
|
|||||||
/* Note: Takes advantage of common buffer/string fields */
|
/* Note: Takes advantage of common buffer/string fields */
|
||||||
|
|
||||||
pointer = obj_desc->buffer.pointer;
|
pointer = obj_desc->buffer.pointer;
|
||||||
count = obj_desc->buffer.length;
|
count = obj_desc->buffer.length;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_TYPE);
|
return_ACPI_STATUS(AE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -126,7 +115,7 @@ acpi_ex_convert_to_integer (
|
|||||||
|
|
||||||
/* String conversion is different than Buffer conversion */
|
/* String conversion is different than Buffer conversion */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -135,19 +124,18 @@ acpi_ex_convert_to_integer (
|
|||||||
* of ACPI 3.0) is that the to_integer() operator allows both decimal
|
* of ACPI 3.0) is that the to_integer() operator allows both decimal
|
||||||
* and hexadecimal strings (hex prefixed with "0x").
|
* and hexadecimal strings (hex prefixed with "0x").
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_strtoul64 ((char *) pointer, flags, &result);
|
status = acpi_ut_strtoul64((char *)pointer, flags, &result);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/* Check for zero-length buffer */
|
/* Check for zero-length buffer */
|
||||||
|
|
||||||
if (!count) {
|
if (!count) {
|
||||||
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
|
return_ACPI_STATUS(AE_AML_BUFFER_LIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transfer no more than an integer's worth of data */
|
/* Transfer no more than an integer's worth of data */
|
||||||
@@ -170,7 +158,6 @@ acpi_ex_convert_to_integer (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* No other types can get here */
|
/* No other types can get here */
|
||||||
break;
|
break;
|
||||||
@@ -178,20 +165,19 @@ acpi_ex_convert_to_integer (
|
|||||||
|
|
||||||
/* Create a new integer */
|
/* Create a new integer */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the Result */
|
/* Save the Result */
|
||||||
|
|
||||||
return_desc->integer.value = result;
|
return_desc->integer.value = result;
|
||||||
acpi_ex_truncate_for32bit_table (return_desc);
|
acpi_ex_truncate_for32bit_table(return_desc);
|
||||||
*result_desc = return_desc;
|
*result_desc = return_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_convert_to_buffer
|
* FUNCTION: acpi_ex_convert_to_buffer
|
||||||
@@ -207,25 +193,21 @@ acpi_ex_convert_to_integer (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_convert_to_buffer (
|
acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object **result_desc)
|
||||||
union acpi_operand_object **result_desc)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *return_desc;
|
union acpi_operand_object *return_desc;
|
||||||
u8 *new_buf;
|
u8 *new_buf;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_buffer", obj_desc);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_buffer", obj_desc);
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
|
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/* No conversion necessary */
|
/* No conversion necessary */
|
||||||
|
|
||||||
*result_desc = obj_desc;
|
*result_desc = obj_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
@@ -233,20 +215,20 @@ acpi_ex_convert_to_buffer (
|
|||||||
* Create a new Buffer object.
|
* Create a new Buffer object.
|
||||||
* Need enough space for one integer
|
* 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) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the integer to the buffer, LSB first */
|
/* Copy the integer to the buffer, LSB first */
|
||||||
|
|
||||||
new_buf = return_desc->buffer.pointer;
|
new_buf = return_desc->buffer.pointer;
|
||||||
ACPI_MEMCPY (new_buf,
|
ACPI_MEMCPY(new_buf,
|
||||||
&obj_desc->integer.value,
|
&obj_desc->integer.value,
|
||||||
acpi_gbl_integer_byte_width);
|
acpi_gbl_integer_byte_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -258,32 +240,31 @@ acpi_ex_convert_to_buffer (
|
|||||||
* ASL/AML code that depends on the null being transferred to the new
|
* ASL/AML code that depends on the null being transferred to the new
|
||||||
* buffer.
|
* buffer.
|
||||||
*/
|
*/
|
||||||
return_desc = acpi_ut_create_buffer_object (
|
return_desc = acpi_ut_create_buffer_object((acpi_size)
|
||||||
(acpi_size) obj_desc->string.length + 1);
|
obj_desc->string.
|
||||||
|
length + 1);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the string to the buffer */
|
/* Copy the string to the buffer */
|
||||||
|
|
||||||
new_buf = return_desc->buffer.pointer;
|
new_buf = return_desc->buffer.pointer;
|
||||||
ACPI_STRNCPY ((char *) new_buf, (char *) obj_desc->string.pointer,
|
ACPI_STRNCPY((char *)new_buf, (char *)obj_desc->string.pointer,
|
||||||
obj_desc->string.length);
|
obj_desc->string.length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_TYPE);
|
return_ACPI_STATUS(AE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark buffer initialized */
|
/* Mark buffer initialized */
|
||||||
|
|
||||||
return_desc->common.flags |= AOPOBJ_DATA_VALID;
|
return_desc->common.flags |= AOPOBJ_DATA_VALID;
|
||||||
*result_desc = return_desc;
|
*result_desc = return_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_convert_to_ascii
|
* FUNCTION: acpi_ex_convert_to_ascii
|
||||||
@@ -300,24 +281,19 @@ acpi_ex_convert_to_buffer (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ex_convert_to_ascii (
|
acpi_ex_convert_to_ascii(acpi_integer integer,
|
||||||
acpi_integer integer,
|
u16 base, u8 * string, u8 data_width)
|
||||||
u16 base,
|
|
||||||
u8 *string,
|
|
||||||
u8 data_width)
|
|
||||||
{
|
{
|
||||||
acpi_integer digit;
|
acpi_integer digit;
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
acpi_native_uint j;
|
acpi_native_uint j;
|
||||||
acpi_native_uint k = 0;
|
acpi_native_uint k = 0;
|
||||||
acpi_native_uint hex_length;
|
acpi_native_uint hex_length;
|
||||||
acpi_native_uint decimal_length;
|
acpi_native_uint decimal_length;
|
||||||
u32 remainder;
|
u32 remainder;
|
||||||
u8 supress_zeros;
|
u8 supress_zeros;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
switch (base) {
|
switch (base) {
|
||||||
case 10:
|
case 10:
|
||||||
@@ -339,7 +315,7 @@ acpi_ex_convert_to_ascii (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
supress_zeros = TRUE; /* No leading zeros */
|
supress_zeros = TRUE; /* No leading zeros */
|
||||||
remainder = 0;
|
remainder = 0;
|
||||||
|
|
||||||
for (i = decimal_length; i > 0; i--) {
|
for (i = decimal_length; i > 0; i--) {
|
||||||
@@ -347,7 +323,8 @@ acpi_ex_convert_to_ascii (
|
|||||||
|
|
||||||
digit = integer;
|
digit = integer;
|
||||||
for (j = 0; j < i; j++) {
|
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 */
|
/* Handle leading zeros */
|
||||||
@@ -367,11 +344,13 @@ acpi_ex_convert_to_ascii (
|
|||||||
|
|
||||||
/* hex_length: 2 ascii hex chars per data byte */
|
/* hex_length: 2 ascii hex chars per data byte */
|
||||||
|
|
||||||
hex_length = (acpi_native_uint) ACPI_MUL_2 (data_width);
|
hex_length = (acpi_native_uint) ACPI_MUL_2(data_width);
|
||||||
for (i = 0, j = (hex_length-1); i < hex_length; i++, j--) {
|
for (i = 0, j = (hex_length - 1); i < hex_length; i++, j--) {
|
||||||
/* Get one hex digit, most significant digits first */
|
/* Get one hex digit, most significant digits first */
|
||||||
|
|
||||||
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++;
|
k++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -387,15 +366,14 @@ acpi_ex_convert_to_ascii (
|
|||||||
* Finally, null terminate the string and return the length
|
* Finally, null terminate the string and return the length
|
||||||
*/
|
*/
|
||||||
if (!k) {
|
if (!k) {
|
||||||
string [0] = ACPI_ASCII_ZERO;
|
string[0] = ACPI_ASCII_ZERO;
|
||||||
k = 1;
|
k = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
string [k] = 0;
|
string[k] = 0;
|
||||||
return ((u32) k);
|
return ((u32) k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_convert_to_string
|
* FUNCTION: acpi_ex_convert_to_string
|
||||||
@@ -412,30 +390,25 @@ acpi_ex_convert_to_ascii (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_convert_to_string (
|
acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object ** result_desc, u32 type)
|
||||||
union acpi_operand_object **result_desc,
|
|
||||||
u32 type)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *return_desc;
|
union acpi_operand_object *return_desc;
|
||||||
u8 *new_buf;
|
u8 *new_buf;
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 string_length = 0;
|
u32 string_length = 0;
|
||||||
u16 base = 16;
|
u16 base = 16;
|
||||||
u8 separator = ',';
|
u8 separator = ',';
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_convert_to_string", obj_desc);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_convert_to_string", obj_desc);
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
|
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
/* No conversion necessary */
|
/* No conversion necessary */
|
||||||
|
|
||||||
*result_desc = obj_desc;
|
*result_desc = obj_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
@@ -452,7 +425,7 @@ acpi_ex_convert_to_string (
|
|||||||
|
|
||||||
/* Two hex string characters for each integer byte */
|
/* Two hex string characters for each integer byte */
|
||||||
|
|
||||||
string_length = ACPI_MUL_2 (acpi_gbl_integer_byte_width);
|
string_length = ACPI_MUL_2(acpi_gbl_integer_byte_width);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,31 +433,33 @@ acpi_ex_convert_to_string (
|
|||||||
* Create a new String
|
* Create a new String
|
||||||
* Need enough space for one ASCII integer (plus null terminator)
|
* 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) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_buf = return_desc->buffer.pointer;
|
new_buf = return_desc->buffer.pointer;
|
||||||
|
|
||||||
/* Convert integer to string */
|
/* Convert integer to string */
|
||||||
|
|
||||||
string_length = acpi_ex_convert_to_ascii (obj_desc->integer.value, base,
|
string_length =
|
||||||
new_buf, acpi_gbl_integer_byte_width);
|
acpi_ex_convert_to_ascii(obj_desc->integer.value, base,
|
||||||
|
new_buf,
|
||||||
|
acpi_gbl_integer_byte_width);
|
||||||
|
|
||||||
/* Null terminate at the correct place */
|
/* Null terminate at the correct place */
|
||||||
|
|
||||||
return_desc->string.length = string_length;
|
return_desc->string.length = string_length;
|
||||||
new_buf [string_length] = 0;
|
new_buf[string_length] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/* Setup string length, base, and separator */
|
/* Setup string length, base, and separator */
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
|
case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by to_decimal_string */
|
||||||
/*
|
/*
|
||||||
* From ACPI: "If Data is a buffer, it is converted to a string of
|
* From ACPI: "If Data is a buffer, it is converted to a string of
|
||||||
* decimal values separated by commas."
|
* decimal values separated by commas."
|
||||||
@@ -498,11 +473,9 @@ acpi_ex_convert_to_string (
|
|||||||
for (i = 0; i < obj_desc->buffer.length; i++) {
|
for (i = 0; i < obj_desc->buffer.length; i++) {
|
||||||
if (obj_desc->buffer.pointer[i] >= 100) {
|
if (obj_desc->buffer.pointer[i] >= 100) {
|
||||||
string_length += 4;
|
string_length += 4;
|
||||||
}
|
} else if (obj_desc->buffer.pointer[i] >= 10) {
|
||||||
else if (obj_desc->buffer.pointer[i] >= 10) {
|
|
||||||
string_length += 3;
|
string_length += 3;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
string_length += 2;
|
string_length += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,7 +491,7 @@ acpi_ex_convert_to_string (
|
|||||||
string_length = (obj_desc->buffer.length * 3);
|
string_length = (obj_desc->buffer.length * 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
|
case ACPI_EXPLICIT_CONVERT_HEX: /* Used by to_hex_string */
|
||||||
/*
|
/*
|
||||||
* From ACPI: "If Data is a buffer, it is converted to a string of
|
* From ACPI: "If Data is a buffer, it is converted to a string of
|
||||||
* hexadecimal values separated by commas."
|
* hexadecimal values separated by commas."
|
||||||
@@ -527,7 +500,7 @@ acpi_ex_convert_to_string (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -535,15 +508,16 @@ acpi_ex_convert_to_string (
|
|||||||
* (-1 because of extra separator included in string_length from above)
|
* (-1 because of extra separator included in string_length from above)
|
||||||
*/
|
*/
|
||||||
string_length--;
|
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);
|
return_ACPI_STATUS(AE_AML_STRING_LIMIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new string object and string buffer */
|
/* Create a new string object and string buffer */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_string_object ((acpi_size) string_length);
|
return_desc =
|
||||||
|
acpi_ut_create_string_object((acpi_size) string_length);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_buf = return_desc->buffer.pointer;
|
new_buf = return_desc->buffer.pointer;
|
||||||
@@ -553,10 +527,11 @@ acpi_ex_convert_to_string (
|
|||||||
* (separated by commas or spaces)
|
* (separated by commas or spaces)
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < obj_desc->buffer.length; i++) {
|
for (i = 0; i < obj_desc->buffer.length; i++) {
|
||||||
new_buf += acpi_ex_convert_to_ascii (
|
new_buf += acpi_ex_convert_to_ascii((acpi_integer)
|
||||||
(acpi_integer) obj_desc->buffer.pointer[i], base,
|
obj_desc->buffer.
|
||||||
new_buf, 1);
|
pointer[i], base,
|
||||||
*new_buf++ = separator; /* each separated by a comma or space */
|
new_buf, 1);
|
||||||
|
*new_buf++ = separator; /* each separated by a comma or space */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -568,14 +543,13 @@ acpi_ex_convert_to_string (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_TYPE);
|
return_ACPI_STATUS(AE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
*result_desc = return_desc;
|
*result_desc = return_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_convert_to_target_type
|
* FUNCTION: acpi_ex_convert_to_target_type
|
||||||
@@ -592,17 +566,14 @@ acpi_ex_convert_to_string (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_convert_to_target_type (
|
acpi_ex_convert_to_target_type(acpi_object_type destination_type,
|
||||||
acpi_object_type destination_type,
|
union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object **result_desc,
|
||||||
union acpi_operand_object **result_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_convert_to_target_type");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_convert_to_target_type");
|
||||||
|
|
||||||
/* Default behavior */
|
/* Default behavior */
|
||||||
|
|
||||||
@@ -612,10 +583,10 @@ acpi_ex_convert_to_target_type (
|
|||||||
* If required by the target,
|
* If required by the target,
|
||||||
* perform implicit conversion on the source before we store it.
|
* perform implicit conversion on the source before we store it.
|
||||||
*/
|
*/
|
||||||
switch (GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args)) {
|
switch (GET_CURRENT_ARG_TYPE(walk_state->op_info->runtime_args)) {
|
||||||
case ARGI_SIMPLE_TARGET:
|
case ARGI_SIMPLE_TARGET:
|
||||||
case ARGI_FIXED_TARGET:
|
case ARGI_FIXED_TARGET:
|
||||||
case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
|
case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */
|
||||||
|
|
||||||
switch (destination_type) {
|
switch (destination_type) {
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
@@ -627,17 +598,19 @@ acpi_ex_convert_to_target_type (
|
|||||||
default:
|
default:
|
||||||
/* No conversion allowed for these types */
|
/* No conversion allowed for these types */
|
||||||
|
|
||||||
if (destination_type != ACPI_GET_OBJECT_TYPE (source_desc)) {
|
if (destination_type !=
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_GET_OBJECT_TYPE(source_desc)) {
|
||||||
"Explicit operator, will store (%s) over existing type (%s)\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
acpi_ut_get_object_type_name (source_desc),
|
"Explicit operator, will store (%s) over existing type (%s)\n",
|
||||||
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;
|
status = AE_TYPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_TARGETREF:
|
case ARGI_TARGETREF:
|
||||||
|
|
||||||
switch (destination_type) {
|
switch (destination_type) {
|
||||||
@@ -649,55 +622,55 @@ acpi_ex_convert_to_target_type (
|
|||||||
* These types require an Integer operand. We can convert
|
* These types require an Integer operand. We can convert
|
||||||
* a Buffer or a String to an Integer if necessary.
|
* a Buffer or a String to an Integer if necessary.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_integer (source_desc, result_desc,
|
status =
|
||||||
16);
|
acpi_ex_convert_to_integer(source_desc, result_desc,
|
||||||
|
16);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
/*
|
/*
|
||||||
* The operand must be a String. We can convert an
|
* The operand must be a String. We can convert an
|
||||||
* Integer or Buffer if necessary
|
* Integer or Buffer if necessary
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_string (source_desc, result_desc,
|
status =
|
||||||
ACPI_IMPLICIT_CONVERT_HEX);
|
acpi_ex_convert_to_string(source_desc, result_desc,
|
||||||
|
ACPI_IMPLICIT_CONVERT_HEX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
/*
|
/*
|
||||||
* The operand must be a Buffer. We can convert an
|
* The operand must be a Buffer. We can convert an
|
||||||
* Integer or String if necessary
|
* Integer or String if necessary
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_buffer (source_desc, result_desc);
|
status =
|
||||||
|
acpi_ex_convert_to_buffer(source_desc, result_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
|
ACPI_REPORT_ERROR(("Bad destination type during conversion: %X\n", destination_type));
|
||||||
destination_type));
|
|
||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_REFERENCE:
|
case ARGI_REFERENCE:
|
||||||
/*
|
/*
|
||||||
* create_xxxx_field cases - we are storing the field object into the name
|
* create_xxxx_field cases - we are storing the field object into the name
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unknown Target type ID 0x%X Op %s dest_type %s\n",
|
"Unknown Target type ID 0x%X Op %s dest_type %s\n",
|
||||||
GET_CURRENT_ARG_TYPE (walk_state->op_info->runtime_args),
|
GET_CURRENT_ARG_TYPE(walk_state->op_info->
|
||||||
walk_state->op_info->name, acpi_ut_get_type_name (destination_type)));
|
runtime_args),
|
||||||
|
walk_state->op_info->name,
|
||||||
|
acpi_ut_get_type_name(destination_type)));
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n",
|
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->
|
||||||
status = AE_AML_INTERNAL;
|
runtime_args)))
|
||||||
|
status = AE_AML_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -710,7 +683,5 @@ acpi_ex_convert_to_target_type (
|
|||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
@@ -49,10 +48,8 @@
|
|||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
#include <acpi/actables.h>
|
#include <acpi/actables.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("excreate")
|
ACPI_MODULE_NAME("excreate")
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -66,33 +63,30 @@
|
|||||||
* DESCRIPTION: Create a new named alias
|
* 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 *target_node;
|
||||||
struct acpi_namespace_node *alias_node;
|
struct acpi_namespace_node *alias_node;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_create_alias");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_create_alias");
|
||||||
|
|
||||||
/* Get the source/alias operands (both namespace nodes) */
|
/* Get the source/alias operands (both namespace nodes) */
|
||||||
|
|
||||||
alias_node = (struct acpi_namespace_node *) walk_state->operands[0];
|
alias_node = (struct acpi_namespace_node *)walk_state->operands[0];
|
||||||
target_node = (struct acpi_namespace_node *) walk_state->operands[1];
|
target_node = (struct acpi_namespace_node *)walk_state->operands[1];
|
||||||
|
|
||||||
if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) ||
|
if ((target_node->type == ACPI_TYPE_LOCAL_ALIAS) ||
|
||||||
(target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
|
(target_node->type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
|
||||||
/*
|
/*
|
||||||
* Dereference an existing alias so that we don't create a chain
|
* Dereference an existing alias so that we don't create a chain
|
||||||
* of aliases. With this code, we guarantee that an alias is
|
* of aliases. With this code, we guarantee that an alias is
|
||||||
* always exactly one level of indirection away from the
|
* always exactly one level of indirection away from the
|
||||||
* actual aliased name.
|
* 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.
|
* types, the object can change dynamically via a Store.
|
||||||
*/
|
*/
|
||||||
alias_node->type = ACPI_TYPE_LOCAL_ALIAS;
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
@@ -126,7 +121,8 @@ acpi_ex_create_alias (
|
|||||||
* types, the object can change dynamically via a Store.
|
* types, the object can change dynamically via a Store.
|
||||||
*/
|
*/
|
||||||
alias_node->type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -139,17 +135,18 @@ acpi_ex_create_alias (
|
|||||||
* additional reference to prevent deletion out from under either the
|
* additional reference to prevent deletion out from under either the
|
||||||
* target node or the alias Node
|
* target node or the alias Node
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_attach_object (alias_node,
|
status = acpi_ns_attach_object(alias_node,
|
||||||
acpi_ns_get_attached_object (target_node), target_node->type);
|
acpi_ns_get_attached_object
|
||||||
|
(target_node),
|
||||||
|
target_node->type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Since both operands are Nodes, we don't need to delete them */
|
/* Since both operands are Nodes, we don't need to delete them */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_event
|
* FUNCTION: acpi_ex_create_event
|
||||||
@@ -162,18 +159,14 @@ acpi_ex_create_alias (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state)
|
||||||
acpi_ex_create_event (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_create_event");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_create_event");
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_EVENT);
|
||||||
|
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_EVENT);
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -183,27 +176,27 @@ acpi_ex_create_event (
|
|||||||
* Create the actual OS semaphore, with zero initial units -- meaning
|
* Create the actual OS semaphore, with zero initial units -- meaning
|
||||||
* that the event is created in an unsignalled state
|
* that the event is created in an unsignalled state
|
||||||
*/
|
*/
|
||||||
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0,
|
status = acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0,
|
||||||
&obj_desc->event.semaphore);
|
&obj_desc->event.semaphore);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach object to the Node */
|
/* Attach object to the Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object ((struct acpi_namespace_node *) walk_state->operands[0],
|
status =
|
||||||
obj_desc, ACPI_TYPE_EVENT);
|
acpi_ns_attach_object((struct acpi_namespace_node *)walk_state->
|
||||||
|
operands[0], obj_desc, ACPI_TYPE_EVENT);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/*
|
/*
|
||||||
* Remove local reference to the object (on error, will cause deletion
|
* Remove local reference to the object (on error, will cause deletion
|
||||||
* of both object and semaphore if present.)
|
* of both object and semaphore if present.)
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_mutex
|
* FUNCTION: acpi_ex_create_mutex
|
||||||
@@ -218,20 +211,16 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state)
|
||||||
acpi_ex_create_mutex (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_create_mutex", ACPI_WALK_OPERANDS);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_create_mutex", ACPI_WALK_OPERANDS);
|
||||||
|
|
||||||
/* Create the new mutex object */
|
/* Create the new mutex object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_MUTEX);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_MUTEX);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -242,30 +231,30 @@ acpi_ex_create_mutex (
|
|||||||
* One unit max to make it a mutex, with one initial unit to allow
|
* One unit max to make it a mutex, with one initial unit to allow
|
||||||
* the mutex to be acquired.
|
* the mutex to be acquired.
|
||||||
*/
|
*/
|
||||||
status = acpi_os_create_semaphore (1, 1, &obj_desc->mutex.semaphore);
|
status = acpi_os_create_semaphore(1, 1, &obj_desc->mutex.semaphore);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init object and attach to NS node */
|
/* Init object and attach to NS node */
|
||||||
|
|
||||||
obj_desc->mutex.sync_level = (u8) walk_state->operands[1]->integer.value;
|
obj_desc->mutex.sync_level =
|
||||||
obj_desc->mutex.node = (struct acpi_namespace_node *) walk_state->operands[0];
|
(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,
|
status = acpi_ns_attach_object(obj_desc->mutex.node,
|
||||||
obj_desc, ACPI_TYPE_MUTEX);
|
obj_desc, ACPI_TYPE_MUTEX);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
/*
|
/*
|
||||||
* Remove local reference to the object (on error, will cause deletion
|
* Remove local reference to the object (on error, will cause deletion
|
||||||
* of both object and semaphore if present.)
|
* of both object and semaphore if present.)
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_region
|
* FUNCTION: acpi_ex_create_region
|
||||||
@@ -282,20 +271,16 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_create_region (
|
acpi_ex_create_region(u8 * aml_start,
|
||||||
u8 *aml_start,
|
u32 aml_length,
|
||||||
u32 aml_length,
|
u8 region_space, struct acpi_walk_state *walk_state)
|
||||||
u8 region_space,
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_operand_object *region_obj2;
|
union acpi_operand_object *region_obj2;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_create_region");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_create_region");
|
||||||
|
|
||||||
/* Get the Namespace Node */
|
/* Get the Namespace Node */
|
||||||
|
|
||||||
@@ -305,8 +290,8 @@ acpi_ex_create_region (
|
|||||||
* If the region object is already attached to this node,
|
* If the region object is already attached to this node,
|
||||||
* just return
|
* just return
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_get_attached_object (node)) {
|
if (acpi_ns_get_attached_object(node)) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -314,17 +299,18 @@ acpi_ex_create_region (
|
|||||||
* range
|
* range
|
||||||
*/
|
*/
|
||||||
if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
|
if ((region_space >= ACPI_NUM_PREDEFINED_REGIONS) &&
|
||||||
(region_space < ACPI_USER_REGION_BEGIN)) {
|
(region_space < ACPI_USER_REGION_BEGIN)) {
|
||||||
ACPI_REPORT_ERROR (("Invalid address_space type %X\n", region_space));
|
ACPI_REPORT_ERROR(("Invalid address_space type %X\n",
|
||||||
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
|
region_space));
|
||||||
|
return_ACPI_STATUS(AE_AML_INVALID_SPACE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
|
||||||
acpi_ut_get_region_name (region_space), region_space));
|
acpi_ut_get_region_name(region_space), region_space));
|
||||||
|
|
||||||
/* Create the region descriptor */
|
/* Create the region descriptor */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -334,7 +320,7 @@ acpi_ex_create_region (
|
|||||||
* Remember location in AML stream of address & length
|
* Remember location in AML stream of address & length
|
||||||
* operands since they need to be evaluated at run time.
|
* operands since they need to be evaluated at run time.
|
||||||
*/
|
*/
|
||||||
region_obj2 = obj_desc->common.next_object;
|
region_obj2 = obj_desc->common.next_object;
|
||||||
region_obj2->extra.aml_start = aml_start;
|
region_obj2->extra.aml_start = aml_start;
|
||||||
region_obj2->extra.aml_length = aml_length;
|
region_obj2->extra.aml_length = aml_length;
|
||||||
|
|
||||||
@@ -343,22 +329,20 @@ acpi_ex_create_region (
|
|||||||
obj_desc->region.space_id = region_space;
|
obj_desc->region.space_id = region_space;
|
||||||
obj_desc->region.address = 0;
|
obj_desc->region.address = 0;
|
||||||
obj_desc->region.length = 0;
|
obj_desc->region.length = 0;
|
||||||
obj_desc->region.node = node;
|
obj_desc->region.node = node;
|
||||||
|
|
||||||
/* Install the new region object in the parent Node */
|
/* Install the new region object in the parent Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
|
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_table_region
|
* FUNCTION: acpi_ex_create_table_region
|
||||||
@@ -371,20 +355,16 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_create_table_region(struct acpi_walk_state *walk_state)
|
||||||
acpi_ex_create_table_region (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object **operand = &walk_state->operands[0];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
struct acpi_table_header *table;
|
struct acpi_table_header *table;
|
||||||
union acpi_operand_object *region_obj2;
|
union acpi_operand_object *region_obj2;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_create_table_region");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_create_table_region");
|
||||||
|
|
||||||
/* Get the Node from the object stack */
|
/* Get the Node from the object stack */
|
||||||
|
|
||||||
@@ -394,66 +374,64 @@ acpi_ex_create_table_region (
|
|||||||
* If the region object is already attached to this node,
|
* If the region object is already attached to this node,
|
||||||
* just return
|
* just return
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_get_attached_object (node)) {
|
if (acpi_ns_get_attached_object(node)) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the ACPI table */
|
/* Find the ACPI table */
|
||||||
|
|
||||||
status = acpi_tb_find_table (operand[1]->string.pointer,
|
status = acpi_tb_find_table(operand[1]->string.pointer,
|
||||||
operand[2]->string.pointer,
|
operand[2]->string.pointer,
|
||||||
operand[3]->string.pointer, &table);
|
operand[3]->string.pointer, &table);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the region descriptor */
|
/* Create the region descriptor */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_REGION);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_REGION);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
region_obj2 = obj_desc->common.next_object;
|
region_obj2 = obj_desc->common.next_object;
|
||||||
region_obj2->extra.region_context = NULL;
|
region_obj2->extra.region_context = NULL;
|
||||||
|
|
||||||
/* Init the region from the operands */
|
/* Init the region from the operands */
|
||||||
|
|
||||||
obj_desc->region.space_id = REGION_DATA_TABLE;
|
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.length = table->length;
|
||||||
obj_desc->region.node = node;
|
obj_desc->region.node = node;
|
||||||
obj_desc->region.flags = AOPOBJ_DATA_VALID;
|
obj_desc->region.flags = AOPOBJ_DATA_VALID;
|
||||||
|
|
||||||
/* Install the new region object in the parent Node */
|
/* Install the new region object in the parent Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object (node, obj_desc, ACPI_TYPE_REGION);
|
status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ev_initialize_region (obj_desc, FALSE);
|
status = acpi_ev_initialize_region(obj_desc, FALSE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_NOT_EXIST) {
|
if (status == AE_NOT_EXIST) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
|
obj_desc->region.flags |= AOPOBJ_SETUP_COMPLETE;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_processor
|
* FUNCTION: acpi_ex_create_processor
|
||||||
@@ -468,43 +446,39 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state)
|
||||||
acpi_ex_create_processor (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object **operand = &walk_state->operands[0];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_create_processor", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_create_processor", walk_state);
|
||||||
|
|
||||||
/* Create the processor object */
|
/* Create the processor object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_PROCESSOR);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_PROCESSOR);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the processor object from the operands */
|
/* Initialize the processor object from the operands */
|
||||||
|
|
||||||
obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
|
obj_desc->processor.proc_id = (u8) operand[1]->integer.value;
|
||||||
obj_desc->processor.address = (acpi_io_address) operand[2]->integer.value;
|
obj_desc->processor.address =
|
||||||
obj_desc->processor.length = (u8) operand[3]->integer.value;
|
(acpi_io_address) operand[2]->integer.value;
|
||||||
|
obj_desc->processor.length = (u8) operand[3]->integer.value;
|
||||||
|
|
||||||
/* Install the processor object in the parent Node */
|
/* Install the processor object in the parent Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
|
status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
|
||||||
obj_desc, ACPI_TYPE_PROCESSOR);
|
obj_desc, ACPI_TYPE_PROCESSOR);
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_power_resource
|
* FUNCTION: acpi_ex_create_power_resource
|
||||||
@@ -519,43 +493,39 @@ acpi_ex_create_processor (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state)
|
||||||
acpi_ex_create_power_resource (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object **operand = &walk_state->operands[0];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_create_power_resource", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_create_power_resource", walk_state);
|
||||||
|
|
||||||
/* Create the power resource object */
|
/* Create the power resource object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_POWER);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_POWER);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the power object from the operands */
|
/* Initialize the power object from the operands */
|
||||||
|
|
||||||
obj_desc->power_resource.system_level = (u8) operand[1]->integer.value;
|
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 */
|
/* Install the power resource object in the parent Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
|
status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
|
||||||
obj_desc, ACPI_TYPE_POWER);
|
obj_desc, ACPI_TYPE_POWER);
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_create_method
|
* FUNCTION: acpi_ex_create_method
|
||||||
@@ -571,25 +541,21 @@ acpi_ex_create_power_resource (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_create_method (
|
acpi_ex_create_method(u8 * aml_start,
|
||||||
u8 *aml_start,
|
u32 aml_length, struct acpi_walk_state *walk_state)
|
||||||
u32 aml_length,
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object **operand = &walk_state->operands[0];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u8 method_flags;
|
u8 method_flags;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_create_method", walk_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_create_method", walk_state);
|
||||||
|
|
||||||
/* Create a new method object */
|
/* Create a new method object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (ACPI_TYPE_METHOD);
|
obj_desc = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the method's AML pointer and length */
|
/* Save the method's AML pointer and length */
|
||||||
@@ -603,8 +569,10 @@ acpi_ex_create_method (
|
|||||||
*/
|
*/
|
||||||
method_flags = (u8) operand[1]->integer.value;
|
method_flags = (u8) operand[1]->integer.value;
|
||||||
|
|
||||||
obj_desc->method.method_flags = (u8) (method_flags & ~AML_METHOD_ARG_COUNT);
|
obj_desc->method.method_flags =
|
||||||
obj_desc->method.param_count = (u8) (method_flags & AML_METHOD_ARG_COUNT);
|
(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
|
* Get the concurrency count. If required, a semaphore will be
|
||||||
@@ -613,32 +581,28 @@ acpi_ex_create_method (
|
|||||||
if (acpi_gbl_all_methods_serialized) {
|
if (acpi_gbl_all_methods_serialized) {
|
||||||
obj_desc->method.concurrency = 1;
|
obj_desc->method.concurrency = 1;
|
||||||
obj_desc->method.method_flags |= AML_METHOD_SERIALIZED;
|
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 1.0: Concurrency = 1
|
||||||
* ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1)
|
* ACPI 2.0: Concurrency = (sync_level (in method declaration) + 1)
|
||||||
*/
|
*/
|
||||||
obj_desc->method.concurrency = (u8)
|
obj_desc->method.concurrency = (u8)
|
||||||
(((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
|
(((method_flags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
|
obj_desc->method.concurrency = ACPI_INFINITE_CONCURRENCY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach the new object to the method Node */
|
/* Attach the new object to the method Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object ((struct acpi_namespace_node *) operand[0],
|
status = acpi_ns_attach_object((struct acpi_namespace_node *)operand[0],
|
||||||
obj_desc, ACPI_TYPE_METHOD);
|
obj_desc, ACPI_TYPE_METHOD);
|
||||||
|
|
||||||
/* Remove local reference to the object */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
|
|
||||||
/* Remove a reference to the operand */
|
/* Remove a reference to the operand */
|
||||||
|
|
||||||
acpi_ut_remove_reference (operand[1]);
|
acpi_ut_remove_reference(operand[1]);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,15 +41,12 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exfield")
|
ACPI_MODULE_NAME("exfield")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -65,67 +62,70 @@
|
|||||||
* Buffer, depending on the size of the field.
|
* Buffer, depending on the size of the field.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_read_data_from_field (
|
acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object **ret_buffer_desc)
|
||||||
union acpi_operand_object **ret_buffer_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_operand_object *buffer_desc;
|
union acpi_operand_object *buffer_desc;
|
||||||
acpi_size length;
|
acpi_size length;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
u8 locked;
|
u8 locked;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_read_data_from_field", obj_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_read_data_from_field", obj_desc);
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
if (!ret_buffer_desc) {
|
if (!ret_buffer_desc) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
||||||
/*
|
/*
|
||||||
* If the buffer_field arguments have not been previously evaluated,
|
* If the buffer_field arguments have not been previously evaluated,
|
||||||
* evaluate them now and save the results.
|
* evaluate them now and save the results.
|
||||||
*/
|
*/
|
||||||
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
|
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
|
||||||
status = acpi_ds_get_buffer_field_arguments (obj_desc);
|
status = acpi_ds_get_buffer_field_arguments(obj_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
|
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
|
||||||
(obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
|
&& (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
|
* This is an SMBus read. We must create a buffer to hold the data
|
||||||
* and directly access the region handler.
|
* 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) {
|
if (!buffer_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lock entire transaction if requested */
|
/* Lock entire transaction if requested */
|
||||||
|
|
||||||
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
|
locked =
|
||||||
|
acpi_ex_acquire_global_lock(obj_desc->common_field.
|
||||||
|
field_flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform the read.
|
* Perform the read.
|
||||||
* Note: Smbus protocol value is passed in upper 16-bits of Function
|
* Note: Smbus protocol value is passed in upper 16-bits of Function
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_access_region (obj_desc, 0,
|
status = acpi_ex_access_region(obj_desc, 0,
|
||||||
ACPI_CAST_PTR (acpi_integer, buffer_desc->buffer.pointer),
|
ACPI_CAST_PTR(acpi_integer,
|
||||||
ACPI_READ | (obj_desc->field.attribute << 16));
|
buffer_desc->
|
||||||
acpi_ex_release_global_lock (locked);
|
buffer.pointer),
|
||||||
|
ACPI_READ | (obj_desc->field.
|
||||||
|
attribute << 16));
|
||||||
|
acpi_ex_release_global_lock(locked);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,22 +139,22 @@ acpi_ex_read_data_from_field (
|
|||||||
*
|
*
|
||||||
* Note: Field.length is in bits.
|
* 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) {
|
if (length > acpi_gbl_integer_byte_width) {
|
||||||
/* Field is too large for an Integer, create a Buffer instead */
|
/* Field is too large for an Integer, create a Buffer instead */
|
||||||
|
|
||||||
buffer_desc = acpi_ut_create_buffer_object (length);
|
buffer_desc = acpi_ut_create_buffer_object(length);
|
||||||
if (!buffer_desc) {
|
if (!buffer_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
buffer = buffer_desc->buffer.pointer;
|
buffer = buffer_desc->buffer.pointer;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Field will fit within an Integer (normal case) */
|
/* Field will fit within an Integer (normal case) */
|
||||||
|
|
||||||
buffer_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
buffer_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!buffer_desc) {
|
if (!buffer_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
length = acpi_gbl_integer_byte_width;
|
length = acpi_gbl_integer_byte_width;
|
||||||
@@ -162,37 +162,36 @@ acpi_ex_read_data_from_field (
|
|||||||
buffer = &buffer_desc->integer.value;
|
buffer = &buffer_desc->integer.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"field_read [TO]: Obj %p, Type %X, Buf %p, byte_len %X\n",
|
"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,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
(u32) length));
|
||||||
"field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
obj_desc->common_field.bit_length,
|
"field_read [FROM]: bit_len %X, bit_off %X, byte_off %X\n",
|
||||||
obj_desc->common_field.start_field_bit_offset,
|
obj_desc->common_field.bit_length,
|
||||||
obj_desc->common_field.base_byte_offset));
|
obj_desc->common_field.start_field_bit_offset,
|
||||||
|
obj_desc->common_field.base_byte_offset));
|
||||||
|
|
||||||
/* Lock entire transaction if requested */
|
/* Lock entire transaction if requested */
|
||||||
|
|
||||||
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
|
locked =
|
||||||
|
acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
|
||||||
|
|
||||||
/* Read from the field */
|
/* Read from the field */
|
||||||
|
|
||||||
status = acpi_ex_extract_from_field (obj_desc, buffer, (u32) length);
|
status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length);
|
||||||
acpi_ex_release_global_lock (locked);
|
acpi_ex_release_global_lock(locked);
|
||||||
|
|
||||||
|
exit:
|
||||||
exit:
|
if (ACPI_FAILURE(status)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ut_remove_reference(buffer_desc);
|
||||||
acpi_ut_remove_reference (buffer_desc);
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
*ret_buffer_desc = buffer_desc;
|
*ret_buffer_desc = buffer_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_write_data_to_field
|
* FUNCTION: acpi_ex_write_data_to_field
|
||||||
@@ -208,97 +207,96 @@ exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_write_data_to_field (
|
acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object **result_desc)
|
||||||
union acpi_operand_object **result_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 length;
|
u32 length;
|
||||||
u32 required_length;
|
u32 required_length;
|
||||||
void *buffer;
|
void *buffer;
|
||||||
void *new_buffer;
|
void *new_buffer;
|
||||||
u8 locked;
|
u8 locked;
|
||||||
union acpi_operand_object *buffer_desc;
|
union acpi_operand_object *buffer_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_write_data_to_field", obj_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_write_data_to_field", obj_desc);
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!source_desc || !obj_desc) {
|
if (!source_desc || !obj_desc) {
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
||||||
/*
|
/*
|
||||||
* If the buffer_field arguments have not been previously evaluated,
|
* If the buffer_field arguments have not been previously evaluated,
|
||||||
* evaluate them now and save the results.
|
* evaluate them now and save the results.
|
||||||
*/
|
*/
|
||||||
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
|
if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {
|
||||||
status = acpi_ds_get_buffer_field_arguments (obj_desc);
|
status = acpi_ds_get_buffer_field_arguments(obj_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD) &&
|
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
|
||||||
(obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS)) {
|
&& (obj_desc->field.region_obj->region.space_id ==
|
||||||
|
ACPI_ADR_SPACE_SMBUS)) {
|
||||||
/*
|
/*
|
||||||
* This is an SMBus write. We will bypass the entire field mechanism
|
* This is an SMBus write. We will bypass the entire field mechanism
|
||||||
* and handoff the buffer directly to the handler.
|
* and handoff the buffer directly to the handler.
|
||||||
*
|
*
|
||||||
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
|
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
|
||||||
*/
|
*/
|
||||||
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
|
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
|
||||||
ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
|
ACPI_REPORT_ERROR(("SMBus write requires Buffer, found type %s\n", acpi_ut_get_object_type_name(source_desc)));
|
||||||
acpi_ut_get_object_type_name (source_desc)));
|
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
|
if (source_desc->buffer.length < ACPI_SMBUS_BUFFER_SIZE) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("SMBus write requires Buffer of length %X, found length %X\n", ACPI_SMBUS_BUFFER_SIZE, source_desc->buffer.length));
|
||||||
"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);
|
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) {
|
if (!buffer_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = buffer_desc->buffer.pointer;
|
buffer = buffer_desc->buffer.pointer;
|
||||||
ACPI_MEMCPY (buffer, source_desc->buffer.pointer,
|
ACPI_MEMCPY(buffer, source_desc->buffer.pointer,
|
||||||
ACPI_SMBUS_BUFFER_SIZE);
|
ACPI_SMBUS_BUFFER_SIZE);
|
||||||
|
|
||||||
/* Lock entire transaction if requested */
|
/* Lock entire transaction if requested */
|
||||||
|
|
||||||
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
|
locked =
|
||||||
|
acpi_ex_acquire_global_lock(obj_desc->common_field.
|
||||||
|
field_flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform the write (returns status and perhaps data in the
|
* Perform the write (returns status and perhaps data in the
|
||||||
* same buffer)
|
* same buffer)
|
||||||
* Note: SMBus protocol type is passed in upper 16-bits of Function.
|
* Note: SMBus protocol type is passed in upper 16-bits of Function.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_access_region (obj_desc, 0,
|
status = acpi_ex_access_region(obj_desc, 0,
|
||||||
(acpi_integer *) buffer,
|
(acpi_integer *) buffer,
|
||||||
ACPI_WRITE | (obj_desc->field.attribute << 16));
|
ACPI_WRITE | (obj_desc->field.
|
||||||
acpi_ex_release_global_lock (locked);
|
attribute << 16));
|
||||||
|
acpi_ex_release_global_lock(locked);
|
||||||
|
|
||||||
*result_desc = buffer_desc;
|
*result_desc = buffer_desc;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a pointer to the data to be written */
|
/* Get a pointer to the data to be written */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
buffer = &source_desc->integer.value;
|
buffer = &source_desc->integer.value;
|
||||||
length = sizeof (source_desc->integer.value);
|
length = sizeof(source_desc->integer.value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
@@ -312,7 +310,7 @@ acpi_ex_write_data_to_field (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -322,15 +320,15 @@ acpi_ex_write_data_to_field (
|
|||||||
* the ACPI specification.
|
* the ACPI specification.
|
||||||
*/
|
*/
|
||||||
new_buffer = NULL;
|
new_buffer = NULL;
|
||||||
required_length = ACPI_ROUND_BITS_UP_TO_BYTES (
|
required_length =
|
||||||
obj_desc->common_field.bit_length);
|
ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length);
|
||||||
|
|
||||||
if (length < required_length) {
|
if (length < required_length) {
|
||||||
/* We need to create a new buffer */
|
/* We need to create a new buffer */
|
||||||
|
|
||||||
new_buffer = ACPI_MEM_CALLOCATE (required_length);
|
new_buffer = ACPI_MEM_CALLOCATE(required_length);
|
||||||
if (!new_buffer) {
|
if (!new_buffer) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -338,40 +336,42 @@ acpi_ex_write_data_to_field (
|
|||||||
* at Byte zero. All unused (upper) bytes of the
|
* at Byte zero. All unused (upper) bytes of the
|
||||||
* buffer will be 0.
|
* buffer will be 0.
|
||||||
*/
|
*/
|
||||||
ACPI_MEMCPY ((char *) new_buffer, (char *) buffer, length);
|
ACPI_MEMCPY((char *)new_buffer, (char *)buffer, length);
|
||||||
buffer = new_buffer;
|
buffer = new_buffer;
|
||||||
length = required_length;
|
length = required_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
|
"field_write [FROM]: Obj %p (%s:%X), Buf %p, byte_len %X\n",
|
||||||
source_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (source_desc)),
|
source_desc,
|
||||||
ACPI_GET_OBJECT_TYPE (source_desc), buffer, length));
|
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,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
|
"field_write [TO]: Obj %p (%s:%X), bit_len %X, bit_off %X, byte_off %X\n",
|
||||||
obj_desc, acpi_ut_get_type_name (ACPI_GET_OBJECT_TYPE (obj_desc)),
|
obj_desc,
|
||||||
ACPI_GET_OBJECT_TYPE (obj_desc),
|
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
|
||||||
obj_desc->common_field.bit_length,
|
ACPI_GET_OBJECT_TYPE(obj_desc),
|
||||||
obj_desc->common_field.start_field_bit_offset,
|
obj_desc->common_field.bit_length,
|
||||||
obj_desc->common_field.base_byte_offset));
|
obj_desc->common_field.start_field_bit_offset,
|
||||||
|
obj_desc->common_field.base_byte_offset));
|
||||||
|
|
||||||
/* Lock entire transaction if requested */
|
/* Lock entire transaction if requested */
|
||||||
|
|
||||||
locked = acpi_ex_acquire_global_lock (obj_desc->common_field.field_flags);
|
locked =
|
||||||
|
acpi_ex_acquire_global_lock(obj_desc->common_field.field_flags);
|
||||||
|
|
||||||
/* Write to the field */
|
/* Write to the field */
|
||||||
|
|
||||||
status = acpi_ex_insert_into_field (obj_desc, buffer, length);
|
status = acpi_ex_insert_into_field(obj_desc, buffer, length);
|
||||||
acpi_ex_release_global_lock (locked);
|
acpi_ex_release_global_lock(locked);
|
||||||
|
|
||||||
/* Free temporary buffer if we used one */
|
/* Free temporary buffer if we used one */
|
||||||
|
|
||||||
if (new_buffer) {
|
if (new_buffer) {
|
||||||
ACPI_MEM_FREE (new_buffer);
|
ACPI_MEM_FREE(new_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -42,15 +42,12 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exmisc")
|
ACPI_MODULE_NAME("exmisc")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -66,27 +63,23 @@
|
|||||||
* Common code for the ref_of_op and the cond_ref_of_op.
|
* Common code for the ref_of_op and the cond_ref_of_op.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_get_object_reference (
|
acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
union acpi_operand_object **return_desc,
|
||||||
union acpi_operand_object **return_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *reference_obj;
|
union acpi_operand_object *reference_obj;
|
||||||
union acpi_operand_object *referenced_obj;
|
union acpi_operand_object *referenced_obj;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_get_object_reference", obj_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
|
||||||
|
|
||||||
*return_desc = NULL;
|
*return_desc = NULL;
|
||||||
|
|
||||||
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
|
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
|
||||||
case ACPI_DESC_TYPE_OPERAND:
|
case ACPI_DESC_TYPE_OPERAND:
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
|
if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -104,13 +97,11 @@ acpi_ex_get_object_reference (
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n",
|
ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode));
|
||||||
obj_desc->reference.opcode));
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_DESC_TYPE_NAMED:
|
case ACPI_DESC_TYPE_NAMED:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -119,34 +110,32 @@ acpi_ex_get_object_reference (
|
|||||||
referenced_obj = obj_desc;
|
referenced_obj = obj_desc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n",
|
ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
|
||||||
ACPI_GET_DESCRIPTOR_TYPE (obj_desc)));
|
return_ACPI_STATUS(AE_TYPE);
|
||||||
return_ACPI_STATUS (AE_TYPE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Create a new reference object */
|
/* 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) {
|
if (!reference_obj) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
reference_obj->reference.opcode = AML_REF_OF_OP;
|
reference_obj->reference.opcode = AML_REF_OF_OP;
|
||||||
reference_obj->reference.object = referenced_obj;
|
reference_obj->reference.object = referenced_obj;
|
||||||
*return_desc = reference_obj;
|
*return_desc = reference_obj;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Object %p Type [%s], returning Reference %p\n",
|
"Object %p Type [%s], returning Reference %p\n",
|
||||||
obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
|
obj_desc, acpi_ut_get_object_type_name(obj_desc),
|
||||||
|
*return_desc));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_concat_template
|
* FUNCTION: acpi_ex_concat_template
|
||||||
@@ -163,63 +152,58 @@ acpi_ex_get_object_reference (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_concat_template (
|
acpi_ex_concat_template(union acpi_operand_object *operand0,
|
||||||
union acpi_operand_object *operand0,
|
union acpi_operand_object *operand1,
|
||||||
union acpi_operand_object *operand1,
|
union acpi_operand_object **actual_return_desc,
|
||||||
union acpi_operand_object **actual_return_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *return_desc;
|
union acpi_operand_object *return_desc;
|
||||||
u8 *new_buf;
|
u8 *new_buf;
|
||||||
u8 *end_tag1;
|
u8 *end_tag1;
|
||||||
u8 *end_tag2;
|
u8 *end_tag2;
|
||||||
acpi_size length1;
|
acpi_size length1;
|
||||||
acpi_size length2;
|
acpi_size length2;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_concat_template");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_concat_template");
|
||||||
|
|
||||||
/* Find the end_tags in each resource template */
|
/* Find the end_tags in each resource template */
|
||||||
|
|
||||||
end_tag1 = acpi_ut_get_resource_end_tag (operand0);
|
end_tag1 = acpi_ut_get_resource_end_tag(operand0);
|
||||||
end_tag2 = acpi_ut_get_resource_end_tag (operand1);
|
end_tag2 = acpi_ut_get_resource_end_tag(operand1);
|
||||||
if (!end_tag1 || !end_tag2) {
|
if (!end_tag1 || !end_tag2) {
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the length of each part */
|
/* Compute the length of each part */
|
||||||
|
|
||||||
length1 = ACPI_PTR_DIFF (end_tag1, operand0->buffer.pointer);
|
length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer);
|
||||||
length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) +
|
length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2; /* Size of END_TAG */
|
||||||
2; /* Size of END_TAG */
|
|
||||||
|
|
||||||
/* Create a new buffer object for the result */
|
/* Create a new buffer object for the result */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_buffer_object (length1 + length2);
|
return_desc = acpi_ut_create_buffer_object(length1 + length2);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the templates to the new descriptor */
|
/* Copy the templates to the new descriptor */
|
||||||
|
|
||||||
new_buf = return_desc->buffer.pointer;
|
new_buf = return_desc->buffer.pointer;
|
||||||
ACPI_MEMCPY (new_buf, operand0->buffer.pointer, length1);
|
ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1);
|
||||||
ACPI_MEMCPY (new_buf + length1, operand1->buffer.pointer, length2);
|
ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2);
|
||||||
|
|
||||||
/* Compute the new checksum */
|
/* Compute the new checksum */
|
||||||
|
|
||||||
new_buf[return_desc->buffer.length - 1] =
|
new_buf[return_desc->buffer.length - 1] =
|
||||||
acpi_ut_generate_checksum (return_desc->buffer.pointer,
|
acpi_ut_generate_checksum(return_desc->buffer.pointer,
|
||||||
(return_desc->buffer.length - 1));
|
(return_desc->buffer.length - 1));
|
||||||
|
|
||||||
/* Return the completed template descriptor */
|
/* Return the completed template descriptor */
|
||||||
|
|
||||||
*actual_return_desc = return_desc;
|
*actual_return_desc = return_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_do_concatenate
|
* FUNCTION: acpi_ex_do_concatenate
|
||||||
@@ -236,21 +220,18 @@ acpi_ex_concat_template (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_do_concatenate (
|
acpi_ex_do_concatenate(union acpi_operand_object *operand0,
|
||||||
union acpi_operand_object *operand0,
|
union acpi_operand_object *operand1,
|
||||||
union acpi_operand_object *operand1,
|
union acpi_operand_object **actual_return_desc,
|
||||||
union acpi_operand_object **actual_return_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *local_operand1 = operand1;
|
union acpi_operand_object *local_operand1 = operand1;
|
||||||
union acpi_operand_object *return_desc;
|
union acpi_operand_object *return_desc;
|
||||||
char *new_buf;
|
char *new_buf;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_size new_length;
|
acpi_size new_length;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_do_concatenate");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_do_concatenate");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert the second operand if necessary. The first operand
|
* Convert the second operand if necessary. The first operand
|
||||||
@@ -259,27 +240,28 @@ acpi_ex_do_concatenate (
|
|||||||
* guaranteed to be either Integer/String/Buffer by the operand
|
* guaranteed to be either Integer/String/Buffer by the operand
|
||||||
* resolution mechanism.
|
* resolution mechanism.
|
||||||
*/
|
*/
|
||||||
switch (ACPI_GET_OBJECT_TYPE (operand0)) {
|
switch (ACPI_GET_OBJECT_TYPE(operand0)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
status = acpi_ex_convert_to_string (operand1, &local_operand1,
|
status = acpi_ex_convert_to_string(operand1, &local_operand1,
|
||||||
ACPI_IMPLICIT_CONVERT_HEX);
|
ACPI_IMPLICIT_CONVERT_HEX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
|
status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
|
ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n",
|
||||||
ACPI_GET_OBJECT_TYPE (operand0)));
|
ACPI_GET_OBJECT_TYPE(operand0)));
|
||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,32 +278,33 @@ acpi_ex_do_concatenate (
|
|||||||
* 2) Two Strings concatenated to produce a new String
|
* 2) Two Strings concatenated to produce a new String
|
||||||
* 3) Two Buffers concatenated to produce a new Buffer
|
* 3) Two Buffers concatenated to produce a new Buffer
|
||||||
*/
|
*/
|
||||||
switch (ACPI_GET_OBJECT_TYPE (operand0)) {
|
switch (ACPI_GET_OBJECT_TYPE(operand0)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
/* Result of two Integers is a Buffer */
|
/* Result of two Integers is a Buffer */
|
||||||
/* Need enough buffer space for two integers */
|
/* Need enough buffer space for two integers */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_buffer_object ((acpi_size)
|
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) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_buf = (char *) return_desc->buffer.pointer;
|
new_buf = (char *)return_desc->buffer.pointer;
|
||||||
|
|
||||||
/* Copy the first integer, LSB first */
|
/* Copy the first integer, LSB first */
|
||||||
|
|
||||||
ACPI_MEMCPY (new_buf,
|
ACPI_MEMCPY(new_buf,
|
||||||
&operand0->integer.value,
|
&operand0->integer.value,
|
||||||
acpi_gbl_integer_byte_width);
|
acpi_gbl_integer_byte_width);
|
||||||
|
|
||||||
/* Copy the second integer (LSB first) after the first */
|
/* Copy the second integer (LSB first) after the first */
|
||||||
|
|
||||||
ACPI_MEMCPY (new_buf + acpi_gbl_integer_byte_width,
|
ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width,
|
||||||
&local_operand1->integer.value,
|
&local_operand1->integer.value,
|
||||||
acpi_gbl_integer_byte_width);
|
acpi_gbl_integer_byte_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
@@ -329,13 +312,13 @@ acpi_ex_do_concatenate (
|
|||||||
/* Result of two Strings is a String */
|
/* Result of two Strings is a String */
|
||||||
|
|
||||||
new_length = (acpi_size) operand0->string.length +
|
new_length = (acpi_size) operand0->string.length +
|
||||||
(acpi_size) local_operand1->string.length;
|
(acpi_size) local_operand1->string.length;
|
||||||
if (new_length > ACPI_MAX_STRING_CONVERSION) {
|
if (new_length > ACPI_MAX_STRING_CONVERSION) {
|
||||||
status = AE_AML_STRING_LIMIT;
|
status = AE_AML_STRING_LIMIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_desc = acpi_ut_create_string_object (new_length);
|
return_desc = acpi_ut_create_string_object(new_length);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -345,56 +328,56 @@ acpi_ex_do_concatenate (
|
|||||||
|
|
||||||
/* Concatenate the strings */
|
/* Concatenate the strings */
|
||||||
|
|
||||||
ACPI_STRCPY (new_buf,
|
ACPI_STRCPY(new_buf, operand0->string.pointer);
|
||||||
operand0->string.pointer);
|
ACPI_STRCPY(new_buf + operand0->string.length,
|
||||||
ACPI_STRCPY (new_buf + operand0->string.length,
|
local_operand1->string.pointer);
|
||||||
local_operand1->string.pointer);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/* Result of two Buffers is a Buffer */
|
/* Result of two Buffers is a Buffer */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_buffer_object (
|
return_desc = acpi_ut_create_buffer_object((acpi_size)
|
||||||
(acpi_size) operand0->buffer.length +
|
operand0->buffer.
|
||||||
(acpi_size) local_operand1->buffer.length);
|
length +
|
||||||
|
(acpi_size)
|
||||||
|
local_operand1->
|
||||||
|
buffer.length);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_buf = (char *) return_desc->buffer.pointer;
|
new_buf = (char *)return_desc->buffer.pointer;
|
||||||
|
|
||||||
/* Concatenate the buffers */
|
/* Concatenate the buffers */
|
||||||
|
|
||||||
ACPI_MEMCPY (new_buf,
|
ACPI_MEMCPY(new_buf,
|
||||||
operand0->buffer.pointer,
|
operand0->buffer.pointer, operand0->buffer.length);
|
||||||
operand0->buffer.length);
|
ACPI_MEMCPY(new_buf + operand0->buffer.length,
|
||||||
ACPI_MEMCPY (new_buf + operand0->buffer.length,
|
local_operand1->buffer.pointer,
|
||||||
local_operand1->buffer.pointer,
|
local_operand1->buffer.length);
|
||||||
local_operand1->buffer.length);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Invalid object type, should not happen here */
|
/* Invalid object type, should not happen here */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n",
|
ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n",
|
||||||
ACPI_GET_OBJECT_TYPE (operand0)));
|
ACPI_GET_OBJECT_TYPE(operand0)));
|
||||||
status =AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
*actual_return_desc = return_desc;
|
*actual_return_desc = return_desc;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (local_operand1 != operand1) {
|
if (local_operand1 != operand1) {
|
||||||
acpi_ut_remove_reference (local_operand1);
|
acpi_ut_remove_reference(local_operand1);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_do_math_op
|
* FUNCTION: acpi_ex_do_math_op
|
||||||
@@ -412,62 +395,49 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_integer
|
acpi_integer
|
||||||
acpi_ex_do_math_op (
|
acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
|
||||||
u16 opcode,
|
|
||||||
acpi_integer integer0,
|
|
||||||
acpi_integer integer1)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */
|
case AML_ADD_OP: /* Add (Integer0, Integer1, Result) */
|
||||||
|
|
||||||
return (integer0 + integer1);
|
return (integer0 + integer1);
|
||||||
|
|
||||||
|
case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
|
||||||
case AML_BIT_AND_OP: /* And (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (integer0 & integer1);
|
return (integer0 & integer1);
|
||||||
|
|
||||||
|
case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
|
||||||
case AML_BIT_NAND_OP: /* NAnd (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (~(integer0 & integer1));
|
return (~(integer0 & integer1));
|
||||||
|
|
||||||
|
case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
|
||||||
case AML_BIT_OR_OP: /* Or (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (integer0 | integer1);
|
return (integer0 | integer1);
|
||||||
|
|
||||||
|
case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
|
||||||
case AML_BIT_NOR_OP: /* NOr (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (~(integer0 | integer1));
|
return (~(integer0 | integer1));
|
||||||
|
|
||||||
|
case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
|
||||||
case AML_BIT_XOR_OP: /* XOr (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (integer0 ^ integer1);
|
return (integer0 ^ integer1);
|
||||||
|
|
||||||
|
case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
|
||||||
case AML_MULTIPLY_OP: /* Multiply (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (integer0 * integer1);
|
return (integer0 * integer1);
|
||||||
|
|
||||||
|
case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result) */
|
||||||
case AML_SHIFT_LEFT_OP: /* shift_left (Operand, shift_count, Result)*/
|
|
||||||
|
|
||||||
return (integer0 << integer1);
|
return (integer0 << integer1);
|
||||||
|
|
||||||
|
case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */
|
||||||
case AML_SHIFT_RIGHT_OP: /* shift_right (Operand, shift_count, Result) */
|
|
||||||
|
|
||||||
return (integer0 >> integer1);
|
return (integer0 >> integer1);
|
||||||
|
|
||||||
|
case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
|
||||||
case AML_SUBTRACT_OP: /* Subtract (Integer0, Integer1, Result) */
|
|
||||||
|
|
||||||
return (integer0 - integer1);
|
return (integer0 - integer1);
|
||||||
|
|
||||||
@@ -477,7 +447,6 @@ acpi_ex_do_math_op (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_do_logical_numeric_op
|
* FUNCTION: acpi_ex_do_logical_numeric_op
|
||||||
@@ -499,28 +468,24 @@ acpi_ex_do_math_op (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_do_logical_numeric_op (
|
acpi_ex_do_logical_numeric_op(u16 opcode,
|
||||||
u16 opcode,
|
acpi_integer integer0,
|
||||||
acpi_integer integer0,
|
acpi_integer integer1, u8 * logical_result)
|
||||||
acpi_integer integer1,
|
|
||||||
u8 *logical_result)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u8 local_result = FALSE;
|
u8 local_result = FALSE;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_do_logical_numeric_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case AML_LAND_OP: /* LAnd (Integer0, Integer1) */
|
case AML_LAND_OP: /* LAnd (Integer0, Integer1) */
|
||||||
|
|
||||||
if (integer0 && integer1) {
|
if (integer0 && integer1) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_LOR_OP: /* LOr (Integer0, Integer1) */
|
case AML_LOR_OP: /* LOr (Integer0, Integer1) */
|
||||||
|
|
||||||
if (integer0 || integer1) {
|
if (integer0 || integer1) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
@@ -535,10 +500,9 @@ acpi_ex_do_logical_numeric_op (
|
|||||||
/* Return the logical result and status */
|
/* Return the logical result and status */
|
||||||
|
|
||||||
*logical_result = local_result;
|
*logical_result = local_result;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_do_logical_op
|
* FUNCTION: acpi_ex_do_logical_op
|
||||||
@@ -566,24 +530,20 @@ acpi_ex_do_logical_numeric_op (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_do_logical_op (
|
acpi_ex_do_logical_op(u16 opcode,
|
||||||
u16 opcode,
|
union acpi_operand_object *operand0,
|
||||||
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;
|
union acpi_operand_object *local_operand1 = operand1;
|
||||||
acpi_integer integer0;
|
acpi_integer integer0;
|
||||||
acpi_integer integer1;
|
acpi_integer integer1;
|
||||||
u32 length0;
|
u32 length0;
|
||||||
u32 length1;
|
u32 length1;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u8 local_result = FALSE;
|
u8 local_result = FALSE;
|
||||||
int compare;
|
int compare;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_do_logical_op");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_do_logical_op");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert the second operand if necessary. The first operand
|
* Convert the second operand if necessary. The first operand
|
||||||
@@ -592,18 +552,19 @@ acpi_ex_do_logical_op (
|
|||||||
* guaranteed to be either Integer/String/Buffer by the operand
|
* guaranteed to be either Integer/String/Buffer by the operand
|
||||||
* resolution mechanism.
|
* resolution mechanism.
|
||||||
*/
|
*/
|
||||||
switch (ACPI_GET_OBJECT_TYPE (operand0)) {
|
switch (ACPI_GET_OBJECT_TYPE(operand0)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
status = acpi_ex_convert_to_string (operand1, &local_operand1,
|
status = acpi_ex_convert_to_string(operand1, &local_operand1,
|
||||||
ACPI_IMPLICIT_CONVERT_HEX);
|
ACPI_IMPLICIT_CONVERT_HEX);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
|
status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -611,14 +572,14 @@ acpi_ex_do_logical_op (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Two cases: 1) Both Integers, 2) Both Strings or Buffers
|
* Two cases: 1) Both Integers, 2) Both Strings or Buffers
|
||||||
*/
|
*/
|
||||||
if (ACPI_GET_OBJECT_TYPE (operand0) == ACPI_TYPE_INTEGER) {
|
if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) {
|
||||||
/*
|
/*
|
||||||
* 1) Both operands are of type integer
|
* 1) Both operands are of type integer
|
||||||
* Note: local_operand1 may have changed above
|
* Note: local_operand1 may have changed above
|
||||||
@@ -627,21 +588,21 @@ acpi_ex_do_logical_op (
|
|||||||
integer1 = local_operand1->integer.value;
|
integer1 = local_operand1->integer.value;
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
|
case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
|
||||||
|
|
||||||
if (integer0 == integer1) {
|
if (integer0 == integer1) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
|
case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
|
||||||
|
|
||||||
if (integer0 > integer1) {
|
if (integer0 > integer1) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
|
case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
|
||||||
|
|
||||||
if (integer0 < integer1) {
|
if (integer0 < integer1) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
@@ -652,8 +613,7 @@ acpi_ex_do_logical_op (
|
|||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* 2) Both operands are Strings or both are Buffers
|
* 2) Both operands are Strings or both are Buffers
|
||||||
* Note: Code below takes advantage of common Buffer/String
|
* Note: Code below takes advantage of common Buffer/String
|
||||||
@@ -665,31 +625,31 @@ acpi_ex_do_logical_op (
|
|||||||
|
|
||||||
/* Lexicographic compare: compare the data bytes */
|
/* Lexicographic compare: compare the data bytes */
|
||||||
|
|
||||||
compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer,
|
compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
|
||||||
(const char * ) local_operand1->buffer.pointer,
|
(const char *)local_operand1->buffer.
|
||||||
(length0 > length1) ? length1 : length0);
|
pointer,
|
||||||
|
(length0 > length1) ? length1 : length0);
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
|
case AML_LEQUAL_OP: /* LEqual (Operand0, Operand1) */
|
||||||
|
|
||||||
/* Length and all bytes must be equal */
|
/* Length and all bytes must be equal */
|
||||||
|
|
||||||
if ((length0 == length1) &&
|
if ((length0 == length1) && (compare == 0)) {
|
||||||
(compare == 0)) {
|
|
||||||
/* Length and all bytes match ==> TRUE */
|
/* Length and all bytes match ==> TRUE */
|
||||||
|
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
|
case AML_LGREATER_OP: /* LGreater (Operand0, Operand1) */
|
||||||
|
|
||||||
if (compare > 0) {
|
if (compare > 0) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
goto cleanup; /* TRUE */
|
goto cleanup; /* TRUE */
|
||||||
}
|
}
|
||||||
if (compare < 0) {
|
if (compare < 0) {
|
||||||
goto cleanup; /* FALSE */
|
goto cleanup; /* FALSE */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bytes match (to shortest length), compare lengths */
|
/* Bytes match (to shortest length), compare lengths */
|
||||||
@@ -699,14 +659,14 @@ acpi_ex_do_logical_op (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
|
case AML_LLESS_OP: /* LLess (Operand0, Operand1) */
|
||||||
|
|
||||||
if (compare > 0) {
|
if (compare > 0) {
|
||||||
goto cleanup; /* FALSE */
|
goto cleanup; /* FALSE */
|
||||||
}
|
}
|
||||||
if (compare < 0) {
|
if (compare < 0) {
|
||||||
local_result = TRUE;
|
local_result = TRUE;
|
||||||
goto cleanup; /* TRUE */
|
goto cleanup; /* TRUE */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bytes match (to shortest length), compare lengths */
|
/* Bytes match (to shortest length), compare lengths */
|
||||||
@@ -722,18 +682,16 @@ acpi_ex_do_logical_op (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
/* New object was created if implicit conversion performed - delete */
|
/* New object was created if implicit conversion performed - delete */
|
||||||
|
|
||||||
if (local_operand1 != operand1) {
|
if (local_operand1 != operand1) {
|
||||||
acpi_ut_remove_reference (local_operand1);
|
acpi_ut_remove_reference(local_operand1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the logical result and status */
|
/* Return the logical result and status */
|
||||||
|
|
||||||
*logical_result = local_result;
|
*logical_result = local_result;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,20 +42,16 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exmutex")
|
ACPI_MODULE_NAME("exmutex")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ex_link_mutex (
|
acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
struct acpi_thread_state *thread);
|
||||||
struct acpi_thread_state *thread);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -69,12 +65,9 @@ acpi_ex_link_mutex (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc)
|
||||||
acpi_ex_unlink_mutex (
|
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
struct acpi_thread_state *thread = obj_desc->mutex.owner_thread;
|
struct acpi_thread_state *thread = obj_desc->mutex.owner_thread;
|
||||||
|
|
||||||
|
|
||||||
if (!thread) {
|
if (!thread) {
|
||||||
return;
|
return;
|
||||||
@@ -88,13 +81,11 @@ acpi_ex_unlink_mutex (
|
|||||||
|
|
||||||
if (obj_desc->mutex.prev) {
|
if (obj_desc->mutex.prev) {
|
||||||
(obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
|
(obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
thread->acquired_mutex_list = obj_desc->mutex.next;
|
thread->acquired_mutex_list = obj_desc->mutex.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_link_mutex
|
* FUNCTION: acpi_ex_link_mutex
|
||||||
@@ -109,12 +100,10 @@ acpi_ex_unlink_mutex (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ex_link_mutex (
|
acpi_ex_link_mutex(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
struct acpi_thread_state *thread)
|
||||||
struct acpi_thread_state *thread)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *list_head;
|
union acpi_operand_object *list_head;
|
||||||
|
|
||||||
|
|
||||||
list_head = thread->acquired_mutex_list;
|
list_head = thread->acquired_mutex_list;
|
||||||
|
|
||||||
@@ -134,7 +123,6 @@ acpi_ex_link_mutex (
|
|||||||
thread->acquired_mutex_list = obj_desc;
|
thread->acquired_mutex_list = obj_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_acquire_mutex
|
* FUNCTION: acpi_ex_acquire_mutex
|
||||||
@@ -150,27 +138,23 @@ acpi_ex_link_mutex (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_acquire_mutex (
|
acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
|
||||||
union acpi_operand_object *time_desc,
|
union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_acquire_mutex", obj_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_acquire_mutex", obj_desc);
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check -- we must have a valid thread ID */
|
/* Sanity check -- we must have a valid thread ID */
|
||||||
|
|
||||||
if (!walk_state->thread) {
|
if (!walk_state->thread) {
|
||||||
ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
|
ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
|
||||||
acpi_ut_get_node_name (obj_desc->mutex.node)));
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -178,10 +162,8 @@ acpi_ex_acquire_mutex (
|
|||||||
* mutex. This mechanism provides some deadlock prevention
|
* mutex. This mechanism provides some deadlock prevention
|
||||||
*/
|
*/
|
||||||
if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
|
if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Cannot acquire Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
|
||||||
"Cannot acquire Mutex [%4.4s], incorrect sync_level\n",
|
return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
|
||||||
acpi_ut_get_node_name (obj_desc->mutex.node)));
|
|
||||||
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support for multiple acquires by the owning thread */
|
/* Support for multiple acquires by the owning thread */
|
||||||
@@ -190,43 +172,43 @@ acpi_ex_acquire_mutex (
|
|||||||
/* Special case for Global Lock, allow all threads */
|
/* Special case for Global Lock, allow all threads */
|
||||||
|
|
||||||
if ((obj_desc->mutex.owner_thread->thread_id ==
|
if ((obj_desc->mutex.owner_thread->thread_id ==
|
||||||
walk_state->thread->thread_id) ||
|
walk_state->thread->thread_id) ||
|
||||||
(obj_desc->mutex.semaphore ==
|
(obj_desc->mutex.semaphore ==
|
||||||
acpi_gbl_global_lock_semaphore)) {
|
acpi_gbl_global_lock_semaphore)) {
|
||||||
/*
|
/*
|
||||||
* The mutex is already owned by this thread,
|
* The mutex is already owned by this thread,
|
||||||
* just increment the acquisition depth
|
* just increment the acquisition depth
|
||||||
*/
|
*/
|
||||||
obj_desc->mutex.acquisition_depth++;
|
obj_desc->mutex.acquisition_depth++;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acquire the mutex, wait if necessary */
|
/* Acquire the mutex, wait if necessary */
|
||||||
|
|
||||||
status = acpi_ex_system_acquire_mutex (time_desc, obj_desc);
|
status = acpi_ex_system_acquire_mutex(time_desc, obj_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/* Includes failure from a timeout on time_desc */
|
/* Includes failure from a timeout on time_desc */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Have the mutex: update mutex and walk info and save the sync_level */
|
/* Have the mutex: update mutex and walk info and save the sync_level */
|
||||||
|
|
||||||
obj_desc->mutex.owner_thread = walk_state->thread;
|
obj_desc->mutex.owner_thread = walk_state->thread;
|
||||||
obj_desc->mutex.acquisition_depth = 1;
|
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;
|
walk_state->thread->current_sync_level = obj_desc->mutex.sync_level;
|
||||||
|
|
||||||
/* Link the mutex to the current thread for force-unlock at method exit */
|
/* Link the mutex to the current thread for force-unlock at method exit */
|
||||||
|
|
||||||
acpi_ex_link_mutex (obj_desc, walk_state->thread);
|
acpi_ex_link_mutex(obj_desc, walk_state->thread);
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_release_mutex
|
* FUNCTION: acpi_ex_release_mutex
|
||||||
@@ -241,48 +223,40 @@ acpi_ex_acquire_mutex (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_release_mutex (
|
acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_release_mutex");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_release_mutex");
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The mutex must have been previously acquired in order to release it */
|
/* The mutex must have been previously acquired in order to release it */
|
||||||
|
|
||||||
if (!obj_desc->mutex.owner_thread) {
|
if (!obj_desc->mutex.owner_thread) {
|
||||||
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
|
ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], not acquired\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
|
||||||
acpi_ut_get_node_name (obj_desc->mutex.node)));
|
return_ACPI_STATUS(AE_AML_MUTEX_NOT_ACQUIRED);
|
||||||
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check -- we must have a valid thread ID */
|
/* Sanity check -- we must have a valid thread ID */
|
||||||
|
|
||||||
if (!walk_state->thread) {
|
if (!walk_state->thread) {
|
||||||
ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
|
ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], null thread info\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
|
||||||
acpi_ut_get_node_name (obj_desc->mutex.node)));
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The Mutex is owned, but this thread must be the owner.
|
* The Mutex is owned, but this thread must be the owner.
|
||||||
* Special case for Global Lock, any thread can release
|
* Special case for Global Lock, any thread can release
|
||||||
*/
|
*/
|
||||||
if ((obj_desc->mutex.owner_thread->thread_id != walk_state->thread->thread_id) &&
|
if ((obj_desc->mutex.owner_thread->thread_id !=
|
||||||
(obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
|
walk_state->thread->thread_id)
|
||||||
ACPI_REPORT_ERROR ((
|
&& (obj_desc->mutex.semaphore != acpi_gbl_global_lock_semaphore)) {
|
||||||
"Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
|
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));
|
||||||
walk_state->thread->thread_id,
|
return_ACPI_STATUS(AE_AML_NOT_OWNER);
|
||||||
acpi_ut_get_node_name (obj_desc->mutex.node),
|
|
||||||
obj_desc->mutex.owner_thread->thread_id));
|
|
||||||
return_ACPI_STATUS (AE_AML_NOT_OWNER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -290,10 +264,8 @@ acpi_ex_release_mutex (
|
|||||||
* equal to the current sync level
|
* equal to the current sync level
|
||||||
*/
|
*/
|
||||||
if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
|
if (obj_desc->mutex.sync_level > walk_state->thread->current_sync_level) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Cannot release Mutex [%4.4s], incorrect sync_level\n", acpi_ut_get_node_name(obj_desc->mutex.node)));
|
||||||
"Cannot release Mutex [%4.4s], incorrect sync_level\n",
|
return_ACPI_STATUS(AE_AML_MUTEX_ORDER);
|
||||||
acpi_ut_get_node_name (obj_desc->mutex.node)));
|
|
||||||
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match multiple Acquires with multiple Releases */
|
/* Match multiple Acquires with multiple Releases */
|
||||||
@@ -302,26 +274,26 @@ acpi_ex_release_mutex (
|
|||||||
if (obj_desc->mutex.acquisition_depth != 0) {
|
if (obj_desc->mutex.acquisition_depth != 0) {
|
||||||
/* Just decrement the depth and return */
|
/* Just decrement the depth and return */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unlink the mutex from the owner's list */
|
/* Unlink the mutex from the owner's list */
|
||||||
|
|
||||||
acpi_ex_unlink_mutex (obj_desc);
|
acpi_ex_unlink_mutex(obj_desc);
|
||||||
|
|
||||||
/* Release the mutex */
|
/* Release the mutex */
|
||||||
|
|
||||||
status = acpi_ex_system_release_mutex (obj_desc);
|
status = acpi_ex_system_release_mutex(obj_desc);
|
||||||
|
|
||||||
/* Update the mutex and walk state, restore sync_level before acquire */
|
/* Update the mutex and walk state, restore sync_level before acquire */
|
||||||
|
|
||||||
obj_desc->mutex.owner_thread = NULL;
|
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);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_release_all_mutexes
|
* FUNCTION: acpi_ex_release_all_mutexes
|
||||||
@@ -334,17 +306,13 @@ acpi_ex_release_mutex (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread)
|
||||||
acpi_ex_release_all_mutexes (
|
|
||||||
struct acpi_thread_state *thread)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *next = thread->acquired_mutex_list;
|
union acpi_operand_object *next = thread->acquired_mutex_list;
|
||||||
union acpi_operand_object *this;
|
union acpi_operand_object *this;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* Traverse the list of owned mutexes, releasing each one */
|
/* Traverse the list of owned mutexes, releasing each one */
|
||||||
|
|
||||||
@@ -353,13 +321,13 @@ acpi_ex_release_all_mutexes (
|
|||||||
next = this->mutex.next;
|
next = this->mutex.next;
|
||||||
|
|
||||||
this->mutex.acquisition_depth = 1;
|
this->mutex.acquisition_depth = 1;
|
||||||
this->mutex.prev = NULL;
|
this->mutex.prev = NULL;
|
||||||
this->mutex.next = NULL;
|
this->mutex.next = NULL;
|
||||||
|
|
||||||
/* Release the mutex */
|
/* Release the mutex */
|
||||||
|
|
||||||
status = acpi_ex_system_release_mutex (this);
|
status = acpi_ex_system_release_mutex(this);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,5 +340,3 @@ acpi_ex_release_all_mutexes (
|
|||||||
thread->current_sync_level = this->mutex.original_sync_level;
|
thread->current_sync_level = this->mutex.original_sync_level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,26 +42,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exnames")
|
ACPI_MODULE_NAME("exnames")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* 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
|
static acpi_status
|
||||||
acpi_ex_name_segment (
|
acpi_ex_name_segment(u8 ** in_aml_address, char *name_string);
|
||||||
u8 **in_aml_address,
|
|
||||||
char *name_string);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -79,17 +71,13 @@ acpi_ex_name_segment (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static char *
|
static char *acpi_ex_allocate_name_string(u32 prefix_count, u32 num_name_segs)
|
||||||
acpi_ex_allocate_name_string (
|
|
||||||
u32 prefix_count,
|
|
||||||
u32 num_name_segs)
|
|
||||||
{
|
{
|
||||||
char *temp_ptr;
|
char *temp_ptr;
|
||||||
char *name_string;
|
char *name_string;
|
||||||
u32 size_needed;
|
u32 size_needed;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_allocate_name_string");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_allocate_name_string");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
|
* Allow room for all \ and ^ prefixes, all segments and a multi_name_prefix.
|
||||||
@@ -100,20 +88,19 @@ acpi_ex_allocate_name_string (
|
|||||||
/* Special case for root */
|
/* Special case for root */
|
||||||
|
|
||||||
size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
|
size_needed = 1 + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
|
||||||
}
|
} else {
|
||||||
else {
|
size_needed =
|
||||||
size_needed = prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
|
prefix_count + (ACPI_NAME_SIZE * num_name_segs) + 2 + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a buffer for the name.
|
* Allocate a buffer for the name.
|
||||||
* This buffer must be deleted by the caller!
|
* This buffer must be deleted by the caller!
|
||||||
*/
|
*/
|
||||||
name_string = ACPI_MEM_ALLOCATE (size_needed);
|
name_string = ACPI_MEM_ALLOCATE(size_needed);
|
||||||
if (!name_string) {
|
if (!name_string) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("ex_allocate_name_string: Could not allocate size %d\n", size_needed));
|
||||||
"ex_allocate_name_string: Could not allocate size %d\n", size_needed));
|
return_PTR(NULL);
|
||||||
return_PTR (NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
temp_ptr = name_string;
|
temp_ptr = name_string;
|
||||||
@@ -122,23 +109,20 @@ acpi_ex_allocate_name_string (
|
|||||||
|
|
||||||
if (prefix_count == ACPI_UINT32_MAX) {
|
if (prefix_count == ACPI_UINT32_MAX) {
|
||||||
*temp_ptr++ = AML_ROOT_PREFIX;
|
*temp_ptr++ = AML_ROOT_PREFIX;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
while (prefix_count--) {
|
while (prefix_count--) {
|
||||||
*temp_ptr++ = AML_PARENT_PREFIX;
|
*temp_ptr++ = AML_PARENT_PREFIX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Set up Dual or Multi prefixes if needed */
|
/* Set up Dual or Multi prefixes if needed */
|
||||||
|
|
||||||
if (num_name_segs > 2) {
|
if (num_name_segs > 2) {
|
||||||
/* Set up multi prefixes */
|
/* Set up multi prefixes */
|
||||||
|
|
||||||
*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
|
*temp_ptr++ = AML_MULTI_NAME_PREFIX_OP;
|
||||||
*temp_ptr++ = (char) num_name_segs;
|
*temp_ptr++ = (char)num_name_segs;
|
||||||
}
|
} else if (2 == num_name_segs) {
|
||||||
else if (2 == num_name_segs) {
|
|
||||||
/* Set up dual prefixes */
|
/* Set up dual prefixes */
|
||||||
|
|
||||||
*temp_ptr++ = AML_DUAL_NAME_PREFIX;
|
*temp_ptr++ = AML_DUAL_NAME_PREFIX;
|
||||||
@@ -150,7 +134,7 @@ acpi_ex_allocate_name_string (
|
|||||||
*/
|
*/
|
||||||
*temp_ptr = 0;
|
*temp_ptr = 0;
|
||||||
|
|
||||||
return_PTR (name_string);
|
return_PTR(name_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -167,19 +151,14 @@ acpi_ex_allocate_name_string (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
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)
|
|
||||||
{
|
{
|
||||||
char *aml_address = (void *) *in_aml_address;
|
char *aml_address = (void *)*in_aml_address;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 index;
|
u32 index;
|
||||||
char char_buf[5];
|
char char_buf[5];
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_name_segment");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_name_segment");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If first character is a digit, then we know that we aren't looking at a
|
* If first character is a digit, then we know that we aren't looking at a
|
||||||
@@ -188,20 +167,20 @@ acpi_ex_name_segment (
|
|||||||
char_buf[0] = *aml_address;
|
char_buf[0] = *aml_address;
|
||||||
|
|
||||||
if ('0' <= char_buf[0] && char_buf[0] <= '9') {
|
if ('0' <= char_buf[0] && char_buf[0] <= '9') {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", char_buf[0]));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "leading digit: %c\n",
|
||||||
return_ACPI_STATUS (AE_CTRL_PENDING);
|
char_buf[0]));
|
||||||
|
return_ACPI_STATUS(AE_CTRL_PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "Bytes from stream:\n"));
|
||||||
|
|
||||||
for (index = 0;
|
for (index = 0;
|
||||||
(index < ACPI_NAME_SIZE) && (acpi_ut_valid_acpi_character (*aml_address));
|
(index < ACPI_NAME_SIZE)
|
||||||
index++) {
|
&& (acpi_ut_valid_acpi_character(*aml_address)); index++) {
|
||||||
char_buf[index] = *aml_address++;
|
char_buf[index] = *aml_address++;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", char_buf[index]));
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD, "%c\n", char_buf[index]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Valid name segment */
|
/* Valid name segment */
|
||||||
|
|
||||||
if (index == 4) {
|
if (index == 4) {
|
||||||
@@ -210,41 +189,37 @@ acpi_ex_name_segment (
|
|||||||
char_buf[4] = '\0';
|
char_buf[4] = '\0';
|
||||||
|
|
||||||
if (name_string) {
|
if (name_string) {
|
||||||
ACPI_STRCAT (name_string, char_buf);
|
ACPI_STRCAT(name_string, char_buf);
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Appended to - %s \n", name_string));
|
"Appended to - %s \n", name_string));
|
||||||
|
} else {
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
|
"No Name string - %s \n", char_buf));
|
||||||
}
|
}
|
||||||
else {
|
} else if (index == 0) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
|
||||||
"No Name string - %s \n", char_buf));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (index == 0) {
|
|
||||||
/*
|
/*
|
||||||
* First character was not a valid name character,
|
* First character was not a valid name character,
|
||||||
* so we are looking at something other than a name.
|
* so we are looking at something other than a name.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Leading character is not alpha: %02Xh (not a name)\n",
|
"Leading character is not alpha: %02Xh (not a name)\n",
|
||||||
char_buf[0]));
|
char_buf[0]));
|
||||||
status = AE_CTRL_PENDING;
|
status = AE_CTRL_PENDING;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Segment started with one or more valid characters, but fewer than
|
* Segment started with one or more valid characters, but fewer than
|
||||||
* the required 4
|
* the required 4
|
||||||
*/
|
*/
|
||||||
status = AE_AML_BAD_NAME;
|
status = AE_AML_BAD_NAME;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Bad character %02x in name, at %p\n",
|
"Bad character %02x in name, at %p\n",
|
||||||
*aml_address, aml_address));
|
*aml_address, aml_address));
|
||||||
}
|
}
|
||||||
|
|
||||||
*in_aml_address = (u8 *) aml_address;
|
*in_aml_address = (u8 *) aml_address;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_get_name_string
|
* FUNCTION: acpi_ex_get_name_string
|
||||||
@@ -263,37 +238,32 @@ acpi_ex_name_segment (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_get_name_string (
|
acpi_ex_get_name_string(acpi_object_type data_type,
|
||||||
acpi_object_type data_type,
|
u8 * in_aml_address,
|
||||||
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;
|
acpi_status status = AE_OK;
|
||||||
u8 *aml_address = in_aml_address;
|
u8 *aml_address = in_aml_address;
|
||||||
char *name_string = NULL;
|
char *name_string = NULL;
|
||||||
u32 num_segments;
|
u32 num_segments;
|
||||||
u32 prefix_count = 0;
|
u32 prefix_count = 0;
|
||||||
u8 has_prefix = FALSE;
|
u8 has_prefix = FALSE;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_get_name_string", aml_address);
|
||||||
|
|
||||||
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) {
|
||||||
if (ACPI_TYPE_LOCAL_REGION_FIELD == data_type ||
|
|
||||||
ACPI_TYPE_LOCAL_BANK_FIELD == data_type ||
|
|
||||||
ACPI_TYPE_LOCAL_INDEX_FIELD == data_type) {
|
|
||||||
/* Disallow prefixes for types associated with field_unit names */
|
/* Disallow prefixes for types associated with field_unit names */
|
||||||
|
|
||||||
name_string = acpi_ex_allocate_name_string (0, 1);
|
name_string = acpi_ex_allocate_name_string(0, 1);
|
||||||
if (!name_string) {
|
if (!name_string) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
|
} else {
|
||||||
|
status =
|
||||||
|
acpi_ex_name_segment(&aml_address, name_string);
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
status = acpi_ex_name_segment (&aml_address, name_string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* data_type is not a field name.
|
* data_type is not a field name.
|
||||||
* Examine first character of name for root or parent prefix operators
|
* Examine first character of name for root or parent prefix operators
|
||||||
@@ -301,8 +271,9 @@ acpi_ex_get_name_string (
|
|||||||
switch (*aml_address) {
|
switch (*aml_address) {
|
||||||
case AML_ROOT_PREFIX:
|
case AML_ROOT_PREFIX:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "root_prefix(\\) at %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||||
aml_address));
|
"root_prefix(\\) at %p\n",
|
||||||
|
aml_address));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remember that we have a root_prefix --
|
* Remember that we have a root_prefix --
|
||||||
@@ -313,14 +284,14 @@ acpi_ex_get_name_string (
|
|||||||
has_prefix = TRUE;
|
has_prefix = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_PARENT_PREFIX:
|
case AML_PARENT_PREFIX:
|
||||||
|
|
||||||
/* Increment past possibly multiple parent prefixes */
|
/* Increment past possibly multiple parent prefixes */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "parent_prefix (^) at %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||||
aml_address));
|
"parent_prefix (^) at %p\n",
|
||||||
|
aml_address));
|
||||||
|
|
||||||
aml_address++;
|
aml_address++;
|
||||||
prefix_count++;
|
prefix_count++;
|
||||||
@@ -330,7 +301,6 @@ acpi_ex_get_name_string (
|
|||||||
has_prefix = TRUE;
|
has_prefix = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Not a prefix character */
|
/* Not a prefix character */
|
||||||
@@ -343,11 +313,13 @@ acpi_ex_get_name_string (
|
|||||||
switch (*aml_address) {
|
switch (*aml_address) {
|
||||||
case AML_DUAL_NAME_PREFIX:
|
case AML_DUAL_NAME_PREFIX:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "dual_name_prefix at %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||||
aml_address));
|
"dual_name_prefix at %p\n",
|
||||||
|
aml_address));
|
||||||
|
|
||||||
aml_address++;
|
aml_address++;
|
||||||
name_string = acpi_ex_allocate_name_string (prefix_count, 2);
|
name_string =
|
||||||
|
acpi_ex_allocate_name_string(prefix_count, 2);
|
||||||
if (!name_string) {
|
if (!name_string) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
break;
|
break;
|
||||||
@@ -357,24 +329,29 @@ acpi_ex_get_name_string (
|
|||||||
|
|
||||||
has_prefix = TRUE;
|
has_prefix = TRUE;
|
||||||
|
|
||||||
status = acpi_ex_name_segment (&aml_address, name_string);
|
status =
|
||||||
if (ACPI_SUCCESS (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);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_MULTI_NAME_PREFIX_OP:
|
case AML_MULTI_NAME_PREFIX_OP:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "multi_name_prefix at %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_LOAD,
|
||||||
aml_address));
|
"multi_name_prefix at %p\n",
|
||||||
|
aml_address));
|
||||||
|
|
||||||
/* Fetch count of segments remaining in name path */
|
/* Fetch count of segments remaining in name path */
|
||||||
|
|
||||||
aml_address++;
|
aml_address++;
|
||||||
num_segments = *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) {
|
if (!name_string) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
break;
|
break;
|
||||||
@@ -386,27 +363,28 @@ acpi_ex_get_name_string (
|
|||||||
has_prefix = TRUE;
|
has_prefix = TRUE;
|
||||||
|
|
||||||
while (num_segments &&
|
while (num_segments &&
|
||||||
(status = acpi_ex_name_segment (&aml_address, name_string)) ==
|
(status =
|
||||||
AE_OK) {
|
acpi_ex_name_segment(&aml_address,
|
||||||
|
name_string)) == AE_OK) {
|
||||||
num_segments--;
|
num_segments--;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
/* null_name valid as of 8-12-98 ASL/AML Grammar Update */
|
/* null_name valid as of 8-12-98 ASL/AML Grammar Update */
|
||||||
|
|
||||||
if (prefix_count == ACPI_UINT32_MAX) {
|
if (prefix_count == ACPI_UINT32_MAX) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"name_seg is \"\\\" followed by NULL\n"));
|
"name_seg is \"\\\" followed by NULL\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Consume the NULL byte */
|
/* Consume the NULL byte */
|
||||||
|
|
||||||
aml_address++;
|
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) {
|
if (!name_string) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
break;
|
break;
|
||||||
@@ -414,18 +392,19 @@ acpi_ex_get_name_string (
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Name segment string */
|
/* 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) {
|
if (!name_string) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_name_segment (&aml_address, name_string);
|
status =
|
||||||
|
acpi_ex_name_segment(&aml_address, name_string);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,22 +412,20 @@ acpi_ex_get_name_string (
|
|||||||
if (AE_CTRL_PENDING == status && has_prefix) {
|
if (AE_CTRL_PENDING == status && has_prefix) {
|
||||||
/* Ran out of segments after processing a prefix */
|
/* Ran out of segments after processing a prefix */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (
|
ACPI_REPORT_ERROR(("ex_do_name: Malformed Name at %p\n",
|
||||||
("ex_do_name: Malformed Name at %p\n", name_string));
|
name_string));
|
||||||
status = AE_AML_BAD_NAME;
|
status = AE_AML_BAD_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (name_string) {
|
if (name_string) {
|
||||||
ACPI_MEM_FREE (name_string);
|
ACPI_MEM_FREE(name_string);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
*out_name_string = name_string;
|
*out_name_string = name_string;
|
||||||
*out_name_length = (u32) (aml_address - in_aml_address);
|
*out_name_length = (u32) (aml_address - in_aml_address);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,17 +41,14 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exoparg2")
|
ACPI_MODULE_NAME("exoparg2")
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Naming convention for AML interpreter execution routines.
|
* Naming convention for AML interpreter execution routines.
|
||||||
@@ -74,8 +71,6 @@
|
|||||||
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
||||||
* fully resolved operands.
|
* fully resolved operands.
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_2A_0T_0R
|
* FUNCTION: acpi_ex_opcode_2A_0T_0R
|
||||||
@@ -90,29 +85,24 @@
|
|||||||
* ALLOCATION: Deletes both operands
|
* 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];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
u32 value;
|
u32 value;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_0R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
/* Examine the opcode */
|
/* Examine the opcode */
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */
|
case AML_NOTIFY_OP: /* Notify (notify_object, notify_value) */
|
||||||
|
|
||||||
/* The first operand is a namespace node */
|
/* The first operand is a namespace node */
|
||||||
|
|
||||||
node = (struct acpi_namespace_node *) operand[0];
|
node = (struct acpi_namespace_node *)operand[0];
|
||||||
|
|
||||||
/* Second value is the notify value */
|
/* Second value is the notify value */
|
||||||
|
|
||||||
@@ -120,15 +110,14 @@ acpi_ex_opcode_2A_0T_0R (
|
|||||||
|
|
||||||
/* Are notifies allowed on this object? */
|
/* Are notifies allowed on this object? */
|
||||||
|
|
||||||
if (!acpi_ev_is_notify_object (node)) {
|
if (!acpi_ev_is_notify_object(node)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unexpected notify object type [%s]\n",
|
"Unexpected notify object type [%s]\n",
|
||||||
acpi_ut_get_type_name (node->type)));
|
acpi_ut_get_type_name(node->type)));
|
||||||
|
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ACPI_GPE_NOTIFY_CHECK
|
#ifdef ACPI_GPE_NOTIFY_CHECK
|
||||||
/*
|
/*
|
||||||
* GPE method wake/notify check. Here, we want to ensure that we
|
* GPE method wake/notify check. Here, we want to ensure that we
|
||||||
@@ -144,12 +133,14 @@ acpi_ex_opcode_2A_0T_0R (
|
|||||||
* If all three cases are true, this is a wake-only GPE that should
|
* If all three cases are true, this is a wake-only GPE that should
|
||||||
* be disabled at runtime.
|
* be disabled at runtime.
|
||||||
*/
|
*/
|
||||||
if (value == 2) /* device_wake */ {
|
if (value == 2) { /* device_wake */
|
||||||
status = acpi_ev_check_for_wake_only_gpe (walk_state->gpe_event_info);
|
status =
|
||||||
if (ACPI_FAILURE (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 */
|
/* AE_WAKE_ONLY_GPE only error, means ignore this notify */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK)
|
return_ACPI_STATUS(AE_OK)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -161,21 +152,18 @@ acpi_ex_opcode_2A_0T_0R (
|
|||||||
* from this thread -- because handlers may in turn run other
|
* from this thread -- because handlers may in turn run other
|
||||||
* control methods.
|
* control methods.
|
||||||
*/
|
*/
|
||||||
status = acpi_ev_queue_notify_request (node, value);
|
status = acpi_ev_queue_notify_request(node, value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_2A_2T_1R
|
* FUNCTION: acpi_ex_opcode_2A_2T_1R
|
||||||
@@ -189,19 +177,15 @@ acpi_ex_opcode_2A_0T_0R (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
|
||||||
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 **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *return_desc1 = NULL;
|
union acpi_operand_object *return_desc1 = NULL;
|
||||||
union acpi_operand_object *return_desc2 = NULL;
|
union acpi_operand_object *return_desc2 = NULL;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_2T_1R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
/* Execute the opcode */
|
/* Execute the opcode */
|
||||||
|
|
||||||
@@ -210,13 +194,15 @@ acpi_ex_opcode_2A_2T_1R (
|
|||||||
|
|
||||||
/* Divide (Dividend, Divisor, remainder_result quotient_result) */
|
/* Divide (Dividend, Divisor, remainder_result quotient_result) */
|
||||||
|
|
||||||
return_desc1 = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
return_desc1 =
|
||||||
|
acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!return_desc1) {
|
if (!return_desc1) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
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) {
|
if (!return_desc2) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -224,33 +210,31 @@ acpi_ex_opcode_2A_2T_1R (
|
|||||||
|
|
||||||
/* Quotient to return_desc1, remainder to return_desc2 */
|
/* Quotient to return_desc1, remainder to return_desc2 */
|
||||||
|
|
||||||
status = acpi_ut_divide (operand[0]->integer.value,
|
status = acpi_ut_divide(operand[0]->integer.value,
|
||||||
operand[1]->integer.value,
|
operand[1]->integer.value,
|
||||||
&return_desc1->integer.value,
|
&return_desc1->integer.value,
|
||||||
&return_desc2->integer.value);
|
&return_desc2->integer.value);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_2T_1R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the results to the target reference operands */
|
/* Store the results to the target reference operands */
|
||||||
|
|
||||||
status = acpi_ex_store (return_desc2, operand[2], walk_state);
|
status = acpi_ex_store(return_desc2, operand[2], walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_store (return_desc1, operand[3], walk_state);
|
status = acpi_ex_store(return_desc1, operand[3], walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,24 +242,22 @@ acpi_ex_opcode_2A_2T_1R (
|
|||||||
|
|
||||||
walk_state->result_obj = return_desc1;
|
walk_state->result_obj = return_desc1;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
/*
|
/*
|
||||||
* Since the remainder is not returned indirectly, remove a reference to
|
* Since the remainder is not returned indirectly, remove a reference to
|
||||||
* it. Only the quotient is returned indirectly.
|
* it. Only the quotient is returned indirectly.
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (return_desc2);
|
acpi_ut_remove_reference(return_desc2);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/* Delete the return object */
|
/* Delete the return object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (return_desc1);
|
acpi_ut_remove_reference(return_desc1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_2A_1T_1R
|
* FUNCTION: acpi_ex_opcode_2A_1T_1R
|
||||||
@@ -289,42 +271,39 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
|
||||||
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 **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *return_desc = NULL;
|
union acpi_operand_object *return_desc = NULL;
|
||||||
acpi_integer index;
|
acpi_integer index;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_size length;
|
acpi_size length;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_1T_1R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
/* Execute the opcode */
|
/* Execute the opcode */
|
||||||
|
|
||||||
if (walk_state->op_info->flags & AML_MATH) {
|
if (walk_state->op_info->flags & AML_MATH) {
|
||||||
/* All simple math opcodes (add, etc.) */
|
/* All simple math opcodes (add, etc.) */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_desc->integer.value = acpi_ex_do_math_op (walk_state->opcode,
|
return_desc->integer.value =
|
||||||
operand[0]->integer.value,
|
acpi_ex_do_math_op(walk_state->opcode,
|
||||||
operand[1]->integer.value);
|
operand[0]->integer.value,
|
||||||
|
operand[1]->integer.value);
|
||||||
goto store_result_to_target;
|
goto store_result_to_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
|
case AML_MOD_OP: /* Mod (Dividend, Divisor, remainder_result (ACPI 2.0) */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -332,21 +311,18 @@ acpi_ex_opcode_2A_1T_1R (
|
|||||||
|
|
||||||
/* return_desc will contain the remainder */
|
/* return_desc will contain the remainder */
|
||||||
|
|
||||||
status = acpi_ut_divide (operand[0]->integer.value,
|
status = acpi_ut_divide(operand[0]->integer.value,
|
||||||
operand[1]->integer.value,
|
operand[1]->integer.value,
|
||||||
NULL,
|
NULL, &return_desc->integer.value);
|
||||||
&return_desc->integer.value);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
|
||||||
|
|
||||||
case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
|
status = acpi_ex_do_concatenate(operand[0], operand[1],
|
||||||
|
&return_desc, walk_state);
|
||||||
status = acpi_ex_do_concatenate (operand[0], operand[1],
|
|
||||||
&return_desc, walk_state);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
|
||||||
case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Input object is guaranteed to be a buffer at this point (it may have
|
* Input object is guaranteed to be a buffer at this point (it may have
|
||||||
@@ -365,8 +341,8 @@ acpi_ex_opcode_2A_1T_1R (
|
|||||||
*/
|
*/
|
||||||
length = 0;
|
length = 0;
|
||||||
while ((length < operand[0]->buffer.length) &&
|
while ((length < operand[0]->buffer.length) &&
|
||||||
(length < operand[1]->integer.value) &&
|
(length < operand[1]->integer.value) &&
|
||||||
(operand[0]->buffer.pointer[length])) {
|
(operand[0]->buffer.pointer[length])) {
|
||||||
length++;
|
length++;
|
||||||
if (length > ACPI_MAX_STRING_CONVERSION) {
|
if (length > ACPI_MAX_STRING_CONVERSION) {
|
||||||
status = AE_AML_STRING_LIMIT;
|
status = AE_AML_STRING_LIMIT;
|
||||||
@@ -376,33 +352,32 @@ acpi_ex_opcode_2A_1T_1R (
|
|||||||
|
|
||||||
/* Allocate a new string object */
|
/* Allocate a new string object */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_string_object (length);
|
return_desc = acpi_ut_create_string_object(length);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the raw buffer data with no transform. NULL terminated already*/
|
/* Copy the raw buffer data with no transform. NULL terminated already */
|
||||||
|
|
||||||
ACPI_MEMCPY (return_desc->string.pointer,
|
ACPI_MEMCPY(return_desc->string.pointer,
|
||||||
operand[0]->buffer.pointer, length);
|
operand[0]->buffer.pointer, length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_CONCAT_RES_OP:
|
case AML_CONCAT_RES_OP:
|
||||||
|
|
||||||
/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
|
/* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */
|
||||||
|
|
||||||
status = acpi_ex_concat_template (operand[0], operand[1],
|
status = acpi_ex_concat_template(operand[0], operand[1],
|
||||||
&return_desc, walk_state);
|
&return_desc, walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_INDEX_OP: /* Index (Source Index Result) */
|
||||||
case AML_INDEX_OP: /* Index (Source Index Result) */
|
|
||||||
|
|
||||||
/* Create the internal return object */
|
/* 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) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -412,76 +387,75 @@ acpi_ex_opcode_2A_1T_1R (
|
|||||||
|
|
||||||
/* At this point, the Source operand is a Package, Buffer, or String */
|
/* At this point, the Source operand is a Package, Buffer, or String */
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (operand[0]) == ACPI_TYPE_PACKAGE) {
|
if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) {
|
||||||
/* Object to be indexed is a Package */
|
/* Object to be indexed is a Package */
|
||||||
|
|
||||||
if (index >= operand[0]->package.count) {
|
if (index >= operand[0]->package.count) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Index value (%X%8.8X) beyond package end (%X)\n",
|
"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;
|
status = AE_AML_PACKAGE_LIMIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
|
return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
|
||||||
return_desc->reference.object = operand[0];
|
return_desc->reference.object = operand[0];
|
||||||
return_desc->reference.where = &operand[0]->package.elements [
|
return_desc->reference.where =
|
||||||
index];
|
&operand[0]->package.elements[index];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Object to be indexed is a Buffer/String */
|
/* Object to be indexed is a Buffer/String */
|
||||||
|
|
||||||
if (index >= operand[0]->buffer.length) {
|
if (index >= operand[0]->buffer.length) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Index value (%X%8.8X) beyond end of buffer (%X)\n",
|
"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;
|
status = AE_AML_BUFFER_LIMIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_desc->reference.target_type = ACPI_TYPE_BUFFER_FIELD;
|
return_desc->reference.target_type =
|
||||||
return_desc->reference.object = operand[0];
|
ACPI_TYPE_BUFFER_FIELD;
|
||||||
|
return_desc->reference.object = operand[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a reference to the target package/buffer/string for the life
|
* Add a reference to the target package/buffer/string for the life
|
||||||
* of the index.
|
* of the index.
|
||||||
*/
|
*/
|
||||||
acpi_ut_add_reference (operand[0]);
|
acpi_ut_add_reference(operand[0]);
|
||||||
|
|
||||||
/* Complete the Index reference object */
|
/* Complete the Index reference object */
|
||||||
|
|
||||||
return_desc->reference.opcode = AML_INDEX_OP;
|
return_desc->reference.opcode = AML_INDEX_OP;
|
||||||
return_desc->reference.offset = (u32) index;
|
return_desc->reference.offset = (u32) index;
|
||||||
|
|
||||||
/* Store the reference to the Target */
|
/* Store the reference to the Target */
|
||||||
|
|
||||||
status = acpi_ex_store (return_desc, operand[2], walk_state);
|
status = acpi_ex_store(return_desc, operand[2], walk_state);
|
||||||
|
|
||||||
/* Return the reference */
|
/* Return the reference */
|
||||||
|
|
||||||
walk_state->result_obj = return_desc;
|
walk_state->result_obj = return_desc;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_1T_1R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store_result_to_target:
|
||||||
|
|
||||||
store_result_to_target:
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
|
||||||
/*
|
/*
|
||||||
* Store the result of the operation (which is now in return_desc) into
|
* Store the result of the operation (which is now in return_desc) into
|
||||||
* the Target descriptor.
|
* the Target descriptor.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_store (return_desc, operand[2], walk_state);
|
status = acpi_ex_store(return_desc, operand[2], walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,19 +464,17 @@ store_result_to_target:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Delete return object on error */
|
/* Delete return object on error */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_ut_remove_reference (return_desc);
|
acpi_ut_remove_reference(return_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_2A_0T_1R
|
* FUNCTION: acpi_ex_opcode_2A_0T_1R
|
||||||
@@ -515,23 +487,19 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
|
||||||
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 **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *return_desc = NULL;
|
union acpi_operand_object *return_desc = NULL;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u8 logical_result = FALSE;
|
u8 logical_result = FALSE;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_2A_0T_1R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
/* Create the internal return object */
|
/* Create the internal return object */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -542,50 +510,48 @@ acpi_ex_opcode_2A_0T_1R (
|
|||||||
if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
|
if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
|
||||||
/* logical_op (Operand0, Operand1) */
|
/* logical_op (Operand0, Operand1) */
|
||||||
|
|
||||||
status = acpi_ex_do_logical_numeric_op (walk_state->opcode,
|
status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
|
||||||
operand[0]->integer.value, operand[1]->integer.value,
|
operand[0]->integer.
|
||||||
&logical_result);
|
value,
|
||||||
|
operand[1]->integer.
|
||||||
|
value, &logical_result);
|
||||||
goto store_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) */
|
/* logical_op (Operand0, Operand1) */
|
||||||
|
|
||||||
status = acpi_ex_do_logical_op (walk_state->opcode, operand[0],
|
status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],
|
||||||
operand[1], &logical_result);
|
operand[1], &logical_result);
|
||||||
goto store_logical_result;
|
goto store_logical_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
|
case AML_ACQUIRE_OP: /* Acquire (mutex_object, Timeout) */
|
||||||
|
|
||||||
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) {
|
if (status == AE_TIME) {
|
||||||
logical_result = TRUE; /* TRUE = Acquire timed out */
|
logical_result = TRUE; /* TRUE = Acquire timed out */
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AML_WAIT_OP: /* Wait (event_object, Timeout) */
|
||||||
|
|
||||||
case AML_WAIT_OP: /* Wait (event_object, Timeout) */
|
status = acpi_ex_system_wait_event(operand[1], operand[0]);
|
||||||
|
|
||||||
status = acpi_ex_system_wait_event (operand[1], operand[0]);
|
|
||||||
if (status == AE_TIME) {
|
if (status == AE_TIME) {
|
||||||
logical_result = TRUE; /* TRUE, Wait timed out */
|
logical_result = TRUE; /* TRUE, Wait timed out */
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_2A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
store_logical_result:
|
||||||
store_logical_result:
|
|
||||||
/*
|
/*
|
||||||
* Set return value to according to logical_result. logical TRUE (all ones)
|
* Set return value to according to logical_result. logical TRUE (all ones)
|
||||||
* Default is FALSE (zero)
|
* Default is FALSE (zero)
|
||||||
@@ -596,16 +562,13 @@ store_logical_result:
|
|||||||
|
|
||||||
walk_state->result_obj = return_desc;
|
walk_state->result_obj = return_desc;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Delete return object on error */
|
/* Delete return object on error */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_ut_remove_reference (return_desc);
|
acpi_ut_remove_reference(return_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,16 +42,13 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exoparg3")
|
ACPI_MODULE_NAME("exoparg3")
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Naming convention for AML interpreter execution routines.
|
* Naming convention for AML interpreter execution routines.
|
||||||
@@ -74,8 +71,6 @@
|
|||||||
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
||||||
* fully resolved operands.
|
* fully resolved operands.
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_3A_0T_0R
|
* FUNCTION: acpi_ex_opcode_3A_0T_0R
|
||||||
@@ -87,61 +82,53 @@
|
|||||||
* DESCRIPTION: Execute Triadic operator (3 operands)
|
* 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];
|
union acpi_operand_object **operand = &walk_state->operands[0];
|
||||||
struct acpi_signal_fatal_info *fatal;
|
struct acpi_signal_fatal_info *fatal;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_0T_0R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_0T_0R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
|
case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
|
"fatal_op: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
|
||||||
(u32) operand[0]->integer.value,
|
(u32) operand[0]->integer.value,
|
||||||
(u32) operand[1]->integer.value,
|
(u32) operand[1]->integer.value,
|
||||||
(u32) operand[2]->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) {
|
if (fatal) {
|
||||||
fatal->type = (u32) operand[0]->integer.value;
|
fatal->type = (u32) operand[0]->integer.value;
|
||||||
fatal->code = (u32) operand[1]->integer.value;
|
fatal->code = (u32) operand[1]->integer.value;
|
||||||
fatal->argument = (u32) operand[2]->integer.value;
|
fatal->argument = (u32) operand[2]->integer.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always signal the OS! */
|
/* Always signal the OS! */
|
||||||
|
|
||||||
status = acpi_os_signal (ACPI_SIGNAL_FATAL, fatal);
|
status = acpi_os_signal(ACPI_SIGNAL_FATAL, fatal);
|
||||||
|
|
||||||
/* Might return while OS is shutting down, just continue */
|
/* Might return while OS is shutting down, just continue */
|
||||||
|
|
||||||
ACPI_MEM_FREE (fatal);
|
ACPI_MEM_FREE(fatal);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
|
||||||
cleanup:
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_3A_1T_1R
|
* FUNCTION: acpi_ex_opcode_3A_1T_1R
|
||||||
@@ -154,31 +141,28 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state)
|
||||||
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 **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *return_desc = NULL;
|
union acpi_operand_object *return_desc = NULL;
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_integer index;
|
acpi_integer index;
|
||||||
acpi_size length;
|
acpi_size length;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_3A_1T_1R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_3A_1T_1R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
|
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create the return object. The Source operand is guaranteed to be
|
* Create the return object. The Source operand is guaranteed to be
|
||||||
* either a String or a Buffer, so just use its type.
|
* either a String or a Buffer, so just use its type.
|
||||||
*/
|
*/
|
||||||
return_desc = acpi_ut_create_internal_object (
|
return_desc =
|
||||||
ACPI_GET_OBJECT_TYPE (operand[0]));
|
acpi_ut_create_internal_object(ACPI_GET_OBJECT_TYPE
|
||||||
|
(operand[0]));
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -201,17 +185,17 @@ acpi_ex_opcode_3A_1T_1R (
|
|||||||
|
|
||||||
else if ((index + length) > operand[0]->string.length) {
|
else if ((index + length) > operand[0]->string.length) {
|
||||||
length = (acpi_size) operand[0]->string.length -
|
length = (acpi_size) operand[0]->string.length -
|
||||||
(acpi_size) index;
|
(acpi_size) index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Strings always have a sub-pointer, not so for buffers */
|
/* Strings always have a sub-pointer, not so for buffers */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (operand[0])) {
|
switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
/* Always allocate a new buffer for the String */
|
/* Always allocate a new buffer for the String */
|
||||||
|
|
||||||
buffer = ACPI_MEM_CALLOCATE ((acpi_size) length + 1);
|
buffer = ACPI_MEM_CALLOCATE((acpi_size) length + 1);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -225,7 +209,7 @@ acpi_ex_opcode_3A_1T_1R (
|
|||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
/* Allocate a new buffer for the Buffer */
|
/* Allocate a new buffer for the Buffer */
|
||||||
|
|
||||||
buffer = ACPI_MEM_CALLOCATE (length);
|
buffer = ACPI_MEM_CALLOCATE(length);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -233,7 +217,7 @@ acpi_ex_opcode_3A_1T_1R (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* Should not happen */
|
default: /* Should not happen */
|
||||||
|
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -242,8 +226,8 @@ acpi_ex_opcode_3A_1T_1R (
|
|||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
/* Copy the portion requested */
|
/* Copy the portion requested */
|
||||||
|
|
||||||
ACPI_MEMCPY (buffer, operand[0]->string.pointer + index,
|
ACPI_MEMCPY(buffer, operand[0]->string.pointer + index,
|
||||||
length);
|
length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the length of the new String/Buffer */
|
/* Set the length of the new String/Buffer */
|
||||||
@@ -256,25 +240,23 @@ acpi_ex_opcode_3A_1T_1R (
|
|||||||
return_desc->buffer.flags |= AOPOBJ_DATA_VALID;
|
return_desc->buffer.flags |= AOPOBJ_DATA_VALID;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_3A_0T_0R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the result in the target */
|
/* Store the result in the target */
|
||||||
|
|
||||||
status = acpi_ex_store (return_desc, operand[3], walk_state);
|
status = acpi_ex_store(return_desc, operand[3], walk_state);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
/* Delete return object on error */
|
/* Delete return object on error */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status) || walk_state->result_obj) {
|
if (ACPI_FAILURE(status) || walk_state->result_obj) {
|
||||||
acpi_ut_remove_reference (return_desc);
|
acpi_ut_remove_reference(return_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the return object and exit */
|
/* Set the return object and exit */
|
||||||
@@ -282,7 +264,5 @@ cleanup:
|
|||||||
else {
|
else {
|
||||||
walk_state->result_obj = return_desc;
|
walk_state->result_obj = return_desc;
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,16 +42,13 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exoparg6")
|
ACPI_MODULE_NAME("exoparg6")
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Naming convention for AML interpreter execution routines.
|
* Naming convention for AML interpreter execution routines.
|
||||||
@@ -74,15 +71,11 @@
|
|||||||
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
* The AcpiExOpcode* functions are called via the Dispatcher component with
|
||||||
* fully resolved operands.
|
* fully resolved operands.
|
||||||
!*/
|
!*/
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static u8
|
static u8
|
||||||
acpi_ex_do_match (
|
acpi_ex_do_match(u32 match_op,
|
||||||
u32 match_op,
|
union acpi_operand_object *package_obj,
|
||||||
union acpi_operand_object *package_obj,
|
union acpi_operand_object *match_obj);
|
||||||
union acpi_operand_object *match_obj);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -101,14 +94,12 @@ acpi_ex_do_match (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u8
|
static u8
|
||||||
acpi_ex_do_match (
|
acpi_ex_do_match(u32 match_op,
|
||||||
u32 match_op,
|
union acpi_operand_object *package_obj,
|
||||||
union acpi_operand_object *package_obj,
|
union acpi_operand_object *match_obj)
|
||||||
union acpi_operand_object *match_obj)
|
|
||||||
{
|
{
|
||||||
u8 logical_result = TRUE;
|
u8 logical_result = TRUE;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: Since the package_obj/match_obj ordering is opposite to that of
|
* Note: Since the package_obj/match_obj ordering is opposite to that of
|
||||||
@@ -133,9 +124,10 @@ acpi_ex_do_match (
|
|||||||
* True if equal: (P[i] == M)
|
* True if equal: (P[i] == M)
|
||||||
* Change to: (M == P[i])
|
* Change to: (M == P[i])
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_do_logical_op (AML_LEQUAL_OP, match_obj, package_obj,
|
status =
|
||||||
&logical_result);
|
acpi_ex_do_logical_op(AML_LEQUAL_OP, match_obj, package_obj,
|
||||||
if (ACPI_FAILURE (status)) {
|
&logical_result);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -146,12 +138,13 @@ acpi_ex_do_match (
|
|||||||
* True if less than or equal: (P[i] <= M) (P[i] not_greater than M)
|
* 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])
|
* 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 =
|
||||||
&logical_result);
|
acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
|
||||||
if (ACPI_FAILURE (status)) {
|
&logical_result);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
logical_result = (u8) !logical_result;
|
logical_result = (u8) ! logical_result;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MATCH_MLT:
|
case MATCH_MLT:
|
||||||
@@ -160,9 +153,10 @@ acpi_ex_do_match (
|
|||||||
* True if less than: (P[i] < M)
|
* True if less than: (P[i] < M)
|
||||||
* Change to: (M > P[i])
|
* Change to: (M > P[i])
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
|
status =
|
||||||
&logical_result);
|
acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
|
||||||
if (ACPI_FAILURE (status)) {
|
package_obj, &logical_result);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -173,12 +167,13 @@ acpi_ex_do_match (
|
|||||||
* True if greater than or equal: (P[i] >= M) (P[i] not_less than M)
|
* 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])
|
* Change to: (M <= P[i]) (M not_greater than P[i])
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_do_logical_op (AML_LGREATER_OP, match_obj, package_obj,
|
status =
|
||||||
&logical_result);
|
acpi_ex_do_logical_op(AML_LGREATER_OP, match_obj,
|
||||||
if (ACPI_FAILURE (status)) {
|
package_obj, &logical_result);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
logical_result = (u8)!logical_result;
|
logical_result = (u8) ! logical_result;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MATCH_MGT:
|
case MATCH_MGT:
|
||||||
@@ -187,9 +182,10 @@ acpi_ex_do_match (
|
|||||||
* True if greater than: (P[i] > M)
|
* True if greater than: (P[i] > M)
|
||||||
* Change to: (M < P[i])
|
* Change to: (M < P[i])
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_do_logical_op (AML_LLESS_OP, match_obj, package_obj,
|
status =
|
||||||
&logical_result);
|
acpi_ex_do_logical_op(AML_LLESS_OP, match_obj, package_obj,
|
||||||
if (ACPI_FAILURE (status)) {
|
&logical_result);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -204,7 +200,6 @@ acpi_ex_do_match (
|
|||||||
return logical_result;
|
return logical_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_opcode_6A_0T_1R
|
* FUNCTION: acpi_ex_opcode_6A_0T_1R
|
||||||
@@ -217,20 +212,16 @@ acpi_ex_do_match (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state)
|
||||||
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 **operand = &walk_state->operands[0];
|
||||||
union acpi_operand_object *return_desc = NULL;
|
union acpi_operand_object *return_desc = NULL;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_integer index;
|
acpi_integer index;
|
||||||
union acpi_operand_object *this_element;
|
union acpi_operand_object *this_element;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_STR ("ex_opcode_6A_0T_1R",
|
|
||||||
acpi_ps_get_opcode_name (walk_state->opcode));
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_STR("ex_opcode_6A_0T_1R",
|
||||||
|
acpi_ps_get_opcode_name(walk_state->opcode));
|
||||||
|
|
||||||
switch (walk_state->opcode) {
|
switch (walk_state->opcode) {
|
||||||
case AML_MATCH_OP:
|
case AML_MATCH_OP:
|
||||||
@@ -242,8 +233,9 @@ acpi_ex_opcode_6A_0T_1R (
|
|||||||
/* Validate both Match Term Operators (MTR, MEQ, etc.) */
|
/* Validate both Match Term Operators (MTR, MEQ, etc.) */
|
||||||
|
|
||||||
if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
|
if ((operand[1]->integer.value > MAX_MATCH_OPERATOR) ||
|
||||||
(operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
|
(operand[3]->integer.value > MAX_MATCH_OPERATOR)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Match operator out of range\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
|
"Match operator out of range\n"));
|
||||||
status = AE_AML_OPERAND_VALUE;
|
status = AE_AML_OPERAND_VALUE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -252,16 +244,17 @@ acpi_ex_opcode_6A_0T_1R (
|
|||||||
|
|
||||||
index = operand[5]->integer.value;
|
index = operand[5]->integer.value;
|
||||||
if (index >= operand[0]->package.count) {
|
if (index >= operand[0]->package.count) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Index (%X%8.8X) beyond package end (%X)\n",
|
"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;
|
status = AE_AML_PACKAGE_LIMIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an integer for the return value */
|
/* Create an integer for the return value */
|
||||||
|
|
||||||
return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);
|
return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
|
||||||
if (!return_desc) {
|
if (!return_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -283,7 +276,7 @@ acpi_ex_opcode_6A_0T_1R (
|
|||||||
* ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
|
* ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
|
||||||
* match was found.
|
* match was found.
|
||||||
*/
|
*/
|
||||||
for ( ; index < operand[0]->package.count; index++) {
|
for (; index < operand[0]->package.count; index++) {
|
||||||
/* Get the current package element */
|
/* Get the current package element */
|
||||||
|
|
||||||
this_element = operand[0]->package.elements[index];
|
this_element = operand[0]->package.elements[index];
|
||||||
@@ -299,13 +292,13 @@ acpi_ex_opcode_6A_0T_1R (
|
|||||||
* (proceed to next iteration of enclosing for loop) signifies a
|
* (proceed to next iteration of enclosing for loop) signifies a
|
||||||
* non-match.
|
* non-match.
|
||||||
*/
|
*/
|
||||||
if (!acpi_ex_do_match ((u32) operand[1]->integer.value,
|
if (!acpi_ex_do_match((u32) operand[1]->integer.value,
|
||||||
this_element, operand[2])) {
|
this_element, operand[2])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!acpi_ex_do_match ((u32) operand[3]->integer.value,
|
if (!acpi_ex_do_match((u32) operand[3]->integer.value,
|
||||||
this_element, operand[4])) {
|
this_element, operand[4])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,31 +309,27 @@ acpi_ex_opcode_6A_0T_1R (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_LOAD_TABLE_OP:
|
case AML_LOAD_TABLE_OP:
|
||||||
|
|
||||||
status = acpi_ex_load_table_op (walk_state, &return_desc);
|
status = acpi_ex_load_table_op(walk_state, &return_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n",
|
ACPI_REPORT_ERROR(("acpi_ex_opcode_6A_0T_1R: Unknown opcode %X\n", walk_state->opcode));
|
||||||
walk_state->opcode));
|
|
||||||
status = AE_AML_BAD_OPCODE;
|
status = AE_AML_BAD_OPCODE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
walk_state->result_obj = return_desc;
|
walk_state->result_obj = return_desc;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Delete return object on error */
|
/* Delete return object on error */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_ut_remove_reference (return_desc);
|
acpi_ut_remove_reference(return_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,32 +42,24 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exprep")
|
ACPI_MODULE_NAME("exprep")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ex_decode_field_access (
|
acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
u8 field_flags, u32 * return_byte_alignment);
|
||||||
u8 field_flags,
|
|
||||||
u32 *return_byte_alignment);
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_UNDER_DEVELOPMENT
|
#ifdef ACPI_UNDER_DEVELOPMENT
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ex_generate_access (
|
acpi_ex_generate_access(u32 field_bit_offset,
|
||||||
u32 field_bit_offset,
|
u32 field_bit_length, u32 region_length);
|
||||||
u32 field_bit_length,
|
|
||||||
u32 region_length);
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -92,39 +84,36 @@ acpi_ex_generate_access (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ex_generate_access (
|
acpi_ex_generate_access(u32 field_bit_offset,
|
||||||
u32 field_bit_offset,
|
u32 field_bit_length, u32 region_length)
|
||||||
u32 field_bit_length,
|
|
||||||
u32 region_length)
|
|
||||||
{
|
{
|
||||||
u32 field_byte_length;
|
u32 field_byte_length;
|
||||||
u32 field_byte_offset;
|
u32 field_byte_offset;
|
||||||
u32 field_byte_end_offset;
|
u32 field_byte_end_offset;
|
||||||
u32 access_byte_width;
|
u32 access_byte_width;
|
||||||
u32 field_start_offset;
|
u32 field_start_offset;
|
||||||
u32 field_end_offset;
|
u32 field_end_offset;
|
||||||
u32 minimum_access_width = 0xFFFFFFFF;
|
u32 minimum_access_width = 0xFFFFFFFF;
|
||||||
u32 minimum_accesses = 0xFFFFFFFF;
|
u32 minimum_accesses = 0xFFFFFFFF;
|
||||||
u32 accesses;
|
u32 accesses;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_generate_access");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_generate_access");
|
||||||
|
|
||||||
/* Round Field start offset and length to "minimal" byte boundaries */
|
/* Round Field start offset and length to "minimal" byte boundaries */
|
||||||
|
|
||||||
field_byte_offset = ACPI_DIV_8 (ACPI_ROUND_DOWN (field_bit_offset, 8));
|
field_byte_offset = ACPI_DIV_8(ACPI_ROUND_DOWN(field_bit_offset, 8));
|
||||||
field_byte_end_offset = ACPI_DIV_8 (ACPI_ROUND_UP (field_bit_length +
|
field_byte_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length +
|
||||||
field_bit_offset, 8));
|
field_bit_offset, 8));
|
||||||
field_byte_length = field_byte_end_offset - field_byte_offset;
|
field_byte_length = field_byte_end_offset - field_byte_offset;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Bit length %d, Bit offset %d\n",
|
"Bit length %d, Bit offset %d\n",
|
||||||
field_bit_length, field_bit_offset));
|
field_bit_length, field_bit_offset));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Byte Length %d, Byte Offset %d, End Offset %d\n",
|
"Byte Length %d, Byte Offset %d, End Offset %d\n",
|
||||||
field_byte_length, field_byte_offset, field_byte_end_offset));
|
field_byte_length, field_byte_offset,
|
||||||
|
field_byte_end_offset));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Iterative search for the maximum access width that is both aligned
|
* 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)
|
* 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
|
* 1) Round end offset up to next access boundary and make sure that
|
||||||
* this does not go beyond the end of the parent region.
|
* this does not go beyond the end of the parent region.
|
||||||
@@ -140,31 +130,37 @@ acpi_ex_generate_access (
|
|||||||
* are done. (This does not optimize for the perfectly aligned
|
* are done. (This does not optimize for the perfectly aligned
|
||||||
* case yet).
|
* 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 =
|
field_start_offset =
|
||||||
ACPI_ROUND_DOWN (field_byte_offset, access_byte_width) /
|
ACPI_ROUND_DOWN(field_byte_offset,
|
||||||
access_byte_width;
|
access_byte_width) /
|
||||||
|
access_byte_width;
|
||||||
|
|
||||||
field_end_offset =
|
field_end_offset =
|
||||||
ACPI_ROUND_UP ((field_byte_length + field_byte_offset),
|
ACPI_ROUND_UP((field_byte_length +
|
||||||
access_byte_width) / access_byte_width;
|
field_byte_offset),
|
||||||
|
access_byte_width) /
|
||||||
|
access_byte_width;
|
||||||
|
|
||||||
accesses = field_end_offset - field_start_offset;
|
accesses = field_end_offset - field_start_offset;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"access_width %d end is within region\n", access_byte_width));
|
"access_width %d end is within region\n",
|
||||||
|
access_byte_width));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Field Start %d, Field End %d -- requires %d accesses\n",
|
"Field Start %d, Field End %d -- requires %d accesses\n",
|
||||||
field_start_offset, field_end_offset, accesses));
|
field_start_offset, field_end_offset,
|
||||||
|
accesses));
|
||||||
|
|
||||||
/* Single access is optimal */
|
/* Single access is optimal */
|
||||||
|
|
||||||
if (accesses <= 1) {
|
if (accesses <= 1) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Entire field can be accessed with one operation of size %d\n",
|
"Entire field can be accessed with one operation of size %d\n",
|
||||||
access_byte_width));
|
access_byte_width));
|
||||||
return_VALUE (access_byte_width);
|
return_VALUE(access_byte_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -172,30 +168,30 @@ acpi_ex_generate_access (
|
|||||||
* try the next wider access on next iteration
|
* try the next wider access on next iteration
|
||||||
*/
|
*/
|
||||||
if (accesses < minimum_accesses) {
|
if (accesses < minimum_accesses) {
|
||||||
minimum_accesses = accesses;
|
minimum_accesses = accesses;
|
||||||
minimum_access_width = access_byte_width;
|
minimum_access_width = access_byte_width;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
"access_width %d end is NOT within region\n",
|
||||||
"access_width %d end is NOT within region\n", access_byte_width));
|
access_byte_width));
|
||||||
if (access_byte_width == 1) {
|
if (access_byte_width == 1) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Field goes beyond end-of-region!\n"));
|
"Field goes beyond end-of-region!\n"));
|
||||||
|
|
||||||
/* Field does not fit in the region at all */
|
/* Field does not fit in the region at all */
|
||||||
|
|
||||||
return_VALUE (0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This width goes beyond the end-of-region, back off to
|
* This width goes beyond the end-of-region, back off to
|
||||||
* previous access
|
* previous access
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Backing off to previous optimal access width of %d\n",
|
"Backing off to previous optimal access width of %d\n",
|
||||||
minimum_access_width));
|
minimum_access_width));
|
||||||
return_VALUE (minimum_access_width);
|
return_VALUE(minimum_access_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,12 +199,11 @@ acpi_ex_generate_access (
|
|||||||
* Could not read/write field with one operation,
|
* Could not read/write field with one operation,
|
||||||
* just use max access width
|
* just use max access width
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Cannot access field in one operation, using width 8\n"));
|
"Cannot access field in one operation, using width 8\n"));
|
||||||
return_VALUE (8);
|
return_VALUE(8);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_UNDER_DEVELOPMENT */
|
#endif /* ACPI_UNDER_DEVELOPMENT */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -226,18 +221,14 @@ acpi_ex_generate_access (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ex_decode_field_access (
|
acpi_ex_decode_field_access(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
u8 field_flags, u32 * return_byte_alignment)
|
||||||
u8 field_flags,
|
|
||||||
u32 *return_byte_alignment)
|
|
||||||
{
|
{
|
||||||
u32 access;
|
u32 access;
|
||||||
u32 byte_alignment;
|
u32 byte_alignment;
|
||||||
u32 bit_length;
|
u32 bit_length;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_decode_field_access");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_decode_field_access");
|
||||||
|
|
||||||
access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
|
access = (field_flags & AML_FIELD_ACCESS_TYPE_MASK);
|
||||||
|
|
||||||
@@ -246,9 +237,12 @@ acpi_ex_decode_field_access (
|
|||||||
|
|
||||||
#ifdef ACPI_UNDER_DEVELOPMENT
|
#ifdef ACPI_UNDER_DEVELOPMENT
|
||||||
byte_alignment =
|
byte_alignment =
|
||||||
acpi_ex_generate_access (obj_desc->common_field.start_field_bit_offset,
|
acpi_ex_generate_access(obj_desc->common_field.
|
||||||
obj_desc->common_field.bit_length,
|
start_field_bit_offset,
|
||||||
0xFFFFFFFF /* Temp until we pass region_length as parameter */);
|
obj_desc->common_field.bit_length,
|
||||||
|
0xFFFFFFFF
|
||||||
|
/* Temp until we pass region_length as parameter */
|
||||||
|
);
|
||||||
bit_length = byte_alignment * 8;
|
bit_length = byte_alignment * 8;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -257,36 +251,35 @@ acpi_ex_decode_field_access (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_FIELD_ACCESS_BYTE:
|
case AML_FIELD_ACCESS_BYTE:
|
||||||
case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
|
case AML_FIELD_ACCESS_BUFFER: /* ACPI 2.0 (SMBus Buffer) */
|
||||||
byte_alignment = 1;
|
byte_alignment = 1;
|
||||||
bit_length = 8;
|
bit_length = 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_FIELD_ACCESS_WORD:
|
case AML_FIELD_ACCESS_WORD:
|
||||||
byte_alignment = 2;
|
byte_alignment = 2;
|
||||||
bit_length = 16;
|
bit_length = 16;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_FIELD_ACCESS_DWORD:
|
case AML_FIELD_ACCESS_DWORD:
|
||||||
byte_alignment = 4;
|
byte_alignment = 4;
|
||||||
bit_length = 32;
|
bit_length = 32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
|
case AML_FIELD_ACCESS_QWORD: /* ACPI 2.0 */
|
||||||
byte_alignment = 8;
|
byte_alignment = 8;
|
||||||
bit_length = 64;
|
bit_length = 64;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Invalid field access type */
|
/* Invalid field access type */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unknown field access type %X\n",
|
"Unknown field access type %X\n", access));
|
||||||
access));
|
return_VALUE(0);
|
||||||
return_VALUE (0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
|
||||||
/*
|
/*
|
||||||
* buffer_field access can be on any byte boundary, so the
|
* buffer_field access can be on any byte boundary, so the
|
||||||
* byte_alignment is always 1 byte -- regardless of any byte_alignment
|
* byte_alignment is always 1 byte -- regardless of any byte_alignment
|
||||||
@@ -296,10 +289,9 @@ acpi_ex_decode_field_access (
|
|||||||
}
|
}
|
||||||
|
|
||||||
*return_byte_alignment = byte_alignment;
|
*return_byte_alignment = byte_alignment;
|
||||||
return_VALUE (bit_length);
|
return_VALUE(bit_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_prep_common_field_object
|
* FUNCTION: acpi_ex_prep_common_field_object
|
||||||
@@ -322,20 +314,16 @@ acpi_ex_decode_field_access (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_prep_common_field_object (
|
acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
|
||||||
union acpi_operand_object *obj_desc,
|
u8 field_flags,
|
||||||
u8 field_flags,
|
u8 field_attribute,
|
||||||
u8 field_attribute,
|
u32 field_bit_position, u32 field_bit_length)
|
||||||
u32 field_bit_position,
|
|
||||||
u32 field_bit_length)
|
|
||||||
{
|
{
|
||||||
u32 access_bit_width;
|
u32 access_bit_width;
|
||||||
u32 byte_alignment;
|
u32 byte_alignment;
|
||||||
u32 nearest_byte_address;
|
u32 nearest_byte_address;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_prep_common_field_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_prep_common_field_object");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: the structure being initialized is the
|
* Note: the structure being initialized is the
|
||||||
@@ -361,16 +349,16 @@ acpi_ex_prep_common_field_object (
|
|||||||
* For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
|
* For all other access types (Byte, Word, Dword, Qword), the Bitwidth is
|
||||||
* the same (equivalent) as the byte_alignment.
|
* the same (equivalent) as the byte_alignment.
|
||||||
*/
|
*/
|
||||||
access_bit_width = acpi_ex_decode_field_access (obj_desc, field_flags,
|
access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags,
|
||||||
&byte_alignment);
|
&byte_alignment);
|
||||||
if (!access_bit_width) {
|
if (!access_bit_width) {
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
|
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup width (access granularity) fields */
|
/* Setup width (access granularity) fields */
|
||||||
|
|
||||||
obj_desc->common_field.access_byte_width = (u8)
|
obj_desc->common_field.access_byte_width = (u8)
|
||||||
ACPI_DIV_8 (access_bit_width); /* 1, 2, 4, 8 */
|
ACPI_DIV_8(access_bit_width); /* 1, 2, 4, 8 */
|
||||||
|
|
||||||
obj_desc->common_field.access_bit_width = (u8) access_bit_width;
|
obj_desc->common_field.access_bit_width = (u8) access_bit_width;
|
||||||
|
|
||||||
@@ -385,30 +373,30 @@ acpi_ex_prep_common_field_object (
|
|||||||
* region or buffer.
|
* region or buffer.
|
||||||
*/
|
*/
|
||||||
nearest_byte_address =
|
nearest_byte_address =
|
||||||
ACPI_ROUND_BITS_DOWN_TO_BYTES (field_bit_position);
|
ACPI_ROUND_BITS_DOWN_TO_BYTES(field_bit_position);
|
||||||
obj_desc->common_field.base_byte_offset = (u32)
|
obj_desc->common_field.base_byte_offset = (u32)
|
||||||
ACPI_ROUND_DOWN (nearest_byte_address, byte_alignment);
|
ACPI_ROUND_DOWN(nearest_byte_address, byte_alignment);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* start_field_bit_offset is the offset of the first bit of the field within
|
* start_field_bit_offset is the offset of the first bit of the field within
|
||||||
* a field datum.
|
* a field datum.
|
||||||
*/
|
*/
|
||||||
obj_desc->common_field.start_field_bit_offset = (u8)
|
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)
|
* Does the entire field fit within a single field access element? (datum)
|
||||||
* (i.e., without crossing a datum boundary)
|
* (i.e., without crossing a datum boundary)
|
||||||
*/
|
*/
|
||||||
if ((obj_desc->common_field.start_field_bit_offset + field_bit_length) <=
|
if ((obj_desc->common_field.start_field_bit_offset +
|
||||||
(u16) access_bit_width) {
|
field_bit_length) <= (u16) access_bit_width) {
|
||||||
obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
|
obj_desc->common.flags |= AOPOBJ_SINGLE_DATUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_prep_field_value
|
* FUNCTION: acpi_ex_prep_field_value
|
||||||
@@ -422,51 +410,49 @@ acpi_ex_prep_common_field_object (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
|
||||||
acpi_ex_prep_field_value (
|
|
||||||
struct acpi_create_field_info *info)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
u32 type;
|
u32 type;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_prep_field_value");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_prep_field_value");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
|
if (info->field_type != ACPI_TYPE_LOCAL_INDEX_FIELD) {
|
||||||
if (!info->region_node) {
|
if (!info->region_node) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null region_node\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null region_node\n"));
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
type = acpi_ns_get_type (info->region_node);
|
type = acpi_ns_get_type(info->region_node);
|
||||||
if (type != ACPI_TYPE_REGION) {
|
if (type != ACPI_TYPE_REGION) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed Region, found type %X (%s)\n",
|
"Needed Region, found type %X (%s)\n",
|
||||||
type, acpi_ut_get_type_name (type)));
|
type, acpi_ut_get_type_name(type)));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate a new field object */
|
/* Allocate a new field object */
|
||||||
|
|
||||||
obj_desc = acpi_ut_create_internal_object (info->field_type);
|
obj_desc = acpi_ut_create_internal_object(info->field_type);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize areas of the object that are common to all fields */
|
/* Initialize areas of the object that are common to all fields */
|
||||||
|
|
||||||
obj_desc->common_field.node = info->field_node;
|
obj_desc->common_field.node = info->field_node;
|
||||||
status = acpi_ex_prep_common_field_object (obj_desc, info->field_flags,
|
status = acpi_ex_prep_common_field_object(obj_desc, info->field_flags,
|
||||||
info->attribute, info->field_bit_position, info->field_bit_length);
|
info->attribute,
|
||||||
if (ACPI_FAILURE (status)) {
|
info->field_bit_position,
|
||||||
acpi_ut_delete_object_desc (obj_desc);
|
info->field_bit_length);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_ut_delete_object_desc(obj_desc);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize areas of the object that are specific to the field type */
|
/* Initialize areas of the object that are specific to the field type */
|
||||||
@@ -474,71 +460,73 @@ acpi_ex_prep_field_value (
|
|||||||
switch (info->field_type) {
|
switch (info->field_type) {
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
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 */
|
/* An additional reference for the container */
|
||||||
|
|
||||||
acpi_ut_add_reference (obj_desc->field.region_obj);
|
acpi_ut_add_reference(obj_desc->field.region_obj);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"region_field: bit_off %X, Off %X, Gran %X, Region %p\n",
|
"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.start_field_bit_offset,
|
||||||
obj_desc->field.access_byte_width, obj_desc->field.region_obj));
|
obj_desc->field.base_byte_offset,
|
||||||
|
obj_desc->field.access_byte_width,
|
||||||
|
obj_desc->field.region_obj));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
|
|
||||||
obj_desc->bank_field.value = info->bank_value;
|
obj_desc->bank_field.value = info->bank_value;
|
||||||
obj_desc->bank_field.region_obj = acpi_ns_get_attached_object (
|
obj_desc->bank_field.region_obj =
|
||||||
info->region_node);
|
acpi_ns_get_attached_object(info->region_node);
|
||||||
obj_desc->bank_field.bank_obj = acpi_ns_get_attached_object (
|
obj_desc->bank_field.bank_obj =
|
||||||
info->register_node);
|
acpi_ns_get_attached_object(info->register_node);
|
||||||
|
|
||||||
/* An additional reference for the attached objects */
|
/* An additional reference for the attached objects */
|
||||||
|
|
||||||
acpi_ut_add_reference (obj_desc->bank_field.region_obj);
|
acpi_ut_add_reference(obj_desc->bank_field.region_obj);
|
||||||
acpi_ut_add_reference (obj_desc->bank_field.bank_obj);
|
acpi_ut_add_reference(obj_desc->bank_field.bank_obj);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
|
"Bank Field: bit_off %X, Off %X, Gran %X, Region %p, bank_reg %p\n",
|
||||||
obj_desc->bank_field.start_field_bit_offset,
|
obj_desc->bank_field.start_field_bit_offset,
|
||||||
obj_desc->bank_field.base_byte_offset,
|
obj_desc->bank_field.base_byte_offset,
|
||||||
obj_desc->field.access_byte_width,
|
obj_desc->field.access_byte_width,
|
||||||
obj_desc->bank_field.region_obj,
|
obj_desc->bank_field.region_obj,
|
||||||
obj_desc->bank_field.bank_obj));
|
obj_desc->bank_field.bank_obj));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
|
|
||||||
obj_desc->index_field.index_obj = acpi_ns_get_attached_object (
|
obj_desc->index_field.index_obj =
|
||||||
info->register_node);
|
acpi_ns_get_attached_object(info->register_node);
|
||||||
obj_desc->index_field.data_obj = acpi_ns_get_attached_object (
|
obj_desc->index_field.data_obj =
|
||||||
info->data_register_node);
|
acpi_ns_get_attached_object(info->data_register_node);
|
||||||
obj_desc->index_field.value = (u32)
|
obj_desc->index_field.value = (u32)
|
||||||
(info->field_bit_position / ACPI_MUL_8 (
|
(info->field_bit_position /
|
||||||
obj_desc->field.access_byte_width));
|
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
|
||||||
ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
|
|| !obj_desc->index_field.index_obj) {
|
||||||
acpi_ut_delete_object_desc (obj_desc);
|
ACPI_REPORT_ERROR(("Null Index Object during field prep\n"));
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
acpi_ut_delete_object_desc(obj_desc);
|
||||||
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An additional reference for the attached objects */
|
/* An additional reference for the attached objects */
|
||||||
|
|
||||||
acpi_ut_add_reference (obj_desc->index_field.data_obj);
|
acpi_ut_add_reference(obj_desc->index_field.data_obj);
|
||||||
acpi_ut_add_reference (obj_desc->index_field.index_obj);
|
acpi_ut_add_reference(obj_desc->index_field.index_obj);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
"index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
|
"index_field: bit_off %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
|
||||||
obj_desc->index_field.start_field_bit_offset,
|
obj_desc->index_field.start_field_bit_offset,
|
||||||
obj_desc->index_field.base_byte_offset,
|
obj_desc->index_field.base_byte_offset,
|
||||||
obj_desc->index_field.value,
|
obj_desc->index_field.value,
|
||||||
obj_desc->field.access_byte_width,
|
obj_desc->field.access_byte_width,
|
||||||
obj_desc->index_field.index_obj,
|
obj_desc->index_field.index_obj,
|
||||||
obj_desc->index_field.data_obj));
|
obj_desc->index_field.data_obj));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -550,15 +538,16 @@ acpi_ex_prep_field_value (
|
|||||||
* Store the constructed descriptor (obj_desc) into the parent Node,
|
* Store the constructed descriptor (obj_desc) into the parent Node,
|
||||||
* preserving the current type of that named_obj.
|
* preserving the current type of that named_obj.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_attach_object (info->field_node, obj_desc,
|
status = acpi_ns_attach_object(info->field_node, obj_desc,
|
||||||
acpi_ns_get_type (info->field_node));
|
acpi_ns_get_type(info->field_node));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Set named_obj %p [%4.4s], obj_desc %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
|
||||||
info->field_node, acpi_ut_get_node_name (info->field_node), obj_desc));
|
"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 */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exregion")
|
ACPI_MODULE_NAME("exregion")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -68,27 +65,23 @@
|
|||||||
* DESCRIPTION: Handler for the System Memory address space (Op Region)
|
* DESCRIPTION: Handler for the System Memory address space (Op Region)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_system_memory_space_handler (
|
acpi_ex_system_memory_space_handler(u32 function,
|
||||||
u32 function,
|
acpi_physical_address address,
|
||||||
acpi_physical_address address,
|
u32 bit_width,
|
||||||
u32 bit_width,
|
acpi_integer * value,
|
||||||
acpi_integer *value,
|
void *handler_context, void *region_context)
|
||||||
void *handler_context,
|
|
||||||
void *region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
void *logical_addr_ptr = NULL;
|
void *logical_addr_ptr = NULL;
|
||||||
struct acpi_mem_space_context *mem_info = region_context;
|
struct acpi_mem_space_context *mem_info = region_context;
|
||||||
u32 length;
|
u32 length;
|
||||||
acpi_size window_size;
|
acpi_size window_size;
|
||||||
#ifndef ACPI_MISALIGNED_TRANSFERS
|
#ifndef ACPI_MISALIGNED_TRANSFERS
|
||||||
u32 remainder;
|
u32 remainder;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_system_memory_space_handler");
|
ACPI_FUNCTION_TRACE("ex_system_memory_space_handler");
|
||||||
|
|
||||||
|
|
||||||
/* Validate and translate the bit width */
|
/* Validate and translate the bit width */
|
||||||
|
|
||||||
@@ -110,9 +103,10 @@ acpi_ex_system_memory_space_handler (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid system_memory width %d\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
bit_width));
|
"Invalid system_memory width %d\n",
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
|
bit_width));
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ACPI_MISALIGNED_TRANSFERS
|
#ifndef ACPI_MISALIGNED_TRANSFERS
|
||||||
@@ -120,9 +114,10 @@ acpi_ex_system_memory_space_handler (
|
|||||||
* Hardware does not support non-aligned data transfers, we must verify
|
* Hardware does not support non-aligned data transfers, we must verify
|
||||||
* the request.
|
* the request.
|
||||||
*/
|
*/
|
||||||
(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) {
|
if (remainder != 0) {
|
||||||
return_ACPI_STATUS (AE_AML_ALIGNMENT);
|
return_ACPI_STATUS(AE_AML_ALIGNMENT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -132,9 +127,10 @@ acpi_ex_system_memory_space_handler (
|
|||||||
* 2) Address beyond the current mapping?
|
* 2) Address beyond the current mapping?
|
||||||
*/
|
*/
|
||||||
if ((address < mem_info->mapped_physical_address) ||
|
if ((address < mem_info->mapped_physical_address) ||
|
||||||
(((acpi_integer) address + length) >
|
(((acpi_integer) address + length) > ((acpi_integer)
|
||||||
((acpi_integer)
|
mem_info->
|
||||||
mem_info->mapped_physical_address + mem_info->mapped_length))) {
|
mapped_physical_address +
|
||||||
|
mem_info->mapped_length))) {
|
||||||
/*
|
/*
|
||||||
* The request cannot be resolved by the current memory mapping;
|
* The request cannot be resolved by the current memory mapping;
|
||||||
* Delete the existing mapping and create a new one.
|
* Delete the existing mapping and create a new one.
|
||||||
@@ -142,8 +138,8 @@ acpi_ex_system_memory_space_handler (
|
|||||||
if (mem_info->mapped_length) {
|
if (mem_info->mapped_length) {
|
||||||
/* Valid mapping, delete it */
|
/* Valid mapping, delete it */
|
||||||
|
|
||||||
acpi_os_unmap_memory (mem_info->mapped_logical_address,
|
acpi_os_unmap_memory(mem_info->mapped_logical_address,
|
||||||
mem_info->mapped_length);
|
mem_info->mapped_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -151,7 +147,7 @@ acpi_ex_system_memory_space_handler (
|
|||||||
* constrain the maximum mapping size to something reasonable.
|
* constrain the maximum mapping size to something reasonable.
|
||||||
*/
|
*/
|
||||||
window_size = (acpi_size)
|
window_size = (acpi_size)
|
||||||
((mem_info->address + mem_info->length) - address);
|
((mem_info->address + mem_info->length) - address);
|
||||||
|
|
||||||
if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
|
if (window_size > ACPI_SYSMEM_REGION_WINDOW_SIZE) {
|
||||||
window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
|
window_size = ACPI_SYSMEM_REGION_WINDOW_SIZE;
|
||||||
@@ -159,14 +155,16 @@ acpi_ex_system_memory_space_handler (
|
|||||||
|
|
||||||
/* Create a new mapping starting at the address given */
|
/* Create a new mapping starting at the address given */
|
||||||
|
|
||||||
status = acpi_os_map_memory (address, window_size,
|
status = acpi_os_map_memory(address, window_size,
|
||||||
(void **) &mem_info->mapped_logical_address);
|
(void **)&mem_info->
|
||||||
if (ACPI_FAILURE (status)) {
|
mapped_logical_address);
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
if (ACPI_FAILURE(status)) {
|
||||||
"Could not map memory at %8.8X%8.8X, size %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
ACPI_FORMAT_UINT64 (address), (u32) window_size));
|
"Could not map memory at %8.8X%8.8X, size %X\n",
|
||||||
|
ACPI_FORMAT_UINT64(address),
|
||||||
|
(u32) window_size));
|
||||||
mem_info->mapped_length = 0;
|
mem_info->mapped_length = 0;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the physical address and mapping size */
|
/* Save the physical address and mapping size */
|
||||||
@@ -180,42 +178,41 @@ acpi_ex_system_memory_space_handler (
|
|||||||
* access
|
* access
|
||||||
*/
|
*/
|
||||||
logical_addr_ptr = mem_info->mapped_logical_address +
|
logical_addr_ptr = mem_info->mapped_logical_address +
|
||||||
((acpi_integer) address -
|
((acpi_integer) address -
|
||||||
(acpi_integer) mem_info->mapped_physical_address);
|
(acpi_integer) mem_info->mapped_physical_address);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"system_memory %d (%d width) Address=%8.8X%8.8X\n",
|
"system_memory %d (%d width) Address=%8.8X%8.8X\n",
|
||||||
function, bit_width,
|
function, bit_width, ACPI_FORMAT_UINT64(address)));
|
||||||
ACPI_FORMAT_UINT64 (address)));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform the memory read or write
|
* Perform the memory read or write
|
||||||
*
|
*
|
||||||
* Note: For machines that do not support non-aligned transfers, the target
|
* Note: For machines that do not support non-aligned transfers, the target
|
||||||
* address was checked for alignment above. We do not attempt to break the
|
* address was checked for alignment above. We do not attempt to break the
|
||||||
* transfer up into smaller (byte-size) chunks because the AML specifically
|
* transfer up into smaller (byte-size) chunks because the AML specifically
|
||||||
* asked for a transfer width that the hardware may require.
|
* asked for a transfer width that the hardware may require.
|
||||||
*/
|
*/
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case ACPI_READ:
|
case ACPI_READ:
|
||||||
|
|
||||||
*value = 0;
|
*value = 0;
|
||||||
switch (bit_width) {
|
switch (bit_width) {
|
||||||
case 8:
|
case 8:
|
||||||
*value = (acpi_integer) *((u8 *) logical_addr_ptr);
|
*value = (acpi_integer) * ((u8 *) logical_addr_ptr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
*value = (acpi_integer) *((u16 *) logical_addr_ptr);
|
*value = (acpi_integer) * ((u16 *) logical_addr_ptr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
*value = (acpi_integer) *((u32 *) logical_addr_ptr);
|
*value = (acpi_integer) * ((u32 *) logical_addr_ptr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if ACPI_MACHINE_WIDTH != 16
|
#if ACPI_MACHINE_WIDTH != 16
|
||||||
case 64:
|
case 64:
|
||||||
*value = (acpi_integer) *((u64 *) logical_addr_ptr);
|
*value = (acpi_integer) * ((u64 *) logical_addr_ptr);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
@@ -228,20 +225,20 @@ acpi_ex_system_memory_space_handler (
|
|||||||
|
|
||||||
switch (bit_width) {
|
switch (bit_width) {
|
||||||
case 8:
|
case 8:
|
||||||
*(u8 *) logical_addr_ptr = (u8) *value;
|
*(u8 *) logical_addr_ptr = (u8) * value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
*(u16 *) logical_addr_ptr = (u16) *value;
|
*(u16 *) logical_addr_ptr = (u16) * value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 32:
|
case 32:
|
||||||
*(u32 *) logical_addr_ptr = (u32) *value;
|
*(u32 *) logical_addr_ptr = (u32) * value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if ACPI_MACHINE_WIDTH != 16
|
#if ACPI_MACHINE_WIDTH != 16
|
||||||
case 64:
|
case 64:
|
||||||
*(u64 *) logical_addr_ptr = (u64) *value;
|
*(u64 *) logical_addr_ptr = (u64) * value;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -256,10 +253,9 @@ acpi_ex_system_memory_space_handler (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_io_space_handler
|
* FUNCTION: acpi_ex_system_io_space_handler
|
||||||
@@ -279,39 +275,35 @@ acpi_ex_system_memory_space_handler (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_system_io_space_handler (
|
acpi_ex_system_io_space_handler(u32 function,
|
||||||
u32 function,
|
acpi_physical_address address,
|
||||||
acpi_physical_address address,
|
u32 bit_width,
|
||||||
u32 bit_width,
|
acpi_integer * value,
|
||||||
acpi_integer *value,
|
void *handler_context, void *region_context)
|
||||||
void *handler_context,
|
|
||||||
void *region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 value32;
|
u32 value32;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_system_io_space_handler");
|
||||||
|
|
||||||
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)));
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
|
||||||
"system_iO %d (%d width) Address=%8.8X%8.8X\n", function, bit_width,
|
|
||||||
ACPI_FORMAT_UINT64 (address)));
|
|
||||||
|
|
||||||
/* Decode the function parameter */
|
/* Decode the function parameter */
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case ACPI_READ:
|
case ACPI_READ:
|
||||||
|
|
||||||
status = acpi_os_read_port ((acpi_io_address) address,
|
status = acpi_os_read_port((acpi_io_address) address,
|
||||||
&value32, bit_width);
|
&value32, bit_width);
|
||||||
*value = value32;
|
*value = value32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_WRITE:
|
case ACPI_WRITE:
|
||||||
|
|
||||||
status = acpi_os_write_port ((acpi_io_address) address,
|
status = acpi_os_write_port((acpi_io_address) address,
|
||||||
(u32) *value, bit_width);
|
(u32) * value, bit_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -319,10 +311,9 @@ acpi_ex_system_io_space_handler (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_pci_config_space_handler
|
* FUNCTION: acpi_ex_pci_config_space_handler
|
||||||
@@ -342,21 +333,17 @@ acpi_ex_system_io_space_handler (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_pci_config_space_handler (
|
acpi_ex_pci_config_space_handler(u32 function,
|
||||||
u32 function,
|
acpi_physical_address address,
|
||||||
acpi_physical_address address,
|
u32 bit_width,
|
||||||
u32 bit_width,
|
acpi_integer * value,
|
||||||
acpi_integer *value,
|
void *handler_context, void *region_context)
|
||||||
void *handler_context,
|
|
||||||
void *region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_pci_id *pci_id;
|
struct acpi_pci_id *pci_id;
|
||||||
u16 pci_register;
|
u16 pci_register;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_pci_config_space_handler");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_pci_config_space_handler");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The arguments to acpi_os(Read|Write)pci_configuration are:
|
* The arguments to acpi_os(Read|Write)pci_configuration are:
|
||||||
@@ -370,26 +357,26 @@ acpi_ex_pci_config_space_handler (
|
|||||||
* Value - input value for write, output address for read
|
* Value - input value for write, output address for read
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
pci_id = (struct acpi_pci_id *) region_context;
|
pci_id = (struct acpi_pci_id *)region_context;
|
||||||
pci_register = (u16) (u32) address;
|
pci_register = (u16) (u32) address;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"pci_config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
|
"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,
|
function, bit_width, pci_id->segment, pci_id->bus,
|
||||||
pci_id->function, pci_register));
|
pci_id->device, pci_id->function, pci_register));
|
||||||
|
|
||||||
switch (function) {
|
switch (function) {
|
||||||
case ACPI_READ:
|
case ACPI_READ:
|
||||||
|
|
||||||
*value = 0;
|
*value = 0;
|
||||||
status = acpi_os_read_pci_configuration (pci_id, pci_register,
|
status = acpi_os_read_pci_configuration(pci_id, pci_register,
|
||||||
value, bit_width);
|
value, bit_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_WRITE:
|
case ACPI_WRITE:
|
||||||
|
|
||||||
status = acpi_os_write_pci_configuration (pci_id, pci_register,
|
status = acpi_os_write_pci_configuration(pci_id, pci_register,
|
||||||
*value, bit_width);
|
*value, bit_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -398,10 +385,9 @@ acpi_ex_pci_config_space_handler (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_cmos_space_handler
|
* FUNCTION: acpi_ex_cmos_space_handler
|
||||||
@@ -421,24 +407,19 @@ acpi_ex_pci_config_space_handler (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_cmos_space_handler (
|
acpi_ex_cmos_space_handler(u32 function,
|
||||||
u32 function,
|
acpi_physical_address address,
|
||||||
acpi_physical_address address,
|
u32 bit_width,
|
||||||
u32 bit_width,
|
acpi_integer * value,
|
||||||
acpi_integer *value,
|
void *handler_context, void *region_context)
|
||||||
void *handler_context,
|
|
||||||
void *region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_cmos_space_handler");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_cmos_space_handler");
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_pci_bar_space_handler
|
* FUNCTION: acpi_ex_pci_bar_space_handler
|
||||||
@@ -458,24 +439,19 @@ acpi_ex_cmos_space_handler (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_pci_bar_space_handler (
|
acpi_ex_pci_bar_space_handler(u32 function,
|
||||||
u32 function,
|
acpi_physical_address address,
|
||||||
acpi_physical_address address,
|
u32 bit_width,
|
||||||
u32 bit_width,
|
acpi_integer * value,
|
||||||
acpi_integer *value,
|
void *handler_context, void *region_context)
|
||||||
void *handler_context,
|
|
||||||
void *region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_pci_bar_space_handler");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_pci_bar_space_handler");
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_data_table_space_handler
|
* FUNCTION: acpi_ex_data_table_space_handler
|
||||||
@@ -495,24 +471,20 @@ acpi_ex_pci_bar_space_handler (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_data_table_space_handler (
|
acpi_ex_data_table_space_handler(u32 function,
|
||||||
u32 function,
|
acpi_physical_address address,
|
||||||
acpi_physical_address address,
|
u32 bit_width,
|
||||||
u32 bit_width,
|
acpi_integer * value,
|
||||||
acpi_integer *value,
|
void *handler_context, void *region_context)
|
||||||
void *handler_context,
|
|
||||||
void *region_context)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u32 byte_width = ACPI_DIV_8 (bit_width);
|
u32 byte_width = ACPI_DIV_8(bit_width);
|
||||||
u32 i;
|
u32 i;
|
||||||
char *logical_addr_ptr;
|
char *logical_addr_ptr;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_data_table_space_handler");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_data_table_space_handler");
|
logical_addr_ptr = ACPI_PHYSADDR_TO_PTR(address);
|
||||||
|
|
||||||
|
|
||||||
logical_addr_ptr = ACPI_PHYSADDR_TO_PTR (address);
|
|
||||||
|
|
||||||
/* Perform the memory read or write */
|
/* Perform the memory read or write */
|
||||||
|
|
||||||
@@ -520,17 +492,15 @@ acpi_ex_data_table_space_handler (
|
|||||||
case ACPI_READ:
|
case ACPI_READ:
|
||||||
|
|
||||||
for (i = 0; i < byte_width; i++) {
|
for (i = 0; i < byte_width; i++) {
|
||||||
((char *) value) [i] = logical_addr_ptr[i];
|
((char *)value)[i] = logical_addr_ptr[i];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_WRITE:
|
case ACPI_WRITE:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_SUPPORT);
|
return_ACPI_STATUS(AE_SUPPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
@@ -50,10 +49,8 @@
|
|||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exresnte")
|
ACPI_MODULE_NAME("exresnte")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -80,41 +77,37 @@
|
|||||||
* ACPI_TYPE_PACKAGE
|
* ACPI_TYPE_PACKAGE
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_resolve_node_to_value (
|
acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr,
|
||||||
struct acpi_namespace_node **object_ptr,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *source_desc;
|
union acpi_operand_object *source_desc;
|
||||||
union acpi_operand_object *obj_desc = NULL;
|
union acpi_operand_object *obj_desc = NULL;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_object_type entry_type;
|
acpi_object_type entry_type;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_resolve_node_to_value");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_resolve_node_to_value");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The stack pointer points to a struct acpi_namespace_node (Node). Get the
|
* The stack pointer points to a struct acpi_namespace_node (Node). Get the
|
||||||
* object that is attached to the Node.
|
* object that is attached to the Node.
|
||||||
*/
|
*/
|
||||||
node = *object_ptr;
|
node = *object_ptr;
|
||||||
source_desc = acpi_ns_get_attached_object (node);
|
source_desc = acpi_ns_get_attached_object(node);
|
||||||
entry_type = acpi_ns_get_type ((acpi_handle) node);
|
entry_type = acpi_ns_get_type((acpi_handle) node);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Entry=%p source_desc=%p [%s]\n",
|
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) ||
|
if ((entry_type == ACPI_TYPE_LOCAL_ALIAS) ||
|
||||||
(entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
|
(entry_type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) {
|
||||||
/* There is always exactly one level of indirection */
|
/* There is always exactly one level of indirection */
|
||||||
|
|
||||||
node = ACPI_CAST_PTR (struct acpi_namespace_node, node->object);
|
node = ACPI_CAST_PTR(struct acpi_namespace_node, node->object);
|
||||||
source_desc = acpi_ns_get_attached_object (node);
|
source_desc = acpi_ns_get_attached_object(node);
|
||||||
entry_type = acpi_ns_get_type ((acpi_handle) node);
|
entry_type = acpi_ns_get_type((acpi_handle) node);
|
||||||
*object_ptr = node;
|
*object_ptr = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,14 +117,14 @@ acpi_ex_resolve_node_to_value (
|
|||||||
* 2) Method locals and arguments have a pseudo-Node
|
* 2) Method locals and arguments have a pseudo-Node
|
||||||
*/
|
*/
|
||||||
if (entry_type == ACPI_TYPE_DEVICE ||
|
if (entry_type == ACPI_TYPE_DEVICE ||
|
||||||
(node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
|
(node->flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!source_desc) {
|
if (!source_desc) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
node));
|
"No object attached to node %p\n", node));
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -141,83 +134,89 @@ acpi_ex_resolve_node_to_value (
|
|||||||
switch (entry_type) {
|
switch (entry_type) {
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_PACKAGE) {
|
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_PACKAGE) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
acpi_ut_get_object_type_name (source_desc)));
|
"Object not a Package, type %s\n",
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
acpi_ut_get_object_type_name
|
||||||
|
(source_desc)));
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_get_package_arguments (source_desc);
|
status = acpi_ds_get_package_arguments(source_desc);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/* Return an additional reference to the object */
|
/* Return an additional reference to the object */
|
||||||
|
|
||||||
obj_desc = source_desc;
|
obj_desc = source_desc;
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) {
|
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
acpi_ut_get_object_type_name (source_desc)));
|
"Object not a Buffer, type %s\n",
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
acpi_ut_get_object_type_name
|
||||||
|
(source_desc)));
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_get_buffer_arguments (source_desc);
|
status = acpi_ds_get_buffer_arguments(source_desc);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/* Return an additional reference to the object */
|
/* Return an additional reference to the object */
|
||||||
|
|
||||||
obj_desc = source_desc;
|
obj_desc = source_desc;
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) {
|
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
acpi_ut_get_object_type_name (source_desc)));
|
"Object not a String, type %s\n",
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
acpi_ut_get_object_type_name
|
||||||
|
(source_desc)));
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return an additional reference to the object */
|
/* Return an additional reference to the object */
|
||||||
|
|
||||||
obj_desc = source_desc;
|
obj_desc = source_desc;
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
if (ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) {
|
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
acpi_ut_get_object_type_name (source_desc)));
|
"Object not a Integer, type %s\n",
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
acpi_ut_get_object_type_name
|
||||||
|
(source_desc)));
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return an additional reference to the object */
|
/* Return an additional reference to the object */
|
||||||
|
|
||||||
obj_desc = source_desc;
|
obj_desc = source_desc;
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER_FIELD:
|
case ACPI_TYPE_BUFFER_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"field_read Node=%p source_desc=%p Type=%X\n",
|
"field_read Node=%p source_desc=%p Type=%X\n",
|
||||||
node, source_desc, entry_type));
|
node, source_desc, entry_type));
|
||||||
|
|
||||||
status = acpi_ex_read_data_from_field (walk_state, source_desc, &obj_desc);
|
status =
|
||||||
|
acpi_ex_read_data_from_field(walk_state, source_desc,
|
||||||
|
&obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* For these objects, just return the object attached to the Node */
|
/* For these objects, just return the object attached to the Node */
|
||||||
|
|
||||||
case ACPI_TYPE_MUTEX:
|
case ACPI_TYPE_MUTEX:
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
@@ -230,19 +229,18 @@ acpi_ex_resolve_node_to_value (
|
|||||||
/* Return an additional reference to the object */
|
/* Return an additional reference to the object */
|
||||||
|
|
||||||
obj_desc = source_desc;
|
obj_desc = source_desc;
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* TYPE_ANY is untyped, and thus there is no object associated with it */
|
/* TYPE_ANY is untyped, and thus there is no object associated with it */
|
||||||
|
|
||||||
case ACPI_TYPE_ANY:
|
case ACPI_TYPE_ANY:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Untyped entry %p, no attached object!\n",
|
"Untyped entry %p, no attached object!\n",
|
||||||
node));
|
node));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
|
|
||||||
|
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||||
|
|
||||||
@@ -253,39 +251,37 @@ acpi_ex_resolve_node_to_value (
|
|||||||
/* Return an additional reference to the object */
|
/* Return an additional reference to the object */
|
||||||
|
|
||||||
obj_desc = source_desc;
|
obj_desc = source_desc;
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* No named references are allowed here */
|
/* No named references are allowed here */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unsupported Reference opcode %X (%s)\n",
|
"Unsupported Reference opcode %X (%s)\n",
|
||||||
source_desc->reference.opcode,
|
source_desc->reference.opcode,
|
||||||
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
|
acpi_ps_get_opcode_name(source_desc->
|
||||||
|
reference.
|
||||||
|
opcode)));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Default case is for unknown types */
|
/* Default case is for unknown types */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Node %p - Unknown object type %X\n",
|
"Node %p - Unknown object type %X\n",
|
||||||
node, entry_type));
|
node, entry_type));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
|
|
||||||
} /* switch (entry_type) */
|
|
||||||
|
|
||||||
|
} /* switch (entry_type) */
|
||||||
|
|
||||||
/* Return the object descriptor */
|
/* Return the object descriptor */
|
||||||
|
|
||||||
*object_ptr = (void *) obj_desc;
|
*object_ptr = (void *)obj_desc;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
@@ -50,17 +49,13 @@
|
|||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exresolv")
|
ACPI_MODULE_NAME("exresolv")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_resolve_object_to_value (
|
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
||||||
union acpi_operand_object **stack_ptr,
|
struct acpi_walk_state *walk_state);
|
||||||
struct acpi_walk_state *walk_state);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -78,19 +73,16 @@ acpi_ex_resolve_object_to_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_resolve_to_value (
|
acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
|
||||||
union acpi_operand_object **stack_ptr,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_resolve_to_value", stack_ptr);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_resolve_to_value", stack_ptr);
|
||||||
|
|
||||||
if (!stack_ptr || !*stack_ptr) {
|
if (!stack_ptr || !*stack_ptr) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Internal - null pointer\n"));
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -98,15 +90,16 @@ acpi_ex_resolve_to_value (
|
|||||||
* 1) A valid union acpi_operand_object, or
|
* 1) A valid union acpi_operand_object, or
|
||||||
* 2) A struct acpi_namespace_node (named_obj)
|
* 2) A struct acpi_namespace_node (named_obj)
|
||||||
*/
|
*/
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_OPERAND) {
|
||||||
status = acpi_ex_resolve_object_to_value (stack_ptr, walk_state);
|
status = acpi_ex_resolve_object_to_value(stack_ptr, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!*stack_ptr) {
|
if (!*stack_ptr) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
"Internal - null pointer\n"));
|
||||||
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,20 +107,20 @@ acpi_ex_resolve_to_value (
|
|||||||
* Object on the stack may have changed if acpi_ex_resolve_object_to_value()
|
* Object on the stack may have changed if acpi_ex_resolve_object_to_value()
|
||||||
* was called (i.e., we can't use an _else_ here.)
|
* was called (i.e., we can't use an _else_ here.)
|
||||||
*/
|
*/
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(*stack_ptr) == ACPI_DESC_TYPE_NAMED) {
|
||||||
status = acpi_ex_resolve_node_to_value (
|
status =
|
||||||
ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, stack_ptr),
|
acpi_ex_resolve_node_to_value(ACPI_CAST_INDIRECT_PTR
|
||||||
walk_state);
|
(struct acpi_namespace_node,
|
||||||
if (ACPI_FAILURE (status)) {
|
stack_ptr), walk_state);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Resolved object %p\n", *stack_ptr));
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_resolve_object_to_value
|
* FUNCTION: acpi_ex_resolve_object_to_value
|
||||||
@@ -143,25 +136,22 @@ acpi_ex_resolve_to_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_resolve_object_to_value (
|
acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr,
|
||||||
union acpi_operand_object **stack_ptr,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *stack_desc;
|
union acpi_operand_object *stack_desc;
|
||||||
void *temp_node;
|
void *temp_node;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
u16 opcode;
|
u16 opcode;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_resolve_object_to_value");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_resolve_object_to_value");
|
||||||
|
|
||||||
stack_desc = *stack_ptr;
|
stack_desc = *stack_ptr;
|
||||||
|
|
||||||
/* This is an union acpi_operand_object */
|
/* This is an union acpi_operand_object */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (stack_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(stack_desc)) {
|
||||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||||
|
|
||||||
opcode = stack_desc->reference.opcode;
|
opcode = stack_desc->reference.opcode;
|
||||||
@@ -177,14 +167,13 @@ acpi_ex_resolve_object_to_value (
|
|||||||
|
|
||||||
/* Delete the Reference Object */
|
/* Delete the Reference Object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (stack_desc);
|
acpi_ut_remove_reference(stack_desc);
|
||||||
|
|
||||||
/* Return the namespace node */
|
/* Return the namespace node */
|
||||||
|
|
||||||
(*stack_ptr) = temp_node;
|
(*stack_ptr) = temp_node;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_LOCAL_OP:
|
case AML_LOCAL_OP:
|
||||||
case AML_ARG_OP:
|
case AML_ARG_OP:
|
||||||
|
|
||||||
@@ -192,24 +181,28 @@ acpi_ex_resolve_object_to_value (
|
|||||||
* Get the local from the method's state info
|
* Get the local from the method's state info
|
||||||
* Note: this increments the local's object reference count
|
* Note: this increments the local's object reference count
|
||||||
*/
|
*/
|
||||||
status = acpi_ds_method_data_get_value (opcode,
|
status = acpi_ds_method_data_get_value(opcode,
|
||||||
stack_desc->reference.offset, walk_state, &obj_desc);
|
stack_desc->
|
||||||
if (ACPI_FAILURE (status)) {
|
reference.offset,
|
||||||
return_ACPI_STATUS (status);
|
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",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
stack_desc->reference.offset, obj_desc));
|
"[Arg/Local %X] value_obj is %p\n",
|
||||||
|
stack_desc->reference.offset,
|
||||||
|
obj_desc));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we can delete the original Reference Object and
|
* Now we can delete the original Reference Object and
|
||||||
* replace it with the resolved value
|
* replace it with the resolved value
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (stack_desc);
|
acpi_ut_remove_reference(stack_desc);
|
||||||
*stack_ptr = obj_desc;
|
*stack_ptr = obj_desc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INDEX_OP:
|
case AML_INDEX_OP:
|
||||||
|
|
||||||
switch (stack_desc->reference.target_type) {
|
switch (stack_desc->reference.target_type) {
|
||||||
@@ -218,7 +211,6 @@ acpi_ex_resolve_object_to_value (
|
|||||||
/* Just return - leave the Reference on the stack */
|
/* Just return - leave the Reference on the stack */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
obj_desc = *stack_desc->reference.where;
|
obj_desc = *stack_desc->reference.where;
|
||||||
@@ -228,36 +220,31 @@ acpi_ex_resolve_object_to_value (
|
|||||||
* (i.e., dereference the package index)
|
* (i.e., dereference the package index)
|
||||||
* Delete the ref object, increment the returned object
|
* Delete the ref object, increment the returned object
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (stack_desc);
|
acpi_ut_remove_reference(stack_desc);
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
*stack_ptr = obj_desc;
|
*stack_ptr = obj_desc;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* A NULL object descriptor means an unitialized element of
|
* A NULL object descriptor means an unitialized element of
|
||||||
* the package, can't dereference it
|
* the package, can't dereference it
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Attempt to deref an Index to NULL pkg element Idx=%p\n",
|
"Attempt to deref an Index to NULL pkg element Idx=%p\n",
|
||||||
stack_desc));
|
stack_desc));
|
||||||
status = AE_AML_UNINITIALIZED_ELEMENT;
|
status = AE_AML_UNINITIALIZED_ELEMENT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Invalid reference object */
|
/* Invalid reference object */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("During resolve, Unknown target_type %X in Index/Reference obj %p\n", stack_desc->reference.target_type, stack_desc));
|
||||||
"During resolve, Unknown target_type %X in Index/Reference obj %p\n",
|
|
||||||
stack_desc->reference.target_type, stack_desc));
|
|
||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_REF_OF_OP:
|
case AML_REF_OF_OP:
|
||||||
case AML_DEBUG_OP:
|
case AML_DEBUG_OP:
|
||||||
case AML_LOAD_OP:
|
case AML_LOAD_OP:
|
||||||
@@ -266,60 +253,58 @@ acpi_ex_resolve_object_to_value (
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
|
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
|
||||||
|
|
||||||
/* Get the object pointed to by the namespace node */
|
/* Get the object pointed to by the namespace node */
|
||||||
|
|
||||||
*stack_ptr = (stack_desc->reference.node)->object;
|
*stack_ptr = (stack_desc->reference.node)->object;
|
||||||
acpi_ut_add_reference (*stack_ptr);
|
acpi_ut_add_reference(*stack_ptr);
|
||||||
acpi_ut_remove_reference (stack_desc);
|
acpi_ut_remove_reference(stack_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("During resolve, Unknown Reference opcode %X (%s) in %p\n", opcode, acpi_ps_get_opcode_name(opcode), stack_desc));
|
||||||
"During resolve, Unknown Reference opcode %X (%s) in %p\n",
|
|
||||||
opcode, acpi_ps_get_opcode_name (opcode), stack_desc));
|
|
||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
status = acpi_ds_get_buffer_arguments (stack_desc);
|
status = acpi_ds_get_buffer_arguments(stack_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
status = acpi_ds_get_package_arguments (stack_desc);
|
status = acpi_ds_get_package_arguments(stack_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/* These cases may never happen here, but just in case.. */
|
||||||
/* These cases may never happen here, but just in case.. */
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER_FIELD:
|
case ACPI_TYPE_BUFFER_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "field_read source_desc=%p Type=%X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
stack_desc, ACPI_GET_OBJECT_TYPE (stack_desc)));
|
"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 =
|
||||||
*stack_ptr = (void *) obj_desc;
|
acpi_ex_read_data_from_field(walk_state, stack_desc,
|
||||||
|
&obj_desc);
|
||||||
|
*stack_ptr = (void *)obj_desc;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_resolve_multiple
|
* FUNCTION: acpi_ex_resolve_multiple
|
||||||
@@ -337,42 +322,44 @@ acpi_ex_resolve_object_to_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_resolve_multiple (
|
acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_operand_object *operand,
|
||||||
union acpi_operand_object *operand,
|
acpi_object_type * return_type,
|
||||||
acpi_object_type *return_type,
|
union acpi_operand_object **return_desc)
|
||||||
union acpi_operand_object **return_desc)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc = (void *) operand;
|
union acpi_operand_object *obj_desc = (void *)operand;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_object_type type;
|
acpi_object_type type;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_ex_resolve_multiple");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_ex_resolve_multiple");
|
||||||
|
|
||||||
/* Operand can be either a namespace node or an operand descriptor */
|
/* Operand can be either a namespace node or an operand descriptor */
|
||||||
|
|
||||||
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
|
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
|
||||||
case ACPI_DESC_TYPE_OPERAND:
|
case ACPI_DESC_TYPE_OPERAND:
|
||||||
type = obj_desc->common.type;
|
type = obj_desc->common.type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_DESC_TYPE_NAMED:
|
case ACPI_DESC_TYPE_NAMED:
|
||||||
type = ((struct acpi_namespace_node *) obj_desc)->type;
|
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 we had an Alias node, use the attached object for type info */
|
||||||
|
|
||||||
if (type == ACPI_TYPE_LOCAL_ALIAS) {
|
if (type == ACPI_TYPE_LOCAL_ALIAS) {
|
||||||
type = ((struct acpi_namespace_node *) obj_desc)->type;
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If type is anything other than a reference, we are done */
|
/* If type is anything other than a reference, we are done */
|
||||||
@@ -387,7 +374,7 @@ acpi_ex_resolve_multiple (
|
|||||||
* of the object_type and size_of operators). This means traversing
|
* of the object_type and size_of operators). This means traversing
|
||||||
* the list of possibly many nested references.
|
* the list of possibly many nested references.
|
||||||
*/
|
*/
|
||||||
while (ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
|
while (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REFERENCE) {
|
||||||
switch (obj_desc->reference.opcode) {
|
switch (obj_desc->reference.opcode) {
|
||||||
case AML_REF_OF_OP:
|
case AML_REF_OF_OP:
|
||||||
|
|
||||||
@@ -397,31 +384,29 @@ acpi_ex_resolve_multiple (
|
|||||||
|
|
||||||
/* All "References" point to a NS node */
|
/* All "References" point to a NS node */
|
||||||
|
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_DESC_TYPE_NAMED) {
|
||||||
"acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
|
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
|
||||||
node, acpi_ut_get_descriptor_name (node)));
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the attached object */
|
/* Get the attached object */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
/* No object, use the NS node type */
|
/* No object, use the NS node type */
|
||||||
|
|
||||||
type = acpi_ns_get_type (node);
|
type = acpi_ns_get_type(node);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for circular references */
|
/* Check for circular references */
|
||||||
|
|
||||||
if (obj_desc == operand) {
|
if (obj_desc == operand) {
|
||||||
return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
|
return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INDEX_OP:
|
case AML_INDEX_OP:
|
||||||
|
|
||||||
/* Get the type of this reference (index into another object) */
|
/* Get the type of this reference (index into another object) */
|
||||||
@@ -442,12 +427,11 @@ acpi_ex_resolve_multiple (
|
|||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
/* NULL package elements are allowed */
|
/* NULL package elements are allowed */
|
||||||
|
|
||||||
type = 0; /* Uninitialized */
|
type = 0; /* Uninitialized */
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INT_NAMEPATH_OP:
|
case AML_INT_NAMEPATH_OP:
|
||||||
|
|
||||||
/* Dereference the reference pointer */
|
/* Dereference the reference pointer */
|
||||||
@@ -456,50 +440,61 @@ acpi_ex_resolve_multiple (
|
|||||||
|
|
||||||
/* All "References" point to a NS node */
|
/* All "References" point to a NS node */
|
||||||
|
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(node) !=
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_DESC_TYPE_NAMED) {
|
||||||
"acpi_ex_resolve_multiple: Not a NS node %p [%s]\n",
|
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Not a NS node %p [%s]\n", node, acpi_ut_get_descriptor_name(node)));
|
||||||
node, acpi_ut_get_descriptor_name (node)));
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the attached object */
|
/* Get the attached object */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
/* No object, use the NS node type */
|
/* No object, use the NS node type */
|
||||||
|
|
||||||
type = acpi_ns_get_type (node);
|
type = acpi_ns_get_type(node);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for circular references */
|
/* Check for circular references */
|
||||||
|
|
||||||
if (obj_desc == operand) {
|
if (obj_desc == operand) {
|
||||||
return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
|
return_ACPI_STATUS(AE_AML_CIRCULAR_REFERENCE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_LOCAL_OP:
|
case AML_LOCAL_OP:
|
||||||
case AML_ARG_OP:
|
case AML_ARG_OP:
|
||||||
|
|
||||||
if (return_desc) {
|
if (return_desc) {
|
||||||
status = acpi_ds_method_data_get_value (obj_desc->reference.opcode,
|
status =
|
||||||
obj_desc->reference.offset, walk_state, &obj_desc);
|
acpi_ds_method_data_get_value(obj_desc->
|
||||||
if (ACPI_FAILURE (status)) {
|
reference.
|
||||||
return_ACPI_STATUS (status);
|
opcode,
|
||||||
|
obj_desc->
|
||||||
|
reference.
|
||||||
|
offset,
|
||||||
|
walk_state,
|
||||||
|
&obj_desc);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
}
|
} else {
|
||||||
else {
|
status =
|
||||||
status = acpi_ds_method_data_get_node (obj_desc->reference.opcode,
|
acpi_ds_method_data_get_node(obj_desc->
|
||||||
obj_desc->reference.offset, walk_state, &node);
|
reference.
|
||||||
if (ACPI_FAILURE (status)) {
|
opcode,
|
||||||
return_ACPI_STATUS (status);
|
obj_desc->
|
||||||
|
reference.
|
||||||
|
offset,
|
||||||
|
walk_state,
|
||||||
|
&node);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
type = ACPI_TYPE_ANY;
|
type = ACPI_TYPE_ANY;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -507,7 +502,6 @@ acpi_ex_resolve_multiple (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_DEBUG_OP:
|
case AML_DEBUG_OP:
|
||||||
|
|
||||||
/* The Debug Object is of type "debug_object" */
|
/* The Debug Object is of type "debug_object" */
|
||||||
@@ -515,13 +509,10 @@ acpi_ex_resolve_multiple (
|
|||||||
type = ACPI_TYPE_DEBUG_OBJECT;
|
type = ACPI_TYPE_DEBUG_OBJECT;
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("acpi_ex_resolve_multiple: Unknown Reference subtype %X\n", obj_desc->reference.opcode));
|
||||||
"acpi_ex_resolve_multiple: Unknown Reference subtype %X\n",
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
obj_desc->reference.opcode));
|
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,10 +520,9 @@ acpi_ex_resolve_multiple (
|
|||||||
* Now we are guaranteed to have an object that has not been created
|
* Now we are guaranteed to have an object that has not been created
|
||||||
* via the ref_of or Index operators.
|
* via the ref_of or Index operators.
|
||||||
*/
|
*/
|
||||||
type = ACPI_GET_OBJECT_TYPE (obj_desc);
|
type = ACPI_GET_OBJECT_TYPE(obj_desc);
|
||||||
|
|
||||||
|
exit:
|
||||||
exit:
|
|
||||||
/* Convert internal types to external types */
|
/* Convert internal types to external types */
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -559,7 +549,5 @@ exit:
|
|||||||
if (return_desc) {
|
if (return_desc) {
|
||||||
*return_desc = obj_desc;
|
*return_desc = obj_desc;
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,24 +42,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exresop")
|
ACPI_MODULE_NAME("exresop")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_check_object_type (
|
acpi_ex_check_object_type(acpi_object_type type_needed,
|
||||||
acpi_object_type type_needed,
|
acpi_object_type this_type, void *object);
|
||||||
acpi_object_type this_type,
|
|
||||||
void *object);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -76,13 +70,10 @@ acpi_ex_check_object_type (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_check_object_type (
|
acpi_ex_check_object_type(acpi_object_type type_needed,
|
||||||
acpi_object_type type_needed,
|
acpi_object_type this_type, void *object)
|
||||||
acpi_object_type this_type,
|
|
||||||
void *object)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_NAME ("ex_check_object_type");
|
ACPI_FUNCTION_NAME("ex_check_object_type");
|
||||||
|
|
||||||
|
|
||||||
if (type_needed == ACPI_TYPE_ANY) {
|
if (type_needed == ACPI_TYPE_ANY) {
|
||||||
/* All types OK, so we don't perform any typechecks */
|
/* All types OK, so we don't perform any typechecks */
|
||||||
@@ -97,16 +88,17 @@ acpi_ex_check_object_type (
|
|||||||
* specification, a store to a constant is a noop.)
|
* specification, a store to a constant is a noop.)
|
||||||
*/
|
*/
|
||||||
if ((this_type == ACPI_TYPE_INTEGER) &&
|
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);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type_needed != this_type) {
|
if (type_needed != this_type) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [%s], found [%s] %p\n",
|
"Needed [%s], found [%s] %p\n",
|
||||||
acpi_ut_get_type_name (type_needed),
|
acpi_ut_get_type_name(type_needed),
|
||||||
acpi_ut_get_type_name (this_type), object));
|
acpi_ut_get_type_name(this_type), object));
|
||||||
|
|
||||||
return (AE_AML_OPERAND_TYPE);
|
return (AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
@@ -114,7 +106,6 @@ acpi_ex_check_object_type (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_resolve_operands
|
* FUNCTION: acpi_ex_resolve_operands
|
||||||
@@ -137,41 +128,37 @@ acpi_ex_check_object_type (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_resolve_operands (
|
acpi_ex_resolve_operands(u16 opcode,
|
||||||
u16 opcode,
|
union acpi_operand_object ** stack_ptr,
|
||||||
union acpi_operand_object **stack_ptr,
|
struct acpi_walk_state * walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
u8 object_type;
|
u8 object_type;
|
||||||
void *temp_node;
|
void *temp_node;
|
||||||
u32 arg_types;
|
u32 arg_types;
|
||||||
const struct acpi_opcode_info *op_info;
|
const struct acpi_opcode_info *op_info;
|
||||||
u32 this_arg_type;
|
u32 this_arg_type;
|
||||||
acpi_object_type type_needed;
|
acpi_object_type type_needed;
|
||||||
u16 target_op = 0;
|
u16 target_op = 0;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_U32 ("ex_resolve_operands", opcode);
|
op_info = acpi_ps_get_opcode_info(opcode);
|
||||||
|
|
||||||
|
|
||||||
op_info = acpi_ps_get_opcode_info (opcode);
|
|
||||||
if (op_info->class == AML_CLASS_UNKNOWN) {
|
if (op_info->class == AML_CLASS_UNKNOWN) {
|
||||||
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg_types = op_info->runtime_args;
|
arg_types = op_info->runtime_args;
|
||||||
if (arg_types == ARGI_INVALID_OPCODE) {
|
if (arg_types == ARGI_INVALID_OPCODE) {
|
||||||
ACPI_REPORT_ERROR (("resolve_operands: %X is not a valid AML opcode\n",
|
ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode));
|
||||||
opcode));
|
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Opcode %X [%s] required_operand_types=%8.8X \n",
|
"Opcode %X [%s] required_operand_types=%8.8X \n",
|
||||||
opcode, op_info->name, arg_types));
|
opcode, op_info->name, arg_types));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normal exit is with (arg_types == 0) at end of argument list.
|
* Normal exit is with (arg_types == 0) at end of argument list.
|
||||||
@@ -180,12 +167,11 @@ acpi_ex_resolve_operands (
|
|||||||
* to) the required type; if stack underflows; or upon
|
* to) the required type; if stack underflows; or upon
|
||||||
* finding a NULL stack entry (which should not happen).
|
* finding a NULL stack entry (which should not happen).
|
||||||
*/
|
*/
|
||||||
while (GET_CURRENT_ARG_TYPE (arg_types)) {
|
while (GET_CURRENT_ARG_TYPE(arg_types)) {
|
||||||
if (!stack_ptr || !*stack_ptr) {
|
if (!stack_ptr || !*stack_ptr) {
|
||||||
ACPI_REPORT_ERROR (("resolve_operands: Null stack entry at %p\n",
|
ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr));
|
||||||
stack_ptr));
|
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract useful items */
|
/* Extract useful items */
|
||||||
@@ -194,37 +180,37 @@ acpi_ex_resolve_operands (
|
|||||||
|
|
||||||
/* Decode the descriptor type */
|
/* Decode the descriptor type */
|
||||||
|
|
||||||
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
|
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
|
||||||
case ACPI_DESC_TYPE_NAMED:
|
case ACPI_DESC_TYPE_NAMED:
|
||||||
|
|
||||||
/* Namespace Node */
|
/* Namespace Node */
|
||||||
|
|
||||||
object_type = ((struct acpi_namespace_node *) obj_desc)->type;
|
object_type =
|
||||||
|
((struct acpi_namespace_node *)obj_desc)->type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_DESC_TYPE_OPERAND:
|
case ACPI_DESC_TYPE_OPERAND:
|
||||||
|
|
||||||
/* ACPI internal object */
|
/* ACPI internal object */
|
||||||
|
|
||||||
object_type = ACPI_GET_OBJECT_TYPE (obj_desc);
|
object_type = ACPI_GET_OBJECT_TYPE(obj_desc);
|
||||||
|
|
||||||
/* Check for bad acpi_object_type */
|
/* Check for bad acpi_object_type */
|
||||||
|
|
||||||
if (!acpi_ut_valid_object_type (object_type)) {
|
if (!acpi_ut_valid_object_type(object_type)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Bad operand object type [%X]\n",
|
"Bad operand object type [%X]\n",
|
||||||
object_type));
|
object_type));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
|
if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
|
||||||
/* Decode the Reference */
|
/* Decode the Reference */
|
||||||
|
|
||||||
op_info = acpi_ps_get_opcode_info (opcode);
|
op_info = acpi_ps_get_opcode_info(opcode);
|
||||||
if (op_info->class == AML_CLASS_UNKNOWN) {
|
if (op_info->class == AML_CLASS_UNKNOWN) {
|
||||||
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
|
return_ACPI_STATUS(AE_AML_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (obj_desc->reference.opcode) {
|
switch (obj_desc->reference.opcode) {
|
||||||
@@ -238,51 +224,62 @@ acpi_ex_resolve_operands (
|
|||||||
case AML_REF_OF_OP:
|
case AML_REF_OF_OP:
|
||||||
case AML_ARG_OP:
|
case AML_ARG_OP:
|
||||||
case AML_LOCAL_OP:
|
case AML_LOCAL_OP:
|
||||||
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
|
case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */
|
||||||
case AML_INT_NAMEPATH_OP: /* Reference to a named object */
|
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
|
||||||
"Operand is a Reference, ref_opcode [%s]\n",
|
((ACPI_DB_EXEC,
|
||||||
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name)));
|
"Operand is a Reference, ref_opcode [%s]\n",
|
||||||
|
(acpi_ps_get_opcode_info
|
||||||
|
(obj_desc->
|
||||||
|
reference.
|
||||||
|
opcode))->
|
||||||
|
name)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
|
"Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
|
||||||
obj_desc->reference.opcode,
|
obj_desc->reference.
|
||||||
(acpi_ps_get_opcode_info (obj_desc->reference.opcode))->name));
|
opcode,
|
||||||
|
(acpi_ps_get_opcode_info
|
||||||
|
(obj_desc->reference.
|
||||||
|
opcode))->name));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Invalid descriptor */
|
/* Invalid descriptor */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Invalid descriptor %p [%s]\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get one argument type, point to the next */
|
/* Get one argument type, point to the next */
|
||||||
|
|
||||||
this_arg_type = GET_CURRENT_ARG_TYPE (arg_types);
|
this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
|
||||||
INCREMENT_ARG_LIST (arg_types);
|
INCREMENT_ARG_LIST(arg_types);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle cases where the object does not need to be
|
* Handle cases where the object does not need to be
|
||||||
* resolved to a value
|
* resolved to a value
|
||||||
*/
|
*/
|
||||||
switch (this_arg_type) {
|
switch (this_arg_type) {
|
||||||
case ARGI_REF_OR_STRING: /* Can be a String or Reference */
|
case ARGI_REF_OR_STRING: /* Can be a String or Reference */
|
||||||
|
|
||||||
if ((ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) &&
|
if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
|
||||||
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_STRING)) {
|
ACPI_DESC_TYPE_OPERAND)
|
||||||
|
&& (ACPI_GET_OBJECT_TYPE(obj_desc) ==
|
||||||
|
ACPI_TYPE_STRING)) {
|
||||||
/*
|
/*
|
||||||
* String found - the string references a named object and
|
* String found - the string references a named object and
|
||||||
* must be resolved to a node
|
* must be resolved to a node
|
||||||
@@ -296,39 +293,40 @@ acpi_ex_resolve_operands (
|
|||||||
*/
|
*/
|
||||||
/*lint -fallthrough */
|
/*lint -fallthrough */
|
||||||
|
|
||||||
case ARGI_REFERENCE: /* References: */
|
case ARGI_REFERENCE: /* References: */
|
||||||
case ARGI_INTEGER_REF:
|
case ARGI_INTEGER_REF:
|
||||||
case ARGI_OBJECT_REF:
|
case ARGI_OBJECT_REF:
|
||||||
case ARGI_DEVICE_REF:
|
case ARGI_DEVICE_REF:
|
||||||
case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
|
case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
|
||||||
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
|
case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
|
||||||
case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
|
case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
|
* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
|
||||||
* A Namespace Node is OK as-is
|
* 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;
|
goto next_operand;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_check_object_type (ACPI_TYPE_LOCAL_REFERENCE,
|
status =
|
||||||
object_type, obj_desc);
|
acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE,
|
||||||
if (ACPI_FAILURE (status)) {
|
object_type, obj_desc);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc->reference.opcode == AML_NAME_OP) {
|
if (obj_desc->reference.opcode == AML_NAME_OP) {
|
||||||
/* Convert a named reference to the actual named object */
|
/* Convert a named reference to the actual named object */
|
||||||
|
|
||||||
temp_node = obj_desc->reference.object;
|
temp_node = obj_desc->reference.object;
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
(*stack_ptr) = temp_node;
|
(*stack_ptr) = temp_node;
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
case ARGI_DATAREFOBJ: /* Store operator only */
|
||||||
case ARGI_DATAREFOBJ: /* Store operator only */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't want to resolve index_op reference objects during
|
* We don't want to resolve index_op reference objects during
|
||||||
@@ -337,8 +335,10 @@ acpi_ex_resolve_operands (
|
|||||||
* -- All others must be resolved below.
|
* -- All others must be resolved below.
|
||||||
*/
|
*/
|
||||||
if ((opcode == AML_STORE_OP) &&
|
if ((opcode == AML_STORE_OP) &&
|
||||||
(ACPI_GET_OBJECT_TYPE (*stack_ptr) == ACPI_TYPE_LOCAL_REFERENCE) &&
|
(ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
|
||||||
((*stack_ptr)->reference.opcode == AML_INDEX_OP)) {
|
ACPI_TYPE_LOCAL_REFERENCE)
|
||||||
|
&& ((*stack_ptr)->reference.opcode ==
|
||||||
|
AML_INDEX_OP)) {
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -351,9 +351,9 @@ acpi_ex_resolve_operands (
|
|||||||
/*
|
/*
|
||||||
* Resolve this object to a value
|
* Resolve this object to a value
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_resolve_to_value (stack_ptr, walk_state);
|
status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the resolved object */
|
/* Get the resolved object */
|
||||||
@@ -364,10 +364,10 @@ acpi_ex_resolve_operands (
|
|||||||
* Check the resulting object (value) type
|
* Check the resulting object (value) type
|
||||||
*/
|
*/
|
||||||
switch (this_arg_type) {
|
switch (this_arg_type) {
|
||||||
/*
|
/*
|
||||||
* For the simple cases, only one type of resolved object
|
* For the simple cases, only one type of resolved object
|
||||||
* is allowed
|
* is allowed
|
||||||
*/
|
*/
|
||||||
case ARGI_MUTEX:
|
case ARGI_MUTEX:
|
||||||
|
|
||||||
/* Need an operand of type ACPI_TYPE_MUTEX */
|
/* Need an operand of type ACPI_TYPE_MUTEX */
|
||||||
@@ -382,7 +382,7 @@ acpi_ex_resolve_operands (
|
|||||||
type_needed = ACPI_TYPE_EVENT;
|
type_needed = ACPI_TYPE_EVENT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ARGI_PACKAGE: /* Package */
|
case ARGI_PACKAGE: /* Package */
|
||||||
|
|
||||||
/* Need an operand of type ACPI_TYPE_PACKAGE */
|
/* Need an operand of type ACPI_TYPE_PACKAGE */
|
||||||
|
|
||||||
@@ -403,10 +403,9 @@ acpi_ex_resolve_operands (
|
|||||||
type_needed = ACPI_TYPE_LOCAL_REFERENCE;
|
type_needed = ACPI_TYPE_LOCAL_REFERENCE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
/*
|
||||||
/*
|
* The more complex cases allow multiple resolved object types
|
||||||
* The more complex cases allow multiple resolved object types
|
*/
|
||||||
*/
|
|
||||||
case ARGI_INTEGER:
|
case ARGI_INTEGER:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -414,25 +413,27 @@ acpi_ex_resolve_operands (
|
|||||||
* But we can implicitly convert from a STRING or BUFFER
|
* But we can implicitly convert from a STRING or BUFFER
|
||||||
* Aka - "Implicit Source Operand Conversion"
|
* Aka - "Implicit Source Operand Conversion"
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_integer (obj_desc, stack_ptr, 16);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_TYPE) {
|
if (status == AE_TYPE) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Integer/String/Buffer], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc != *stack_ptr) {
|
if (obj_desc != *stack_ptr) {
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_BUFFER:
|
case ARGI_BUFFER:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -440,25 +441,26 @@ acpi_ex_resolve_operands (
|
|||||||
* But we can implicitly convert from a STRING or INTEGER
|
* But we can implicitly convert from a STRING or INTEGER
|
||||||
* Aka - "Implicit Source Operand Conversion"
|
* Aka - "Implicit Source Operand Conversion"
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
|
status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_TYPE) {
|
if (status == AE_TYPE) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Integer/String/Buffer], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc != *stack_ptr) {
|
if (obj_desc != *stack_ptr) {
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_STRING:
|
case ARGI_STRING:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -466,83 +468,86 @@ acpi_ex_resolve_operands (
|
|||||||
* But we can implicitly convert from a BUFFER or INTEGER
|
* But we can implicitly convert from a BUFFER or INTEGER
|
||||||
* Aka - "Implicit Source Operand Conversion"
|
* Aka - "Implicit Source Operand Conversion"
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_string (obj_desc, stack_ptr,
|
status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
|
||||||
ACPI_IMPLICIT_CONVERT_HEX);
|
ACPI_IMPLICIT_CONVERT_HEX);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_TYPE) {
|
if (status == AE_TYPE) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Integer/String/Buffer], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc != *stack_ptr) {
|
if (obj_desc != *stack_ptr) {
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_COMPUTEDATA:
|
case ARGI_COMPUTEDATA:
|
||||||
|
|
||||||
/* Need an operand of type INTEGER, STRING or BUFFER */
|
/* Need an operand of type INTEGER, STRING or BUFFER */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/* Valid operand */
|
/* Valid operand */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Integer/String/Buffer], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_BUFFER_OR_STRING:
|
case ARGI_BUFFER_OR_STRING:
|
||||||
|
|
||||||
/* Need an operand of type STRING or BUFFER */
|
/* Need an operand of type STRING or BUFFER */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
/* Valid operand */
|
/* Valid operand */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
/* Highest priority conversion is to type Buffer */
|
/* Highest priority conversion is to type Buffer */
|
||||||
|
|
||||||
status = acpi_ex_convert_to_buffer (obj_desc, stack_ptr);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ex_convert_to_buffer(obj_desc,
|
||||||
return_ACPI_STATUS (status);
|
stack_ptr);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc != *stack_ptr) {
|
if (obj_desc != *stack_ptr) {
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Integer/String/Buffer], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_DATAOBJECT:
|
case ARGI_DATAOBJECT:
|
||||||
/*
|
/*
|
||||||
* ARGI_DATAOBJECT is only used by the size_of operator.
|
* ARGI_DATAOBJECT is only used by the size_of operator.
|
||||||
@@ -551,7 +556,7 @@ acpi_ex_resolve_operands (
|
|||||||
* The only reference allowed here is a direct reference to
|
* The only reference allowed here is a direct reference to
|
||||||
* a namespace node.
|
* a namespace node.
|
||||||
*/
|
*/
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
@@ -561,20 +566,20 @@ acpi_ex_resolve_operands (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Buffer/String/Package/Reference], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_COMPLEXOBJ:
|
case ARGI_COMPLEXOBJ:
|
||||||
|
|
||||||
/* Need a buffer or package or (ACPI 2.0) String */
|
/* Need a buffer or package or (ACPI 2.0) String */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
@@ -583,20 +588,20 @@ acpi_ex_resolve_operands (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Buffer/String/Package], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_REGION_OR_FIELD:
|
case ARGI_REGION_OR_FIELD:
|
||||||
|
|
||||||
/* Need an operand of type REGION or a FIELD in a region */
|
/* Need an operand of type REGION or a FIELD in a region */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_REGION:
|
case ACPI_TYPE_REGION:
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
@@ -606,20 +611,20 @@ acpi_ex_resolve_operands (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed [Region/region_field], found [%s] %p\n",
|
"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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
case ARGI_DATAREFOBJ:
|
case ARGI_DATAREFOBJ:
|
||||||
|
|
||||||
/* Used by the Store() operator only */
|
/* Used by the Store() operator only */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
@@ -651,47 +656,46 @@ acpi_ex_resolve_operands (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
|
"Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n",
|
||||||
acpi_ut_get_object_type_name (obj_desc), obj_desc));
|
acpi_ut_get_object_type_name
|
||||||
|
(obj_desc), obj_desc));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
goto next_operand;
|
goto next_operand;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* Unknown type */
|
/* Unknown type */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Internal - Unknown ARGI (required operand) type %X\n",
|
"Internal - Unknown ARGI (required operand) type %X\n",
|
||||||
this_arg_type));
|
this_arg_type));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure that the original object was resolved to the
|
* Make sure that the original object was resolved to the
|
||||||
* required object type (Simple cases only).
|
* required object type (Simple cases only).
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_check_object_type (type_needed,
|
status = acpi_ex_check_object_type(type_needed,
|
||||||
ACPI_GET_OBJECT_TYPE (*stack_ptr), *stack_ptr);
|
ACPI_GET_OBJECT_TYPE
|
||||||
if (ACPI_FAILURE (status)) {
|
(*stack_ptr), *stack_ptr);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
next_operand:
|
next_operand:
|
||||||
/*
|
/*
|
||||||
* If more operands needed, decrement stack_ptr to point
|
* If more operands needed, decrement stack_ptr to point
|
||||||
* to next operand on stack
|
* to next operand on stack
|
||||||
*/
|
*/
|
||||||
if (GET_CURRENT_ARG_TYPE (arg_types)) {
|
if (GET_CURRENT_ARG_TYPE(arg_types)) {
|
||||||
stack_ptr--;
|
stack_ptr--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
@@ -50,24 +49,18 @@
|
|||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exstore")
|
ACPI_MODULE_NAME("exstore")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ex_do_debug_object (
|
acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
u32 level, u32 index);
|
||||||
u32 level,
|
|
||||||
u32 index);
|
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_store_object_to_index (
|
acpi_ex_store_object_to_index(union acpi_operand_object *val_desc,
|
||||||
union acpi_operand_object *val_desc,
|
union acpi_operand_object *dest_desc,
|
||||||
union acpi_operand_object *dest_desc,
|
struct acpi_walk_state *walk_state);
|
||||||
struct acpi_walk_state *walk_state);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -84,136 +77,146 @@ acpi_ex_store_object_to_index (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ex_do_debug_object (
|
acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
u32 level, u32 index)
|
||||||
u32 level,
|
|
||||||
u32 index)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_do_debug_object", source_desc);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_do_debug_object", source_desc);
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
|
||||||
|
level, " "));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
|
|
||||||
level, " "));
|
|
||||||
|
|
||||||
/* Display index for package output only */
|
/* Display index for package output only */
|
||||||
|
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
|
||||||
"(%.2u) ", index -1));
|
"(%.2u) ", index - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!source_desc) {
|
if (!source_desc) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_OPERAND) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
|
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)) {
|
if (!acpi_ut_valid_internal_object(source_desc)) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
|
||||||
"%p, Invalid Internal Object!\n", source_desc));
|
"%p, Invalid Internal Object!\n",
|
||||||
return_VOID;
|
source_desc));
|
||||||
|
return_VOID;
|
||||||
}
|
}
|
||||||
}
|
} else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
|
||||||
else if (ACPI_GET_DESCRIPTOR_TYPE (source_desc) == ACPI_DESC_TYPE_NAMED) {
|
ACPI_DESC_TYPE_NAMED) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
|
||||||
acpi_ut_get_type_name (((struct acpi_namespace_node *) source_desc)->type),
|
acpi_ut_get_type_name(((struct
|
||||||
source_desc));
|
acpi_namespace_node
|
||||||
|
*)source_desc)->
|
||||||
|
type),
|
||||||
|
source_desc));
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
/* Output correct integer width */
|
/* Output correct integer width */
|
||||||
|
|
||||||
if (acpi_gbl_integer_byte_width == 4) {
|
if (acpi_gbl_integer_byte_width == 4) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
|
||||||
(u32) source_desc->integer.value));
|
(u32) source_desc->integer.
|
||||||
}
|
value));
|
||||||
else {
|
} else {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
|
||||||
ACPI_FORMAT_UINT64 (source_desc->integer.value)));
|
"0x%8.8X%8.8X\n",
|
||||||
|
ACPI_FORMAT_UINT64(source_desc->
|
||||||
|
integer.
|
||||||
|
value)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
|
||||||
(u32) source_desc->buffer.length));
|
(u32) source_desc->buffer.length));
|
||||||
ACPI_DUMP_BUFFER (source_desc->buffer.pointer,
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
|
||||||
source_desc->package.count));
|
"[0x%.2X Elements]\n",
|
||||||
|
source_desc->package.count));
|
||||||
|
|
||||||
/* Output the entire contents of the package */
|
/* Output the entire contents of the package */
|
||||||
|
|
||||||
for (i = 0; i < source_desc->package.count; i++) {
|
for (i = 0; i < source_desc->package.count; i++) {
|
||||||
acpi_ex_do_debug_object (source_desc->package.elements[i],
|
acpi_ex_do_debug_object(source_desc->package.
|
||||||
level+4, i+1);
|
elements[i], level + 4, i + 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||||
|
|
||||||
if (source_desc->reference.opcode == AML_INDEX_OP) {
|
if (source_desc->reference.opcode == AML_INDEX_OP) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT,
|
||||||
acpi_ps_get_opcode_name (source_desc->reference.opcode),
|
"[%s, 0x%X]\n",
|
||||||
source_desc->reference.offset));
|
acpi_ps_get_opcode_name
|
||||||
|
(source_desc->reference.opcode),
|
||||||
|
source_desc->reference.offset));
|
||||||
|
} else {
|
||||||
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
|
||||||
|
acpi_ps_get_opcode_name
|
||||||
|
(source_desc->reference.opcode)));
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
|
|
||||||
acpi_ps_get_opcode_name (source_desc->reference.opcode)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (source_desc->reference.object) {
|
if (source_desc->reference.object) {
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) ==
|
if (ACPI_GET_DESCRIPTOR_TYPE
|
||||||
ACPI_DESC_TYPE_NAMED) {
|
(source_desc->reference.object) ==
|
||||||
acpi_ex_do_debug_object (((struct acpi_namespace_node *)
|
ACPI_DESC_TYPE_NAMED) {
|
||||||
source_desc->reference.object)->object,
|
acpi_ex_do_debug_object(((struct
|
||||||
level+4, 0);
|
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 {
|
} else if (source_desc->reference.node) {
|
||||||
acpi_ex_do_debug_object (source_desc->reference.object, level+4, 0);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_store
|
* FUNCTION: acpi_ex_store
|
||||||
@@ -235,42 +238,41 @@ acpi_ex_do_debug_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_store (
|
acpi_ex_store(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object *dest_desc,
|
||||||
union acpi_operand_object *dest_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *ref_desc = dest_desc;
|
union acpi_operand_object *ref_desc = dest_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_store", dest_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_store", dest_desc);
|
||||||
|
|
||||||
/* Validate parameters */
|
/* Validate parameters */
|
||||||
|
|
||||||
if (!source_desc || !dest_desc) {
|
if (!source_desc || !dest_desc) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null parameter\n"));
|
||||||
return_ACPI_STATUS (AE_AML_NO_OPERAND);
|
return_ACPI_STATUS(AE_AML_NO_OPERAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* dest_desc can be either a namespace node or an ACPI object */
|
/* dest_desc can be either a namespace node or an ACPI object */
|
||||||
|
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (dest_desc) == ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(dest_desc) == ACPI_DESC_TYPE_NAMED) {
|
||||||
/*
|
/*
|
||||||
* Dest is a namespace node,
|
* Dest is a namespace node,
|
||||||
* Storing an object into a Named node.
|
* Storing an object into a Named node.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_store_object_to_node (source_desc,
|
status = acpi_ex_store_object_to_node(source_desc,
|
||||||
(struct acpi_namespace_node *) dest_desc, walk_state,
|
(struct
|
||||||
ACPI_IMPLICIT_CONVERSION);
|
acpi_namespace_node *)
|
||||||
|
dest_desc, walk_state,
|
||||||
|
ACPI_IMPLICIT_CONVERSION);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destination object must be a Reference or a Constant object */
|
/* Destination object must be a Reference or a Constant object */
|
||||||
|
|
||||||
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
|
||||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -279,7 +281,7 @@ acpi_ex_store (
|
|||||||
/* Allow stores to Constants -- a Noop as per ACPI spec */
|
/* Allow stores to Constants -- a Noop as per ACPI spec */
|
||||||
|
|
||||||
if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) {
|
if (dest_desc->common.flags & AOPOBJ_AML_CONSTANT) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*lint -fallthrough */
|
/*lint -fallthrough */
|
||||||
@@ -288,16 +290,18 @@ acpi_ex_store (
|
|||||||
|
|
||||||
/* Destination is not a Reference object */
|
/* Destination is not a Reference object */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Target is not a Reference or Constant object - %s [%p]\n",
|
"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(source_desc);
|
||||||
ACPI_DUMP_STACK_ENTRY (dest_desc);
|
ACPI_DUMP_STACK_ENTRY(dest_desc);
|
||||||
ACPI_DUMP_OPERANDS (&dest_desc, ACPI_IMODE_EXECUTE, "ex_store",
|
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);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -314,58 +318,59 @@ acpi_ex_store (
|
|||||||
|
|
||||||
/* Storing an object into a Name "container" */
|
/* Storing an object into a Name "container" */
|
||||||
|
|
||||||
status = acpi_ex_store_object_to_node (source_desc,
|
status = acpi_ex_store_object_to_node(source_desc,
|
||||||
ref_desc->reference.object,
|
ref_desc->reference.
|
||||||
walk_state, ACPI_IMPLICIT_CONVERSION);
|
object, walk_state,
|
||||||
|
ACPI_IMPLICIT_CONVERSION);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INDEX_OP:
|
case AML_INDEX_OP:
|
||||||
|
|
||||||
/* Storing to an Index (pointer into a packager or buffer) */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_LOCAL_OP:
|
case AML_LOCAL_OP:
|
||||||
case AML_ARG_OP:
|
case AML_ARG_OP:
|
||||||
|
|
||||||
/* Store to a method local/arg */
|
/* Store to a method local/arg */
|
||||||
|
|
||||||
status = acpi_ds_store_object_to_local (ref_desc->reference.opcode,
|
status =
|
||||||
ref_desc->reference.offset, source_desc, walk_state);
|
acpi_ds_store_object_to_local(ref_desc->reference.opcode,
|
||||||
|
ref_desc->reference.offset,
|
||||||
|
source_desc, walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_DEBUG_OP:
|
case AML_DEBUG_OP:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Storing to the Debug object causes the value stored to be
|
* Storing to the Debug object causes the value stored to be
|
||||||
* displayed and otherwise has no effect -- see ACPI Specification
|
* displayed and otherwise has no effect -- see ACPI Specification
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"**** Write to Debug Object: Object %p %s ****:\n\n",
|
"**** Write to Debug Object: Object %p %s ****:\n\n",
|
||||||
source_desc, acpi_ut_get_object_type_name (source_desc)));
|
source_desc,
|
||||||
|
acpi_ut_get_object_type_name(source_desc)));
|
||||||
|
|
||||||
acpi_ex_do_debug_object (source_desc, 0, 0);
|
acpi_ex_do_debug_object(source_desc, 0, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("ex_store: Unknown Reference opcode %X\n",
|
ACPI_REPORT_ERROR(("ex_store: Unknown Reference opcode %X\n",
|
||||||
ref_desc->reference.opcode));
|
ref_desc->reference.opcode));
|
||||||
ACPI_DUMP_ENTRY (ref_desc, ACPI_LV_ERROR);
|
ACPI_DUMP_ENTRY(ref_desc, ACPI_LV_ERROR);
|
||||||
|
|
||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_store_object_to_index
|
* FUNCTION: acpi_ex_store_object_to_index
|
||||||
@@ -381,20 +386,17 @@ acpi_ex_store (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ex_store_object_to_index (
|
acpi_ex_store_object_to_index(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object *index_desc,
|
||||||
union acpi_operand_object *index_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *new_desc;
|
union acpi_operand_object *new_desc;
|
||||||
u8 value = 0;
|
u8 value = 0;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_store_object_to_index");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_store_object_to_index");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destination must be a reference pointer, and
|
* Destination must be a reference pointer, and
|
||||||
@@ -413,19 +415,20 @@ acpi_ex_store_object_to_index (
|
|||||||
*/
|
*/
|
||||||
obj_desc = *(index_desc->reference.where);
|
obj_desc = *(index_desc->reference.where);
|
||||||
|
|
||||||
status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ut_copy_iobject_to_iobject(source_desc, &new_desc,
|
||||||
return_ACPI_STATUS (status);
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
/* Decrement reference count by the ref count of the parent package */
|
/* Decrement reference count by the ref count of the parent package */
|
||||||
|
|
||||||
for (i = 0;
|
for (i = 0; i < ((union acpi_operand_object *)
|
||||||
i < ((union acpi_operand_object *)
|
index_desc->reference.object)->common.
|
||||||
index_desc->reference.object)->common.reference_count;
|
reference_count; i++) {
|
||||||
i++) {
|
acpi_ut_remove_reference(obj_desc);
|
||||||
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 */
|
/* Increment ref count by the ref count of the parent package-1 */
|
||||||
|
|
||||||
for (i = 1;
|
for (i = 1; i < ((union acpi_operand_object *)
|
||||||
i < ((union acpi_operand_object *)
|
index_desc->reference.object)->common.
|
||||||
index_desc->reference.object)->common.reference_count;
|
reference_count; i++) {
|
||||||
i++) {
|
acpi_ut_add_reference(new_desc);
|
||||||
acpi_ut_add_reference (new_desc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER_FIELD:
|
case ACPI_TYPE_BUFFER_FIELD:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -460,16 +461,16 @@ acpi_ex_store_object_to_index (
|
|||||||
* by the INDEX_OP code.
|
* by the INDEX_OP code.
|
||||||
*/
|
*/
|
||||||
obj_desc = index_desc->reference.object;
|
obj_desc = index_desc->reference.object;
|
||||||
if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) &&
|
if ((ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_BUFFER) &&
|
||||||
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {
|
(ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_STRING)) {
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The assignment of the individual elements will be slightly
|
* The assignment of the individual elements will be slightly
|
||||||
* different for each source type.
|
* different for each source type.
|
||||||
*/
|
*/
|
||||||
switch (ACPI_GET_OBJECT_TYPE (source_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
/* Use the least-significant byte of the integer */
|
/* Use the least-significant byte of the integer */
|
||||||
@@ -489,10 +490,11 @@ acpi_ex_store_object_to_index (
|
|||||||
|
|
||||||
/* All other types are invalid */
|
/* All other types are invalid */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Source must be Integer/Buffer/String type, not %s\n",
|
"Source must be Integer/Buffer/String type, not %s\n",
|
||||||
acpi_ut_get_object_type_name (source_desc)));
|
acpi_ut_get_object_type_name
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
|
(source_desc)));
|
||||||
|
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the source value into the target buffer byte */
|
/* Store the source value into the target buffer byte */
|
||||||
@@ -500,18 +502,16 @@ acpi_ex_store_object_to_index (
|
|||||||
obj_desc->buffer.pointer[index_desc->reference.offset] = value;
|
obj_desc->buffer.pointer[index_desc->reference.offset] = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Target is not a Package or buffer_field\n"));
|
"Target is not a Package or buffer_field\n"));
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_store_object_to_node
|
* FUNCTION: acpi_ex_store_object_to_node
|
||||||
@@ -539,37 +539,35 @@ acpi_ex_store_object_to_index (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_store_object_to_node (
|
acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
u8 implicit_conversion)
|
||||||
u8 implicit_conversion)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *target_desc;
|
union acpi_operand_object *target_desc;
|
||||||
union acpi_operand_object *new_desc;
|
union acpi_operand_object *new_desc;
|
||||||
acpi_object_type target_type;
|
acpi_object_type target_type;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_node", source_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_node", source_desc);
|
||||||
|
|
||||||
/* Get current type of the node, and object attached to Node */
|
/* Get current type of the node, and object attached to Node */
|
||||||
|
|
||||||
target_type = acpi_ns_get_type (node);
|
target_type = acpi_ns_get_type(node);
|
||||||
target_desc = acpi_ns_get_attached_object (node);
|
target_desc = acpi_ns_get_attached_object(node);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
|
||||||
source_desc, acpi_ut_get_object_type_name (source_desc),
|
source_desc,
|
||||||
node, acpi_ut_get_type_name (target_type)));
|
acpi_ut_get_object_type_name(source_desc), node,
|
||||||
|
acpi_ut_get_type_name(target_type)));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Resolve the source object to an actual value
|
* Resolve the source object to an actual value
|
||||||
* (If it is a reference object)
|
* (If it is a reference object)
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_resolve_object (&source_desc, target_type, walk_state);
|
status = acpi_ex_resolve_object(&source_desc, target_type, walk_state);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If no implicit conversion, drop into the default case below */
|
/* If no implicit conversion, drop into the default case below */
|
||||||
@@ -590,11 +588,10 @@ acpi_ex_store_object_to_node (
|
|||||||
|
|
||||||
/* For fields, copy the source data to the target field. */
|
/* For fields, copy the source data to the target field. */
|
||||||
|
|
||||||
status = acpi_ex_write_data_to_field (source_desc, target_desc,
|
status = acpi_ex_write_data_to_field(source_desc, target_desc,
|
||||||
&walk_state->result_obj);
|
&walk_state->result_obj);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
@@ -605,10 +602,11 @@ acpi_ex_store_object_to_node (
|
|||||||
*
|
*
|
||||||
* Copy and/or convert the source object to a new target object
|
* Copy and/or convert the source object to a new target object
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_store_object_to_object (source_desc, target_desc,
|
status =
|
||||||
&new_desc, walk_state);
|
acpi_ex_store_object_to_object(source_desc, target_desc,
|
||||||
if (ACPI_FAILURE (status)) {
|
&new_desc, walk_state);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new_desc != target_desc) {
|
if (new_desc != target_desc) {
|
||||||
@@ -621,30 +619,33 @@ acpi_ex_store_object_to_node (
|
|||||||
* has been performed such that the node/object type has been
|
* has been performed such that the node/object type has been
|
||||||
* changed.
|
* 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,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Store %s into %s via Convert/Attach\n",
|
"Store %s into %s via Convert/Attach\n",
|
||||||
acpi_ut_get_object_type_name (source_desc),
|
acpi_ut_get_object_type_name
|
||||||
acpi_ut_get_object_type_name (new_desc)));
|
(source_desc),
|
||||||
|
acpi_ut_get_object_type_name
|
||||||
|
(new_desc)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Storing %s (%p) directly into node (%p) with no implicit conversion\n",
|
"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 */
|
/* No conversions for all other types. Just attach the source object */
|
||||||
|
|
||||||
status = acpi_ns_attach_object (node, source_desc,
|
status = acpi_ns_attach_object(node, source_desc,
|
||||||
ACPI_GET_OBJECT_TYPE (source_desc));
|
ACPI_GET_OBJECT_TYPE
|
||||||
|
(source_desc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -43,15 +43,12 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exstoren")
|
ACPI_MODULE_NAME("exstoren")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -67,19 +64,15 @@
|
|||||||
* it and return the actual object in the source_desc_ptr.
|
* it and return the actual object in the source_desc_ptr.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_resolve_object (
|
acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
|
||||||
union acpi_operand_object **source_desc_ptr,
|
acpi_object_type target_type,
|
||||||
acpi_object_type target_type,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *source_desc = *source_desc_ptr;
|
union acpi_operand_object *source_desc = *source_desc_ptr;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_resolve_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_resolve_object");
|
||||||
|
|
||||||
/* Ensure we have a Target that can be stored to */
|
/* Ensure we have a Target that can be stored to */
|
||||||
|
|
||||||
@@ -102,11 +95,14 @@ acpi_ex_resolve_object (
|
|||||||
* are all essentially the same. This case handles the
|
* are all essentially the same. This case handles the
|
||||||
* "interchangeable" types Integer, String, and Buffer.
|
* "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 */
|
/* Resolve a reference object first */
|
||||||
|
|
||||||
status = acpi_ex_resolve_to_value (source_desc_ptr, walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ex_resolve_to_value(source_desc_ptr,
|
||||||
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,31 +115,32 @@ acpi_ex_resolve_object (
|
|||||||
|
|
||||||
/* Must have a Integer, Buffer, or String */
|
/* Must have a Integer, Buffer, or String */
|
||||||
|
|
||||||
if ((ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_INTEGER) &&
|
if ((ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_INTEGER) &&
|
||||||
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_BUFFER) &&
|
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) &&
|
||||||
(ACPI_GET_OBJECT_TYPE (source_desc) != ACPI_TYPE_STRING) &&
|
(ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_STRING) &&
|
||||||
!((ACPI_GET_OBJECT_TYPE (source_desc) == ACPI_TYPE_LOCAL_REFERENCE) && (source_desc->reference.opcode == AML_LOAD_OP))) {
|
!((ACPI_GET_OBJECT_TYPE(source_desc) ==
|
||||||
|
ACPI_TYPE_LOCAL_REFERENCE)
|
||||||
|
&& (source_desc->reference.opcode == AML_LOAD_OP))) {
|
||||||
/* Conversion successful but still not a valid type */
|
/* Conversion successful but still not a valid type */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
|
"Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
|
||||||
acpi_ut_get_object_type_name (source_desc),
|
acpi_ut_get_object_type_name
|
||||||
acpi_ut_get_type_name (target_type)));
|
(source_desc),
|
||||||
|
acpi_ut_get_type_name(target_type)));
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_ALIAS:
|
case ACPI_TYPE_LOCAL_ALIAS:
|
||||||
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
|
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
|
||||||
|
|
||||||
/* Aliases are resolved by acpi_ex_prep_operands */
|
/* Aliases are resolved by acpi_ex_prep_operands */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
|
ACPI_REPORT_ERROR(("Store into Alias - should never happen\n"));
|
||||||
status = AE_AML_INTERNAL;
|
status = AE_AML_INTERNAL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
default:
|
default:
|
||||||
|
|
||||||
@@ -154,10 +151,9 @@ acpi_ex_resolve_object (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_store_object_to_object
|
* FUNCTION: acpi_ex_store_object_to_object
|
||||||
@@ -194,18 +190,15 @@ acpi_ex_resolve_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_store_object_to_object (
|
acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object *dest_desc,
|
||||||
union acpi_operand_object *dest_desc,
|
union acpi_operand_object **new_desc,
|
||||||
union acpi_operand_object **new_desc,
|
struct acpi_walk_state *walk_state)
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *actual_src_desc;
|
union acpi_operand_object *actual_src_desc;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_store_object_to_object", source_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_store_object_to_object", source_desc);
|
||||||
|
|
||||||
actual_src_desc = source_desc;
|
actual_src_desc = source_desc;
|
||||||
if (!dest_desc) {
|
if (!dest_desc) {
|
||||||
@@ -214,11 +207,14 @@ acpi_ex_store_object_to_object (
|
|||||||
* package element), so we can simply copy the source object
|
* package element), so we can simply copy the source object
|
||||||
* creating a new destination object
|
* creating a new destination object
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, new_desc, walk_state);
|
status =
|
||||||
return_ACPI_STATUS (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.
|
* The source type does not match the type of the destination.
|
||||||
* Perform the "implicit conversion" of the source to the current type
|
* Perform the "implicit conversion" of the source to the current type
|
||||||
@@ -228,10 +224,13 @@ acpi_ex_store_object_to_object (
|
|||||||
* Otherwise, actual_src_desc is a temporary object to hold the
|
* Otherwise, actual_src_desc is a temporary object to hold the
|
||||||
* converted object.
|
* converted object.
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_convert_to_target_type (ACPI_GET_OBJECT_TYPE (dest_desc),
|
status =
|
||||||
source_desc, &actual_src_desc, walk_state);
|
acpi_ex_convert_to_target_type(ACPI_GET_OBJECT_TYPE
|
||||||
if (ACPI_FAILURE (status)) {
|
(dest_desc), source_desc,
|
||||||
return_ACPI_STATUS (status);
|
&actual_src_desc,
|
||||||
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source_desc == actual_src_desc) {
|
if (source_desc == actual_src_desc) {
|
||||||
@@ -240,7 +239,7 @@ acpi_ex_store_object_to_object (
|
|||||||
* new object.
|
* new object.
|
||||||
*/
|
*/
|
||||||
*new_desc = source_desc;
|
*new_desc = source_desc;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,38 +247,42 @@ acpi_ex_store_object_to_object (
|
|||||||
* We now have two objects of identical types, and we can perform a
|
* We now have two objects of identical types, and we can perform a
|
||||||
* copy of the *value* of the source object.
|
* copy of the *value* of the source object.
|
||||||
*/
|
*/
|
||||||
switch (ACPI_GET_OBJECT_TYPE (dest_desc)) {
|
switch (ACPI_GET_OBJECT_TYPE(dest_desc)) {
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
dest_desc->integer.value = actual_src_desc->integer.value;
|
dest_desc->integer.value = actual_src_desc->integer.value;
|
||||||
|
|
||||||
/* Truncate value if we are executing from a 32-bit ACPI table */
|
/* Truncate value if we are executing from a 32-bit ACPI table */
|
||||||
|
|
||||||
acpi_ex_truncate_for32bit_table (dest_desc);
|
acpi_ex_truncate_for32bit_table(dest_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
status = acpi_ut_copy_iobject_to_iobject (actual_src_desc, &dest_desc,
|
status =
|
||||||
walk_state);
|
acpi_ut_copy_iobject_to_iobject(actual_src_desc, &dest_desc,
|
||||||
|
walk_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
* All other types come here.
|
* All other types come here.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN,
|
||||||
acpi_ut_get_object_type_name (dest_desc)));
|
"Store into type %s not implemented\n",
|
||||||
|
acpi_ut_get_object_type_name(dest_desc)));
|
||||||
|
|
||||||
status = AE_NOT_IMPLEMENTED;
|
status = AE_NOT_IMPLEMENTED;
|
||||||
break;
|
break;
|
||||||
@@ -288,11 +291,9 @@ acpi_ex_store_object_to_object (
|
|||||||
if (actual_src_desc != source_desc) {
|
if (actual_src_desc != source_desc) {
|
||||||
/* Delete the intermediate (temporary) source object */
|
/* Delete the intermediate (temporary) source object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (actual_src_desc);
|
acpi_ut_remove_reference(actual_src_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
*new_desc = dest_desc;
|
*new_desc = dest_desc;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exstorob")
|
ACPI_MODULE_NAME("exstorob")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -63,18 +60,14 @@
|
|||||||
* DESCRIPTION: Copy a buffer object to another buffer object.
|
* DESCRIPTION: Copy a buffer object to another buffer object.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_store_buffer_to_buffer (
|
acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object *target_desc)
|
||||||
union acpi_operand_object *target_desc)
|
|
||||||
{
|
{
|
||||||
u32 length;
|
u32 length;
|
||||||
u8 *buffer;
|
u8 *buffer;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_store_buffer_to_buffer", source_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_store_buffer_to_buffer", source_desc);
|
||||||
|
|
||||||
/* We know that source_desc is a buffer by now */
|
/* We know that source_desc is a buffer by now */
|
||||||
|
|
||||||
@@ -86,10 +79,10 @@ acpi_ex_store_buffer_to_buffer (
|
|||||||
* allocate a new buffer of the proper length
|
* allocate a new buffer of the proper length
|
||||||
*/
|
*/
|
||||||
if ((target_desc->buffer.length == 0) ||
|
if ((target_desc->buffer.length == 0) ||
|
||||||
(target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
|
(target_desc->common.flags & AOPOBJ_STATIC_POINTER)) {
|
||||||
target_desc->buffer.pointer = ACPI_MEM_ALLOCATE (length);
|
target_desc->buffer.pointer = ACPI_MEM_ALLOCATE(length);
|
||||||
if (!target_desc->buffer.pointer) {
|
if (!target_desc->buffer.pointer) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
target_desc->buffer.length = length;
|
target_desc->buffer.length = length;
|
||||||
@@ -100,8 +93,9 @@ acpi_ex_store_buffer_to_buffer (
|
|||||||
if (length <= target_desc->buffer.length) {
|
if (length <= target_desc->buffer.length) {
|
||||||
/* Clear existing buffer and copy in the new one */
|
/* 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,
|
||||||
ACPI_MEMCPY (target_desc->buffer.pointer, buffer, length);
|
target_desc->buffer.length);
|
||||||
|
ACPI_MEMCPY(target_desc->buffer.pointer, buffer, length);
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_BEHAVIOR
|
#ifdef ACPI_OBSOLETE_BEHAVIOR
|
||||||
/*
|
/*
|
||||||
@@ -124,26 +118,24 @@ acpi_ex_store_buffer_to_buffer (
|
|||||||
target_desc->buffer.length = length;
|
target_desc->buffer.length = length;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Truncate the source, copy only what will fit */
|
/* Truncate the source, copy only what will fit */
|
||||||
|
|
||||||
ACPI_MEMCPY (target_desc->buffer.pointer, buffer,
|
ACPI_MEMCPY(target_desc->buffer.pointer, buffer,
|
||||||
target_desc->buffer.length);
|
target_desc->buffer.length);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Truncating source buffer from %X to %X\n",
|
"Truncating source buffer from %X to %X\n",
|
||||||
length, target_desc->buffer.length));
|
length, target_desc->buffer.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy flags */
|
/* Copy flags */
|
||||||
|
|
||||||
target_desc->buffer.flags = source_desc->buffer.flags;
|
target_desc->buffer.flags = source_desc->buffer.flags;
|
||||||
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
|
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_store_string_to_string
|
* FUNCTION: acpi_ex_store_string_to_string
|
||||||
@@ -158,16 +150,13 @@ acpi_ex_store_buffer_to_buffer (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_store_string_to_string (
|
acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
|
||||||
union acpi_operand_object *source_desc,
|
union acpi_operand_object *target_desc)
|
||||||
union acpi_operand_object *target_desc)
|
|
||||||
{
|
{
|
||||||
u32 length;
|
u32 length;
|
||||||
u8 *buffer;
|
u8 *buffer;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_store_string_to_string", source_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_store_string_to_string", source_desc);
|
||||||
|
|
||||||
/* We know that source_desc is a string by now */
|
/* We know that source_desc is a string by now */
|
||||||
|
|
||||||
@@ -179,41 +168,38 @@ acpi_ex_store_string_to_string (
|
|||||||
* pointer is not a static pointer (part of an ACPI table)
|
* pointer is not a static pointer (part of an ACPI table)
|
||||||
*/
|
*/
|
||||||
if ((length < target_desc->string.length) &&
|
if ((length < target_desc->string.length) &&
|
||||||
(!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
|
(!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
|
||||||
/*
|
/*
|
||||||
* String will fit in existing non-static buffer.
|
* String will fit in existing non-static buffer.
|
||||||
* Clear old string and copy in the new one
|
* Clear old string and copy in the new one
|
||||||
*/
|
*/
|
||||||
ACPI_MEMSET (target_desc->string.pointer, 0,
|
ACPI_MEMSET(target_desc->string.pointer, 0,
|
||||||
(acpi_size) target_desc->string.length + 1);
|
(acpi_size) target_desc->string.length + 1);
|
||||||
ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
|
ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Free the current buffer, then allocate a new buffer
|
* Free the current buffer, then allocate a new buffer
|
||||||
* large enough to hold the value
|
* large enough to hold the value
|
||||||
*/
|
*/
|
||||||
if (target_desc->string.pointer &&
|
if (target_desc->string.pointer &&
|
||||||
(!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
|
(!(target_desc->common.flags & AOPOBJ_STATIC_POINTER))) {
|
||||||
/* Only free if not a pointer into the DSDT */
|
/* Only free if not a pointer into the DSDT */
|
||||||
|
|
||||||
ACPI_MEM_FREE (target_desc->string.pointer);
|
ACPI_MEM_FREE(target_desc->string.pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
target_desc->string.pointer = ACPI_MEM_CALLOCATE (
|
target_desc->string.pointer = ACPI_MEM_CALLOCATE((acpi_size)
|
||||||
(acpi_size) length + 1);
|
length + 1);
|
||||||
if (!target_desc->string.pointer) {
|
if (!target_desc->string.pointer) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
|
target_desc->common.flags &= ~AOPOBJ_STATIC_POINTER;
|
||||||
ACPI_MEMCPY (target_desc->string.pointer, buffer, length);
|
ACPI_MEMCPY(target_desc->string.pointer, buffer, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the new target length */
|
/* Set the new target length */
|
||||||
|
|
||||||
target_desc->string.length = length;
|
target_desc->string.length = length;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,12 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exsystem")
|
ACPI_MODULE_NAME("exsystem")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -65,49 +63,42 @@
|
|||||||
* interpreter is released.
|
* 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 status;
|
||||||
acpi_status status2;
|
acpi_status status2;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_system_wait_semaphore");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_system_wait_semaphore");
|
status = acpi_os_wait_semaphore(semaphore, 1, 0);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
status = acpi_os_wait_semaphore (semaphore, 1, 0);
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == AE_TIME) {
|
if (status == AE_TIME) {
|
||||||
/* We must wait, so unlock the interpreter */
|
/* We must wait, so unlock the interpreter */
|
||||||
|
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
|
|
||||||
status = acpi_os_wait_semaphore (semaphore, 1, timeout);
|
status = acpi_os_wait_semaphore(semaphore, 1, timeout);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"*** Thread awake after blocking, %s\n",
|
"*** Thread awake after blocking, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
|
|
||||||
/* Reacquire the interpreter */
|
/* Reacquire the interpreter */
|
||||||
|
|
||||||
status2 = acpi_ex_enter_interpreter ();
|
status2 = acpi_ex_enter_interpreter();
|
||||||
if (ACPI_FAILURE (status2)) {
|
if (ACPI_FAILURE(status2)) {
|
||||||
/* Report fatal error, could not acquire interpreter */
|
/* Report fatal error, could not acquire interpreter */
|
||||||
|
|
||||||
return_ACPI_STATUS (status2);
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_do_stall
|
* FUNCTION: acpi_ex_system_do_stall
|
||||||
@@ -125,35 +116,29 @@ acpi_ex_system_wait_semaphore (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_system_do_stall(u32 how_long)
|
||||||
acpi_ex_system_do_stall (
|
|
||||||
u32 how_long)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
if (how_long > 255) { /* 255 microseconds */
|
||||||
|
|
||||||
|
|
||||||
if (how_long > 255) /* 255 microseconds */ {
|
|
||||||
/*
|
/*
|
||||||
* Longer than 255 usec, this is an error
|
* Longer than 255 usec, this is an error
|
||||||
*
|
*
|
||||||
* (ACPI specifies 100 usec as max, but this gives some slack in
|
* (ACPI specifies 100 usec as max, but this gives some slack in
|
||||||
* order to support existing BIOSs)
|
* order to support existing BIOSs)
|
||||||
*/
|
*/
|
||||||
ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n",
|
ACPI_REPORT_ERROR(("Stall: Time parameter is too large (%d)\n",
|
||||||
how_long));
|
how_long));
|
||||||
status = AE_AML_OPERAND_VALUE;
|
status = AE_AML_OPERAND_VALUE;
|
||||||
}
|
} else {
|
||||||
else {
|
acpi_os_stall(how_long);
|
||||||
acpi_os_stall (how_long);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_do_suspend
|
* FUNCTION: acpi_ex_system_do_suspend
|
||||||
@@ -167,29 +152,24 @@ acpi_ex_system_do_stall (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_system_do_suspend(acpi_integer how_long)
|
||||||
acpi_ex_system_do_suspend (
|
|
||||||
acpi_integer how_long)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* Since this thread will sleep, we must release the interpreter */
|
/* Since this thread will sleep, we must release the interpreter */
|
||||||
|
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
|
|
||||||
acpi_os_sleep (how_long);
|
acpi_os_sleep(how_long);
|
||||||
|
|
||||||
/* And now we must get the interpreter again */
|
/* And now we must get the interpreter again */
|
||||||
|
|
||||||
status = acpi_ex_enter_interpreter ();
|
status = acpi_ex_enter_interpreter();
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_acquire_mutex
|
* FUNCTION: acpi_ex_system_acquire_mutex
|
||||||
@@ -206,33 +186,30 @@ acpi_ex_system_do_suspend (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_system_acquire_mutex (
|
acpi_ex_system_acquire_mutex(union acpi_operand_object * time_desc,
|
||||||
union acpi_operand_object *time_desc,
|
union acpi_operand_object * obj_desc)
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ex_system_acquire_mutex", obj_desc);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ex_system_acquire_mutex", obj_desc);
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support for the _GL_ Mutex object -- go get the global lock */
|
/* Support for the _GL_ Mutex object -- go get the global lock */
|
||||||
|
|
||||||
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
|
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
|
||||||
status = acpi_ev_acquire_global_lock ((u16) time_desc->integer.value);
|
status =
|
||||||
return_ACPI_STATUS (status);
|
acpi_ev_acquire_global_lock((u16) time_desc->integer.value);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_system_wait_semaphore (obj_desc->mutex.semaphore,
|
status = acpi_ex_system_wait_semaphore(obj_desc->mutex.semaphore,
|
||||||
(u16) time_desc->integer.value);
|
(u16) time_desc->integer.value);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_release_mutex
|
* FUNCTION: acpi_ex_system_release_mutex
|
||||||
@@ -248,32 +225,27 @@ acpi_ex_system_acquire_mutex (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_system_release_mutex(union acpi_operand_object *obj_desc)
|
||||||
acpi_ex_system_release_mutex (
|
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_system_release_mutex");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_system_release_mutex");
|
||||||
|
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support for the _GL_ Mutex object -- release the global lock */
|
/* Support for the _GL_ Mutex object -- release the global lock */
|
||||||
|
|
||||||
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
|
if (obj_desc->mutex.semaphore == acpi_gbl_global_lock_semaphore) {
|
||||||
status = acpi_ev_release_global_lock ();
|
status = acpi_ev_release_global_lock();
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_os_signal_semaphore (obj_desc->mutex.semaphore, 1);
|
status = acpi_os_signal_semaphore(obj_desc->mutex.semaphore, 1);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_signal_event
|
* FUNCTION: acpi_ex_system_signal_event
|
||||||
@@ -287,24 +259,19 @@ acpi_ex_system_release_mutex (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc)
|
||||||
acpi_ex_system_signal_event (
|
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_system_signal_event");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_system_signal_event");
|
||||||
|
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
status = acpi_os_signal_semaphore (obj_desc->event.semaphore, 1);
|
status = acpi_os_signal_semaphore(obj_desc->event.semaphore, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_wait_event
|
* FUNCTION: acpi_ex_system_wait_event
|
||||||
@@ -321,25 +288,23 @@ acpi_ex_system_signal_event (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ex_system_wait_event (
|
acpi_ex_system_wait_event(union acpi_operand_object *time_desc,
|
||||||
union acpi_operand_object *time_desc,
|
union acpi_operand_object *obj_desc)
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_system_wait_event");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_system_wait_event");
|
||||||
|
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
status = acpi_ex_system_wait_semaphore (obj_desc->event.semaphore,
|
status =
|
||||||
(u16) time_desc->integer.value);
|
acpi_ex_system_wait_semaphore(obj_desc->event.semaphore,
|
||||||
|
(u16) time_desc->integer.
|
||||||
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_system_reset_event
|
* FUNCTION: acpi_ex_system_reset_event
|
||||||
@@ -352,27 +317,23 @@ acpi_ex_system_wait_event (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc)
|
||||||
acpi_ex_system_reset_event (
|
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
void *temp_semaphore;
|
void *temp_semaphore;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are going to simply delete the existing semaphore and
|
* We are going to simply delete the existing semaphore and
|
||||||
* create a new one!
|
* create a new one!
|
||||||
*/
|
*/
|
||||||
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
|
status =
|
||||||
if (ACPI_SUCCESS (status)) {
|
acpi_os_create_semaphore(ACPI_NO_UNIT_LIMIT, 0, &temp_semaphore);
|
||||||
(void) acpi_os_delete_semaphore (obj_desc->event.semaphore);
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
(void)acpi_os_delete_semaphore(obj_desc->event.semaphore);
|
||||||
obj_desc->event.semaphore = temp_semaphore;
|
obj_desc->event.semaphore = temp_semaphore;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DEFINE_AML_GLOBALS is tested in amlcode.h
|
* DEFINE_AML_GLOBALS is tested in amlcode.h
|
||||||
* to determine whether certain global names should be "defined" or only
|
* to determine whether certain global names should be "defined" or only
|
||||||
@@ -65,15 +64,10 @@
|
|||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_EXECUTER
|
#define _COMPONENT ACPI_EXECUTER
|
||||||
ACPI_MODULE_NAME ("exutils")
|
ACPI_MODULE_NAME("exutils")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* 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
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
@@ -89,24 +83,20 @@ acpi_ex_digits_needed (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ex_enter_interpreter(void)
|
||||||
acpi_ex_enter_interpreter (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_enter_interpreter");
|
ACPI_FUNCTION_TRACE("ex_enter_interpreter");
|
||||||
|
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_EXECUTE);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_EXECUTE);
|
if (ACPI_FAILURE(status)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
ACPI_REPORT_ERROR(("Could not acquire interpreter mutex\n"));
|
||||||
ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_exit_interpreter
|
* FUNCTION: acpi_ex_exit_interpreter
|
||||||
@@ -129,25 +119,20 @@ acpi_ex_enter_interpreter (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_exit_interpreter(void)
|
||||||
acpi_ex_exit_interpreter (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_exit_interpreter");
|
||||||
|
|
||||||
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"));
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_EXECUTE);
|
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_truncate_for32bit_table
|
* FUNCTION: acpi_ex_truncate_for32bit_table
|
||||||
@@ -161,20 +146,17 @@ acpi_ex_exit_interpreter (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc)
|
||||||
acpi_ex_truncate_for32bit_table (
|
|
||||||
union acpi_operand_object *obj_desc)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Object must be a valid number and we must be executing
|
* Object must be a valid number and we must be executing
|
||||||
* a control method
|
* a control method
|
||||||
*/
|
*/
|
||||||
if ((!obj_desc) ||
|
if ((!obj_desc) ||
|
||||||
(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_INTEGER)) {
|
(ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +169,6 @@ acpi_ex_truncate_for32bit_table (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_acquire_global_lock
|
* FUNCTION: acpi_ex_acquire_global_lock
|
||||||
@@ -203,37 +184,31 @@ acpi_ex_truncate_for32bit_table (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8
|
u8 acpi_ex_acquire_global_lock(u32 field_flags)
|
||||||
acpi_ex_acquire_global_lock (
|
|
||||||
u32 field_flags)
|
|
||||||
{
|
{
|
||||||
u8 locked = FALSE;
|
u8 locked = FALSE;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_acquire_global_lock");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_acquire_global_lock");
|
||||||
|
|
||||||
/* Only attempt lock if the always_lock bit is set */
|
/* Only attempt lock if the always_lock bit is set */
|
||||||
|
|
||||||
if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
|
if (field_flags & AML_FIELD_LOCK_RULE_MASK) {
|
||||||
/* We should attempt to get the lock, wait forever */
|
/* We should attempt to get the lock, wait forever */
|
||||||
|
|
||||||
status = acpi_ev_acquire_global_lock (ACPI_WAIT_FOREVER);
|
status = acpi_ev_acquire_global_lock(ACPI_WAIT_FOREVER);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
locked = TRUE;
|
locked = TRUE;
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
"Could not acquire Global Lock, %s\n",
|
||||||
"Could not acquire Global Lock, %s\n",
|
acpi_format_exception(status)));
|
||||||
acpi_format_exception (status)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE (locked);
|
return_VALUE(locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_release_global_lock
|
* FUNCTION: acpi_ex_release_global_lock
|
||||||
@@ -247,34 +222,28 @@ acpi_ex_acquire_global_lock (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_release_global_lock(u8 locked_by_me)
|
||||||
acpi_ex_release_global_lock (
|
|
||||||
u8 locked_by_me)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_release_global_lock");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_release_global_lock");
|
||||||
|
|
||||||
/* Only attempt unlock if the caller locked it */
|
/* Only attempt unlock if the caller locked it */
|
||||||
|
|
||||||
if (locked_by_me) {
|
if (locked_by_me) {
|
||||||
/* OK, now release the lock */
|
/* OK, now release the lock */
|
||||||
|
|
||||||
status = acpi_ev_release_global_lock ();
|
status = acpi_ev_release_global_lock();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/* Report the error, but there isn't much else we can do */
|
/* Report the error, but there isn't much else we can do */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
|
ACPI_REPORT_ERROR(("Could not release ACPI Global Lock, %s\n", acpi_format_exception(status)));
|
||||||
acpi_format_exception (status)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_digits_needed
|
* FUNCTION: acpi_ex_digits_needed
|
||||||
@@ -289,22 +258,17 @@ acpi_ex_release_global_lock (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32 acpi_ex_digits_needed(acpi_integer value, u32 base)
|
||||||
acpi_ex_digits_needed (
|
|
||||||
acpi_integer value,
|
|
||||||
u32 base)
|
|
||||||
{
|
{
|
||||||
u32 num_digits;
|
u32 num_digits;
|
||||||
acpi_integer current_value;
|
acpi_integer current_value;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ex_digits_needed");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ex_digits_needed");
|
||||||
|
|
||||||
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */
|
/* acpi_integer is unsigned, so we don't worry about a '-' prefix */
|
||||||
|
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
return_VALUE (1);
|
return_VALUE(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_value = value;
|
current_value = value;
|
||||||
@@ -313,14 +277,14 @@ acpi_ex_digits_needed (
|
|||||||
/* Count the digits in the requested base */
|
/* Count the digits in the requested base */
|
||||||
|
|
||||||
while (current_value) {
|
while (current_value) {
|
||||||
(void) acpi_ut_short_divide (current_value, base, ¤t_value, NULL);
|
(void)acpi_ut_short_divide(current_value, base, ¤t_value,
|
||||||
|
NULL);
|
||||||
num_digits++;
|
num_digits++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE (num_digits);
|
return_VALUE(num_digits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_eisa_id_to_string
|
* FUNCTION: acpi_ex_eisa_id_to_string
|
||||||
@@ -334,32 +298,26 @@ acpi_ex_digits_needed (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_eisa_id_to_string(u32 numeric_id, char *out_string)
|
||||||
acpi_ex_eisa_id_to_string (
|
|
||||||
u32 numeric_id,
|
|
||||||
char *out_string)
|
|
||||||
{
|
{
|
||||||
u32 eisa_id;
|
u32 eisa_id;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* Swap ID to big-endian to get contiguous bits */
|
/* Swap ID to big-endian to get contiguous bits */
|
||||||
|
|
||||||
eisa_id = acpi_ut_dword_byte_swap (numeric_id);
|
eisa_id = acpi_ut_dword_byte_swap(numeric_id);
|
||||||
|
|
||||||
out_string[0] = (char) ('@' + (((unsigned long) eisa_id >> 26) & 0x1f));
|
out_string[0] = (char)('@' + (((unsigned long)eisa_id >> 26) & 0x1f));
|
||||||
out_string[1] = (char) ('@' + ((eisa_id >> 21) & 0x1f));
|
out_string[1] = (char)('@' + ((eisa_id >> 21) & 0x1f));
|
||||||
out_string[2] = (char) ('@' + ((eisa_id >> 16) & 0x1f));
|
out_string[2] = (char)('@' + ((eisa_id >> 16) & 0x1f));
|
||||||
out_string[3] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 12);
|
out_string[3] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 12);
|
||||||
out_string[4] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 8);
|
out_string[4] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 8);
|
||||||
out_string[5] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 4);
|
out_string[5] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 4);
|
||||||
out_string[6] = acpi_ut_hex_to_ascii_char ((acpi_integer) eisa_id, 0);
|
out_string[6] = acpi_ut_hex_to_ascii_char((acpi_integer) eisa_id, 0);
|
||||||
out_string[7] = 0;
|
out_string[7] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ex_unsigned_integer_to_string
|
* FUNCTION: acpi_ex_unsigned_integer_to_string
|
||||||
@@ -374,25 +332,20 @@ acpi_ex_eisa_id_to_string (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ex_unsigned_integer_to_string(acpi_integer value, char *out_string)
|
||||||
acpi_ex_unsigned_integer_to_string (
|
|
||||||
acpi_integer value,
|
|
||||||
char *out_string)
|
|
||||||
{
|
{
|
||||||
u32 count;
|
u32 count;
|
||||||
u32 digits_needed;
|
u32 digits_needed;
|
||||||
u32 remainder;
|
u32 remainder;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
digits_needed = acpi_ex_digits_needed(value, 10);
|
||||||
|
|
||||||
|
|
||||||
digits_needed = acpi_ex_digits_needed (value, 10);
|
|
||||||
out_string[digits_needed] = 0;
|
out_string[digits_needed] = 0;
|
||||||
|
|
||||||
for (count = digits_needed; count > 0; count--) {
|
for (count = digits_needed; count > 0; count--) {
|
||||||
(void) acpi_ut_short_divide (value, 10, &value, &remainder);
|
(void)acpi_ut_short_divide(value, 10, &value, &remainder);
|
||||||
out_string[count-1] = (char) ('0' + remainder);\
|
out_string[count - 1] = (char)('0' + remainder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,49 +34,45 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define ACPI_FAN_COMPONENT 0x00200000
|
#define ACPI_FAN_COMPONENT 0x00200000
|
||||||
#define ACPI_FAN_CLASS "fan"
|
#define ACPI_FAN_CLASS "fan"
|
||||||
#define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver"
|
#define ACPI_FAN_DRIVER_NAME "ACPI Fan Driver"
|
||||||
#define ACPI_FAN_FILE_STATE "state"
|
#define ACPI_FAN_FILE_STATE "state"
|
||||||
|
|
||||||
#define _COMPONENT ACPI_FAN_COMPONENT
|
#define _COMPONENT ACPI_FAN_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_fan")
|
ACPI_MODULE_NAME("acpi_fan")
|
||||||
|
|
||||||
MODULE_AUTHOR("Paul Diefenbaugh");
|
MODULE_AUTHOR("Paul Diefenbaugh");
|
||||||
MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME);
|
MODULE_DESCRIPTION(ACPI_FAN_DRIVER_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
static int acpi_fan_add (struct acpi_device *device);
|
static int acpi_fan_add(struct acpi_device *device);
|
||||||
static int acpi_fan_remove (struct acpi_device *device, int type);
|
static int acpi_fan_remove(struct acpi_device *device, int type);
|
||||||
|
|
||||||
static struct acpi_driver acpi_fan_driver = {
|
static struct acpi_driver acpi_fan_driver = {
|
||||||
.name = ACPI_FAN_DRIVER_NAME,
|
.name = ACPI_FAN_DRIVER_NAME,
|
||||||
.class = ACPI_FAN_CLASS,
|
.class = ACPI_FAN_CLASS,
|
||||||
.ids = "PNP0C0B",
|
.ids = "PNP0C0B",
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_fan_add,
|
.add = acpi_fan_add,
|
||||||
.remove = acpi_fan_remove,
|
.remove = acpi_fan_remove,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_fan {
|
struct acpi_fan {
|
||||||
acpi_handle handle;
|
acpi_handle handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
FS Interface (/proc)
|
FS Interface (/proc)
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct proc_dir_entry *acpi_fan_dir;
|
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;
|
struct acpi_fan *fan = seq->private;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_fan_read_state");
|
ACPI_FUNCTION_TRACE("acpi_fan_read_state");
|
||||||
|
|
||||||
@@ -85,7 +81,7 @@ acpi_fan_read_state(struct seq_file *seq, void *offset)
|
|||||||
seq_printf(seq, "status: ERROR\n");
|
seq_printf(seq, "status: ERROR\n");
|
||||||
else
|
else
|
||||||
seq_printf(seq, "status: %s\n",
|
seq_printf(seq, "status: %s\n",
|
||||||
!state?"on":"off");
|
!state ? "on" : "off");
|
||||||
}
|
}
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
@@ -96,13 +92,13 @@ static int acpi_fan_state_open_fs(struct inode *inode, struct file *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t
|
static ssize_t
|
||||||
acpi_fan_write_state(struct file *file, const char __user *buffer,
|
acpi_fan_write_state(struct file *file, const char __user * buffer,
|
||||||
size_t count, loff_t *ppos)
|
size_t count, loff_t * ppos)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct seq_file *m = (struct seq_file *)file->private_data;
|
struct seq_file *m = (struct seq_file *)file->private_data;
|
||||||
struct acpi_fan *fan = (struct acpi_fan *) m->private;
|
struct acpi_fan *fan = (struct acpi_fan *)m->private;
|
||||||
char state_string[12] = {'\0'};
|
char state_string[12] = { '\0' };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_fan_write_state");
|
ACPI_FUNCTION_TRACE("acpi_fan_write_state");
|
||||||
|
|
||||||
@@ -115,7 +111,7 @@ acpi_fan_write_state(struct file *file, const char __user *buffer,
|
|||||||
state_string[count] = '\0';
|
state_string[count] = '\0';
|
||||||
|
|
||||||
result = acpi_bus_set_power(fan->handle,
|
result = acpi_bus_set_power(fan->handle,
|
||||||
simple_strtoul(state_string, NULL, 0));
|
simple_strtoul(state_string, NULL, 0));
|
||||||
if (result)
|
if (result)
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
|
|
||||||
@@ -123,18 +119,17 @@ acpi_fan_write_state(struct file *file, const char __user *buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations acpi_fan_state_ops = {
|
static struct file_operations acpi_fan_state_ops = {
|
||||||
.open = acpi_fan_state_open_fs,
|
.open = acpi_fan_state_open_fs,
|
||||||
.read = seq_read,
|
.read = seq_read,
|
||||||
.write = acpi_fan_write_state,
|
.write = acpi_fan_write_state,
|
||||||
.llseek = seq_lseek,
|
.llseek = seq_lseek,
|
||||||
.release = single_release,
|
.release = single_release,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int acpi_fan_add_fs(struct acpi_device *device)
|
||||||
acpi_fan_add_fs(struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *entry = NULL;
|
struct proc_dir_entry *entry = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
|
ACPI_FUNCTION_TRACE("acpi_fan_add_fs");
|
||||||
|
|
||||||
@@ -143,7 +138,7 @@ acpi_fan_add_fs(struct acpi_device *device)
|
|||||||
|
|
||||||
if (!acpi_device_dir(device)) {
|
if (!acpi_device_dir(device)) {
|
||||||
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
|
||||||
acpi_fan_dir);
|
acpi_fan_dir);
|
||||||
if (!acpi_device_dir(device))
|
if (!acpi_device_dir(device))
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
acpi_device_dir(device)->owner = THIS_MODULE;
|
acpi_device_dir(device)->owner = THIS_MODULE;
|
||||||
@@ -151,11 +146,12 @@ acpi_fan_add_fs(struct acpi_device *device)
|
|||||||
|
|
||||||
/* 'status' [R/W] */
|
/* 'status' [R/W] */
|
||||||
entry = create_proc_entry(ACPI_FAN_FILE_STATE,
|
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)
|
if (!entry)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to create '%s' fs entry\n",
|
"Unable to create '%s' fs entry\n",
|
||||||
ACPI_FAN_FILE_STATE));
|
ACPI_FAN_FILE_STATE));
|
||||||
else {
|
else {
|
||||||
entry->proc_fops = &acpi_fan_state_ops;
|
entry->proc_fops = &acpi_fan_state_ops;
|
||||||
entry->data = acpi_driver_data(device);
|
entry->data = acpi_driver_data(device);
|
||||||
@@ -165,15 +161,12 @@ acpi_fan_add_fs(struct acpi_device *device)
|
|||||||
return_VALUE(0);
|
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");
|
ACPI_FUNCTION_TRACE("acpi_fan_remove_fs");
|
||||||
|
|
||||||
if (acpi_device_dir(device)) {
|
if (acpi_device_dir(device)) {
|
||||||
remove_proc_entry(ACPI_FAN_FILE_STATE,
|
remove_proc_entry(ACPI_FAN_FILE_STATE, acpi_device_dir(device));
|
||||||
acpi_device_dir(device));
|
|
||||||
remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
|
remove_proc_entry(acpi_device_bid(device), acpi_fan_dir);
|
||||||
acpi_device_dir(device) = NULL;
|
acpi_device_dir(device) = NULL;
|
||||||
}
|
}
|
||||||
@@ -181,17 +174,15 @@ acpi_fan_remove_fs(struct acpi_device *device)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
Driver Interface
|
Driver Interface
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static int
|
static int acpi_fan_add(struct acpi_device *device)
|
||||||
acpi_fan_add(struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct acpi_fan *fan = NULL;
|
struct acpi_fan *fan = NULL;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_fan_add");
|
ACPI_FUNCTION_TRACE("acpi_fan_add");
|
||||||
|
|
||||||
@@ -211,7 +202,7 @@ acpi_fan_add(struct acpi_device *device)
|
|||||||
result = acpi_bus_get_power(fan->handle, &state);
|
result = acpi_bus_get_power(fan->handle, &state);
|
||||||
if (result) {
|
if (result) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Error reading power state\n"));
|
"Error reading power state\n"));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,19 +211,17 @@ acpi_fan_add(struct acpi_device *device)
|
|||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
|
||||||
acpi_device_name(device), acpi_device_bid(device),
|
acpi_device_name(device), acpi_device_bid(device),
|
||||||
!device->power.state?"on":"off");
|
!device->power.state ? "on" : "off");
|
||||||
|
|
||||||
end:
|
end:
|
||||||
if (result)
|
if (result)
|
||||||
kfree(fan);
|
kfree(fan);
|
||||||
|
|
||||||
return_VALUE(result);
|
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;
|
struct acpi_fan *fan = NULL;
|
||||||
|
|
||||||
@@ -241,7 +230,7 @@ acpi_fan_remove(struct acpi_device *device, int type)
|
|||||||
if (!device || !acpi_driver_data(device))
|
if (!device || !acpi_driver_data(device))
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
fan = (struct acpi_fan *) acpi_driver_data(device);
|
fan = (struct acpi_fan *)acpi_driver_data(device);
|
||||||
|
|
||||||
acpi_fan_remove_fs(device);
|
acpi_fan_remove_fs(device);
|
||||||
|
|
||||||
@@ -250,9 +239,7 @@ acpi_fan_remove(struct acpi_device *device, int type)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int __init acpi_fan_init(void)
|
||||||
static int __init
|
|
||||||
acpi_fan_init(void)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
@@ -272,9 +259,7 @@ acpi_fan_init(void)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __exit acpi_fan_exit(void)
|
||||||
static void __exit
|
|
||||||
acpi_fan_exit(void)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("acpi_fan_exit");
|
ACPI_FUNCTION_TRACE("acpi_fan_exit");
|
||||||
|
|
||||||
@@ -285,7 +270,5 @@ acpi_fan_exit(void)
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
module_init(acpi_fan_init);
|
module_init(acpi_fan_init);
|
||||||
module_exit(acpi_fan_exit);
|
module_exit(acpi_fan_exit);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ int register_acpi_bus_type(struct acpi_bus_type *type)
|
|||||||
down_write(&bus_type_sem);
|
down_write(&bus_type_sem);
|
||||||
list_add_tail(&type->list, &bus_type_list);
|
list_add_tail(&type->list, &bus_type_list);
|
||||||
up_write(&bus_type_sem);
|
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 0;
|
||||||
}
|
}
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@@ -45,7 +46,8 @@ int unregister_acpi_bus_type(struct acpi_bus_type *type)
|
|||||||
down_write(&bus_type_sem);
|
down_write(&bus_type_sem);
|
||||||
list_del_init(&type->list);
|
list_del_init(&type->list);
|
||||||
up_write(&bus_type_sem);
|
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 0;
|
||||||
}
|
}
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|||||||
@@ -42,13 +42,10 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_HARDWARE
|
#define _COMPONENT ACPI_HARDWARE
|
||||||
ACPI_MODULE_NAME ("hwacpi")
|
ACPI_MODULE_NAME("hwacpi")
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -62,36 +59,30 @@
|
|||||||
* the FADT.
|
* the FADT.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
acpi_status acpi_hw_initialize(void)
|
||||||
acpi_status
|
|
||||||
acpi_hw_initialize (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("hw_initialize");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_initialize");
|
||||||
|
|
||||||
/* We must have the ACPI tables by the time we get here */
|
/* We must have the ACPI tables by the time we get here */
|
||||||
|
|
||||||
if (!acpi_gbl_FADT) {
|
if (!acpi_gbl_FADT) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No FADT is present\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No FADT is present\n"));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check the FADT for valid values */
|
/* Sanity check the FADT for valid values */
|
||||||
|
|
||||||
status = acpi_ut_validate_fadt ();
|
status = acpi_ut_validate_fadt();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_set_mode
|
* FUNCTION: acpi_hw_set_mode
|
||||||
@@ -104,24 +95,21 @@ acpi_hw_initialize (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_hw_set_mode(u32 mode)
|
||||||
acpi_hw_set_mode (
|
|
||||||
u32 mode)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 retry;
|
u32 retry;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_set_mode");
|
||||||
ACPI_FUNCTION_TRACE ("hw_set_mode");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
|
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
|
||||||
* system does not support mode transition.
|
* system does not support mode transition.
|
||||||
*/
|
*/
|
||||||
if (!acpi_gbl_FADT->smi_cmd) {
|
if (!acpi_gbl_FADT->smi_cmd) {
|
||||||
ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n"));
|
ACPI_REPORT_ERROR(("No SMI_CMD in FADT, mode transition failed.\n"));
|
||||||
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -132,9 +120,8 @@ acpi_hw_set_mode (
|
|||||||
* transitions are not supported.
|
* transitions are not supported.
|
||||||
*/
|
*/
|
||||||
if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
|
if (!acpi_gbl_FADT->acpi_enable && !acpi_gbl_FADT->acpi_disable) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("No ACPI mode transition supported in this system (enable/disable both zero)\n"));
|
||||||
"No ACPI mode transition supported in this system (enable/disable both zero)\n"));
|
return_ACPI_STATUS(AE_OK);
|
||||||
return_ACPI_STATUS (AE_OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
@@ -142,9 +129,11 @@ acpi_hw_set_mode (
|
|||||||
|
|
||||||
/* BIOS should have disabled ALL fixed and GP events */
|
/* BIOS should have disabled ALL fixed and GP events */
|
||||||
|
|
||||||
status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
|
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||||
(u32) acpi_gbl_FADT->acpi_enable, 8);
|
(u32) acpi_gbl_FADT->acpi_enable,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
|
8);
|
||||||
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
|
"Attempting to enable ACPI mode\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_SYS_MODE_LEGACY:
|
case ACPI_SYS_MODE_LEGACY:
|
||||||
@@ -153,20 +142,21 @@ acpi_hw_set_mode (
|
|||||||
* BIOS should clear all fixed status bits and restore fixed event
|
* BIOS should clear all fixed status bits and restore fixed event
|
||||||
* enable bits to default
|
* enable bits to default
|
||||||
*/
|
*/
|
||||||
status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
|
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||||
(u32) acpi_gbl_FADT->acpi_disable, 8);
|
(u32) acpi_gbl_FADT->acpi_disable,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
8);
|
||||||
"Attempting to enable Legacy (non-ACPI) mode\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
|
"Attempting to enable Legacy (non-ACPI) mode\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_REPORT_ERROR (("Could not write mode change, %s\n",
|
ACPI_REPORT_ERROR(("Could not write mode change, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -176,19 +166,19 @@ acpi_hw_set_mode (
|
|||||||
retry = 3000;
|
retry = 3000;
|
||||||
while (retry) {
|
while (retry) {
|
||||||
if (acpi_hw_get_mode() == mode) {
|
if (acpi_hw_get_mode() == mode) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
mode));
|
"Mode %X successfully enabled\n",
|
||||||
return_ACPI_STATUS (AE_OK);
|
mode));
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
acpi_os_stall(1000);
|
acpi_os_stall(1000);
|
||||||
retry--;
|
retry--;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Hardware never changed modes\n"));
|
ACPI_REPORT_ERROR(("Hardware never changed modes\n"));
|
||||||
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
|
return_ACPI_STATUS(AE_NO_HARDWARE_RESPONSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_get_mode
|
* FUNCTION: acpi_hw_get_mode
|
||||||
@@ -202,34 +192,30 @@ acpi_hw_set_mode (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32 acpi_hw_get_mode(void)
|
||||||
acpi_hw_get_mode (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 value;
|
u32 value;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("hw_get_mode");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_get_mode");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
|
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
|
||||||
* system does not support mode transition.
|
* system does not support mode transition.
|
||||||
*/
|
*/
|
||||||
if (!acpi_gbl_FADT->smi_cmd) {
|
if (!acpi_gbl_FADT->smi_cmd) {
|
||||||
return_VALUE (ACPI_SYS_MODE_ACPI);
|
return_VALUE(ACPI_SYS_MODE_ACPI);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_get_register (ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_get_register(ACPI_BITREG_SCI_ENABLE, &value, ACPI_MTX_LOCK);
|
||||||
return_VALUE (ACPI_SYS_MODE_LEGACY);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_VALUE(ACPI_SYS_MODE_LEGACY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
return_VALUE (ACPI_SYS_MODE_ACPI);
|
return_VALUE(ACPI_SYS_MODE_ACPI);
|
||||||
}
|
} else {
|
||||||
else {
|
return_VALUE(ACPI_SYS_MODE_LEGACY);
|
||||||
return_VALUE (ACPI_SYS_MODE_LEGACY);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,15 +46,12 @@
|
|||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_HARDWARE
|
#define _COMPONENT ACPI_HARDWARE
|
||||||
ACPI_MODULE_NAME ("hwgpe")
|
ACPI_MODULE_NAME("hwgpe")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_hw_enable_wakeup_gpe_block (
|
acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
struct acpi_gpe_block_info *gpe_block);
|
||||||
struct acpi_gpe_block_info *gpe_block);
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -71,15 +68,12 @@ acpi_hw_enable_wakeup_gpe_block (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_write_gpe_enable_reg (
|
acpi_hw_write_gpe_enable_reg(struct acpi_gpe_event_info *gpe_event_info)
|
||||||
struct acpi_gpe_event_info *gpe_event_info)
|
|
||||||
{
|
{
|
||||||
struct acpi_gpe_register_info *gpe_register_info;
|
struct acpi_gpe_register_info *gpe_register_info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* Get the info block for the entire GPE register */
|
/* Get the info block for the entire GPE register */
|
||||||
|
|
||||||
@@ -90,13 +84,12 @@ acpi_hw_write_gpe_enable_reg (
|
|||||||
|
|
||||||
/* Write the entire GPE (runtime) enable register */
|
/* Write the entire GPE (runtime) enable register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_write (8, gpe_register_info->enable_for_run,
|
status = acpi_hw_low_level_write(8, gpe_register_info->enable_for_run,
|
||||||
&gpe_register_info->enable_address);
|
&gpe_register_info->enable_address);
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_clear_gpe
|
* FUNCTION: acpi_hw_clear_gpe
|
||||||
@@ -109,27 +102,23 @@ acpi_hw_write_gpe_enable_reg (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info)
|
||||||
acpi_hw_clear_gpe (
|
|
||||||
struct acpi_gpe_event_info *gpe_event_info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a one to the appropriate bit in the status register to
|
* Write a one to the appropriate bit in the status register to
|
||||||
* clear this GPE.
|
* clear this GPE.
|
||||||
*/
|
*/
|
||||||
status = acpi_hw_low_level_write (8, gpe_event_info->register_bit,
|
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);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_get_gpe_status
|
* FUNCTION: acpi_hw_get_gpe_status
|
||||||
@@ -145,19 +134,16 @@ acpi_hw_clear_gpe (
|
|||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_get_gpe_status (
|
acpi_hw_get_gpe_status(struct acpi_gpe_event_info * gpe_event_info,
|
||||||
struct acpi_gpe_event_info *gpe_event_info,
|
acpi_event_status * event_status)
|
||||||
acpi_event_status *event_status)
|
|
||||||
{
|
{
|
||||||
u32 in_byte;
|
u32 in_byte;
|
||||||
u8 register_bit;
|
u8 register_bit;
|
||||||
struct acpi_gpe_register_info *gpe_register_info;
|
struct acpi_gpe_register_info *gpe_register_info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_event_status local_event_status = 0;
|
acpi_event_status local_event_status = 0;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
if (!event_status) {
|
if (!event_status) {
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
@@ -185,8 +171,10 @@ acpi_hw_get_gpe_status (
|
|||||||
|
|
||||||
/* GPE currently active (status bit == 1)? */
|
/* GPE currently active (status bit == 1)? */
|
||||||
|
|
||||||
status = acpi_hw_low_level_read (8, &in_byte, &gpe_register_info->status_address);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_hw_low_level_read(8, &in_byte,
|
||||||
|
&gpe_register_info->status_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,12 +186,10 @@ acpi_hw_get_gpe_status (
|
|||||||
|
|
||||||
(*event_status) = local_event_status;
|
(*event_status) = local_event_status;
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -219,22 +205,21 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_disable_gpe_block (
|
acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
struct acpi_gpe_block_info * gpe_block)
|
||||||
struct acpi_gpe_block_info *gpe_block)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Examine each GPE Register within the block */
|
/* Examine each GPE Register within the block */
|
||||||
|
|
||||||
for (i = 0; i < gpe_block->register_count; i++) {
|
for (i = 0; i < gpe_block->register_count; i++) {
|
||||||
/* Disable all GPEs in this register */
|
/* Disable all GPEs in this register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_write (8, 0x00,
|
status = acpi_hw_low_level_write(8, 0x00,
|
||||||
&gpe_block->register_info[i].enable_address);
|
&gpe_block->register_info[i].
|
||||||
if (ACPI_FAILURE (status)) {
|
enable_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,7 +227,6 @@ acpi_hw_disable_gpe_block (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_clear_gpe_block
|
* FUNCTION: acpi_hw_clear_gpe_block
|
||||||
@@ -257,22 +241,21 @@ acpi_hw_disable_gpe_block (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_clear_gpe_block (
|
acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
struct acpi_gpe_block_info * gpe_block)
|
||||||
struct acpi_gpe_block_info *gpe_block)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Examine each GPE Register within the block */
|
/* Examine each GPE Register within the block */
|
||||||
|
|
||||||
for (i = 0; i < gpe_block->register_count; i++) {
|
for (i = 0; i < gpe_block->register_count; i++) {
|
||||||
/* Clear status on all GPEs in this register */
|
/* Clear status on all GPEs in this register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_write (8, 0xFF,
|
status = acpi_hw_low_level_write(8, 0xFF,
|
||||||
&gpe_block->register_info[i].status_address);
|
&gpe_block->register_info[i].
|
||||||
if (ACPI_FAILURE (status)) {
|
status_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,7 +263,6 @@ acpi_hw_clear_gpe_block (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_enable_runtime_gpe_block
|
* FUNCTION: acpi_hw_enable_runtime_gpe_block
|
||||||
@@ -296,13 +278,11 @@ acpi_hw_clear_gpe_block (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_enable_runtime_gpe_block (
|
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info * gpe_xrupt_info,
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
struct acpi_gpe_block_info * gpe_block)
|
||||||
struct acpi_gpe_block_info *gpe_block)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* NOTE: assumes that all GPEs are currently disabled */
|
/* NOTE: assumes that all GPEs are currently disabled */
|
||||||
|
|
||||||
@@ -315,9 +295,13 @@ acpi_hw_enable_runtime_gpe_block (
|
|||||||
|
|
||||||
/* Enable all "runtime" GPEs in this register */
|
/* Enable all "runtime" GPEs in this register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_write (8, gpe_block->register_info[i].enable_for_run,
|
status =
|
||||||
&gpe_block->register_info[i].enable_address);
|
acpi_hw_low_level_write(8,
|
||||||
if (ACPI_FAILURE (status)) {
|
gpe_block->register_info[i].
|
||||||
|
enable_for_run,
|
||||||
|
&gpe_block->register_info[i].
|
||||||
|
enable_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,7 +309,6 @@ acpi_hw_enable_runtime_gpe_block (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_enable_wakeup_gpe_block
|
* FUNCTION: acpi_hw_enable_wakeup_gpe_block
|
||||||
@@ -341,13 +324,11 @@ acpi_hw_enable_runtime_gpe_block (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_hw_enable_wakeup_gpe_block (
|
acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
||||||
struct acpi_gpe_xrupt_info *gpe_xrupt_info,
|
struct acpi_gpe_block_info *gpe_block)
|
||||||
struct acpi_gpe_block_info *gpe_block)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Examine each GPE Register within the block */
|
/* Examine each GPE Register within the block */
|
||||||
|
|
||||||
@@ -358,10 +339,12 @@ acpi_hw_enable_wakeup_gpe_block (
|
|||||||
|
|
||||||
/* Enable all "wake" GPEs in this register */
|
/* Enable all "wake" GPEs in this register */
|
||||||
|
|
||||||
status = acpi_hw_low_level_write (8,
|
status = acpi_hw_low_level_write(8,
|
||||||
gpe_block->register_info[i].enable_for_wake,
|
gpe_block->register_info[i].
|
||||||
&gpe_block->register_info[i].enable_address);
|
enable_for_wake,
|
||||||
if (ACPI_FAILURE (status)) {
|
&gpe_block->register_info[i].
|
||||||
|
enable_address);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,7 +352,6 @@ acpi_hw_enable_wakeup_gpe_block (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_disable_all_gpes
|
* FUNCTION: acpi_hw_disable_all_gpes
|
||||||
@@ -382,22 +364,17 @@ acpi_hw_enable_wakeup_gpe_block (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_hw_disable_all_gpes(void)
|
||||||
acpi_hw_disable_all_gpes (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_disable_all_gpes");
|
||||||
|
|
||||||
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);
|
||||||
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
|
* FUNCTION: acpi_hw_enable_all_runtime_gpes
|
||||||
@@ -410,21 +387,16 @@ acpi_hw_disable_all_gpes (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_hw_enable_all_runtime_gpes(void)
|
||||||
acpi_hw_enable_all_runtime_gpes (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_enable_all_runtime_gpes");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("hw_enable_all_runtime_gpes");
|
status = acpi_ev_walk_gpe_list(acpi_hw_enable_runtime_gpe_block);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
status = acpi_ev_walk_gpe_list (acpi_hw_enable_runtime_gpe_block);
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_enable_all_wakeup_gpes
|
* FUNCTION: acpi_hw_enable_all_wakeup_gpes
|
||||||
@@ -437,17 +409,12 @@ acpi_hw_enable_all_runtime_gpes (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_hw_enable_all_wakeup_gpes(void)
|
||||||
acpi_hw_enable_all_wakeup_gpes (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_enable_all_wakeup_gpes");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("hw_enable_all_wakeup_gpes");
|
status = acpi_ev_walk_gpe_list(acpi_hw_enable_wakeup_gpe_block);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
status = acpi_ev_walk_gpe_list (acpi_hw_enable_wakeup_gpe_block);
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,7 @@
|
|||||||
#include <acpi/acevents.h>
|
#include <acpi/acevents.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_HARDWARE
|
#define _COMPONENT ACPI_HARDWARE
|
||||||
ACPI_MODULE_NAME ("hwregs")
|
ACPI_MODULE_NAME("hwregs")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -65,57 +64,52 @@
|
|||||||
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
|
* 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_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_clear_acpi_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));
|
||||||
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));
|
|
||||||
|
|
||||||
if (flags & ACPI_MTX_LOCK) {
|
if (flags & ACPI_MTX_LOCK) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1_STATUS,
|
ACPI_REGISTER_PM1_STATUS,
|
||||||
ACPI_BITMASK_ALL_FIXED_STATUS);
|
ACPI_BITMASK_ALL_FIXED_STATUS);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the fixed events */
|
/* Clear the fixed events */
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
|
if (acpi_gbl_FADT->xpm1b_evt_blk.address) {
|
||||||
status = acpi_hw_low_level_write (16, ACPI_BITMASK_ALL_FIXED_STATUS,
|
status =
|
||||||
&acpi_gbl_FADT->xpm1b_evt_blk);
|
acpi_hw_low_level_write(16, ACPI_BITMASK_ALL_FIXED_STATUS,
|
||||||
if (ACPI_FAILURE (status)) {
|
&acpi_gbl_FADT->xpm1b_evt_blk);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
|
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
|
||||||
|
|
||||||
status = acpi_ev_walk_gpe_list (acpi_hw_clear_gpe_block);
|
status = acpi_ev_walk_gpe_list(acpi_hw_clear_gpe_block);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (flags & ACPI_MTX_LOCK) {
|
if (flags & ACPI_MTX_LOCK) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_sleep_type_data
|
* FUNCTION: acpi_get_sleep_type_data
|
||||||
@@ -132,53 +126,48 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_sleep_type_data (
|
acpi_get_sleep_type_data(u8 sleep_state, u8 * sleep_type_a, u8 * sleep_type_b)
|
||||||
u8 sleep_state,
|
|
||||||
u8 *sleep_type_a,
|
|
||||||
u8 *sleep_type_b)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_parameter_info info;
|
struct acpi_parameter_info info;
|
||||||
char *sleep_state_name;
|
char *sleep_state_name;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_sleep_type_data");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_sleep_type_data");
|
||||||
|
|
||||||
/* Validate parameters */
|
/* Validate parameters */
|
||||||
|
|
||||||
if ((sleep_state > ACPI_S_STATES_MAX) ||
|
if ((sleep_state > ACPI_S_STATES_MAX) || !sleep_type_a || !sleep_type_b) {
|
||||||
!sleep_type_a || !sleep_type_b) {
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Evaluate the namespace object containing the values for this state */
|
/* Evaluate the namespace object containing the values for this state */
|
||||||
|
|
||||||
info.parameters = NULL;
|
info.parameters = NULL;
|
||||||
info.return_object = NULL;
|
info.return_object = NULL;
|
||||||
sleep_state_name = (char *) acpi_gbl_sleep_state_names[sleep_state];
|
sleep_state_name = (char *)acpi_gbl_sleep_state_names[sleep_state];
|
||||||
|
|
||||||
status = acpi_ns_evaluate_by_name (sleep_state_name, &info);
|
status = acpi_ns_evaluate_by_name(sleep_state_name, &info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"%s while evaluating sleep_state [%s]\n",
|
"%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);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must have a return object */
|
/* Must have a return object */
|
||||||
|
|
||||||
if (!info.return_object) {
|
if (!info.return_object) {
|
||||||
ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
|
ACPI_REPORT_ERROR(("No Sleep State object returned from [%s]\n",
|
||||||
sleep_state_name));
|
sleep_state_name));
|
||||||
status = AE_NOT_EXIST;
|
status = AE_NOT_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It must be of type Package */
|
/* It must be of type Package */
|
||||||
|
|
||||||
else if (ACPI_GET_OBJECT_TYPE (info.return_object) != ACPI_TYPE_PACKAGE) {
|
else if (ACPI_GET_OBJECT_TYPE(info.return_object) != ACPI_TYPE_PACKAGE) {
|
||||||
ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
|
ACPI_REPORT_ERROR(("Sleep State return object is not a Package\n"));
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,45 +179,41 @@ acpi_get_sleep_type_data (
|
|||||||
* one per sleep type (A/B).
|
* one per sleep type (A/B).
|
||||||
*/
|
*/
|
||||||
else if (info.return_object->package.count < 2) {
|
else if (info.return_object->package.count < 2) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("Sleep State return package does not have at least two elements\n"));
|
||||||
"Sleep State return package does not have at least two elements\n"));
|
|
||||||
status = AE_AML_NO_OPERAND;
|
status = AE_AML_NO_OPERAND;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The first two elements must both be of type Integer */
|
/* The first two elements must both be of type Integer */
|
||||||
|
|
||||||
else if ((ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[0])
|
else if ((ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[0])
|
||||||
!= ACPI_TYPE_INTEGER) ||
|
!= ACPI_TYPE_INTEGER) ||
|
||||||
(ACPI_GET_OBJECT_TYPE (info.return_object->package.elements[1])
|
(ACPI_GET_OBJECT_TYPE(info.return_object->package.elements[1])
|
||||||
!= ACPI_TYPE_INTEGER)) {
|
!= ACPI_TYPE_INTEGER)) {
|
||||||
ACPI_REPORT_ERROR ((
|
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])));
|
||||||
"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;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Valid _Sx_ package size, type, and value */
|
/* Valid _Sx_ package size, type, and value */
|
||||||
|
|
||||||
*sleep_type_a = (u8)
|
*sleep_type_a = (u8)
|
||||||
(info.return_object->package.elements[0])->integer.value;
|
(info.return_object->package.elements[0])->integer.value;
|
||||||
*sleep_type_b = (u8)
|
*sleep_type_b = (u8)
|
||||||
(info.return_object->package.elements[1])->integer.value;
|
(info.return_object->package.elements[1])->integer.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
|
"%s While evaluating sleep_state [%s], bad Sleep object %p type %s\n",
|
||||||
acpi_format_exception (status),
|
acpi_format_exception(status),
|
||||||
sleep_state_name, info.return_object,
|
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);
|
acpi_ut_remove_reference(info.return_object);
|
||||||
return_ACPI_STATUS (status);
|
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 *
|
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id)
|
||||||
acpi_hw_get_bit_register_info (
|
|
||||||
u32 register_id)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_NAME ("hw_get_bit_register_info");
|
ACPI_FUNCTION_NAME("hw_get_bit_register_info");
|
||||||
|
|
||||||
|
|
||||||
if (register_id > ACPI_BITREG_MAX) {
|
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 (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (&acpi_gbl_bit_register_info[register_id]);
|
return (&acpi_gbl_bit_register_info[register_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_register
|
* FUNCTION: acpi_get_register
|
||||||
@@ -273,59 +256,56 @@ acpi_hw_get_bit_register_info (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_get_register(u32 register_id, u32 * return_value, u32 flags)
|
||||||
acpi_get_register (
|
|
||||||
u32 register_id,
|
|
||||||
u32 *return_value,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
u32 register_value = 0;
|
u32 register_value = 0;
|
||||||
struct acpi_bit_register_info *bit_reg_info;
|
struct acpi_bit_register_info *bit_reg_info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_register");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_register");
|
||||||
|
|
||||||
/* Get the info structure corresponding to the requested ACPI Register */
|
/* Get the info structure corresponding to the requested ACPI Register */
|
||||||
|
|
||||||
bit_reg_info = acpi_hw_get_bit_register_info (register_id);
|
bit_reg_info = acpi_hw_get_bit_register_info(register_id);
|
||||||
if (!bit_reg_info) {
|
if (!bit_reg_info) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & ACPI_MTX_LOCK) {
|
if (flags & ACPI_MTX_LOCK) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read from the register */
|
/* Read from the register */
|
||||||
|
|
||||||
status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
bit_reg_info->parent_register, ®ister_value);
|
bit_reg_info->parent_register,
|
||||||
|
®ister_value);
|
||||||
|
|
||||||
if (flags & ACPI_MTX_LOCK) {
|
if (flags & ACPI_MTX_LOCK) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/* Normalize the value that was read */
|
/* Normalize the value that was read */
|
||||||
|
|
||||||
register_value = ((register_value & bit_reg_info->access_bit_mask)
|
register_value =
|
||||||
>> bit_reg_info->bit_position);
|
((register_value & bit_reg_info->access_bit_mask)
|
||||||
|
>> bit_reg_info->bit_position);
|
||||||
|
|
||||||
*return_value = register_value;
|
*return_value = register_value;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
|
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);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_register);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_register);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -342,40 +322,36 @@ EXPORT_SYMBOL(acpi_get_register);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_set_register(u32 register_id, u32 value, u32 flags)
|
||||||
acpi_set_register (
|
|
||||||
u32 register_id,
|
|
||||||
u32 value,
|
|
||||||
u32 flags)
|
|
||||||
{
|
{
|
||||||
u32 register_value = 0;
|
u32 register_value = 0;
|
||||||
struct acpi_bit_register_info *bit_reg_info;
|
struct acpi_bit_register_info *bit_reg_info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_U32 ("acpi_set_register", register_id);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_U32("acpi_set_register", register_id);
|
||||||
|
|
||||||
/* Get the info structure corresponding to the requested ACPI Register */
|
/* Get the info structure corresponding to the requested ACPI Register */
|
||||||
|
|
||||||
bit_reg_info = acpi_hw_get_bit_register_info (register_id);
|
bit_reg_info = acpi_hw_get_bit_register_info(register_id);
|
||||||
if (!bit_reg_info) {
|
if (!bit_reg_info) {
|
||||||
ACPI_REPORT_ERROR (("Bad ACPI HW register_id: %X\n", register_id));
|
ACPI_REPORT_ERROR(("Bad ACPI HW register_id: %X\n",
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
register_id));
|
||||||
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & ACPI_MTX_LOCK) {
|
if (flags & ACPI_MTX_LOCK) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always do a register read first so we can insert the new bits */
|
/* Always do a register read first so we can insert the new bits */
|
||||||
|
|
||||||
status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
bit_reg_info->parent_register, ®ister_value);
|
bit_reg_info->parent_register,
|
||||||
if (ACPI_FAILURE (status)) {
|
®ister_value);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,26 +371,30 @@ acpi_set_register (
|
|||||||
* information is the single bit we're interested in, all others should
|
* information is the single bit we're interested in, all others should
|
||||||
* be written as 0 so they will be left unchanged.
|
* be written as 0 so they will be left unchanged.
|
||||||
*/
|
*/
|
||||||
value = ACPI_REGISTER_PREPARE_BITS (value,
|
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) {
|
if (value) {
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
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;
|
register_value = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_REGISTER_PM1_ENABLE:
|
case ACPI_REGISTER_PM1_ENABLE:
|
||||||
|
|
||||||
ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
|
ACPI_REGISTER_INSERT_VALUE(register_value,
|
||||||
bit_reg_info->access_bit_mask, value);
|
bit_reg_info->bit_position,
|
||||||
|
bit_reg_info->access_bit_mask,
|
||||||
|
value);
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_REGISTER_PM1_CONTROL:
|
case ACPI_REGISTER_PM1_CONTROL:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -422,65 +402,73 @@ acpi_set_register (
|
|||||||
* Note that at this level, the fact that there are actually TWO
|
* Note that at this level, the fact that there are actually TWO
|
||||||
* registers (A and B - and B may not exist) is abstracted.
|
* 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,
|
ACPI_REGISTER_INSERT_VALUE(register_value,
|
||||||
bit_reg_info->access_bit_mask, value);
|
bit_reg_info->bit_position,
|
||||||
|
bit_reg_info->access_bit_mask,
|
||||||
|
value);
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_REGISTER_PM2_CONTROL:
|
case ACPI_REGISTER_PM2_CONTROL:
|
||||||
|
|
||||||
status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM2_CONTROL, ®ister_value);
|
ACPI_REGISTER_PM2_CONTROL,
|
||||||
if (ACPI_FAILURE (status)) {
|
®ister_value);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
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,
|
||||||
register_value,
|
"PM2 control: Read %X from %8.8X%8.8X\n",
|
||||||
ACPI_FORMAT_UINT64 (
|
register_value,
|
||||||
acpi_gbl_FADT->xpm2_cnt_blk.address)));
|
ACPI_FORMAT_UINT64(acpi_gbl_FADT->
|
||||||
|
xpm2_cnt_blk.address)));
|
||||||
|
|
||||||
ACPI_REGISTER_INSERT_VALUE (register_value, bit_reg_info->bit_position,
|
ACPI_REGISTER_INSERT_VALUE(register_value,
|
||||||
bit_reg_info->access_bit_mask, 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,
|
||||||
register_value,
|
"About to write %4.4X to %8.8X%8.8X\n",
|
||||||
ACPI_FORMAT_UINT64 (
|
register_value,
|
||||||
acpi_gbl_FADT->xpm2_cnt_blk.address)));
|
ACPI_FORMAT_UINT64(acpi_gbl_FADT->
|
||||||
|
xpm2_cnt_blk.address)));
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM2_CONTROL, (u8) (register_value));
|
ACPI_REGISTER_PM2_CONTROL,
|
||||||
|
(u8) (register_value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
|
||||||
|
|
||||||
if (flags & ACPI_MTX_LOCK) {
|
if (flags & ACPI_MTX_LOCK) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normalize the value that was read */
|
/* Normalize the value that was read */
|
||||||
|
|
||||||
ACPI_DEBUG_EXEC (register_value =
|
ACPI_DEBUG_EXEC(register_value =
|
||||||
((register_value & bit_reg_info->access_bit_mask) >>
|
((register_value & bit_reg_info->access_bit_mask) >>
|
||||||
bit_reg_info->bit_position));
|
bit_reg_info->bit_position));
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||||
value, register_value, bit_reg_info->parent_register));
|
"Set bits: %8.8X actual %8.8X register %X\n", value,
|
||||||
return_ACPI_STATUS (status);
|
register_value, bit_reg_info->parent_register));
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_set_register);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_set_register);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -498,103 +486,107 @@ EXPORT_SYMBOL(acpi_set_register);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_register_read (
|
acpi_hw_register_read(u8 use_lock, u32 register_id, u32 * return_value)
|
||||||
u8 use_lock,
|
|
||||||
u32 register_id,
|
|
||||||
u32 *return_value)
|
|
||||||
{
|
{
|
||||||
u32 value1 = 0;
|
u32 value1 = 0;
|
||||||
u32 value2 = 0;
|
u32 value2 = 0;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("hw_register_read");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_register_read");
|
||||||
|
|
||||||
if (ACPI_MTX_LOCK == use_lock) {
|
if (ACPI_MTX_LOCK == use_lock) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (register_id) {
|
switch (register_id) {
|
||||||
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
|
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
|
||||||
|
|
||||||
status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_evt_blk);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_hw_low_level_read(16, &value1,
|
||||||
|
&acpi_gbl_FADT->xpm1a_evt_blk);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PM1B is optional */
|
/* 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;
|
value1 |= value2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
|
||||||
|
|
||||||
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)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PM1B is optional */
|
/* 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;
|
value1 |= value2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_read(16, &value1,
|
||||||
status = acpi_hw_low_level_read (16, &value1, &acpi_gbl_FADT->xpm1a_cnt_blk);
|
&acpi_gbl_FADT->xpm1a_cnt_blk);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
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;
|
value1 |= value2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_read(8, &value1,
|
||||||
status = acpi_hw_low_level_read (8, &value1, &acpi_gbl_FADT->xpm2_cnt_blk);
|
&acpi_gbl_FADT->xpm2_cnt_blk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_read(32, &value1,
|
||||||
status = acpi_hw_low_level_read (32, &value1, &acpi_gbl_FADT->xpm_tmr_blk);
|
&acpi_gbl_FADT->xpm_tmr_blk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
|
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
|
||||||
|
|
||||||
status = acpi_os_read_port (acpi_gbl_FADT->smi_cmd, &value1, 8);
|
status = acpi_os_read_port(acpi_gbl_FADT->smi_cmd, &value1, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
|
||||||
register_id));
|
register_id));
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (ACPI_MTX_LOCK == use_lock) {
|
if (ACPI_MTX_LOCK == use_lock) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
*return_value = value1;
|
*return_value = value1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_register_write
|
* FUNCTION: acpi_hw_register_write
|
||||||
@@ -610,109 +602,112 @@ unlock_and_exit:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_hw_register_write(u8 use_lock, u32 register_id, u32 value)
|
||||||
acpi_hw_register_write (
|
|
||||||
u8 use_lock,
|
|
||||||
u32 register_id,
|
|
||||||
u32 value)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("hw_register_write");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("hw_register_write");
|
||||||
|
|
||||||
if (ACPI_MTX_LOCK == use_lock) {
|
if (ACPI_MTX_LOCK == use_lock) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_HARDWARE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_HARDWARE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (register_id) {
|
switch (register_id) {
|
||||||
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
|
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
|
||||||
|
|
||||||
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_evt_blk);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_hw_low_level_write(16, value,
|
||||||
|
&acpi_gbl_FADT->xpm1a_evt_blk);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PM1B is optional */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
|
||||||
|
|
||||||
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)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PM1B is optional */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_write(16, value,
|
||||||
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
|
&acpi_gbl_FADT->xpm1a_cnt_blk);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
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;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_write(16, value,
|
||||||
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1a_cnt_blk);
|
&acpi_gbl_FADT->xpm1a_cnt_blk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_write(16, value,
|
||||||
status = acpi_hw_low_level_write (16, value, &acpi_gbl_FADT->xpm1b_cnt_blk);
|
&acpi_gbl_FADT->xpm1b_cnt_blk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_write(8, value,
|
||||||
status = acpi_hw_low_level_write (8, value, &acpi_gbl_FADT->xpm2_cnt_blk);
|
&acpi_gbl_FADT->xpm2_cnt_blk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
|
||||||
|
|
||||||
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
|
status =
|
||||||
|
acpi_hw_low_level_write(32, value,
|
||||||
status = acpi_hw_low_level_write (32, value, &acpi_gbl_FADT->xpm_tmr_blk);
|
&acpi_gbl_FADT->xpm_tmr_blk);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
|
||||||
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
|
|
||||||
|
|
||||||
/* SMI_CMD is currently always in IO space */
|
/* SMI_CMD is currently always in IO space */
|
||||||
|
|
||||||
status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd, value, 8);
|
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd, value, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
if (ACPI_MTX_LOCK == use_lock) {
|
if (ACPI_MTX_LOCK == use_lock) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_HARDWARE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_HARDWARE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_low_level_read
|
* FUNCTION: acpi_hw_low_level_read
|
||||||
@@ -728,17 +723,12 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_low_level_read (
|
acpi_hw_low_level_read(u32 width, u32 * value, struct acpi_generic_address *reg)
|
||||||
u32 width,
|
|
||||||
u32 *value,
|
|
||||||
struct acpi_generic_address *reg)
|
|
||||||
{
|
{
|
||||||
u64 address;
|
u64 address;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("hw_low_level_read");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("hw_low_level_read");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must have a valid pointer to a GAS structure, and
|
* Must have a valid pointer to a GAS structure, and
|
||||||
@@ -751,7 +741,7 @@ acpi_hw_low_level_read (
|
|||||||
|
|
||||||
/* Get a local copy of the address. Handles possible alignment issues */
|
/* Get a local copy of the address. Handles possible alignment issues */
|
||||||
|
|
||||||
ACPI_MOVE_64_TO_64 (&address, ®->address);
|
ACPI_MOVE_64_TO_64(&address, ®->address);
|
||||||
if (!address) {
|
if (!address) {
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
@@ -764,35 +754,32 @@ acpi_hw_low_level_read (
|
|||||||
switch (reg->address_space_id) {
|
switch (reg->address_space_id) {
|
||||||
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
||||||
|
|
||||||
status = acpi_os_read_memory (
|
status = acpi_os_read_memory((acpi_physical_address) address,
|
||||||
(acpi_physical_address) address,
|
value, width);
|
||||||
value, width);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_ADR_SPACE_SYSTEM_IO:
|
case ACPI_ADR_SPACE_SYSTEM_IO:
|
||||||
|
|
||||||
status = acpi_os_read_port ((acpi_io_address) address,
|
status = acpi_os_read_port((acpi_io_address) address,
|
||||||
value, width);
|
value, width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
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);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
|
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||||
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
|
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
|
||||||
*value, width,
|
*value, width,
|
||||||
ACPI_FORMAT_UINT64 (address),
|
ACPI_FORMAT_UINT64(address),
|
||||||
acpi_ut_get_region_name (reg->address_space_id)));
|
acpi_ut_get_region_name(reg->address_space_id)));
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_hw_low_level_write
|
* FUNCTION: acpi_hw_low_level_write
|
||||||
@@ -808,17 +795,12 @@ acpi_hw_low_level_read (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_hw_low_level_write (
|
acpi_hw_low_level_write(u32 width, u32 value, struct acpi_generic_address * reg)
|
||||||
u32 width,
|
|
||||||
u32 value,
|
|
||||||
struct acpi_generic_address *reg)
|
|
||||||
{
|
{
|
||||||
u64 address;
|
u64 address;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("hw_low_level_write");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("hw_low_level_write");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must have a valid pointer to a GAS structure, and
|
* Must have a valid pointer to a GAS structure, and
|
||||||
@@ -831,7 +813,7 @@ acpi_hw_low_level_write (
|
|||||||
|
|
||||||
/* Get a local copy of the address. Handles possible alignment issues */
|
/* Get a local copy of the address. Handles possible alignment issues */
|
||||||
|
|
||||||
ACPI_MOVE_64_TO_64 (&address, ®->address);
|
ACPI_MOVE_64_TO_64(&address, ®->address);
|
||||||
if (!address) {
|
if (!address) {
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
@@ -843,30 +825,28 @@ acpi_hw_low_level_write (
|
|||||||
switch (reg->address_space_id) {
|
switch (reg->address_space_id) {
|
||||||
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
|
||||||
|
|
||||||
status = acpi_os_write_memory (
|
status = acpi_os_write_memory((acpi_physical_address) address,
|
||||||
(acpi_physical_address) address,
|
value, width);
|
||||||
value, width);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_ADR_SPACE_SYSTEM_IO:
|
case ACPI_ADR_SPACE_SYSTEM_IO:
|
||||||
|
|
||||||
status = acpi_os_write_port ((acpi_io_address) address,
|
status = acpi_os_write_port((acpi_io_address) address,
|
||||||
value, width);
|
value, width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
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);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
|
ACPI_DEBUG_PRINT((ACPI_DB_IO,
|
||||||
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
|
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
|
||||||
value, width,
|
value, width,
|
||||||
ACPI_FORMAT_UINT64 (address),
|
ACPI_FORMAT_UINT64(address),
|
||||||
acpi_ut_get_region_name (reg->address_space_id)));
|
acpi_ut_get_region_name(reg->address_space_id)));
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,7 @@
|
|||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_HARDWARE
|
#define _COMPONENT ACPI_HARDWARE
|
||||||
ACPI_MODULE_NAME ("hwsleep")
|
ACPI_MODULE_NAME("hwsleep")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -61,30 +60,25 @@
|
|||||||
* DESCRIPTION: Access function for the firmware_waking_vector field in FACS
|
* DESCRIPTION: Access function for the firmware_waking_vector field in FACS
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_set_firmware_waking_vector (
|
acpi_set_firmware_waking_vector(acpi_physical_address physical_address)
|
||||||
acpi_physical_address physical_address)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_set_firmware_waking_vector");
|
ACPI_FUNCTION_TRACE("acpi_set_firmware_waking_vector");
|
||||||
|
|
||||||
|
|
||||||
/* Set the vector */
|
/* Set the vector */
|
||||||
|
|
||||||
if (acpi_gbl_common_fACS.vector_width == 32) {
|
if (acpi_gbl_common_fACS.vector_width == 32) {
|
||||||
*(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector))
|
*(ACPI_CAST_PTR
|
||||||
= (u32) physical_address;
|
(u32, acpi_gbl_common_fACS.firmware_waking_vector))
|
||||||
}
|
= (u32) physical_address;
|
||||||
else {
|
} else {
|
||||||
*acpi_gbl_common_fACS.firmware_waking_vector
|
*acpi_gbl_common_fACS.firmware_waking_vector = physical_address;
|
||||||
= physical_address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_firmware_waking_vector
|
* FUNCTION: acpi_get_firmware_waking_vector
|
||||||
@@ -101,33 +95,31 @@ acpi_set_firmware_waking_vector (
|
|||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_firmware_waking_vector (
|
acpi_get_firmware_waking_vector(acpi_physical_address * physical_address)
|
||||||
acpi_physical_address *physical_address)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_firmware_waking_vector");
|
ACPI_FUNCTION_TRACE("acpi_get_firmware_waking_vector");
|
||||||
|
|
||||||
|
|
||||||
if (!physical_address) {
|
if (!physical_address) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the vector */
|
/* Get the vector */
|
||||||
|
|
||||||
if (acpi_gbl_common_fACS.vector_width == 32) {
|
if (acpi_gbl_common_fACS.vector_width == 32) {
|
||||||
*physical_address = (acpi_physical_address)
|
*physical_address = (acpi_physical_address)
|
||||||
*(ACPI_CAST_PTR (u32, acpi_gbl_common_fACS.firmware_waking_vector));
|
*
|
||||||
}
|
(ACPI_CAST_PTR
|
||||||
else {
|
(u32, acpi_gbl_common_fACS.firmware_waking_vector));
|
||||||
|
} else {
|
||||||
*physical_address =
|
*physical_address =
|
||||||
*acpi_gbl_common_fACS.firmware_waking_vector;
|
*acpi_gbl_common_fACS.firmware_waking_vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_enter_sleep_state_prep
|
* FUNCTION: acpi_enter_sleep_state_prep
|
||||||
@@ -143,25 +135,22 @@ acpi_get_firmware_waking_vector (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
|
||||||
acpi_enter_sleep_state_prep (
|
|
||||||
u8 sleep_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_object_list arg_list;
|
struct acpi_object_list arg_list;
|
||||||
union acpi_object arg;
|
union acpi_object arg;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_prep");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_prep");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
|
* _PSW methods could be run here to enable wake-on keyboard, LAN, etc.
|
||||||
*/
|
*/
|
||||||
status = acpi_get_sleep_type_data (sleep_state,
|
status = acpi_get_sleep_type_data(sleep_state,
|
||||||
&acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
|
&acpi_gbl_sleep_type_a,
|
||||||
if (ACPI_FAILURE (status)) {
|
&acpi_gbl_sleep_type_b);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup parameter object */
|
/* Setup parameter object */
|
||||||
@@ -174,14 +163,14 @@ acpi_enter_sleep_state_prep (
|
|||||||
|
|
||||||
/* Run the _PTS and _GTS methods */
|
/* Run the _PTS and _GTS methods */
|
||||||
|
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__PTS, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__PTS, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__GTS, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__GTS, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the argument to _SST */
|
/* Setup the argument to _SST */
|
||||||
@@ -202,22 +191,21 @@ acpi_enter_sleep_state_prep (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
|
arg.integer.value = ACPI_SST_INDICATOR_OFF; /* Default is off */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the system indicators to show the desired sleep state. */
|
/* Set the system indicators to show the desired sleep state. */
|
||||||
|
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
|
ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_enter_sleep_state
|
* FUNCTION: acpi_enter_sleep_state
|
||||||
@@ -231,80 +219,82 @@ acpi_enter_sleep_state_prep (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status asmlinkage
|
acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state)
|
||||||
acpi_enter_sleep_state (
|
|
||||||
u8 sleep_state)
|
|
||||||
{
|
{
|
||||||
u32 PM1Acontrol;
|
u32 PM1Acontrol;
|
||||||
u32 PM1Bcontrol;
|
u32 PM1Bcontrol;
|
||||||
struct acpi_bit_register_info *sleep_type_reg_info;
|
struct acpi_bit_register_info *sleep_type_reg_info;
|
||||||
struct acpi_bit_register_info *sleep_enable_reg_info;
|
struct acpi_bit_register_info *sleep_enable_reg_info;
|
||||||
u32 in_value;
|
u32 in_value;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_enter_sleep_state");
|
||||||
|
|
||||||
if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
|
if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||
|
||||||
(acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
|
(acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {
|
||||||
ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",
|
ACPI_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,
|
||||||
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
|
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_type_reg_info =
|
||||||
sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);
|
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 */
|
/* Clear wake status */
|
||||||
|
|
||||||
status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear all fixed and general purpose status bits */
|
/* Clear all fixed and general purpose status bits */
|
||||||
|
|
||||||
status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
|
status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1) Disable/Clear all GPEs
|
* 1) Disable/Clear all GPEs
|
||||||
* 2) Enable all wakeup GPEs
|
* 2) Enable all wakeup GPEs
|
||||||
*/
|
*/
|
||||||
status = acpi_hw_disable_all_gpes ();
|
status = acpi_hw_disable_all_gpes();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
acpi_gbl_system_awake_and_running = FALSE;
|
acpi_gbl_system_awake_and_running = FALSE;
|
||||||
|
|
||||||
status = acpi_hw_enable_all_wakeup_gpes ();
|
status = acpi_hw_enable_all_wakeup_gpes();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get current value of PM1A control */
|
/* Get current value of PM1A control */
|
||||||
|
|
||||||
status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
|
ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT((ACPI_DB_INIT,
|
||||||
"Entering sleep state [S%d]\n", sleep_state));
|
"Entering sleep state [S%d]\n", sleep_state));
|
||||||
|
|
||||||
/* Clear SLP_EN and SLP_TYP fields */
|
/* Clear SLP_EN and SLP_TYP fields */
|
||||||
|
|
||||||
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
|
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
|
||||||
sleep_enable_reg_info->access_bit_mask);
|
sleep_enable_reg_info->access_bit_mask);
|
||||||
PM1Bcontrol = PM1Acontrol;
|
PM1Bcontrol = PM1Acontrol;
|
||||||
|
|
||||||
/* Insert SLP_TYP bits */
|
/* Insert SLP_TYP bits */
|
||||||
|
|
||||||
PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
|
PM1Acontrol |=
|
||||||
PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
|
(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
|
* We split the writes of SLP_TYP and SLP_EN to workaround
|
||||||
@@ -313,16 +303,18 @@ acpi_enter_sleep_state (
|
|||||||
|
|
||||||
/* Write #1: fill in SLP_TYP data */
|
/* Write #1: fill in SLP_TYP data */
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
|
ACPI_REGISTER_PM1A_CONTROL,
|
||||||
if (ACPI_FAILURE (status)) {
|
PM1Acontrol);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
|
ACPI_REGISTER_PM1B_CONTROL,
|
||||||
if (ACPI_FAILURE (status)) {
|
PM1Bcontrol);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Insert SLP_ENABLE bit */
|
/* Insert SLP_ENABLE bit */
|
||||||
@@ -332,18 +324,20 @@ acpi_enter_sleep_state (
|
|||||||
|
|
||||||
/* Write #2: SLP_TYP + SLP_EN */
|
/* Write #2: SLP_TYP + SLP_EN */
|
||||||
|
|
||||||
ACPI_FLUSH_CPU_CACHE ();
|
ACPI_FLUSH_CPU_CACHE();
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
|
ACPI_REGISTER_PM1A_CONTROL,
|
||||||
if (ACPI_FAILURE (status)) {
|
PM1Acontrol);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
|
ACPI_REGISTER_PM1B_CONTROL,
|
||||||
if (ACPI_FAILURE (status)) {
|
PM1Bcontrol);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sleep_state > ACPI_STATE_S3) {
|
if (sleep_state > ACPI_STATE_S3) {
|
||||||
@@ -358,33 +352,34 @@ acpi_enter_sleep_state (
|
|||||||
* still read the right value. Ideally, this block would go
|
* still read the right value. Ideally, this block would go
|
||||||
* away entirely.
|
* away entirely.
|
||||||
*/
|
*/
|
||||||
acpi_os_stall (10000000);
|
acpi_os_stall(10000000);
|
||||||
|
|
||||||
status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1_CONTROL,
|
ACPI_REGISTER_PM1_CONTROL,
|
||||||
sleep_enable_reg_info->access_bit_mask);
|
sleep_enable_reg_info->
|
||||||
if (ACPI_FAILURE (status)) {
|
access_bit_mask);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait until we enter sleep state */
|
/* Wait until we enter sleep state */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
|
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
|
||||||
ACPI_MTX_DO_NOT_LOCK);
|
ACPI_MTX_DO_NOT_LOCK);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Spin until we wake */
|
/* Spin until we wake */
|
||||||
|
|
||||||
} while (!in_value);
|
} while (!in_value);
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_enter_sleep_state);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_enter_sleep_state);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -399,60 +394,57 @@ EXPORT_SYMBOL(acpi_enter_sleep_state);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status asmlinkage
|
acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void)
|
||||||
acpi_enter_sleep_state_s4bios (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
u32 in_value;
|
u32 in_value;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_enter_sleep_state_s4bios");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state_s4bios");
|
status =
|
||||||
|
acpi_set_register(ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
|
return_ACPI_STATUS(status);
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);
|
status = acpi_hw_clear_acpi_status(ACPI_MTX_DO_NOT_LOCK);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1) Disable/Clear all GPEs
|
* 1) Disable/Clear all GPEs
|
||||||
* 2) Enable all wakeup GPEs
|
* 2) Enable all wakeup GPEs
|
||||||
*/
|
*/
|
||||||
status = acpi_hw_disable_all_gpes ();
|
status = acpi_hw_disable_all_gpes();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
acpi_gbl_system_awake_and_running = FALSE;
|
acpi_gbl_system_awake_and_running = FALSE;
|
||||||
|
|
||||||
status = acpi_hw_enable_all_wakeup_gpes ();
|
status = acpi_hw_enable_all_wakeup_gpes();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_FLUSH_CPU_CACHE ();
|
ACPI_FLUSH_CPU_CACHE();
|
||||||
|
|
||||||
status = acpi_os_write_port (acpi_gbl_FADT->smi_cmd,
|
status = acpi_os_write_port(acpi_gbl_FADT->smi_cmd,
|
||||||
(u32) acpi_gbl_FADT->S4bios_req, 8);
|
(u32) acpi_gbl_FADT->S4bios_req, 8);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
acpi_os_stall(1000);
|
acpi_os_stall(1000);
|
||||||
status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,
|
status = acpi_get_register(ACPI_BITREG_WAKE_STATUS, &in_value,
|
||||||
ACPI_MTX_DO_NOT_LOCK);
|
ACPI_MTX_DO_NOT_LOCK);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
} while (!in_value);
|
} while (!in_value);
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -467,55 +459,62 @@ EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_leave_sleep_state(u8 sleep_state)
|
||||||
acpi_leave_sleep_state (
|
|
||||||
u8 sleep_state)
|
|
||||||
{
|
{
|
||||||
struct acpi_object_list arg_list;
|
struct acpi_object_list arg_list;
|
||||||
union acpi_object arg;
|
union acpi_object arg;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_bit_register_info *sleep_type_reg_info;
|
struct acpi_bit_register_info *sleep_type_reg_info;
|
||||||
struct acpi_bit_register_info *sleep_enable_reg_info;
|
struct acpi_bit_register_info *sleep_enable_reg_info;
|
||||||
u32 PM1Acontrol;
|
u32 PM1Acontrol;
|
||||||
u32 PM1Bcontrol;
|
u32 PM1Bcontrol;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_leave_sleep_state");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_leave_sleep_state");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set SLP_TYPE and SLP_EN to state S0.
|
* Set SLP_TYPE and SLP_EN to state S0.
|
||||||
* This is unclear from the ACPI Spec, but it is required
|
* This is unclear from the ACPI Spec, but it is required
|
||||||
* by some machines.
|
* by some machines.
|
||||||
*/
|
*/
|
||||||
status = acpi_get_sleep_type_data (ACPI_STATE_S0,
|
status = acpi_get_sleep_type_data(ACPI_STATE_S0,
|
||||||
&acpi_gbl_sleep_type_a, &acpi_gbl_sleep_type_b);
|
&acpi_gbl_sleep_type_a,
|
||||||
if (ACPI_SUCCESS (status)) {
|
&acpi_gbl_sleep_type_b);
|
||||||
sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);
|
if (ACPI_SUCCESS(status)) {
|
||||||
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 */
|
/* Get current value of PM1A control */
|
||||||
|
|
||||||
status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,
|
status = acpi_hw_register_read(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);
|
ACPI_REGISTER_PM1_CONTROL,
|
||||||
if (ACPI_SUCCESS (status)) {
|
&PM1Acontrol);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
/* Clear SLP_EN and SLP_TYP fields */
|
/* Clear SLP_EN and SLP_TYP fields */
|
||||||
|
|
||||||
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
|
PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |
|
||||||
sleep_enable_reg_info->access_bit_mask);
|
sleep_enable_reg_info->
|
||||||
|
access_bit_mask);
|
||||||
PM1Bcontrol = PM1Acontrol;
|
PM1Bcontrol = PM1Acontrol;
|
||||||
|
|
||||||
/* Insert SLP_TYP bits */
|
/* Insert SLP_TYP bits */
|
||||||
|
|
||||||
PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);
|
PM1Acontrol |=
|
||||||
PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);
|
(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 */
|
/* Just ignore any errors */
|
||||||
|
|
||||||
(void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
(void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);
|
ACPI_REGISTER_PM1A_CONTROL,
|
||||||
(void) acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,
|
PM1Acontrol);
|
||||||
ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);
|
(void)acpi_hw_register_write(ACPI_MTX_DO_NOT_LOCK,
|
||||||
|
ACPI_REGISTER_PM1B_CONTROL,
|
||||||
|
PM1Bcontrol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,23 +531,23 @@ acpi_leave_sleep_state (
|
|||||||
/* Ignore any errors from these methods */
|
/* Ignore any errors from these methods */
|
||||||
|
|
||||||
arg.integer.value = ACPI_SST_WAKING;
|
arg.integer.value = ACPI_SST_WAKING;
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
|
ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
arg.integer.value = sleep_state;
|
arg.integer.value = sleep_state;
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__BFS, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__BFS, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
ACPI_REPORT_ERROR (("Method _BFS failed, %s\n",
|
ACPI_REPORT_ERROR(("Method _BFS failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__WAK, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
ACPI_REPORT_ERROR (("Method _WAK failed, %s\n",
|
ACPI_REPORT_ERROR(("Method _WAK failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
|
/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
|
||||||
|
|
||||||
@@ -557,33 +556,35 @@ acpi_leave_sleep_state (
|
|||||||
* 1) Disable/Clear all GPEs
|
* 1) Disable/Clear all GPEs
|
||||||
* 2) Enable all runtime GPEs
|
* 2) Enable all runtime GPEs
|
||||||
*/
|
*/
|
||||||
status = acpi_hw_disable_all_gpes ();
|
status = acpi_hw_disable_all_gpes();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
acpi_gbl_system_awake_and_running = TRUE;
|
acpi_gbl_system_awake_and_running = TRUE;
|
||||||
|
|
||||||
status = acpi_hw_enable_all_runtime_gpes ();
|
status = acpi_hw_enable_all_runtime_gpes();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable power button */
|
/* Enable power button */
|
||||||
|
|
||||||
(void) acpi_set_register(
|
(void)
|
||||||
acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].enable_register_id,
|
acpi_set_register(acpi_gbl_fixed_event_info
|
||||||
1, ACPI_MTX_DO_NOT_LOCK);
|
[ACPI_EVENT_POWER_BUTTON].enable_register_id, 1,
|
||||||
|
ACPI_MTX_DO_NOT_LOCK);
|
||||||
|
|
||||||
(void) acpi_set_register(
|
(void)
|
||||||
acpi_gbl_fixed_event_info[ACPI_EVENT_POWER_BUTTON].status_register_id,
|
acpi_set_register(acpi_gbl_fixed_event_info
|
||||||
1, ACPI_MTX_DO_NOT_LOCK);
|
[ACPI_EVENT_POWER_BUTTON].status_register_id, 1,
|
||||||
|
ACPI_MTX_DO_NOT_LOCK);
|
||||||
|
|
||||||
arg.integer.value = ACPI_SST_WORKING;
|
arg.integer.value = ACPI_SST_WORKING;
|
||||||
status = acpi_evaluate_object (NULL, METHOD_NAME__SST, &arg_list, NULL);
|
status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL);
|
||||||
if (ACPI_FAILURE (status) && status != AE_NOT_FOUND) {
|
if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
|
||||||
ACPI_REPORT_ERROR (("Method _SST failed, %s\n",
|
ACPI_REPORT_ERROR(("Method _SST failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,8 +46,7 @@
|
|||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_HARDWARE
|
#define _COMPONENT ACPI_HARDWARE
|
||||||
ACPI_MODULE_NAME ("hwtimer")
|
ACPI_MODULE_NAME("hwtimer")
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -60,29 +59,23 @@
|
|||||||
* DESCRIPTION: Obtains resolution of the ACPI PM Timer (24 or 32 bits).
|
* 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");
|
ACPI_FUNCTION_TRACE("acpi_get_timer_resolution");
|
||||||
|
|
||||||
|
|
||||||
if (!resolution) {
|
if (!resolution) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == acpi_gbl_FADT->tmr_val_ext) {
|
if (0 == acpi_gbl_FADT->tmr_val_ext) {
|
||||||
*resolution = 24;
|
*resolution = 24;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
*resolution = 32;
|
*resolution = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_timer
|
* FUNCTION: acpi_get_timer
|
||||||
@@ -95,26 +88,22 @@ acpi_get_timer_resolution (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_get_timer(u32 * ticks)
|
||||||
acpi_get_timer (
|
|
||||||
u32 *ticks)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_timer");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_timer");
|
||||||
|
|
||||||
if (!ticks) {
|
if (!ticks) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_hw_low_level_read (32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
|
status = acpi_hw_low_level_read(32, ticks, &acpi_gbl_FADT->xpm_tmr_blk);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_timer);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_timer);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -146,21 +135,16 @@ EXPORT_SYMBOL(acpi_get_timer);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_timer_duration (
|
acpi_get_timer_duration(u32 start_ticks, u32 end_ticks, u32 * time_elapsed)
|
||||||
u32 start_ticks,
|
|
||||||
u32 end_ticks,
|
|
||||||
u32 *time_elapsed)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 delta_ticks;
|
u32 delta_ticks;
|
||||||
acpi_integer quotient;
|
acpi_integer quotient;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_timer_duration");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_timer_duration");
|
||||||
|
|
||||||
if (!time_elapsed) {
|
if (!time_elapsed) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -169,22 +153,22 @@ acpi_get_timer_duration (
|
|||||||
*/
|
*/
|
||||||
if (start_ticks < end_ticks) {
|
if (start_ticks < end_ticks) {
|
||||||
delta_ticks = end_ticks - start_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) {
|
if (0 == acpi_gbl_FADT->tmr_val_ext) {
|
||||||
/* 24-bit Timer */
|
/* 24-bit Timer */
|
||||||
|
|
||||||
delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
|
delta_ticks =
|
||||||
}
|
(((0x00FFFFFF - start_ticks) +
|
||||||
else {
|
end_ticks) & 0x00FFFFFF);
|
||||||
|
} else {
|
||||||
/* 32-bit Timer */
|
/* 32-bit Timer */
|
||||||
|
|
||||||
delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
|
delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
|
||||||
}
|
}
|
||||||
}
|
} else { /* start_ticks == end_ticks */
|
||||||
else /* start_ticks == end_ticks */ {
|
|
||||||
*time_elapsed = 0;
|
*time_elapsed = 0;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -192,12 +176,11 @@ acpi_get_timer_duration (
|
|||||||
*
|
*
|
||||||
* time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
|
* time_elapsed = (delta_ticks * 1000000) / PM_TIMER_FREQUENCY;
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_short_divide (((u64) delta_ticks) * 1000000,
|
status = acpi_ut_short_divide(((u64) delta_ticks) * 1000000,
|
||||||
PM_TIMER_FREQUENCY, "ient, NULL);
|
PM_TIMER_FREQUENCY, "ient, NULL);
|
||||||
|
|
||||||
*time_elapsed = (u32) quotient;
|
*time_elapsed = (u32) quotient;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_get_timer_duration);
|
EXPORT_SYMBOL(acpi_get_timer_duration);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@
|
|||||||
#define _COMPONENT ACPI_HOTKEY_COMPONENT
|
#define _COMPONENT ACPI_HOTKEY_COMPONENT
|
||||||
ACPI_MODULE_NAME("acpi_hotkey")
|
ACPI_MODULE_NAME("acpi_hotkey")
|
||||||
|
|
||||||
MODULE_AUTHOR("luming.yu@intel.com");
|
MODULE_AUTHOR("luming.yu@intel.com");
|
||||||
MODULE_DESCRIPTION(ACPI_HOTK_NAME);
|
MODULE_DESCRIPTION(ACPI_HOTK_NAME);
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
||||||
@@ -180,8 +180,8 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset);
|
|||||||
static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset);
|
static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset);
|
||||||
static int hotkey_polling_open_fs(struct inode *inode, struct file *file);
|
static int hotkey_polling_open_fs(struct inode *inode, struct file *file);
|
||||||
static union acpi_hotkey *get_hotkey_by_event(struct
|
static union acpi_hotkey *get_hotkey_by_event(struct
|
||||||
acpi_hotkey_list
|
acpi_hotkey_list
|
||||||
*hotkey_list, int event);
|
*hotkey_list, int event);
|
||||||
|
|
||||||
/* event based config */
|
/* event based config */
|
||||||
static struct file_operations hotkey_config_fops = {
|
static struct file_operations hotkey_config_fops = {
|
||||||
@@ -256,7 +256,7 @@ static char *format_result(union acpi_object *object)
|
|||||||
/* Now, just support integer type */
|
/* Now, just support integer type */
|
||||||
if (object->type == ACPI_TYPE_INTEGER)
|
if (object->type == ACPI_TYPE_INTEGER)
|
||||||
sprintf(buf, "%d\n", (u32) object->integer.value);
|
sprintf(buf, "%d\n", (u32) object->integer.value);
|
||||||
do_fail:
|
do_fail:
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,9 +268,9 @@ static int hotkey_polling_seq_show(struct seq_file *seq, void *offset)
|
|||||||
|
|
||||||
ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
|
ACPI_FUNCTION_TRACE("hotkey_polling_seq_show");
|
||||||
|
|
||||||
if (poll_hotkey->poll_result){
|
if (poll_hotkey->poll_result) {
|
||||||
buf = format_result(poll_hotkey->poll_result);
|
buf = format_result(poll_hotkey->poll_result);
|
||||||
if(buf)
|
if (buf)
|
||||||
seq_printf(seq, "%s", buf);
|
seq_printf(seq, "%s", buf);
|
||||||
kfree(buf);
|
kfree(buf);
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list)
|
|||||||
union acpi_hotkey *key =
|
union acpi_hotkey *key =
|
||||||
container_of(entries, union acpi_hotkey, entries);
|
container_of(entries, union acpi_hotkey, entries);
|
||||||
if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
|
if (key->link.hotkey_type == ACPI_HOTKEY_EVENT
|
||||||
&& key->event_hotkey.external_hotkey_num == event){
|
&& key->event_hotkey.external_hotkey_num == event) {
|
||||||
val = key->link.hotkey_standard_num;
|
val = key->link.hotkey_standard_num;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -343,7 +343,7 @@ static int auto_hotkey_remove(struct acpi_device *device, int type)
|
|||||||
static int create_polling_proc(union acpi_hotkey *device)
|
static int create_polling_proc(union acpi_hotkey *device)
|
||||||
{
|
{
|
||||||
struct proc_dir_entry *proc;
|
struct proc_dir_entry *proc;
|
||||||
char proc_name[80];
|
char proc_name[80];
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("create_polling_proc");
|
ACPI_FUNCTION_TRACE("create_polling_proc");
|
||||||
@@ -351,8 +351,8 @@ static int create_polling_proc(union acpi_hotkey *device)
|
|||||||
|
|
||||||
sprintf(proc_name, "%d", device->link.hotkey_standard_num);
|
sprintf(proc_name, "%d", device->link.hotkey_standard_num);
|
||||||
/*
|
/*
|
||||||
strcat(proc_name, device->poll_hotkey.poll_method);
|
strcat(proc_name, device->poll_hotkey.poll_method);
|
||||||
*/
|
*/
|
||||||
proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
|
proc = create_proc_entry(proc_name, mode, hotkey_proc_dir);
|
||||||
|
|
||||||
if (!proc) {
|
if (!proc) {
|
||||||
@@ -415,50 +415,50 @@ static int hotkey_remove(union acpi_hotkey *device)
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hotkey_update(union acpi_hotkey *key)
|
static int hotkey_update(union acpi_hotkey *key)
|
||||||
{
|
{
|
||||||
struct list_head *entries;
|
struct list_head *entries;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("hotkey_update");
|
ACPI_FUNCTION_TRACE("hotkey_update");
|
||||||
|
|
||||||
list_for_each(entries, global_hotkey_list.entries) {
|
list_for_each(entries, global_hotkey_list.entries) {
|
||||||
union acpi_hotkey *tmp=
|
union acpi_hotkey *tmp =
|
||||||
container_of(entries, union acpi_hotkey, entries);
|
container_of(entries, union acpi_hotkey, entries);
|
||||||
if (tmp->link.hotkey_standard_num ==
|
if (tmp->link.hotkey_standard_num ==
|
||||||
key->link.hotkey_standard_num) {
|
key->link.hotkey_standard_num) {
|
||||||
if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
|
if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) {
|
||||||
free_hotkey_buffer(tmp);
|
free_hotkey_buffer(tmp);
|
||||||
tmp->event_hotkey.bus_handle =
|
tmp->event_hotkey.bus_handle =
|
||||||
key->event_hotkey.bus_handle;
|
key->event_hotkey.bus_handle;
|
||||||
tmp->event_hotkey.external_hotkey_num =
|
tmp->event_hotkey.external_hotkey_num =
|
||||||
key->event_hotkey.external_hotkey_num;
|
key->event_hotkey.external_hotkey_num;
|
||||||
tmp->event_hotkey.action_handle =
|
tmp->event_hotkey.action_handle =
|
||||||
key->event_hotkey.action_handle;
|
key->event_hotkey.action_handle;
|
||||||
tmp->event_hotkey.action_method =
|
tmp->event_hotkey.action_method =
|
||||||
key->event_hotkey.action_method;
|
key->event_hotkey.action_method;
|
||||||
kfree(key);
|
kfree(key);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
char proc_name[80];
|
char proc_name[80];
|
||||||
|
|
||||||
sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
|
sprintf(proc_name, "%d", tmp->link.hotkey_standard_num);
|
||||||
strcat(proc_name, tmp->poll_hotkey.poll_method);
|
strcat(proc_name, tmp->poll_hotkey.poll_method);
|
||||||
remove_proc_entry(proc_name,hotkey_proc_dir);
|
remove_proc_entry(proc_name,hotkey_proc_dir);
|
||||||
*/
|
*/
|
||||||
free_poll_hotkey_buffer(tmp);
|
free_poll_hotkey_buffer(tmp);
|
||||||
tmp->poll_hotkey.poll_handle =
|
tmp->poll_hotkey.poll_handle =
|
||||||
key->poll_hotkey.poll_handle;
|
key->poll_hotkey.poll_handle;
|
||||||
tmp->poll_hotkey.poll_method =
|
tmp->poll_hotkey.poll_method =
|
||||||
key->poll_hotkey.poll_method;
|
key->poll_hotkey.poll_method;
|
||||||
tmp->poll_hotkey.action_handle =
|
tmp->poll_hotkey.action_handle =
|
||||||
key->poll_hotkey.action_handle;
|
key->poll_hotkey.action_handle;
|
||||||
tmp->poll_hotkey.action_method =
|
tmp->poll_hotkey.action_method =
|
||||||
key->poll_hotkey.action_method;
|
key->poll_hotkey.action_method;
|
||||||
tmp->poll_hotkey.poll_result =
|
tmp->poll_hotkey.poll_result =
|
||||||
key->poll_hotkey.poll_result;
|
key->poll_hotkey.poll_result;
|
||||||
/*
|
/*
|
||||||
create_polling_proc(tmp);
|
create_polling_proc(tmp);
|
||||||
*/
|
*/
|
||||||
kfree(key);
|
kfree(key);
|
||||||
}
|
}
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
@@ -483,27 +483,25 @@ static void free_hotkey_device(union acpi_hotkey *key)
|
|||||||
acpi_hotkey_notify_handler);
|
acpi_hotkey_notify_handler);
|
||||||
free_hotkey_buffer(key);
|
free_hotkey_buffer(key);
|
||||||
} else {
|
} else {
|
||||||
char proc_name[80];
|
char proc_name[80];
|
||||||
|
|
||||||
sprintf(proc_name, "%d", key->link.hotkey_standard_num);
|
sprintf(proc_name, "%d", key->link.hotkey_standard_num);
|
||||||
/*
|
/*
|
||||||
strcat(proc_name, key->poll_hotkey.poll_method);
|
strcat(proc_name, key->poll_hotkey.poll_method);
|
||||||
*/
|
*/
|
||||||
remove_proc_entry(proc_name,hotkey_proc_dir);
|
remove_proc_entry(proc_name, hotkey_proc_dir);
|
||||||
free_poll_hotkey_buffer(key);
|
free_poll_hotkey_buffer(key);
|
||||||
}
|
}
|
||||||
kfree(key);
|
kfree(key);
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void free_hotkey_buffer(union acpi_hotkey *key)
|
||||||
free_hotkey_buffer(union acpi_hotkey *key)
|
|
||||||
{
|
{
|
||||||
kfree(key->event_hotkey.action_method);
|
kfree(key->event_hotkey.action_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void free_poll_hotkey_buffer(union acpi_hotkey *key)
|
||||||
free_poll_hotkey_buffer(union acpi_hotkey *key)
|
|
||||||
{
|
{
|
||||||
kfree(key->poll_hotkey.action_method);
|
kfree(key->poll_hotkey.action_method);
|
||||||
kfree(key->poll_hotkey.poll_method);
|
kfree(key->poll_hotkey.poll_method);
|
||||||
@@ -513,15 +511,15 @@ static int
|
|||||||
init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
|
init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
|
||||||
char *method, int std_num, int external_num)
|
char *method, int std_num, int external_num)
|
||||||
{
|
{
|
||||||
acpi_handle tmp_handle;
|
acpi_handle tmp_handle;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("init_hotkey_device");
|
ACPI_FUNCTION_TRACE("init_hotkey_device");
|
||||||
|
|
||||||
if(std_num < 0 || IS_POLL(std_num) || !key )
|
if (std_num < 0 || IS_POLL(std_num) || !key)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
|
|
||||||
if(!bus_str || !action_str || !method)
|
if (!bus_str || !action_str || !method)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
|
|
||||||
key->link.hotkey_type = ACPI_HOTKEY_EVENT;
|
key->link.hotkey_type = ACPI_HOTKEY_EVENT;
|
||||||
@@ -529,19 +527,22 @@ init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str,
|
|||||||
key->event_hotkey.flag = 0;
|
key->event_hotkey.flag = 0;
|
||||||
key->event_hotkey.action_method = method;
|
key->event_hotkey.action_method = method;
|
||||||
|
|
||||||
status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle));
|
status =
|
||||||
if(ACPI_FAILURE(status))
|
acpi_get_handle(NULL, bus_str, &(key->event_hotkey.bus_handle));
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
key->event_hotkey.external_hotkey_num = external_num;
|
key->event_hotkey.external_hotkey_num = external_num;
|
||||||
status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle));
|
status =
|
||||||
if(ACPI_FAILURE(status))
|
acpi_get_handle(NULL, action_str,
|
||||||
|
&(key->event_hotkey.action_handle));
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
status = acpi_get_handle(key->event_hotkey.action_handle,
|
status = acpi_get_handle(key->event_hotkey.action_handle,
|
||||||
method, &tmp_handle);
|
method, &tmp_handle);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
return_VALUE(AE_OK);
|
return_VALUE(AE_OK);
|
||||||
do_fail:
|
do_fail:
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,14 +553,14 @@ init_poll_hotkey_device(union acpi_hotkey *key,
|
|||||||
char *action_str, char *action_method, int std_num)
|
char *action_str, char *action_method, int std_num)
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_handle tmp_handle;
|
acpi_handle tmp_handle;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
|
ACPI_FUNCTION_TRACE("init_poll_hotkey_device");
|
||||||
|
|
||||||
if(std_num < 0 || IS_EVENT(std_num) || !key)
|
if (std_num < 0 || IS_EVENT(std_num) || !key)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
|
|
||||||
if(!poll_str || !poll_method || !action_str || !action_method)
|
if (!poll_str || !poll_method || !action_str || !action_method)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
|
|
||||||
key->link.hotkey_type = ACPI_HOTKEY_POLLING;
|
key->link.hotkey_type = ACPI_HOTKEY_POLLING;
|
||||||
@@ -568,30 +569,32 @@ init_poll_hotkey_device(union acpi_hotkey *key,
|
|||||||
key->poll_hotkey.poll_method = poll_method;
|
key->poll_hotkey.poll_method = poll_method;
|
||||||
key->poll_hotkey.action_method = action_method;
|
key->poll_hotkey.action_method = action_method;
|
||||||
|
|
||||||
status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle));
|
status =
|
||||||
if(ACPI_FAILURE(status))
|
acpi_get_handle(NULL, poll_str, &(key->poll_hotkey.poll_handle));
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
status = acpi_get_handle(key->poll_hotkey.poll_handle,
|
status = acpi_get_handle(key->poll_hotkey.poll_handle,
|
||||||
poll_method, &tmp_handle);
|
poll_method, &tmp_handle);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
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))
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
status = acpi_get_handle(key->poll_hotkey.action_handle,
|
status = acpi_get_handle(key->poll_hotkey.action_handle,
|
||||||
action_method, &tmp_handle);
|
action_method, &tmp_handle);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
key->poll_hotkey.poll_result =
|
key->poll_hotkey.poll_result =
|
||||||
(union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
|
(union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL);
|
||||||
if(!key->poll_hotkey.poll_result)
|
if (!key->poll_hotkey.poll_result)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
return_VALUE(AE_OK);
|
return_VALUE(AE_OK);
|
||||||
do_fail:
|
do_fail:
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int hotkey_open_config(struct inode *inode, struct file *file)
|
static int hotkey_open_config(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE("hotkey_open_config");
|
ACPI_FUNCTION_TRACE("hotkey_open_config");
|
||||||
@@ -679,8 +682,9 @@ get_parms(char *config_record,
|
|||||||
|
|
||||||
sscanf(config_record, "%d", cmd);
|
sscanf(config_record, "%d", cmd);
|
||||||
|
|
||||||
if(*cmd == 1){
|
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;
|
goto do_fail;
|
||||||
else
|
else
|
||||||
return (6);
|
return (6);
|
||||||
@@ -694,8 +698,8 @@ get_parms(char *config_record,
|
|||||||
goto do_fail;
|
goto do_fail;
|
||||||
|
|
||||||
count = tmp1 - tmp;
|
count = tmp1 - tmp;
|
||||||
*bus_handle = (char *) kmalloc(count+1, GFP_KERNEL);
|
*bus_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
|
||||||
if(!*bus_handle)
|
if (!*bus_handle)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
strncpy(*bus_handle, tmp, count);
|
strncpy(*bus_handle, tmp, count);
|
||||||
*(*bus_handle + count) = 0;
|
*(*bus_handle + count) = 0;
|
||||||
@@ -706,8 +710,8 @@ get_parms(char *config_record,
|
|||||||
if (!tmp1)
|
if (!tmp1)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
count = tmp1 - tmp;
|
count = tmp1 - tmp;
|
||||||
*bus_method = (char *) kmalloc(count+1, GFP_KERNEL);
|
*bus_method = (char *)kmalloc(count + 1, GFP_KERNEL);
|
||||||
if(!*bus_method)
|
if (!*bus_method)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
strncpy(*bus_method, tmp, count);
|
strncpy(*bus_method, tmp, count);
|
||||||
*(*bus_method + count) = 0;
|
*(*bus_method + count) = 0;
|
||||||
@@ -718,7 +722,7 @@ get_parms(char *config_record,
|
|||||||
if (!tmp1)
|
if (!tmp1)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
count = tmp1 - tmp;
|
count = tmp1 - tmp;
|
||||||
*action_handle = (char *) kmalloc(count+1, GFP_KERNEL);
|
*action_handle = (char *)kmalloc(count + 1, GFP_KERNEL);
|
||||||
strncpy(*action_handle, tmp, count);
|
strncpy(*action_handle, tmp, count);
|
||||||
*(*action_handle + count) = 0;
|
*(*action_handle + count) = 0;
|
||||||
|
|
||||||
@@ -728,17 +732,18 @@ get_parms(char *config_record,
|
|||||||
if (!tmp1)
|
if (!tmp1)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
count = tmp1 - tmp;
|
count = tmp1 - tmp;
|
||||||
*method = (char *) kmalloc(count+1, GFP_KERNEL);
|
*method = (char *)kmalloc(count + 1, GFP_KERNEL);
|
||||||
if(!*method)
|
if (!*method)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
strncpy(*method, tmp, count);
|
strncpy(*method, tmp, count);
|
||||||
*(*method + count) = 0;
|
*(*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;
|
goto do_fail;
|
||||||
|
|
||||||
return_VALUE(6);
|
return_VALUE(6);
|
||||||
do_fail:
|
do_fail:
|
||||||
return_VALUE(-1);
|
return_VALUE(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,8 +763,8 @@ static ssize_t hotkey_write_config(struct file *file,
|
|||||||
|
|
||||||
ACPI_FUNCTION_TRACE(("hotkey_write_config"));
|
ACPI_FUNCTION_TRACE(("hotkey_write_config"));
|
||||||
|
|
||||||
config_record = (char *) kmalloc(count+1, GFP_KERNEL);
|
config_record = (char *)kmalloc(count + 1, GFP_KERNEL);
|
||||||
if(!config_record)
|
if (!config_record)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
|
|
||||||
if (copy_from_user(config_record, buffer, count)) {
|
if (copy_from_user(config_record, buffer, count)) {
|
||||||
@@ -777,10 +782,10 @@ static ssize_t hotkey_write_config(struct file *file,
|
|||||||
&method, &internal_event_num, &external_event_num);
|
&method, &internal_event_num, &external_event_num);
|
||||||
|
|
||||||
kfree(config_record);
|
kfree(config_record);
|
||||||
if(IS_OTHERS(internal_event_num))
|
if (IS_OTHERS(internal_event_num))
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
if (ret != 6) {
|
if (ret != 6) {
|
||||||
do_fail:
|
do_fail:
|
||||||
kfree(bus_handle);
|
kfree(bus_handle);
|
||||||
kfree(bus_method);
|
kfree(bus_method);
|
||||||
kfree(action_handle);
|
kfree(action_handle);
|
||||||
@@ -791,14 +796,14 @@ do_fail:
|
|||||||
}
|
}
|
||||||
|
|
||||||
key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
|
key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL);
|
||||||
if(!key)
|
if (!key)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
memset(key, 0, sizeof(union acpi_hotkey));
|
memset(key, 0, sizeof(union acpi_hotkey));
|
||||||
if(cmd == 1) {
|
if (cmd == 1) {
|
||||||
union acpi_hotkey *tmp = NULL;
|
union acpi_hotkey *tmp = NULL;
|
||||||
tmp = get_hotkey_by_event(&global_hotkey_list,
|
tmp = get_hotkey_by_event(&global_hotkey_list,
|
||||||
internal_event_num);
|
internal_event_num);
|
||||||
if(!tmp)
|
if (!tmp)
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key"));
|
||||||
else
|
else
|
||||||
memcpy(key, tmp, sizeof(union acpi_hotkey));
|
memcpy(key, tmp, sizeof(union acpi_hotkey));
|
||||||
@@ -807,15 +812,16 @@ do_fail:
|
|||||||
if (IS_EVENT(internal_event_num)) {
|
if (IS_EVENT(internal_event_num)) {
|
||||||
kfree(bus_method);
|
kfree(bus_method);
|
||||||
ret = init_hotkey_device(key, bus_handle, action_handle, method,
|
ret = init_hotkey_device(key, bus_handle, action_handle, method,
|
||||||
internal_event_num, external_event_num);
|
internal_event_num,
|
||||||
|
external_event_num);
|
||||||
} else
|
} else
|
||||||
ret = init_poll_hotkey_device(key, bus_handle, bus_method,
|
ret = init_poll_hotkey_device(key, bus_handle, bus_method,
|
||||||
action_handle, method,
|
action_handle, method,
|
||||||
internal_event_num);
|
internal_event_num);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
kfree(bus_handle);
|
kfree(bus_handle);
|
||||||
kfree(action_handle);
|
kfree(action_handle);
|
||||||
if(IS_EVENT(internal_event_num))
|
if (IS_EVENT(internal_event_num))
|
||||||
free_hotkey_buffer(key);
|
free_hotkey_buffer(key);
|
||||||
else
|
else
|
||||||
free_poll_hotkey_buffer(key);
|
free_poll_hotkey_buffer(key);
|
||||||
@@ -824,13 +830,14 @@ do_fail:
|
|||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
cont_cmd:
|
cont_cmd:
|
||||||
kfree(bus_handle);
|
kfree(bus_handle);
|
||||||
kfree(action_handle);
|
kfree(action_handle);
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 0:
|
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;
|
goto fail_out;
|
||||||
else
|
else
|
||||||
hotkey_add(key);
|
hotkey_add(key);
|
||||||
@@ -839,7 +846,7 @@ cont_cmd:
|
|||||||
hotkey_remove(key);
|
hotkey_remove(key);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if(hotkey_update(key))
|
if (hotkey_update(key))
|
||||||
goto fail_out;
|
goto fail_out;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -847,8 +854,8 @@ cont_cmd:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return_VALUE(count);
|
return_VALUE(count);
|
||||||
fail_out:
|
fail_out:
|
||||||
if(IS_EVENT(internal_event_num))
|
if (IS_EVENT(internal_event_num))
|
||||||
free_hotkey_buffer(key);
|
free_hotkey_buffer(key);
|
||||||
else
|
else
|
||||||
free_poll_hotkey_buffer(key);
|
free_poll_hotkey_buffer(key);
|
||||||
@@ -882,7 +889,8 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val,
|
|||||||
return_VALUE(status == AE_OK);
|
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;
|
struct acpi_buffer output;
|
||||||
union acpi_object out_obj;
|
union acpi_object out_obj;
|
||||||
@@ -893,7 +901,7 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
|
|||||||
output.pointer = &out_obj;
|
output.pointer = &out_obj;
|
||||||
|
|
||||||
status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
|
status = acpi_evaluate_object(handle, (char *)method, NULL, &output);
|
||||||
if(val){
|
if (val) {
|
||||||
val->integer.value = out_obj.integer.value;
|
val->integer.value = out_obj.integer.value;
|
||||||
val->type = out_obj.type;
|
val->type = out_obj.type;
|
||||||
} else
|
} else
|
||||||
@@ -903,8 +911,8 @@ static int read_acpi_int(acpi_handle handle, const char *method, union acpi_obje
|
|||||||
}
|
}
|
||||||
|
|
||||||
static union acpi_hotkey *get_hotkey_by_event(struct
|
static union acpi_hotkey *get_hotkey_by_event(struct
|
||||||
acpi_hotkey_list
|
acpi_hotkey_list
|
||||||
*hotkey_list, int event)
|
*hotkey_list, int event)
|
||||||
{
|
{
|
||||||
struct list_head *entries;
|
struct list_head *entries;
|
||||||
|
|
||||||
@@ -912,10 +920,10 @@ static union acpi_hotkey *get_hotkey_by_event(struct
|
|||||||
union acpi_hotkey *key =
|
union acpi_hotkey *key =
|
||||||
container_of(entries, union acpi_hotkey, entries);
|
container_of(entries, union acpi_hotkey, entries);
|
||||||
if (key->link.hotkey_standard_num == event) {
|
if (key->link.hotkey_standard_num == event) {
|
||||||
return(key);
|
return (key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -932,15 +940,15 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
|
|||||||
{
|
{
|
||||||
struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
|
struct acpi_hotkey_list *hotkey_list = &global_hotkey_list;
|
||||||
char *arg;
|
char *arg;
|
||||||
int event,method_type,type, value;
|
int event, method_type, type, value;
|
||||||
union acpi_hotkey *key;
|
union acpi_hotkey *key;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
|
ACPI_FUNCTION_TRACE("hotkey_execte_aml_method");
|
||||||
|
|
||||||
arg = (char *) kmalloc(count+1, GFP_KERNEL);
|
arg = (char *)kmalloc(count + 1, GFP_KERNEL);
|
||||||
if(!arg)
|
if (!arg)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
arg[count]=0;
|
arg[count] = 0;
|
||||||
|
|
||||||
if (copy_from_user(arg, buffer, count)) {
|
if (copy_from_user(arg, buffer, count)) {
|
||||||
kfree(arg);
|
kfree(arg);
|
||||||
@@ -948,7 +956,8 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
|
|||||||
return_VALUE(-EINVAL);
|
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);
|
kfree(arg);
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3"));
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
@@ -956,19 +965,21 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
|
|||||||
kfree(arg);
|
kfree(arg);
|
||||||
if (type == ACPI_TYPE_INTEGER) {
|
if (type == ACPI_TYPE_INTEGER) {
|
||||||
key = get_hotkey_by_event(hotkey_list, event);
|
key = get_hotkey_by_event(hotkey_list, event);
|
||||||
if(!key)
|
if (!key)
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
if (IS_EVENT(event))
|
if (IS_EVENT(event))
|
||||||
write_acpi_int(key->event_hotkey.action_handle,
|
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)) {
|
else if (IS_POLL(event)) {
|
||||||
if ( method_type == POLL_METHOD )
|
if (method_type == POLL_METHOD)
|
||||||
read_acpi_int(key->poll_hotkey.poll_handle,
|
read_acpi_int(key->poll_hotkey.poll_handle,
|
||||||
key->poll_hotkey.poll_method,
|
key->poll_hotkey.poll_method,
|
||||||
key->poll_hotkey.poll_result);
|
key->poll_hotkey.poll_result);
|
||||||
else if ( method_type == ACTION_METHOD )
|
else if (method_type == ACTION_METHOD)
|
||||||
write_acpi_int(key->poll_hotkey.action_handle,
|
write_acpi_int(key->poll_hotkey.action_handle,
|
||||||
key->poll_hotkey.action_method, value, NULL);
|
key->poll_hotkey.action_method,
|
||||||
|
value, NULL);
|
||||||
else
|
else
|
||||||
goto do_fail;
|
goto do_fail;
|
||||||
|
|
||||||
@@ -978,7 +989,7 @@ static ssize_t hotkey_execute_aml_method(struct file *file,
|
|||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
}
|
}
|
||||||
return_VALUE(count);
|
return_VALUE(count);
|
||||||
do_fail:
|
do_fail:
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1074,15 +1085,15 @@ static int __init hotkey_init(void)
|
|||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
do_fail5:
|
do_fail5:
|
||||||
remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir);
|
remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir);
|
||||||
do_fail4:
|
do_fail4:
|
||||||
remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir);
|
remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir);
|
||||||
do_fail3:
|
do_fail3:
|
||||||
remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir);
|
remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir);
|
||||||
do_fail2:
|
do_fail2:
|
||||||
remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir);
|
remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir);
|
||||||
do_fail1:
|
do_fail1:
|
||||||
remove_proc_entry(HOTKEY_PROC, acpi_root_dir);
|
remove_proc_entry(HOTKEY_PROC, acpi_root_dir);
|
||||||
return (-ENODEV);
|
return (-ENODEV);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,39 +86,33 @@ static acpi_handle root_handle = NULL;
|
|||||||
static acpi_handle *object##_parent = &parent##_handle; \
|
static acpi_handle *object##_parent = &parent##_handle; \
|
||||||
static char *object##_paths[] = { paths }
|
static char *object##_paths[] = { paths }
|
||||||
|
|
||||||
IBM_HANDLE(ec, root,
|
IBM_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC", /* A21e, A22p, T20, T21, X20 */
|
||||||
"\\_SB.PCI0.ISA.EC", /* A21e, A22p, T20, T21, X20 */
|
"\\_SB.PCI0.LPC.EC", /* all others */
|
||||||
"\\_SB.PCI0.LPC.EC", /* all others */
|
);
|
||||||
);
|
|
||||||
|
|
||||||
IBM_HANDLE(vid, root,
|
IBM_HANDLE(vid, root, "\\_SB.PCI0.VID", /* A21e, G40, X30, X40 */
|
||||||
"\\_SB.PCI0.VID", /* A21e, G40, X30, X40 */
|
"\\_SB.PCI0.AGP.VID", /* all others */
|
||||||
"\\_SB.PCI0.AGP.VID", /* all others */
|
);
|
||||||
);
|
|
||||||
|
|
||||||
IBM_HANDLE(cmos, root,
|
IBM_HANDLE(cmos, root, "\\UCMS", /* R50, R50p, R51, T4x, X31, X40 */
|
||||||
"\\UCMS", /* R50, R50p, R51, T4x, X31, X40 */
|
"\\CMOS", /* A3x, G40, R32, T23, T30, X22, X24, X30 */
|
||||||
"\\CMOS", /* A3x, G40, R32, T23, T30, X22, X24, X30 */
|
"\\CMS", /* R40, R40e */
|
||||||
"\\CMS", /* R40, R40e */
|
); /* A21e, A22p, T20, T21, X20 */
|
||||||
); /* A21e, A22p, T20, T21, X20 */
|
|
||||||
|
|
||||||
IBM_HANDLE(dock, root,
|
IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */
|
||||||
"\\_SB.GDCK", /* X30, X31, X40 */
|
"\\_SB.PCI0.DOCK", /* A22p, T20, T21, X20 */
|
||||||
"\\_SB.PCI0.DOCK", /* A22p, T20, T21, X20 */
|
"\\_SB.PCI0.PCI1.DOCK", /* all others */
|
||||||
"\\_SB.PCI0.PCI1.DOCK", /* all others */
|
); /* A21e, G40, R32, R40, R40e */
|
||||||
); /* A21e, G40, R32, R40, R40e */
|
|
||||||
|
|
||||||
IBM_HANDLE(bay, root,
|
IBM_HANDLE(bay, root, "\\_SB.PCI0.IDE0.SCND.MSTR"); /* all except A21e */
|
||||||
"\\_SB.PCI0.IDE0.SCND.MSTR"); /* all except A21e */
|
IBM_HANDLE(bayej, root, "\\_SB.PCI0.IDE0.SCND.MSTR._EJ0"); /* all except A2x, A3x */
|
||||||
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(lght, root, "\\LGHT"); /* A21e, A22p, T20, T21, X20 */
|
||||||
IBM_HANDLE(hkey, ec, "HKEY"); /* all */
|
IBM_HANDLE(hkey, ec, "HKEY"); /* all */
|
||||||
IBM_HANDLE(led, ec, "LED"); /* all except A21e, A22p, T20, T21, X20 */
|
IBM_HANDLE(led, ec, "LED"); /* all except A21e, A22p, T20, T21, X20 */
|
||||||
IBM_HANDLE(sysl, ec, "SYSL"); /* A21e, A22p, T20, T21, X20 */
|
IBM_HANDLE(sysl, ec, "SYSL"); /* A21e, A22p, T20, T21, X20 */
|
||||||
IBM_HANDLE(bled, ec, "BLED"); /* A22p, T20, T21, X20 */
|
IBM_HANDLE(bled, ec, "BLED"); /* A22p, T20, T21, X20 */
|
||||||
IBM_HANDLE(beep, ec, "BEEP"); /* all models */
|
IBM_HANDLE(beep, ec, "BEEP"); /* all models */
|
||||||
|
|
||||||
struct ibm_struct {
|
struct ibm_struct {
|
||||||
char *name;
|
char *name;
|
||||||
@@ -126,10 +120,10 @@ struct ibm_struct {
|
|||||||
char *hid;
|
char *hid;
|
||||||
struct acpi_driver *driver;
|
struct acpi_driver *driver;
|
||||||
|
|
||||||
int (*init) (struct ibm_struct *);
|
int (*init) (struct ibm_struct *);
|
||||||
int (*read) (struct ibm_struct *, char *);
|
int (*read) (struct ibm_struct *, char *);
|
||||||
int (*write) (struct ibm_struct *, char *);
|
int (*write) (struct ibm_struct *, char *);
|
||||||
void (*exit) (struct ibm_struct *);
|
void (*exit) (struct ibm_struct *);
|
||||||
|
|
||||||
void (*notify) (struct ibm_struct *, u32);
|
void (*notify) (struct ibm_struct *, u32);
|
||||||
acpi_handle *handle;
|
acpi_handle *handle;
|
||||||
@@ -165,15 +159,15 @@ static int acpi_evalf(acpi_handle handle,
|
|||||||
void *res, char *method, char *fmt, ...)
|
void *res, char *method, char *fmt, ...)
|
||||||
{
|
{
|
||||||
char *fmt0 = fmt;
|
char *fmt0 = fmt;
|
||||||
struct acpi_object_list params;
|
struct acpi_object_list params;
|
||||||
union acpi_object in_objs[IBM_MAX_ACPI_ARGS];
|
union acpi_object in_objs[IBM_MAX_ACPI_ARGS];
|
||||||
struct acpi_buffer result;
|
struct acpi_buffer result;
|
||||||
union acpi_object out_obj;
|
union acpi_object out_obj;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char res_type;
|
char res_type;
|
||||||
int success;
|
int success;
|
||||||
int quiet;
|
int quiet;
|
||||||
|
|
||||||
if (!*fmt) {
|
if (!*fmt) {
|
||||||
printk(IBM_ERR "acpi_evalf() called with empty format\n");
|
printk(IBM_ERR "acpi_evalf() called with empty format\n");
|
||||||
@@ -199,7 +193,7 @@ static int acpi_evalf(acpi_handle handle,
|
|||||||
in_objs[params.count].integer.value = va_arg(ap, int);
|
in_objs[params.count].integer.value = va_arg(ap, int);
|
||||||
in_objs[params.count++].type = ACPI_TYPE_INTEGER;
|
in_objs[params.count++].type = ACPI_TYPE_INTEGER;
|
||||||
break;
|
break;
|
||||||
/* add more types as needed */
|
/* add more types as needed */
|
||||||
default:
|
default:
|
||||||
printk(IBM_ERR "acpi_evalf() called "
|
printk(IBM_ERR "acpi_evalf() called "
|
||||||
"with invalid format character '%c'\n", c);
|
"with invalid format character '%c'\n", c);
|
||||||
@@ -214,15 +208,15 @@ static int acpi_evalf(acpi_handle handle,
|
|||||||
status = acpi_evaluate_object(handle, method, ¶ms, &result);
|
status = acpi_evaluate_object(handle, method, ¶ms, &result);
|
||||||
|
|
||||||
switch (res_type) {
|
switch (res_type) {
|
||||||
case 'd': /* int */
|
case 'd': /* int */
|
||||||
if (res)
|
if (res)
|
||||||
*(int *)res = out_obj.integer.value;
|
*(int *)res = out_obj.integer.value;
|
||||||
success = status == AE_OK && out_obj.type == ACPI_TYPE_INTEGER;
|
success = status == AE_OK && out_obj.type == ACPI_TYPE_INTEGER;
|
||||||
break;
|
break;
|
||||||
case 'v': /* void */
|
case 'v': /* void */
|
||||||
success = status == AE_OK;
|
success = status == AE_OK;
|
||||||
break;
|
break;
|
||||||
/* add more types as needed */
|
/* add more types as needed */
|
||||||
default:
|
default:
|
||||||
printk(IBM_ERR "acpi_evalf() called "
|
printk(IBM_ERR "acpi_evalf() called "
|
||||||
"with invalid format character '%c'\n", res_type);
|
"with invalid format character '%c'\n", res_type);
|
||||||
@@ -303,9 +297,9 @@ static int hotkey_set(struct ibm_struct *ibm, int status, int mask)
|
|||||||
if (!ibm->supported)
|
if (!ibm->supported)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i=0; i<32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
int bit = ((1 << i) & mask) != 0;
|
int bit = ((1 << i) & mask) != 0;
|
||||||
if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i+1, bit))
|
if (!acpi_evalf(hkey_handle, NULL, "MHKM", "vdd", i + 1, bit))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,8 +312,7 @@ static int hotkey_init(struct ibm_struct *ibm)
|
|||||||
|
|
||||||
ibm->supported = 1;
|
ibm->supported = 1;
|
||||||
ret = hotkey_get(ibm,
|
ret = hotkey_get(ibm,
|
||||||
&ibm->state.hotkey.status,
|
&ibm->state.hotkey.status, &ibm->state.hotkey.mask);
|
||||||
&ibm->state.hotkey.mask);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
/* mask not supported on A21e, A22p, T20, T21, X20, X22, X24 */
|
/* mask not supported on A21e, A22p, T20, T21, X20, X22, X24 */
|
||||||
ibm->supported = 0;
|
ibm->supported = 0;
|
||||||
@@ -368,7 +361,7 @@ static int hotkey_write(struct ibm_struct *ibm, char *buf)
|
|||||||
status = 0;
|
status = 0;
|
||||||
} else if (strlencmp(cmd, "reset") == 0) {
|
} else if (strlencmp(cmd, "reset") == 0) {
|
||||||
status = ibm->state.hotkey.status;
|
status = ibm->state.hotkey.status;
|
||||||
mask = ibm->state.hotkey.mask;
|
mask = ibm->state.hotkey.mask;
|
||||||
} else if (sscanf(cmd, "0x%x", &mask) == 1) {
|
} else if (sscanf(cmd, "0x%x", &mask) == 1) {
|
||||||
/* mask set */
|
/* mask set */
|
||||||
} else if (sscanf(cmd, "%x", &mask) == 1) {
|
} else if (sscanf(cmd, "%x", &mask) == 1) {
|
||||||
@@ -456,15 +449,14 @@ static int bluetooth_write(struct ibm_struct *ibm, char *buf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
|
if (do_cmd && !acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int video_init(struct ibm_struct *ibm)
|
static int video_init(struct ibm_struct *ibm)
|
||||||
{
|
{
|
||||||
if (!acpi_evalf(vid_handle,
|
if (!acpi_evalf(vid_handle, &ibm->state.video.autoswitch, "^VDEE", "d"))
|
||||||
&ibm->state.video.autoswitch, "^VDEE", "d"))
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -566,8 +558,7 @@ static int video_write(struct ibm_struct *ibm, char *buf)
|
|||||||
|
|
||||||
static void video_exit(struct ibm_struct *ibm)
|
static void video_exit(struct ibm_struct *ibm)
|
||||||
{
|
{
|
||||||
acpi_evalf(vid_handle, NULL, "_DOS", "vd",
|
acpi_evalf(vid_handle, NULL, "_DOS", "vd", ibm->state.video.autoswitch);
|
||||||
ibm->state.video.autoswitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int light_init(struct ibm_struct *ibm)
|
static int light_init(struct ibm_struct *ibm)
|
||||||
@@ -612,8 +603,8 @@ static int light_write(struct ibm_struct *ibm, char *buf)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
success = cmos_handle ?
|
success = cmos_handle ?
|
||||||
acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) :
|
acpi_evalf(cmos_handle, NULL, NULL, "vd", cmos_cmd) :
|
||||||
acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd);
|
acpi_evalf(lght_handle, NULL, NULL, "vd", lght_cmd);
|
||||||
if (!success)
|
if (!success)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
@@ -678,15 +669,15 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
|
|||||||
int docked = dock_docked();
|
int docked = dock_docked();
|
||||||
|
|
||||||
if (event == 3 && docked)
|
if (event == 3 && docked)
|
||||||
acpi_bus_generate_event(ibm->device, event, 1); /* button */
|
acpi_bus_generate_event(ibm->device, event, 1); /* button */
|
||||||
else if (event == 3 && !docked)
|
else if (event == 3 && !docked)
|
||||||
acpi_bus_generate_event(ibm->device, event, 2); /* undock */
|
acpi_bus_generate_event(ibm->device, event, 2); /* undock */
|
||||||
else if (event == 0 && docked)
|
else if (event == 0 && docked)
|
||||||
acpi_bus_generate_event(ibm->device, event, 3); /* dock */
|
acpi_bus_generate_event(ibm->device, event, 3); /* dock */
|
||||||
else {
|
else {
|
||||||
printk(IBM_ERR "unknown dock event %d, status %d\n",
|
printk(IBM_ERR "unknown dock event %d, status %d\n",
|
||||||
event, _sta(dock_handle));
|
event, _sta(dock_handle));
|
||||||
acpi_bus_generate_event(ibm->device, event, 0); /* unknown */
|
acpi_bus_generate_event(ibm->device, event, 0); /* unknown */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +687,7 @@ static int bay_init(struct ibm_struct *ibm)
|
|||||||
{
|
{
|
||||||
/* bay not supported on A21e, A22p, A31, A31p, G40, R32, R40e */
|
/* bay not supported on A21e, A22p, A31, A31p, G40, R32, R40e */
|
||||||
ibm->supported = bay_handle && bayej_handle &&
|
ibm->supported = bay_handle && bayej_handle &&
|
||||||
acpi_evalf(bay_handle, NULL, "_STA", "qv");
|
acpi_evalf(bay_handle, NULL, "_STA", "qv");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -858,76 +849,77 @@ static int beep_write(struct ibm_struct *ibm, char *buf)
|
|||||||
|
|
||||||
static struct ibm_struct ibms[] = {
|
static struct ibm_struct ibms[] = {
|
||||||
{
|
{
|
||||||
.name = "driver",
|
.name = "driver",
|
||||||
.init = driver_init,
|
.init = driver_init,
|
||||||
.read = driver_read,
|
.read = driver_read,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "hotkey",
|
.name = "hotkey",
|
||||||
.hid = "IBM0068",
|
.hid = "IBM0068",
|
||||||
.init = hotkey_init,
|
.init = hotkey_init,
|
||||||
.read = hotkey_read,
|
.read = hotkey_read,
|
||||||
.write = hotkey_write,
|
.write = hotkey_write,
|
||||||
.exit = hotkey_exit,
|
.exit = hotkey_exit,
|
||||||
.notify = hotkey_notify,
|
.notify = hotkey_notify,
|
||||||
.handle = &hkey_handle,
|
.handle = &hkey_handle,
|
||||||
.type = ACPI_DEVICE_NOTIFY,
|
.type = ACPI_DEVICE_NOTIFY,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "bluetooth",
|
.name = "bluetooth",
|
||||||
.init = bluetooth_init,
|
.init = bluetooth_init,
|
||||||
.read = bluetooth_read,
|
.read = bluetooth_read,
|
||||||
.write = bluetooth_write,
|
.write = bluetooth_write,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "video",
|
.name = "video",
|
||||||
.init = video_init,
|
.init = video_init,
|
||||||
.read = video_read,
|
.read = video_read,
|
||||||
.write = video_write,
|
.write = video_write,
|
||||||
.exit = video_exit,
|
.exit = video_exit,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "light",
|
.name = "light",
|
||||||
.init = light_init,
|
.init = light_init,
|
||||||
.read = light_read,
|
.read = light_read,
|
||||||
.write = light_write,
|
.write = light_write,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "dock",
|
.name = "dock",
|
||||||
.read = dock_read,
|
.read = dock_read,
|
||||||
.write = dock_write,
|
.write = dock_write,
|
||||||
.notify = dock_notify,
|
.notify = dock_notify,
|
||||||
.handle = &dock_handle,
|
.handle = &dock_handle,
|
||||||
.type = ACPI_SYSTEM_NOTIFY,
|
.type = ACPI_SYSTEM_NOTIFY,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "bay",
|
.name = "bay",
|
||||||
.init = bay_init,
|
.init = bay_init,
|
||||||
.read = bay_read,
|
.read = bay_read,
|
||||||
.write = bay_write,
|
.write = bay_write,
|
||||||
.notify = bay_notify,
|
.notify = bay_notify,
|
||||||
.handle = &bay_handle,
|
.handle = &bay_handle,
|
||||||
.type = ACPI_SYSTEM_NOTIFY,
|
.type = ACPI_SYSTEM_NOTIFY,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "cmos",
|
.name = "cmos",
|
||||||
.read = cmos_read,
|
.read = cmos_read,
|
||||||
.write = cmos_write,
|
.write = cmos_write,
|
||||||
.experimental = 1,
|
.experimental = 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "led",
|
.name = "led",
|
||||||
.read = led_read,
|
.read = led_read,
|
||||||
.write = led_write,
|
.write = led_write,
|
||||||
.experimental = 1,
|
.experimental = 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.name = "beep",
|
.name = "beep",
|
||||||
.read = beep_read,
|
.read = beep_read,
|
||||||
.write = beep_write,
|
.write = beep_write,
|
||||||
.experimental = 1,
|
.experimental = 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NUM_IBMS (sizeof(ibms)/sizeof(ibms[0]))
|
#define NUM_IBMS (sizeof(ibms)/sizeof(ibms[0]))
|
||||||
|
|
||||||
static int dispatch_read(char *page, char **start, off_t off, int count,
|
static int dispatch_read(char *page, char **start, off_t off, int count,
|
||||||
@@ -955,7 +947,7 @@ static int dispatch_read(char *page, char **start, off_t off, int count,
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dispatch_write(struct file *file, const char __user *userbuf,
|
static int dispatch_write(struct file *file, const char __user * userbuf,
|
||||||
unsigned long count, void *data)
|
unsigned long count, void *data)
|
||||||
{
|
{
|
||||||
struct ibm_struct *ibm = (struct ibm_struct *)data;
|
struct ibm_struct *ibm = (struct ibm_struct *)data;
|
||||||
@@ -969,9 +961,9 @@ static int dispatch_write(struct file *file, const char __user *userbuf,
|
|||||||
if (!kernbuf)
|
if (!kernbuf)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (copy_from_user(kernbuf, userbuf, count)) {
|
if (copy_from_user(kernbuf, userbuf, count)) {
|
||||||
kfree(kernbuf);
|
kfree(kernbuf);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
kernbuf[count] = 0;
|
kernbuf[count] = 0;
|
||||||
@@ -982,7 +974,7 @@ static int dispatch_write(struct file *file, const char __user *userbuf,
|
|||||||
|
|
||||||
kfree(kernbuf);
|
kfree(kernbuf);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dispatch_notify(acpi_handle handle, u32 event, void *data)
|
static void dispatch_notify(acpi_handle handle, u32 event, void *data)
|
||||||
@@ -1120,13 +1112,13 @@ static void ibm_exit(struct ibm_struct *ibm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ibm_handle_init(char *name,
|
static int ibm_handle_init(char *name,
|
||||||
acpi_handle *handle, acpi_handle parent,
|
acpi_handle * handle, acpi_handle parent,
|
||||||
char **paths, int num_paths, int required)
|
char **paths, int num_paths, int required)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
for (i=0; i<num_paths; i++) {
|
for (i = 0; i < num_paths; i++) {
|
||||||
status = acpi_get_handle(parent, paths[i], handle);
|
status = acpi_get_handle(parent, paths[i], handle);
|
||||||
if (ACPI_SUCCESS(status))
|
if (ACPI_SUCCESS(status))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1146,7 +1138,6 @@ static int ibm_handle_init(char *name,
|
|||||||
ibm_handle_init(#object, &object##_handle, *object##_parent, \
|
ibm_handle_init(#object, &object##_handle, *object##_parent, \
|
||||||
object##_paths, sizeof(object##_paths)/sizeof(char*), required)
|
object##_paths, sizeof(object##_paths)/sizeof(char*), required)
|
||||||
|
|
||||||
|
|
||||||
static int set_ibm_param(const char *val, struct kernel_param *kp)
|
static int set_ibm_param(const char *val, struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@@ -1158,7 +1149,7 @@ static int set_ibm_param(const char *val, struct kernel_param *kp)
|
|||||||
strcpy(arg_with_comma, val);
|
strcpy(arg_with_comma, val);
|
||||||
strcat(arg_with_comma, ",");
|
strcat(arg_with_comma, ",");
|
||||||
|
|
||||||
for (i=0; i<NUM_IBMS; i++)
|
for (i = 0; i < NUM_IBMS; i++)
|
||||||
if (strcmp(ibms[i].name, kp->name) == 0)
|
if (strcmp(ibms[i].name, kp->name) == 0)
|
||||||
return ibms[i].write(&ibms[i], arg_with_comma);
|
return ibms[i].write(&ibms[i], arg_with_comma);
|
||||||
BUG();
|
BUG();
|
||||||
@@ -1172,7 +1163,7 @@ static void acpi_ibm_exit(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=NUM_IBMS-1; i>=0; i--)
|
for (i = NUM_IBMS - 1; i >= 0; i--)
|
||||||
ibm_exit(&ibms[i]);
|
ibm_exit(&ibms[i]);
|
||||||
|
|
||||||
remove_proc_entry(IBM_DIR, acpi_root_dir);
|
remove_proc_entry(IBM_DIR, acpi_root_dir);
|
||||||
@@ -1185,15 +1176,14 @@ static int __init acpi_ibm_init(void)
|
|||||||
if (acpi_disabled)
|
if (acpi_disabled)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (!acpi_specific_hotkey_enabled){
|
if (!acpi_specific_hotkey_enabled) {
|
||||||
printk(IBM_ERR "Using generic hotkey driver\n");
|
printk(IBM_ERR "Using generic hotkey driver\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
/* these handles are required */
|
/* these handles are required */
|
||||||
if (IBM_HANDLE_INIT(ec, 1) < 0 ||
|
if (IBM_HANDLE_INIT(ec, 1) < 0 ||
|
||||||
IBM_HANDLE_INIT(hkey, 1) < 0 ||
|
IBM_HANDLE_INIT(hkey, 1) < 0 ||
|
||||||
IBM_HANDLE_INIT(vid, 1) < 0 ||
|
IBM_HANDLE_INIT(vid, 1) < 0 || IBM_HANDLE_INIT(beep, 1) < 0)
|
||||||
IBM_HANDLE_INIT(beep, 1) < 0)
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* these handles have alternatives */
|
/* these handles have alternatives */
|
||||||
@@ -1205,10 +1195,10 @@ static int __init acpi_ibm_init(void)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
/* these handles are not required */
|
/* these handles are not required */
|
||||||
IBM_HANDLE_INIT(dock, 0);
|
IBM_HANDLE_INIT(dock, 0);
|
||||||
IBM_HANDLE_INIT(bay, 0);
|
IBM_HANDLE_INIT(bay, 0);
|
||||||
IBM_HANDLE_INIT(bayej, 0);
|
IBM_HANDLE_INIT(bayej, 0);
|
||||||
IBM_HANDLE_INIT(bled, 0);
|
IBM_HANDLE_INIT(bled, 0);
|
||||||
|
|
||||||
proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
|
proc_dir = proc_mkdir(IBM_DIR, acpi_root_dir);
|
||||||
if (!proc_dir) {
|
if (!proc_dir) {
|
||||||
@@ -1217,7 +1207,7 @@ static int __init acpi_ibm_init(void)
|
|||||||
}
|
}
|
||||||
proc_dir->owner = THIS_MODULE;
|
proc_dir->owner = THIS_MODULE;
|
||||||
|
|
||||||
for (i=0; i<NUM_IBMS; i++) {
|
for (i = 0; i < NUM_IBMS; i++) {
|
||||||
ret = ibm_init(&ibms[i]);
|
ret = ibm_init(&ibms[i]);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
acpi_ibm_exit();
|
acpi_ibm_exit();
|
||||||
|
|||||||
@@ -30,12 +30,11 @@
|
|||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||||
ACPI_MODULE_NAME ("acpi_motherboard")
|
ACPI_MODULE_NAME("acpi_motherboard")
|
||||||
|
|
||||||
/* Dell use PNP0C01 instead of PNP0C02 */
|
/* Dell use PNP0C01 instead of PNP0C02 */
|
||||||
#define ACPI_MB_HID1 "PNP0C01"
|
#define ACPI_MB_HID1 "PNP0C01"
|
||||||
#define ACPI_MB_HID2 "PNP0C02"
|
#define ACPI_MB_HID2 "PNP0C02"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Doesn't care about legacy IO ports, only IO ports beyond 0x1000 are reserved
|
* 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
|
* 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) \
|
#define IS_RESERVED_ADDR(base, len) \
|
||||||
(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
|
(((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \
|
||||||
&& ((base) + (len) > 0x1000))
|
&& ((base) + (len) > 0x1000))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clearing the flag (IORESOURCE_BUSY) allows drivers to use
|
* Clearing the flag (IORESOURCE_BUSY) allows drivers to use
|
||||||
* the io ports if they really know they can use it, while
|
* the io ports if they really know they can use it, while
|
||||||
* still preventing hotplug PCI devices from using it.
|
* 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;
|
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)
|
if (io_res->min_base_address != io_res->max_base_address)
|
||||||
return_VALUE(AE_OK);
|
return_VALUE(AE_OK);
|
||||||
if (IS_RESERVED_ADDR(io_res->min_base_address, io_res->range_length)) {
|
if (IS_RESERVED_ADDR
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
|
(io_res->min_base_address, io_res->range_length)) {
|
||||||
io_res->min_base_address,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
io_res->min_base_address + io_res->range_length));
|
"Motherboard resources 0x%08x - 0x%08x\n",
|
||||||
requested_res = request_region(io_res->min_base_address,
|
io_res->min_base_address,
|
||||||
io_res->range_length, "motherboard");
|
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) {
|
} 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)) {
|
if (IS_RESERVED_ADDR
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Motherboard resources 0x%08x - 0x%08x\n",
|
(fixed_io_res->base_address, fixed_io_res->range_length)) {
|
||||||
fixed_io_res->base_address,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
fixed_io_res->base_address + fixed_io_res->range_length));
|
"Motherboard resources 0x%08x - 0x%08x\n",
|
||||||
requested_res = request_region(fixed_io_res->base_address,
|
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 {
|
} else {
|
||||||
/* Memory mapped IO? */
|
/* Memory mapped IO? */
|
||||||
@@ -89,72 +95,70 @@ acpi_reserve_io_ranges (struct acpi_resource *res, void *data)
|
|||||||
return_VALUE(AE_OK);
|
return_VALUE(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int acpi_motherboard_add (struct acpi_device *device)
|
static int acpi_motherboard_add(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
if (!device)
|
if (!device)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
acpi_walk_resources(device->handle, METHOD_NAME__CRS,
|
acpi_walk_resources(device->handle, METHOD_NAME__CRS,
|
||||||
acpi_reserve_io_ranges, NULL);
|
acpi_reserve_io_ranges, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct acpi_driver acpi_motherboard_driver1 = {
|
static struct acpi_driver acpi_motherboard_driver1 = {
|
||||||
.name = "motherboard",
|
.name = "motherboard",
|
||||||
.class = "",
|
.class = "",
|
||||||
.ids = ACPI_MB_HID1,
|
.ids = ACPI_MB_HID1,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_motherboard_add,
|
.add = acpi_motherboard_add,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct acpi_driver acpi_motherboard_driver2 = {
|
static struct acpi_driver acpi_motherboard_driver2 = {
|
||||||
.name = "motherboard",
|
.name = "motherboard",
|
||||||
.class = "",
|
.class = "",
|
||||||
.ids = ACPI_MB_HID2,
|
.ids = ACPI_MB_HID2,
|
||||||
.ops = {
|
.ops = {
|
||||||
.add = acpi_motherboard_add,
|
.add = acpi_motherboard_add,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init
|
static void __init acpi_reserve_resources(void)
|
||||||
acpi_reserve_resources (void)
|
|
||||||
{
|
{
|
||||||
if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
|
if (acpi_gbl_FADT->xpm1a_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
|
||||||
request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
|
request_region(acpi_gbl_FADT->xpm1a_evt_blk.address,
|
||||||
acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
|
acpi_gbl_FADT->pm1_evt_len, "PM1a_EVT_BLK");
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
|
if (acpi_gbl_FADT->xpm1b_evt_blk.address && acpi_gbl_FADT->pm1_evt_len)
|
||||||
request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
|
request_region(acpi_gbl_FADT->xpm1b_evt_blk.address,
|
||||||
acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
|
acpi_gbl_FADT->pm1_evt_len, "PM1b_EVT_BLK");
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
|
if (acpi_gbl_FADT->xpm1a_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
|
||||||
request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address,
|
request_region(acpi_gbl_FADT->xpm1a_cnt_blk.address,
|
||||||
acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
|
acpi_gbl_FADT->pm1_cnt_len, "PM1a_CNT_BLK");
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
|
if (acpi_gbl_FADT->xpm1b_cnt_blk.address && acpi_gbl_FADT->pm1_cnt_len)
|
||||||
request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address,
|
request_region(acpi_gbl_FADT->xpm1b_cnt_blk.address,
|
||||||
acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
|
acpi_gbl_FADT->pm1_cnt_len, "PM1b_CNT_BLK");
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
|
if (acpi_gbl_FADT->xpm_tmr_blk.address && acpi_gbl_FADT->pm_tm_len == 4)
|
||||||
request_region(acpi_gbl_FADT->xpm_tmr_blk.address,
|
request_region(acpi_gbl_FADT->xpm_tmr_blk.address, 4, "PM_TMR");
|
||||||
4, "PM_TMR");
|
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
|
if (acpi_gbl_FADT->xpm2_cnt_blk.address && acpi_gbl_FADT->pm2_cnt_len)
|
||||||
request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
|
request_region(acpi_gbl_FADT->xpm2_cnt_blk.address,
|
||||||
acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
|
acpi_gbl_FADT->pm2_cnt_len, "PM2_CNT_BLK");
|
||||||
|
|
||||||
/* Length of GPE blocks must be a non-negative multiple of 2 */
|
/* Length of GPE blocks must be a non-negative multiple of 2 */
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
|
if (acpi_gbl_FADT->xgpe0_blk.address && acpi_gbl_FADT->gpe0_blk_len &&
|
||||||
!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
|
!(acpi_gbl_FADT->gpe0_blk_len & 0x1))
|
||||||
request_region(acpi_gbl_FADT->xgpe0_blk.address,
|
request_region(acpi_gbl_FADT->xgpe0_blk.address,
|
||||||
acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
|
acpi_gbl_FADT->gpe0_blk_len, "GPE0_BLK");
|
||||||
|
|
||||||
if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
|
if (acpi_gbl_FADT->xgpe1_blk.address && acpi_gbl_FADT->gpe1_blk_len &&
|
||||||
!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
|
!(acpi_gbl_FADT->gpe1_blk_len & 0x1))
|
||||||
request_region(acpi_gbl_FADT->xgpe1_blk.address,
|
request_region(acpi_gbl_FADT->xgpe1_blk.address,
|
||||||
acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
|
acpi_gbl_FADT->gpe1_blk_len, "GPE1_BLK");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init acpi_motherboard_init(void)
|
static int __init acpi_motherboard_init(void)
|
||||||
@@ -166,7 +170,7 @@ static int __init acpi_motherboard_init(void)
|
|||||||
* This module must run after scan.c
|
* This module must run after scan.c
|
||||||
*/
|
*/
|
||||||
if (!acpi_disabled)
|
if (!acpi_disabled)
|
||||||
acpi_reserve_resources ();
|
acpi_reserve_resources();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,16 +41,13 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsaccess")
|
ACPI_MODULE_NAME("nsaccess")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -65,24 +62,19 @@
|
|||||||
* MUTEX: Locks namespace for entire execution
|
* MUTEX: Locks namespace for entire execution
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
acpi_status acpi_ns_root_initialize(void)
|
||||||
acpi_status
|
|
||||||
acpi_ns_root_initialize (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
const struct acpi_predefined_names *init_val = NULL;
|
const struct acpi_predefined_names *init_val = NULL;
|
||||||
struct acpi_namespace_node *new_node;
|
struct acpi_namespace_node *new_node;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
acpi_string val = NULL;
|
acpi_string val = NULL;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_root_initialize");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_root_initialize");
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -102,24 +94,26 @@ acpi_ns_root_initialize (
|
|||||||
|
|
||||||
/* Enter the pre-defined names in the name table */
|
/* Enter the pre-defined names in the name table */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Entering predefined entries into namespace\n"));
|
"Entering predefined entries into namespace\n"));
|
||||||
|
|
||||||
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
|
for (init_val = acpi_gbl_pre_defined_names; init_val->name; init_val++) {
|
||||||
/* _OSI is optional for now, will be permanent later */
|
/* _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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_lookup (NULL, init_val->name, init_val->type,
|
status = acpi_ns_lookup(NULL, init_val->name, init_val->type,
|
||||||
ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
|
ACPI_IMODE_LOAD_PASS2,
|
||||||
NULL, &new_node);
|
ACPI_NS_NO_UPSEARCH, NULL, &new_node);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status) || (!new_node)) /* Must be on same line for code converter */ {
|
if (ACPI_FAILURE(status) || (!new_node)) { /* Must be on same line for code converter */
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not create predefined name %s, %s\n",
|
"Could not create predefined name %s, %s\n",
|
||||||
init_val->name, acpi_format_exception (status)));
|
init_val->name,
|
||||||
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,11 +122,11 @@ acpi_ns_root_initialize (
|
|||||||
* initial value, create the initial value.
|
* initial value, create the initial value.
|
||||||
*/
|
*/
|
||||||
if (init_val->val) {
|
if (init_val->val) {
|
||||||
status = acpi_os_predefined_override (init_val, &val);
|
status = acpi_os_predefined_override(init_val, &val);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not override predefined %s\n",
|
"Could not override predefined %s\n",
|
||||||
init_val->name));
|
init_val->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!val) {
|
if (!val) {
|
||||||
@@ -143,7 +137,8 @@ acpi_ns_root_initialize (
|
|||||||
* Entry requests an initial value, allocate a
|
* Entry requests an initial value, allocate a
|
||||||
* descriptor for it.
|
* 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) {
|
if (!obj_desc) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -156,7 +151,8 @@ acpi_ns_root_initialize (
|
|||||||
*/
|
*/
|
||||||
switch (init_val->type) {
|
switch (init_val->type) {
|
||||||
case ACPI_TYPE_METHOD:
|
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;
|
obj_desc->common.flags |= AOPOBJ_DATA_VALID;
|
||||||
|
|
||||||
#if defined (ACPI_ASL_COMPILER)
|
#if defined (ACPI_ASL_COMPILER)
|
||||||
@@ -167,45 +163,50 @@ acpi_ns_root_initialize (
|
|||||||
#else
|
#else
|
||||||
/* Mark this as a very SPECIAL method */
|
/* 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
|
#ifndef ACPI_DUMP_APP
|
||||||
obj_desc->method.implementation = acpi_ut_osi_implementation;
|
obj_desc->method.implementation =
|
||||||
|
acpi_ut_osi_implementation;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
obj_desc->integer.value = ACPI_TO_INTEGER (val);
|
obj_desc->integer.value = ACPI_TO_INTEGER(val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build an object around the static 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->string.pointer = val;
|
||||||
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
|
obj_desc->common.flags |= AOPOBJ_STATIC_POINTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_MUTEX:
|
case ACPI_TYPE_MUTEX:
|
||||||
|
|
||||||
obj_desc->mutex.node = new_node;
|
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) {
|
if (ACPI_STRCMP(init_val->name, "_GL_") == 0) {
|
||||||
/*
|
/*
|
||||||
* Create a counting semaphore for the
|
* Create a counting semaphore for the
|
||||||
* global lock
|
* global lock
|
||||||
*/
|
*/
|
||||||
status = acpi_os_create_semaphore (ACPI_NO_UNIT_LIMIT,
|
status =
|
||||||
1, &obj_desc->mutex.semaphore);
|
acpi_os_create_semaphore
|
||||||
if (ACPI_FAILURE (status)) {
|
(ACPI_NO_UNIT_LIMIT, 1,
|
||||||
acpi_ut_remove_reference (obj_desc);
|
&obj_desc->mutex.semaphore);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_ut_remove_reference
|
||||||
|
(obj_desc);
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,56 +214,58 @@ acpi_ns_root_initialize (
|
|||||||
* We just created the mutex for the
|
* We just created the mutex for the
|
||||||
* global lock, save it
|
* global lock, save it
|
||||||
*/
|
*/
|
||||||
acpi_gbl_global_lock_semaphore = obj_desc->mutex.semaphore;
|
acpi_gbl_global_lock_semaphore =
|
||||||
}
|
obj_desc->mutex.semaphore;
|
||||||
else {
|
} else {
|
||||||
/* Create a mutex */
|
/* Create a mutex */
|
||||||
|
|
||||||
status = acpi_os_create_semaphore (1, 1,
|
status = acpi_os_create_semaphore(1, 1,
|
||||||
&obj_desc->mutex.semaphore);
|
&obj_desc->
|
||||||
if (ACPI_FAILURE (status)) {
|
mutex.
|
||||||
acpi_ut_remove_reference (obj_desc);
|
semaphore);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_ut_remove_reference
|
||||||
|
(obj_desc);
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
|
ACPI_REPORT_ERROR(("Unsupported initial type value %X\n", init_val->type));
|
||||||
init_val->type));
|
acpi_ut_remove_reference(obj_desc);
|
||||||
acpi_ut_remove_reference (obj_desc);
|
|
||||||
obj_desc = NULL;
|
obj_desc = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store pointer to value descriptor in the Node */
|
/* Store pointer to value descriptor in the Node */
|
||||||
|
|
||||||
status = acpi_ns_attach_object (new_node, obj_desc,
|
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 */
|
/* Remove local reference to the object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
|
||||||
|
|
||||||
/* Save a handle to "_GPE", it is always present */
|
/* Save a handle to "_GPE", it is always present */
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
status = acpi_ns_get_node_by_path ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
|
status =
|
||||||
&acpi_gbl_fadt_gpe_device);
|
acpi_ns_get_node_by_path("\\_GPE", NULL,
|
||||||
|
ACPI_NS_NO_UPSEARCH,
|
||||||
|
&acpi_gbl_fadt_gpe_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_lookup
|
* FUNCTION: acpi_ns_lookup
|
||||||
@@ -287,62 +290,57 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_lookup (
|
acpi_ns_lookup(union acpi_generic_state *scope_info,
|
||||||
union acpi_generic_state *scope_info,
|
char *pathname,
|
||||||
char *pathname,
|
acpi_object_type type,
|
||||||
acpi_object_type type,
|
acpi_interpreter_mode interpreter_mode,
|
||||||
acpi_interpreter_mode interpreter_mode,
|
u32 flags,
|
||||||
u32 flags,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
struct acpi_namespace_node **return_node)
|
||||||
struct acpi_namespace_node **return_node)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
char *path = pathname;
|
char *path = pathname;
|
||||||
struct acpi_namespace_node *prefix_node;
|
struct acpi_namespace_node *prefix_node;
|
||||||
struct acpi_namespace_node *current_node = NULL;
|
struct acpi_namespace_node *current_node = NULL;
|
||||||
struct acpi_namespace_node *this_node = NULL;
|
struct acpi_namespace_node *this_node = NULL;
|
||||||
u32 num_segments;
|
u32 num_segments;
|
||||||
u32 num_carats;
|
u32 num_carats;
|
||||||
acpi_name simple_name;
|
acpi_name simple_name;
|
||||||
acpi_object_type type_to_check_for;
|
acpi_object_type type_to_check_for;
|
||||||
acpi_object_type this_search_type;
|
acpi_object_type this_search_type;
|
||||||
u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
|
u32 search_parent_flag = ACPI_NS_SEARCH_PARENT;
|
||||||
u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
|
u32 local_flags = flags & ~(ACPI_NS_ERROR_IF_FOUND |
|
||||||
ACPI_NS_SEARCH_PARENT);
|
ACPI_NS_SEARCH_PARENT);
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_lookup");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_lookup");
|
||||||
|
|
||||||
if (!return_node) {
|
if (!return_node) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_gbl_ns_lookup_count++;
|
acpi_gbl_ns_lookup_count++;
|
||||||
*return_node = ACPI_ENTRY_NOT_FOUND;
|
*return_node = ACPI_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
if (!acpi_gbl_root_node) {
|
if (!acpi_gbl_root_node) {
|
||||||
return_ACPI_STATUS (AE_NO_NAMESPACE);
|
return_ACPI_STATUS(AE_NO_NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the prefix scope.
|
* Get the prefix scope.
|
||||||
* A null scope means use the root scope
|
* A null scope means use the root scope
|
||||||
*/
|
*/
|
||||||
if ((!scope_info) ||
|
if ((!scope_info) || (!scope_info->scope.node)) {
|
||||||
(!scope_info->scope.node)) {
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
"Null scope prefix, using root node (%p)\n",
|
||||||
"Null scope prefix, using root node (%p)\n",
|
acpi_gbl_root_node));
|
||||||
acpi_gbl_root_node));
|
|
||||||
|
|
||||||
prefix_node = acpi_gbl_root_node;
|
prefix_node = acpi_gbl_root_node;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
prefix_node = scope_info->scope.node;
|
prefix_node = scope_info->scope.node;
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (prefix_node) != ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(prefix_node) !=
|
||||||
ACPI_REPORT_ERROR (("ns_lookup: %p is not a namespace node [%s]\n",
|
ACPI_DESC_TYPE_NAMED) {
|
||||||
prefix_node, acpi_ut_get_descriptor_name (prefix_node)));
|
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);
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -350,9 +348,9 @@ acpi_ns_lookup (
|
|||||||
* Device/Method, etc.) It could be a Package or other object node.
|
* Device/Method, etc.) It could be a Package or other object node.
|
||||||
* Backup up the tree to find the containing scope node.
|
* Backup up the tree to find the containing scope node.
|
||||||
*/
|
*/
|
||||||
while (!acpi_ns_opens_scope (prefix_node->type) &&
|
while (!acpi_ns_opens_scope(prefix_node->type) &&
|
||||||
prefix_node->type != ACPI_TYPE_ANY) {
|
prefix_node->type != ACPI_TYPE_ANY) {
|
||||||
prefix_node = acpi_ns_get_parent_node (prefix_node);
|
prefix_node = acpi_ns_get_parent_node(prefix_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,13 +365,13 @@ acpi_ns_lookup (
|
|||||||
/* A Null name_path is allowed and refers to the root */
|
/* A Null name_path is allowed and refers to the root */
|
||||||
|
|
||||||
num_segments = 0;
|
num_segments = 0;
|
||||||
this_node = acpi_gbl_root_node;
|
this_node = acpi_gbl_root_node;
|
||||||
path = "";
|
path = "";
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Null Pathname (Zero segments), Flags=%X\n", flags));
|
"Null Pathname (Zero segments), Flags=%X\n",
|
||||||
}
|
flags));
|
||||||
else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Name pointer is valid (and must be in internal name format)
|
* Name pointer is valid (and must be in internal name format)
|
||||||
*
|
*
|
||||||
@@ -397,15 +395,16 @@ acpi_ns_lookup (
|
|||||||
|
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Path is absolute from root [%p]\n", this_node));
|
"Path is absolute from root [%p]\n",
|
||||||
}
|
this_node));
|
||||||
else {
|
} else {
|
||||||
/* Pathname is relative to current scope, start there */
|
/* Pathname is relative to current scope, start there */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Searching relative to prefix scope [%4.4s] (%p)\n",
|
"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
|
* Handle multiple Parent Prefixes (carat) by just getting
|
||||||
@@ -426,20 +425,20 @@ acpi_ns_lookup (
|
|||||||
/* Backup to the parent node */
|
/* Backup to the parent node */
|
||||||
|
|
||||||
num_carats++;
|
num_carats++;
|
||||||
this_node = acpi_ns_get_parent_node (this_node);
|
this_node = acpi_ns_get_parent_node(this_node);
|
||||||
if (!this_node) {
|
if (!this_node) {
|
||||||
/* Current scope has no parent scope */
|
/* Current scope has no parent scope */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (
|
ACPI_REPORT_ERROR(("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
|
||||||
("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
|
return_ACPI_STATUS(AE_NOT_FOUND);
|
||||||
return_ACPI_STATUS (AE_NOT_FOUND);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
|
if (search_parent_flag == ACPI_NS_NO_UPSEARCH) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Search scope is [%4.4s], path has %d carat(s)\n",
|
"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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,9 +464,9 @@ acpi_ns_lookup (
|
|||||||
num_segments = 0;
|
num_segments = 0;
|
||||||
type = this_node->type;
|
type = this_node->type;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Prefix-only Pathname (Zero name segments), Flags=%X\n",
|
"Prefix-only Pathname (Zero name segments), Flags=%X\n",
|
||||||
flags));
|
flags));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_DUAL_NAME_PREFIX:
|
case AML_DUAL_NAME_PREFIX:
|
||||||
@@ -481,8 +480,9 @@ acpi_ns_lookup (
|
|||||||
num_segments = 2;
|
num_segments = 2;
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Dual Pathname (2 segments, Flags=%X)\n", flags));
|
"Dual Pathname (2 segments, Flags=%X)\n",
|
||||||
|
flags));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_MULTI_NAME_PREFIX_OP:
|
case AML_MULTI_NAME_PREFIX_OP:
|
||||||
@@ -494,12 +494,12 @@ acpi_ns_lookup (
|
|||||||
/* Extract segment count, point to first name segment */
|
/* Extract segment count, point to first name segment */
|
||||||
|
|
||||||
path++;
|
path++;
|
||||||
num_segments = (u32) (u8) *path;
|
num_segments = (u32) (u8) * path;
|
||||||
path++;
|
path++;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Multi Pathname (%d Segments, Flags=%X) \n",
|
"Multi Pathname (%d Segments, Flags=%X) \n",
|
||||||
num_segments, flags));
|
num_segments, flags));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -509,15 +509,15 @@ acpi_ns_lookup (
|
|||||||
*/
|
*/
|
||||||
num_segments = 1;
|
num_segments = 1;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Simple Pathname (1 segment, Flags=%X)\n", flags));
|
"Simple Pathname (1 segment, Flags=%X)\n",
|
||||||
|
flags));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_EXEC (acpi_ns_print_pathname (num_segments, path));
|
ACPI_DEBUG_EXEC(acpi_ns_print_pathname(num_segments, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Search namespace for each segment of the name. Loop through and
|
* Search namespace for each segment of the name. Loop through and
|
||||||
* verify (or add to the namespace) each name segment.
|
* verify (or add to the namespace) each name segment.
|
||||||
@@ -541,7 +541,7 @@ acpi_ns_lookup (
|
|||||||
* requested it AND we have a single, non-fully-qualified name_seg
|
* requested it AND we have a single, non-fully-qualified name_seg
|
||||||
*/
|
*/
|
||||||
if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) &&
|
if ((search_parent_flag != ACPI_NS_NO_UPSEARCH) &&
|
||||||
(flags & ACPI_NS_SEARCH_PARENT)) {
|
(flags & ACPI_NS_SEARCH_PARENT)) {
|
||||||
local_flags |= ACPI_NS_SEARCH_PARENT;
|
local_flags |= ACPI_NS_SEARCH_PARENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,24 +554,28 @@ acpi_ns_lookup (
|
|||||||
|
|
||||||
/* Extract one ACPI name from the front of the pathname */
|
/* Extract one ACPI name from the front of the pathname */
|
||||||
|
|
||||||
ACPI_MOVE_32_TO_32 (&simple_name, path);
|
ACPI_MOVE_32_TO_32(&simple_name, path);
|
||||||
|
|
||||||
/* Try to find the single (4 character) ACPI name */
|
/* Try to find the single (4 character) ACPI name */
|
||||||
|
|
||||||
status = acpi_ns_search_and_enter (simple_name, walk_state, current_node,
|
status =
|
||||||
interpreter_mode, this_search_type, local_flags, &this_node);
|
acpi_ns_search_and_enter(simple_name, walk_state,
|
||||||
if (ACPI_FAILURE (status)) {
|
current_node, interpreter_mode,
|
||||||
|
this_search_type, local_flags,
|
||||||
|
&this_node);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
if (status == AE_NOT_FOUND) {
|
if (status == AE_NOT_FOUND) {
|
||||||
/* Name not found in ACPI namespace */
|
/* Name not found in ACPI namespace */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Name [%4.4s] not found in scope [%4.4s] %p\n",
|
"Name [%4.4s] not found in scope [%4.4s] %p\n",
|
||||||
(char *) &simple_name, (char *) ¤t_node->name,
|
(char *)&simple_name,
|
||||||
current_node));
|
(char *)¤t_node->name,
|
||||||
|
current_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
*return_node = this_node;
|
*return_node = this_node;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -587,19 +591,16 @@ acpi_ns_lookup (
|
|||||||
*
|
*
|
||||||
* Then we have a type mismatch. Just warn and ignore it.
|
* Then we have a type mismatch. Just warn and ignore it.
|
||||||
*/
|
*/
|
||||||
if ((num_segments == 0) &&
|
if ((num_segments == 0) &&
|
||||||
(type_to_check_for != ACPI_TYPE_ANY) &&
|
(type_to_check_for != ACPI_TYPE_ANY) &&
|
||||||
(type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
|
(type_to_check_for != ACPI_TYPE_LOCAL_ALIAS) &&
|
||||||
(type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
|
(type_to_check_for != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
|
||||||
(type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
|
(type_to_check_for != ACPI_TYPE_LOCAL_SCOPE) &&
|
||||||
(this_node->type != ACPI_TYPE_ANY) &&
|
(this_node->type != ACPI_TYPE_ANY) &&
|
||||||
(this_node->type != type_to_check_for)) {
|
(this_node->type != type_to_check_for)) {
|
||||||
/* Complain about a type mismatch */
|
/* Complain about a type mismatch */
|
||||||
|
|
||||||
ACPI_REPORT_WARNING (
|
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)));
|
||||||
("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)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -625,15 +626,16 @@ acpi_ns_lookup (
|
|||||||
* If entry is a type which opens a scope, push the new scope on the
|
* If entry is a type which opens a scope, push the new scope on the
|
||||||
* scope stack.
|
* scope stack.
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_opens_scope (type)) {
|
if (acpi_ns_opens_scope(type)) {
|
||||||
status = acpi_ds_scope_stack_push (this_node, type, walk_state);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ds_scope_stack_push(this_node, type,
|
||||||
return_ACPI_STATUS (status);
|
walk_state);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*return_node = this_node;
|
*return_node = this_node;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,20 +41,14 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsalloc")
|
ACPI_MODULE_NAME("nsalloc")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* 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,31 +62,26 @@ acpi_ns_remove_reference (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
struct acpi_namespace_node *
|
struct acpi_namespace_node *acpi_ns_create_node(u32 name)
|
||||||
acpi_ns_create_node (
|
|
||||||
u32 name)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_create_node");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_create_node");
|
node = ACPI_MEM_CALLOCATE(sizeof(struct acpi_namespace_node));
|
||||||
|
|
||||||
|
|
||||||
node = ACPI_MEM_CALLOCATE (sizeof (struct acpi_namespace_node));
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return_PTR (NULL);
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_allocated++);
|
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_allocated++);
|
||||||
|
|
||||||
node->name.integer = name;
|
node->name.integer = name;
|
||||||
node->reference_count = 1;
|
node->reference_count = 1;
|
||||||
ACPI_SET_DESCRIPTOR_TYPE (node, ACPI_DESC_TYPE_NAMED);
|
ACPI_SET_DESCRIPTOR_TYPE(node, ACPI_DESC_TYPE_NAMED);
|
||||||
|
|
||||||
return_PTR (node);
|
return_PTR(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_delete_node
|
* FUNCTION: acpi_ns_delete_node
|
||||||
@@ -105,19 +94,15 @@ acpi_ns_create_node (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_delete_node(struct acpi_namespace_node *node)
|
||||||
acpi_ns_delete_node (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
struct acpi_namespace_node *prev_node;
|
struct acpi_namespace_node *prev_node;
|
||||||
struct acpi_namespace_node *next_node;
|
struct acpi_namespace_node *next_node;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ns_delete_node", node);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_delete_node", node);
|
parent_node = acpi_ns_get_parent_node(node);
|
||||||
|
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (node);
|
|
||||||
|
|
||||||
prev_node = NULL;
|
prev_node = NULL;
|
||||||
next_node = parent_node->child;
|
next_node = parent_node->child;
|
||||||
@@ -136,32 +121,29 @@ acpi_ns_delete_node (
|
|||||||
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
|
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
|
||||||
prev_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) */
|
/* Node is first child (has no previous peer) */
|
||||||
|
|
||||||
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
|
if (next_node->flags & ANOBJ_END_OF_PEER_LIST) {
|
||||||
/* No peers at all */
|
/* No peers at all */
|
||||||
|
|
||||||
parent_node->child = NULL;
|
parent_node->child = NULL;
|
||||||
}
|
} else { /* Link peer list to parent */
|
||||||
else { /* Link peer list to parent */
|
|
||||||
|
|
||||||
parent_node->child = next_node->peer;
|
parent_node->child = next_node->peer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
|
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Detach an object if there is one then delete the node
|
* Detach an object if there is one then delete the node
|
||||||
*/
|
*/
|
||||||
acpi_ns_detach_object (node);
|
acpi_ns_detach_object(node);
|
||||||
ACPI_MEM_FREE (node);
|
ACPI_MEM_FREE(node);
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_install_node
|
* FUNCTION: acpi_ns_install_node
|
||||||
@@ -182,19 +164,14 @@ acpi_ns_delete_node (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_install_node(struct acpi_walk_state *walk_state, struct acpi_namespace_node *parent_node, /* Parent */
|
||||||
acpi_ns_install_node (
|
struct acpi_namespace_node *node, /* New Child */
|
||||||
struct acpi_walk_state *walk_state,
|
acpi_object_type type)
|
||||||
struct acpi_namespace_node *parent_node, /* Parent */
|
|
||||||
struct acpi_namespace_node *node, /* New Child*/
|
|
||||||
acpi_object_type type)
|
|
||||||
{
|
{
|
||||||
acpi_owner_id owner_id = 0;
|
acpi_owner_id owner_id = 0;
|
||||||
struct acpi_namespace_node *child_node;
|
struct acpi_namespace_node *child_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_install_node");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_install_node");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the owner ID from the Walk state
|
* Get the owner ID from the Walk state
|
||||||
@@ -212,8 +189,7 @@ acpi_ns_install_node (
|
|||||||
parent_node->child = node;
|
parent_node->child = node;
|
||||||
node->flags |= ANOBJ_END_OF_PEER_LIST;
|
node->flags |= ANOBJ_END_OF_PEER_LIST;
|
||||||
node->peer = parent_node;
|
node->peer = parent_node;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
|
while (!(child_node->flags & ANOBJ_END_OF_PEER_LIST)) {
|
||||||
child_node = child_node->peer;
|
child_node = child_node->peer;
|
||||||
}
|
}
|
||||||
@@ -232,24 +208,25 @@ acpi_ns_install_node (
|
|||||||
node->owner_id = owner_id;
|
node->owner_id = owner_id;
|
||||||
node->type = (u8) type;
|
node->type = (u8) type;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"%4.4s (%s) [Node %p Owner %X] added to %4.4s (%s) [Node %p]\n",
|
"%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(node),
|
||||||
acpi_ut_get_node_name (parent_node), acpi_ut_get_type_name (parent_node->type),
|
acpi_ut_get_type_name(node->type), node, owner_id,
|
||||||
parent_node));
|
acpi_ut_get_node_name(parent_node),
|
||||||
|
acpi_ut_get_type_name(parent_node->type),
|
||||||
|
parent_node));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Increment the reference count(s) of all parents up to
|
* Increment the reference count(s) of all parents up to
|
||||||
* the root!
|
* the root!
|
||||||
*/
|
*/
|
||||||
while ((node = acpi_ns_get_parent_node (node)) != NULL) {
|
while ((node = acpi_ns_get_parent_node(node)) != NULL) {
|
||||||
node->reference_count++;
|
node->reference_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_delete_children
|
* FUNCTION: acpi_ns_delete_children
|
||||||
@@ -263,18 +240,14 @@ acpi_ns_install_node (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_delete_children(struct acpi_namespace_node *parent_node)
|
||||||
acpi_ns_delete_children (
|
|
||||||
struct acpi_namespace_node *parent_node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *child_node;
|
struct acpi_namespace_node *child_node;
|
||||||
struct acpi_namespace_node *next_node;
|
struct acpi_namespace_node *next_node;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
u8 flags;
|
u8 flags;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_delete_children", parent_node);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ns_delete_children", parent_node);
|
||||||
|
|
||||||
if (!parent_node) {
|
if (!parent_node) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
@@ -293,48 +266,48 @@ acpi_ns_delete_children (
|
|||||||
do {
|
do {
|
||||||
/* Get the things we need */
|
/* Get the things we need */
|
||||||
|
|
||||||
next_node = child_node->peer;
|
next_node = child_node->peer;
|
||||||
flags = child_node->flags;
|
flags = child_node->flags;
|
||||||
|
|
||||||
/* Grandchildren should have all been deleted already */
|
/* Grandchildren should have all been deleted already */
|
||||||
|
|
||||||
if (child_node->child) {
|
if (child_node->child) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
parent_node, child_node));
|
"Found a grandchild! P=%p C=%p\n",
|
||||||
|
parent_node, child_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we can free this child object */
|
/* Now we can free this child object */
|
||||||
|
|
||||||
ACPI_MEM_TRACKING (acpi_gbl_ns_node_list->total_freed++);
|
ACPI_MEM_TRACKING(acpi_gbl_ns_node_list->total_freed++);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
|
||||||
child_node, acpi_gbl_current_node_count));
|
"Object %p, Remaining %X\n", child_node,
|
||||||
|
acpi_gbl_current_node_count));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Detach an object if there is one, then free the child node
|
* Detach an object if there is one, then free the child node
|
||||||
*/
|
*/
|
||||||
acpi_ns_detach_object (child_node);
|
acpi_ns_detach_object(child_node);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decrement the reference count(s) of all parents up to
|
* Decrement the reference count(s) of all parents up to
|
||||||
* the root! (counts were incremented when the node was created)
|
* the root! (counts were incremented when the node was created)
|
||||||
*/
|
*/
|
||||||
node = child_node;
|
node = child_node;
|
||||||
while ((node = acpi_ns_get_parent_node (node)) != NULL) {
|
while ((node = acpi_ns_get_parent_node(node)) != NULL) {
|
||||||
node->reference_count--;
|
node->reference_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There should be only one reference remaining on this node */
|
/* There should be only one reference remaining on this node */
|
||||||
|
|
||||||
if (child_node->reference_count != 1) {
|
if (child_node->reference_count != 1) {
|
||||||
ACPI_REPORT_WARNING ((
|
ACPI_REPORT_WARNING(("Existing references (%d) on node being deleted (%p)\n", child_node->reference_count, child_node));
|
||||||
"Existing references (%d) on node being deleted (%p)\n",
|
|
||||||
child_node->reference_count, child_node));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we can delete the node */
|
/* Now we can delete the node */
|
||||||
|
|
||||||
ACPI_MEM_FREE (child_node);
|
ACPI_MEM_FREE(child_node);
|
||||||
|
|
||||||
/* And move on to the next child in the list */
|
/* And move on to the next child in the list */
|
||||||
|
|
||||||
@@ -342,7 +315,6 @@ acpi_ns_delete_children (
|
|||||||
|
|
||||||
} while (!(flags & ANOBJ_END_OF_PEER_LIST));
|
} while (!(flags & ANOBJ_END_OF_PEER_LIST));
|
||||||
|
|
||||||
|
|
||||||
/* Clear the parent's child pointer */
|
/* Clear the parent's child pointer */
|
||||||
|
|
||||||
parent_node->child = NULL;
|
parent_node->child = NULL;
|
||||||
@@ -350,7 +322,6 @@ acpi_ns_delete_children (
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_delete_namespace_subtree
|
* FUNCTION: acpi_ns_delete_namespace_subtree
|
||||||
@@ -364,16 +335,12 @@ acpi_ns_delete_children (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_node)
|
||||||
acpi_ns_delete_namespace_subtree (
|
|
||||||
struct acpi_namespace_node *parent_node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *child_node = NULL;
|
struct acpi_namespace_node *child_node = NULL;
|
||||||
u32 level = 1;
|
u32 level = 1;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_delete_namespace_subtree");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_delete_namespace_subtree");
|
||||||
|
|
||||||
if (!parent_node) {
|
if (!parent_node) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
@@ -386,16 +353,17 @@ acpi_ns_delete_namespace_subtree (
|
|||||||
while (level > 0) {
|
while (level > 0) {
|
||||||
/* Get the next node in this scope (NULL if none) */
|
/* Get the next node in this scope (NULL if none) */
|
||||||
|
|
||||||
child_node = acpi_ns_get_next_node (ACPI_TYPE_ANY, parent_node,
|
child_node = acpi_ns_get_next_node(ACPI_TYPE_ANY, parent_node,
|
||||||
child_node);
|
child_node);
|
||||||
if (child_node) {
|
if (child_node) {
|
||||||
/* Found a child node - detach any attached object */
|
/* Found a child node - detach any attached object */
|
||||||
|
|
||||||
acpi_ns_detach_object (child_node);
|
acpi_ns_detach_object(child_node);
|
||||||
|
|
||||||
/* Check if this node has any children */
|
/* 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,
|
* There is at least one child of this node,
|
||||||
* visit the node
|
* visit the node
|
||||||
@@ -404,8 +372,7 @@ acpi_ns_delete_namespace_subtree (
|
|||||||
parent_node = child_node;
|
parent_node = child_node;
|
||||||
child_node = NULL;
|
child_node = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* No more children of this parent node.
|
* No more children of this parent node.
|
||||||
* Move up to the grandparent.
|
* Move up to the grandparent.
|
||||||
@@ -416,7 +383,7 @@ acpi_ns_delete_namespace_subtree (
|
|||||||
* Now delete all of the children of this parent
|
* Now delete all of the children of this parent
|
||||||
* all at the same time.
|
* all at the same time.
|
||||||
*/
|
*/
|
||||||
acpi_ns_delete_children (parent_node);
|
acpi_ns_delete_children(parent_node);
|
||||||
|
|
||||||
/* New "last child" is this parent node */
|
/* New "last child" is this parent node */
|
||||||
|
|
||||||
@@ -424,14 +391,13 @@ acpi_ns_delete_namespace_subtree (
|
|||||||
|
|
||||||
/* Move up the tree to the grandparent */
|
/* Move up the tree to the grandparent */
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (parent_node);
|
parent_node = acpi_ns_get_parent_node(parent_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_remove_reference
|
* FUNCTION: acpi_ns_remove_reference
|
||||||
@@ -447,16 +413,12 @@ acpi_ns_delete_namespace_subtree (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void
|
static void acpi_ns_remove_reference(struct acpi_namespace_node *node)
|
||||||
acpi_ns_remove_reference (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
struct acpi_namespace_node *this_node;
|
struct acpi_namespace_node *this_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decrement the reference count(s) of this node and all
|
* Decrement the reference count(s) of this node and all
|
||||||
@@ -466,7 +428,7 @@ acpi_ns_remove_reference (
|
|||||||
while (this_node) {
|
while (this_node) {
|
||||||
/* Prepare to move up to parent */
|
/* Prepare to move up to parent */
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (this_node);
|
parent_node = acpi_ns_get_parent_node(this_node);
|
||||||
|
|
||||||
/* Decrement the reference count on this node */
|
/* Decrement the reference count on this node */
|
||||||
|
|
||||||
@@ -477,15 +439,14 @@ acpi_ns_remove_reference (
|
|||||||
if (!this_node->reference_count) {
|
if (!this_node->reference_count) {
|
||||||
/* Delete all children and delete the node */
|
/* Delete all children and delete the node */
|
||||||
|
|
||||||
acpi_ns_delete_children (this_node);
|
acpi_ns_delete_children(this_node);
|
||||||
acpi_ns_delete_node (this_node);
|
acpi_ns_delete_node(this_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_node = parent_node;
|
this_node = parent_node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_delete_namespace_by_owner
|
* FUNCTION: acpi_ns_delete_namespace_by_owner
|
||||||
@@ -500,27 +461,23 @@ acpi_ns_remove_reference (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id)
|
||||||
acpi_ns_delete_namespace_by_owner (
|
|
||||||
acpi_owner_id owner_id)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *child_node;
|
struct acpi_namespace_node *child_node;
|
||||||
struct acpi_namespace_node *deletion_node;
|
struct acpi_namespace_node *deletion_node;
|
||||||
u32 level;
|
u32 level;
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_U32 ("ns_delete_namespace_by_owner", owner_id);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_U32("ns_delete_namespace_by_owner", owner_id);
|
||||||
|
|
||||||
if (owner_id == 0) {
|
if (owner_id == 0) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent_node = acpi_gbl_root_node;
|
parent_node = acpi_gbl_root_node;
|
||||||
child_node = NULL;
|
child_node = NULL;
|
||||||
deletion_node = NULL;
|
deletion_node = NULL;
|
||||||
level = 1;
|
level = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Traverse the tree of nodes until we bubble back up
|
* Traverse the tree of nodes until we bubble back up
|
||||||
@@ -531,10 +488,12 @@ acpi_ns_delete_namespace_by_owner (
|
|||||||
* Get the next child of this parent node. When child_node is NULL,
|
* Get the next child of this parent node. When child_node is NULL,
|
||||||
* the first child of the parent is returned
|
* 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) {
|
if (deletion_node) {
|
||||||
acpi_ns_remove_reference (deletion_node);
|
acpi_ns_remove_reference(deletion_node);
|
||||||
deletion_node = NULL;
|
deletion_node = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,12 +501,13 @@ acpi_ns_delete_namespace_by_owner (
|
|||||||
if (child_node->owner_id == owner_id) {
|
if (child_node->owner_id == owner_id) {
|
||||||
/* Found a matching child node - detach any attached object */
|
/* Found a matching child node - detach any attached object */
|
||||||
|
|
||||||
acpi_ns_detach_object (child_node);
|
acpi_ns_detach_object(child_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this node has any children */
|
/* 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,
|
* There is at least one child of this node,
|
||||||
* visit the node
|
* visit the node
|
||||||
@@ -555,12 +515,10 @@ acpi_ns_delete_namespace_by_owner (
|
|||||||
level++;
|
level++;
|
||||||
parent_node = child_node;
|
parent_node = child_node;
|
||||||
child_node = NULL;
|
child_node = NULL;
|
||||||
}
|
} else if (child_node->owner_id == owner_id) {
|
||||||
else if (child_node->owner_id == owner_id) {
|
|
||||||
deletion_node = child_node;
|
deletion_node = child_node;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* No more children of this parent node.
|
* No more children of this parent node.
|
||||||
* Move up to the grandparent.
|
* Move up to the grandparent.
|
||||||
@@ -578,11 +536,9 @@ acpi_ns_delete_namespace_by_owner (
|
|||||||
|
|
||||||
/* Move up the tree to the grandparent */
|
/* Move up the tree to the grandparent */
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (parent_node);
|
parent_node = acpi_ns_get_parent_node(parent_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,31 +41,22 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsdump")
|
ACPI_MODULE_NAME("nsdump")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
void
|
void acpi_ns_dump_root_devices(void);
|
||||||
acpi_ns_dump_root_devices (
|
|
||||||
void);
|
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_dump_one_device (
|
acpi_ns_dump_one_device(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 level, void *context, void **return_value);
|
||||||
u32 level,
|
|
||||||
void *context,
|
|
||||||
void **return_value);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
|
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -80,43 +71,38 @@ acpi_ns_dump_one_device (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_print_pathname(u32 num_segments, char *pathname)
|
||||||
acpi_ns_print_pathname (
|
|
||||||
u32 num_segments,
|
|
||||||
char *pathname)
|
|
||||||
{
|
{
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ns_print_pathname");
|
||||||
|
|
||||||
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the entire name */
|
/* Print the entire name */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "["));
|
||||||
|
|
||||||
while (num_segments) {
|
while (num_segments) {
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
ACPI_IS_PRINT (pathname[i]) ?
|
ACPI_IS_PRINT(pathname[i]) ?
|
||||||
acpi_os_printf ("%c", pathname[i]) :
|
acpi_os_printf("%c", pathname[i]) :
|
||||||
acpi_os_printf ("?");
|
acpi_os_printf("?");
|
||||||
}
|
}
|
||||||
|
|
||||||
pathname += ACPI_NAME_SIZE;
|
pathname += ACPI_NAME_SIZE;
|
||||||
num_segments--;
|
num_segments--;
|
||||||
if (num_segments) {
|
if (num_segments) {
|
||||||
acpi_os_printf (".");
|
acpi_os_printf(".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_os_printf ("]\n");
|
acpi_os_printf("]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_dump_pathname
|
* FUNCTION: acpi_ns_dump_pathname
|
||||||
@@ -134,15 +120,10 @@ acpi_ns_print_pathname (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ns_dump_pathname (
|
acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component)
|
||||||
acpi_handle handle,
|
|
||||||
char *msg,
|
|
||||||
u32 level,
|
|
||||||
u32 component)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_dump_pathname");
|
ACPI_FUNCTION_TRACE("ns_dump_pathname");
|
||||||
|
|
||||||
|
|
||||||
/* Do this only if the requested debug level and component are enabled */
|
/* Do this only if the requested debug level and component are enabled */
|
||||||
|
|
||||||
@@ -152,12 +133,11 @@ acpi_ns_dump_pathname (
|
|||||||
|
|
||||||
/* Convert handle to a full pathname and print it (with supplied message) */
|
/* Convert handle to a full pathname and print it (with supplied message) */
|
||||||
|
|
||||||
acpi_ns_print_node_pathname (handle, msg);
|
acpi_ns_print_node_pathname(handle, msg);
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_dump_one_object
|
* FUNCTION: acpi_ns_dump_one_object
|
||||||
@@ -175,24 +155,19 @@ acpi_ns_dump_pathname (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_dump_one_object (
|
acpi_ns_dump_one_object(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 level, void *context, void **return_value)
|
||||||
u32 level,
|
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
struct acpi_walk_info *info = (struct acpi_walk_info *) context;
|
struct acpi_walk_info *info = (struct acpi_walk_info *)context;
|
||||||
struct acpi_namespace_node *this_node;
|
struct acpi_namespace_node *this_node;
|
||||||
union acpi_operand_object *obj_desc = NULL;
|
union acpi_operand_object *obj_desc = NULL;
|
||||||
acpi_object_type obj_type;
|
acpi_object_type obj_type;
|
||||||
acpi_object_type type;
|
acpi_object_type type;
|
||||||
u32 bytes_to_dump;
|
u32 bytes_to_dump;
|
||||||
u32 dbg_level;
|
u32 dbg_level;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ns_dump_one_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ns_dump_one_object");
|
||||||
|
|
||||||
/* Is output enabled? */
|
/* Is output enabled? */
|
||||||
|
|
||||||
@@ -201,48 +176,47 @@ acpi_ns_dump_one_object (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!obj_handle) {
|
if (!obj_handle) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n"));
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_node = acpi_ns_map_handle_to_node (obj_handle);
|
this_node = acpi_ns_map_handle_to_node(obj_handle);
|
||||||
type = this_node->type;
|
type = this_node->type;
|
||||||
|
|
||||||
/* Check if the owner matches */
|
/* Check if the owner matches */
|
||||||
|
|
||||||
if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
|
if ((info->owner_id != ACPI_OWNER_ID_MAX) &&
|
||||||
(info->owner_id != this_node->owner_id)) {
|
(info->owner_id != this_node->owner_id)) {
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
|
if (!(info->display_type & ACPI_DISPLAY_SHORT)) {
|
||||||
/* Indent the object according to the level */
|
/* Indent the object according to the level */
|
||||||
|
|
||||||
acpi_os_printf ("%2d%*s", (u32) level - 1, (int) level * 2, " ");
|
acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " ");
|
||||||
|
|
||||||
/* Check the node type and name */
|
/* Check the node type and name */
|
||||||
|
|
||||||
if (type > ACPI_TYPE_LOCAL_MAX) {
|
if (type > ACPI_TYPE_LOCAL_MAX) {
|
||||||
ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", type));
|
ACPI_REPORT_WARNING(("Invalid ACPI Type %08X\n", type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!acpi_ut_valid_acpi_name (this_node->name.integer)) {
|
if (!acpi_ut_valid_acpi_name(this_node->name.integer)) {
|
||||||
ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
|
ACPI_REPORT_WARNING(("Invalid ACPI Name %08X\n",
|
||||||
this_node->name.integer));
|
this_node->name.integer));
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_os_printf ("%4.4s", acpi_ut_get_node_name (this_node));
|
acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we can print out the pertinent information
|
* Now we can print out the pertinent information
|
||||||
*/
|
*/
|
||||||
acpi_os_printf (" %-12s %p ",
|
acpi_os_printf(" %-12s %p ", acpi_ut_get_type_name(type), this_node);
|
||||||
acpi_ut_get_type_name (type), this_node);
|
|
||||||
|
|
||||||
dbg_level = acpi_dbg_level;
|
dbg_level = acpi_dbg_level;
|
||||||
acpi_dbg_level = 0;
|
acpi_dbg_level = 0;
|
||||||
obj_desc = acpi_ns_get_attached_object (this_node);
|
obj_desc = acpi_ns_get_attached_object(this_node);
|
||||||
acpi_dbg_level = dbg_level;
|
acpi_dbg_level = dbg_level;
|
||||||
|
|
||||||
switch (info->display_type & ACPI_DISPLAY_MASK) {
|
switch (info->display_type & ACPI_DISPLAY_MASK) {
|
||||||
@@ -251,147 +225,166 @@ acpi_ns_dump_one_object (
|
|||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
/* No attached object, we are done */
|
/* No attached object, we are done */
|
||||||
|
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ACPI_TYPE_PROCESSOR:
|
case ACPI_TYPE_PROCESSOR:
|
||||||
|
|
||||||
acpi_os_printf ("ID %X Len %.4X Addr %p\n",
|
acpi_os_printf("ID %X Len %.4X Addr %p\n",
|
||||||
obj_desc->processor.proc_id, obj_desc->processor.length,
|
obj_desc->processor.proc_id,
|
||||||
(char *) obj_desc->processor.address);
|
obj_desc->processor.length,
|
||||||
|
(char *)obj_desc->processor.address);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_DEVICE:
|
case ACPI_TYPE_DEVICE:
|
||||||
|
|
||||||
acpi_os_printf ("Notify Object: %p\n", obj_desc);
|
acpi_os_printf("Notify Object: %p\n", obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
|
|
||||||
acpi_os_printf ("Args %X Len %.4X Aml %p\n",
|
acpi_os_printf("Args %X Len %.4X Aml %p\n",
|
||||||
(u32) obj_desc->method.param_count,
|
(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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
acpi_os_printf ("= %8.8X%8.8X\n",
|
acpi_os_printf("= %8.8X%8.8X\n",
|
||||||
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
|
ACPI_FORMAT_UINT64(obj_desc->integer.
|
||||||
|
value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
||||||
acpi_os_printf ("Elements %.2X\n",
|
acpi_os_printf("Elements %.2X\n",
|
||||||
obj_desc->package.count);
|
obj_desc->package.count);
|
||||||
}
|
} else {
|
||||||
else {
|
acpi_os_printf("[Length not yet evaluated]\n");
|
||||||
acpi_os_printf ("[Length not yet evaluated]\n");
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
if (obj_desc->common.flags & AOPOBJ_DATA_VALID) {
|
||||||
acpi_os_printf ("Len %.2X",
|
acpi_os_printf("Len %.2X",
|
||||||
obj_desc->buffer.length);
|
obj_desc->buffer.length);
|
||||||
|
|
||||||
/* Dump some of the buffer */
|
/* Dump some of the buffer */
|
||||||
|
|
||||||
if (obj_desc->buffer.length > 0) {
|
if (obj_desc->buffer.length > 0) {
|
||||||
acpi_os_printf (" =");
|
acpi_os_printf(" =");
|
||||||
for (i = 0; (i < obj_desc->buffer.length && i < 12); i++) {
|
for (i = 0;
|
||||||
acpi_os_printf (" %.2hX", obj_desc->buffer.pointer[i]);
|
(i < obj_desc->buffer.length
|
||||||
|
&& i < 12); i++) {
|
||||||
|
acpi_os_printf(" %.2hX",
|
||||||
|
obj_desc->buffer.
|
||||||
|
pointer[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
}
|
} else {
|
||||||
else {
|
acpi_os_printf("[Length not yet evaluated]\n");
|
||||||
acpi_os_printf ("[Length not yet evaluated]\n");
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
acpi_os_printf ("Len %.2X ", obj_desc->string.length);
|
acpi_os_printf("Len %.2X ", obj_desc->string.length);
|
||||||
acpi_ut_print_string (obj_desc->string.pointer, 32);
|
acpi_ut_print_string(obj_desc->string.pointer, 32);
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_REGION:
|
case ACPI_TYPE_REGION:
|
||||||
|
|
||||||
acpi_os_printf ("[%s]",
|
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) {
|
if (obj_desc->region.flags & AOPOBJ_DATA_VALID) {
|
||||||
acpi_os_printf (" Addr %8.8X%8.8X Len %.4X\n",
|
acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n",
|
||||||
ACPI_FORMAT_UINT64 (obj_desc->region.address),
|
ACPI_FORMAT_UINT64(obj_desc->
|
||||||
obj_desc->region.length);
|
region.
|
||||||
}
|
address),
|
||||||
else {
|
obj_desc->region.length);
|
||||||
acpi_os_printf (" [Address/Length not yet evaluated]\n");
|
} else {
|
||||||
|
acpi_os_printf
|
||||||
|
(" [Address/Length not yet evaluated]\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REFERENCE:
|
case ACPI_TYPE_LOCAL_REFERENCE:
|
||||||
|
|
||||||
acpi_os_printf ("[%s]\n",
|
acpi_os_printf("[%s]\n",
|
||||||
acpi_ps_get_opcode_name (obj_desc->reference.opcode));
|
acpi_ps_get_opcode_name(obj_desc->
|
||||||
|
reference.
|
||||||
|
opcode));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER_FIELD:
|
case ACPI_TYPE_BUFFER_FIELD:
|
||||||
|
|
||||||
if (obj_desc->buffer_field.buffer_obj &&
|
if (obj_desc->buffer_field.buffer_obj &&
|
||||||
obj_desc->buffer_field.buffer_obj->buffer.node) {
|
obj_desc->buffer_field.buffer_obj->buffer.node) {
|
||||||
acpi_os_printf ("Buf [%4.4s]",
|
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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
|
|
||||||
acpi_os_printf ("Rgn [%4.4s]",
|
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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
|
|
||||||
acpi_os_printf ("Rgn [%4.4s] Bnk [%4.4s]",
|
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->
|
||||||
acpi_ut_get_node_name (obj_desc->bank_field.bank_obj->common_field.node));
|
common_field.
|
||||||
|
region_obj->region.
|
||||||
|
node),
|
||||||
|
acpi_ut_get_node_name(obj_desc->
|
||||||
|
bank_field.
|
||||||
|
bank_obj->
|
||||||
|
common_field.
|
||||||
|
node));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
|
|
||||||
acpi_os_printf ("Idx [%4.4s] Dat [%4.4s]",
|
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->
|
||||||
acpi_ut_get_node_name (obj_desc->index_field.data_obj->common_field.node));
|
index_field.
|
||||||
|
index_obj->
|
||||||
|
common_field.node),
|
||||||
|
acpi_ut_get_node_name(obj_desc->
|
||||||
|
index_field.
|
||||||
|
data_obj->
|
||||||
|
common_field.
|
||||||
|
node));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_ALIAS:
|
case ACPI_TYPE_LOCAL_ALIAS:
|
||||||
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
|
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
|
||||||
|
|
||||||
acpi_os_printf ("Target %4.4s (%p)\n",
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
acpi_os_printf ("Object %p\n", obj_desc);
|
acpi_os_printf("Object %p\n", obj_desc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,11 +396,15 @@ acpi_ns_dump_one_object (
|
|||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
|
|
||||||
acpi_os_printf (" Off %.3X Len %.2X Acc %.2hd\n",
|
acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n",
|
||||||
(obj_desc->common_field.base_byte_offset * 8)
|
(obj_desc->common_field.
|
||||||
+ obj_desc->common_field.start_field_bit_offset,
|
base_byte_offset * 8)
|
||||||
obj_desc->common_field.bit_length,
|
+
|
||||||
obj_desc->common_field.access_byte_width);
|
obj_desc->common_field.
|
||||||
|
start_field_bit_offset,
|
||||||
|
obj_desc->common_field.bit_length,
|
||||||
|
obj_desc->common_field.
|
||||||
|
access_byte_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -415,56 +412,55 @@ acpi_ns_dump_one_object (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_DISPLAY_OBJECTS:
|
case ACPI_DISPLAY_OBJECTS:
|
||||||
|
|
||||||
acpi_os_printf ("O:%p", obj_desc);
|
acpi_os_printf("O:%p", obj_desc);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
/* No attached object, we are done */
|
/* No attached object, we are done */
|
||||||
|
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_os_printf ("(R%d)", obj_desc->common.reference_count);
|
acpi_os_printf("(R%d)", obj_desc->common.reference_count);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
|
|
||||||
/* Name is a Method and its AML offset/length are set */
|
/* Name is a Method and its AML offset/length are set */
|
||||||
|
|
||||||
acpi_os_printf (" M:%p-%X\n", obj_desc->method.aml_start,
|
acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start,
|
||||||
obj_desc->method.aml_length);
|
obj_desc->method.aml_length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_INTEGER:
|
case ACPI_TYPE_INTEGER:
|
||||||
|
|
||||||
acpi_os_printf (" I:%8.8X8.8%X\n",
|
acpi_os_printf(" I:%8.8X8.8%X\n",
|
||||||
ACPI_FORMAT_UINT64 (obj_desc->integer.value));
|
ACPI_FORMAT_UINT64(obj_desc->integer.
|
||||||
|
value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_STRING:
|
case ACPI_TYPE_STRING:
|
||||||
|
|
||||||
acpi_os_printf (" S:%p-%X\n", obj_desc->string.pointer,
|
acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer,
|
||||||
obj_desc->string.length);
|
obj_desc->string.length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
acpi_os_printf (" B:%p-%X\n", obj_desc->buffer.pointer,
|
acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer,
|
||||||
obj_desc->buffer.length);
|
obj_desc->buffer.length);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,46 +470,47 @@ acpi_ns_dump_one_object (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* If there is an attached object, display it */
|
/* If there is an attached object, display it */
|
||||||
|
|
||||||
dbg_level = acpi_dbg_level;
|
dbg_level = acpi_dbg_level;
|
||||||
acpi_dbg_level = 0;
|
acpi_dbg_level = 0;
|
||||||
obj_desc = acpi_ns_get_attached_object (this_node);
|
obj_desc = acpi_ns_get_attached_object(this_node);
|
||||||
acpi_dbg_level = dbg_level;
|
acpi_dbg_level = dbg_level;
|
||||||
|
|
||||||
/* Dump attached objects */
|
/* Dump attached objects */
|
||||||
|
|
||||||
while (obj_desc) {
|
while (obj_desc) {
|
||||||
obj_type = ACPI_TYPE_INVALID;
|
obj_type = ACPI_TYPE_INVALID;
|
||||||
acpi_os_printf ("Attached Object %p: ", obj_desc);
|
acpi_os_printf("Attached Object %p: ", obj_desc);
|
||||||
|
|
||||||
/* Decode the type of attached object and dump the contents */
|
/* Decode the type of attached object and dump the contents */
|
||||||
|
|
||||||
switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
|
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
|
||||||
case ACPI_DESC_TYPE_NAMED:
|
case ACPI_DESC_TYPE_NAMED:
|
||||||
|
|
||||||
acpi_os_printf ("(Ptr to Node)\n");
|
acpi_os_printf("(Ptr to Node)\n");
|
||||||
bytes_to_dump = sizeof (struct acpi_namespace_node);
|
bytes_to_dump = sizeof(struct acpi_namespace_node);
|
||||||
ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
|
ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_DESC_TYPE_OPERAND:
|
case ACPI_DESC_TYPE_OPERAND:
|
||||||
|
|
||||||
obj_type = ACPI_GET_OBJECT_TYPE (obj_desc);
|
obj_type = ACPI_GET_OBJECT_TYPE(obj_desc);
|
||||||
|
|
||||||
if (obj_type > ACPI_TYPE_LOCAL_MAX) {
|
if (obj_type > ACPI_TYPE_LOCAL_MAX) {
|
||||||
acpi_os_printf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
|
acpi_os_printf
|
||||||
obj_type);
|
("(Ptr to ACPI Object type %X [UNKNOWN])\n",
|
||||||
|
obj_type);
|
||||||
bytes_to_dump = 32;
|
bytes_to_dump = 32;
|
||||||
}
|
} else {
|
||||||
else {
|
acpi_os_printf
|
||||||
acpi_os_printf ("(Ptr to ACPI Object type %X [%s])\n",
|
("(Ptr to ACPI Object type %X [%s])\n",
|
||||||
obj_type, acpi_ut_get_type_name (obj_type));
|
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);
|
ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -523,7 +520,8 @@ acpi_ns_dump_one_object (
|
|||||||
|
|
||||||
/* If value is NOT an internal object, we are done */
|
/* 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;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,49 +535,50 @@ acpi_ns_dump_one_object (
|
|||||||
* NOTE: takes advantage of common fields between string/buffer
|
* NOTE: takes advantage of common fields between string/buffer
|
||||||
*/
|
*/
|
||||||
bytes_to_dump = obj_desc->string.length;
|
bytes_to_dump = obj_desc->string.length;
|
||||||
obj_desc = (void *) obj_desc->string.pointer;
|
obj_desc = (void *)obj_desc->string.pointer;
|
||||||
acpi_os_printf ( "(Buffer/String pointer %p length %X)\n",
|
acpi_os_printf("(Buffer/String pointer %p length %X)\n",
|
||||||
obj_desc, bytes_to_dump);
|
obj_desc, bytes_to_dump);
|
||||||
ACPI_DUMP_BUFFER (obj_desc, bytes_to_dump);
|
ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER_FIELD:
|
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;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
obj_desc = (void *) obj_desc->package.elements;
|
obj_desc = (void *)obj_desc->package.elements;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_METHOD:
|
case ACPI_TYPE_METHOD:
|
||||||
obj_desc = (void *) obj_desc->method.aml_start;
|
obj_desc = (void *)obj_desc->method.aml_start;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
case ACPI_TYPE_LOCAL_REGION_FIELD:
|
||||||
obj_desc = (void *) obj_desc->field.region_obj;
|
obj_desc = (void *)obj_desc->field.region_obj;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
case ACPI_TYPE_LOCAL_BANK_FIELD:
|
||||||
obj_desc = (void *) obj_desc->bank_field.region_obj;
|
obj_desc = (void *)obj_desc->bank_field.region_obj;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
case ACPI_TYPE_LOCAL_INDEX_FIELD:
|
||||||
obj_desc = (void *) obj_desc->index_field.index_obj;
|
obj_desc = (void *)obj_desc->index_field.index_obj;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
|
obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
acpi_os_printf ("\n");
|
acpi_os_printf("\n");
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -601,29 +600,25 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ns_dump_objects (
|
acpi_ns_dump_objects(acpi_object_type type,
|
||||||
acpi_object_type type,
|
u8 display_type,
|
||||||
u8 display_type,
|
u32 max_depth,
|
||||||
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;
|
struct acpi_walk_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
info.debug_level = ACPI_LV_TABLES;
|
info.debug_level = ACPI_LV_TABLES;
|
||||||
info.owner_id = owner_id;
|
info.owner_id = owner_id;
|
||||||
info.display_type = display_type;
|
info.display_type = display_type;
|
||||||
|
|
||||||
(void) acpi_ns_walk_namespace (type, start_handle, max_depth,
|
(void)acpi_ns_walk_namespace(type, start_handle, max_depth,
|
||||||
ACPI_NS_WALK_NO_UNLOCK, acpi_ns_dump_one_object,
|
ACPI_NS_WALK_NO_UNLOCK,
|
||||||
(void *) &info, NULL);
|
acpi_ns_dump_one_object, (void *)&info,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -638,25 +633,19 @@ acpi_ns_dump_objects (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level)
|
||||||
acpi_ns_dump_entry (
|
|
||||||
acpi_handle handle,
|
|
||||||
u32 debug_level)
|
|
||||||
{
|
{
|
||||||
struct acpi_walk_info info;
|
struct acpi_walk_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
info.debug_level = debug_level;
|
info.debug_level = debug_level;
|
||||||
info.owner_id = ACPI_OWNER_ID_MAX;
|
info.owner_id = ACPI_OWNER_ID_MAX;
|
||||||
info.display_type = ACPI_DISPLAY_SUMMARY;
|
info.display_type = ACPI_DISPLAY_SUMMARY;
|
||||||
|
|
||||||
(void) acpi_ns_dump_one_object (handle, 1, &info, NULL);
|
(void)acpi_ns_dump_one_object(handle, 1, &info, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_ASL_COMPILER
|
#ifdef ACPI_ASL_COMPILER
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -673,23 +662,19 @@ acpi_ns_dump_entry (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth)
|
||||||
acpi_ns_dump_tables (
|
|
||||||
acpi_handle search_base,
|
|
||||||
u32 max_depth)
|
|
||||||
{
|
{
|
||||||
acpi_handle search_handle = search_base;
|
acpi_handle search_handle = search_base;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_dump_tables");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_dump_tables");
|
||||||
|
|
||||||
if (!acpi_gbl_root_node) {
|
if (!acpi_gbl_root_node) {
|
||||||
/*
|
/*
|
||||||
* If the name space has not been initialized,
|
* If the name space has not been initialized,
|
||||||
* there is nothing to dump.
|
* 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;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,12 +682,12 @@ acpi_ns_dump_tables (
|
|||||||
/* Entire namespace */
|
/* Entire namespace */
|
||||||
|
|
||||||
search_handle = acpi_gbl_root_node;
|
search_handle = acpi_gbl_root_node;
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ns_dump_objects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
|
acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth,
|
||||||
ACPI_OWNER_ID_MAX, search_handle);
|
ACPI_OWNER_ID_MAX, search_handle);
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
#endif /* _ACPI_ASL_COMPILER */
|
#endif /* _ACPI_ASL_COMPILER */
|
||||||
#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
|
#endif /* defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) */
|
||||||
|
|||||||
@@ -41,20 +41,15 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
|
|
||||||
|
|
||||||
/* TBD: This entire module is apparently obsolete and should be removed */
|
/* TBD: This entire module is apparently obsolete and should be removed */
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsdumpdv")
|
ACPI_MODULE_NAME("nsdumpdv")
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
|
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
|
||||||
|
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_dump_one_device
|
* FUNCTION: acpi_ns_dump_one_device
|
||||||
@@ -70,44 +65,39 @@
|
|||||||
* This procedure is a user_function called by acpi_ns_walk_namespace.
|
* This procedure is a user_function called by acpi_ns_walk_namespace.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_dump_one_device (
|
acpi_ns_dump_one_device(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 level, void *context, void **return_value)
|
||||||
u32 level,
|
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
struct acpi_buffer buffer;
|
struct acpi_buffer buffer;
|
||||||
struct acpi_device_info *info;
|
struct acpi_device_info *info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ns_dump_one_device");
|
||||||
|
|
||||||
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;
|
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||||
status = acpi_get_object_info (obj_handle, &buffer);
|
status = acpi_get_object_info(obj_handle, &buffer);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
info = buffer.pointer;
|
info = buffer.pointer;
|
||||||
for (i = 0; i < level; i++) {
|
for (i = 0; i < level; i++) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES,
|
||||||
" HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
|
" HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
|
||||||
info->hardware_id.value, ACPI_FORMAT_UINT64 (info->address),
|
info->hardware_id.value,
|
||||||
info->current_status));
|
ACPI_FORMAT_UINT64(info->address),
|
||||||
ACPI_MEM_FREE (info);
|
info->current_status));
|
||||||
|
ACPI_MEM_FREE(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_dump_root_devices
|
* FUNCTION: acpi_ns_dump_root_devices
|
||||||
@@ -120,16 +110,12 @@ acpi_ns_dump_one_device (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_dump_root_devices(void)
|
||||||
acpi_ns_dump_root_devices (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_handle sys_bus_handle;
|
acpi_handle sys_bus_handle;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ns_dump_root_devices");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ns_dump_root_devices");
|
||||||
|
|
||||||
/* Only dump the table if tracing is enabled */
|
/* Only dump the table if tracing is enabled */
|
||||||
|
|
||||||
@@ -138,19 +124,17 @@ acpi_ns_dump_root_devices (
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
|
status = acpi_get_handle(NULL, ACPI_NS_SYSTEM_BUS, &sys_bus_handle);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
|
ACPI_DEBUG_PRINT((ACPI_DB_TABLES,
|
||||||
"Display of all devices in the namespace:\n"));
|
"Display of all devices in the namespace:\n"));
|
||||||
|
|
||||||
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE, sys_bus_handle,
|
status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE, sys_bus_handle,
|
||||||
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
|
||||||
acpi_ns_dump_one_device, NULL, NULL);
|
acpi_ns_dump_one_device, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,26 +42,19 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nseval")
|
ACPI_MODULE_NAME("nseval")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_execute_control_method (
|
acpi_ns_execute_control_method(struct acpi_parameter_info *info);
|
||||||
struct acpi_parameter_info *info);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -85,48 +78,44 @@ acpi_ns_get_object_value (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_evaluate_relative (
|
acpi_ns_evaluate_relative(char *pathname, struct acpi_parameter_info *info)
|
||||||
char *pathname,
|
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node = NULL;
|
struct acpi_namespace_node *node = NULL;
|
||||||
union acpi_generic_state *scope_info;
|
union acpi_generic_state *scope_info;
|
||||||
char *internal_path = NULL;
|
char *internal_path = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_evaluate_relative");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_evaluate_relative");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Must have a valid object handle
|
* Must have a valid object handle
|
||||||
*/
|
*/
|
||||||
if (!info || !info->node) {
|
if (!info || !info->node) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build an internal name string for the method */
|
/* Build an internal name string for the method */
|
||||||
|
|
||||||
status = acpi_ns_internalize_name (pathname, &internal_path);
|
status = acpi_ns_internalize_name(pathname, &internal_path);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
scope_info = acpi_ut_create_generic_state ();
|
scope_info = acpi_ut_create_generic_state();
|
||||||
if (!scope_info) {
|
if (!scope_info) {
|
||||||
goto cleanup1;
|
goto cleanup1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the prefix handle and Node */
|
/* Get the prefix handle and Node */
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->node = acpi_ns_map_handle_to_node (info->node);
|
info->node = acpi_ns_map_handle_to_node(info->node);
|
||||||
if (!info->node) {
|
if (!info->node) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -134,39 +123,38 @@ acpi_ns_evaluate_relative (
|
|||||||
/* Lookup the name in the namespace */
|
/* Lookup the name in the namespace */
|
||||||
|
|
||||||
scope_info->scope.node = info->node;
|
scope_info->scope.node = info->node;
|
||||||
status = acpi_ns_lookup (scope_info, internal_path, ACPI_TYPE_ANY,
|
status = acpi_ns_lookup(scope_info, internal_path, ACPI_TYPE_ANY,
|
||||||
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
|
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
|
||||||
&node);
|
&node);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
|
||||||
pathname, acpi_format_exception (status)));
|
pathname, acpi_format_exception(status)));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that we have a handle to the object, we can attempt to evaluate it.
|
* 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",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "%s [%p] Value %p\n",
|
||||||
pathname, node, acpi_ns_get_attached_object (node)));
|
pathname, node, acpi_ns_get_attached_object(node)));
|
||||||
|
|
||||||
info->node = node;
|
info->node = node;
|
||||||
status = acpi_ns_evaluate_by_handle (info);
|
status = acpi_ns_evaluate_by_handle(info);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
pathname));
|
"*** Completed eval of object %s ***\n", pathname));
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
acpi_ut_delete_generic_state (scope_info);
|
acpi_ut_delete_generic_state(scope_info);
|
||||||
|
|
||||||
cleanup1:
|
cleanup1:
|
||||||
ACPI_MEM_FREE (internal_path);
|
ACPI_MEM_FREE(internal_path);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_evaluate_by_name
|
* FUNCTION: acpi_ns_evaluate_by_name
|
||||||
@@ -189,68 +177,63 @@ cleanup1:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_evaluate_by_name (
|
acpi_ns_evaluate_by_name(char *pathname, struct acpi_parameter_info *info)
|
||||||
char *pathname,
|
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
char *internal_path = NULL;
|
char *internal_path = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_evaluate_by_name");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_evaluate_by_name");
|
||||||
|
|
||||||
/* Build an internal name string for the method */
|
/* Build an internal name string for the method */
|
||||||
|
|
||||||
status = acpi_ns_internalize_name (pathname, &internal_path);
|
status = acpi_ns_internalize_name(pathname, &internal_path);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the name in the namespace */
|
/* Lookup the name in the namespace */
|
||||||
|
|
||||||
status = acpi_ns_lookup (NULL, internal_path, ACPI_TYPE_ANY,
|
status = acpi_ns_lookup(NULL, internal_path, ACPI_TYPE_ANY,
|
||||||
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
|
ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
|
||||||
&info->node);
|
&info->node);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Object at [%s] was not found, status=%.4X\n",
|
"Object at [%s] was not found, status=%.4X\n",
|
||||||
pathname, status));
|
pathname, status));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now that we have a handle to the object, we can attempt to evaluate it.
|
* 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",
|
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);
|
status = acpi_ns_evaluate_by_handle(info);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
pathname));
|
"*** Completed eval of object %s ***\n", pathname));
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
|
||||||
if (internal_path) {
|
if (internal_path) {
|
||||||
ACPI_MEM_FREE (internal_path);
|
ACPI_MEM_FREE(internal_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_evaluate_by_handle
|
* FUNCTION: acpi_ns_evaluate_by_handle
|
||||||
@@ -275,26 +258,22 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_evaluate_by_handle(struct acpi_parameter_info *info)
|
||||||
acpi_ns_evaluate_by_handle (
|
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_evaluate_by_handle");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_evaluate_by_handle");
|
||||||
|
|
||||||
/* Check if namespace has been initialized */
|
/* Check if namespace has been initialized */
|
||||||
|
|
||||||
if (!acpi_gbl_root_node) {
|
if (!acpi_gbl_root_node) {
|
||||||
return_ACPI_STATUS (AE_NO_NAMESPACE);
|
return_ACPI_STATUS(AE_NO_NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parameter Validation */
|
/* Parameter Validation */
|
||||||
|
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the return value to an invalid object */
|
/* Initialize the return value to an invalid object */
|
||||||
@@ -303,23 +282,25 @@ acpi_ns_evaluate_by_handle (
|
|||||||
|
|
||||||
/* Get the prefix handle and Node */
|
/* Get the prefix handle and Node */
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
info->node = acpi_ns_map_handle_to_node (info->node);
|
info->node = acpi_ns_map_handle_to_node(info->node);
|
||||||
if (!info->node) {
|
if (!info->node) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For a method alias, we must grab the actual method node so that proper
|
* For a method alias, we must grab the actual method node so that proper
|
||||||
* scoping context will be established before execution.
|
* scoping context will be established before execution.
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_get_type (info->node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -329,17 +310,16 @@ acpi_ns_evaluate_by_handle (
|
|||||||
*
|
*
|
||||||
* In both cases, the namespace is unlocked by the acpi_ns* procedure
|
* In both cases, the namespace is unlocked by the acpi_ns* procedure
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_get_type (info->node) == ACPI_TYPE_METHOD) {
|
if (acpi_ns_get_type(info->node) == ACPI_TYPE_METHOD) {
|
||||||
/*
|
/*
|
||||||
* Case 1) We have an actual control method to execute
|
* Case 1) We have an actual control method to execute
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_execute_control_method (info);
|
status = acpi_ns_execute_control_method(info);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Case 2) Object is NOT a method, just return its current value
|
* Case 2) Object is NOT a method, just return its current value
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_get_object_value (info);
|
status = acpi_ns_get_object_value(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -355,10 +335,9 @@ acpi_ns_evaluate_by_handle (
|
|||||||
* Namespace was unlocked by the handling acpi_ns* function, so we
|
* Namespace was unlocked by the handling acpi_ns* function, so we
|
||||||
* just return
|
* just return
|
||||||
*/
|
*/
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_execute_control_method
|
* FUNCTION: acpi_ns_execute_control_method
|
||||||
@@ -384,30 +363,29 @@ acpi_ns_evaluate_by_handle (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_execute_control_method (
|
acpi_ns_execute_control_method(struct acpi_parameter_info *info)
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_execute_control_method");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_execute_control_method");
|
||||||
|
|
||||||
/* Verify that there is a method associated with this object */
|
/* Verify that there is a method associated with this object */
|
||||||
|
|
||||||
info->obj_desc = acpi_ns_get_attached_object (info->node);
|
info->obj_desc = acpi_ns_get_attached_object(info->node);
|
||||||
if (!info->obj_desc) {
|
if (!info->obj_desc) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
|
"No attached method object\n"));
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DUMP_PATHNAME (info->node, "Execute Method:",
|
ACPI_DUMP_PATHNAME(info->node, "Execute Method:",
|
||||||
ACPI_LV_INFO, _COMPONENT);
|
ACPI_LV_INFO, _COMPONENT);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
|
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
|
* Unlock the namespace before execution. This allows namespace access
|
||||||
@@ -416,27 +394,26 @@ acpi_ns_execute_control_method (
|
|||||||
* interpreter locks to ensure that no thread is using the portion of the
|
* interpreter locks to ensure that no thread is using the portion of the
|
||||||
* namespace that is being deleted.
|
* namespace that is being deleted.
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute the method via the interpreter. The interpreter is locked
|
* Execute the method via the interpreter. The interpreter is locked
|
||||||
* here before calling into the AML parser
|
* here before calling into the AML parser
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_enter_interpreter ();
|
status = acpi_ex_enter_interpreter();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ps_execute_method (info);
|
status = acpi_ps_execute_method(info);
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_object_value
|
* FUNCTION: acpi_ns_get_object_value
|
||||||
@@ -454,16 +431,12 @@ acpi_ns_execute_control_method (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ns_get_object_value(struct acpi_parameter_info *info)
|
||||||
acpi_ns_get_object_value (
|
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_namespace_node *resolved_node = info->node;
|
struct acpi_namespace_node *resolved_node = info->node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_get_object_value");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_get_object_value");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Objects require additional resolution steps (e.g., the Node may be a
|
* Objects require additional resolution steps (e.g., the Node may be a
|
||||||
@@ -486,32 +459,33 @@ acpi_ns_get_object_value (
|
|||||||
*
|
*
|
||||||
* We must release the namespace lock before entering the intepreter.
|
* We must release the namespace lock before entering the intepreter.
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ex_enter_interpreter ();
|
status = acpi_ex_enter_interpreter();
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
status = acpi_ex_resolve_node_to_value (&resolved_node, NULL);
|
status = acpi_ex_resolve_node_to_value(&resolved_node, NULL);
|
||||||
/*
|
/*
|
||||||
* If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
|
* If acpi_ex_resolve_node_to_value() succeeded, the return value was placed
|
||||||
* in resolved_node.
|
* in resolved_node.
|
||||||
*/
|
*/
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
status = AE_CTRL_RETURN_VALUE;
|
status = AE_CTRL_RETURN_VALUE;
|
||||||
info->return_object = ACPI_CAST_PTR
|
info->return_object = ACPI_CAST_PTR
|
||||||
(union acpi_operand_object, resolved_node);
|
(union acpi_operand_object, resolved_node);
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
info->return_object,
|
"Returning object %p [%s]\n",
|
||||||
acpi_ut_get_object_type_name (info->return_object)));
|
info->return_object,
|
||||||
|
acpi_ut_get_object_type_name(info->
|
||||||
|
return_object)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Namespace is unlocked */
|
/* Namespace is unlocked */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,31 +41,22 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsinit")
|
ACPI_MODULE_NAME("nsinit")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
static acpi_status
|
||||||
|
acpi_ns_init_one_object(acpi_handle obj_handle,
|
||||||
|
u32 level, void *context, void **return_value);
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_init_one_object (
|
acpi_ns_init_one_device(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 nesting_level, void *context, void **return_value);
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -80,52 +71,48 @@ acpi_ns_init_one_device (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_initialize_objects(void)
|
||||||
acpi_ns_initialize_objects (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_init_walk_info info;
|
struct acpi_init_walk_info info;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_initialize_objects");
|
||||||
|
|
||||||
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,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
"Completing Region/Field/Buffer/Package initialization:"));
|
||||||
"**** Starting initialization of namespace objects ****\n"));
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
|
||||||
"Completing Region/Field/Buffer/Package initialization:"));
|
|
||||||
|
|
||||||
/* Set all init info to zero */
|
/* Set all init info to zero */
|
||||||
|
|
||||||
ACPI_MEMSET (&info, 0, sizeof (struct acpi_init_walk_info));
|
ACPI_MEMSET(&info, 0, sizeof(struct acpi_init_walk_info));
|
||||||
|
|
||||||
/* Walk entire namespace from the supplied root */
|
/* Walk entire namespace from the supplied root */
|
||||||
|
|
||||||
status = acpi_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
||||||
ACPI_UINT32_MAX, acpi_ns_init_one_object,
|
ACPI_UINT32_MAX, acpi_ns_init_one_object,
|
||||||
&info, NULL);
|
&info, NULL);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||||
"\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
|
"\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n",
|
||||||
info.op_region_init, info.op_region_count,
|
info.op_region_init, info.op_region_count,
|
||||||
info.field_init, info.field_count,
|
info.field_init, info.field_count,
|
||||||
info.buffer_init, info.buffer_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,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"%hd Control Methods found\n", info.method_count));
|
"%hd Control Methods found\n", info.method_count));
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
|
ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
|
||||||
"%hd Op Regions found\n", info.op_region_count));
|
"%hd Op Regions found\n", info.op_region_count));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_initialize_devices
|
* FUNCTION: acpi_ns_initialize_devices
|
||||||
@@ -142,16 +129,12 @@ acpi_ns_initialize_objects (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_initialize_devices(void)
|
||||||
acpi_ns_initialize_devices (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_device_walk_info info;
|
struct acpi_device_walk_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_initialize_devices");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_initialize_devices");
|
||||||
|
|
||||||
/* Init counters */
|
/* Init counters */
|
||||||
|
|
||||||
@@ -159,34 +142,34 @@ acpi_ns_initialize_devices (
|
|||||||
info.num_STA = 0;
|
info.num_STA = 0;
|
||||||
info.num_INI = 0;
|
info.num_INI = 0;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||||
"Executing all Device _STA and_INI methods:"));
|
"Executing all Device _STA and_INI methods:"));
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Walk namespace for all objects */
|
/* Walk namespace for all objects */
|
||||||
|
|
||||||
status = acpi_ns_walk_namespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
|
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);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed! %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||||
"\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
|
"\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
|
||||||
info.device_count, info.num_STA, info.num_INI));
|
info.device_count, info.num_STA, info.num_INI));
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_init_one_object
|
* FUNCTION: acpi_ns_init_one_object
|
||||||
@@ -208,28 +191,25 @@ acpi_ns_initialize_devices (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_init_one_object (
|
acpi_ns_init_one_object(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 level, void *context, void **return_value)
|
||||||
u32 level,
|
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
acpi_object_type type;
|
acpi_object_type type;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_init_walk_info *info = (struct acpi_init_walk_info *) context;
|
struct acpi_init_walk_info *info =
|
||||||
struct acpi_namespace_node *node = (struct acpi_namespace_node *) obj_handle;
|
(struct acpi_init_walk_info *)context;
|
||||||
union acpi_operand_object *obj_desc;
|
struct acpi_namespace_node *node =
|
||||||
|
(struct acpi_namespace_node *)obj_handle;
|
||||||
|
union acpi_operand_object *obj_desc;
|
||||||
ACPI_FUNCTION_NAME ("ns_init_one_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ns_init_one_object");
|
||||||
|
|
||||||
info->object_count++;
|
info->object_count++;
|
||||||
|
|
||||||
/* And even then, we are only interested in a few object types */
|
/* And even then, we are only interested in a few object types */
|
||||||
|
|
||||||
type = acpi_ns_get_type (obj_handle);
|
type = acpi_ns_get_type(obj_handle);
|
||||||
obj_desc = acpi_ns_get_attached_object (node);
|
obj_desc = acpi_ns_get_attached_object(node);
|
||||||
if (!obj_desc) {
|
if (!obj_desc) {
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
@@ -269,8 +249,8 @@ acpi_ns_init_one_object (
|
|||||||
/*
|
/*
|
||||||
* Must lock the interpreter before executing AML code
|
* Must lock the interpreter before executing AML code
|
||||||
*/
|
*/
|
||||||
status = acpi_ex_enter_interpreter ();
|
status = acpi_ex_enter_interpreter();
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,25 +262,25 @@ acpi_ns_init_one_object (
|
|||||||
case ACPI_TYPE_REGION:
|
case ACPI_TYPE_REGION:
|
||||||
|
|
||||||
info->op_region_init++;
|
info->op_region_init++;
|
||||||
status = acpi_ds_get_region_arguments (obj_desc);
|
status = acpi_ds_get_region_arguments(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER_FIELD:
|
case ACPI_TYPE_BUFFER_FIELD:
|
||||||
|
|
||||||
info->field_init++;
|
info->field_init++;
|
||||||
status = acpi_ds_get_buffer_field_arguments (obj_desc);
|
status = acpi_ds_get_buffer_field_arguments(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_BUFFER:
|
case ACPI_TYPE_BUFFER:
|
||||||
|
|
||||||
info->buffer_init++;
|
info->buffer_init++;
|
||||||
status = acpi_ds_get_buffer_arguments (obj_desc);
|
status = acpi_ds_get_buffer_arguments(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_TYPE_PACKAGE:
|
case ACPI_TYPE_PACKAGE:
|
||||||
|
|
||||||
info->package_init++;
|
info->package_init++;
|
||||||
status = acpi_ds_get_package_arguments (obj_desc);
|
status = acpi_ds_get_package_arguments(obj_desc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -308,12 +288,13 @@ acpi_ns_init_one_object (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_ERROR, "\n"));
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not execute arguments for [%4.4s] (%s), %s\n",
|
"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_format_exception (status)));
|
acpi_ut_get_type_name(type),
|
||||||
|
acpi_format_exception(status)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -321,18 +302,17 @@ acpi_ns_init_one_object (
|
|||||||
* pathname
|
* pathname
|
||||||
*/
|
*/
|
||||||
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
|
if (!(acpi_dbg_level & ACPI_LV_INIT_NAMES)) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We ignore errors from above, and always return OK, since we don't want
|
* We ignore errors from above, and always return OK, since we don't want
|
||||||
* to abort the walk on any single error.
|
* to abort the walk on any single error.
|
||||||
*/
|
*/
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_init_one_device
|
* FUNCTION: acpi_ns_init_one_device
|
||||||
@@ -348,41 +328,37 @@ acpi_ns_init_one_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_init_one_device (
|
acpi_ns_init_one_device(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 nesting_level, void *context, void **return_value)
|
||||||
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_parameter_info pinfo;
|
(struct acpi_device_walk_info *)context;
|
||||||
u32 flags;
|
struct acpi_parameter_info pinfo;
|
||||||
acpi_status status;
|
u32 flags;
|
||||||
|
acpi_status status;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_init_one_device");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_init_one_device");
|
||||||
|
|
||||||
pinfo.parameters = NULL;
|
pinfo.parameters = NULL;
|
||||||
pinfo.parameter_type = ACPI_PARAM_ARGS;
|
pinfo.parameter_type = ACPI_PARAM_ARGS;
|
||||||
|
|
||||||
pinfo.node = acpi_ns_map_handle_to_node (obj_handle);
|
pinfo.node = acpi_ns_map_handle_to_node(obj_handle);
|
||||||
if (!pinfo.node) {
|
if (!pinfo.node) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We will run _STA/_INI on Devices, Processors and thermal_zones only
|
* We will run _STA/_INI on Devices, Processors and thermal_zones only
|
||||||
*/
|
*/
|
||||||
if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
|
if ((pinfo.node->type != ACPI_TYPE_DEVICE) &&
|
||||||
(pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
|
(pinfo.node->type != ACPI_TYPE_PROCESSOR) &&
|
||||||
(pinfo.node->type != ACPI_TYPE_THERMAL)) {
|
(pinfo.node->type != ACPI_TYPE_THERMAL)) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
|
if ((acpi_dbg_level <= ACPI_LV_ALL_EXCEPTIONS) &&
|
||||||
(!(acpi_dbg_level & ACPI_LV_INFO))) {
|
(!(acpi_dbg_level & ACPI_LV_INFO))) {
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, "."));
|
||||||
}
|
}
|
||||||
|
|
||||||
info->device_count++;
|
info->device_count++;
|
||||||
@@ -390,20 +366,20 @@ acpi_ns_init_one_device (
|
|||||||
/*
|
/*
|
||||||
* Run _STA to determine if we can run _INI on the device.
|
* Run _STA to determine if we can run _INI on the device.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
|
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
|
||||||
pinfo.node, METHOD_NAME__STA));
|
pinfo.node,
|
||||||
status = acpi_ut_execute_STA (pinfo.node, &flags);
|
METHOD_NAME__STA));
|
||||||
|
status = acpi_ut_execute_STA(pinfo.node, &flags);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
if (pinfo.node->type == ACPI_TYPE_DEVICE) {
|
if (pinfo.node->type == ACPI_TYPE_DEVICE) {
|
||||||
/* Ignore error and move on to next device */
|
/* Ignore error and move on to next device */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _STA is not required for Processor or thermal_zone objects */
|
/* _STA is not required for Processor or thermal_zone objects */
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
info->num_STA++;
|
info->num_STA++;
|
||||||
|
|
||||||
if (!(flags & 0x01)) {
|
if (!(flags & 0x01)) {
|
||||||
@@ -416,32 +392,34 @@ acpi_ns_init_one_device (
|
|||||||
/*
|
/*
|
||||||
* The device is present. Run _INI.
|
* The device is present. Run _INI.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_EXEC (acpi_ut_display_init_pathname (ACPI_TYPE_METHOD,
|
ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_METHOD,
|
||||||
pinfo.node, METHOD_NAME__INI));
|
pinfo.node,
|
||||||
status = acpi_ns_evaluate_relative (METHOD_NAME__INI, &pinfo);
|
METHOD_NAME__INI));
|
||||||
if (ACPI_FAILURE (status)) {
|
status = acpi_ns_evaluate_relative(METHOD_NAME__INI, &pinfo);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
/* No _INI (AE_NOT_FOUND) means device requires no initialization */
|
/* No _INI (AE_NOT_FOUND) means device requires no initialization */
|
||||||
|
|
||||||
if (status != AE_NOT_FOUND) {
|
if (status != AE_NOT_FOUND) {
|
||||||
/* Ignore error and move on to next device */
|
/* Ignore error and move on to next device */
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#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",
|
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);
|
ACPI_MEM_FREE(scope_name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Delete any return object (especially if implicit_return is enabled) */
|
/* Delete any return object (especially if implicit_return is enabled) */
|
||||||
|
|
||||||
if (pinfo.return_object) {
|
if (pinfo.return_object) {
|
||||||
acpi_ut_remove_reference (pinfo.return_object);
|
acpi_ut_remove_reference(pinfo.return_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Count of successful INIs */
|
/* Count of successful INIs */
|
||||||
@@ -452,8 +430,9 @@ acpi_ns_init_one_device (
|
|||||||
if (acpi_gbl_init_handler) {
|
if (acpi_gbl_init_handler) {
|
||||||
/* External initialization handler is present, call it */
|
/* 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);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,32 +41,22 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsload")
|
ACPI_MODULE_NAME("nsload")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* 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
|
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
||||||
acpi_status
|
acpi_status acpi_ns_unload_namespace(acpi_handle handle);
|
||||||
acpi_ns_unload_namespace (
|
|
||||||
acpi_handle handle);
|
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle);
|
||||||
acpi_ns_delete_subtree (
|
|
||||||
acpi_handle start_handle);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef ACPI_NO_METHOD_EXECUTION
|
#ifndef ACPI_NO_METHOD_EXECUTION
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -82,40 +72,39 @@ acpi_ns_delete_subtree (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_load_table (
|
acpi_ns_load_table(struct acpi_table_desc *table_desc,
|
||||||
struct acpi_table_desc *table_desc,
|
struct acpi_namespace_node *node)
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_load_table");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_load_table");
|
||||||
|
|
||||||
/* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
|
/* 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 */
|
/* Just ignore this table */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check validity of the AML start and length */
|
/* Check validity of the AML start and length */
|
||||||
|
|
||||||
if (!table_desc->aml_start) {
|
if (!table_desc->aml_start) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Null AML pointer\n"));
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AML block at %p\n",
|
||||||
table_desc->aml_start));
|
table_desc->aml_start));
|
||||||
|
|
||||||
/* Ignore table if there is no AML contained within */
|
/* Ignore table if there is no AML contained within */
|
||||||
|
|
||||||
if (!table_desc->aml_length) {
|
if (!table_desc->aml_length) {
|
||||||
ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
|
ACPI_REPORT_WARNING(("Zero-length AML block in table [%4.4s]\n",
|
||||||
table_desc->pointer->signature));
|
table_desc->pointer->signature));
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -127,19 +116,19 @@ acpi_ns_load_table (
|
|||||||
* to another control method, we can't continue parsing
|
* to another control method, we can't continue parsing
|
||||||
* because we don't know how many arguments to parse next!
|
* because we don't know how many arguments to parse next!
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"**** Loading table into namespace ****\n"));
|
"**** Loading table into namespace ****\n"));
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_parse_table (table_desc, node->child);
|
status = acpi_ns_parse_table(table_desc, node->child);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -148,18 +137,17 @@ acpi_ns_load_table (
|
|||||||
* just-in-time parsing, we delete the control method
|
* just-in-time parsing, we delete the control method
|
||||||
* parse trees.
|
* parse trees.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"**** Begin Table Method Parsing and Object Initialization ****\n"));
|
"**** Begin Table Method Parsing and Object Initialization ****\n"));
|
||||||
|
|
||||||
status = acpi_ds_initialize_objects (table_desc, node);
|
status = acpi_ds_initialize_objects(table_desc, node);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"**** Completed Table Method Parsing and Object Initialization ****\n"));
|
"**** Completed Table Method Parsing and Object Initialization ****\n"));
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_load_table_by_type
|
* FUNCTION: acpi_ns_load_table_by_type
|
||||||
@@ -174,21 +162,17 @@ acpi_ns_load_table (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ns_load_table_by_type(acpi_table_type table_type)
|
||||||
acpi_ns_load_table_by_type (
|
|
||||||
acpi_table_type table_type)
|
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_table_desc *table_desc;
|
struct acpi_table_desc *table_desc;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_load_table_by_type");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_load_table_by_type");
|
status = acpi_ut_acquire_mutex(ACPI_MTX_TABLES);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_TABLES);
|
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -198,7 +182,7 @@ acpi_ns_load_table_by_type (
|
|||||||
switch (table_type) {
|
switch (table_type) {
|
||||||
case ACPI_TABLE_DSDT:
|
case ACPI_TABLE_DSDT:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: DSDT\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace load: DSDT\n"));
|
||||||
|
|
||||||
table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
|
table_desc = acpi_gbl_table_lists[ACPI_TABLE_DSDT].next;
|
||||||
|
|
||||||
@@ -210,18 +194,18 @@ acpi_ns_load_table_by_type (
|
|||||||
|
|
||||||
/* Now load the single DSDT */
|
/* Now load the single DSDT */
|
||||||
|
|
||||||
status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
|
status = acpi_ns_load_table(table_desc, acpi_gbl_root_node);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
table_desc->loaded_into_namespace = TRUE;
|
table_desc->loaded_into_namespace = TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ACPI_TABLE_SSDT:
|
case ACPI_TABLE_SSDT:
|
||||||
case ACPI_TABLE_PSDT:
|
case ACPI_TABLE_PSDT:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace load: %d SSDT or PSDTs\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
acpi_gbl_table_lists[table_type].count));
|
"Namespace load: %d SSDT or PSDTs\n",
|
||||||
|
acpi_gbl_table_lists[table_type].count));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Traverse list of SSDT or PSDT tables
|
* Traverse list of SSDT or PSDT tables
|
||||||
@@ -233,8 +217,10 @@ acpi_ns_load_table_by_type (
|
|||||||
* already loaded!
|
* already loaded!
|
||||||
*/
|
*/
|
||||||
if (!table_desc->loaded_into_namespace) {
|
if (!table_desc->loaded_into_namespace) {
|
||||||
status = acpi_ns_load_table (table_desc, acpi_gbl_root_node);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ns_load_table(table_desc,
|
||||||
|
acpi_gbl_root_node);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,19 +231,16 @@ acpi_ns_load_table_by_type (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
status = AE_SUPPORT;
|
status = AE_SUPPORT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_TABLES);
|
return_ACPI_STATUS(status);
|
||||||
return_ACPI_STATUS (status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_load_namespace
|
* FUNCTION: acpi_load_namespace
|
||||||
@@ -271,45 +254,40 @@ unlock_and_exit:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_load_namespace(void)
|
||||||
acpi_ns_load_namespace (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_load_name_space");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_load_name_space");
|
||||||
|
|
||||||
/* There must be at least a DSDT installed */
|
/* There must be at least a DSDT installed */
|
||||||
|
|
||||||
if (acpi_gbl_DSDT == NULL) {
|
if (acpi_gbl_DSDT == NULL) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "DSDT is not in memory\n"));
|
||||||
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
|
return_ACPI_STATUS(AE_NO_ACPI_TABLES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Load the namespace. The DSDT is required,
|
* Load the namespace. The DSDT is required,
|
||||||
* but the SSDT and PSDT tables are optional.
|
* but the SSDT and PSDT tables are optional.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_load_table_by_type (ACPI_TABLE_DSDT);
|
status = acpi_ns_load_table_by_type(ACPI_TABLE_DSDT);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ignore exceptions from these */
|
/* Ignore exceptions from these */
|
||||||
|
|
||||||
(void) acpi_ns_load_table_by_type (ACPI_TABLE_SSDT);
|
(void)acpi_ns_load_table_by_type(ACPI_TABLE_SSDT);
|
||||||
(void) acpi_ns_load_table_by_type (ACPI_TABLE_PSDT);
|
(void)acpi_ns_load_table_by_type(ACPI_TABLE_PSDT);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT,
|
||||||
"ACPI Namespace successfully loaded at root %p\n",
|
"ACPI Namespace successfully loaded at root %p\n",
|
||||||
acpi_gbl_root_node));
|
acpi_gbl_root_node));
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
#ifdef ACPI_FUTURE_IMPLEMENTATION
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -327,24 +305,20 @@ acpi_ns_load_namespace (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ns_delete_subtree(acpi_handle start_handle)
|
||||||
acpi_ns_delete_subtree (
|
|
||||||
acpi_handle start_handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_handle child_handle;
|
acpi_handle child_handle;
|
||||||
acpi_handle parent_handle;
|
acpi_handle parent_handle;
|
||||||
acpi_handle next_child_handle;
|
acpi_handle next_child_handle;
|
||||||
acpi_handle dummy;
|
acpi_handle dummy;
|
||||||
u32 level;
|
u32 level;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_delete_subtree");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_delete_subtree");
|
||||||
|
|
||||||
parent_handle = start_handle;
|
parent_handle = start_handle;
|
||||||
child_handle = NULL;
|
child_handle = NULL;
|
||||||
level = 1;
|
level = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Traverse the tree of objects until we bubble back up
|
* Traverse the tree of objects until we bubble back up
|
||||||
@@ -353,18 +327,19 @@ acpi_ns_delete_subtree (
|
|||||||
while (level > 0) {
|
while (level > 0) {
|
||||||
/* Attempt to get the next object in this scope */
|
/* Attempt to get the next object in this scope */
|
||||||
|
|
||||||
status = acpi_get_next_object (ACPI_TYPE_ANY, parent_handle,
|
status = acpi_get_next_object(ACPI_TYPE_ANY, parent_handle,
|
||||||
child_handle, &next_child_handle);
|
child_handle, &next_child_handle);
|
||||||
|
|
||||||
child_handle = next_child_handle;
|
child_handle = next_child_handle;
|
||||||
|
|
||||||
/* Did we get a new object? */
|
/* Did we get a new object? */
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/* Check if this object has any children */
|
/* Check if this object has any children */
|
||||||
|
|
||||||
if (ACPI_SUCCESS (acpi_get_next_object (ACPI_TYPE_ANY, child_handle,
|
if (ACPI_SUCCESS
|
||||||
NULL, &dummy))) {
|
(acpi_get_next_object
|
||||||
|
(ACPI_TYPE_ANY, child_handle, NULL, &dummy))) {
|
||||||
/*
|
/*
|
||||||
* There is at least one child of this object,
|
* There is at least one child of this object,
|
||||||
* visit the object
|
* visit the object
|
||||||
@@ -373,8 +348,7 @@ acpi_ns_delete_subtree (
|
|||||||
parent_handle = child_handle;
|
parent_handle = child_handle;
|
||||||
child_handle = NULL;
|
child_handle = NULL;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* No more children in this object, go back up to
|
* No more children in this object, go back up to
|
||||||
* the object's parent
|
* the object's parent
|
||||||
@@ -383,24 +357,23 @@ acpi_ns_delete_subtree (
|
|||||||
|
|
||||||
/* Delete all children now */
|
/* Delete all children now */
|
||||||
|
|
||||||
acpi_ns_delete_children (child_handle);
|
acpi_ns_delete_children(child_handle);
|
||||||
|
|
||||||
child_handle = parent_handle;
|
child_handle = parent_handle;
|
||||||
status = acpi_get_parent (parent_handle, &parent_handle);
|
status = acpi_get_parent(parent_handle, &parent_handle);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now delete the starting object, and we are done */
|
/* Now delete the starting object, and we are done */
|
||||||
|
|
||||||
acpi_ns_delete_node (child_handle);
|
acpi_ns_delete_node(child_handle);
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_unload_name_space
|
* FUNCTION: acpi_ns_unload_name_space
|
||||||
@@ -415,32 +388,27 @@ acpi_ns_delete_subtree (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_unload_namespace(acpi_handle handle)
|
||||||
acpi_ns_unload_namespace (
|
|
||||||
acpi_handle handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_unload_name_space");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_unload_name_space");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!acpi_gbl_root_node) {
|
if (!acpi_gbl_root_node) {
|
||||||
return_ACPI_STATUS (AE_NO_NAMESPACE);
|
return_ACPI_STATUS(AE_NO_NAMESPACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handle) {
|
if (!handle) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function does the real work */
|
/* This function does the real work */
|
||||||
|
|
||||||
status = acpi_ns_delete_subtree (handle);
|
status = acpi_ns_delete_subtree(handle);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -41,23 +41,17 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsnames")
|
ACPI_MODULE_NAME("nsnames")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ns_build_external_path (
|
acpi_ns_build_external_path(struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_size size, char *name_buffer);
|
||||||
acpi_size size,
|
|
||||||
char *name_buffer);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -75,17 +69,13 @@ acpi_ns_build_external_path (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ns_build_external_path (
|
acpi_ns_build_external_path(struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_size size, char *name_buffer)
|
||||||
acpi_size size,
|
|
||||||
char *name_buffer)
|
|
||||||
{
|
{
|
||||||
acpi_size index;
|
acpi_size index;
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("ns_build_external_path");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_NAME("ns_build_external_path");
|
||||||
|
|
||||||
/* Special case for root */
|
/* Special case for root */
|
||||||
|
|
||||||
@@ -106,8 +96,8 @@ acpi_ns_build_external_path (
|
|||||||
|
|
||||||
/* Put the name into the buffer */
|
/* Put the name into the buffer */
|
||||||
|
|
||||||
ACPI_MOVE_32_TO_32 ((name_buffer + index), &parent_node->name);
|
ACPI_MOVE_32_TO_32((name_buffer + index), &parent_node->name);
|
||||||
parent_node = acpi_ns_get_parent_node (parent_node);
|
parent_node = acpi_ns_get_parent_node(parent_node);
|
||||||
|
|
||||||
/* Prefix name with the path separator */
|
/* Prefix name with the path separator */
|
||||||
|
|
||||||
@@ -120,15 +110,14 @@ acpi_ns_build_external_path (
|
|||||||
name_buffer[index] = AML_ROOT_PREFIX;
|
name_buffer[index] = AML_ROOT_PREFIX;
|
||||||
|
|
||||||
if (index != 0) {
|
if (index != 0) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Could not construct pathname; index=%X, size=%X, Path=%s\n",
|
"Could not construct pathname; index=%X, size=%X, Path=%s\n",
|
||||||
(u32) index, (u32) size, &name_buffer[size]));
|
(u32) index, (u32) size, &name_buffer[size]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -144,37 +133,32 @@ acpi_ns_build_external_path (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
char *
|
char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node)
|
||||||
acpi_ns_get_external_pathname (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
char *name_buffer;
|
char *name_buffer;
|
||||||
acpi_size size;
|
acpi_size size;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_get_external_pathname", node);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ns_get_external_pathname", node);
|
||||||
|
|
||||||
/* Calculate required buffer size based on depth below root */
|
/* Calculate required buffer size based on depth below root */
|
||||||
|
|
||||||
size = acpi_ns_get_pathname_length (node);
|
size = acpi_ns_get_pathname_length(node);
|
||||||
|
|
||||||
/* Allocate a buffer to be returned to caller */
|
/* Allocate a buffer to be returned to caller */
|
||||||
|
|
||||||
name_buffer = ACPI_MEM_CALLOCATE (size);
|
name_buffer = ACPI_MEM_CALLOCATE(size);
|
||||||
if (!name_buffer) {
|
if (!name_buffer) {
|
||||||
ACPI_REPORT_ERROR (("ns_get_table_pathname: allocation failure\n"));
|
ACPI_REPORT_ERROR(("ns_get_table_pathname: allocation failure\n"));
|
||||||
return_PTR (NULL);
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the path in the allocated buffer */
|
/* Build the path in the allocated buffer */
|
||||||
|
|
||||||
acpi_ns_build_external_path (node, size, name_buffer);
|
acpi_ns_build_external_path(node, size, name_buffer);
|
||||||
return_PTR (name_buffer);
|
return_PTR(name_buffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_pathname_length
|
* FUNCTION: acpi_ns_get_pathname_length
|
||||||
@@ -187,16 +171,12 @@ acpi_ns_get_external_pathname (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_size
|
acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
|
||||||
acpi_ns_get_pathname_length (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
acpi_size size;
|
acpi_size size;
|
||||||
struct acpi_namespace_node *next_node;
|
struct acpi_namespace_node *next_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute length of pathname as 5 * number of name segments.
|
* Compute length of pathname as 5 * number of name segments.
|
||||||
@@ -207,17 +187,16 @@ acpi_ns_get_pathname_length (
|
|||||||
|
|
||||||
while (next_node && (next_node != acpi_gbl_root_node)) {
|
while (next_node && (next_node != acpi_gbl_root_node)) {
|
||||||
size += ACPI_PATH_SEGMENT_LENGTH;
|
size += ACPI_PATH_SEGMENT_LENGTH;
|
||||||
next_node = acpi_ns_get_parent_node (next_node);
|
next_node = acpi_ns_get_parent_node(next_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!size) {
|
if (!size) {
|
||||||
size = 1; /* Root node case */
|
size = 1; /* Root node case */
|
||||||
}
|
}
|
||||||
|
|
||||||
return (size + 1); /* +1 for null string terminator */
|
return (size + 1); /* +1 for null string terminator */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_handle_to_pathname
|
* FUNCTION: acpi_ns_handle_to_pathname
|
||||||
@@ -233,41 +212,36 @@ acpi_ns_get_pathname_length (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_handle_to_pathname (
|
acpi_ns_handle_to_pathname(acpi_handle target_handle,
|
||||||
acpi_handle target_handle,
|
struct acpi_buffer * buffer)
|
||||||
struct acpi_buffer *buffer)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_size required_size;
|
acpi_size required_size;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ns_handle_to_pathname", target_handle);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_handle_to_pathname", target_handle);
|
node = acpi_ns_map_handle_to_node(target_handle);
|
||||||
|
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (target_handle);
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine size required for the caller buffer */
|
/* Determine size required for the caller buffer */
|
||||||
|
|
||||||
required_size = acpi_ns_get_pathname_length (node);
|
required_size = acpi_ns_get_pathname_length(node);
|
||||||
|
|
||||||
/* Validate/Allocate/Clear caller buffer */
|
/* Validate/Allocate/Clear caller buffer */
|
||||||
|
|
||||||
status = acpi_ut_initialize_buffer (buffer, required_size);
|
status = acpi_ut_initialize_buffer(buffer, required_size);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the path in the caller buffer */
|
/* Build the path in the caller buffer */
|
||||||
|
|
||||||
acpi_ns_build_external_path (node, required_size, buffer->pointer);
|
acpi_ns_build_external_path(node, required_size, buffer->pointer);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%s [%X] \n",
|
||||||
(char *) buffer->pointer, (u32) required_size));
|
(char *)buffer->pointer, (u32) required_size));
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsobject")
|
ACPI_MODULE_NAME("nsobject")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -71,20 +68,15 @@
|
|||||||
* MUTEX: Assumes namespace is locked
|
* MUTEX: Assumes namespace is locked
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_attach_object (
|
acpi_ns_attach_object(struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
union acpi_operand_object *object, acpi_object_type type)
|
||||||
union acpi_operand_object *object,
|
|
||||||
acpi_object_type type)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *last_obj_desc;
|
union acpi_operand_object *last_obj_desc;
|
||||||
acpi_object_type object_type = ACPI_TYPE_ANY;
|
acpi_object_type object_type = ACPI_TYPE_ANY;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_attach_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_attach_object");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parameter validation
|
* Parameter validation
|
||||||
@@ -92,40 +84,39 @@ acpi_ns_attach_object (
|
|||||||
if (!node) {
|
if (!node) {
|
||||||
/* Invalid handle */
|
/* Invalid handle */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("ns_attach_object: Null named_obj handle\n"));
|
ACPI_REPORT_ERROR(("ns_attach_object: Null named_obj handle\n"));
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!object && (ACPI_TYPE_ANY != type)) {
|
if (!object && (ACPI_TYPE_ANY != type)) {
|
||||||
/* Null object */
|
/* Null object */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
|
||||||
"ns_attach_object: Null object, but type not ACPI_TYPE_ANY\n"));
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (node) != ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
|
||||||
/* Not a name handle */
|
/* Not a name handle */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("ns_attach_object: Invalid handle %p [%s]\n",
|
ACPI_REPORT_ERROR(("ns_attach_object: Invalid handle %p [%s]\n",
|
||||||
node, acpi_ut_get_descriptor_name (node)));
|
node, acpi_ut_get_descriptor_name(node)));
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if this object is already attached */
|
/* Check if this object is already attached */
|
||||||
|
|
||||||
if (node->object == object) {
|
if (node->object == object) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Obj %p already installed in name_obj %p\n",
|
"Obj %p already installed in name_obj %p\n",
|
||||||
object, node));
|
object, node));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If null object, we will just install it */
|
/* If null object, we will just install it */
|
||||||
|
|
||||||
if (!object) {
|
if (!object) {
|
||||||
obj_desc = NULL;
|
obj_desc = NULL;
|
||||||
object_type = ACPI_TYPE_ANY;
|
object_type = ACPI_TYPE_ANY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,14 +124,14 @@ acpi_ns_attach_object (
|
|||||||
* If the source object is a namespace Node with an attached object,
|
* If the source object is a namespace Node with an attached object,
|
||||||
* we will use that (attached) object
|
* we will use that (attached) object
|
||||||
*/
|
*/
|
||||||
else if ((ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) &&
|
else if ((ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) &&
|
||||||
((struct acpi_namespace_node *) object)->object) {
|
((struct acpi_namespace_node *)object)->object) {
|
||||||
/*
|
/*
|
||||||
* Value passed is a name handle and that name has a
|
* Value passed is a name handle and that name has a
|
||||||
* non-null value. Use that name's value and type.
|
* non-null value. Use that name's value and type.
|
||||||
*/
|
*/
|
||||||
obj_desc = ((struct acpi_namespace_node *) object)->object;
|
obj_desc = ((struct acpi_namespace_node *)object)->object;
|
||||||
object_type = ((struct acpi_namespace_node *) object)->type;
|
object_type = ((struct acpi_namespace_node *)object)->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -148,20 +139,20 @@ acpi_ns_attach_object (
|
|||||||
* it first
|
* it first
|
||||||
*/
|
*/
|
||||||
else {
|
else {
|
||||||
obj_desc = (union acpi_operand_object *) object;
|
obj_desc = (union acpi_operand_object *)object;
|
||||||
|
|
||||||
/* Use the given type */
|
/* Use the given type */
|
||||||
|
|
||||||
object_type = type;
|
object_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n",
|
||||||
obj_desc, node, acpi_ut_get_node_name (node)));
|
obj_desc, node, acpi_ut_get_node_name(node)));
|
||||||
|
|
||||||
/* Detach an existing attached object if present */
|
/* Detach an existing attached object if present */
|
||||||
|
|
||||||
if (node->object) {
|
if (node->object) {
|
||||||
acpi_ns_detach_object (node);
|
acpi_ns_detach_object(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
@@ -169,7 +160,7 @@ acpi_ns_attach_object (
|
|||||||
* Must increment the new value's reference count
|
* Must increment the new value's reference count
|
||||||
* (if it is an internal object)
|
* (if it is an internal object)
|
||||||
*/
|
*/
|
||||||
acpi_ut_add_reference (obj_desc);
|
acpi_ut_add_reference(obj_desc);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle objects with multiple descriptors - walk
|
* Handle objects with multiple descriptors - walk
|
||||||
@@ -185,13 +176,12 @@ acpi_ns_attach_object (
|
|||||||
last_obj_desc->common.next_object = node->object;
|
last_obj_desc->common.next_object = node->object;
|
||||||
}
|
}
|
||||||
|
|
||||||
node->type = (u8) object_type;
|
node->type = (u8) object_type;
|
||||||
node->object = obj_desc;
|
node->object = obj_desc;
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_detach_object
|
* FUNCTION: acpi_ns_detach_object
|
||||||
@@ -206,30 +196,27 @@ acpi_ns_attach_object (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_detach_object(struct acpi_namespace_node *node)
|
||||||
acpi_ns_detach_object (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_detach_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_detach_object");
|
||||||
|
|
||||||
obj_desc = node->object;
|
obj_desc = node->object;
|
||||||
|
|
||||||
if (!obj_desc ||
|
if (!obj_desc ||
|
||||||
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
|
(ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA)) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the entry in all cases */
|
/* Clear the entry in all cases */
|
||||||
|
|
||||||
node->object = NULL;
|
node->object = NULL;
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (obj_desc) == ACPI_DESC_TYPE_OPERAND) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_OPERAND) {
|
||||||
node->object = obj_desc->common.next_object;
|
node->object = obj_desc->common.next_object;
|
||||||
if (node->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;
|
node->object = node->object->common.next_object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,16 +225,15 @@ acpi_ns_detach_object (
|
|||||||
|
|
||||||
node->type = ACPI_TYPE_ANY;
|
node->type = ACPI_TYPE_ANY;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n",
|
||||||
node, acpi_ut_get_node_name (node), obj_desc));
|
node, acpi_ut_get_node_name(node), obj_desc));
|
||||||
|
|
||||||
/* Remove one reference on the object (and all subobjects) */
|
/* Remove one reference on the object (and all subobjects) */
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_attached_object
|
* FUNCTION: acpi_ns_get_attached_object
|
||||||
@@ -261,29 +247,28 @@ acpi_ns_detach_object (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
union acpi_operand_object *
|
union acpi_operand_object *acpi_ns_get_attached_object(struct
|
||||||
acpi_ns_get_attached_object (
|
acpi_namespace_node
|
||||||
struct acpi_namespace_node *node)
|
*node)
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_get_attached_object", node);
|
ACPI_FUNCTION_TRACE_PTR("ns_get_attached_object", node);
|
||||||
|
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Null Node ptr\n"));
|
||||||
return_PTR (NULL);
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node->object ||
|
if (!node->object ||
|
||||||
((ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_OPERAND) &&
|
((ACPI_GET_DESCRIPTOR_TYPE(node->object) != ACPI_DESC_TYPE_OPERAND)
|
||||||
(ACPI_GET_DESCRIPTOR_TYPE (node->object) != ACPI_DESC_TYPE_NAMED)) ||
|
&& (ACPI_GET_DESCRIPTOR_TYPE(node->object) !=
|
||||||
(ACPI_GET_OBJECT_TYPE (node->object) == ACPI_TYPE_LOCAL_DATA)) {
|
ACPI_DESC_TYPE_NAMED))
|
||||||
return_PTR (NULL);
|
|| (ACPI_GET_OBJECT_TYPE(node->object) == ACPI_TYPE_LOCAL_DATA)) {
|
||||||
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_PTR (node->object);
|
return_PTR(node->object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_secondary_object
|
* FUNCTION: acpi_ns_get_secondary_object
|
||||||
@@ -297,24 +282,23 @@ acpi_ns_get_attached_object (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
union acpi_operand_object *
|
union acpi_operand_object *acpi_ns_get_secondary_object(union
|
||||||
acpi_ns_get_secondary_object (
|
acpi_operand_object
|
||||||
union acpi_operand_object *obj_desc)
|
*obj_desc)
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_get_secondary_object", obj_desc);
|
ACPI_FUNCTION_TRACE_PTR("ns_get_secondary_object", obj_desc);
|
||||||
|
|
||||||
|
if ((!obj_desc) ||
|
||||||
if ((!obj_desc) ||
|
(ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
|
||||||
(ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) ||
|
(!obj_desc->common.next_object) ||
|
||||||
(!obj_desc->common.next_object) ||
|
(ACPI_GET_OBJECT_TYPE(obj_desc->common.next_object) ==
|
||||||
(ACPI_GET_OBJECT_TYPE (obj_desc->common.next_object) == ACPI_TYPE_LOCAL_DATA)) {
|
ACPI_TYPE_LOCAL_DATA)) {
|
||||||
return_PTR (NULL);
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_PTR (obj_desc->common.next_object);
|
return_PTR(obj_desc->common.next_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_attach_data
|
* FUNCTION: acpi_ns_attach_data
|
||||||
@@ -330,23 +314,20 @@ acpi_ns_get_secondary_object (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_attach_data (
|
acpi_ns_attach_data(struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_handler handler, void *data)
|
||||||
acpi_object_handler handler,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *prev_obj_desc;
|
union acpi_operand_object *prev_obj_desc;
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *data_desc;
|
union acpi_operand_object *data_desc;
|
||||||
|
|
||||||
|
|
||||||
/* We only allow one attachment per handler */
|
/* We only allow one attachment per handler */
|
||||||
|
|
||||||
prev_obj_desc = NULL;
|
prev_obj_desc = NULL;
|
||||||
obj_desc = node->object;
|
obj_desc = node->object;
|
||||||
while (obj_desc) {
|
while (obj_desc) {
|
||||||
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
|
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
|
||||||
(obj_desc->data.handler == handler)) {
|
(obj_desc->data.handler == handler)) {
|
||||||
return (AE_ALREADY_EXISTS);
|
return (AE_ALREADY_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +337,7 @@ acpi_ns_attach_data (
|
|||||||
|
|
||||||
/* Create an internal object for the data */
|
/* Create an internal object for the data */
|
||||||
|
|
||||||
data_desc = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_DATA);
|
data_desc = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_DATA);
|
||||||
if (!data_desc) {
|
if (!data_desc) {
|
||||||
return (AE_NO_MEMORY);
|
return (AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
@@ -368,15 +349,13 @@ acpi_ns_attach_data (
|
|||||||
|
|
||||||
if (prev_obj_desc) {
|
if (prev_obj_desc) {
|
||||||
prev_obj_desc->common.next_object = data_desc;
|
prev_obj_desc->common.next_object = data_desc;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
node->object = data_desc;
|
node->object = data_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_detach_data
|
* FUNCTION: acpi_ns_detach_data
|
||||||
@@ -392,27 +371,25 @@ acpi_ns_attach_data (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_detach_data (
|
acpi_ns_detach_data(struct acpi_namespace_node * node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_handler handler)
|
||||||
acpi_object_handler handler)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
union acpi_operand_object *prev_obj_desc;
|
union acpi_operand_object *prev_obj_desc;
|
||||||
|
|
||||||
|
|
||||||
prev_obj_desc = NULL;
|
prev_obj_desc = NULL;
|
||||||
obj_desc = node->object;
|
obj_desc = node->object;
|
||||||
while (obj_desc) {
|
while (obj_desc) {
|
||||||
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
|
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
|
||||||
(obj_desc->data.handler == handler)) {
|
(obj_desc->data.handler == handler)) {
|
||||||
if (prev_obj_desc) {
|
if (prev_obj_desc) {
|
||||||
prev_obj_desc->common.next_object = obj_desc->common.next_object;
|
prev_obj_desc->common.next_object =
|
||||||
}
|
obj_desc->common.next_object;
|
||||||
else {
|
} else {
|
||||||
node->object = obj_desc->common.next_object;
|
node->object = obj_desc->common.next_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ut_remove_reference (obj_desc);
|
acpi_ut_remove_reference(obj_desc);
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,7 +400,6 @@ acpi_ns_detach_data (
|
|||||||
return (AE_NOT_FOUND);
|
return (AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_attached_data
|
* FUNCTION: acpi_ns_get_attached_data
|
||||||
@@ -440,18 +416,15 @@ acpi_ns_detach_data (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_get_attached_data (
|
acpi_ns_get_attached_data(struct acpi_namespace_node * node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_handler handler, void **data)
|
||||||
acpi_object_handler handler,
|
|
||||||
void **data)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
obj_desc = node->object;
|
obj_desc = node->object;
|
||||||
while (obj_desc) {
|
while (obj_desc) {
|
||||||
if ((ACPI_GET_OBJECT_TYPE (obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
|
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_DATA) &&
|
||||||
(obj_desc->data.handler == handler)) {
|
(obj_desc->data.handler == handler)) {
|
||||||
*data = obj_desc->data.pointer;
|
*data = obj_desc->data.pointer;
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
@@ -461,5 +434,3 @@ acpi_ns_get_attached_data (
|
|||||||
|
|
||||||
return (AE_NOT_FOUND);
|
return (AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,16 +41,13 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsparse")
|
ACPI_MODULE_NAME("nsparse")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -64,54 +61,50 @@
|
|||||||
* DESCRIPTION: Perform one complete parse of an ACPI/AML table.
|
* DESCRIPTION: Perform one complete parse of an ACPI/AML table.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_one_complete_parse (
|
acpi_ns_one_complete_parse(u8 pass_number, struct acpi_table_desc * table_desc)
|
||||||
u8 pass_number,
|
|
||||||
struct acpi_table_desc *table_desc)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *parse_root;
|
union acpi_parse_object *parse_root;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_walk_state *walk_state;
|
struct acpi_walk_state *walk_state;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_one_complete_parse");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_one_complete_parse");
|
||||||
|
|
||||||
/* Create and init a Root Node */
|
/* Create and init a Root Node */
|
||||||
|
|
||||||
parse_root = acpi_ps_create_scope_op ();
|
parse_root = acpi_ps_create_scope_op();
|
||||||
if (!parse_root) {
|
if (!parse_root) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and initialize a new walk state */
|
/* Create and initialize a new walk state */
|
||||||
|
|
||||||
walk_state = acpi_ds_create_walk_state (table_desc->owner_id,
|
walk_state = acpi_ds_create_walk_state(table_desc->owner_id,
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (!walk_state) {
|
if (!walk_state) {
|
||||||
acpi_ps_free_op (parse_root);
|
acpi_ps_free_op(parse_root);
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_init_aml_walk (walk_state, parse_root, NULL,
|
status = acpi_ds_init_aml_walk(walk_state, parse_root, NULL,
|
||||||
table_desc->aml_start, table_desc->aml_length,
|
table_desc->aml_start,
|
||||||
NULL, pass_number);
|
table_desc->aml_length, NULL,
|
||||||
if (ACPI_FAILURE (status)) {
|
pass_number);
|
||||||
acpi_ds_delete_walk_state (walk_state);
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
acpi_ds_delete_walk_state(walk_state);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the AML */
|
/* 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",
|
||||||
status = acpi_ps_parse_aml (walk_state);
|
pass_number));
|
||||||
|
status = acpi_ps_parse_aml(walk_state);
|
||||||
|
|
||||||
acpi_ps_delete_parse_tree (parse_root);
|
acpi_ps_delete_parse_tree(parse_root);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_parse_table
|
* FUNCTION: acpi_ns_parse_table
|
||||||
@@ -126,15 +119,12 @@ acpi_ns_one_complete_parse (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_parse_table (
|
acpi_ns_parse_table(struct acpi_table_desc *table_desc,
|
||||||
struct acpi_table_desc *table_desc,
|
struct acpi_namespace_node *start_node)
|
||||||
struct acpi_namespace_node *start_node)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_parse_table");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_parse_table");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AML Parse, pass 1
|
* AML Parse, pass 1
|
||||||
@@ -146,10 +136,10 @@ acpi_ns_parse_table (
|
|||||||
* to service the entire parse. The second pass of the parse then
|
* to service the entire parse. The second pass of the parse then
|
||||||
* performs another complete parse of the AML..
|
* performs another complete parse of the AML..
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n"));
|
||||||
status = acpi_ns_one_complete_parse (1, table_desc);
|
status = acpi_ns_one_complete_parse(1, table_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -161,13 +151,11 @@ acpi_ns_parse_table (
|
|||||||
* overhead of this is compensated for by the fact that the
|
* overhead of this is compensated for by the fact that the
|
||||||
* parse objects are all cached.
|
* parse objects are all cached.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 2\n"));
|
||||||
status = acpi_ns_one_complete_parse (2, table_desc);
|
status = acpi_ns_one_complete_parse(2, table_desc);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,23 +41,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nssearch")
|
ACPI_MODULE_NAME("nssearch")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_search_parent_tree (
|
acpi_ns_search_parent_tree(u32 target_name,
|
||||||
u32 target_name,
|
struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_type type,
|
||||||
acpi_object_type type,
|
struct acpi_namespace_node **return_node);
|
||||||
struct acpi_namespace_node **return_node);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -87,30 +82,28 @@ acpi_ns_search_parent_tree (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_search_node (
|
acpi_ns_search_node(u32 target_name,
|
||||||
u32 target_name,
|
struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_type type,
|
||||||
acpi_object_type type,
|
struct acpi_namespace_node **return_node)
|
||||||
struct acpi_namespace_node **return_node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *next_node;
|
struct acpi_namespace_node *next_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_search_node");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_search_node");
|
||||||
|
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
if (ACPI_LV_NAMES & acpi_dbg_level) {
|
if (ACPI_LV_NAMES & acpi_dbg_level) {
|
||||||
char *scope_name;
|
char *scope_name;
|
||||||
|
|
||||||
scope_name = acpi_ns_get_external_pathname (node);
|
scope_name = acpi_ns_get_external_pathname(node);
|
||||||
if (scope_name) {
|
if (scope_name) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Searching %s (%p) For [%4.4s] (%s)\n",
|
"Searching %s (%p) For [%4.4s] (%s)\n",
|
||||||
scope_name, node, (char *) &target_name,
|
scope_name, node,
|
||||||
acpi_ut_get_type_name (type)));
|
(char *)&target_name,
|
||||||
|
acpi_ut_get_type_name(type)));
|
||||||
|
|
||||||
ACPI_MEM_FREE (scope_name);
|
ACPI_MEM_FREE(scope_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -126,20 +119,26 @@ acpi_ns_search_node (
|
|||||||
if (next_node->name.integer == target_name) {
|
if (next_node->name.integer == target_name) {
|
||||||
/* Resolve a control method alias if any */
|
/* Resolve a control method alias if any */
|
||||||
|
|
||||||
if (acpi_ns_get_type (next_node) == ACPI_TYPE_LOCAL_METHOD_ALIAS) {
|
if (acpi_ns_get_type(next_node) ==
|
||||||
next_node = ACPI_CAST_PTR (struct acpi_namespace_node, next_node->object);
|
ACPI_TYPE_LOCAL_METHOD_ALIAS) {
|
||||||
|
next_node =
|
||||||
|
ACPI_CAST_PTR(struct acpi_namespace_node,
|
||||||
|
next_node->object);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Found matching entry.
|
* Found matching entry.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
|
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
|
||||||
(char *) &target_name, acpi_ut_get_type_name (next_node->type),
|
(char *)&target_name,
|
||||||
next_node, acpi_ut_get_node_name (node), node));
|
acpi_ut_get_type_name(next_node->
|
||||||
|
type),
|
||||||
|
next_node,
|
||||||
|
acpi_ut_get_node_name(node), node));
|
||||||
|
|
||||||
*return_node = next_node;
|
*return_node = next_node;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -159,15 +158,14 @@ acpi_ns_search_node (
|
|||||||
|
|
||||||
/* Searched entire namespace level, not found */
|
/* Searched entire namespace level, not found */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
|
"Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
|
||||||
(char *) &target_name, acpi_ut_get_type_name (type),
|
(char *)&target_name, acpi_ut_get_type_name(type),
|
||||||
acpi_ut_get_node_name (node), node, node->child));
|
acpi_ut_get_node_name(node), node, node->child));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_NOT_FOUND);
|
return_ACPI_STATUS(AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_search_parent_tree
|
* FUNCTION: acpi_ns_search_parent_tree
|
||||||
@@ -194,43 +192,42 @@ acpi_ns_search_node (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_search_parent_tree (
|
acpi_ns_search_parent_tree(u32 target_name,
|
||||||
u32 target_name,
|
struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_object_type type,
|
||||||
acpi_object_type type,
|
struct acpi_namespace_node **return_node)
|
||||||
struct acpi_namespace_node **return_node)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_search_parent_tree");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_search_parent_tree");
|
parent_node = acpi_ns_get_parent_node(node);
|
||||||
|
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (node);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there is no parent (i.e., we are at the root) or type is "local",
|
* If there is no parent (i.e., we are at the root) or type is "local",
|
||||||
* we won't be searching the parent tree.
|
* we won't be searching the parent tree.
|
||||||
*/
|
*/
|
||||||
if (!parent_node) {
|
if (!parent_node) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
|
||||||
(char *) &target_name));
|
(char *)&target_name));
|
||||||
return_ACPI_STATUS (AE_NOT_FOUND);
|
return_ACPI_STATUS(AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acpi_ns_local (type)) {
|
if (acpi_ns_local(type)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
|
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
|
||||||
(char *) &target_name, acpi_ut_get_type_name (type)));
|
(char *)&target_name,
|
||||||
return_ACPI_STATUS (AE_NOT_FOUND);
|
acpi_ut_get_type_name(type)));
|
||||||
|
return_ACPI_STATUS(AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the parent tree */
|
/* Search the parent tree */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"Searching parent [%4.4s] for [%4.4s]\n",
|
"Searching parent [%4.4s] for [%4.4s]\n",
|
||||||
acpi_ut_get_node_name (parent_node), (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
|
* Search parents until target is found or we have backed up to the root
|
||||||
@@ -241,25 +238,24 @@ acpi_ns_search_parent_tree (
|
|||||||
* object type at this point, we only care about the existence of
|
* object type at this point, we only care about the existence of
|
||||||
* the actual name we are searching for. Typechecking comes later.
|
* the actual name we are searching for. Typechecking comes later.
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_search_node (target_name, parent_node,
|
status = acpi_ns_search_node(target_name, parent_node,
|
||||||
ACPI_TYPE_ANY, return_node);
|
ACPI_TYPE_ANY, return_node);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Not found here, go up another level
|
* Not found here, go up another level
|
||||||
* (until we reach the root)
|
* (until we reach the root)
|
||||||
*/
|
*/
|
||||||
parent_node = acpi_ns_get_parent_node (parent_node);
|
parent_node = acpi_ns_get_parent_node(parent_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not found in parent tree */
|
/* Not found in parent tree */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_NOT_FOUND);
|
return_ACPI_STATUS(AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_search_and_enter
|
* FUNCTION: acpi_ns_search_and_enter
|
||||||
@@ -286,52 +282,46 @@ acpi_ns_search_parent_tree (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_search_and_enter (
|
acpi_ns_search_and_enter(u32 target_name,
|
||||||
u32 target_name,
|
struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
struct acpi_namespace_node *node,
|
||||||
struct acpi_namespace_node *node,
|
acpi_interpreter_mode interpreter_mode,
|
||||||
acpi_interpreter_mode interpreter_mode,
|
acpi_object_type type,
|
||||||
acpi_object_type type,
|
u32 flags, struct acpi_namespace_node **return_node)
|
||||||
u32 flags,
|
|
||||||
struct acpi_namespace_node **return_node)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *new_node;
|
struct acpi_namespace_node *new_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_search_and_enter");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_search_and_enter");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!node || !target_name || !return_node) {
|
if (!node || !target_name || !return_node) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Null param: Node %p Name %X return_node %p\n",
|
"Null param: Node %p Name %X return_node %p\n",
|
||||||
node, target_name, return_node));
|
node, target_name, return_node));
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("ns_search_and_enter: Null parameter\n"));
|
ACPI_REPORT_ERROR(("ns_search_and_enter: Null parameter\n"));
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Name must consist of printable characters */
|
/* Name must consist of printable characters */
|
||||||
|
|
||||||
if (!acpi_ut_valid_acpi_name (target_name)) {
|
if (!acpi_ut_valid_acpi_name(target_name)) {
|
||||||
ACPI_REPORT_ERROR (("ns_search_and_enter: Bad character in ACPI Name: %X\n",
|
ACPI_REPORT_ERROR(("ns_search_and_enter: Bad character in ACPI Name: %X\n", target_name));
|
||||||
target_name));
|
return_ACPI_STATUS(AE_BAD_CHARACTER);
|
||||||
return_ACPI_STATUS (AE_BAD_CHARACTER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to find the name in the namespace level specified by the caller */
|
/* Try to find the name in the namespace level specified by the caller */
|
||||||
|
|
||||||
*return_node = ACPI_ENTRY_NOT_FOUND;
|
*return_node = ACPI_ENTRY_NOT_FOUND;
|
||||||
status = acpi_ns_search_node (target_name, node, type, return_node);
|
status = acpi_ns_search_node(target_name, node, type, return_node);
|
||||||
if (status != AE_NOT_FOUND) {
|
if (status != AE_NOT_FOUND) {
|
||||||
/*
|
/*
|
||||||
* If we found it AND the request specifies that a find is an error,
|
* If we found it AND the request specifies that a find is an error,
|
||||||
* return the error
|
* return the error
|
||||||
*/
|
*/
|
||||||
if ((status == AE_OK) &&
|
if ((status == AE_OK) && (flags & ACPI_NS_ERROR_IF_FOUND)) {
|
||||||
(flags & ACPI_NS_ERROR_IF_FOUND)) {
|
|
||||||
status = AE_ALREADY_EXISTS;
|
status = AE_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +329,7 @@ acpi_ns_search_and_enter (
|
|||||||
* Either found it or there was an error
|
* Either found it or there was an error
|
||||||
* -- finished either way
|
* -- finished either way
|
||||||
*/
|
*/
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -351,14 +341,16 @@ acpi_ns_search_and_enter (
|
|||||||
* and during the execution phase.
|
* and during the execution phase.
|
||||||
*/
|
*/
|
||||||
if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
|
if ((interpreter_mode != ACPI_IMODE_LOAD_PASS1) &&
|
||||||
(flags & ACPI_NS_SEARCH_PARENT)) {
|
(flags & ACPI_NS_SEARCH_PARENT)) {
|
||||||
/*
|
/*
|
||||||
* Not found at this level - search parent tree according to the
|
* Not found at this level - search parent tree according to the
|
||||||
* ACPI specification
|
* ACPI specification
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_search_parent_tree (target_name, node, type, return_node);
|
status =
|
||||||
if (ACPI_SUCCESS (status)) {
|
acpi_ns_search_parent_tree(target_name, node, type,
|
||||||
return_ACPI_STATUS (status);
|
return_node);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,25 +358,24 @@ acpi_ns_search_and_enter (
|
|||||||
* In execute mode, just search, never add names. Exit now.
|
* In execute mode, just search, never add names. Exit now.
|
||||||
*/
|
*/
|
||||||
if (interpreter_mode == ACPI_IMODE_EXECUTE) {
|
if (interpreter_mode == ACPI_IMODE_EXECUTE) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
|
ACPI_DEBUG_PRINT((ACPI_DB_NAMES,
|
||||||
"%4.4s Not found in %p [Not adding]\n",
|
"%4.4s Not found in %p [Not adding]\n",
|
||||||
(char *) &target_name, node));
|
(char *)&target_name, node));
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_NOT_FOUND);
|
return_ACPI_STATUS(AE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the new named object */
|
/* Create the new named object */
|
||||||
|
|
||||||
new_node = acpi_ns_create_node (target_name);
|
new_node = acpi_ns_create_node(target_name);
|
||||||
if (!new_node) {
|
if (!new_node) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Install the new object into the parent's list of children */
|
/* Install the new object into the parent's list of children */
|
||||||
|
|
||||||
acpi_ns_install_node (walk_state, node, new_node, type);
|
acpi_ns_install_node(walk_state, node, new_node, type);
|
||||||
*return_node = new_node;
|
*return_node = new_node;
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,28 +42,21 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/actables.h>
|
#include <acpi/actables.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsutils")
|
ACPI_MODULE_NAME("nsutils")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
static u8 acpi_ns_valid_path_separator(char sep);
|
||||||
static u8
|
|
||||||
acpi_ns_valid_path_separator (
|
|
||||||
char sep);
|
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
acpi_name
|
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node *node_to_search);
|
||||||
acpi_ns_find_parent_name (
|
|
||||||
struct acpi_namespace_node *node_to_search);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_report_error
|
* FUNCTION: acpi_ns_report_error
|
||||||
@@ -81,51 +74,45 @@ acpi_ns_find_parent_name (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ns_report_error (
|
acpi_ns_report_error(char *module_name,
|
||||||
char *module_name,
|
u32 line_number,
|
||||||
u32 line_number,
|
u32 component_id,
|
||||||
u32 component_id,
|
char *internal_name, acpi_status lookup_status)
|
||||||
char *internal_name,
|
|
||||||
acpi_status lookup_status)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
|
|
||||||
|
acpi_os_printf("%8s-%04d: *** Error: Looking up ",
|
||||||
acpi_os_printf ("%8s-%04d: *** Error: Looking up ",
|
module_name, line_number);
|
||||||
module_name, line_number);
|
|
||||||
|
|
||||||
if (lookup_status == AE_BAD_CHARACTER) {
|
if (lookup_status == AE_BAD_CHARACTER) {
|
||||||
/* There is a non-ascii character in the name */
|
/* There is a non-ascii character in the name */
|
||||||
|
|
||||||
acpi_os_printf ("[0x%4.4X] (NON-ASCII)\n",
|
acpi_os_printf("[0x%4.4X] (NON-ASCII)\n",
|
||||||
*(ACPI_CAST_PTR (u32, internal_name)));
|
*(ACPI_CAST_PTR(u32, internal_name)));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Convert path to external format */
|
/* Convert path to external format */
|
||||||
|
|
||||||
status = acpi_ns_externalize_name (ACPI_UINT32_MAX,
|
status = acpi_ns_externalize_name(ACPI_UINT32_MAX,
|
||||||
internal_name, NULL, &name);
|
internal_name, NULL, &name);
|
||||||
|
|
||||||
/* Print target name */
|
/* Print target name */
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
acpi_os_printf ("[%s]", name);
|
acpi_os_printf("[%s]", name);
|
||||||
}
|
} else {
|
||||||
else {
|
acpi_os_printf("[COULD NOT EXTERNALIZE NAME]");
|
||||||
acpi_os_printf ("[COULD NOT EXTERNALIZE NAME]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
ACPI_MEM_FREE (name);
|
ACPI_MEM_FREE(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_os_printf (" in namespace, %s\n",
|
acpi_os_printf(" in namespace, %s\n",
|
||||||
acpi_format_exception (lookup_status));
|
acpi_format_exception(lookup_status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_report_method_error
|
* FUNCTION: acpi_ns_report_method_error
|
||||||
@@ -145,34 +132,31 @@ acpi_ns_report_error (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ns_report_method_error (
|
acpi_ns_report_method_error(char *module_name,
|
||||||
char *module_name,
|
u32 line_number,
|
||||||
u32 line_number,
|
u32 component_id,
|
||||||
u32 component_id,
|
char *message,
|
||||||
char *message,
|
struct acpi_namespace_node *prefix_node,
|
||||||
struct acpi_namespace_node *prefix_node,
|
char *path, acpi_status method_status)
|
||||||
char *path,
|
|
||||||
acpi_status method_status)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node = prefix_node;
|
struct acpi_namespace_node *node = prefix_node;
|
||||||
|
|
||||||
|
|
||||||
if (path) {
|
if (path) {
|
||||||
status = acpi_ns_get_node_by_path (path, prefix_node,
|
status = acpi_ns_get_node_by_path(path, prefix_node,
|
||||||
ACPI_NS_NO_UPSEARCH, &node);
|
ACPI_NS_NO_UPSEARCH, &node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_os_printf ("report_method_error: Could not get node\n");
|
acpi_os_printf
|
||||||
|
("report_method_error: Could not get node\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_os_printf ("%8s-%04d: *** Error: ", module_name, line_number);
|
acpi_os_printf("%8s-%04d: *** Error: ", module_name, line_number);
|
||||||
acpi_ns_print_node_pathname (node, message);
|
acpi_ns_print_node_pathname(node, message);
|
||||||
acpi_os_printf (", %s\n", acpi_format_exception (method_status));
|
acpi_os_printf(", %s\n", acpi_format_exception(method_status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_print_node_pathname
|
* FUNCTION: acpi_ns_print_node_pathname
|
||||||
@@ -186,16 +170,13 @@ acpi_ns_report_method_error (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ns_print_node_pathname (
|
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, char *message)
|
||||||
struct acpi_namespace_node *node,
|
|
||||||
char *message)
|
|
||||||
{
|
{
|
||||||
struct acpi_buffer buffer;
|
struct acpi_buffer buffer;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
acpi_os_printf ("[NULL NAME]");
|
acpi_os_printf("[NULL NAME]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,18 +184,17 @@ acpi_ns_print_node_pathname (
|
|||||||
|
|
||||||
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
|
||||||
|
|
||||||
status = acpi_ns_handle_to_pathname (node, &buffer);
|
status = acpi_ns_handle_to_pathname(node, &buffer);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
if (message) {
|
if (message) {
|
||||||
acpi_os_printf ("%s ", message);
|
acpi_os_printf("%s ", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_os_printf ("[%s] (Node %p)", (char *) buffer.pointer, node);
|
acpi_os_printf("[%s] (Node %p)", (char *)buffer.pointer, node);
|
||||||
ACPI_MEM_FREE (buffer.pointer);
|
ACPI_MEM_FREE(buffer.pointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_valid_root_prefix
|
* FUNCTION: acpi_ns_valid_root_prefix
|
||||||
@@ -227,15 +207,12 @@ acpi_ns_print_node_pathname (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8
|
u8 acpi_ns_valid_root_prefix(char prefix)
|
||||||
acpi_ns_valid_root_prefix (
|
|
||||||
char prefix)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((u8) (prefix == '\\'));
|
return ((u8) (prefix == '\\'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_valid_path_separator
|
* FUNCTION: acpi_ns_valid_path_separator
|
||||||
@@ -248,15 +225,12 @@ acpi_ns_valid_root_prefix (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u8
|
static u8 acpi_ns_valid_path_separator(char sep)
|
||||||
acpi_ns_valid_path_separator (
|
|
||||||
char sep)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((u8) (sep == '.'));
|
return ((u8) (sep == '.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_type
|
* FUNCTION: acpi_ns_get_type
|
||||||
@@ -269,22 +243,18 @@ acpi_ns_valid_path_separator (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_object_type
|
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node * node)
|
||||||
acpi_ns_get_type (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ns_get_type");
|
ACPI_FUNCTION_TRACE("ns_get_type");
|
||||||
|
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
ACPI_REPORT_WARNING (("ns_get_type: Null Node input pointer\n"));
|
ACPI_REPORT_WARNING(("ns_get_type: Null Node input pointer\n"));
|
||||||
return_VALUE (ACPI_TYPE_ANY);
|
return_VALUE(ACPI_TYPE_ANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE ((acpi_object_type) node->type);
|
return_VALUE((acpi_object_type) node->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_local
|
* FUNCTION: acpi_ns_local
|
||||||
@@ -298,24 +268,20 @@ acpi_ns_get_type (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32 acpi_ns_local(acpi_object_type type)
|
||||||
acpi_ns_local (
|
|
||||||
acpi_object_type type)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE ("ns_local");
|
ACPI_FUNCTION_TRACE("ns_local");
|
||||||
|
|
||||||
|
if (!acpi_ut_valid_object_type(type)) {
|
||||||
if (!acpi_ut_valid_object_type (type)) {
|
|
||||||
/* Type code out of range */
|
/* Type code out of range */
|
||||||
|
|
||||||
ACPI_REPORT_WARNING (("ns_local: Invalid Object Type\n"));
|
ACPI_REPORT_WARNING(("ns_local: Invalid Object Type\n"));
|
||||||
return_VALUE (ACPI_NS_NORMAL);
|
return_VALUE(ACPI_NS_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE ((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
|
return_VALUE((u32) acpi_gbl_ns_properties[type] & ACPI_NS_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_internal_name_length
|
* FUNCTION: acpi_ns_get_internal_name_length
|
||||||
@@ -330,16 +296,12 @@ acpi_ns_local (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info)
|
||||||
acpi_ns_get_internal_name_length (
|
|
||||||
struct acpi_namestring_info *info)
|
|
||||||
{
|
{
|
||||||
char *next_external_char;
|
char *next_external_char;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
next_external_char = info->external_name;
|
next_external_char = info->external_name;
|
||||||
info->num_carats = 0;
|
info->num_carats = 0;
|
||||||
@@ -353,11 +315,10 @@ acpi_ns_get_internal_name_length (
|
|||||||
*
|
*
|
||||||
* strlen() + 1 covers the first name_seg, which has no path separator
|
* strlen() + 1 covers the first name_seg, which has no path separator
|
||||||
*/
|
*/
|
||||||
if (acpi_ns_valid_root_prefix (next_external_char[0])) {
|
if (acpi_ns_valid_root_prefix(next_external_char[0])) {
|
||||||
info->fully_qualified = TRUE;
|
info->fully_qualified = TRUE;
|
||||||
next_external_char++;
|
next_external_char++;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Handle Carat prefixes
|
* Handle Carat prefixes
|
||||||
*/
|
*/
|
||||||
@@ -375,19 +336,18 @@ acpi_ns_get_internal_name_length (
|
|||||||
if (*next_external_char) {
|
if (*next_external_char) {
|
||||||
info->num_segments = 1;
|
info->num_segments = 1;
|
||||||
for (i = 0; next_external_char[i]; i++) {
|
for (i = 0; next_external_char[i]; i++) {
|
||||||
if (acpi_ns_valid_path_separator (next_external_char[i])) {
|
if (acpi_ns_valid_path_separator(next_external_char[i])) {
|
||||||
info->num_segments++;
|
info->num_segments++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
info->length = (ACPI_NAME_SIZE * info->num_segments) +
|
info->length = (ACPI_NAME_SIZE * info->num_segments) +
|
||||||
4 + info->num_carats;
|
4 + info->num_carats;
|
||||||
|
|
||||||
info->next_external_char = next_external_char;
|
info->next_external_char = next_external_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_build_internal_name
|
* FUNCTION: acpi_ns_build_internal_name
|
||||||
@@ -401,19 +361,15 @@ acpi_ns_get_internal_name_length (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info)
|
||||||
acpi_ns_build_internal_name (
|
|
||||||
struct acpi_namestring_info *info)
|
|
||||||
{
|
{
|
||||||
u32 num_segments = info->num_segments;
|
u32 num_segments = info->num_segments;
|
||||||
char *internal_name = info->internal_name;
|
char *internal_name = info->internal_name;
|
||||||
char *external_name = info->next_external_char;
|
char *external_name = info->next_external_char;
|
||||||
char *result = NULL;
|
char *result = NULL;
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_build_internal_name");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_build_internal_name");
|
||||||
|
|
||||||
/* Setup the correct prefixes, counts, and pointers */
|
/* Setup the correct prefixes, counts, and pointers */
|
||||||
|
|
||||||
@@ -422,18 +378,15 @@ acpi_ns_build_internal_name (
|
|||||||
|
|
||||||
if (num_segments <= 1) {
|
if (num_segments <= 1) {
|
||||||
result = &internal_name[1];
|
result = &internal_name[1];
|
||||||
}
|
} else if (num_segments == 2) {
|
||||||
else if (num_segments == 2) {
|
|
||||||
internal_name[1] = AML_DUAL_NAME_PREFIX;
|
internal_name[1] = AML_DUAL_NAME_PREFIX;
|
||||||
result = &internal_name[2];
|
result = &internal_name[2];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
|
internal_name[1] = AML_MULTI_NAME_PREFIX_OP;
|
||||||
internal_name[2] = (char) num_segments;
|
internal_name[2] = (char)num_segments;
|
||||||
result = &internal_name[3];
|
result = &internal_name[3];
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* Not fully qualified.
|
* Not fully qualified.
|
||||||
* Handle Carats first, then append the name segments
|
* Handle Carats first, then append the name segments
|
||||||
@@ -447,15 +400,14 @@ acpi_ns_build_internal_name (
|
|||||||
|
|
||||||
if (num_segments <= 1) {
|
if (num_segments <= 1) {
|
||||||
result = &internal_name[i];
|
result = &internal_name[i];
|
||||||
}
|
} else if (num_segments == 2) {
|
||||||
else if (num_segments == 2) {
|
|
||||||
internal_name[i] = AML_DUAL_NAME_PREFIX;
|
internal_name[i] = AML_DUAL_NAME_PREFIX;
|
||||||
result = &internal_name[(acpi_native_uint) (i+1)];
|
result = &internal_name[(acpi_native_uint) (i + 1)];
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
internal_name[i] = AML_MULTI_NAME_PREFIX_OP;
|
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)] =
|
||||||
result = &internal_name[(acpi_native_uint) (i+2)];
|
(char)num_segments;
|
||||||
|
result = &internal_name[(acpi_native_uint) (i + 2)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,25 +415,25 @@ acpi_ns_build_internal_name (
|
|||||||
|
|
||||||
for (; num_segments; num_segments--) {
|
for (; num_segments; num_segments--) {
|
||||||
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
for (i = 0; i < ACPI_NAME_SIZE; i++) {
|
||||||
if (acpi_ns_valid_path_separator (*external_name) ||
|
if (acpi_ns_valid_path_separator(*external_name) ||
|
||||||
(*external_name == 0)) {
|
(*external_name == 0)) {
|
||||||
/* Pad the segment with underscore(s) if segment is short */
|
/* Pad the segment with underscore(s) if segment is short */
|
||||||
|
|
||||||
result[i] = '_';
|
result[i] = '_';
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Convert the character to uppercase and save it */
|
/* 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++;
|
external_name++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now we must have a path separator, or the pathname is bad */
|
/* Now we must have a path separator, or the pathname is bad */
|
||||||
|
|
||||||
if (!acpi_ns_valid_path_separator (*external_name) &&
|
if (!acpi_ns_valid_path_separator(*external_name) &&
|
||||||
(*external_name != 0)) {
|
(*external_name != 0)) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move on the next segment */
|
/* Move on the next segment */
|
||||||
@@ -495,18 +447,17 @@ acpi_ns_build_internal_name (
|
|||||||
*result = 0;
|
*result = 0;
|
||||||
|
|
||||||
if (info->fully_qualified) {
|
if (info->fully_qualified) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (abs) \"\\%s\"\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
internal_name, internal_name));
|
"Returning [%p] (abs) \"\\%s\"\n",
|
||||||
}
|
internal_name, internal_name));
|
||||||
else {
|
} else {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Returning [%p] (rel) \"%s\"\n",
|
||||||
internal_name, internal_name));
|
internal_name, internal_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_internalize_name
|
* FUNCTION: acpi_ns_internalize_name
|
||||||
@@ -522,51 +473,43 @@ acpi_ns_build_internal_name (
|
|||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ns_internalize_name(char *external_name, char **converted_name)
|
||||||
acpi_ns_internalize_name (
|
|
||||||
char *external_name,
|
|
||||||
char **converted_name)
|
|
||||||
{
|
{
|
||||||
char *internal_name;
|
char *internal_name;
|
||||||
struct acpi_namestring_info info;
|
struct acpi_namestring_info info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_internalize_name");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_internalize_name");
|
if ((!external_name) || (*external_name == 0) || (!converted_name)) {
|
||||||
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
|
|
||||||
if ((!external_name) ||
|
|
||||||
(*external_name == 0) ||
|
|
||||||
(!converted_name)) {
|
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the length of the new internal name */
|
/* Get the length of the new internal name */
|
||||||
|
|
||||||
info.external_name = external_name;
|
info.external_name = external_name;
|
||||||
acpi_ns_get_internal_name_length (&info);
|
acpi_ns_get_internal_name_length(&info);
|
||||||
|
|
||||||
/* We need a segment to store the internal name */
|
/* We need a segment to store the internal name */
|
||||||
|
|
||||||
internal_name = ACPI_MEM_CALLOCATE (info.length);
|
internal_name = ACPI_MEM_CALLOCATE(info.length);
|
||||||
if (!internal_name) {
|
if (!internal_name) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the name */
|
/* Build the name */
|
||||||
|
|
||||||
info.internal_name = internal_name;
|
info.internal_name = internal_name;
|
||||||
status = acpi_ns_build_internal_name (&info);
|
status = acpi_ns_build_internal_name(&info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_MEM_FREE (internal_name);
|
ACPI_MEM_FREE(internal_name);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
*converted_name = internal_name;
|
*converted_name = internal_name;
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_externalize_name
|
* FUNCTION: acpi_ns_externalize_name
|
||||||
@@ -585,27 +528,21 @@ acpi_ns_internalize_name (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_externalize_name (
|
acpi_ns_externalize_name(u32 internal_name_length,
|
||||||
u32 internal_name_length,
|
char *internal_name,
|
||||||
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 names_index = 0;
|
||||||
acpi_native_uint num_segments = 0;
|
acpi_native_uint num_segments = 0;
|
||||||
acpi_native_uint required_length;
|
acpi_native_uint required_length;
|
||||||
acpi_native_uint prefix_length = 0;
|
acpi_native_uint prefix_length = 0;
|
||||||
acpi_native_uint i = 0;
|
acpi_native_uint i = 0;
|
||||||
acpi_native_uint j = 0;
|
acpi_native_uint j = 0;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_externalize_name");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_externalize_name");
|
if (!internal_name_length || !internal_name || !converted_name) {
|
||||||
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
|
|
||||||
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++) {
|
for (i = 0; i < internal_name_length; i++) {
|
||||||
if (internal_name[i] == '^') {
|
if (internal_name[i] == '^') {
|
||||||
prefix_length = i + 1;
|
prefix_length = i + 1;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -648,7 +584,8 @@ acpi_ns_externalize_name (
|
|||||||
|
|
||||||
names_index = prefix_length + 2;
|
names_index = prefix_length + 2;
|
||||||
num_segments = (acpi_native_uint) (u8)
|
num_segments = (acpi_native_uint) (u8)
|
||||||
internal_name[(acpi_native_uint) (prefix_length + 1)];
|
internal_name[(acpi_native_uint)
|
||||||
|
(prefix_length + 1)];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AML_DUAL_NAME_PREFIX:
|
case AML_DUAL_NAME_PREFIX:
|
||||||
@@ -683,23 +620,23 @@ acpi_ns_externalize_name (
|
|||||||
* punctuation ('.') between object names, plus the NULL terminator.
|
* punctuation ('.') between object names, plus the NULL terminator.
|
||||||
*/
|
*/
|
||||||
required_length = prefix_length + (4 * num_segments) +
|
required_length = prefix_length + (4 * num_segments) +
|
||||||
((num_segments > 0) ? (num_segments - 1) : 0) + 1;
|
((num_segments > 0) ? (num_segments - 1) : 0) + 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check to see if we're still in bounds. If not, there's a problem
|
* Check to see if we're still in bounds. If not, there's a problem
|
||||||
* with internal_name (invalid format).
|
* with internal_name (invalid format).
|
||||||
*/
|
*/
|
||||||
if (required_length > internal_name_length) {
|
if (required_length > internal_name_length) {
|
||||||
ACPI_REPORT_ERROR (("ns_externalize_name: Invalid internal name\n"));
|
ACPI_REPORT_ERROR(("ns_externalize_name: Invalid internal name\n"));
|
||||||
return_ACPI_STATUS (AE_BAD_PATHNAME);
|
return_ACPI_STATUS(AE_BAD_PATHNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build converted_name
|
* Build converted_name
|
||||||
*/
|
*/
|
||||||
*converted_name = ACPI_MEM_CALLOCATE (required_length);
|
*converted_name = ACPI_MEM_CALLOCATE(required_length);
|
||||||
if (!(*converted_name)) {
|
if (!(*converted_name)) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
@@ -725,10 +662,9 @@ acpi_ns_externalize_name (
|
|||||||
*converted_name_length = (u32) required_length;
|
*converted_name_length = (u32) required_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_map_handle_to_node
|
* FUNCTION: acpi_ns_map_handle_to_node
|
||||||
@@ -745,13 +681,10 @@ acpi_ns_externalize_name (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
struct acpi_namespace_node *
|
struct acpi_namespace_node *acpi_ns_map_handle_to_node(acpi_handle handle)
|
||||||
acpi_ns_map_handle_to_node (
|
|
||||||
acpi_handle handle)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple implementation.
|
* Simple implementation.
|
||||||
@@ -766,14 +699,13 @@ acpi_ns_map_handle_to_node (
|
|||||||
|
|
||||||
/* We can at least attempt to verify the handle */
|
/* We can at least attempt to verify the handle */
|
||||||
|
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (handle) != ACPI_DESC_TYPE_NAMED) {
|
if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((struct acpi_namespace_node *) handle);
|
return ((struct acpi_namespace_node *)handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_convert_entry_to_handle
|
* FUNCTION: acpi_ns_convert_entry_to_handle
|
||||||
@@ -786,18 +718,14 @@ acpi_ns_map_handle_to_node (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_handle
|
acpi_handle acpi_ns_convert_entry_to_handle(struct acpi_namespace_node *node)
|
||||||
acpi_ns_convert_entry_to_handle (
|
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple implementation for now;
|
* Simple implementation for now;
|
||||||
*/
|
*/
|
||||||
return ((acpi_handle) node);
|
return ((acpi_handle) node);
|
||||||
|
|
||||||
|
|
||||||
/* Example future implementation ---------------------
|
/* Example future implementation ---------------------
|
||||||
|
|
||||||
if (!Node)
|
if (!Node)
|
||||||
@@ -810,12 +738,10 @@ acpi_ns_convert_entry_to_handle (
|
|||||||
return (ACPI_ROOT_OBJECT);
|
return (ACPI_ROOT_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ((acpi_handle) Node);
|
return ((acpi_handle) Node);
|
||||||
------------------------------------------------------*/
|
------------------------------------------------------*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_terminate
|
* FUNCTION: acpi_ns_terminate
|
||||||
@@ -828,42 +754,37 @@ acpi_ns_convert_entry_to_handle (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ns_terminate(void)
|
||||||
acpi_ns_terminate (
|
|
||||||
void)
|
|
||||||
{
|
{
|
||||||
union acpi_operand_object *obj_desc;
|
union acpi_operand_object *obj_desc;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_terminate");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_terminate");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1) Free the entire namespace -- all nodes and objects
|
* 1) Free the entire namespace -- all nodes and objects
|
||||||
*
|
*
|
||||||
* Delete all object descriptors attached to namepsace nodes
|
* Delete all object descriptors attached to namepsace nodes
|
||||||
*/
|
*/
|
||||||
acpi_ns_delete_namespace_subtree (acpi_gbl_root_node);
|
acpi_ns_delete_namespace_subtree(acpi_gbl_root_node);
|
||||||
|
|
||||||
/* Detach any objects attached to the root */
|
/* Detach any objects attached to the root */
|
||||||
|
|
||||||
obj_desc = acpi_ns_get_attached_object (acpi_gbl_root_node);
|
obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
|
||||||
if (obj_desc) {
|
if (obj_desc) {
|
||||||
acpi_ns_detach_object (acpi_gbl_root_node);
|
acpi_ns_detach_object(acpi_gbl_root_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n"));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2) Now we can delete the ACPI tables
|
* 2) Now we can delete the ACPI tables
|
||||||
*/
|
*/
|
||||||
acpi_tb_delete_all_tables ();
|
acpi_tb_delete_all_tables();
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ACPI Tables freed\n"));
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_opens_scope
|
* FUNCTION: acpi_ns_opens_scope
|
||||||
@@ -875,24 +796,21 @@ acpi_ns_terminate (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u32
|
u32 acpi_ns_opens_scope(acpi_object_type type)
|
||||||
acpi_ns_opens_scope (
|
|
||||||
acpi_object_type type)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_TRACE_STR ("ns_opens_scope", acpi_ut_get_type_name (type));
|
ACPI_FUNCTION_TRACE_STR("ns_opens_scope", acpi_ut_get_type_name(type));
|
||||||
|
|
||||||
|
if (!acpi_ut_valid_object_type(type)) {
|
||||||
if (!acpi_ut_valid_object_type (type)) {
|
|
||||||
/* type code out of range */
|
/* type code out of range */
|
||||||
|
|
||||||
ACPI_REPORT_WARNING (("ns_opens_scope: Invalid Object Type %X\n", type));
|
ACPI_REPORT_WARNING(("ns_opens_scope: Invalid Object Type %X\n",
|
||||||
return_VALUE (ACPI_NS_NORMAL);
|
type));
|
||||||
|
return_VALUE(ACPI_NS_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE (((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
|
return_VALUE(((u32) acpi_gbl_ns_properties[type]) & ACPI_NS_NEWSCOPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_node_by_path
|
* FUNCTION: acpi_ns_get_node_by_path
|
||||||
@@ -916,33 +834,29 @@ acpi_ns_opens_scope (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_get_node_by_path (
|
acpi_ns_get_node_by_path(char *pathname,
|
||||||
char *pathname,
|
struct acpi_namespace_node *start_node,
|
||||||
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;
|
union acpi_generic_state scope_info;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
char *internal_path = NULL;
|
char *internal_path = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ns_get_node_by_path", pathname);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ns_get_node_by_path", pathname);
|
||||||
|
|
||||||
if (pathname) {
|
if (pathname) {
|
||||||
/* Convert path to internal representation */
|
/* Convert path to internal representation */
|
||||||
|
|
||||||
status = acpi_ns_internalize_name (pathname, &internal_path);
|
status = acpi_ns_internalize_name(pathname, &internal_path);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must lock namespace during lookup */
|
/* Must lock namespace during lookup */
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -952,25 +866,25 @@ acpi_ns_get_node_by_path (
|
|||||||
|
|
||||||
/* Lookup the name in the namespace */
|
/* Lookup the name in the namespace */
|
||||||
|
|
||||||
status = acpi_ns_lookup (&scope_info, internal_path,
|
status = acpi_ns_lookup(&scope_info, internal_path,
|
||||||
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
|
||||||
(flags | ACPI_NS_DONT_OPEN_SCOPE),
|
(flags | ACPI_NS_DONT_OPEN_SCOPE),
|
||||||
NULL, return_node);
|
NULL, return_node);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
|
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);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (internal_path) {
|
if (internal_path) {
|
||||||
ACPI_MEM_FREE (internal_path);
|
ACPI_MEM_FREE(internal_path);
|
||||||
}
|
}
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_parent_node
|
* FUNCTION: acpi_ns_get_parent_node
|
||||||
@@ -983,12 +897,10 @@ cleanup:
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
struct acpi_namespace_node *
|
struct acpi_namespace_node *acpi_ns_get_parent_node(struct acpi_namespace_node
|
||||||
acpi_ns_get_parent_node (
|
*node)
|
||||||
struct acpi_namespace_node *node)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_ENTRY ();
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -1006,7 +918,6 @@ acpi_ns_get_parent_node (
|
|||||||
return (node->peer);
|
return (node->peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_get_next_valid_node
|
* FUNCTION: acpi_ns_get_next_valid_node
|
||||||
@@ -1021,9 +932,9 @@ acpi_ns_get_parent_node (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
struct acpi_namespace_node *
|
struct acpi_namespace_node *acpi_ns_get_next_valid_node(struct
|
||||||
acpi_ns_get_next_valid_node (
|
acpi_namespace_node
|
||||||
struct acpi_namespace_node *node)
|
*node)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* If we are at the end of this peer list, return NULL */
|
/* 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);
|
return (node->peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -1053,38 +963,36 @@ acpi_ns_get_next_valid_node (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_name
|
acpi_name acpi_ns_find_parent_name(struct acpi_namespace_node * child_node)
|
||||||
acpi_ns_find_parent_name (
|
|
||||||
struct acpi_namespace_node *child_node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_find_parent_name");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_find_parent_name");
|
||||||
|
|
||||||
if (child_node) {
|
if (child_node) {
|
||||||
/* Valid entry. Get the parent Node */
|
/* Valid entry. Get the parent Node */
|
||||||
|
|
||||||
parent_node = acpi_ns_get_parent_node (child_node);
|
parent_node = acpi_ns_get_parent_node(child_node);
|
||||||
if (parent_node) {
|
if (parent_node) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Parent of %p [%4.4s] is %p [%4.4s]\n",
|
"Parent of %p [%4.4s] is %p [%4.4s]\n",
|
||||||
child_node, acpi_ut_get_node_name (child_node),
|
child_node,
|
||||||
parent_node, acpi_ut_get_node_name (parent_node)));
|
acpi_ut_get_node_name(child_node),
|
||||||
|
parent_node,
|
||||||
|
acpi_ut_get_node_name(parent_node)));
|
||||||
|
|
||||||
if (parent_node->name.integer) {
|
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,
|
ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
|
||||||
"Unable to find parent of %p (%4.4s)\n",
|
"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);
|
return_VALUE(ACPI_UNKNOWN_NAME);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nswalk")
|
ACPI_MODULE_NAME("nswalk")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -68,18 +65,15 @@
|
|||||||
* within Scope is returned.
|
* within Scope is returned.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
|
||||||
struct acpi_namespace_node *
|
struct acpi_namespace_node
|
||||||
acpi_ns_get_next_node (
|
*parent_node,
|
||||||
acpi_object_type type,
|
struct acpi_namespace_node
|
||||||
struct acpi_namespace_node *parent_node,
|
*child_node)
|
||||||
struct acpi_namespace_node *child_node)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *next_node = NULL;
|
struct acpi_namespace_node *next_node = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
if (!child_node) {
|
if (!child_node) {
|
||||||
/* It's really the parent's _scope_ that we want */
|
/* It's really the parent's _scope_ that we want */
|
||||||
@@ -92,7 +86,7 @@ acpi_ns_get_next_node (
|
|||||||
else {
|
else {
|
||||||
/* Start search at the NEXT node */
|
/* Start search at the NEXT node */
|
||||||
|
|
||||||
next_node = acpi_ns_get_next_valid_node (child_node);
|
next_node = acpi_ns_get_next_valid_node(child_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If any type is OK, we are done */
|
/* If any type is OK, we are done */
|
||||||
@@ -114,7 +108,7 @@ acpi_ns_get_next_node (
|
|||||||
|
|
||||||
/* Otherwise, move on to the next node */
|
/* Otherwise, move on to the next node */
|
||||||
|
|
||||||
next_node = acpi_ns_get_next_valid_node (next_node);
|
next_node = acpi_ns_get_next_valid_node(next_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Not found */
|
/* Not found */
|
||||||
@@ -122,7 +116,6 @@ acpi_ns_get_next_node (
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ns_walk_namespace
|
* FUNCTION: acpi_ns_walk_namespace
|
||||||
@@ -154,25 +147,21 @@ acpi_ns_get_next_node (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ns_walk_namespace (
|
acpi_ns_walk_namespace(acpi_object_type type,
|
||||||
acpi_object_type type,
|
acpi_handle start_node,
|
||||||
acpi_handle start_node,
|
u32 max_depth,
|
||||||
u32 max_depth,
|
u8 unlock_before_callback,
|
||||||
u8 unlock_before_callback,
|
acpi_walk_callback user_function,
|
||||||
acpi_walk_callback user_function,
|
void *context, void **return_value)
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_status mutex_status;
|
acpi_status mutex_status;
|
||||||
struct acpi_namespace_node *child_node;
|
struct acpi_namespace_node *child_node;
|
||||||
struct acpi_namespace_node *parent_node;
|
struct acpi_namespace_node *parent_node;
|
||||||
acpi_object_type child_type;
|
acpi_object_type child_type;
|
||||||
u32 level;
|
u32 level;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ns_walk_namespace");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ns_walk_namespace");
|
||||||
|
|
||||||
/* Special case for the namespace Root Node */
|
/* Special case for the namespace Root Node */
|
||||||
|
|
||||||
@@ -183,9 +172,9 @@ acpi_ns_walk_namespace (
|
|||||||
/* Null child means "get first node" */
|
/* Null child means "get first node" */
|
||||||
|
|
||||||
parent_node = start_node;
|
parent_node = start_node;
|
||||||
child_node = NULL;
|
child_node = NULL;
|
||||||
child_type = ACPI_TYPE_ANY;
|
child_type = ACPI_TYPE_ANY;
|
||||||
level = 1;
|
level = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Traverse the tree of nodes until we bubble back up to where we
|
* Traverse the tree of nodes until we bubble back up to where we
|
||||||
@@ -196,7 +185,9 @@ acpi_ns_walk_namespace (
|
|||||||
/* Get the next node in this scope. Null if not found */
|
/* Get the next node in this scope. Null if not found */
|
||||||
|
|
||||||
status = AE_OK;
|
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) {
|
if (child_node) {
|
||||||
/*
|
/*
|
||||||
* Found node, Get the type if we are not
|
* Found node, Get the type if we are not
|
||||||
@@ -212,19 +203,25 @@ acpi_ns_walk_namespace (
|
|||||||
* callback function
|
* callback function
|
||||||
*/
|
*/
|
||||||
if (unlock_before_callback) {
|
if (unlock_before_callback) {
|
||||||
mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
mutex_status =
|
||||||
if (ACPI_FAILURE (mutex_status)) {
|
acpi_ut_release_mutex
|
||||||
return_ACPI_STATUS (mutex_status);
|
(ACPI_MTX_NAMESPACE);
|
||||||
|
if (ACPI_FAILURE(mutex_status)) {
|
||||||
|
return_ACPI_STATUS
|
||||||
|
(mutex_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = user_function (child_node, level,
|
status = user_function(child_node, level,
|
||||||
context, return_value);
|
context, return_value);
|
||||||
|
|
||||||
if (unlock_before_callback) {
|
if (unlock_before_callback) {
|
||||||
mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
mutex_status =
|
||||||
if (ACPI_FAILURE (mutex_status)) {
|
acpi_ut_acquire_mutex
|
||||||
return_ACPI_STATUS (mutex_status);
|
(ACPI_MTX_NAMESPACE);
|
||||||
|
if (ACPI_FAILURE(mutex_status)) {
|
||||||
|
return_ACPI_STATUS
|
||||||
|
(mutex_status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,13 +236,13 @@ acpi_ns_walk_namespace (
|
|||||||
|
|
||||||
/* Exit now, with OK status */
|
/* Exit now, with OK status */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
/* All others are valid exceptions */
|
/* All others are valid exceptions */
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,7 +255,8 @@ acpi_ns_walk_namespace (
|
|||||||
* maximum depth has been reached.
|
* maximum depth has been reached.
|
||||||
*/
|
*/
|
||||||
if ((level < max_depth) && (status != AE_CTRL_DEPTH)) {
|
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
|
* There is at least one child of this
|
||||||
* node, visit the onde
|
* node, visit the onde
|
||||||
@@ -268,8 +266,7 @@ acpi_ns_walk_namespace (
|
|||||||
child_node = NULL;
|
child_node = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* No more children of this node (acpi_ns_get_next_node
|
* No more children of this node (acpi_ns_get_next_node
|
||||||
* failed), go back upwards in the namespace tree to
|
* failed), go back upwards in the namespace tree to
|
||||||
@@ -277,13 +274,11 @@ acpi_ns_walk_namespace (
|
|||||||
*/
|
*/
|
||||||
level--;
|
level--;
|
||||||
child_node = parent_node;
|
child_node = parent_node;
|
||||||
parent_node = acpi_ns_get_parent_node (parent_node);
|
parent_node = acpi_ns_get_parent_node(parent_node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete walk, not terminated by user function */
|
/* Complete walk, not terminated by user function */
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -48,10 +48,8 @@
|
|||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsxfeval")
|
ACPI_MODULE_NAME("nsxfeval")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -73,27 +71,23 @@
|
|||||||
* be valid (non-null)
|
* be valid (non-null)
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_evaluate_object_typed (
|
acpi_evaluate_object_typed(acpi_handle handle,
|
||||||
acpi_handle handle,
|
acpi_string pathname,
|
||||||
acpi_string pathname,
|
struct acpi_object_list *external_params,
|
||||||
struct acpi_object_list *external_params,
|
struct acpi_buffer *return_buffer,
|
||||||
struct acpi_buffer *return_buffer,
|
acpi_object_type return_type)
|
||||||
acpi_object_type return_type)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
u8 must_free = FALSE;
|
u8 must_free = FALSE;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_evaluate_object_typed");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_evaluate_object_typed");
|
||||||
|
|
||||||
/* Return buffer must be valid */
|
/* Return buffer must be valid */
|
||||||
|
|
||||||
if (!return_buffer) {
|
if (!return_buffer) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
|
if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
|
||||||
@@ -102,51 +96,52 @@ acpi_evaluate_object_typed (
|
|||||||
|
|
||||||
/* Evaluate the object */
|
/* Evaluate the object */
|
||||||
|
|
||||||
status = acpi_evaluate_object (handle, pathname, external_params, return_buffer);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_evaluate_object(handle, pathname, external_params,
|
||||||
return_ACPI_STATUS (status);
|
return_buffer);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Type ANY means "don't care" */
|
/* Type ANY means "don't care" */
|
||||||
|
|
||||||
if (return_type == ACPI_TYPE_ANY) {
|
if (return_type == ACPI_TYPE_ANY) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (return_buffer->length == 0) {
|
if (return_buffer->length == 0) {
|
||||||
/* Error because caller specifically asked for a return value */
|
/* Error because caller specifically asked for a return value */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No return value\n"));
|
||||||
"No return value\n"));
|
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_NULL_OBJECT);
|
return_ACPI_STATUS(AE_NULL_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Examine the object type returned from evaluate_object */
|
/* Examine the object type returned from evaluate_object */
|
||||||
|
|
||||||
if (((union acpi_object *) return_buffer->pointer)->type == return_type) {
|
if (((union acpi_object *)return_buffer->pointer)->type == return_type) {
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return object type does not match requested type */
|
/* Return object type does not match requested type */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Incorrect return type [%s] requested [%s]\n",
|
"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 *)
|
||||||
acpi_ut_get_type_name (return_type)));
|
return_buffer->pointer)->type),
|
||||||
|
acpi_ut_get_type_name(return_type)));
|
||||||
|
|
||||||
if (must_free) {
|
if (must_free) {
|
||||||
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
|
/* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
|
||||||
|
|
||||||
acpi_os_free (return_buffer->pointer);
|
acpi_os_free(return_buffer->pointer);
|
||||||
return_buffer->pointer = NULL;
|
return_buffer->pointer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_buffer->length = 0;
|
return_buffer->length = 0;
|
||||||
return_ACPI_STATUS (AE_TYPE);
|
return_ACPI_STATUS(AE_TYPE);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -169,21 +164,18 @@ acpi_evaluate_object_typed (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_evaluate_object (
|
acpi_evaluate_object(acpi_handle handle,
|
||||||
acpi_handle handle,
|
acpi_string pathname,
|
||||||
acpi_string pathname,
|
struct acpi_object_list *external_params,
|
||||||
struct acpi_object_list *external_params,
|
struct acpi_buffer *return_buffer)
|
||||||
struct acpi_buffer *return_buffer)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_status status2;
|
acpi_status status2;
|
||||||
struct acpi_parameter_info info;
|
struct acpi_parameter_info info;
|
||||||
acpi_size buffer_space_needed;
|
acpi_size buffer_space_needed;
|
||||||
u32 i;
|
u32 i;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_evaluate_object");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_evaluate_object");
|
||||||
|
|
||||||
info.node = handle;
|
info.node = handle;
|
||||||
info.parameters = NULL;
|
info.parameters = NULL;
|
||||||
@@ -200,11 +192,11 @@ acpi_evaluate_object (
|
|||||||
* Allocate a new parameter block for the internal objects
|
* Allocate a new parameter block for the internal objects
|
||||||
* Add 1 to count to allow for null terminated internal list
|
* Add 1 to count to allow for null terminated internal list
|
||||||
*/
|
*/
|
||||||
info.parameters = ACPI_MEM_CALLOCATE (
|
info.parameters = ACPI_MEM_CALLOCATE(((acpi_size)
|
||||||
((acpi_size) external_params->count + 1) *
|
external_params->count +
|
||||||
sizeof (void *));
|
1) * sizeof(void *));
|
||||||
if (!info.parameters) {
|
if (!info.parameters) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -212,48 +204,47 @@ acpi_evaluate_object (
|
|||||||
* internal object
|
* internal object
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < external_params->count; i++) {
|
for (i = 0; i < external_params->count; i++) {
|
||||||
status = acpi_ut_copy_eobject_to_iobject (&external_params->pointer[i],
|
status =
|
||||||
&info.parameters[i]);
|
acpi_ut_copy_eobject_to_iobject(&external_params->
|
||||||
if (ACPI_FAILURE (status)) {
|
pointer[i],
|
||||||
acpi_ut_delete_internal_object_list (info.parameters);
|
&info.
|
||||||
return_ACPI_STATUS (status);
|
parameters[i]);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
|
acpi_ut_delete_internal_object_list(info.
|
||||||
|
parameters);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info.parameters[external_params->count] = NULL;
|
info.parameters[external_params->count] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Three major cases:
|
* Three major cases:
|
||||||
* 1) Fully qualified pathname
|
* 1) Fully qualified pathname
|
||||||
* 2) No handle, not fully qualified pathname (error)
|
* 2) No handle, not fully qualified pathname (error)
|
||||||
* 3) Valid handle
|
* 3) Valid handle
|
||||||
*/
|
*/
|
||||||
if ((pathname) &&
|
if ((pathname) && (acpi_ns_valid_root_prefix(pathname[0]))) {
|
||||||
(acpi_ns_valid_root_prefix (pathname[0]))) {
|
|
||||||
/*
|
/*
|
||||||
* The path is fully qualified, just evaluate by name
|
* The path is fully qualified, just evaluate by name
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_evaluate_by_name (pathname, &info);
|
status = acpi_ns_evaluate_by_name(pathname, &info);
|
||||||
}
|
} else if (!handle) {
|
||||||
else if (!handle) {
|
|
||||||
/*
|
/*
|
||||||
* A handle is optional iff a fully qualified pathname
|
* A handle is optional iff a fully qualified pathname
|
||||||
* is specified. Since we've already handled fully
|
* is specified. Since we've already handled fully
|
||||||
* qualified names above, this is an error
|
* qualified names above, this is an error
|
||||||
*/
|
*/
|
||||||
if (!pathname) {
|
if (!pathname) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Both Handle and Pathname are NULL\n"));
|
"Both Handle and Pathname are NULL\n"));
|
||||||
}
|
} else {
|
||||||
else {
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
"Handle is NULL and Pathname is relative\n"));
|
||||||
"Handle is NULL and Pathname is relative\n"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* We get here if we have a handle -- and if we have a
|
* We get here if we have a handle -- and if we have a
|
||||||
* pathname it is relative. The handle will be validated
|
* pathname it is relative. The handle will be validated
|
||||||
@@ -264,17 +255,15 @@ acpi_evaluate_object (
|
|||||||
* The null pathname case means the handle is for
|
* The null pathname case means the handle is for
|
||||||
* the actual object to be evaluated
|
* the actual object to be evaluated
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_evaluate_by_handle (&info);
|
status = acpi_ns_evaluate_by_handle(&info);
|
||||||
}
|
} else {
|
||||||
else {
|
/*
|
||||||
/*
|
* Both a Handle and a relative Pathname
|
||||||
* Both a Handle and a relative Pathname
|
*/
|
||||||
*/
|
status = acpi_ns_evaluate_relative(pathname, &info);
|
||||||
status = acpi_ns_evaluate_relative (pathname, &info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we are expecting a return value, and all went well above,
|
* If we are expecting a return value, and all went well above,
|
||||||
* copy the return value to an external object.
|
* copy the return value to an external object.
|
||||||
@@ -282,9 +271,9 @@ acpi_evaluate_object (
|
|||||||
if (return_buffer) {
|
if (return_buffer) {
|
||||||
if (!info.return_object) {
|
if (!info.return_object) {
|
||||||
return_buffer->length = 0;
|
return_buffer->length = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
if (ACPI_GET_DESCRIPTOR_TYPE(info.return_object) ==
|
||||||
if (ACPI_GET_DESCRIPTOR_TYPE (info.return_object) == ACPI_DESC_TYPE_NAMED) {
|
ACPI_DESC_TYPE_NAMED) {
|
||||||
/*
|
/*
|
||||||
* If we received a NS Node as a return object, this means that
|
* If we received a NS Node as a return object, this means that
|
||||||
* the object we are evaluating has nothing interesting to
|
* the object we are evaluating has nothing interesting to
|
||||||
@@ -294,37 +283,43 @@ acpi_evaluate_object (
|
|||||||
* support for various types at a later date if necessary.
|
* support for various types at a later date if necessary.
|
||||||
*/
|
*/
|
||||||
status = AE_TYPE;
|
status = AE_TYPE;
|
||||||
info.return_object = NULL; /* No need to delete a NS Node */
|
info.return_object = NULL; /* No need to delete a NS Node */
|
||||||
return_buffer->length = 0;
|
return_buffer->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/*
|
/*
|
||||||
* Find out how large a buffer is needed
|
* Find out how large a buffer is needed
|
||||||
* to contain the returned object
|
* to contain the returned object
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_get_object_size (info.return_object,
|
status =
|
||||||
&buffer_space_needed);
|
acpi_ut_get_object_size(info.return_object,
|
||||||
if (ACPI_SUCCESS (status)) {
|
&buffer_space_needed);
|
||||||
|
if (ACPI_SUCCESS(status)) {
|
||||||
/* Validate/Allocate/Clear caller buffer */
|
/* Validate/Allocate/Clear caller buffer */
|
||||||
|
|
||||||
status = acpi_ut_initialize_buffer (return_buffer,
|
status =
|
||||||
buffer_space_needed);
|
acpi_ut_initialize_buffer
|
||||||
if (ACPI_FAILURE (status)) {
|
(return_buffer,
|
||||||
|
buffer_space_needed);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
/*
|
/*
|
||||||
* Caller's buffer is too small or a new one can't be allocated
|
* Caller's buffer is too small or a new one can't be allocated
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Needed buffer size %X, %s\n",
|
"Needed buffer size %X, %s\n",
|
||||||
(u32) buffer_space_needed,
|
(u32)
|
||||||
acpi_format_exception (status)));
|
buffer_space_needed,
|
||||||
}
|
acpi_format_exception
|
||||||
else {
|
(status)));
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
* We have enough space for the object, build it
|
* We have enough space for the object, build it
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_copy_iobject_to_eobject (info.return_object,
|
status =
|
||||||
return_buffer);
|
acpi_ut_copy_iobject_to_eobject
|
||||||
|
(info.return_object,
|
||||||
|
return_buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -336,14 +331,14 @@ acpi_evaluate_object (
|
|||||||
* Delete the internal return object. NOTE: Interpreter
|
* Delete the internal return object. NOTE: Interpreter
|
||||||
* must be locked to avoid race condition.
|
* must be locked to avoid race condition.
|
||||||
*/
|
*/
|
||||||
status2 = acpi_ex_enter_interpreter ();
|
status2 = acpi_ex_enter_interpreter();
|
||||||
if (ACPI_SUCCESS (status2)) {
|
if (ACPI_SUCCESS(status2)) {
|
||||||
/*
|
/*
|
||||||
* Delete the internal return object. (Or at least
|
* Delete the internal return object. (Or at least
|
||||||
* decrement the reference count by one)
|
* decrement the reference count by one)
|
||||||
*/
|
*/
|
||||||
acpi_ut_remove_reference (info.return_object);
|
acpi_ut_remove_reference(info.return_object);
|
||||||
acpi_ex_exit_interpreter ();
|
acpi_ex_exit_interpreter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,13 +348,13 @@ acpi_evaluate_object (
|
|||||||
if (info.parameters) {
|
if (info.parameters) {
|
||||||
/* Free the allocated parameter block */
|
/* Free the allocated parameter block */
|
||||||
|
|
||||||
acpi_ut_delete_internal_object_list (info.parameters);
|
acpi_ut_delete_internal_object_list(info.parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_evaluate_object);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_evaluate_object);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -392,26 +387,20 @@ EXPORT_SYMBOL(acpi_evaluate_object);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_walk_namespace (
|
acpi_walk_namespace(acpi_object_type type,
|
||||||
acpi_object_type type,
|
acpi_handle start_object,
|
||||||
acpi_handle start_object,
|
u32 max_depth,
|
||||||
u32 max_depth,
|
acpi_walk_callback user_function,
|
||||||
acpi_walk_callback user_function,
|
void *context, void **return_value)
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_walk_namespace");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_walk_namespace");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if ((type > ACPI_TYPE_EXTERNAL_MAX) ||
|
if ((type > ACPI_TYPE_EXTERNAL_MAX) || (!max_depth) || (!user_function)) {
|
||||||
(!max_depth) ||
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
(!user_function)) {
|
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -420,20 +409,20 @@ acpi_walk_namespace (
|
|||||||
* to the user function - since this function
|
* to the user function - since this function
|
||||||
* must be allowed to make Acpi calls itself.
|
* must be allowed to make Acpi calls itself.
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_walk_namespace (type, start_object, max_depth,
|
status = acpi_ns_walk_namespace(type, start_object, max_depth,
|
||||||
ACPI_NS_WALK_UNLOCK,
|
ACPI_NS_WALK_UNLOCK,
|
||||||
user_function, context, return_value);
|
user_function, context, return_value);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_walk_namespace);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_walk_namespace);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -450,29 +439,26 @@ EXPORT_SYMBOL(acpi_walk_namespace);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status
|
||||||
acpi_ns_get_device_callback (
|
acpi_ns_get_device_callback(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
u32 nesting_level,
|
||||||
u32 nesting_level,
|
void *context, void **return_value)
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
struct acpi_get_devices_info *info = context;
|
struct acpi_get_devices_info *info = context;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
struct acpi_device_id hid;
|
struct acpi_device_id hid;
|
||||||
struct acpi_compatible_id_list *cid;
|
struct acpi_compatible_id_list *cid;
|
||||||
acpi_native_uint i;
|
acpi_native_uint i;
|
||||||
|
|
||||||
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
if (ACPI_FAILURE(status)) {
|
||||||
if (ACPI_FAILURE (status)) {
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (obj_handle);
|
node = acpi_ns_map_handle_to_node(obj_handle);
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,8 +468,8 @@ acpi_ns_get_device_callback (
|
|||||||
|
|
||||||
/* Run _STA to determine if device is present */
|
/* Run _STA to determine if device is present */
|
||||||
|
|
||||||
status = acpi_ut_execute_STA (node, &flags);
|
status = acpi_ut_execute_STA(node, &flags);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (AE_CTRL_DEPTH);
|
return (AE_CTRL_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,44 +482,43 @@ acpi_ns_get_device_callback (
|
|||||||
/* Filter based on device HID & CID */
|
/* Filter based on device HID & CID */
|
||||||
|
|
||||||
if (info->hid != NULL) {
|
if (info->hid != NULL) {
|
||||||
status = acpi_ut_execute_HID (node, &hid);
|
status = acpi_ut_execute_HID(node, &hid);
|
||||||
if (status == AE_NOT_FOUND) {
|
if (status == AE_NOT_FOUND) {
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
} else if (ACPI_FAILURE(status)) {
|
||||||
else if (ACPI_FAILURE (status)) {
|
|
||||||
return (AE_CTRL_DEPTH);
|
return (AE_CTRL_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_STRNCMP (hid.value, info->hid, sizeof (hid.value)) != 0) {
|
if (ACPI_STRNCMP(hid.value, info->hid, sizeof(hid.value)) != 0) {
|
||||||
/* Get the list of Compatible IDs */
|
/* Get the list of Compatible IDs */
|
||||||
|
|
||||||
status = acpi_ut_execute_CID (node, &cid);
|
status = acpi_ut_execute_CID(node, &cid);
|
||||||
if (status == AE_NOT_FOUND) {
|
if (status == AE_NOT_FOUND) {
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
} else if (ACPI_FAILURE(status)) {
|
||||||
else if (ACPI_FAILURE (status)) {
|
|
||||||
return (AE_CTRL_DEPTH);
|
return (AE_CTRL_DEPTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Walk the CID list */
|
/* Walk the CID list */
|
||||||
|
|
||||||
for (i = 0; i < cid->count; i++) {
|
for (i = 0; i < cid->count; i++) {
|
||||||
if (ACPI_STRNCMP (cid->id[i].value, info->hid,
|
if (ACPI_STRNCMP(cid->id[i].value, info->hid,
|
||||||
sizeof (struct acpi_compatible_id)) != 0) {
|
sizeof(struct
|
||||||
ACPI_MEM_FREE (cid);
|
acpi_compatible_id)) !=
|
||||||
|
0) {
|
||||||
|
ACPI_MEM_FREE(cid);
|
||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ACPI_MEM_FREE (cid);
|
ACPI_MEM_FREE(cid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status = info->user_function (obj_handle, nesting_level, info->context,
|
status = info->user_function(obj_handle, nesting_level, info->context,
|
||||||
return_value);
|
return_value);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_devices
|
* FUNCTION: acpi_get_devices
|
||||||
@@ -560,32 +545,28 @@ acpi_ns_get_device_callback (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_devices (
|
acpi_get_devices(char *HID,
|
||||||
char *HID,
|
acpi_walk_callback user_function,
|
||||||
acpi_walk_callback user_function,
|
void *context, void **return_value)
|
||||||
void *context,
|
|
||||||
void **return_value)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_get_devices_info info;
|
struct acpi_get_devices_info info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("acpi_get_devices");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("acpi_get_devices");
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!user_function) {
|
if (!user_function) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We're going to call their callback from OUR callback, so we need
|
* We're going to call their callback from OUR callback, so we need
|
||||||
* to know what it is, and their context parameter.
|
* to know what it is, and their context parameter.
|
||||||
*/
|
*/
|
||||||
info.context = context;
|
info.context = context;
|
||||||
info.user_function = user_function;
|
info.user_function = user_function;
|
||||||
info.hid = HID;
|
info.hid = HID;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lock the namespace around the walk.
|
* Lock the namespace around the walk.
|
||||||
@@ -593,22 +574,22 @@ acpi_get_devices (
|
|||||||
* to the user function - since this function
|
* to the user function - since this function
|
||||||
* must be allowed to make Acpi calls itself.
|
* must be allowed to make Acpi calls itself.
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_walk_namespace (ACPI_TYPE_DEVICE,
|
status = acpi_ns_walk_namespace(ACPI_TYPE_DEVICE,
|
||||||
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
|
ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
|
||||||
ACPI_NS_WALK_UNLOCK,
|
ACPI_NS_WALK_UNLOCK,
|
||||||
acpi_ns_get_device_callback, &info,
|
acpi_ns_get_device_callback, &info,
|
||||||
return_value);
|
return_value);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_devices);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_devices);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -625,44 +606,38 @@ EXPORT_SYMBOL(acpi_get_devices);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_attach_data (
|
acpi_attach_data(acpi_handle obj_handle,
|
||||||
acpi_handle obj_handle,
|
acpi_object_handler handler, void *data)
|
||||||
acpi_object_handler handler,
|
|
||||||
void *data)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!obj_handle ||
|
if (!obj_handle || !handler || !data) {
|
||||||
!handler ||
|
|
||||||
!data) {
|
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the handle */
|
/* Convert and validate the handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (obj_handle);
|
node = acpi_ns_map_handle_to_node(obj_handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_attach_data (node, handler, data);
|
status = acpi_ns_attach_data(node, handler, data);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_detach_data
|
* FUNCTION: acpi_detach_data
|
||||||
@@ -677,42 +652,37 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_detach_data (
|
acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler)
|
||||||
acpi_handle obj_handle,
|
|
||||||
acpi_object_handler handler)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!obj_handle ||
|
if (!obj_handle || !handler) {
|
||||||
!handler) {
|
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the handle */
|
/* Convert and validate the handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (obj_handle);
|
node = acpi_ns_map_handle_to_node(obj_handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_detach_data (node, handler);
|
status = acpi_ns_detach_data(node, handler);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_get_data
|
* FUNCTION: acpi_get_data
|
||||||
@@ -728,41 +698,33 @@ unlock_and_exit:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_data (
|
acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data)
|
||||||
acpi_handle obj_handle,
|
|
||||||
acpi_object_handler handler,
|
|
||||||
void **data)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
if (!obj_handle ||
|
if (!obj_handle || !handler || !data) {
|
||||||
!handler ||
|
|
||||||
!data) {
|
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the handle */
|
/* Convert and validate the handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (obj_handle);
|
node = acpi_ns_map_handle_to_node(obj_handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ns_get_attached_data (node, handler, data);
|
status = acpi_ns_get_attached_data(node, handler, data);
|
||||||
|
|
||||||
unlock_and_exit:
|
unlock_and_exit:
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,10 +47,8 @@
|
|||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsxfname")
|
ACPI_MODULE_NAME("nsxfname")
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -69,20 +67,15 @@
|
|||||||
* namespace handle.
|
* namespace handle.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_handle (
|
acpi_get_handle(acpi_handle parent,
|
||||||
acpi_handle parent,
|
acpi_string pathname, acpi_handle * ret_handle)
|
||||||
acpi_string pathname,
|
|
||||||
acpi_handle *ret_handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node = NULL;
|
struct acpi_namespace_node *node = NULL;
|
||||||
struct acpi_namespace_node *prefix_node = NULL;
|
struct acpi_namespace_node *prefix_node = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* Parameter Validation */
|
/* Parameter Validation */
|
||||||
|
|
||||||
@@ -93,45 +86,47 @@ acpi_get_handle (
|
|||||||
/* Convert a parent handle to a prefix node */
|
/* Convert a parent handle to a prefix node */
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix_node = acpi_ns_map_handle_to_node (parent);
|
prefix_node = acpi_ns_map_handle_to_node(parent);
|
||||||
if (!prefix_node) {
|
if (!prefix_node) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Special case for root, since we can't search for it */
|
/* Special case for root, since we can't search for it */
|
||||||
|
|
||||||
if (ACPI_STRCMP (pathname, ACPI_NS_ROOT_PATH) == 0) {
|
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);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the Node and convert to a handle
|
* Find the Node and convert to a handle
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_get_node_by_path (pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
|
status =
|
||||||
&node);
|
acpi_ns_get_node_by_path(pathname, prefix_node, ACPI_NS_NO_UPSEARCH,
|
||||||
|
&node);
|
||||||
|
|
||||||
*ret_handle = NULL;
|
*ret_handle = NULL;
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
*ret_handle = acpi_ns_convert_entry_to_handle (node);
|
*ret_handle = acpi_ns_convert_entry_to_handle(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_handle);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_handle);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -150,14 +145,10 @@ EXPORT_SYMBOL(acpi_get_handle);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_name (
|
acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer)
|
||||||
acpi_handle handle,
|
|
||||||
u32 name_type,
|
|
||||||
struct acpi_buffer *buffer)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
@@ -165,15 +156,15 @@ acpi_get_name (
|
|||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_validate_buffer (buffer);
|
status = acpi_ut_validate_buffer(buffer);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name_type == ACPI_FULL_PATHNAME) {
|
if (name_type == ACPI_FULL_PATHNAME) {
|
||||||
/* Get the full pathname (From the namespace root) */
|
/* Get the full pathname (From the namespace root) */
|
||||||
|
|
||||||
status = acpi_ns_handle_to_pathname (handle, buffer);
|
status = acpi_ns_handle_to_pathname(handle, buffer);
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,12 +172,12 @@ acpi_get_name (
|
|||||||
* Wants the single segment ACPI name.
|
* Wants the single segment ACPI name.
|
||||||
* Validate handle and convert to a namespace Node
|
* Validate handle and convert to a namespace Node
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (handle);
|
node = acpi_ns_map_handle_to_node(handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -194,26 +185,25 @@ acpi_get_name (
|
|||||||
|
|
||||||
/* Validate/Allocate/Clear caller buffer */
|
/* Validate/Allocate/Clear caller buffer */
|
||||||
|
|
||||||
status = acpi_ut_initialize_buffer (buffer, ACPI_PATH_SEGMENT_LENGTH);
|
status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just copy the ACPI name from the Node and zero terminate it */
|
/* Just copy the ACPI name from the Node and zero terminate it */
|
||||||
|
|
||||||
ACPI_STRNCPY (buffer->pointer, acpi_ut_get_node_name (node),
|
ACPI_STRNCPY(buffer->pointer, acpi_ut_get_node_name(node),
|
||||||
ACPI_NAME_SIZE);
|
ACPI_NAME_SIZE);
|
||||||
((char *) buffer->pointer) [ACPI_NAME_SIZE] = 0;
|
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
|
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_name);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_name);
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -231,17 +221,14 @@ EXPORT_SYMBOL(acpi_get_name);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_object_info (
|
acpi_get_object_info(acpi_handle handle, struct acpi_buffer * buffer)
|
||||||
acpi_handle handle,
|
|
||||||
struct acpi_buffer *buffer)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
struct acpi_device_info *info;
|
struct acpi_device_info *info;
|
||||||
struct acpi_device_info *return_info;
|
struct acpi_device_info *return_info;
|
||||||
struct acpi_compatible_id_list *cid_list = NULL;
|
struct acpi_compatible_id_list *cid_list = NULL;
|
||||||
acpi_size size;
|
acpi_size size;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
@@ -249,37 +236,37 @@ acpi_get_object_info (
|
|||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_validate_buffer (buffer);
|
status = acpi_ut_validate_buffer(buffer);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_device_info));
|
info = ACPI_MEM_CALLOCATE(sizeof(struct acpi_device_info));
|
||||||
if (!info) {
|
if (!info) {
|
||||||
return (AE_NO_MEMORY);
|
return (AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (handle);
|
node = acpi_ns_map_handle_to_node(handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init return structure */
|
/* Init return structure */
|
||||||
|
|
||||||
size = sizeof (struct acpi_device_info);
|
size = sizeof(struct acpi_device_info);
|
||||||
|
|
||||||
info->type = node->type;
|
info->type = node->type;
|
||||||
info->name = node->name.integer;
|
info->name = node->name.integer;
|
||||||
info->valid = 0;
|
info->valid = 0;
|
||||||
|
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,73 +284,73 @@ acpi_get_object_info (
|
|||||||
|
|
||||||
/* Execute the Device._HID method */
|
/* Execute the Device._HID method */
|
||||||
|
|
||||||
status = acpi_ut_execute_HID (node, &info->hardware_id);
|
status = acpi_ut_execute_HID(node, &info->hardware_id);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
info->valid |= ACPI_VALID_HID;
|
info->valid |= ACPI_VALID_HID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the Device._UID method */
|
/* Execute the Device._UID method */
|
||||||
|
|
||||||
status = acpi_ut_execute_UID (node, &info->unique_id);
|
status = acpi_ut_execute_UID(node, &info->unique_id);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
info->valid |= ACPI_VALID_UID;
|
info->valid |= ACPI_VALID_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the Device._CID method */
|
/* Execute the Device._CID method */
|
||||||
|
|
||||||
status = acpi_ut_execute_CID (node, &cid_list);
|
status = acpi_ut_execute_CID(node, &cid_list);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
size += ((acpi_size) cid_list->count - 1) *
|
size += ((acpi_size) cid_list->count - 1) *
|
||||||
sizeof (struct acpi_compatible_id);
|
sizeof(struct acpi_compatible_id);
|
||||||
info->valid |= ACPI_VALID_CID;
|
info->valid |= ACPI_VALID_CID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the Device._STA method */
|
/* Execute the Device._STA method */
|
||||||
|
|
||||||
status = acpi_ut_execute_STA (node, &info->current_status);
|
status = acpi_ut_execute_STA(node, &info->current_status);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
info->valid |= ACPI_VALID_STA;
|
info->valid |= ACPI_VALID_STA;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the Device._ADR method */
|
/* Execute the Device._ADR method */
|
||||||
|
|
||||||
status = acpi_ut_evaluate_numeric_object (METHOD_NAME__ADR, node,
|
status = acpi_ut_evaluate_numeric_object(METHOD_NAME__ADR, node,
|
||||||
&info->address);
|
&info->address);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
info->valid |= ACPI_VALID_ADR;
|
info->valid |= ACPI_VALID_ADR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute the Device._sx_d methods */
|
/* Execute the Device._sx_d methods */
|
||||||
|
|
||||||
status = acpi_ut_execute_sxds (node, info->highest_dstates);
|
status = acpi_ut_execute_sxds(node, info->highest_dstates);
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
info->valid |= ACPI_VALID_SXDS;
|
info->valid |= ACPI_VALID_SXDS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate/Allocate/Clear caller buffer */
|
/* Validate/Allocate/Clear caller buffer */
|
||||||
|
|
||||||
status = acpi_ut_initialize_buffer (buffer, size);
|
status = acpi_ut_initialize_buffer(buffer, size);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Populate the return buffer */
|
/* Populate the return buffer */
|
||||||
|
|
||||||
return_info = buffer->pointer;
|
return_info = buffer->pointer;
|
||||||
ACPI_MEMCPY (return_info, info, sizeof (struct acpi_device_info));
|
ACPI_MEMCPY(return_info, info, sizeof(struct acpi_device_info));
|
||||||
|
|
||||||
if (cid_list) {
|
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:
|
||||||
cleanup:
|
ACPI_MEM_FREE(info);
|
||||||
ACPI_MEM_FREE (info);
|
|
||||||
if (cid_list) {
|
if (cid_list) {
|
||||||
ACPI_MEM_FREE (cid_list);
|
ACPI_MEM_FREE(cid_list);
|
||||||
}
|
}
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_object_info);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_object_info);
|
||||||
|
|||||||
@@ -47,9 +47,8 @@
|
|||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_NAMESPACE
|
#define _COMPONENT ACPI_NAMESPACE
|
||||||
ACPI_MODULE_NAME ("nsxfobj")
|
ACPI_MODULE_NAME("nsxfobj")
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -63,15 +62,10 @@
|
|||||||
* DESCRIPTION: This routine returns the type associatd with a particular handle
|
* 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;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter Validation */
|
/* Parameter Validation */
|
||||||
|
|
||||||
@@ -88,27 +82,26 @@ acpi_get_type (
|
|||||||
return (AE_OK);
|
return (AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the handle */
|
/* Convert and validate the handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (handle);
|
node = acpi_ns_map_handle_to_node(handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
*ret_type = node->type;
|
*ret_type = node->type;
|
||||||
|
|
||||||
|
status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_type);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_type);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -124,14 +117,10 @@ EXPORT_SYMBOL(acpi_get_type);
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle)
|
||||||
acpi_get_parent (
|
|
||||||
acpi_handle handle,
|
|
||||||
acpi_handle *ret_handle)
|
|
||||||
{
|
{
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
if (!ret_handle) {
|
if (!ret_handle) {
|
||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
@@ -143,14 +132,14 @@ acpi_get_parent (
|
|||||||
return (AE_NULL_ENTRY);
|
return (AE_NULL_ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert and validate the handle */
|
/* Convert and validate the handle */
|
||||||
|
|
||||||
node = acpi_ns_map_handle_to_node (handle);
|
node = acpi_ns_map_handle_to_node(handle);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -159,22 +148,21 @@ acpi_get_parent (
|
|||||||
/* Get the parent entry */
|
/* Get the parent entry */
|
||||||
|
|
||||||
*ret_handle =
|
*ret_handle =
|
||||||
acpi_ns_convert_entry_to_handle (acpi_ns_get_parent_node (node));
|
acpi_ns_convert_entry_to_handle(acpi_ns_get_parent_node(node));
|
||||||
|
|
||||||
/* Return exception if parent is null */
|
/* Return exception if parent is null */
|
||||||
|
|
||||||
if (!acpi_ns_get_parent_node (node)) {
|
if (!acpi_ns_get_parent_node(node)) {
|
||||||
status = AE_NULL_ENTRY;
|
status = AE_NULL_ENTRY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
|
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_get_parent);
|
|
||||||
|
|
||||||
|
EXPORT_SYMBOL(acpi_get_parent);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -195,17 +183,14 @@ EXPORT_SYMBOL(acpi_get_parent);
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_get_next_object (
|
acpi_get_next_object(acpi_object_type type,
|
||||||
acpi_object_type type,
|
acpi_handle parent,
|
||||||
acpi_handle parent,
|
acpi_handle child, acpi_handle * ret_handle)
|
||||||
acpi_handle child,
|
|
||||||
acpi_handle *ret_handle)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
struct acpi_namespace_node *parent_node = NULL;
|
struct acpi_namespace_node *parent_node = NULL;
|
||||||
struct acpi_namespace_node *child_node = NULL;
|
struct acpi_namespace_node *child_node = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Parameter validation */
|
/* Parameter validation */
|
||||||
|
|
||||||
@@ -213,8 +198,8 @@ acpi_get_next_object (
|
|||||||
return (AE_BAD_PARAMETER);
|
return (AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);
|
status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,17 +208,16 @@ acpi_get_next_object (
|
|||||||
if (!child) {
|
if (!child) {
|
||||||
/* Start search at the beginning of the specified scope */
|
/* Start search at the beginning of the specified scope */
|
||||||
|
|
||||||
parent_node = acpi_ns_map_handle_to_node (parent);
|
parent_node = acpi_ns_map_handle_to_node(parent);
|
||||||
if (!parent_node) {
|
if (!parent_node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Non-null handle, ignore the parent */
|
/* Non-null handle, ignore the parent */
|
||||||
/* Convert and validate the handle */
|
/* Convert and validate the handle */
|
||||||
|
|
||||||
child_node = acpi_ns_map_handle_to_node (child);
|
child_node = acpi_ns_map_handle_to_node(child);
|
||||||
if (!child_node) {
|
if (!child_node) {
|
||||||
status = AE_BAD_PARAMETER;
|
status = AE_BAD_PARAMETER;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
@@ -242,20 +226,19 @@ acpi_get_next_object (
|
|||||||
|
|
||||||
/* Internal function does the real work */
|
/* Internal function does the real work */
|
||||||
|
|
||||||
node = acpi_ns_get_next_node (type, parent_node, child_node);
|
node = acpi_ns_get_next_node(type, parent_node, child_node);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
status = AE_NOT_FOUND;
|
status = AE_NOT_FOUND;
|
||||||
goto unlock_and_exit;
|
goto unlock_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret_handle) {
|
if (ret_handle) {
|
||||||
*ret_handle = acpi_ns_convert_entry_to_handle (node);
|
*ret_handle = acpi_ns_convert_entry_to_handle(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock_and_exit:
|
||||||
|
|
||||||
unlock_and_exit:
|
(void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE);
|
||||||
|
|
||||||
(void) acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);
|
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,16 +34,18 @@
|
|||||||
|
|
||||||
#define ACPI_NUMA 0x80000000
|
#define ACPI_NUMA 0x80000000
|
||||||
#define _COMPONENT ACPI_NUMA
|
#define _COMPONENT ACPI_NUMA
|
||||||
ACPI_MODULE_NAME ("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
|
void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
|
||||||
acpi_table_print_srat_entry (
|
|
||||||
acpi_table_entry_header *header)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry");
|
ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
|
||||||
|
|
||||||
if (!header)
|
if (!header)
|
||||||
return;
|
return;
|
||||||
@@ -52,48 +54,55 @@ acpi_table_print_srat_entry (
|
|||||||
|
|
||||||
case ACPI_SRAT_PROCESSOR_AFFINITY:
|
case ACPI_SRAT_PROCESSOR_AFFINITY:
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
{
|
{
|
||||||
struct acpi_table_processor_affinity *p =
|
struct acpi_table_processor_affinity *p =
|
||||||
(struct acpi_table_processor_affinity*) header;
|
(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",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
p->apic_id, p->lsapic_eid, p->proximity_domain,
|
"SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
|
||||||
p->flags.enabled?"enabled":"disabled"));
|
p->apic_id, p->lsapic_eid,
|
||||||
}
|
p->proximity_domain,
|
||||||
#endif /* ACPI_DEBUG_OUTPUT */
|
p->flags.
|
||||||
|
enabled ? "enabled" : "disabled"));
|
||||||
|
}
|
||||||
|
#endif /* ACPI_DEBUG_OUTPUT */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACPI_SRAT_MEMORY_AFFINITY:
|
case ACPI_SRAT_MEMORY_AFFINITY:
|
||||||
#ifdef ACPI_DEBUG_OUTPUT
|
#ifdef ACPI_DEBUG_OUTPUT
|
||||||
{
|
{
|
||||||
struct acpi_table_memory_affinity *p =
|
struct acpi_table_memory_affinity *p =
|
||||||
(struct acpi_table_memory_affinity*) header;
|
(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",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
|
"SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
|
||||||
p->memory_type, p->proximity_domain,
|
p->base_addr_hi, p->base_addr_lo,
|
||||||
p->flags.enabled ? "enabled" : "disabled",
|
p->length_hi, p->length_lo,
|
||||||
p->flags.hot_pluggable ? " hot-pluggable" : ""));
|
p->memory_type, p->proximity_domain,
|
||||||
}
|
p->flags.
|
||||||
#endif /* ACPI_DEBUG_OUTPUT */
|
enabled ? "enabled" : "disabled",
|
||||||
|
p->flags.
|
||||||
|
hot_pluggable ? " hot-pluggable" :
|
||||||
|
""));
|
||||||
|
}
|
||||||
|
#endif /* ACPI_DEBUG_OUTPUT */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
|
printk(KERN_WARNING PREFIX
|
||||||
header->type);
|
"Found unsupported SRAT entry (type = 0x%x)\n",
|
||||||
|
header->type);
|
||||||
break;
|
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;
|
struct acpi_table_slit *slit;
|
||||||
u32 localities;
|
u32 localities;
|
||||||
|
|
||||||
if (!phys_addr || !size)
|
if (!phys_addr || !size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
slit = (struct acpi_table_slit *) __va(phys_addr);
|
slit = (struct acpi_table_slit *)__va(phys_addr);
|
||||||
|
|
||||||
/* downcast just for %llu vs %lu for i386/ia64 */
|
/* downcast just for %llu vs %lu for i386/ia64 */
|
||||||
localities = (u32) slit->localities;
|
localities = (u32) slit->localities;
|
||||||
@@ -103,15 +112,13 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_processor_affinity (
|
acpi_parse_processor_affinity(acpi_table_entry_header * header,
|
||||||
acpi_table_entry_header *header,
|
const unsigned long end)
|
||||||
const unsigned long end)
|
|
||||||
{
|
{
|
||||||
struct acpi_table_processor_affinity *processor_affinity;
|
struct acpi_table_processor_affinity *processor_affinity;
|
||||||
|
|
||||||
processor_affinity = (struct acpi_table_processor_affinity*) header;
|
processor_affinity = (struct acpi_table_processor_affinity *)header;
|
||||||
if (!processor_affinity)
|
if (!processor_affinity)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -123,15 +130,13 @@ acpi_parse_processor_affinity (
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int __init
|
static int __init
|
||||||
acpi_parse_memory_affinity (
|
acpi_parse_memory_affinity(acpi_table_entry_header * header,
|
||||||
acpi_table_entry_header *header,
|
const unsigned long end)
|
||||||
const unsigned long end)
|
|
||||||
{
|
{
|
||||||
struct acpi_table_memory_affinity *memory_affinity;
|
struct acpi_table_memory_affinity *memory_affinity;
|
||||||
|
|
||||||
memory_affinity = (struct acpi_table_memory_affinity*) header;
|
memory_affinity = (struct acpi_table_memory_affinity *)header;
|
||||||
if (!memory_affinity)
|
if (!memory_affinity)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -143,36 +148,30 @@ acpi_parse_memory_affinity (
|
|||||||
return 0;
|
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;
|
struct acpi_table_srat *srat;
|
||||||
|
|
||||||
if (!phys_addr || !size)
|
if (!phys_addr || !size)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
srat = (struct acpi_table_srat *) __va(phys_addr);
|
srat = (struct acpi_table_srat *)__va(phys_addr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int __init
|
int __init
|
||||||
acpi_table_parse_srat (
|
acpi_table_parse_srat(enum acpi_srat_entry_id id,
|
||||||
enum acpi_srat_entry_id id,
|
acpi_madt_entry_handler handler, unsigned int max_entries)
|
||||||
acpi_madt_entry_handler handler,
|
|
||||||
unsigned int max_entries)
|
|
||||||
{
|
{
|
||||||
return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
|
return acpi_table_parse_madt_family(ACPI_SRAT,
|
||||||
id, handler, max_entries);
|
sizeof(struct acpi_table_srat), id,
|
||||||
|
handler, max_entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __init acpi_numa_init(void)
|
||||||
int __init
|
|
||||||
acpi_numa_init(void)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* SRAT: Static Resource Affinity Table */
|
/* SRAT: Static Resource Affinity Table */
|
||||||
result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
|
result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
|
||||||
@@ -181,9 +180,7 @@ acpi_numa_init(void)
|
|||||||
result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
|
result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
|
||||||
acpi_parse_processor_affinity,
|
acpi_parse_processor_affinity,
|
||||||
NR_CPUS);
|
NR_CPUS);
|
||||||
result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
|
result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
|
||||||
acpi_parse_memory_affinity,
|
|
||||||
NR_NODE_MEMBLKS); // IA64 specific
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SLIT: System Locality Information Table */
|
/* SLIT: System Locality Information Table */
|
||||||
@@ -193,8 +190,7 @@ acpi_numa_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int acpi_get_pxm(acpi_handle h)
|
||||||
acpi_get_pxm(acpi_handle h)
|
|
||||||
{
|
{
|
||||||
unsigned long pxm;
|
unsigned long pxm;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
@@ -207,7 +203,8 @@ acpi_get_pxm(acpi_handle h)
|
|||||||
if (ACPI_SUCCESS(status))
|
if (ACPI_SUCCESS(status))
|
||||||
return (int)pxm;
|
return (int)pxm;
|
||||||
status = acpi_get_parent(handle, &phandle);
|
status = acpi_get_parent(handle, &phandle);
|
||||||
} while(ACPI_SUCCESS(status));
|
} while (ACPI_SUCCESS(status));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_get_pxm);
|
EXPORT_SYMBOL(acpi_get_pxm);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -41,25 +41,20 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
#include <acpi/acnamesp.h>
|
#include <acpi/acnamesp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psargs")
|
ACPI_MODULE_NAME("psargs")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ps_get_next_package_length (
|
acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state);
|
||||||
struct acpi_parse_state *parser_state);
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -75,49 +70,43 @@ acpi_ps_get_next_field (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static u32
|
static u32
|
||||||
acpi_ps_get_next_package_length (
|
acpi_ps_get_next_package_length(struct acpi_parse_state *parser_state)
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
u32 encoded_length;
|
u32 encoded_length;
|
||||||
u32 length = 0;
|
u32 length = 0;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_get_next_package_length");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_get_next_package_length");
|
encoded_length = (u32) ACPI_GET8(parser_state->aml);
|
||||||
|
|
||||||
|
|
||||||
encoded_length = (u32) ACPI_GET8 (parser_state->aml);
|
|
||||||
parser_state->aml++;
|
parser_state->aml++;
|
||||||
|
|
||||||
switch (encoded_length >> 6) /* bits 6-7 contain encoding scheme */ {
|
switch (encoded_length >> 6) { /* bits 6-7 contain encoding scheme */
|
||||||
case 0: /* 1-byte encoding (bits 0-5) */
|
case 0: /* 1-byte encoding (bits 0-5) */
|
||||||
|
|
||||||
length = (encoded_length & 0x3F);
|
length = (encoded_length & 0x3F);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 1: /* 2-byte encoding (next byte + bits 0-3) */
|
||||||
|
|
||||||
case 1: /* 2-byte encoding (next byte + bits 0-3) */
|
length = ((ACPI_GET8(parser_state->aml) << 04) |
|
||||||
|
(encoded_length & 0x0F));
|
||||||
length = ((ACPI_GET8 (parser_state->aml) << 04) |
|
|
||||||
(encoded_length & 0x0F));
|
|
||||||
parser_state->aml++;
|
parser_state->aml++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
|
||||||
|
|
||||||
case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
|
length = ((ACPI_GET8(parser_state->aml + 1) << 12) |
|
||||||
|
(ACPI_GET8(parser_state->aml) << 04) |
|
||||||
length = ((ACPI_GET8 (parser_state->aml + 1) << 12) |
|
(encoded_length & 0x0F));
|
||||||
(ACPI_GET8 (parser_state->aml) << 04) |
|
|
||||||
(encoded_length & 0x0F));
|
|
||||||
parser_state->aml += 2;
|
parser_state->aml += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
|
||||||
|
|
||||||
case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
|
length = ((ACPI_GET8(parser_state->aml + 2) << 20) |
|
||||||
|
(ACPI_GET8(parser_state->aml + 1) << 12) |
|
||||||
length = ((ACPI_GET8 (parser_state->aml + 2) << 20) |
|
(ACPI_GET8(parser_state->aml) << 04) |
|
||||||
(ACPI_GET8 (parser_state->aml + 1) << 12) |
|
(encoded_length & 0x0F));
|
||||||
(ACPI_GET8 (parser_state->aml) << 04) |
|
|
||||||
(encoded_length & 0x0F));
|
|
||||||
parser_state->aml += 3;
|
parser_state->aml += 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -127,10 +116,9 @@ acpi_ps_get_next_package_length (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VALUE (length);
|
return_VALUE(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_next_package_end
|
* FUNCTION: acpi_ps_get_next_package_end
|
||||||
@@ -144,25 +132,21 @@ acpi_ps_get_next_package_length (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8 *
|
u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state)
|
||||||
acpi_ps_get_next_package_end (
|
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
u8 *start = parser_state->aml;
|
u8 *start = parser_state->aml;
|
||||||
acpi_native_uint length;
|
acpi_native_uint length;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_get_next_package_end");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_get_next_package_end");
|
||||||
|
|
||||||
/* Function below changes parser_state->Aml */
|
/* Function below 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 */
|
return_PTR(start + length); /* end of package */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_next_namestring
|
* FUNCTION: acpi_ps_get_next_namestring
|
||||||
@@ -178,20 +162,16 @@ acpi_ps_get_next_package_end (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
char *
|
char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state)
|
||||||
acpi_ps_get_next_namestring (
|
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
u8 *start = parser_state->aml;
|
u8 *start = parser_state->aml;
|
||||||
u8 *end = parser_state->aml;
|
u8 *end = parser_state->aml;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_get_next_namestring");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_get_next_namestring");
|
||||||
|
|
||||||
/* Handle multiple prefix characters */
|
/* Handle multiple prefix characters */
|
||||||
|
|
||||||
while (acpi_ps_is_prefix_char (ACPI_GET8 (end))) {
|
while (acpi_ps_is_prefix_char(ACPI_GET8(end))) {
|
||||||
/* Include prefix '\\' or '^' */
|
/* Include prefix '\\' or '^' */
|
||||||
|
|
||||||
end++;
|
end++;
|
||||||
@@ -199,7 +179,7 @@ acpi_ps_get_next_namestring (
|
|||||||
|
|
||||||
/* Decode the path */
|
/* Decode the path */
|
||||||
|
|
||||||
switch (ACPI_GET8 (end)) {
|
switch (ACPI_GET8(end)) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
/* null_name */
|
/* null_name */
|
||||||
@@ -221,7 +201,7 @@ acpi_ps_get_next_namestring (
|
|||||||
|
|
||||||
/* Multiple name segments, 4 chars each */
|
/* Multiple name segments, 4 chars each */
|
||||||
|
|
||||||
end += 2 + ((acpi_size) ACPI_GET8 (end + 1) * ACPI_NAME_SIZE);
|
end += 2 + ((acpi_size) ACPI_GET8(end + 1) * ACPI_NAME_SIZE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -232,11 +212,10 @@ acpi_ps_get_next_namestring (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_state->aml = (u8*) end;
|
parser_state->aml = (u8 *) end;
|
||||||
return_PTR ((char *) start);
|
return_PTR((char *)start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_next_namepath
|
* FUNCTION: acpi_ps_get_next_namepath
|
||||||
@@ -259,24 +238,20 @@ acpi_ps_get_next_namestring (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_get_next_namepath (
|
acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
struct acpi_parse_state *parser_state,
|
||||||
struct acpi_parse_state *parser_state,
|
union acpi_parse_object *arg, u8 method_call)
|
||||||
union acpi_parse_object *arg,
|
|
||||||
u8 method_call)
|
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
union acpi_parse_object *name_op;
|
union acpi_parse_object *name_op;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
union acpi_operand_object *method_desc;
|
union acpi_operand_object *method_desc;
|
||||||
struct acpi_namespace_node *node;
|
struct acpi_namespace_node *node;
|
||||||
union acpi_generic_state scope_info;
|
union acpi_generic_state scope_info;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_get_next_namepath");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_get_next_namepath");
|
path = acpi_ps_get_next_namestring(parser_state);
|
||||||
|
|
||||||
|
|
||||||
path = acpi_ps_get_next_namestring (parser_state);
|
|
||||||
|
|
||||||
/* Null path case is allowed */
|
/* Null path case is allowed */
|
||||||
|
|
||||||
@@ -296,49 +271,50 @@ acpi_ps_get_next_namepath (
|
|||||||
* parent tree, but don't open a new scope -- we just want to lookup the
|
* parent tree, but don't open a new scope -- we just want to lookup the
|
||||||
* object (MUST BE mode EXECUTE to perform upsearch)
|
* object (MUST BE mode EXECUTE to perform upsearch)
|
||||||
*/
|
*/
|
||||||
status = acpi_ns_lookup (&scope_info, path, ACPI_TYPE_ANY,
|
status = acpi_ns_lookup(&scope_info, path, ACPI_TYPE_ANY,
|
||||||
ACPI_IMODE_EXECUTE,
|
ACPI_IMODE_EXECUTE,
|
||||||
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
|
ACPI_NS_SEARCH_PARENT |
|
||||||
NULL, &node);
|
ACPI_NS_DONT_OPEN_SCOPE, NULL, &node);
|
||||||
if (ACPI_SUCCESS (status) && method_call) {
|
if (ACPI_SUCCESS(status) && method_call) {
|
||||||
if (node->type == ACPI_TYPE_METHOD) {
|
if (node->type == ACPI_TYPE_METHOD) {
|
||||||
/* This name is actually a control method invocation */
|
/* This name is actually a control method invocation */
|
||||||
|
|
||||||
method_desc = acpi_ns_get_attached_object (node);
|
method_desc = acpi_ns_get_attached_object(node);
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"Control Method - %p Desc %p Path=%p\n",
|
"Control Method - %p Desc %p Path=%p\n",
|
||||||
node, method_desc, path));
|
node, method_desc, path));
|
||||||
|
|
||||||
name_op = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
|
name_op = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
|
||||||
if (!name_op) {
|
if (!name_op) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Change arg into a METHOD CALL and attach name to it */
|
/* Change arg into a METHOD CALL and attach name to it */
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_INT_METHODCALL_OP);
|
acpi_ps_init_op(arg, AML_INT_METHODCALL_OP);
|
||||||
name_op->common.value.name = path;
|
name_op->common.value.name = path;
|
||||||
|
|
||||||
/* Point METHODCALL/NAME to the METHOD Node */
|
/* Point METHODCALL/NAME to the METHOD Node */
|
||||||
|
|
||||||
name_op->common.node = node;
|
name_op->common.node = node;
|
||||||
acpi_ps_append_arg (arg, name_op);
|
acpi_ps_append_arg(arg, name_op);
|
||||||
|
|
||||||
if (!method_desc) {
|
if (!method_desc) {
|
||||||
ACPI_REPORT_ERROR ((
|
ACPI_REPORT_ERROR(("ps_get_next_namepath: Control Method %p has no attached object\n", node));
|
||||||
"ps_get_next_namepath: Control Method %p has no attached object\n",
|
return_ACPI_STATUS(AE_AML_INTERNAL);
|
||||||
node));
|
|
||||||
return_ACPI_STATUS (AE_AML_INTERNAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"Control Method - %p Args %X\n",
|
"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 */
|
/* Get the number of arguments to expect */
|
||||||
|
|
||||||
walk_state->arg_count = method_desc->method.param_count;
|
walk_state->arg_count =
|
||||||
return_ACPI_STATUS (AE_OK);
|
method_desc->method.param_count;
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -348,25 +324,26 @@ acpi_ps_get_next_namepath (
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
/*
|
/*
|
||||||
* 1) Any error other than NOT_FOUND is always severe
|
* 1) Any error other than NOT_FOUND is always severe
|
||||||
* 2) NOT_FOUND is only important if we are executing a method.
|
* 2) NOT_FOUND is only important if we are executing a method.
|
||||||
* 3) If executing a cond_ref_of opcode, NOT_FOUND is ok.
|
* 3) If executing a cond_ref_of opcode, NOT_FOUND is ok.
|
||||||
*/
|
*/
|
||||||
if ((((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
|
if ((((walk_state->
|
||||||
(status == AE_NOT_FOUND) &&
|
parse_flags & ACPI_PARSE_MODE_MASK) ==
|
||||||
(walk_state->op->common.aml_opcode != AML_COND_REF_OF_OP)) ||
|
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);
|
||||||
|
|
||||||
(status != AE_NOT_FOUND)) {
|
acpi_os_printf
|
||||||
ACPI_REPORT_NSERROR (path, status);
|
("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",
|
} else {
|
||||||
scope_info.scope.node, parser_state->start_node, node);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/*
|
/*
|
||||||
* We got a NOT_FOUND during table load or we encountered
|
* We got a NOT_FOUND during table load or we encountered
|
||||||
* a cond_ref_of(x) where the target does not exist.
|
* a cond_ref_of(x) where the target does not exist.
|
||||||
@@ -381,13 +358,12 @@ acpi_ps_get_next_namepath (
|
|||||||
* Regardless of success/failure above,
|
* Regardless of success/failure above,
|
||||||
* Just initialize the Op with the pathname.
|
* Just initialize the Op with the pathname.
|
||||||
*/
|
*/
|
||||||
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
|
acpi_ps_init_op(arg, AML_INT_NAMEPATH_OP);
|
||||||
arg->common.value.name = path;
|
arg->common.value.name = path;
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_next_simple_arg
|
* FUNCTION: acpi_ps_get_next_simple_arg
|
||||||
@@ -403,87 +379,81 @@ acpi_ps_get_next_namepath (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ps_get_next_simple_arg (
|
acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
|
||||||
struct acpi_parse_state *parser_state,
|
u32 arg_type, union acpi_parse_object *arg)
|
||||||
u32 arg_type,
|
|
||||||
union acpi_parse_object *arg)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_U32 ("ps_get_next_simple_arg", arg_type);
|
ACPI_FUNCTION_TRACE_U32("ps_get_next_simple_arg", arg_type);
|
||||||
|
|
||||||
|
|
||||||
switch (arg_type) {
|
switch (arg_type) {
|
||||||
case ARGP_BYTEDATA:
|
case ARGP_BYTEDATA:
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_BYTE_OP);
|
acpi_ps_init_op(arg, AML_BYTE_OP);
|
||||||
arg->common.value.integer = (u32) ACPI_GET8 (parser_state->aml);
|
arg->common.value.integer = (u32) ACPI_GET8(parser_state->aml);
|
||||||
parser_state->aml++;
|
parser_state->aml++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_WORDDATA:
|
case ARGP_WORDDATA:
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_WORD_OP);
|
acpi_ps_init_op(arg, AML_WORD_OP);
|
||||||
|
|
||||||
/* Get 2 bytes from the AML stream */
|
/* Get 2 bytes from the AML stream */
|
||||||
|
|
||||||
ACPI_MOVE_16_TO_32 (&arg->common.value.integer, parser_state->aml);
|
ACPI_MOVE_16_TO_32(&arg->common.value.integer,
|
||||||
|
parser_state->aml);
|
||||||
parser_state->aml += 2;
|
parser_state->aml += 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_DWORDDATA:
|
case ARGP_DWORDDATA:
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_DWORD_OP);
|
acpi_ps_init_op(arg, AML_DWORD_OP);
|
||||||
|
|
||||||
/* Get 4 bytes from the AML stream */
|
/* Get 4 bytes from the AML stream */
|
||||||
|
|
||||||
ACPI_MOVE_32_TO_32 (&arg->common.value.integer, parser_state->aml);
|
ACPI_MOVE_32_TO_32(&arg->common.value.integer,
|
||||||
|
parser_state->aml);
|
||||||
parser_state->aml += 4;
|
parser_state->aml += 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_QWORDDATA:
|
case ARGP_QWORDDATA:
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_QWORD_OP);
|
acpi_ps_init_op(arg, AML_QWORD_OP);
|
||||||
|
|
||||||
/* Get 8 bytes from the AML stream */
|
/* Get 8 bytes from the AML stream */
|
||||||
|
|
||||||
ACPI_MOVE_64_TO_64 (&arg->common.value.integer, parser_state->aml);
|
ACPI_MOVE_64_TO_64(&arg->common.value.integer,
|
||||||
|
parser_state->aml);
|
||||||
parser_state->aml += 8;
|
parser_state->aml += 8;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_CHARLIST:
|
case ARGP_CHARLIST:
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_STRING_OP);
|
acpi_ps_init_op(arg, AML_STRING_OP);
|
||||||
arg->common.value.string = (char *) parser_state->aml;
|
arg->common.value.string = (char *)parser_state->aml;
|
||||||
|
|
||||||
while (ACPI_GET8 (parser_state->aml) != '\0') {
|
while (ACPI_GET8(parser_state->aml) != '\0') {
|
||||||
parser_state->aml++;
|
parser_state->aml++;
|
||||||
}
|
}
|
||||||
parser_state->aml++;
|
parser_state->aml++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_NAME:
|
case ARGP_NAME:
|
||||||
case ARGP_NAMESTRING:
|
case ARGP_NAMESTRING:
|
||||||
|
|
||||||
acpi_ps_init_op (arg, AML_INT_NAMEPATH_OP);
|
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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Invalid arg_type %X\n", arg_type));
|
ACPI_REPORT_ERROR(("Invalid arg_type %X\n", arg_type));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_next_field
|
* FUNCTION: acpi_ps_get_next_field
|
||||||
@@ -496,24 +466,21 @@ acpi_ps_get_next_simple_arg (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static union acpi_parse_object *
|
static union acpi_parse_object *acpi_ps_get_next_field(struct acpi_parse_state
|
||||||
acpi_ps_get_next_field (
|
*parser_state)
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
u32 aml_offset = (u32)
|
u32 aml_offset = (u32)
|
||||||
ACPI_PTR_DIFF (parser_state->aml,
|
ACPI_PTR_DIFF(parser_state->aml,
|
||||||
parser_state->aml_start);
|
parser_state->aml_start);
|
||||||
union acpi_parse_object *field;
|
union acpi_parse_object *field;
|
||||||
u16 opcode;
|
u16 opcode;
|
||||||
u32 name;
|
u32 name;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_get_next_field");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_get_next_field");
|
||||||
|
|
||||||
/* Determine field type */
|
/* Determine field type */
|
||||||
|
|
||||||
switch (ACPI_GET8 (parser_state->aml)) {
|
switch (ACPI_GET8(parser_state->aml)) {
|
||||||
default:
|
default:
|
||||||
|
|
||||||
opcode = AML_INT_NAMEDFIELD_OP;
|
opcode = AML_INT_NAMEDFIELD_OP;
|
||||||
@@ -534,9 +501,9 @@ acpi_ps_get_next_field (
|
|||||||
|
|
||||||
/* Allocate a new field op */
|
/* Allocate a new field op */
|
||||||
|
|
||||||
field = acpi_ps_alloc_op (opcode);
|
field = acpi_ps_alloc_op(opcode);
|
||||||
if (!field) {
|
if (!field) {
|
||||||
return_PTR (NULL);
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
field->common.aml_offset = aml_offset;
|
field->common.aml_offset = aml_offset;
|
||||||
@@ -548,33 +515,34 @@ acpi_ps_get_next_field (
|
|||||||
|
|
||||||
/* Get the 4-character name */
|
/* Get the 4-character name */
|
||||||
|
|
||||||
ACPI_MOVE_32_TO_32 (&name, parser_state->aml);
|
ACPI_MOVE_32_TO_32(&name, parser_state->aml);
|
||||||
acpi_ps_set_name (field, name);
|
acpi_ps_set_name(field, name);
|
||||||
parser_state->aml += ACPI_NAME_SIZE;
|
parser_state->aml += ACPI_NAME_SIZE;
|
||||||
|
|
||||||
/* Get the length which is encoded as a package length */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INT_RESERVEDFIELD_OP:
|
case AML_INT_RESERVEDFIELD_OP:
|
||||||
|
|
||||||
/* Get the length which is encoded as a package length */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_INT_ACCESSFIELD_OP:
|
case AML_INT_ACCESSFIELD_OP:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get access_type and access_attrib and merge into the field Op
|
* Get access_type and access_attrib and merge into the field Op
|
||||||
* access_type is first operand, access_attribute is second
|
* 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++;
|
parser_state->aml++;
|
||||||
field->common.value.integer |= ACPI_GET8 (parser_state->aml);
|
field->common.value.integer |= ACPI_GET8(parser_state->aml);
|
||||||
parser_state->aml++;
|
parser_state->aml++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -584,10 +552,9 @@ acpi_ps_get_next_field (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_PTR (field);
|
return_PTR(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_next_arg
|
* FUNCTION: acpi_ps_get_next_arg
|
||||||
@@ -605,21 +572,17 @@ acpi_ps_get_next_field (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_get_next_arg (
|
acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
struct acpi_parse_state *parser_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 *arg = NULL;
|
||||||
union acpi_parse_object *prev = NULL;
|
union acpi_parse_object *prev = NULL;
|
||||||
union acpi_parse_object *field;
|
union acpi_parse_object *field;
|
||||||
u32 subop;
|
u32 subop;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_get_next_arg", parser_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_get_next_arg", parser_state);
|
||||||
|
|
||||||
switch (arg_type) {
|
switch (arg_type) {
|
||||||
case ARGP_BYTEDATA:
|
case ARGP_BYTEDATA:
|
||||||
@@ -631,37 +594,35 @@ acpi_ps_get_next_arg (
|
|||||||
|
|
||||||
/* Constants, strings, and namestrings are all the same size */
|
/* Constants, strings, and namestrings are all the same size */
|
||||||
|
|
||||||
arg = acpi_ps_alloc_op (AML_BYTE_OP);
|
arg = acpi_ps_alloc_op(AML_BYTE_OP);
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
acpi_ps_get_next_simple_arg (parser_state, arg_type, arg);
|
acpi_ps_get_next_simple_arg(parser_state, arg_type, arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_PKGLENGTH:
|
case ARGP_PKGLENGTH:
|
||||||
|
|
||||||
/* Package length, nothing returned */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_FIELDLIST:
|
case ARGP_FIELDLIST:
|
||||||
|
|
||||||
if (parser_state->aml < parser_state->pkg_end) {
|
if (parser_state->aml < parser_state->pkg_end) {
|
||||||
/* Non-empty list */
|
/* Non-empty list */
|
||||||
|
|
||||||
while (parser_state->aml < parser_state->pkg_end) {
|
while (parser_state->aml < parser_state->pkg_end) {
|
||||||
field = acpi_ps_get_next_field (parser_state);
|
field = acpi_ps_get_next_field(parser_state);
|
||||||
if (!field) {
|
if (!field) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prev) {
|
if (prev) {
|
||||||
prev->common.next = field;
|
prev->common.next = field;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
arg = field;
|
arg = field;
|
||||||
}
|
}
|
||||||
prev = field;
|
prev = field;
|
||||||
@@ -673,21 +634,21 @@ acpi_ps_get_next_arg (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_BYTELIST:
|
case ARGP_BYTELIST:
|
||||||
|
|
||||||
if (parser_state->aml < parser_state->pkg_end) {
|
if (parser_state->aml < parser_state->pkg_end) {
|
||||||
/* Non-empty list */
|
/* Non-empty list */
|
||||||
|
|
||||||
arg = acpi_ps_alloc_op (AML_INT_BYTELIST_OP);
|
arg = acpi_ps_alloc_op(AML_INT_BYTELIST_OP);
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in bytelist data */
|
/* Fill in bytelist data */
|
||||||
|
|
||||||
arg->common.value.size = (u32)
|
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;
|
arg->named.data = parser_state->aml;
|
||||||
|
|
||||||
/* Skip to End of byte data */
|
/* Skip to End of byte data */
|
||||||
@@ -696,32 +657,31 @@ acpi_ps_get_next_arg (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_TARGET:
|
case ARGP_TARGET:
|
||||||
case ARGP_SUPERNAME:
|
case ARGP_SUPERNAME:
|
||||||
case ARGP_SIMPLENAME:
|
case ARGP_SIMPLENAME:
|
||||||
|
|
||||||
subop = acpi_ps_peek_opcode (parser_state);
|
subop = acpi_ps_peek_opcode(parser_state);
|
||||||
if (subop == 0 ||
|
if (subop == 0 ||
|
||||||
acpi_ps_is_leading_char (subop) ||
|
acpi_ps_is_leading_char(subop) ||
|
||||||
acpi_ps_is_prefix_char (subop)) {
|
acpi_ps_is_prefix_char(subop)) {
|
||||||
/* null_name or name_string */
|
/* null_name or name_string */
|
||||||
|
|
||||||
arg = acpi_ps_alloc_op (AML_INT_NAMEPATH_OP);
|
arg = acpi_ps_alloc_op(AML_INT_NAMEPATH_OP);
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ps_get_next_namepath (walk_state, parser_state, arg, 0);
|
status =
|
||||||
}
|
acpi_ps_get_next_namepath(walk_state, parser_state,
|
||||||
else {
|
arg, 0);
|
||||||
|
} else {
|
||||||
/* Single complex argument, nothing returned */
|
/* Single complex argument, nothing returned */
|
||||||
|
|
||||||
walk_state->arg_count = 1;
|
walk_state->arg_count = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_DATAOBJ:
|
case ARGP_DATAOBJ:
|
||||||
case ARGP_TERMARG:
|
case ARGP_TERMARG:
|
||||||
|
|
||||||
@@ -730,7 +690,6 @@ acpi_ps_get_next_arg (
|
|||||||
walk_state->arg_count = 1;
|
walk_state->arg_count = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case ARGP_DATAOBJLIST:
|
case ARGP_DATAOBJLIST:
|
||||||
case ARGP_TERMLIST:
|
case ARGP_TERMLIST:
|
||||||
case ARGP_OBJLIST:
|
case ARGP_OBJLIST:
|
||||||
@@ -742,14 +701,13 @@ acpi_ps_get_next_arg (
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("Invalid arg_type: %X\n", arg_type));
|
ACPI_REPORT_ERROR(("Invalid arg_type: %X\n", arg_type));
|
||||||
status = AE_AML_OPERAND_TYPE;
|
status = AE_AML_OPERAND_TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*return_arg = arg;
|
*return_arg = arg;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the AML and build an operation tree as most interpreters,
|
* Parse the AML and build an operation tree as most interpreters,
|
||||||
* like Perl, do. Parsing is done by hand rather than with a YACC
|
* like Perl, do. Parsing is done by hand rather than with a YACC
|
||||||
@@ -57,10 +56,9 @@
|
|||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psloop")
|
ACPI_MODULE_NAME("psloop")
|
||||||
|
|
||||||
static u32 acpi_gbl_depth = 0;
|
|
||||||
|
|
||||||
|
static u32 acpi_gbl_depth = 0;
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -75,23 +73,20 @@ static u32 acpi_gbl_depth = 0;
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state)
|
||||||
acpi_ps_parse_loop (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
acpi_status status2;
|
acpi_status status2;
|
||||||
union acpi_parse_object *op = NULL; /* current op */
|
union acpi_parse_object *op = NULL; /* current op */
|
||||||
union acpi_parse_object *arg = NULL;
|
union acpi_parse_object *arg = NULL;
|
||||||
union acpi_parse_object *pre_op = NULL;
|
union acpi_parse_object *pre_op = NULL;
|
||||||
struct acpi_parse_state *parser_state;
|
struct acpi_parse_state *parser_state;
|
||||||
u8 *aml_op_start = NULL;
|
u8 *aml_op_start = NULL;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_parse_loop", walk_state);
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_parse_loop", walk_state);
|
|
||||||
|
|
||||||
if (walk_state->descending_callback == NULL) {
|
if (walk_state->descending_callback == NULL) {
|
||||||
return_ACPI_STATUS (AE_BAD_PARAMETER);
|
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_state = &walk_state->parser_state;
|
parser_state = &walk_state->parser_state;
|
||||||
@@ -102,45 +97,56 @@ acpi_ps_parse_loop (
|
|||||||
if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
|
if (walk_state->walk_type & ACPI_WALK_METHOD_RESTART) {
|
||||||
/* We are restarting a preempted control method */
|
/* We are restarting a preempted control method */
|
||||||
|
|
||||||
if (acpi_ps_has_completed_scope (parser_state)) {
|
if (acpi_ps_has_completed_scope(parser_state)) {
|
||||||
/*
|
/*
|
||||||
* We must check if a predicate to an IF or WHILE statement
|
* We must check if a predicate to an IF or WHILE statement
|
||||||
* was just completed
|
* was just completed
|
||||||
*/
|
*/
|
||||||
if ((parser_state->scope->parse_scope.op) &&
|
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.
|
||||||
(parser_state->scope->parse_scope.op->common.aml_opcode == AML_WHILE_OP)) &&
|
aml_opcode == AML_IF_OP)
|
||||||
(walk_state->control_state) &&
|
|| (parser_state->scope->parse_scope.op->common.
|
||||||
(walk_state->control_state->common.state ==
|
aml_opcode == AML_WHILE_OP))
|
||||||
ACPI_CONTROL_PREDICATE_EXECUTING)) {
|
&& (walk_state->control_state)
|
||||||
|
&& (walk_state->control_state->common.state ==
|
||||||
|
ACPI_CONTROL_PREDICATE_EXECUTING)) {
|
||||||
/*
|
/*
|
||||||
* A predicate was just completed, get the value of the
|
* A predicate was just completed, get the value of the
|
||||||
* predicate and branch based on that value
|
* predicate and branch based on that value
|
||||||
*/
|
*/
|
||||||
walk_state->op = NULL;
|
walk_state->op = NULL;
|
||||||
status = acpi_ds_get_predicate_value (walk_state, ACPI_TO_POINTER (TRUE));
|
status =
|
||||||
if (ACPI_FAILURE (status) &&
|
acpi_ds_get_predicate_value(walk_state,
|
||||||
((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
|
ACPI_TO_POINTER
|
||||||
|
(TRUE));
|
||||||
|
if (ACPI_FAILURE(status)
|
||||||
|
&& ((status & AE_CODE_MASK) !=
|
||||||
|
AE_CODE_CONTROL)) {
|
||||||
if (status == AE_AML_NO_RETURN_VALUE) {
|
if (status == AE_AML_NO_RETURN_VALUE) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Invoked method did not return a value, %s\n",
|
"Invoked method did not return a value, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception
|
||||||
|
(status)));
|
||||||
|
|
||||||
}
|
}
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"get_predicate Failed, %s\n",
|
"get_predicate Failed, %s\n",
|
||||||
acpi_format_exception (status)));
|
acpi_format_exception
|
||||||
return_ACPI_STATUS (status);
|
(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,
|
acpi_ps_pop_scope(parser_state, &op,
|
||||||
&walk_state->arg_types, &walk_state->arg_count);
|
&walk_state->arg_types,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
|
&walk_state->arg_count);
|
||||||
}
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
else if (walk_state->prev_op) {
|
"Popped scope, Op=%p\n", op));
|
||||||
|
} else if (walk_state->prev_op) {
|
||||||
/* We were in the middle of an op */
|
/* We were in the middle of an op */
|
||||||
|
|
||||||
op = walk_state->prev_op;
|
op = walk_state->prev_op;
|
||||||
@@ -156,9 +162,10 @@ acpi_ps_parse_loop (
|
|||||||
if (!op) {
|
if (!op) {
|
||||||
/* Get the next opcode from the AML stream */
|
/* Get the next opcode from the AML stream */
|
||||||
|
|
||||||
walk_state->aml_offset = (u32) ACPI_PTR_DIFF (parser_state->aml,
|
walk_state->aml_offset =
|
||||||
parser_state->aml_start);
|
(u32) ACPI_PTR_DIFF(parser_state->aml,
|
||||||
walk_state->opcode = acpi_ps_peek_opcode (parser_state);
|
parser_state->aml_start);
|
||||||
|
walk_state->opcode = acpi_ps_peek_opcode(parser_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First cut to determine what we have found:
|
* First cut to determine what we have found:
|
||||||
@@ -166,7 +173,8 @@ acpi_ps_parse_loop (
|
|||||||
* 2) A name string
|
* 2) A name string
|
||||||
* 3) An unknown/invalid opcode
|
* 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) {
|
switch (walk_state->op_info->class) {
|
||||||
case AML_CLASS_ASCII:
|
case AML_CLASS_ASCII:
|
||||||
case AML_CLASS_PREFIX:
|
case AML_CLASS_PREFIX:
|
||||||
@@ -182,11 +190,13 @@ acpi_ps_parse_loop (
|
|||||||
|
|
||||||
/* The opcode is unrecognized. Just skip unknown opcodes */
|
/* The opcode is unrecognized. Just skip unknown opcodes */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Found unknown opcode %X at AML address %p offset %X, ignoring\n",
|
"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);
|
ACPI_DUMP_BUFFER(parser_state->aml, 128);
|
||||||
|
|
||||||
/* Assume one-byte bad opcode */
|
/* Assume one-byte bad opcode */
|
||||||
|
|
||||||
@@ -197,8 +207,10 @@ acpi_ps_parse_loop (
|
|||||||
|
|
||||||
/* Found opcode info, this is a normal opcode */
|
/* Found opcode info, this is a normal opcode */
|
||||||
|
|
||||||
parser_state->aml += acpi_ps_get_opcode_size (walk_state->opcode);
|
parser_state->aml +=
|
||||||
walk_state->arg_types = walk_state->op_info->parse_args;
|
acpi_ps_get_opcode_size(walk_state->opcode);
|
||||||
|
walk_state->arg_types =
|
||||||
|
walk_state->op_info->parse_args;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +220,9 @@ acpi_ps_parse_loop (
|
|||||||
/* Allocate a new pre_op if necessary */
|
/* Allocate a new pre_op if necessary */
|
||||||
|
|
||||||
if (!pre_op) {
|
if (!pre_op) {
|
||||||
pre_op = acpi_ps_alloc_op (walk_state->opcode);
|
pre_op =
|
||||||
|
acpi_ps_alloc_op(walk_state->
|
||||||
|
opcode);
|
||||||
if (!pre_op) {
|
if (!pre_op) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
@@ -222,30 +236,40 @@ acpi_ps_parse_loop (
|
|||||||
* Get and append arguments until we find the node that contains
|
* Get and append arguments until we find the node that contains
|
||||||
* the name (the type ARGP_NAME).
|
* the name (the type ARGP_NAME).
|
||||||
*/
|
*/
|
||||||
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
|
while (GET_CURRENT_ARG_TYPE
|
||||||
(GET_CURRENT_ARG_TYPE (walk_state->arg_types) != ARGP_NAME)) {
|
(walk_state->arg_types)
|
||||||
status = acpi_ps_get_next_arg (walk_state, parser_state,
|
&&
|
||||||
GET_CURRENT_ARG_TYPE (walk_state->arg_types), &arg);
|
(GET_CURRENT_ARG_TYPE
|
||||||
if (ACPI_FAILURE (status)) {
|
(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;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ps_append_arg (pre_op, arg);
|
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
|
* Make sure that we found a NAME and didn't run out of
|
||||||
* arguments
|
* arguments
|
||||||
*/
|
*/
|
||||||
if (!GET_CURRENT_ARG_TYPE (walk_state->arg_types)) {
|
if (!GET_CURRENT_ARG_TYPE
|
||||||
|
(walk_state->arg_types)) {
|
||||||
status = AE_AML_NO_OPERAND;
|
status = AE_AML_NO_OPERAND;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We know that this arg is a name, move to next arg */
|
/* We know that this arg is a name, move to next arg */
|
||||||
|
|
||||||
INCREMENT_ARG_LIST (walk_state->arg_types);
|
INCREMENT_ARG_LIST(walk_state->arg_types);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the object. This will either insert the object into
|
* Find the object. This will either insert the object into
|
||||||
@@ -253,11 +277,14 @@ acpi_ps_parse_loop (
|
|||||||
*/
|
*/
|
||||||
walk_state->op = NULL;
|
walk_state->op = NULL;
|
||||||
|
|
||||||
status = walk_state->descending_callback (walk_state, &op);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
walk_state->descending_callback(walk_state,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
&op);
|
||||||
"During name lookup/catalog, %s\n",
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_format_exception (status)));
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
|
"During name lookup/catalog, %s\n",
|
||||||
|
acpi_format_exception
|
||||||
|
(status)));
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,17 +292,20 @@ acpi_ps_parse_loop (
|
|||||||
continue;
|
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) {
|
if (status == AE_CTRL_PENDING) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto close_this_op;
|
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++;
|
acpi_gbl_depth++;
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_REGION_OP) {
|
if (op->common.aml_opcode == AML_REGION_OP) {
|
||||||
@@ -291,15 +321,15 @@ acpi_ps_parse_loop (
|
|||||||
*
|
*
|
||||||
* (Length is unknown until parse of the body complete)
|
* (Length is unknown until parse of the body complete)
|
||||||
*/
|
*/
|
||||||
op->named.data = aml_op_start;
|
op->named.data = aml_op_start;
|
||||||
op->named.length = 0;
|
op->named.length = 0;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Not a named opcode, just allocate Op and append to parent */
|
/* 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 =
|
||||||
op = acpi_ps_alloc_op (walk_state->opcode);
|
acpi_ps_get_opcode_info(walk_state->opcode);
|
||||||
|
op = acpi_ps_alloc_op(walk_state->opcode);
|
||||||
if (!op) {
|
if (!op) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
@@ -310,11 +340,12 @@ acpi_ps_parse_loop (
|
|||||||
* Backup to beginning of create_xXXfield declaration
|
* Backup to beginning of create_xXXfield declaration
|
||||||
* body_length is unknown until we parse the body
|
* body_length is unknown until we parse the body
|
||||||
*/
|
*/
|
||||||
op->named.data = aml_op_start;
|
op->named.data = aml_op_start;
|
||||||
op->named.length = 0;
|
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)) {
|
if ((walk_state->descending_callback != NULL)) {
|
||||||
/*
|
/*
|
||||||
@@ -323,14 +354,20 @@ acpi_ps_parse_loop (
|
|||||||
*/
|
*/
|
||||||
walk_state->op = op;
|
walk_state->op = op;
|
||||||
|
|
||||||
status = walk_state->descending_callback (walk_state, &op);
|
status =
|
||||||
status = acpi_ps_next_parse_state (walk_state, op, status);
|
walk_state->
|
||||||
|
descending_callback(walk_state,
|
||||||
|
&op);
|
||||||
|
status =
|
||||||
|
acpi_ps_next_parse_state(walk_state,
|
||||||
|
op,
|
||||||
|
status);
|
||||||
if (status == AE_CTRL_PENDING) {
|
if (status == AE_CTRL_PENDING) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -339,14 +376,15 @@ acpi_ps_parse_loop (
|
|||||||
op->common.aml_offset = walk_state->aml_offset;
|
op->common.aml_offset = walk_state->aml_offset;
|
||||||
|
|
||||||
if (walk_state->op_info) {
|
if (walk_state->op_info) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
|
"Opcode %4.4X [%s] Op %p Aml %p aml_offset %5.5X\n",
|
||||||
(u32) op->common.aml_opcode, walk_state->op_info->name,
|
(u32) op->common.aml_opcode,
|
||||||
op, parser_state->aml, op->common.aml_offset));
|
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
|
* Start arg_count at zero because we don't know if there are
|
||||||
* any args yet
|
* any args yet
|
||||||
@@ -359,22 +397,27 @@ acpi_ps_parse_loop (
|
|||||||
/* Get arguments */
|
/* Get arguments */
|
||||||
|
|
||||||
switch (op->common.aml_opcode) {
|
switch (op->common.aml_opcode) {
|
||||||
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
|
case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
|
||||||
case AML_WORD_OP: /* AML_WORDDATA_ARG */
|
case AML_WORD_OP: /* AML_WORDDATA_ARG */
|
||||||
case AML_DWORD_OP: /* AML_DWORDATA_ARG */
|
case AML_DWORD_OP: /* AML_DWORDATA_ARG */
|
||||||
case AML_QWORD_OP: /* AML_QWORDATA_ARG */
|
case AML_QWORD_OP: /* AML_QWORDATA_ARG */
|
||||||
case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
|
case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
|
||||||
|
|
||||||
/* Fill in constant or string argument directly */
|
/* Fill in constant or string argument directly */
|
||||||
|
|
||||||
acpi_ps_get_next_simple_arg (parser_state,
|
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;
|
break;
|
||||||
|
|
||||||
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
|
case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
|
||||||
|
|
||||||
status = acpi_ps_get_next_namepath (walk_state, parser_state, op, 1);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ps_get_next_namepath(walk_state,
|
||||||
|
parser_state, op,
|
||||||
|
1);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,34 +429,46 @@ acpi_ps_parse_loop (
|
|||||||
* Op is not a constant or string, append each argument
|
* Op is not a constant or string, append each argument
|
||||||
* to the Op
|
* to the Op
|
||||||
*/
|
*/
|
||||||
while (GET_CURRENT_ARG_TYPE (walk_state->arg_types) &&
|
while (GET_CURRENT_ARG_TYPE
|
||||||
!walk_state->arg_count) {
|
(walk_state->arg_types)
|
||||||
|
&& !walk_state->arg_count) {
|
||||||
walk_state->aml_offset = (u32)
|
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,
|
status =
|
||||||
GET_CURRENT_ARG_TYPE (walk_state->arg_types),
|
acpi_ps_get_next_arg(walk_state,
|
||||||
&arg);
|
parser_state,
|
||||||
if (ACPI_FAILURE (status)) {
|
GET_CURRENT_ARG_TYPE
|
||||||
|
(walk_state->
|
||||||
|
arg_types),
|
||||||
|
&arg);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg) {
|
if (arg) {
|
||||||
arg->common.aml_offset = walk_state->aml_offset;
|
arg->common.aml_offset =
|
||||||
acpi_ps_append_arg (op, arg);
|
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 */
|
/* Special processing for certain opcodes */
|
||||||
|
|
||||||
/* TBD (remove): Temporary mechanism to disable this code if needed */
|
/* TBD (remove): Temporary mechanism to disable this code if needed */
|
||||||
|
|
||||||
#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
|
#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
|
||||||
|
|
||||||
if ((walk_state->pass_number <= ACPI_IMODE_LOAD_PASS1) &&
|
if ((walk_state->pass_number <=
|
||||||
((walk_state->parse_flags & ACPI_PARSE_DISASSEMBLE) == 0)) {
|
ACPI_IMODE_LOAD_PASS1)
|
||||||
|
&&
|
||||||
|
((walk_state->
|
||||||
|
parse_flags & ACPI_PARSE_DISASSEMBLE) ==
|
||||||
|
0)) {
|
||||||
/*
|
/*
|
||||||
* We want to skip If/Else/While constructs during Pass1
|
* We want to skip If/Else/While constructs during Pass1
|
||||||
* because we want to actually conditionally execute the
|
* because we want to actually conditionally execute the
|
||||||
@@ -427,12 +482,13 @@ acpi_ps_parse_loop (
|
|||||||
case AML_ELSE_OP:
|
case AML_ELSE_OP:
|
||||||
case AML_WHILE_OP:
|
case AML_WHILE_OP:
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"Pass1: Skipping an If/Else/While body\n"));
|
"Pass1: Skipping an If/Else/While body\n"));
|
||||||
|
|
||||||
/* Skip body of if/else/while in pass 1 */
|
/* 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;
|
walk_state->arg_count = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -451,13 +507,15 @@ acpi_ps_parse_loop (
|
|||||||
*
|
*
|
||||||
* Save the length and address of the body
|
* Save the length and address of the body
|
||||||
*/
|
*/
|
||||||
op->named.data = parser_state->aml;
|
op->named.data = parser_state->aml;
|
||||||
op->named.length = (u32) (parser_state->pkg_end -
|
op->named.length =
|
||||||
parser_state->aml);
|
(u32) (parser_state->pkg_end -
|
||||||
|
parser_state->aml);
|
||||||
|
|
||||||
/* Skip body of method */
|
/* Skip body of method */
|
||||||
|
|
||||||
parser_state->aml = parser_state->pkg_end;
|
parser_state->aml =
|
||||||
|
parser_state->pkg_end;
|
||||||
walk_state->arg_count = 0;
|
walk_state->arg_count = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -466,20 +524,25 @@ acpi_ps_parse_loop (
|
|||||||
case AML_VAR_PACKAGE_OP:
|
case AML_VAR_PACKAGE_OP:
|
||||||
|
|
||||||
if ((op->common.parent) &&
|
if ((op->common.parent) &&
|
||||||
(op->common.parent->common.aml_opcode == AML_NAME_OP) &&
|
(op->common.parent->common.
|
||||||
(walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
|
aml_opcode == AML_NAME_OP)
|
||||||
|
&& (walk_state->pass_number <=
|
||||||
|
ACPI_IMODE_LOAD_PASS2)) {
|
||||||
/*
|
/*
|
||||||
* Skip parsing of Buffers and Packages
|
* Skip parsing of Buffers and Packages
|
||||||
* because we don't have enough info in the first pass
|
* because we don't have enough info in the first pass
|
||||||
* to parse them correctly.
|
* to parse them correctly.
|
||||||
*/
|
*/
|
||||||
op->named.data = aml_op_start;
|
op->named.data = aml_op_start;
|
||||||
op->named.length = (u32) (parser_state->pkg_end -
|
op->named.length =
|
||||||
aml_op_start);
|
(u32) (parser_state->
|
||||||
|
pkg_end -
|
||||||
|
aml_op_start);
|
||||||
|
|
||||||
/* Skip body */
|
/* Skip body */
|
||||||
|
|
||||||
parser_state->aml = parser_state->pkg_end;
|
parser_state->aml =
|
||||||
|
parser_state->pkg_end;
|
||||||
walk_state->arg_count = 0;
|
walk_state->arg_count = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -487,8 +550,9 @@ acpi_ps_parse_loop (
|
|||||||
case AML_WHILE_OP:
|
case AML_WHILE_OP:
|
||||||
|
|
||||||
if (walk_state->control_state) {
|
if (walk_state->control_state) {
|
||||||
walk_state->control_state->control.package_end =
|
walk_state->control_state->
|
||||||
parser_state->pkg_end;
|
control.package_end =
|
||||||
|
parser_state->pkg_end;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -508,9 +572,10 @@ acpi_ps_parse_loop (
|
|||||||
* There are arguments (complex ones), push Op and
|
* There are arguments (complex ones), push Op and
|
||||||
* prepare for argument
|
* prepare for argument
|
||||||
*/
|
*/
|
||||||
status = acpi_ps_push_scope (parser_state, op,
|
status = acpi_ps_push_scope(parser_state, op,
|
||||||
walk_state->arg_types, walk_state->arg_count);
|
walk_state->arg_types,
|
||||||
if (ACPI_FAILURE (status)) {
|
walk_state->arg_count);
|
||||||
|
if (ACPI_FAILURE(status)) {
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
op = NULL;
|
op = NULL;
|
||||||
@@ -521,7 +586,8 @@ acpi_ps_parse_loop (
|
|||||||
* All arguments have been processed -- Op is complete,
|
* All arguments have been processed -- Op is complete,
|
||||||
* prepare for next
|
* prepare for next
|
||||||
*/
|
*/
|
||||||
walk_state->op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
|
walk_state->op_info =
|
||||||
|
acpi_ps_get_opcode_info(op->common.aml_opcode);
|
||||||
if (walk_state->op_info->flags & AML_NAMED) {
|
if (walk_state->op_info->flags & AML_NAMED) {
|
||||||
if (acpi_gbl_depth) {
|
if (acpi_gbl_depth) {
|
||||||
acpi_gbl_depth--;
|
acpi_gbl_depth--;
|
||||||
@@ -536,7 +602,8 @@ acpi_ps_parse_loop (
|
|||||||
* Completed parsing an op_region declaration, we now
|
* Completed parsing an op_region declaration, we now
|
||||||
* know the length.
|
* know the length.
|
||||||
*/
|
*/
|
||||||
op->named.length = (u32) (parser_state->aml - op->named.data);
|
op->named.length =
|
||||||
|
(u32) (parser_state->aml - op->named.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,25 +614,26 @@ acpi_ps_parse_loop (
|
|||||||
*
|
*
|
||||||
* body_length is unknown until we parse the body
|
* 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 */
|
/* This op complete, notify the dispatcher */
|
||||||
|
|
||||||
if (walk_state->ascending_callback != NULL) {
|
if (walk_state->ascending_callback != NULL) {
|
||||||
walk_state->op = op;
|
walk_state->op = op;
|
||||||
walk_state->opcode = op->common.aml_opcode;
|
walk_state->opcode = op->common.aml_opcode;
|
||||||
|
|
||||||
status = walk_state->ascending_callback (walk_state);
|
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) {
|
if (status == AE_CTRL_PENDING) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
close_this_op:
|
||||||
close_this_op:
|
|
||||||
/*
|
/*
|
||||||
* Finished one argument of the containing scope
|
* Finished one argument of the containing scope
|
||||||
*/
|
*/
|
||||||
@@ -574,15 +642,15 @@ close_this_op:
|
|||||||
/* Finished with pre_op */
|
/* Finished with pre_op */
|
||||||
|
|
||||||
if (pre_op) {
|
if (pre_op) {
|
||||||
acpi_ps_free_op (pre_op);
|
acpi_ps_free_op(pre_op);
|
||||||
pre_op = NULL;
|
pre_op = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close this Op (will result in parse subtree deletion) */
|
/* Close this Op (will result in parse subtree deletion) */
|
||||||
|
|
||||||
status2 = acpi_ps_complete_this_op (walk_state, op);
|
status2 = acpi_ps_complete_this_op(walk_state, op);
|
||||||
if (ACPI_FAILURE (status2)) {
|
if (ACPI_FAILURE(status2)) {
|
||||||
return_ACPI_STATUS (status2);
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
op = NULL;
|
op = NULL;
|
||||||
|
|
||||||
@@ -590,68 +658,74 @@ close_this_op:
|
|||||||
case AE_OK:
|
case AE_OK:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_TRANSFER:
|
case AE_CTRL_TRANSFER:
|
||||||
|
|
||||||
/* We are about to transfer to a called method. */
|
/* We are about to transfer to a called method. */
|
||||||
|
|
||||||
walk_state->prev_op = op;
|
walk_state->prev_op = op;
|
||||||
walk_state->prev_arg_types = walk_state->arg_types;
|
walk_state->prev_arg_types = walk_state->arg_types;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_END:
|
case AE_CTRL_END:
|
||||||
|
|
||||||
acpi_ps_pop_scope (parser_state, &op,
|
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) {
|
if (op) {
|
||||||
walk_state->op = 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;
|
walk_state->opcode = op->common.aml_opcode;
|
||||||
|
|
||||||
status = walk_state->ascending_callback (walk_state);
|
status =
|
||||||
status = acpi_ps_next_parse_state (walk_state, op, 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 =
|
||||||
if (ACPI_FAILURE (status2)) {
|
acpi_ps_complete_this_op(walk_state, op);
|
||||||
return_ACPI_STATUS (status2);
|
if (ACPI_FAILURE(status2)) {
|
||||||
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
op = NULL;
|
op = NULL;
|
||||||
}
|
}
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_BREAK:
|
case AE_CTRL_BREAK:
|
||||||
case AE_CTRL_CONTINUE:
|
case AE_CTRL_CONTINUE:
|
||||||
|
|
||||||
/* Pop off scopes until we find the While */
|
/* Pop off scopes until we find the While */
|
||||||
|
|
||||||
while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
|
while (!op || (op->common.aml_opcode != AML_WHILE_OP)) {
|
||||||
acpi_ps_pop_scope (parser_state, &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 */
|
/* Close this iteration of the While loop */
|
||||||
|
|
||||||
walk_state->op = 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;
|
walk_state->opcode = op->common.aml_opcode;
|
||||||
|
|
||||||
status = walk_state->ascending_callback (walk_state);
|
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);
|
status2 = acpi_ps_complete_this_op(walk_state, op);
|
||||||
if (ACPI_FAILURE (status2)) {
|
if (ACPI_FAILURE(status2)) {
|
||||||
return_ACPI_STATUS (status2);
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
op = NULL;
|
op = NULL;
|
||||||
|
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_TERMINATE:
|
case AE_CTRL_TERMINATE:
|
||||||
|
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
@@ -659,61 +733,66 @@ close_this_op:
|
|||||||
/* Clean up */
|
/* Clean up */
|
||||||
do {
|
do {
|
||||||
if (op) {
|
if (op) {
|
||||||
status2 = acpi_ps_complete_this_op (walk_state, op);
|
status2 =
|
||||||
if (ACPI_FAILURE (status2)) {
|
acpi_ps_complete_this_op(walk_state,
|
||||||
return_ACPI_STATUS (status2);
|
op);
|
||||||
|
if (ACPI_FAILURE(status2)) {
|
||||||
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
acpi_ps_pop_scope (parser_state, &op,
|
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);
|
} while (op);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
|
|
||||||
|
default: /* All other non-AE_OK status */
|
||||||
default: /* All other non-AE_OK status */
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (op) {
|
if (op) {
|
||||||
status2 = acpi_ps_complete_this_op (walk_state, op);
|
status2 =
|
||||||
if (ACPI_FAILURE (status2)) {
|
acpi_ps_complete_this_op(walk_state,
|
||||||
return_ACPI_STATUS (status2);
|
op);
|
||||||
|
if (ACPI_FAILURE(status2)) {
|
||||||
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
acpi_ps_pop_scope (parser_state, &op,
|
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);
|
} while (op);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TBD: Cleanup parse ops on error
|
* TBD: Cleanup parse ops on error
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
if (op == NULL) {
|
if (op == NULL) {
|
||||||
acpi_ps_pop_scope (parser_state, &op,
|
acpi_ps_pop_scope(parser_state, &op,
|
||||||
&walk_state->arg_types, &walk_state->arg_count);
|
&walk_state->arg_types,
|
||||||
|
&walk_state->arg_count);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
walk_state->prev_op = op;
|
walk_state->prev_op = op;
|
||||||
walk_state->prev_arg_types = walk_state->arg_types;
|
walk_state->prev_arg_types = walk_state->arg_types;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This scope complete? */
|
/* This scope complete? */
|
||||||
|
|
||||||
if (acpi_ps_has_completed_scope (parser_state)) {
|
if (acpi_ps_has_completed_scope(parser_state)) {
|
||||||
acpi_ps_pop_scope (parser_state, &op,
|
acpi_ps_pop_scope(parser_state, &op,
|
||||||
&walk_state->arg_types, &walk_state->arg_count);
|
&walk_state->arg_types,
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
|
&walk_state->arg_count);
|
||||||
}
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
else {
|
"Popped scope, Op=%p\n", op));
|
||||||
|
} else {
|
||||||
op = NULL;
|
op = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* while parser_state->Aml */
|
} /* while parser_state->Aml */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Complete the last Op (if not completed), and clear the scope stack.
|
* Complete the last Op (if not completed), and clear the scope stack.
|
||||||
@@ -721,16 +800,22 @@ close_this_op:
|
|||||||
* of open scopes (such as when several ASL blocks are closed with
|
* of open scopes (such as when several ASL blocks are closed with
|
||||||
* sequential closing braces). We want to terminate each one cleanly.
|
* 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 {
|
do {
|
||||||
if (op) {
|
if (op) {
|
||||||
if (walk_state->ascending_callback != NULL) {
|
if (walk_state->ascending_callback != NULL) {
|
||||||
walk_state->op = 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;
|
walk_state->opcode = op->common.aml_opcode;
|
||||||
|
|
||||||
status = walk_state->ascending_callback (walk_state);
|
status =
|
||||||
status = acpi_ps_next_parse_state (walk_state, op, status);
|
walk_state->ascending_callback(walk_state);
|
||||||
|
status =
|
||||||
|
acpi_ps_next_parse_state(walk_state, op,
|
||||||
|
status);
|
||||||
if (status == AE_CTRL_PENDING) {
|
if (status == AE_CTRL_PENDING) {
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
goto close_this_op;
|
goto close_this_op;
|
||||||
@@ -742,40 +827,48 @@ close_this_op:
|
|||||||
/* Clean up */
|
/* Clean up */
|
||||||
do {
|
do {
|
||||||
if (op) {
|
if (op) {
|
||||||
status2 = acpi_ps_complete_this_op (walk_state, op);
|
status2 =
|
||||||
if (ACPI_FAILURE (status2)) {
|
acpi_ps_complete_this_op
|
||||||
return_ACPI_STATUS (status2);
|
(walk_state, op);
|
||||||
|
if (ACPI_FAILURE
|
||||||
|
(status2)) {
|
||||||
|
return_ACPI_STATUS
|
||||||
|
(status2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ps_pop_scope (parser_state, &op,
|
acpi_ps_pop_scope(parser_state,
|
||||||
&walk_state->arg_types, &walk_state->arg_count);
|
&op,
|
||||||
|
&walk_state->
|
||||||
|
arg_types,
|
||||||
|
&walk_state->
|
||||||
|
arg_count);
|
||||||
|
|
||||||
} while (op);
|
} while (op);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (ACPI_FAILURE (status)) {
|
else if (ACPI_FAILURE(status)) {
|
||||||
/* First error is most important */
|
/* First error is most important */
|
||||||
|
|
||||||
(void) acpi_ps_complete_this_op (walk_state, op);
|
(void)
|
||||||
return_ACPI_STATUS (status);
|
acpi_ps_complete_this_op(walk_state,
|
||||||
|
op);
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
status2 = acpi_ps_complete_this_op (walk_state, op);
|
status2 = acpi_ps_complete_this_op(walk_state, op);
|
||||||
if (ACPI_FAILURE (status2)) {
|
if (ACPI_FAILURE(status2)) {
|
||||||
return_ACPI_STATUS (status2);
|
return_ACPI_STATUS(status2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ps_pop_scope (parser_state, &op, &walk_state->arg_types,
|
acpi_ps_pop_scope(parser_state, &op, &walk_state->arg_types,
|
||||||
&walk_state->arg_count);
|
&walk_state->arg_count);
|
||||||
|
|
||||||
} while (op);
|
} while (op);
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,16 +41,13 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/acopcode.h>
|
#include <acpi/acopcode.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psopcode")
|
ACPI_MODULE_NAME("psopcode")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -62,7 +59,6 @@
|
|||||||
* the operand type.
|
* the operand type.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Summary of opcode types/flags
|
* Summary of opcode types/flags
|
||||||
*
|
*
|
||||||
@@ -180,156 +176,468 @@
|
|||||||
AML_CREATE_QWORD_FIELD_OP
|
AML_CREATE_QWORD_FIELD_OP
|
||||||
|
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Master Opcode information table. A summary of everything we know about each
|
* Master Opcode information table. A summary of everything we know about each
|
||||||
* opcode, all in one place.
|
* opcode, all in one place.
|
||||||
*/
|
*/
|
||||||
const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
|
const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
|
||||||
{
|
|
||||||
/*! [Begin] no source code translation */
|
/*! [Begin] no source code translation */
|
||||||
/* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
|
/* 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),
|
/* 00 */ ACPI_OP("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER,
|
||||||
/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
|
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),
|
/* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER,
|
||||||
/* 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),
|
AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
|
||||||
/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
|
/* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP,
|
||||||
/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
|
ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT,
|
||||||
/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
|
AML_TYPE_NAMED_SIMPLE,
|
||||||
/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
/* 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),
|
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),
|
/* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY,
|
||||||
/* 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),
|
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
/* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
AML_NSNODE | AML_NAMED),
|
||||||
/* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
/* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP,
|
||||||
/* 0E */ ACPI_OP ("Local2", ARGP_LOCAL2, ARGI_LOCAL2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
|
||||||
/* 0F */ ACPI_OP ("Local3", ARGP_LOCAL3, ARGI_LOCAL3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
AML_TYPE_LITERAL, AML_CONSTANT),
|
||||||
/* 10 */ ACPI_OP ("Local4", ARGP_LOCAL4, ARGI_LOCAL4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
/* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP,
|
||||||
/* 11 */ ACPI_OP ("Local5", ARGP_LOCAL5, ARGI_LOCAL5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
|
||||||
/* 12 */ ACPI_OP ("Local6", ARGP_LOCAL6, ARGI_LOCAL6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
AML_TYPE_LITERAL, AML_CONSTANT),
|
||||||
/* 13 */ ACPI_OP ("Local7", ARGP_LOCAL7, ARGI_LOCAL7, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0),
|
/* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP,
|
||||||
/* 14 */ ACPI_OP ("Arg0", ARGP_ARG0, ARGI_ARG0, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
|
||||||
/* 15 */ ACPI_OP ("Arg1", ARGP_ARG1, ARGI_ARG1, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
AML_TYPE_LITERAL, AML_CONSTANT),
|
||||||
/* 16 */ ACPI_OP ("Arg2", ARGP_ARG2, ARGI_ARG2, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
/* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP,
|
||||||
/* 17 */ ACPI_OP ("Arg3", ARGP_ARG3, ARGI_ARG3, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
ACPI_TYPE_STRING, AML_CLASS_ARGUMENT,
|
||||||
/* 18 */ ACPI_OP ("Arg4", ARGP_ARG4, ARGI_ARG4, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
AML_TYPE_LITERAL, AML_CONSTANT),
|
||||||
/* 19 */ ACPI_OP ("Arg5", ARGP_ARG5, ARGI_ARG5, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
/* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
|
||||||
/* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0),
|
ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT,
|
||||||
/* 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),
|
AML_TYPE_NAMED_NO_OBJ,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
/* 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),
|
AML_NSNODE | AML_NAMED),
|
||||||
/* 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),
|
/* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP,
|
||||||
/* 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),
|
ACPI_TYPE_BUFFER, AML_CLASS_CREATE,
|
||||||
/* 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),
|
AML_TYPE_CREATE_OBJECT,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_DEFER | 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),
|
/* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP,
|
||||||
/* 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),
|
ACPI_TYPE_PACKAGE, AML_CLASS_CREATE,
|
||||||
/* 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),
|
AML_TYPE_CREATE_OBJECT,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_DEFER | 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),
|
/* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP,
|
||||||
/* 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),
|
ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT,
|
||||||
/* 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),
|
AML_TYPE_NAMED_COMPLEX,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
/* 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),
|
AML_NSNODE | AML_NAMED | AML_DEFER),
|
||||||
/* 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),
|
/* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0,
|
||||||
/* 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),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 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),
|
/* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1,
|
||||||
/* 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),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 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),
|
/* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2,
|
||||||
/* 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),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 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),
|
/* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3,
|
||||||
/* 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),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 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),
|
/* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4,
|
||||||
/* 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),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 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),
|
/* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5,
|
||||||
/* 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),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 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),
|
/* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6,
|
||||||
/* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
|
/* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7,
|
||||||
/* 41 */ ACPI_OP ("Noop", ARGP_NOOP_OP, ARGI_NOOP_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS),
|
AML_TYPE_LOCAL_VARIABLE, 0),
|
||||||
/* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
|
/* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0,
|
||||||
/* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT),
|
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) */
|
/* 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),
|
/* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX,
|
||||||
/* 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 ),
|
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE |
|
||||||
/* 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),
|
AML_NSNODE | AML_NAMED),
|
||||||
/* 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),
|
/* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT,
|
||||||
/* 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),
|
AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE,
|
||||||
/* 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),
|
AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED),
|
||||||
/* 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),
|
/* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP,
|
||||||
/* 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),
|
ACPI_TYPE_ANY, AML_CLASS_EXECUTE,
|
||||||
/* 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),
|
AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_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),
|
/* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP,
|
||||||
/* 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),
|
ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD,
|
||||||
/* 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),
|
AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
|
||||||
/* 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),
|
AML_DEFER | AML_FIELD | AML_CREATE),
|
||||||
/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
|
/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY,
|
||||||
/* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0),
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R,
|
||||||
/* 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),
|
AML_FLAGS_EXEC_1A_1T_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),
|
/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY,
|
||||||
/* 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),
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
|
||||||
/* 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),
|
AML_FLAGS_EXEC_1A_0T_0R),
|
||||||
/* 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),
|
/* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY,
|
||||||
/* 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),
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
|
||||||
/* 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),
|
AML_FLAGS_EXEC_1A_0T_0R),
|
||||||
/* 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),
|
/* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP,
|
||||||
/* 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),
|
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 */
|
/* 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),
|
/* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP,
|
||||||
/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
|
ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
|
||||||
/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
|
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 ),
|
/* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP,
|
||||||
/* 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),
|
ACPI_TYPE_ANY, AML_CLASS_INTERNAL,
|
||||||
/* 65 */ ACPI_OP ("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0),
|
AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT),
|
||||||
/* 66 */ ACPI_OP ("-ReservedField-", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
|
/* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP,
|
||||||
/* 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 ),
|
ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY,
|
||||||
/* 68 */ ACPI_OP ("-AccessField-", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
|
AML_CLASS_INTERNAL, AML_TYPE_BOGUS,
|
||||||
/* 69 */ ACPI_OP ("-StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, 0),
|
AML_HAS_ARGS | AML_CONSTANT),
|
||||||
/* 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),
|
/* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP,
|
||||||
/* 6B */ ACPI_OP ("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID, AML_CLASS_UNKNOWN, AML_TYPE_BOGUS, AML_HAS_ARGS),
|
ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT,
|
||||||
/* 6C */ ACPI_OP ("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_ASCII, AML_TYPE_BOGUS, AML_HAS_ARGS),
|
AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE),
|
||||||
/* 6D */ ACPI_OP ("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY, AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS),
|
/* 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 */
|
/* 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),
|
/* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP,
|
||||||
/* 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),
|
ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT,
|
||||||
/* 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),
|
AML_TYPE_LITERAL, 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),
|
/* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP,
|
||||||
/* 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),
|
ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE,
|
||||||
/* 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),
|
AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT,
|
||||||
/* 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),
|
AML_HAS_ARGS | AML_DEFER),
|
||||||
/* 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),
|
/* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,
|
||||||
/* 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),
|
ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY,
|
||||||
/* 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),
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
|
||||||
/* 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),
|
AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
|
||||||
/* 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),
|
/* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY,
|
||||||
/* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0),
|
AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R,
|
||||||
/* 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),
|
AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
|
||||||
/* 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),
|
/* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,
|
||||||
/* 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),
|
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 */
|
/* 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 !*/
|
/*! [End] no source code translation !*/
|
||||||
};
|
};
|
||||||
@@ -338,73 +646,70 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] =
|
|||||||
* This table is directly indexed by the opcodes, and returns an
|
* This table is directly indexed by the opcodes, and returns an
|
||||||
* index into the table above
|
* 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 */
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
/* 8 9 A B C D E F */
|
/* 8 9 A B C D E F */
|
||||||
/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
|
/* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
|
||||||
/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
|
/* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
|
||||||
/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
|
/* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
|
||||||
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
|
/* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
|
||||||
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
|
/* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
|
||||||
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
|
/* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
|
||||||
/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
|
/* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
|
||||||
/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
|
/* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
|
||||||
/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
|
/* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
|
||||||
/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
|
/* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
|
||||||
/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
|
/* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
|
||||||
/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
|
/* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
|
||||||
/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
|
/* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
|
||||||
/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
|
/* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
|
||||||
/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
|
/* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
|
||||||
/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
|
/* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
|
||||||
/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
|
/* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
|
||||||
/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
|
/* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
|
||||||
/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
|
/* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
|
||||||
/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
|
/* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This table is indexed by the second opcode of the extended opcode
|
* 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)
|
* 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 */
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
/* 8 9 A B C D E F */
|
/* 8 9 A B C D E F */
|
||||||
/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
|
/* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
|
/* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
|
||||||
/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
|
/* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
|
||||||
/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
|
/* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
/* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
|
||||||
/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
/* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||||
/* 0x88 */ 0x7C,
|
/* 0x88 */ 0x7C,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_opcode_info
|
* FUNCTION: acpi_ps_get_opcode_info
|
||||||
@@ -418,12 +723,9 @@ static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] =
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
const struct acpi_opcode_info *
|
const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode)
|
||||||
acpi_ps_get_opcode_info (
|
|
||||||
u16 opcode)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_NAME ("ps_get_opcode_info");
|
ACPI_FUNCTION_NAME("ps_get_opcode_info");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Detect normal 8-bit opcode or extended 16-bit opcode
|
* Detect normal 8-bit opcode or extended 16-bit opcode
|
||||||
@@ -431,25 +733,26 @@ acpi_ps_get_opcode_info (
|
|||||||
if (!(opcode & 0xFF00)) {
|
if (!(opcode & 0xFF00)) {
|
||||||
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
|
/* 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) &&
|
if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
|
||||||
(((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
|
(((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
|
||||||
/* Valid extended (16-bit) 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 */
|
/* Unknown AML opcode */
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unknown AML opcode [%4.4X]\n", opcode));
|
"Unknown AML opcode [%4.4X]\n", opcode));
|
||||||
|
|
||||||
return (&acpi_gbl_aml_op_info [_UNK]);
|
return (&acpi_gbl_aml_op_info[_UNK]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_opcode_name
|
* FUNCTION: acpi_ps_get_opcode_name
|
||||||
@@ -463,16 +766,13 @@ acpi_ps_get_opcode_info (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
char *
|
char *acpi_ps_get_opcode_name(u16 opcode)
|
||||||
acpi_ps_get_opcode_name (
|
|
||||||
u16 opcode)
|
|
||||||
{
|
{
|
||||||
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
|
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
|
||||||
|
|
||||||
const struct acpi_opcode_info *op;
|
const struct acpi_opcode_info *op;
|
||||||
|
|
||||||
|
op = acpi_ps_get_opcode_info(opcode);
|
||||||
op = acpi_ps_get_opcode_info (opcode);
|
|
||||||
|
|
||||||
/* Always guaranteed to return a valid pointer */
|
/* Always guaranteed to return a valid pointer */
|
||||||
|
|
||||||
@@ -483,4 +783,3 @@ acpi_ps_get_opcode_name (
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,6 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the AML and build an operation tree as most interpreters,
|
* Parse the AML and build an operation tree as most interpreters,
|
||||||
* like Perl, do. Parsing is done by hand rather than with a YACC
|
* like Perl, do. Parsing is done by hand rather than with a YACC
|
||||||
@@ -59,8 +58,7 @@
|
|||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psparse")
|
ACPI_MODULE_NAME("psparse")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -73,10 +71,7 @@
|
|||||||
* DESCRIPTION: Get the size of the current opcode.
|
* 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 */
|
/* Extended (2-byte) opcode if > 255 */
|
||||||
@@ -90,7 +85,6 @@ acpi_ps_get_opcode_size (
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_peek_opcode
|
* FUNCTION: acpi_ps_peek_opcode
|
||||||
@@ -103,28 +97,24 @@ acpi_ps_get_opcode_size (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u16
|
u16 acpi_ps_peek_opcode(struct acpi_parse_state * parser_state)
|
||||||
acpi_ps_peek_opcode (
|
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
u8 *aml;
|
u8 *aml;
|
||||||
u16 opcode;
|
u16 opcode;
|
||||||
|
|
||||||
|
|
||||||
aml = parser_state->aml;
|
aml = parser_state->aml;
|
||||||
opcode = (u16) ACPI_GET8 (aml);
|
opcode = (u16) ACPI_GET8(aml);
|
||||||
|
|
||||||
if (opcode == AML_EXTENDED_OP_PREFIX) {
|
if (opcode == AML_EXTENDED_OP_PREFIX) {
|
||||||
/* Extended opcode, get the second opcode byte */
|
/* Extended opcode, get the second opcode byte */
|
||||||
|
|
||||||
aml++;
|
aml++;
|
||||||
opcode = (u16) ((opcode << 8) | ACPI_GET8 (aml));
|
opcode = (u16) ((opcode << 8) | ACPI_GET8(aml));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (opcode);
|
return (opcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_complete_this_op
|
* FUNCTION: acpi_ps_complete_this_op
|
||||||
@@ -139,30 +129,28 @@ acpi_ps_peek_opcode (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_complete_this_op (
|
acpi_ps_complete_this_op(struct acpi_walk_state * walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object * op)
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *prev;
|
union acpi_parse_object *prev;
|
||||||
union acpi_parse_object *next;
|
union acpi_parse_object *next;
|
||||||
const struct acpi_opcode_info *parent_info;
|
const struct acpi_opcode_info *parent_info;
|
||||||
union acpi_parse_object *replacement_op = NULL;
|
union acpi_parse_object *replacement_op = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_complete_this_op", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_complete_this_op", op);
|
||||||
|
|
||||||
/* Check for null Op, can happen if AML code is corrupt */
|
/* Check for null Op, can happen if AML code is corrupt */
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return_ACPI_STATUS (AE_OK); /* OK for now */
|
return_ACPI_STATUS(AE_OK); /* OK for now */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delete this op and the subtree below it if asked to */
|
/* Delete this op and the subtree below it if asked to */
|
||||||
|
|
||||||
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
|
if (((walk_state->parse_flags & ACPI_PARSE_TREE_MASK) !=
|
||||||
(walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
|
ACPI_PARSE_DELETE_TREE)
|
||||||
return_ACPI_STATUS (AE_OK);
|
|| (walk_state->op_info->class == AML_CLASS_ARGUMENT)) {
|
||||||
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that we only delete this subtree */
|
/* Make sure that we only delete this subtree */
|
||||||
@@ -179,7 +167,9 @@ acpi_ps_complete_this_op (
|
|||||||
* Check if we need to replace the operator and its subtree
|
* Check if we need to replace the operator and its subtree
|
||||||
* with a return value op (placeholder op)
|
* 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) {
|
switch (parent_info->class) {
|
||||||
case AML_CLASS_CONTROL:
|
case AML_CLASS_CONTROL:
|
||||||
@@ -191,7 +181,8 @@ acpi_ps_complete_this_op (
|
|||||||
* These opcodes contain term_arg operands. The current
|
* These opcodes contain term_arg operands. The current
|
||||||
* op must be replaced by a placeholder return op
|
* 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) {
|
if (!replacement_op) {
|
||||||
goto allocate_error;
|
goto allocate_error;
|
||||||
}
|
}
|
||||||
@@ -203,35 +194,49 @@ acpi_ps_complete_this_op (
|
|||||||
* These opcodes contain term_arg operands. The current
|
* These opcodes contain term_arg operands. The current
|
||||||
* op must be replaced by a placeholder return op
|
* op must be replaced by a placeholder return op
|
||||||
*/
|
*/
|
||||||
if ((op->common.parent->common.aml_opcode == AML_REGION_OP) ||
|
if ((op->common.parent->common.aml_opcode ==
|
||||||
(op->common.parent->common.aml_opcode == AML_DATA_REGION_OP) ||
|
AML_REGION_OP)
|
||||||
(op->common.parent->common.aml_opcode == AML_BUFFER_OP) ||
|
|| (op->common.parent->common.aml_opcode ==
|
||||||
(op->common.parent->common.aml_opcode == AML_PACKAGE_OP) ||
|
AML_DATA_REGION_OP)
|
||||||
(op->common.parent->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
|
|| (op->common.parent->common.aml_opcode ==
|
||||||
replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
|
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) {
|
if (!replacement_op) {
|
||||||
goto allocate_error;
|
goto allocate_error;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else if ((op->common.parent->common.aml_opcode == AML_NAME_OP) &&
|
if ((op->common.parent->common.aml_opcode ==
|
||||||
(walk_state->pass_number <= ACPI_IMODE_LOAD_PASS2)) {
|
AML_NAME_OP)
|
||||||
if ((op->common.aml_opcode == AML_BUFFER_OP) ||
|
&& (walk_state->pass_number <=
|
||||||
(op->common.aml_opcode == AML_PACKAGE_OP) ||
|
ACPI_IMODE_LOAD_PASS2)) {
|
||||||
(op->common.aml_opcode == AML_VAR_PACKAGE_OP)) {
|
if ((op->common.aml_opcode == AML_BUFFER_OP)
|
||||||
replacement_op = acpi_ps_alloc_op (op->common.aml_opcode);
|
|| (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) {
|
if (!replacement_op) {
|
||||||
goto allocate_error;
|
goto allocate_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
replacement_op->named.data = op->named.data;
|
replacement_op->named.data =
|
||||||
replacement_op->named.length = op->named.length;
|
op->named.data;
|
||||||
|
replacement_op->named.length =
|
||||||
|
op->named.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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) {
|
if (!replacement_op) {
|
||||||
goto allocate_error;
|
goto allocate_error;
|
||||||
}
|
}
|
||||||
@@ -243,59 +248,64 @@ acpi_ps_complete_this_op (
|
|||||||
/* This op is the first in the list */
|
/* This op is the first in the list */
|
||||||
|
|
||||||
if (replacement_op) {
|
if (replacement_op) {
|
||||||
replacement_op->common.parent = op->common.parent;
|
replacement_op->common.parent =
|
||||||
replacement_op->common.value.arg = NULL;
|
op->common.parent;
|
||||||
replacement_op->common.node = op->common.node;
|
replacement_op->common.value.arg = NULL;
|
||||||
op->common.parent->common.value.arg = replacement_op;
|
replacement_op->common.node = op->common.node;
|
||||||
replacement_op->common.next = op->common.next;
|
op->common.parent->common.value.arg =
|
||||||
}
|
replacement_op;
|
||||||
else {
|
replacement_op->common.next = op->common.next;
|
||||||
op->common.parent->common.value.arg = op->common.next;
|
} else {
|
||||||
|
op->common.parent->common.value.arg =
|
||||||
|
op->common.next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search the parent list */
|
/* Search the parent list */
|
||||||
|
|
||||||
else while (prev) {
|
else
|
||||||
/* Traverse all siblings in the parent's argument list */
|
while (prev) {
|
||||||
|
/* Traverse all siblings in the parent's argument list */
|
||||||
|
|
||||||
next = prev->common.next;
|
next = prev->common.next;
|
||||||
if (next == op) {
|
if (next == op) {
|
||||||
if (replacement_op) {
|
if (replacement_op) {
|
||||||
replacement_op->common.parent = op->common.parent;
|
replacement_op->common.parent =
|
||||||
replacement_op->common.value.arg = NULL;
|
op->common.parent;
|
||||||
replacement_op->common.node = op->common.node;
|
replacement_op->common.value.
|
||||||
prev->common.next = replacement_op;
|
arg = NULL;
|
||||||
replacement_op->common.next = op->common.next;
|
replacement_op->common.node =
|
||||||
next = NULL;
|
op->common.node;
|
||||||
}
|
prev->common.next =
|
||||||
else {
|
replacement_op;
|
||||||
prev->common.next = op->common.next;
|
replacement_op->common.next =
|
||||||
next = NULL;
|
op->common.next;
|
||||||
|
next = NULL;
|
||||||
|
} else {
|
||||||
|
prev->common.next =
|
||||||
|
op->common.next;
|
||||||
|
next = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
prev = next;
|
||||||
}
|
}
|
||||||
prev = next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
|
|
||||||
/* Now we can actually delete the subtree rooted at Op */
|
/* Now we can actually delete the subtree rooted at Op */
|
||||||
|
|
||||||
acpi_ps_delete_parse_tree (op);
|
acpi_ps_delete_parse_tree(op);
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
|
|
||||||
|
allocate_error:
|
||||||
allocate_error:
|
|
||||||
|
|
||||||
/* Always delete the subtree, even on error */
|
/* Always delete the subtree, even on error */
|
||||||
|
|
||||||
acpi_ps_delete_parse_tree (op);
|
acpi_ps_delete_parse_tree(op);
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_next_parse_state
|
* FUNCTION: acpi_ps_next_parse_state
|
||||||
@@ -312,17 +322,14 @@ allocate_error:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_next_parse_state (
|
acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
|
||||||
struct acpi_walk_state *walk_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
acpi_status callback_status)
|
||||||
acpi_status callback_status)
|
|
||||||
{
|
{
|
||||||
struct acpi_parse_state *parser_state = &walk_state->parser_state;
|
struct acpi_parse_state *parser_state = &walk_state->parser_state;
|
||||||
acpi_status status = AE_CTRL_PENDING;
|
acpi_status status = AE_CTRL_PENDING;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_next_parse_state", op);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_next_parse_state", op);
|
||||||
|
|
||||||
switch (callback_status) {
|
switch (callback_status) {
|
||||||
case AE_CTRL_TERMINATE:
|
case AE_CTRL_TERMINATE:
|
||||||
@@ -335,7 +342,6 @@ acpi_ps_next_parse_state (
|
|||||||
status = AE_CTRL_TERMINATE;
|
status = AE_CTRL_TERMINATE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_BREAK:
|
case AE_CTRL_BREAK:
|
||||||
|
|
||||||
parser_state->aml = walk_state->aml_last_while;
|
parser_state->aml = walk_state->aml_last_while;
|
||||||
@@ -345,7 +351,6 @@ acpi_ps_next_parse_state (
|
|||||||
|
|
||||||
case AE_CTRL_CONTINUE:
|
case AE_CTRL_CONTINUE:
|
||||||
|
|
||||||
|
|
||||||
parser_state->aml = walk_state->aml_last_while;
|
parser_state->aml = walk_state->aml_last_while;
|
||||||
status = AE_CTRL_CONTINUE;
|
status = AE_CTRL_CONTINUE;
|
||||||
break;
|
break;
|
||||||
@@ -369,10 +374,9 @@ acpi_ps_next_parse_state (
|
|||||||
* Predicate of an IF was true, and we are at the matching ELSE.
|
* Predicate of an IF was true, and we are at the matching ELSE.
|
||||||
* Just close out this package
|
* Just close out this package
|
||||||
*/
|
*/
|
||||||
parser_state->aml = acpi_ps_get_next_package_end (parser_state);
|
parser_state->aml = acpi_ps_get_next_package_end(parser_state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_FALSE:
|
case AE_CTRL_FALSE:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -390,7 +394,6 @@ acpi_ps_next_parse_state (
|
|||||||
status = AE_CTRL_END;
|
status = AE_CTRL_END;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AE_CTRL_TRANSFER:
|
case AE_CTRL_TRANSFER:
|
||||||
|
|
||||||
/* A method call (invocation) -- transfer control */
|
/* A method call (invocation) -- transfer control */
|
||||||
@@ -398,14 +401,15 @@ acpi_ps_next_parse_state (
|
|||||||
status = AE_CTRL_TRANSFER;
|
status = AE_CTRL_TRANSFER;
|
||||||
walk_state->prev_op = op;
|
walk_state->prev_op = op;
|
||||||
walk_state->method_call_op = op;
|
walk_state->method_call_op = op;
|
||||||
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? */
|
/* 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;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
||||||
status = callback_status;
|
status = callback_status;
|
||||||
@@ -415,10 +419,9 @@ acpi_ps_next_parse_state (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_parse_aml
|
* FUNCTION: acpi_ps_parse_aml
|
||||||
@@ -432,34 +435,30 @@ acpi_ps_next_parse_state (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state)
|
||||||
acpi_ps_parse_aml (
|
|
||||||
struct acpi_walk_state *walk_state)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
acpi_status terminate_status;
|
acpi_status terminate_status;
|
||||||
struct acpi_thread_state *thread;
|
struct acpi_thread_state *thread;
|
||||||
struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
|
struct acpi_thread_state *prev_walk_list = acpi_gbl_current_walk_list;
|
||||||
struct acpi_walk_state *previous_walk_state;
|
struct acpi_walk_state *previous_walk_state;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_parse_aml");
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_parse_aml");
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
|
"Entered with walk_state=%p Aml=%p size=%X\n",
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
walk_state, walk_state->parser_state.aml,
|
||||||
"Entered with walk_state=%p Aml=%p size=%X\n",
|
walk_state->parser_state.aml_size));
|
||||||
walk_state, walk_state->parser_state.aml,
|
|
||||||
walk_state->parser_state.aml_size));
|
|
||||||
|
|
||||||
|
|
||||||
/* Create and initialize a new thread state */
|
/* Create and initialize a new thread state */
|
||||||
|
|
||||||
thread = acpi_ut_create_thread_state ();
|
thread = acpi_ut_create_thread_state();
|
||||||
if (!thread) {
|
if (!thread) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
walk_state->thread = thread;
|
walk_state->thread = thread;
|
||||||
acpi_ds_push_walk_state (walk_state, thread);
|
acpi_ds_push_walk_state(walk_state, thread);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This global allows the AML debugger to get a handle to the currently
|
* This global allows the AML debugger to get a handle to the currently
|
||||||
@@ -471,54 +470,56 @@ acpi_ps_parse_aml (
|
|||||||
* Execute the walk loop as long as there is a valid Walk State. This
|
* Execute the walk loop as long as there is a valid Walk State. This
|
||||||
* handles nested control method invocations without recursion.
|
* handles nested control method invocations without recursion.
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", walk_state));
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "State=%p\n", walk_state));
|
||||||
|
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
while (walk_state) {
|
while (walk_state) {
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/*
|
/*
|
||||||
* The parse_loop executes AML until the method terminates
|
* The parse_loop executes AML until the method terminates
|
||||||
* or calls another method.
|
* or calls another method.
|
||||||
*/
|
*/
|
||||||
status = acpi_ps_parse_loop (walk_state);
|
status = acpi_ps_parse_loop(walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"Completed one call to walk loop, %s State=%p\n",
|
"Completed one call to walk loop, %s State=%p\n",
|
||||||
acpi_format_exception (status), walk_state));
|
acpi_format_exception(status), walk_state));
|
||||||
|
|
||||||
if (status == AE_CTRL_TRANSFER) {
|
if (status == AE_CTRL_TRANSFER) {
|
||||||
/*
|
/*
|
||||||
* A method call was detected.
|
* A method call was detected.
|
||||||
* Transfer control to the called control method
|
* 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
|
* If the transfer to the new method method call worked, a new walk
|
||||||
* state was created -- get it
|
* state was created -- get it
|
||||||
*/
|
*/
|
||||||
walk_state = acpi_ds_get_current_walk_state (thread);
|
walk_state = acpi_ds_get_current_walk_state(thread);
|
||||||
continue;
|
continue;
|
||||||
}
|
} else if (status == AE_CTRL_TERMINATE) {
|
||||||
else if (status == AE_CTRL_TERMINATE) {
|
|
||||||
status = AE_OK;
|
status = AE_OK;
|
||||||
}
|
} else if ((status != AE_OK) && (walk_state->method_desc)) {
|
||||||
else if ((status != AE_OK) && (walk_state->method_desc)) {
|
ACPI_REPORT_METHOD_ERROR("Method execution failed",
|
||||||
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
|
walk_state->method_node, NULL,
|
||||||
walk_state->method_node, NULL, status);
|
status);
|
||||||
|
|
||||||
/* Check for possible multi-thread reentrancy problem */
|
/* Check for possible multi-thread reentrancy problem */
|
||||||
|
|
||||||
if ((status == AE_ALREADY_EXISTS) &&
|
if ((status == AE_ALREADY_EXISTS) &&
|
||||||
(!walk_state->method_desc->method.semaphore)) {
|
(!walk_state->method_desc->method.semaphore)) {
|
||||||
/*
|
/*
|
||||||
* This method is marked not_serialized, but it tried to create
|
* This method is marked not_serialized, but it tried to create
|
||||||
* a named object, causing the second thread entrance to fail.
|
* a named object, causing the second thread entrance to fail.
|
||||||
* We will workaround this by marking the method permanently
|
* We will workaround this by marking the method permanently
|
||||||
* as Serialized.
|
* as Serialized.
|
||||||
*/
|
*/
|
||||||
walk_state->method_desc->method.method_flags |= AML_METHOD_SERIALIZED;
|
walk_state->method_desc->method.method_flags |=
|
||||||
|
AML_METHOD_SERIALIZED;
|
||||||
walk_state->method_desc->method.concurrency = 1;
|
walk_state->method_desc->method.concurrency = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -533,21 +534,22 @@ acpi_ps_parse_aml (
|
|||||||
|
|
||||||
/* We are done with this walk, move on to the parent if any */
|
/* We are done with this walk, move on to the parent if any */
|
||||||
|
|
||||||
walk_state = acpi_ds_pop_walk_state (thread);
|
walk_state = acpi_ds_pop_walk_state(thread);
|
||||||
|
|
||||||
/* Reset the current scope to the beginning of scope stack */
|
/* Reset the current scope to the beginning of scope stack */
|
||||||
|
|
||||||
acpi_ds_scope_stack_clear (walk_state);
|
acpi_ds_scope_stack_clear(walk_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we just returned from the execution of a control method,
|
* If we just returned from the execution of a control method,
|
||||||
* there's lots of cleanup to do
|
* there's lots of cleanup to do
|
||||||
*/
|
*/
|
||||||
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
|
if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) ==
|
||||||
terminate_status = acpi_ds_terminate_control_method (walk_state);
|
ACPI_PARSE_EXECUTE) {
|
||||||
if (ACPI_FAILURE (terminate_status)) {
|
terminate_status =
|
||||||
ACPI_REPORT_ERROR ((
|
acpi_ds_terminate_control_method(walk_state);
|
||||||
"Could not terminate control method properly\n"));
|
if (ACPI_FAILURE(terminate_status)) {
|
||||||
|
ACPI_REPORT_ERROR(("Could not terminate control method properly\n"));
|
||||||
|
|
||||||
/* Ignore error and continue */
|
/* Ignore error and continue */
|
||||||
}
|
}
|
||||||
@@ -555,46 +557,53 @@ acpi_ps_parse_aml (
|
|||||||
|
|
||||||
/* Delete this walk state and all linked control states */
|
/* Delete this walk state and all linked control states */
|
||||||
|
|
||||||
acpi_ps_cleanup_scope (&walk_state->parser_state);
|
acpi_ps_cleanup_scope(&walk_state->parser_state);
|
||||||
|
|
||||||
previous_walk_state = walk_state;
|
previous_walk_state = walk_state;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"return_value=%p, implicit_value=%p State=%p\n",
|
"return_value=%p, implicit_value=%p State=%p\n",
|
||||||
walk_state->return_desc, walk_state->implicit_return_obj, walk_state));
|
walk_state->return_desc,
|
||||||
|
walk_state->implicit_return_obj, walk_state));
|
||||||
|
|
||||||
/* Check if we have restarted a preempted walk */
|
/* Check if we have restarted a preempted walk */
|
||||||
|
|
||||||
walk_state = acpi_ds_get_current_walk_state (thread);
|
walk_state = acpi_ds_get_current_walk_state(thread);
|
||||||
if (walk_state) {
|
if (walk_state) {
|
||||||
if (ACPI_SUCCESS (status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
/*
|
/*
|
||||||
* There is another walk state, restart it.
|
* There is another walk state, restart it.
|
||||||
* If the method return value is not used by the parent,
|
* If the method return value is not used by the parent,
|
||||||
* The object is deleted
|
* The object is deleted
|
||||||
*/
|
*/
|
||||||
if (!previous_walk_state->return_desc) {
|
if (!previous_walk_state->return_desc) {
|
||||||
status = acpi_ds_restart_control_method (walk_state,
|
status =
|
||||||
previous_walk_state->implicit_return_obj);
|
acpi_ds_restart_control_method
|
||||||
}
|
(walk_state,
|
||||||
else {
|
previous_walk_state->
|
||||||
|
implicit_return_obj);
|
||||||
|
} else {
|
||||||
/*
|
/*
|
||||||
* We have a valid return value, delete any implicit
|
* We have a valid return value, delete any implicit
|
||||||
* return value.
|
* 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 =
|
||||||
previous_walk_state->return_desc);
|
acpi_ds_restart_control_method
|
||||||
|
(walk_state,
|
||||||
|
previous_walk_state->return_desc);
|
||||||
}
|
}
|
||||||
if (ACPI_SUCCESS (status)) {
|
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 */
|
/* On error, delete any return object */
|
||||||
|
|
||||||
acpi_ut_remove_reference (previous_walk_state->return_desc);
|
acpi_ut_remove_reference(previous_walk_state->
|
||||||
|
return_desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,37 +614,36 @@ acpi_ps_parse_aml (
|
|||||||
else if (previous_walk_state->caller_return_desc) {
|
else if (previous_walk_state->caller_return_desc) {
|
||||||
if (previous_walk_state->implicit_return_obj) {
|
if (previous_walk_state->implicit_return_obj) {
|
||||||
*(previous_walk_state->caller_return_desc) =
|
*(previous_walk_state->caller_return_desc) =
|
||||||
previous_walk_state->implicit_return_obj;
|
previous_walk_state->implicit_return_obj;
|
||||||
}
|
} else {
|
||||||
else {
|
/* NULL if no return value */
|
||||||
/* NULL if no return value */
|
|
||||||
|
|
||||||
*(previous_walk_state->caller_return_desc) =
|
*(previous_walk_state->caller_return_desc) =
|
||||||
previous_walk_state->return_desc;
|
previous_walk_state->return_desc;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (previous_walk_state->return_desc) {
|
if (previous_walk_state->return_desc) {
|
||||||
/* Caller doesn't want it, must delete it */
|
/* 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) {
|
if (previous_walk_state->implicit_return_obj) {
|
||||||
/* Caller doesn't want it, must delete it */
|
/* 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acpi_ds_delete_walk_state (previous_walk_state);
|
acpi_ds_delete_walk_state(previous_walk_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normal exit */
|
/* Normal exit */
|
||||||
|
|
||||||
acpi_ex_release_all_mutexes (thread);
|
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;
|
acpi_gbl_current_walk_list = prev_walk_list;
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psscope")
|
ACPI_MODULE_NAME("psscope")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -60,16 +58,13 @@
|
|||||||
* DESCRIPTION: Get parent of current op being parsed
|
* DESCRIPTION: Get parent of current op being parsed
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
|
||||||
union acpi_parse_object *
|
*parser_state)
|
||||||
acpi_ps_get_parent_scope (
|
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return (parser_state->scope->parse_scope.op);
|
return (parser_state->scope->parse_scope.op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_has_completed_scope
|
* FUNCTION: acpi_ps_has_completed_scope
|
||||||
@@ -84,17 +79,14 @@ acpi_ps_get_parent_scope (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
u8
|
u8 acpi_ps_has_completed_scope(struct acpi_parse_state * parser_state)
|
||||||
acpi_ps_has_completed_scope (
|
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
return ((u8)
|
return ((u8)
|
||||||
((parser_state->aml >= parser_state->scope->parse_scope.arg_end ||
|
((parser_state->aml >= parser_state->scope->parse_scope.arg_end
|
||||||
!parser_state->scope->parse_scope.arg_count)));
|
|| !parser_state->scope->parse_scope.arg_count)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_init_scope
|
* FUNCTION: acpi_ps_init_scope
|
||||||
@@ -109,34 +101,30 @@ acpi_ps_has_completed_scope (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_init_scope (
|
acpi_ps_init_scope(struct acpi_parse_state * parser_state,
|
||||||
struct acpi_parse_state *parser_state,
|
union acpi_parse_object * root_op)
|
||||||
union acpi_parse_object *root_op)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *scope;
|
union acpi_generic_state *scope;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_init_scope", root_op);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_init_scope", root_op);
|
scope = acpi_ut_create_generic_state();
|
||||||
|
|
||||||
|
|
||||||
scope = acpi_ut_create_generic_state ();
|
|
||||||
if (!scope) {
|
if (!scope) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
|
scope->common.data_type = ACPI_DESC_TYPE_STATE_RPSCOPE;
|
||||||
scope->parse_scope.op = root_op;
|
scope->parse_scope.op = root_op;
|
||||||
scope->parse_scope.arg_count = ACPI_VAR_ARGS;
|
scope->parse_scope.arg_count = ACPI_VAR_ARGS;
|
||||||
scope->parse_scope.arg_end = parser_state->aml_end;
|
scope->parse_scope.arg_end = parser_state->aml_end;
|
||||||
scope->parse_scope.pkg_end = parser_state->aml_end;
|
scope->parse_scope.pkg_end = parser_state->aml_end;
|
||||||
|
|
||||||
parser_state->scope = scope;
|
parser_state->scope = scope;
|
||||||
parser_state->start_op = root_op;
|
parser_state->start_op = root_op;
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_push_scope
|
* FUNCTION: acpi_ps_push_scope
|
||||||
@@ -153,48 +141,42 @@ acpi_ps_init_scope (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status
|
||||||
acpi_ps_push_scope (
|
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
|
||||||
struct acpi_parse_state *parser_state,
|
union acpi_parse_object *op,
|
||||||
union acpi_parse_object *op,
|
u32 remaining_args, u32 arg_count)
|
||||||
u32 remaining_args,
|
|
||||||
u32 arg_count)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *scope;
|
union acpi_generic_state *scope;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_push_scope", op);
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_push_scope", op);
|
scope = acpi_ut_create_generic_state();
|
||||||
|
|
||||||
|
|
||||||
scope = acpi_ut_create_generic_state ();
|
|
||||||
if (!scope) {
|
if (!scope) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
|
scope->common.data_type = ACPI_DESC_TYPE_STATE_PSCOPE;
|
||||||
scope->parse_scope.op = op;
|
scope->parse_scope.op = op;
|
||||||
scope->parse_scope.arg_list = remaining_args;
|
scope->parse_scope.arg_list = remaining_args;
|
||||||
scope->parse_scope.arg_count = arg_count;
|
scope->parse_scope.arg_count = arg_count;
|
||||||
scope->parse_scope.pkg_end = parser_state->pkg_end;
|
scope->parse_scope.pkg_end = parser_state->pkg_end;
|
||||||
|
|
||||||
/* Push onto scope stack */
|
/* Push onto scope stack */
|
||||||
|
|
||||||
acpi_ut_push_generic_state (&parser_state->scope, scope);
|
acpi_ut_push_generic_state(&parser_state->scope, scope);
|
||||||
|
|
||||||
if (arg_count == ACPI_VAR_ARGS) {
|
if (arg_count == ACPI_VAR_ARGS) {
|
||||||
/* Multiple arguments */
|
/* Multiple arguments */
|
||||||
|
|
||||||
scope->parse_scope.arg_end = parser_state->pkg_end;
|
scope->parse_scope.arg_end = parser_state->pkg_end;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Single argument */
|
/* Single argument */
|
||||||
|
|
||||||
scope->parse_scope.arg_end = ACPI_TO_POINTER (ACPI_MAX_PTR);
|
scope->parse_scope.arg_end = ACPI_TO_POINTER(ACPI_MAX_PTR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_pop_scope
|
* FUNCTION: acpi_ps_pop_scope
|
||||||
@@ -212,48 +194,41 @@ acpi_ps_push_scope (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ps_pop_scope (
|
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
|
||||||
struct acpi_parse_state *parser_state,
|
union acpi_parse_object **op, u32 * arg_list, u32 * arg_count)
|
||||||
union acpi_parse_object **op,
|
|
||||||
u32 *arg_list,
|
|
||||||
u32 *arg_count)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *scope = parser_state->scope;
|
union acpi_generic_state *scope = parser_state->scope;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_pop_scope");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_pop_scope");
|
||||||
|
|
||||||
/* Only pop the scope if there is in fact a next scope */
|
/* Only pop the scope if there is in fact a next scope */
|
||||||
|
|
||||||
if (scope->common.next) {
|
if (scope->common.next) {
|
||||||
scope = acpi_ut_pop_generic_state (&parser_state->scope);
|
scope = acpi_ut_pop_generic_state(&parser_state->scope);
|
||||||
|
|
||||||
/* return to parsing previous op */
|
/* return to parsing previous op */
|
||||||
|
|
||||||
*op = scope->parse_scope.op;
|
*op = scope->parse_scope.op;
|
||||||
*arg_list = scope->parse_scope.arg_list;
|
*arg_list = scope->parse_scope.arg_list;
|
||||||
*arg_count = scope->parse_scope.arg_count;
|
*arg_count = scope->parse_scope.arg_count;
|
||||||
parser_state->pkg_end = scope->parse_scope.pkg_end;
|
parser_state->pkg_end = scope->parse_scope.pkg_end;
|
||||||
|
|
||||||
/* All done with this scope state structure */
|
/* All done with this scope state structure */
|
||||||
|
|
||||||
acpi_ut_delete_generic_state (scope);
|
acpi_ut_delete_generic_state(scope);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* empty parse stack, prepare to fetch next opcode */
|
/* empty parse stack, prepare to fetch next opcode */
|
||||||
|
|
||||||
*op = NULL;
|
*op = NULL;
|
||||||
*arg_list = 0;
|
*arg_list = 0;
|
||||||
*arg_count = 0;
|
*arg_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"Popped Op %p Args %X\n", *op, *arg_count));
|
"Popped Op %p Args %X\n", *op, *arg_count));
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_cleanup_scope
|
* FUNCTION: acpi_ps_cleanup_scope
|
||||||
@@ -267,15 +242,11 @@ acpi_ps_pop_scope (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ps_cleanup_scope(struct acpi_parse_state *parser_state)
|
||||||
acpi_ps_cleanup_scope (
|
|
||||||
struct acpi_parse_state *parser_state)
|
|
||||||
{
|
{
|
||||||
union acpi_generic_state *scope;
|
union acpi_generic_state *scope;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_cleanup_scope", parser_state);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_cleanup_scope", parser_state);
|
||||||
|
|
||||||
if (!parser_state) {
|
if (!parser_state) {
|
||||||
return_VOID;
|
return_VOID;
|
||||||
@@ -284,10 +255,9 @@ acpi_ps_cleanup_scope (
|
|||||||
/* Delete anything on the scope stack */
|
/* Delete anything on the scope stack */
|
||||||
|
|
||||||
while (parser_state->scope) {
|
while (parser_state->scope) {
|
||||||
scope = acpi_ut_pop_generic_state (&parser_state->scope);
|
scope = acpi_ut_pop_generic_state(&parser_state->scope);
|
||||||
acpi_ut_delete_generic_state (scope);
|
acpi_ut_delete_generic_state(scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,23 +41,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("pstree")
|
ACPI_MODULE_NAME("pstree")
|
||||||
|
|
||||||
/* Local prototypes */
|
/* Local prototypes */
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
union acpi_parse_object *
|
union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op);
|
||||||
acpi_ps_get_child (
|
|
||||||
union acpi_parse_object *op);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_get_arg
|
* FUNCTION: acpi_ps_get_arg
|
||||||
@@ -71,21 +66,16 @@ acpi_ps_get_child (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
union acpi_parse_object *
|
union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn)
|
||||||
acpi_ps_get_arg (
|
|
||||||
union acpi_parse_object *op,
|
|
||||||
u32 argn)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *arg = NULL;
|
union acpi_parse_object *arg = NULL;
|
||||||
const struct acpi_opcode_info *op_info;
|
const struct acpi_opcode_info *op_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
/* Get the info structure for this opcode */
|
/* Get the info structure for this opcode */
|
||||||
|
|
||||||
op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
|
op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
|
||||||
if (op_info->class == AML_CLASS_UNKNOWN) {
|
if (op_info->class == AML_CLASS_UNKNOWN) {
|
||||||
/* Invalid opcode or ASCII character */
|
/* Invalid opcode or ASCII character */
|
||||||
|
|
||||||
@@ -111,7 +101,6 @@ acpi_ps_get_arg (
|
|||||||
return (arg);
|
return (arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_append_arg
|
* FUNCTION: acpi_ps_append_arg
|
||||||
@@ -126,16 +115,12 @@ acpi_ps_get_arg (
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_ps_append_arg (
|
acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg)
|
||||||
union acpi_parse_object *op,
|
|
||||||
union acpi_parse_object *arg)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *prev_arg;
|
union acpi_parse_object *prev_arg;
|
||||||
const struct acpi_opcode_info *op_info;
|
const struct acpi_opcode_info *op_info;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return;
|
return;
|
||||||
@@ -143,12 +128,11 @@ acpi_ps_append_arg (
|
|||||||
|
|
||||||
/* Get the info structure for this opcode */
|
/* Get the info structure for this opcode */
|
||||||
|
|
||||||
op_info = acpi_ps_get_opcode_info (op->common.aml_opcode);
|
op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
|
||||||
if (op_info->class == AML_CLASS_UNKNOWN) {
|
if (op_info->class == AML_CLASS_UNKNOWN) {
|
||||||
/* Invalid opcode */
|
/* Invalid opcode */
|
||||||
|
|
||||||
ACPI_REPORT_ERROR (("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n",
|
ACPI_REPORT_ERROR(("ps_append_arg: Invalid AML Opcode: 0x%2.2X\n", op->common.aml_opcode));
|
||||||
op->common.aml_opcode));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,8 +154,7 @@ acpi_ps_append_arg (
|
|||||||
prev_arg = prev_arg->common.next;
|
prev_arg = prev_arg->common.next;
|
||||||
}
|
}
|
||||||
prev_arg->common.next = arg;
|
prev_arg->common.next = arg;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* No argument list, this will be the first argument */
|
/* No argument list, this will be the first argument */
|
||||||
|
|
||||||
op->common.value.arg = arg;
|
op->common.value.arg = arg;
|
||||||
@@ -185,7 +168,6 @@ acpi_ps_append_arg (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -201,18 +183,14 @@ acpi_ps_append_arg (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
union acpi_parse_object *
|
union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
|
||||||
acpi_ps_get_depth_next (
|
union acpi_parse_object *op)
|
||||||
union acpi_parse_object *origin,
|
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *next = NULL;
|
union acpi_parse_object *next = NULL;
|
||||||
union acpi_parse_object *parent;
|
union acpi_parse_object *parent;
|
||||||
union acpi_parse_object *arg;
|
union acpi_parse_object *arg;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@@ -220,7 +198,7 @@ acpi_ps_get_depth_next (
|
|||||||
|
|
||||||
/* Look for an argument or child */
|
/* Look for an argument or child */
|
||||||
|
|
||||||
next = acpi_ps_get_arg (op, 0);
|
next = acpi_ps_get_arg(op, 0);
|
||||||
if (next) {
|
if (next) {
|
||||||
return (next);
|
return (next);
|
||||||
}
|
}
|
||||||
@@ -237,7 +215,7 @@ acpi_ps_get_depth_next (
|
|||||||
parent = op->common.parent;
|
parent = op->common.parent;
|
||||||
|
|
||||||
while (parent) {
|
while (parent) {
|
||||||
arg = acpi_ps_get_arg (parent, 0);
|
arg = acpi_ps_get_arg(parent, 0);
|
||||||
while (arg && (arg != origin) && (arg != op)) {
|
while (arg && (arg != origin) && (arg != op)) {
|
||||||
arg = arg->common.next;
|
arg = arg->common.next;
|
||||||
}
|
}
|
||||||
@@ -261,7 +239,6 @@ acpi_ps_get_depth_next (
|
|||||||
return (next);
|
return (next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
#ifdef ACPI_OBSOLETE_FUNCTIONS
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -275,15 +252,11 @@ acpi_ps_get_depth_next (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
union acpi_parse_object *
|
union acpi_parse_object *acpi_ps_get_child(union acpi_parse_object *op)
|
||||||
acpi_ps_get_child (
|
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *child = NULL;
|
union acpi_parse_object *child = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
switch (op->common.aml_opcode) {
|
switch (op->common.aml_opcode) {
|
||||||
case AML_SCOPE_OP:
|
case AML_SCOPE_OP:
|
||||||
@@ -292,10 +265,9 @@ acpi_ps_get_child (
|
|||||||
case AML_THERMAL_ZONE_OP:
|
case AML_THERMAL_ZONE_OP:
|
||||||
case AML_INT_METHODCALL_OP:
|
case AML_INT_METHODCALL_OP:
|
||||||
|
|
||||||
child = acpi_ps_get_arg (op, 0);
|
child = acpi_ps_get_arg(op, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_BUFFER_OP:
|
case AML_BUFFER_OP:
|
||||||
case AML_PACKAGE_OP:
|
case AML_PACKAGE_OP:
|
||||||
case AML_METHOD_OP:
|
case AML_METHOD_OP:
|
||||||
@@ -303,24 +275,21 @@ acpi_ps_get_child (
|
|||||||
case AML_WHILE_OP:
|
case AML_WHILE_OP:
|
||||||
case AML_FIELD_OP:
|
case AML_FIELD_OP:
|
||||||
|
|
||||||
child = acpi_ps_get_arg (op, 1);
|
child = acpi_ps_get_arg(op, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_POWER_RES_OP:
|
case AML_POWER_RES_OP:
|
||||||
case AML_INDEX_FIELD_OP:
|
case AML_INDEX_FIELD_OP:
|
||||||
|
|
||||||
child = acpi_ps_get_arg (op, 2);
|
child = acpi_ps_get_arg(op, 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AML_PROCESSOR_OP:
|
case AML_PROCESSOR_OP:
|
||||||
case AML_BANK_FIELD_OP:
|
case AML_BANK_FIELD_OP:
|
||||||
|
|
||||||
child = acpi_ps_get_arg (op, 3);
|
child = acpi_ps_get_arg(op, 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* All others have no children */
|
/* All others have no children */
|
||||||
break;
|
break;
|
||||||
@@ -330,5 +299,4 @@ acpi_ps_get_child (
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|||||||
@@ -41,14 +41,12 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/amlcode.h>
|
#include <acpi/amlcode.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psutils")
|
ACPI_MODULE_NAME("psutils")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -61,15 +59,11 @@
|
|||||||
* DESCRIPTION: Create a Scope and associated namepath op with the root name
|
* 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;
|
union acpi_parse_object *scope_op;
|
||||||
|
|
||||||
|
scope_op = acpi_ps_alloc_op(AML_SCOPE_OP);
|
||||||
scope_op = acpi_ps_alloc_op (AML_SCOPE_OP);
|
|
||||||
if (!scope_op) {
|
if (!scope_op) {
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
@@ -78,7 +72,6 @@ acpi_ps_create_scope_op (
|
|||||||
return (scope_op);
|
return (scope_op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_init_op
|
* FUNCTION: acpi_ps_init_op
|
||||||
@@ -92,23 +85,19 @@ acpi_ps_create_scope_op (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode)
|
||||||
acpi_ps_init_op (
|
|
||||||
union acpi_parse_object *op,
|
|
||||||
u16 opcode)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_ENTRY ();
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
|
|
||||||
op->common.data_type = ACPI_DESC_TYPE_PARSER;
|
op->common.data_type = ACPI_DESC_TYPE_PARSER;
|
||||||
op->common.aml_opcode = opcode;
|
op->common.aml_opcode = opcode;
|
||||||
|
|
||||||
ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (op->common.aml_op_name,
|
ACPI_DISASM_ONLY_MEMBERS(ACPI_STRNCPY(op->common.aml_op_name,
|
||||||
(acpi_ps_get_opcode_info (opcode))->name,
|
(acpi_ps_get_opcode_info
|
||||||
sizeof (op->common.aml_op_name)));
|
(opcode))->name,
|
||||||
|
sizeof(op->common.aml_op_name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_alloc_op
|
* FUNCTION: acpi_ps_alloc_op
|
||||||
@@ -123,29 +112,23 @@ acpi_ps_init_op (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
union acpi_parse_object*
|
union acpi_parse_object *acpi_ps_alloc_op(u16 opcode)
|
||||||
acpi_ps_alloc_op (
|
|
||||||
u16 opcode)
|
|
||||||
{
|
{
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
const struct acpi_opcode_info *op_info;
|
const struct acpi_opcode_info *op_info;
|
||||||
u8 flags = ACPI_PARSEOP_GENERIC;
|
u8 flags = ACPI_PARSEOP_GENERIC;
|
||||||
|
|
||||||
|
ACPI_FUNCTION_ENTRY();
|
||||||
|
|
||||||
ACPI_FUNCTION_ENTRY ();
|
op_info = acpi_ps_get_opcode_info(opcode);
|
||||||
|
|
||||||
|
|
||||||
op_info = acpi_ps_get_opcode_info (opcode);
|
|
||||||
|
|
||||||
/* Determine type of parse_op required */
|
/* Determine type of parse_op required */
|
||||||
|
|
||||||
if (op_info->flags & AML_DEFER) {
|
if (op_info->flags & AML_DEFER) {
|
||||||
flags = ACPI_PARSEOP_DEFERRED;
|
flags = ACPI_PARSEOP_DEFERRED;
|
||||||
}
|
} else if (op_info->flags & AML_NAMED) {
|
||||||
else if (op_info->flags & AML_NAMED) {
|
|
||||||
flags = ACPI_PARSEOP_NAMED;
|
flags = ACPI_PARSEOP_NAMED;
|
||||||
}
|
} else if (opcode == AML_INT_BYTELIST_OP) {
|
||||||
else if (opcode == AML_INT_BYTELIST_OP) {
|
|
||||||
flags = ACPI_PARSEOP_BYTELIST;
|
flags = ACPI_PARSEOP_BYTELIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,27 +137,25 @@ acpi_ps_alloc_op (
|
|||||||
if (flags == ACPI_PARSEOP_GENERIC) {
|
if (flags == ACPI_PARSEOP_GENERIC) {
|
||||||
/* The generic op (default) is by far the most common (16 to 1) */
|
/* The generic op (default) is by far the most common (16 to 1) */
|
||||||
|
|
||||||
op = acpi_os_acquire_object (acpi_gbl_ps_node_cache);
|
op = acpi_os_acquire_object(acpi_gbl_ps_node_cache);
|
||||||
memset(op, 0, sizeof(struct acpi_parse_obj_common));
|
memset(op, 0, sizeof(struct acpi_parse_obj_common));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
/* Extended parseop */
|
/* Extended parseop */
|
||||||
|
|
||||||
op = acpi_os_acquire_object (acpi_gbl_ps_node_ext_cache);
|
op = acpi_os_acquire_object(acpi_gbl_ps_node_ext_cache);
|
||||||
memset(op, 0, sizeof(struct acpi_parse_obj_named));
|
memset(op, 0, sizeof(struct acpi_parse_obj_named));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the Op */
|
/* Initialize the Op */
|
||||||
|
|
||||||
if (op) {
|
if (op) {
|
||||||
acpi_ps_init_op (op, opcode);
|
acpi_ps_init_op(op, opcode);
|
||||||
op->common.flags = flags;
|
op->common.flags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (op);
|
return (op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_free_op
|
* FUNCTION: acpi_ps_free_op
|
||||||
@@ -188,26 +169,22 @@ acpi_ps_alloc_op (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void
|
void acpi_ps_free_op(union acpi_parse_object *op)
|
||||||
acpi_ps_free_op (
|
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
ACPI_FUNCTION_NAME ("ps_free_op");
|
ACPI_FUNCTION_NAME("ps_free_op");
|
||||||
|
|
||||||
|
|
||||||
if (op->common.aml_opcode == AML_INT_RETURN_VALUE_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) {
|
if (op->common.flags & ACPI_PARSEOP_GENERIC) {
|
||||||
(void) acpi_os_release_object (acpi_gbl_ps_node_cache, op);
|
(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);
|
||||||
(void) acpi_os_release_object (acpi_gbl_ps_node_ext_cache, op);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: Utility functions
|
* FUNCTION: Utility functions
|
||||||
@@ -216,36 +193,27 @@ acpi_ps_free_op (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is "c" a namestring lead character?
|
* Is "c" a namestring lead character?
|
||||||
*/
|
*/
|
||||||
u8
|
u8 acpi_ps_is_leading_char(u32 c)
|
||||||
acpi_ps_is_leading_char (
|
|
||||||
u32 c)
|
|
||||||
{
|
{
|
||||||
return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
|
return ((u8) (c == '_' || (c >= 'A' && c <= 'Z')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Is "c" a namestring prefix character?
|
* Is "c" a namestring prefix character?
|
||||||
*/
|
*/
|
||||||
u8
|
u8 acpi_ps_is_prefix_char(u32 c)
|
||||||
acpi_ps_is_prefix_char (
|
|
||||||
u32 c)
|
|
||||||
{
|
{
|
||||||
return ((u8) (c == '\\' || c == '^'));
|
return ((u8) (c == '\\' || c == '^'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get op's name (4-byte name segment) or 0 if unnamed
|
* Get op's name (4-byte name segment) or 0 if unnamed
|
||||||
*/
|
*/
|
||||||
#ifdef ACPI_FUTURE_USAGE
|
#ifdef ACPI_FUTURE_USAGE
|
||||||
u32
|
u32 acpi_ps_get_name(union acpi_parse_object * op)
|
||||||
acpi_ps_get_name (
|
|
||||||
union acpi_parse_object *op)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* The "generic" object has no name associated with it */
|
/* The "generic" object has no name associated with it */
|
||||||
@@ -258,16 +226,12 @@ acpi_ps_get_name (
|
|||||||
|
|
||||||
return (op->named.name);
|
return (op->named.name);
|
||||||
}
|
}
|
||||||
#endif /* ACPI_FUTURE_USAGE */
|
#endif /* ACPI_FUTURE_USAGE */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set op's name
|
* Set op's name
|
||||||
*/
|
*/
|
||||||
void
|
void acpi_ps_set_name(union acpi_parse_object *op, u32 name)
|
||||||
acpi_ps_set_name (
|
|
||||||
union acpi_parse_object *op,
|
|
||||||
u32 name)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* The "generic" object has no name associated with it */
|
/* The "generic" object has no name associated with it */
|
||||||
@@ -278,4 +242,3 @@ acpi_ps_set_name (
|
|||||||
|
|
||||||
op->named.name = name;
|
op->named.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,11 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("pswalk")
|
ACPI_MODULE_NAME("pswalk")
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -60,18 +58,13 @@
|
|||||||
* DESCRIPTION: Delete a portion of or an entire parse tree.
|
* 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 *op = subtree_root;
|
||||||
union acpi_parse_object *next = NULL;
|
union acpi_parse_object *next = NULL;
|
||||||
union acpi_parse_object *parent = NULL;
|
union acpi_parse_object *parent = NULL;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE_PTR ("ps_delete_parse_tree", subtree_root);
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE_PTR("ps_delete_parse_tree", subtree_root);
|
||||||
|
|
||||||
/* Visit all nodes in the subtree */
|
/* Visit all nodes in the subtree */
|
||||||
|
|
||||||
@@ -81,7 +74,7 @@ acpi_ps_delete_parse_tree (
|
|||||||
if (op != parent) {
|
if (op != parent) {
|
||||||
/* Look for an argument or child of the current op */
|
/* Look for an argument or child of the current op */
|
||||||
|
|
||||||
next = acpi_ps_get_arg (op, 0);
|
next = acpi_ps_get_arg(op, 0);
|
||||||
if (next) {
|
if (next) {
|
||||||
/* Still going downward in tree (Op is not completed yet) */
|
/* Still going downward in tree (Op is not completed yet) */
|
||||||
|
|
||||||
@@ -95,7 +88,7 @@ acpi_ps_delete_parse_tree (
|
|||||||
next = op->common.next;
|
next = op->common.next;
|
||||||
parent = op->common.parent;
|
parent = op->common.parent;
|
||||||
|
|
||||||
acpi_ps_free_op (op);
|
acpi_ps_free_op(op);
|
||||||
|
|
||||||
/* If we are back to the starting point, the walk is complete. */
|
/* If we are back to the starting point, the walk is complete. */
|
||||||
|
|
||||||
@@ -104,8 +97,7 @@ acpi_ps_delete_parse_tree (
|
|||||||
}
|
}
|
||||||
if (next) {
|
if (next) {
|
||||||
op = next;
|
op = next;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
op = parent;
|
op = parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,27 +41,19 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGES.
|
* POSSIBILITY OF SUCH DAMAGES.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <acpi/acpi.h>
|
#include <acpi/acpi.h>
|
||||||
#include <acpi/acparser.h>
|
#include <acpi/acparser.h>
|
||||||
#include <acpi/acdispat.h>
|
#include <acpi/acdispat.h>
|
||||||
#include <acpi/acinterp.h>
|
#include <acpi/acinterp.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PARSER
|
#define _COMPONENT ACPI_PARSER
|
||||||
ACPI_MODULE_NAME ("psxface")
|
ACPI_MODULE_NAME("psxface")
|
||||||
|
|
||||||
/* Local Prototypes */
|
/* 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
|
static void
|
||||||
acpi_ps_update_parameter_list (
|
acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action);
|
||||||
struct acpi_parameter_info *info,
|
|
||||||
u16 action);
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
@@ -86,27 +78,24 @@ acpi_ps_update_parameter_list (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
acpi_status
|
acpi_status acpi_ps_execute_method(struct acpi_parameter_info *info)
|
||||||
acpi_ps_execute_method (
|
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_execute_method");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_execute_method");
|
||||||
|
|
||||||
/* Validate the Info and method Node */
|
/* Validate the Info and method Node */
|
||||||
|
|
||||||
if (!info || !info->node) {
|
if (!info || !info->node) {
|
||||||
return_ACPI_STATUS (AE_NULL_ENTRY);
|
return_ACPI_STATUS(AE_NULL_ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init for new method, wait on concurrency semaphore */
|
/* Init for new method, wait on concurrency semaphore */
|
||||||
|
|
||||||
status = acpi_ds_begin_method_execution (info->node, info->obj_desc, NULL);
|
status =
|
||||||
if (ACPI_FAILURE (status)) {
|
acpi_ds_begin_method_execution(info->node, info->obj_desc, NULL);
|
||||||
return_ACPI_STATUS (status);
|
if (ACPI_FAILURE(status)) {
|
||||||
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -114,55 +103,54 @@ acpi_ps_execute_method (
|
|||||||
* objects (such as Operation Regions) can be created during the
|
* objects (such as Operation Regions) can be created during the
|
||||||
* first pass parse.
|
* first pass parse.
|
||||||
*/
|
*/
|
||||||
status = acpi_ut_allocate_owner_id (&info->obj_desc->method.owner_id);
|
status = acpi_ut_allocate_owner_id(&info->obj_desc->method.owner_id);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The caller "owns" the parameters, so give each one an extra
|
* The caller "owns" the parameters, so give each one an extra
|
||||||
* reference
|
* reference
|
||||||
*/
|
*/
|
||||||
acpi_ps_update_parameter_list (info, REF_INCREMENT);
|
acpi_ps_update_parameter_list(info, REF_INCREMENT);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1) Perform the first pass parse of the method to enter any
|
* 1) Perform the first pass parse of the method to enter any
|
||||||
* named objects that it creates into the namespace
|
* named objects that it creates into the namespace
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"**** Begin Method Parse **** Entry=%p obj=%p\n",
|
"**** Begin Method Parse **** Entry=%p obj=%p\n",
|
||||||
info->node, info->obj_desc));
|
info->node, info->obj_desc));
|
||||||
|
|
||||||
info->pass_number = 1;
|
info->pass_number = 1;
|
||||||
status = acpi_ps_execute_pass (info);
|
status = acpi_ps_execute_pass(info);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 2) Execute the method. Performs second pass parse simultaneously
|
* 2) Execute the method. Performs second pass parse simultaneously
|
||||||
*/
|
*/
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
"**** Begin Method Execution **** Entry=%p obj=%p\n",
|
"**** Begin Method Execution **** Entry=%p obj=%p\n",
|
||||||
info->node, info->obj_desc));
|
info->node, info->obj_desc));
|
||||||
|
|
||||||
info->pass_number = 3;
|
info->pass_number = 3;
|
||||||
status = acpi_ps_execute_pass (info);
|
status = acpi_ps_execute_pass(info);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup:
|
|
||||||
if (info->obj_desc->method.owner_id) {
|
if (info->obj_desc->method.owner_id) {
|
||||||
acpi_ut_release_owner_id (&info->obj_desc->method.owner_id);
|
acpi_ut_release_owner_id(&info->obj_desc->method.owner_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take away the extra reference that we gave the parameters above */
|
/* Take away the extra reference that we gave the parameters above */
|
||||||
|
|
||||||
acpi_ps_update_parameter_list (info, REF_DECREMENT);
|
acpi_ps_update_parameter_list(info, REF_DECREMENT);
|
||||||
|
|
||||||
/* Exit now if error above */
|
/* Exit now if error above */
|
||||||
|
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -170,17 +158,17 @@ cleanup:
|
|||||||
* a control exception code
|
* a control exception code
|
||||||
*/
|
*/
|
||||||
if (info->return_object) {
|
if (info->return_object) {
|
||||||
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Method returned obj_desc=%p\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
|
||||||
info->return_object));
|
"Method returned obj_desc=%p\n",
|
||||||
ACPI_DUMP_STACK_ENTRY (info->return_object);
|
info->return_object));
|
||||||
|
ACPI_DUMP_STACK_ENTRY(info->return_object);
|
||||||
|
|
||||||
status = AE_CTRL_RETURN_VALUE;
|
status = AE_CTRL_RETURN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_update_parameter_list
|
* FUNCTION: acpi_ps_update_parameter_list
|
||||||
@@ -196,26 +184,23 @@ cleanup:
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_ps_update_parameter_list (
|
acpi_ps_update_parameter_list(struct acpi_parameter_info *info, u16 action)
|
||||||
struct acpi_parameter_info *info,
|
|
||||||
u16 action)
|
|
||||||
{
|
{
|
||||||
acpi_native_uint i;
|
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 */
|
/* Update reference count for each parameter */
|
||||||
|
|
||||||
for (i = 0; info->parameters[i]; i++) {
|
for (i = 0; info->parameters[i]; i++) {
|
||||||
/* Ignore errors, just do them all */
|
/* Ignore errors, just do them all */
|
||||||
|
|
||||||
(void) acpi_ut_update_object_reference (info->parameters[i], action);
|
(void)acpi_ut_update_object_reference(info->
|
||||||
|
parameters[i],
|
||||||
|
action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
*
|
*
|
||||||
* FUNCTION: acpi_ps_execute_pass
|
* FUNCTION: acpi_ps_execute_pass
|
||||||
@@ -229,53 +214,48 @@ acpi_ps_update_parameter_list (
|
|||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static acpi_status
|
static acpi_status acpi_ps_execute_pass(struct acpi_parameter_info *info)
|
||||||
acpi_ps_execute_pass (
|
|
||||||
struct acpi_parameter_info *info)
|
|
||||||
{
|
{
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
union acpi_parse_object *op;
|
union acpi_parse_object *op;
|
||||||
struct acpi_walk_state *walk_state;
|
struct acpi_walk_state *walk_state;
|
||||||
|
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE ("ps_execute_pass");
|
|
||||||
|
|
||||||
|
ACPI_FUNCTION_TRACE("ps_execute_pass");
|
||||||
|
|
||||||
/* Create and init a Root Node */
|
/* Create and init a Root Node */
|
||||||
|
|
||||||
op = acpi_ps_create_scope_op ();
|
op = acpi_ps_create_scope_op();
|
||||||
if (!op) {
|
if (!op) {
|
||||||
return_ACPI_STATUS (AE_NO_MEMORY);
|
return_ACPI_STATUS(AE_NO_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create and initialize a new walk state */
|
/* Create and initialize a new walk state */
|
||||||
|
|
||||||
walk_state = acpi_ds_create_walk_state (
|
walk_state =
|
||||||
info->obj_desc->method.owner_id, NULL, NULL, NULL);
|
acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
|
||||||
|
NULL, NULL);
|
||||||
if (!walk_state) {
|
if (!walk_state) {
|
||||||
status = AE_NO_MEMORY;
|
status = AE_NO_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_ds_init_aml_walk (walk_state, op, info->node,
|
status = acpi_ds_init_aml_walk(walk_state, op, info->node,
|
||||||
info->obj_desc->method.aml_start,
|
info->obj_desc->method.aml_start,
|
||||||
info->obj_desc->method.aml_length,
|
info->obj_desc->method.aml_length,
|
||||||
info->pass_number == 1 ? NULL : info,
|
info->pass_number == 1 ? NULL : info,
|
||||||
info->pass_number);
|
info->pass_number);
|
||||||
if (ACPI_FAILURE (status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
acpi_ds_delete_walk_state (walk_state);
|
acpi_ds_delete_walk_state(walk_state);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the AML */
|
/* Parse the AML */
|
||||||
|
|
||||||
status = acpi_ps_parse_aml (walk_state);
|
status = acpi_ps_parse_aml(walk_state);
|
||||||
|
|
||||||
/* Walk state was deleted by parse_aml */
|
/* Walk state was deleted by parse_aml */
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
acpi_ps_delete_parse_tree (op);
|
acpi_ps_delete_parse_tree(op);
|
||||||
return_ACPI_STATUS (status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,22 +35,16 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PCI_COMPONENT
|
#define _COMPONENT ACPI_PCI_COMPONENT
|
||||||
ACPI_MODULE_NAME ("pci_bind")
|
ACPI_MODULE_NAME("pci_bind")
|
||||||
|
|
||||||
struct acpi_pci_data {
|
struct acpi_pci_data {
|
||||||
struct acpi_pci_id id;
|
struct acpi_pci_id id;
|
||||||
struct pci_bus *bus;
|
struct pci_bus *bus;
|
||||||
struct pci_dev *dev;
|
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");
|
ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
|
||||||
|
|
||||||
@@ -59,7 +53,6 @@ acpi_pci_data_handler (
|
|||||||
return_VOID;
|
return_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* acpi_get_pci_id
|
* acpi_get_pci_id
|
||||||
* ------------------
|
* ------------------
|
||||||
@@ -67,15 +60,12 @@ acpi_pci_data_handler (
|
|||||||
* to resolve PCI information for ACPI-PCI devices defined in the namespace.
|
* to resolve PCI information for ACPI-PCI devices defined in the namespace.
|
||||||
* This typically occurs when resolving PCI operation region information.
|
* This typically occurs when resolving PCI operation region information.
|
||||||
*/
|
*/
|
||||||
acpi_status
|
acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
|
||||||
acpi_get_pci_id (
|
|
||||||
acpi_handle handle,
|
|
||||||
struct acpi_pci_id *id)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_device *device = NULL;
|
struct acpi_device *device = NULL;
|
||||||
struct acpi_pci_data *data = NULL;
|
struct acpi_pci_data *data = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_get_pci_id");
|
ACPI_FUNCTION_TRACE("acpi_get_pci_id");
|
||||||
|
|
||||||
@@ -85,51 +75,49 @@ acpi_get_pci_id (
|
|||||||
result = acpi_bus_get_device(handle, &device);
|
result = acpi_bus_get_device(handle, &device);
|
||||||
if (result) {
|
if (result) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Invalid ACPI Bus context for device %s\n",
|
"Invalid ACPI Bus context for device %s\n",
|
||||||
acpi_device_bid(device)));
|
acpi_device_bid(device)));
|
||||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_get_data(handle, acpi_pci_data_handler, (void**) &data);
|
status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
|
||||||
if (ACPI_FAILURE(status) || !data) {
|
if (ACPI_FAILURE(status) || !data) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Invalid ACPI-PCI context for device %s\n",
|
"Invalid ACPI-PCI context for device %s\n",
|
||||||
acpi_device_bid(device)));
|
acpi_device_bid(device)));
|
||||||
return_ACPI_STATUS(status);
|
return_ACPI_STATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
*id = data->id;
|
*id = data->id;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
id->segment = data->id.segment;
|
id->segment = data->id.segment;
|
||||||
id->bus = data->id.bus;
|
id->bus = data->id.bus;
|
||||||
id->device = data->id.device;
|
id->device = data->id.device;
|
||||||
id->function = data->id.function;
|
id->function = data->id.function;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Device %s has PCI address %02x:%02x:%02x.%02x\n",
|
"Device %s has PCI address %02x:%02x:%02x.%02x\n",
|
||||||
acpi_device_bid(device), id->segment, id->bus,
|
acpi_device_bid(device), id->segment, id->bus,
|
||||||
id->device, id->function));
|
id->device, id->function));
|
||||||
|
|
||||||
return_ACPI_STATUS(AE_OK);
|
return_ACPI_STATUS(AE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_get_pci_id);
|
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;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_pci_data *data = NULL;
|
struct acpi_pci_data *data = NULL;
|
||||||
struct acpi_pci_data *pdata = NULL;
|
struct acpi_pci_data *pdata = NULL;
|
||||||
char *pathname = NULL;
|
char *pathname = NULL;
|
||||||
struct acpi_buffer buffer = {0, NULL};
|
struct acpi_buffer buffer = { 0, NULL };
|
||||||
acpi_handle handle = NULL;
|
acpi_handle handle = NULL;
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
struct pci_bus *bus;
|
struct pci_bus *bus;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_bind");
|
ACPI_FUNCTION_TRACE("acpi_pci_bind");
|
||||||
|
|
||||||
@@ -137,22 +125,22 @@ acpi_pci_bind (
|
|||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
||||||
if(!pathname)
|
if (!pathname)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
||||||
buffer.length = ACPI_PATHNAME_MAX;
|
buffer.length = ACPI_PATHNAME_MAX;
|
||||||
buffer.pointer = pathname;
|
buffer.pointer = pathname;
|
||||||
|
|
||||||
data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
|
data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
|
||||||
if (!data){
|
if (!data) {
|
||||||
kfree (pathname);
|
kfree(pathname);
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
}
|
}
|
||||||
memset(data, 0, sizeof(struct acpi_pci_data));
|
memset(data, 0, sizeof(struct acpi_pci_data));
|
||||||
|
|
||||||
acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
|
acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI device [%s]...\n",
|
||||||
pathname));
|
pathname));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Segment & Bus
|
* Segment & Bus
|
||||||
@@ -160,11 +148,11 @@ acpi_pci_bind (
|
|||||||
* These are obtained via the parent device's ACPI-PCI context.
|
* These are obtained via the parent device's ACPI-PCI context.
|
||||||
*/
|
*/
|
||||||
status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
|
status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
|
||||||
(void**) &pdata);
|
(void **)&pdata);
|
||||||
if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
|
if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Invalid ACPI-PCI context for parent device %s\n",
|
"Invalid ACPI-PCI context for parent device %s\n",
|
||||||
acpi_device_bid(device->parent)));
|
acpi_device_bid(device->parent)));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -181,8 +169,8 @@ acpi_pci_bind (
|
|||||||
data->id.function = device->pnp.bus_address & 0xFFFF;
|
data->id.function = device->pnp.bus_address & 0xFFFF;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %02x:%02x:%02x.%02x\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "...to %02x:%02x:%02x.%02x\n",
|
||||||
data->id.segment, data->id.bus, data->id.device,
|
data->id.segment, data->id.bus, data->id.device,
|
||||||
data->id.function));
|
data->id.function));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TBD: Support slot devices (e.g. function=0xFFFF).
|
* TBD: Support slot devices (e.g. function=0xFFFF).
|
||||||
@@ -202,7 +190,7 @@ acpi_pci_bind (
|
|||||||
if (bus) {
|
if (bus) {
|
||||||
list_for_each_entry(dev, &bus->devices, bus_list) {
|
list_for_each_entry(dev, &bus->devices, bus_list) {
|
||||||
if (dev->devfn == PCI_DEVFN(data->id.device,
|
if (dev->devfn == PCI_DEVFN(data->id.device,
|
||||||
data->id.function)) {
|
data->id.function)) {
|
||||||
data->dev = dev;
|
data->dev = dev;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -210,17 +198,17 @@ acpi_pci_bind (
|
|||||||
}
|
}
|
||||||
if (!data->dev) {
|
if (!data->dev) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Device %02x:%02x:%02x.%02x not present in PCI namespace\n",
|
"Device %02x:%02x:%02x.%02x not present in PCI namespace\n",
|
||||||
data->id.segment, data->id.bus,
|
data->id.segment, data->id.bus,
|
||||||
data->id.device, data->id.function));
|
data->id.device, data->id.function));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (!data->dev->bus) {
|
if (!data->dev->bus) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
|
"Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
|
||||||
data->id.segment, data->id.bus,
|
data->id.segment, data->id.bus,
|
||||||
data->id.device, data->id.function));
|
data->id.device, data->id.function));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -233,9 +221,9 @@ acpi_pci_bind (
|
|||||||
*/
|
*/
|
||||||
if (data->dev->subordinate) {
|
if (data->dev->subordinate) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Device %02x:%02x:%02x.%02x is a PCI bridge\n",
|
"Device %02x:%02x:%02x.%02x is a PCI bridge\n",
|
||||||
data->id.segment, data->id.bus,
|
data->id.segment, data->id.bus,
|
||||||
data->id.device, data->id.function));
|
data->id.device, data->id.function));
|
||||||
data->bus = data->dev->subordinate;
|
data->bus = data->dev->subordinate;
|
||||||
device->ops.bind = acpi_pci_bind;
|
device->ops.bind = acpi_pci_bind;
|
||||||
device->ops.unbind = acpi_pci_unbind;
|
device->ops.unbind = acpi_pci_unbind;
|
||||||
@@ -249,8 +237,8 @@ acpi_pci_bind (
|
|||||||
status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
|
status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to attach ACPI-PCI context to device %s\n",
|
"Unable to attach ACPI-PCI context to device %s\n",
|
||||||
acpi_device_bid(device)));
|
acpi_device_bid(device)));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -267,15 +255,15 @@ acpi_pci_bind (
|
|||||||
*/
|
*/
|
||||||
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
|
status = acpi_get_handle(device->handle, METHOD_NAME__PRT, &handle);
|
||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
if (data->bus) /* PCI-PCI bridge */
|
if (data->bus) /* PCI-PCI bridge */
|
||||||
acpi_pci_irq_add_prt(device->handle, data->id.segment,
|
acpi_pci_irq_add_prt(device->handle, data->id.segment,
|
||||||
data->bus->number);
|
data->bus->number);
|
||||||
else /* non-bridge PCI device */
|
else /* non-bridge PCI device */
|
||||||
acpi_pci_irq_add_prt(device->handle, data->id.segment,
|
acpi_pci_irq_add_prt(device->handle, data->id.segment,
|
||||||
data->id.bus);
|
data->id.bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
kfree(pathname);
|
kfree(pathname);
|
||||||
if (result)
|
if (result)
|
||||||
kfree(data);
|
kfree(data);
|
||||||
@@ -283,22 +271,21 @@ end:
|
|||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int acpi_pci_unbind(
|
int acpi_pci_unbind(struct acpi_device *device)
|
||||||
struct acpi_device *device)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_pci_data *data = NULL;
|
struct acpi_pci_data *data = NULL;
|
||||||
char *pathname = NULL;
|
char *pathname = NULL;
|
||||||
struct acpi_buffer buffer = {0, NULL};
|
struct acpi_buffer buffer = { 0, NULL };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_unbind");
|
ACPI_FUNCTION_TRACE("acpi_pci_unbind");
|
||||||
|
|
||||||
if (!device || !device->parent)
|
if (!device || !device->parent)
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
|
|
||||||
pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
||||||
if(!pathname)
|
if (!pathname)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
||||||
|
|
||||||
@@ -306,14 +293,16 @@ int acpi_pci_unbind(
|
|||||||
buffer.pointer = pathname;
|
buffer.pointer = pathname;
|
||||||
acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
|
acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
|
||||||
pathname));
|
pathname));
|
||||||
kfree(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)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to get data from device %s\n",
|
"Unable to get data from device %s\n",
|
||||||
acpi_device_bid(device)));
|
acpi_device_bid(device)));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -321,8 +310,8 @@ int acpi_pci_unbind(
|
|||||||
status = acpi_detach_data(device->handle, acpi_pci_data_handler);
|
status = acpi_detach_data(device->handle, acpi_pci_data_handler);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to detach data from device %s\n",
|
"Unable to detach data from device %s\n",
|
||||||
acpi_device_bid(device)));
|
acpi_device_bid(device)));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -331,39 +320,37 @@ int acpi_pci_unbind(
|
|||||||
}
|
}
|
||||||
kfree(data);
|
kfree(data);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
return_VALUE(result);
|
return_VALUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acpi_pci_bind_root (
|
acpi_pci_bind_root(struct acpi_device *device,
|
||||||
struct acpi_device *device,
|
struct acpi_pci_id *id, struct pci_bus *bus)
|
||||||
struct acpi_pci_id *id,
|
|
||||||
struct pci_bus *bus)
|
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
acpi_status status = AE_OK;
|
acpi_status status = AE_OK;
|
||||||
struct acpi_pci_data *data = NULL;
|
struct acpi_pci_data *data = NULL;
|
||||||
char *pathname = NULL;
|
char *pathname = NULL;
|
||||||
struct acpi_buffer buffer = {0, NULL};
|
struct acpi_buffer buffer = { 0, NULL };
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
|
ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
|
||||||
|
|
||||||
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
||||||
if(!pathname)
|
if (!pathname)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
||||||
|
|
||||||
buffer.length = ACPI_PATHNAME_MAX;
|
buffer.length = ACPI_PATHNAME_MAX;
|
||||||
buffer.pointer = pathname;
|
buffer.pointer = pathname;
|
||||||
|
|
||||||
if (!device || !id || !bus){
|
if (!device || !id || !bus) {
|
||||||
kfree(pathname);
|
kfree(pathname);
|
||||||
return_VALUE(-EINVAL);
|
return_VALUE(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
|
data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
|
||||||
if (!data){
|
if (!data) {
|
||||||
kfree(pathname);
|
kfree(pathname);
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
}
|
}
|
||||||
@@ -377,18 +364,18 @@ acpi_pci_bind_root (
|
|||||||
acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
|
acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to "
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Binding PCI root bridge [%s] to "
|
||||||
"%02x:%02x\n", pathname, id->segment, id->bus));
|
"%02x:%02x\n", pathname, id->segment, id->bus));
|
||||||
|
|
||||||
status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
|
status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
|
||||||
"Unable to attach ACPI-PCI context to device %s\n",
|
"Unable to attach ACPI-PCI context to device %s\n",
|
||||||
pathname));
|
pathname));
|
||||||
result = -ENODEV;
|
result = -ENODEV;
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
kfree(pathname);
|
kfree(pathname);
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
kfree(data);
|
kfree(data);
|
||||||
|
|||||||
@@ -38,26 +38,22 @@
|
|||||||
#include <acpi/acpi_bus.h>
|
#include <acpi/acpi_bus.h>
|
||||||
#include <acpi/acpi_drivers.h>
|
#include <acpi/acpi_drivers.h>
|
||||||
|
|
||||||
|
|
||||||
#define _COMPONENT ACPI_PCI_COMPONENT
|
#define _COMPONENT ACPI_PCI_COMPONENT
|
||||||
ACPI_MODULE_NAME ("pci_irq")
|
ACPI_MODULE_NAME("pci_irq")
|
||||||
|
|
||||||
static struct acpi_prt_list acpi_prt;
|
static struct acpi_prt_list acpi_prt;
|
||||||
static DEFINE_SPINLOCK(acpi_prt_lock);
|
static DEFINE_SPINLOCK(acpi_prt_lock);
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
PCI IRQ Routing Table (PRT) Support
|
PCI IRQ Routing Table (PRT) Support
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct acpi_prt_entry *
|
static struct acpi_prt_entry *acpi_pci_irq_find_prt_entry(int segment,
|
||||||
acpi_pci_irq_find_prt_entry (
|
int bus,
|
||||||
int segment,
|
int device, int pin)
|
||||||
int bus,
|
|
||||||
int device,
|
|
||||||
int pin)
|
|
||||||
{
|
{
|
||||||
struct list_head *node = NULL;
|
struct list_head *node = NULL;
|
||||||
struct acpi_prt_entry *entry = NULL;
|
struct acpi_prt_entry *entry = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_find_prt_entry");
|
||||||
|
|
||||||
@@ -73,9 +69,9 @@ acpi_pci_irq_find_prt_entry (
|
|||||||
list_for_each(node, &acpi_prt.entries) {
|
list_for_each(node, &acpi_prt.entries) {
|
||||||
entry = list_entry(node, struct acpi_prt_entry, node);
|
entry = list_entry(node, struct acpi_prt_entry, node);
|
||||||
if ((segment == entry->id.segment)
|
if ((segment == entry->id.segment)
|
||||||
&& (bus == entry->id.bus)
|
&& (bus == entry->id.bus)
|
||||||
&& (device == entry->id.device)
|
&& (device == entry->id.device)
|
||||||
&& (pin == entry->pin)) {
|
&& (pin == entry->pin)) {
|
||||||
spin_unlock(&acpi_prt_lock);
|
spin_unlock(&acpi_prt_lock);
|
||||||
return_PTR(entry);
|
return_PTR(entry);
|
||||||
}
|
}
|
||||||
@@ -85,15 +81,11 @@ acpi_pci_irq_find_prt_entry (
|
|||||||
return_PTR(NULL);
|
return_PTR(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_pci_irq_add_entry (
|
acpi_pci_irq_add_entry(acpi_handle handle,
|
||||||
acpi_handle handle,
|
int segment, int bus, struct acpi_pci_routing_table *prt)
|
||||||
int segment,
|
|
||||||
int bus,
|
|
||||||
struct acpi_pci_routing_table *prt)
|
|
||||||
{
|
{
|
||||||
struct acpi_prt_entry *entry = NULL;
|
struct acpi_prt_entry *entry = NULL;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_add_entry");
|
||||||
|
|
||||||
@@ -139,9 +131,10 @@ acpi_pci_irq_add_entry (
|
|||||||
entry->link.index = prt->source_index;
|
entry->link.index = prt->source_index;
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO,
|
||||||
" %02X:%02X:%02X[%c] -> %s[%d]\n",
|
" %02X:%02X:%02X[%c] -> %s[%d]\n",
|
||||||
entry->id.segment, entry->id.bus, entry->id.device,
|
entry->id.segment, entry->id.bus,
|
||||||
('A' + entry->pin), prt->source, entry->link.index));
|
entry->id.device, ('A' + entry->pin), prt->source,
|
||||||
|
entry->link.index));
|
||||||
|
|
||||||
spin_lock(&acpi_prt_lock);
|
spin_lock(&acpi_prt_lock);
|
||||||
list_add_tail(&entry->node, &acpi_prt.entries);
|
list_add_tail(&entry->node, &acpi_prt.entries);
|
||||||
@@ -151,38 +144,29 @@ acpi_pci_irq_add_entry (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
acpi_pci_irq_del_entry (
|
acpi_pci_irq_del_entry(int segment, int bus, struct acpi_prt_entry *entry)
|
||||||
int segment,
|
|
||||||
int bus,
|
|
||||||
struct acpi_prt_entry *entry)
|
|
||||||
{
|
{
|
||||||
if (segment == entry->id.segment && bus == entry->id.bus){
|
if (segment == entry->id.segment && bus == entry->id.bus) {
|
||||||
acpi_prt.count--;
|
acpi_prt.count--;
|
||||||
list_del(&entry->node);
|
list_del(&entry->node);
|
||||||
kfree(entry);
|
kfree(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;
|
acpi_status status = AE_OK;
|
||||||
char *pathname = NULL;
|
char *pathname = NULL;
|
||||||
struct acpi_buffer buffer = {0, NULL};
|
struct acpi_buffer buffer = { 0, NULL };
|
||||||
struct acpi_pci_routing_table *prt = NULL;
|
struct acpi_pci_routing_table *prt = NULL;
|
||||||
struct acpi_pci_routing_table *entry = NULL;
|
struct acpi_pci_routing_table *entry = NULL;
|
||||||
static int first_time = 1;
|
static int first_time = 1;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_add_prt");
|
||||||
|
|
||||||
pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
|
||||||
if(!pathname)
|
if (!pathname)
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
memset(pathname, 0, ACPI_PATHNAME_MAX);
|
||||||
|
|
||||||
@@ -202,7 +186,7 @@ acpi_pci_irq_add_prt (
|
|||||||
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
|
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
|
||||||
|
|
||||||
printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
|
printk(KERN_DEBUG "ACPI: PCI Interrupt Routing Table [%s._PRT]\n",
|
||||||
pathname);
|
pathname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Evaluate this _PRT and add its entries to our global list (acpi_prt).
|
* Evaluate this _PRT and add its entries to our global list (acpi_prt).
|
||||||
@@ -214,12 +198,12 @@ acpi_pci_irq_add_prt (
|
|||||||
status = acpi_get_irq_routing_table(handle, &buffer);
|
status = acpi_get_irq_routing_table(handle, &buffer);
|
||||||
if (status != AE_BUFFER_OVERFLOW) {
|
if (status != AE_BUFFER_OVERFLOW) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
|
||||||
acpi_format_exception(status)));
|
acpi_format_exception(status)));
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
prt = kmalloc(buffer.length, GFP_KERNEL);
|
prt = kmalloc(buffer.length, GFP_KERNEL);
|
||||||
if (!prt){
|
if (!prt) {
|
||||||
return_VALUE(-ENOMEM);
|
return_VALUE(-ENOMEM);
|
||||||
}
|
}
|
||||||
memset(prt, 0, buffer.length);
|
memset(prt, 0, buffer.length);
|
||||||
@@ -228,7 +212,7 @@ acpi_pci_irq_add_prt (
|
|||||||
status = acpi_get_irq_routing_table(handle, &buffer);
|
status = acpi_get_irq_routing_table(handle, &buffer);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PRT [%s]\n",
|
||||||
acpi_format_exception(status)));
|
acpi_format_exception(status)));
|
||||||
kfree(buffer.pointer);
|
kfree(buffer.pointer);
|
||||||
return_VALUE(-ENODEV);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
@@ -238,7 +222,7 @@ acpi_pci_irq_add_prt (
|
|||||||
while (entry && (entry->length > 0)) {
|
while (entry && (entry->length > 0)) {
|
||||||
acpi_pci_irq_add_entry(handle, segment, bus, entry);
|
acpi_pci_irq_add_entry(handle, segment, bus, entry);
|
||||||
entry = (struct acpi_pci_routing_table *)
|
entry = (struct acpi_pci_routing_table *)
|
||||||
((unsigned long) entry + entry->length);
|
((unsigned long)entry + entry->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(prt);
|
kfree(prt);
|
||||||
@@ -246,18 +230,18 @@ acpi_pci_irq_add_prt (
|
|||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void acpi_pci_irq_del_prt(int segment, int bus)
|
||||||
acpi_pci_irq_del_prt (int segment, int bus)
|
|
||||||
{
|
{
|
||||||
struct list_head *node = NULL, *n = NULL;
|
struct list_head *node = NULL, *n = NULL;
|
||||||
struct acpi_prt_entry *entry = NULL;
|
struct acpi_prt_entry *entry = NULL;
|
||||||
|
|
||||||
if (!acpi_prt.count) {
|
if (!acpi_prt.count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk(KERN_DEBUG "ACPI: Delete PCI Interrupt Routing Table for %x:%x\n",
|
printk(KERN_DEBUG
|
||||||
segment, bus);
|
"ACPI: Delete PCI Interrupt Routing Table for %x:%x\n", segment,
|
||||||
|
bus);
|
||||||
spin_lock(&acpi_prt_lock);
|
spin_lock(&acpi_prt_lock);
|
||||||
list_for_each_safe(node, n, &acpi_prt.entries) {
|
list_for_each_safe(node, n, &acpi_prt.entries) {
|
||||||
entry = list_entry(node, struct acpi_prt_entry, node);
|
entry = list_entry(node, struct acpi_prt_entry, node);
|
||||||
@@ -266,26 +250,27 @@ acpi_pci_irq_del_prt (int segment, int bus)
|
|||||||
}
|
}
|
||||||
spin_unlock(&acpi_prt_lock);
|
spin_unlock(&acpi_prt_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
PCI Interrupt Routing Support
|
PCI Interrupt Routing Support
|
||||||
-------------------------------------------------------------------------- */
|
-------------------------------------------------------------------------- */
|
||||||
typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **);
|
typedef int (*irq_lookup_func) (struct acpi_prt_entry *, int *, int *, char **);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
|
acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
|
||||||
int *edge_level,
|
int *edge_level, int *active_high_low, char **link)
|
||||||
int *active_high_low,
|
|
||||||
char **link)
|
|
||||||
{
|
{
|
||||||
int irq;
|
int irq;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
|
ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq");
|
||||||
|
|
||||||
if (entry->link.handle) {
|
if (entry->link.handle) {
|
||||||
irq = acpi_pci_link_allocate_irq(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) {
|
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);
|
return_VALUE(-1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -300,11 +285,9 @@ acpi_pci_allocate_irq(struct acpi_prt_entry *entry,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_pci_free_irq(struct acpi_prt_entry *entry,
|
acpi_pci_free_irq(struct acpi_prt_entry *entry,
|
||||||
int *edge_level,
|
int *edge_level, int *active_high_low, char **link)
|
||||||
int *active_high_low,
|
|
||||||
char **link)
|
|
||||||
{
|
{
|
||||||
int irq;
|
int irq;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
|
ACPI_FUNCTION_TRACE("acpi_pci_free_irq");
|
||||||
if (entry->link.handle) {
|
if (entry->link.handle) {
|
||||||
@@ -314,22 +297,20 @@ acpi_pci_free_irq(struct acpi_prt_entry *entry,
|
|||||||
}
|
}
|
||||||
return_VALUE(irq);
|
return_VALUE(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* acpi_pci_irq_lookup
|
* acpi_pci_irq_lookup
|
||||||
* success: return IRQ >= 0
|
* success: return IRQ >= 0
|
||||||
* failure: return -1
|
* failure: return -1
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
acpi_pci_irq_lookup (
|
acpi_pci_irq_lookup(struct pci_bus *bus,
|
||||||
struct pci_bus *bus,
|
int device,
|
||||||
int device,
|
int pin,
|
||||||
int pin,
|
int *edge_level,
|
||||||
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;
|
struct acpi_prt_entry *entry = NULL;
|
||||||
int segment = pci_domain_nr(bus);
|
int segment = pci_domain_nr(bus);
|
||||||
int bus_nr = bus->number;
|
int bus_nr = bus->number;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -337,8 +318,8 @@ acpi_pci_irq_lookup (
|
|||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup");
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
||||||
"Searching for PRT entry for %02x:%02x:%02x[%c]\n",
|
"Searching for PRT entry for %02x:%02x:%02x[%c]\n",
|
||||||
segment, bus_nr, device, ('A' + pin)));
|
segment, bus_nr, device, ('A' + pin)));
|
||||||
|
|
||||||
entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
|
entry = acpi_pci_irq_find_prt_entry(segment, bus_nr, device, pin);
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
@@ -356,17 +337,14 @@ acpi_pci_irq_lookup (
|
|||||||
* failure: return < 0
|
* failure: return < 0
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
acpi_pci_irq_derive (
|
acpi_pci_irq_derive(struct pci_dev *dev,
|
||||||
struct pci_dev *dev,
|
int pin,
|
||||||
int pin,
|
int *edge_level,
|
||||||
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;
|
struct pci_dev *bridge = dev;
|
||||||
int irq = -1;
|
int irq = -1;
|
||||||
u8 bridge_pin = 0;
|
u8 bridge_pin = 0;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_derive");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_derive");
|
||||||
|
|
||||||
@@ -383,28 +361,33 @@ acpi_pci_irq_derive (
|
|||||||
|
|
||||||
if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
|
if ((bridge->class >> 8) == PCI_CLASS_BRIDGE_CARDBUS) {
|
||||||
/* PC card has the same IRQ as its cardbridge */
|
/* 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) {
|
if (!bridge_pin) {
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
|
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);
|
return_VALUE(-1);
|
||||||
}
|
}
|
||||||
/* Pin is from 0 to 3 */
|
/* Pin is from 0 to 3 */
|
||||||
bridge_pin --;
|
bridge_pin--;
|
||||||
pin = bridge_pin;
|
pin = bridge_pin;
|
||||||
}
|
}
|
||||||
|
|
||||||
irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn),
|
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) {
|
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);
|
return_VALUE(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
|
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Derive IRQ %d for device %s from %s\n",
|
||||||
irq, pci_name(dev), pci_name(bridge)));
|
irq, pci_name(dev), pci_name(bridge)));
|
||||||
|
|
||||||
return_VALUE(irq);
|
return_VALUE(irq);
|
||||||
}
|
}
|
||||||
@@ -415,16 +398,14 @@ acpi_pci_irq_derive (
|
|||||||
* failure: return < 0
|
* failure: return < 0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int acpi_pci_irq_enable(struct pci_dev *dev)
|
||||||
acpi_pci_irq_enable (
|
|
||||||
struct pci_dev *dev)
|
|
||||||
{
|
{
|
||||||
int irq = 0;
|
int irq = 0;
|
||||||
u8 pin = 0;
|
u8 pin = 0;
|
||||||
int edge_level = ACPI_LEVEL_SENSITIVE;
|
int edge_level = ACPI_LEVEL_SENSITIVE;
|
||||||
int active_high_low = ACPI_ACTIVE_LOW;
|
int active_high_low = ACPI_ACTIVE_LOW;
|
||||||
char *link = NULL;
|
char *link = NULL;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_enable");
|
||||||
|
|
||||||
@@ -433,13 +414,16 @@ acpi_pci_irq_enable (
|
|||||||
|
|
||||||
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
|
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
|
||||||
if (!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);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
pin--;
|
pin--;
|
||||||
|
|
||||||
if (!dev->bus) {
|
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);
|
return_VALUE(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,16 +431,18 @@ acpi_pci_irq_enable (
|
|||||||
* First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
|
* First we check the PCI IRQ routing table (PRT) for an IRQ. PRT
|
||||||
* values override any BIOS-assigned IRQs set during boot.
|
* values override any BIOS-assigned IRQs set during boot.
|
||||||
*/
|
*/
|
||||||
irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
|
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
|
* If no PRT entry was found, we'll try to derive an IRQ from the
|
||||||
* device's parent bridge.
|
* device's parent bridge.
|
||||||
*/
|
*/
|
||||||
if (irq < 0)
|
if (irq < 0)
|
||||||
irq = acpi_pci_irq_derive(dev, pin, &edge_level,
|
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 /
|
* No IRQ known to the ACPI subsystem - maybe the BIOS /
|
||||||
@@ -464,18 +450,18 @@ acpi_pci_irq_enable (
|
|||||||
*/
|
*/
|
||||||
if (irq < 0) {
|
if (irq < 0) {
|
||||||
printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
|
printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI",
|
||||||
pci_name(dev), ('A' + pin));
|
pci_name(dev), ('A' + pin));
|
||||||
/* Interrupt Line values above 0xF are forbidden */
|
/* Interrupt Line values above 0xF are forbidden */
|
||||||
if (dev->irq > 0 && (dev->irq <= 0xF)) {
|
if (dev->irq > 0 && (dev->irq <= 0xF)) {
|
||||||
printk(" - using IRQ %d\n", dev->irq);
|
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);
|
return_VALUE(0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
printk("\n");
|
printk("\n");
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = acpi_register_gsi(irq, edge_level, active_high_low);
|
rc = acpi_register_gsi(irq, edge_level, active_high_low);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@@ -486,32 +472,31 @@ acpi_pci_irq_enable (
|
|||||||
dev->irq = rc;
|
dev->irq = rc;
|
||||||
|
|
||||||
printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ",
|
printk(KERN_INFO PREFIX "PCI Interrupt %s[%c] -> ",
|
||||||
pci_name(dev), 'A' + pin);
|
pci_name(dev), 'A' + pin);
|
||||||
|
|
||||||
if (link)
|
if (link)
|
||||||
printk("Link [%s] -> ", link);
|
printk("Link [%s] -> ", link);
|
||||||
|
|
||||||
printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
|
printk("GSI %u (%s, %s) -> IRQ %d\n", irq,
|
||||||
(edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
|
(edge_level == ACPI_LEVEL_SENSITIVE) ? "level" : "edge",
|
||||||
(active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high",
|
(active_high_low == ACPI_ACTIVE_LOW) ? "low" : "high", dev->irq);
|
||||||
dev->irq);
|
|
||||||
|
|
||||||
return_VALUE(0);
|
return_VALUE(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT_SYMBOL(acpi_pci_irq_enable);
|
EXPORT_SYMBOL(acpi_pci_irq_enable);
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: implement x86/x86_64 version */
|
/* 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)
|
|
||||||
{
|
{
|
||||||
int gsi = 0;
|
}
|
||||||
u8 pin = 0;
|
|
||||||
int edge_level = ACPI_LEVEL_SENSITIVE;
|
void acpi_pci_irq_disable(struct pci_dev *dev)
|
||||||
int active_high_low = ACPI_ACTIVE_LOW;
|
{
|
||||||
|
int gsi = 0;
|
||||||
|
u8 pin = 0;
|
||||||
|
int edge_level = ACPI_LEVEL_SENSITIVE;
|
||||||
|
int active_high_low = ACPI_ACTIVE_LOW;
|
||||||
|
|
||||||
ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
|
ACPI_FUNCTION_TRACE("acpi_pci_irq_disable");
|
||||||
|
|
||||||
@@ -529,15 +514,17 @@ acpi_pci_irq_disable (
|
|||||||
/*
|
/*
|
||||||
* First we check the PCI IRQ routing table (PRT) for an IRQ.
|
* First we check the PCI IRQ routing table (PRT) for an IRQ.
|
||||||
*/
|
*/
|
||||||
gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin,
|
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
|
* If no PRT entry was found, we'll try to derive an IRQ from the
|
||||||
* device's parent bridge.
|
* device's parent bridge.
|
||||||
*/
|
*/
|
||||||
if (gsi < 0)
|
if (gsi < 0)
|
||||||
gsi = acpi_pci_irq_derive(dev, pin,
|
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)
|
if (gsi < 0)
|
||||||
return_VOID;
|
return_VOID;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user