diff options
Diffstat (limited to 'drivers/acpi')
218 files changed, 4127 insertions, 2721 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 5eef4cb4f..82b96ee86 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -58,14 +58,25 @@ config ACPI_CCA_REQUIRED bool config ACPI_DEBUGGER - bool "AML debugger interface (EXPERIMENTAL)" + bool "AML debugger interface" select ACPI_DEBUG help - Enable in-kernel debugging of AML facilities: statistics, internal - object dump, single step control method execution. + Enable in-kernel debugging of AML facilities: statistics, + internal object dump, single step control method execution. This is still under development, currently enabling this only results in the compilation of the ACPICA debugger files. +if ACPI_DEBUGGER + +config ACPI_DEBUGGER_USER + tristate "Userspace debugger accessiblity" + depends on DEBUG_FS + help + Export /sys/kernel/debug/acpi/acpidbg for userspace utilities + to access the debugger functionalities. + +endif + config ACPI_SLEEP bool depends on SUSPEND || HIBERNATION diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 675eaf337..cb648a495 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -8,13 +8,13 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT # # ACPI Boot-Time Table Parsing # -obj-y += tables.o +obj-$(CONFIG_ACPI) += tables.o obj-$(CONFIG_X86) += blacklist.o # # ACPI Core Subsystem (Interpreter) # -obj-y += acpi.o \ +obj-$(CONFIG_ACPI) += acpi.o \ acpica/ # All the builtin files are in the "acpi." module_param namespace. @@ -66,10 +66,10 @@ obj-$(CONFIG_ACPI_FAN) += fan.o obj-$(CONFIG_ACPI_VIDEO) += video.o obj-$(CONFIG_ACPI_PCI_SLOT) += pci_slot.o obj-$(CONFIG_ACPI_PROCESSOR) += processor.o -obj-y += container.o +obj-$(CONFIG_ACPI) += container.o obj-$(CONFIG_ACPI_THERMAL) += thermal.o obj-$(CONFIG_ACPI_NFIT) += nfit.o -obj-y += acpi_memhotplug.o +obj-$(CONFIG_ACPI) += acpi_memhotplug.o obj-$(CONFIG_ACPI_HOTPLUG_IOAPIC) += ioapic.o obj-$(CONFIG_ACPI_BATTERY) += battery.o obj-$(CONFIG_ACPI_SBS) += sbshc.o @@ -79,6 +79,7 @@ obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o +obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o # processor has its own "processor." module_param namespace processor-y := processor_driver.o diff --git a/drivers/acpi/acpi_apd.c b/drivers/acpi/acpi_apd.c index a450e7af8..d507cf6de 100644 --- a/drivers/acpi/acpi_apd.c +++ b/drivers/acpi/acpi_apd.c @@ -51,7 +51,7 @@ struct apd_private_data { const struct apd_device_desc *dev_desc; }; -#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE +#if defined(CONFIG_X86_AMD_PLATFORM_DEVICE) || defined(CONFIG_ARM64) #define APD_ADDR(desc) ((unsigned long)&desc) static int acpi_apd_setup(struct apd_private_data *pdata) @@ -71,6 +71,7 @@ static int acpi_apd_setup(struct apd_private_data *pdata) return 0; } +#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE static struct apd_device_desc cz_i2c_desc = { .setup = acpi_apd_setup, .fixed_clk_rate = 133000000, @@ -80,6 +81,14 @@ static struct apd_device_desc cz_uart_desc = { .setup = acpi_apd_setup, .fixed_clk_rate = 48000000, }; +#endif + +#ifdef CONFIG_ARM64 +static struct apd_device_desc xgene_i2c_desc = { + .setup = acpi_apd_setup, + .fixed_clk_rate = 100000000, +}; +#endif #else @@ -132,9 +141,14 @@ static int acpi_apd_create_device(struct acpi_device *adev, static const struct acpi_device_id acpi_apd_device_ids[] = { /* Generic apd devices */ +#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE { "AMD0010", APD_ADDR(cz_i2c_desc) }, { "AMD0020", APD_ADDR(cz_uart_desc) }, { "AMD0030", }, +#endif +#ifdef CONFIG_ARM64 + { "APMC0D0F", APD_ADDR(xgene_i2c_desc) }, +#endif { } }; diff --git a/drivers/acpi/acpi_dbg.c b/drivers/acpi/acpi_dbg.c new file mode 100644 index 000000000..15e4604ef --- /dev/null +++ b/drivers/acpi/acpi_dbg.c @@ -0,0 +1,804 @@ +/* + * ACPI AML interfacing support + * + * Copyright (C) 2015, Intel Corporation + * Authors: Lv Zheng <lv.zheng@intel.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +/* #define DEBUG */ +#define pr_fmt(fmt) "ACPI : AML: " fmt + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/wait.h> +#include <linux/poll.h> +#include <linux/sched.h> +#include <linux/kthread.h> +#include <linux/proc_fs.h> +#include <linux/debugfs.h> +#include <linux/circ_buf.h> +#include <linux/acpi.h> +#include "internal.h" + +#define ACPI_AML_BUF_ALIGN (sizeof (acpi_size)) +#define ACPI_AML_BUF_SIZE PAGE_SIZE + +#define circ_count(circ) \ + (CIRC_CNT((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) +#define circ_count_to_end(circ) \ + (CIRC_CNT_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) +#define circ_space(circ) \ + (CIRC_SPACE((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) +#define circ_space_to_end(circ) \ + (CIRC_SPACE_TO_END((circ)->head, (circ)->tail, ACPI_AML_BUF_SIZE)) + +#define ACPI_AML_OPENED 0x0001 +#define ACPI_AML_CLOSED 0x0002 +#define ACPI_AML_IN_USER 0x0004 /* user space is writing cmd */ +#define ACPI_AML_IN_KERN 0x0008 /* kernel space is reading cmd */ +#define ACPI_AML_OUT_USER 0x0010 /* user space is reading log */ +#define ACPI_AML_OUT_KERN 0x0020 /* kernel space is writing log */ +#define ACPI_AML_USER (ACPI_AML_IN_USER | ACPI_AML_OUT_USER) +#define ACPI_AML_KERN (ACPI_AML_IN_KERN | ACPI_AML_OUT_KERN) +#define ACPI_AML_BUSY (ACPI_AML_USER | ACPI_AML_KERN) +#define ACPI_AML_OPEN (ACPI_AML_OPENED | ACPI_AML_CLOSED) + +struct acpi_aml_io { + wait_queue_head_t wait; + unsigned long flags; + unsigned long users; + struct mutex lock; + struct task_struct *thread; + char out_buf[ACPI_AML_BUF_SIZE] __aligned(ACPI_AML_BUF_ALIGN); + struct circ_buf out_crc; + char in_buf[ACPI_AML_BUF_SIZE] __aligned(ACPI_AML_BUF_ALIGN); + struct circ_buf in_crc; + acpi_osd_exec_callback function; + void *context; + unsigned long usages; +}; + +static struct acpi_aml_io acpi_aml_io; +static bool acpi_aml_initialized; +static struct file *acpi_aml_active_reader; +static struct dentry *acpi_aml_dentry; + +static inline bool __acpi_aml_running(void) +{ + return acpi_aml_io.thread ? true : false; +} + +static inline bool __acpi_aml_access_ok(unsigned long flag) +{ + /* + * The debugger interface is in opened state (OPENED && !CLOSED), + * then it is allowed to access the debugger buffers from either + * user space or the kernel space. + * In addition, for the kernel space, only the debugger thread + * (thread ID matched) is allowed to access. + */ + if (!(acpi_aml_io.flags & ACPI_AML_OPENED) || + (acpi_aml_io.flags & ACPI_AML_CLOSED) || + !__acpi_aml_running()) + return false; + if ((flag & ACPI_AML_KERN) && + current != acpi_aml_io.thread) + return false; + return true; +} + +static inline bool __acpi_aml_readable(struct circ_buf *circ, unsigned long flag) +{ + /* + * Another read is not in progress and there is data in buffer + * available for read. + */ + if (!(acpi_aml_io.flags & flag) && circ_count(circ)) + return true; + return false; +} + +static inline bool __acpi_aml_writable(struct circ_buf *circ, unsigned long flag) +{ + /* + * Another write is not in progress and there is buffer space + * available for write. + */ + if (!(acpi_aml_io.flags & flag) && circ_space(circ)) + return true; + return false; +} + +static inline bool __acpi_aml_busy(void) +{ + if (acpi_aml_io.flags & ACPI_AML_BUSY) + return true; + return false; +} + +static inline bool __acpi_aml_opened(void) +{ + if (acpi_aml_io.flags & ACPI_AML_OPEN) + return true; + return false; +} + +static inline bool __acpi_aml_used(void) +{ + return acpi_aml_io.usages ? true : false; +} + +static inline bool acpi_aml_running(void) +{ + bool ret; + + mutex_lock(&acpi_aml_io.lock); + ret = __acpi_aml_running(); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static bool acpi_aml_busy(void) +{ + bool ret; + + mutex_lock(&acpi_aml_io.lock); + ret = __acpi_aml_busy(); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static bool acpi_aml_used(void) +{ + bool ret; + + /* + * The usage count is prepared to avoid race conditions between the + * starts and the stops of the debugger thread. + */ + mutex_lock(&acpi_aml_io.lock); + ret = __acpi_aml_used(); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static bool acpi_aml_kern_readable(void) +{ + bool ret; + + mutex_lock(&acpi_aml_io.lock); + ret = !__acpi_aml_access_ok(ACPI_AML_IN_KERN) || + __acpi_aml_readable(&acpi_aml_io.in_crc, ACPI_AML_IN_KERN); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static bool acpi_aml_kern_writable(void) +{ + bool ret; + + mutex_lock(&acpi_aml_io.lock); + ret = !__acpi_aml_access_ok(ACPI_AML_OUT_KERN) || + __acpi_aml_writable(&acpi_aml_io.out_crc, ACPI_AML_OUT_KERN); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static bool acpi_aml_user_readable(void) +{ + bool ret; + + mutex_lock(&acpi_aml_io.lock); + ret = !__acpi_aml_access_ok(ACPI_AML_OUT_USER) || + __acpi_aml_readable(&acpi_aml_io.out_crc, ACPI_AML_OUT_USER); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static bool acpi_aml_user_writable(void) +{ + bool ret; + + mutex_lock(&acpi_aml_io.lock); + ret = !__acpi_aml_access_ok(ACPI_AML_IN_USER) || + __acpi_aml_writable(&acpi_aml_io.in_crc, ACPI_AML_IN_USER); + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static int acpi_aml_lock_write(struct circ_buf *circ, unsigned long flag) +{ + int ret = 0; + + mutex_lock(&acpi_aml_io.lock); + if (!__acpi_aml_access_ok(flag)) { + ret = -EFAULT; + goto out; + } + if (!__acpi_aml_writable(circ, flag)) { + ret = -EAGAIN; + goto out; + } + acpi_aml_io.flags |= flag; +out: + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static int acpi_aml_lock_read(struct circ_buf *circ, unsigned long flag) +{ + int ret = 0; + + mutex_lock(&acpi_aml_io.lock); + if (!__acpi_aml_access_ok(flag)) { + ret = -EFAULT; + goto out; + } + if (!__acpi_aml_readable(circ, flag)) { + ret = -EAGAIN; + goto out; + } + acpi_aml_io.flags |= flag; +out: + mutex_unlock(&acpi_aml_io.lock); + return ret; +} + +static void acpi_aml_unlock_fifo(unsigned long flag, bool wakeup) +{ + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.flags &= ~flag; + if (wakeup) + wake_up_interruptible(&acpi_aml_io.wait); + mutex_unlock(&acpi_aml_io.lock); +} + +static int acpi_aml_write_kern(const char *buf, int len) +{ + int ret; + struct circ_buf *crc = &acpi_aml_io.out_crc; + int n; + char *p; + + ret = acpi_aml_lock_write(crc, ACPI_AML_OUT_KERN); + if (IS_ERR_VALUE(ret)) + return ret; + /* sync tail before inserting logs */ + smp_mb(); + p = &crc->buf[crc->head]; + n = min(len, circ_space_to_end(crc)); + memcpy(p, buf, n); + /* sync head after inserting logs */ + smp_wmb(); + crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); + acpi_aml_unlock_fifo(ACPI_AML_OUT_KERN, true); + return n; +} + +static int acpi_aml_readb_kern(void) +{ + int ret; + struct circ_buf *crc = &acpi_aml_io.in_crc; + char *p; + + ret = acpi_aml_lock_read(crc, ACPI_AML_IN_KERN); + if (IS_ERR_VALUE(ret)) + return ret; + /* sync head before removing cmds */ + smp_rmb(); + p = &crc->buf[crc->tail]; + ret = (int)*p; + /* sync tail before inserting cmds */ + smp_mb(); + crc->tail = (crc->tail + 1) & (ACPI_AML_BUF_SIZE - 1); + acpi_aml_unlock_fifo(ACPI_AML_IN_KERN, true); + return ret; +} + +/* + * acpi_aml_write_log() - Capture debugger output + * @msg: the debugger output + * + * This function should be used to implement acpi_os_printf() to filter out + * the debugger output and store the output into the debugger interface + * buffer. Return the size of stored logs or errno. + */ +static ssize_t acpi_aml_write_log(const char *msg) +{ + int ret = 0; + int count = 0, size = 0; + + if (!acpi_aml_initialized) + return -ENODEV; + if (msg) + count = strlen(msg); + while (count > 0) { +again: + ret = acpi_aml_write_kern(msg + size, count); + if (ret == -EAGAIN) { + ret = wait_event_interruptible(acpi_aml_io.wait, + acpi_aml_kern_writable()); + /* + * We need to retry when the condition + * becomes true. + */ + if (ret == 0) + goto again; + break; + } + if (IS_ERR_VALUE(ret)) + break; + size += ret; + count -= ret; + } + return size > 0 ? size : ret; +} + +/* + * acpi_aml_read_cmd() - Capture debugger input + * @msg: the debugger input + * @size: the size of the debugger input + * + * This function should be used to implement acpi_os_get_line() to capture + * the debugger input commands and store the input commands into the + * debugger interface buffer. Return the size of stored commands or errno. + */ +static ssize_t acpi_aml_read_cmd(char *msg, size_t count) +{ + int ret = 0; + int size = 0; + + /* + * This is ensured by the running fact of the debugger thread + * unless a bug is introduced. + */ + BUG_ON(!acpi_aml_initialized); + while (count > 0) { +again: + /* + * Check each input byte to find the end of the command. + */ + ret = acpi_aml_readb_kern(); + if (ret == -EAGAIN) { + ret = wait_event_interruptible(acpi_aml_io.wait, + acpi_aml_kern_readable()); + /* + * We need to retry when the condition becomes + * true. + */ + if (ret == 0) + goto again; + } + if (IS_ERR_VALUE(ret)) + break; + *(msg + size) = (char)ret; + size++; + count--; + if (ret == '\n') { + /* + * acpi_os_get_line() requires a zero terminated command + * string. + */ + *(msg + size - 1) = '\0'; + break; + } + } + return size > 0 ? size : ret; +} + +static int acpi_aml_thread(void *unsed) +{ + acpi_osd_exec_callback function = NULL; + void *context; + + mutex_lock(&acpi_aml_io.lock); + if (acpi_aml_io.function) { + acpi_aml_io.usages++; + function = acpi_aml_io.function; + context = acpi_aml_io.context; + } + mutex_unlock(&acpi_aml_io.lock); + + if (function) + function(context); + + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.usages--; + if (!__acpi_aml_used()) { + acpi_aml_io.thread = NULL; + wake_up(&acpi_aml_io.wait); + } + mutex_unlock(&acpi_aml_io.lock); + + return 0; +} + +/* + * acpi_aml_create_thread() - Create AML debugger thread + * @function: the debugger thread callback + * @context: the context to be passed to the debugger thread + * + * This function should be used to implement acpi_os_execute() which is + * used by the ACPICA debugger to create the debugger thread. + */ +static int acpi_aml_create_thread(acpi_osd_exec_callback function, void *context) +{ + struct task_struct *t; + + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.function = function; + acpi_aml_io.context = context; + mutex_unlock(&acpi_aml_io.lock); + + t = kthread_create(acpi_aml_thread, NULL, "aml"); + if (IS_ERR(t)) { + pr_err("Failed to create AML debugger thread.\n"); + return PTR_ERR(t); + } + + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.thread = t; + acpi_set_debugger_thread_id((acpi_thread_id)(unsigned long)t); + wake_up_process(t); + mutex_unlock(&acpi_aml_io.lock); + return 0; +} + +static int acpi_aml_wait_command_ready(bool single_step, + char *buffer, size_t length) +{ + acpi_status status; + + if (single_step) + acpi_os_printf("\n%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); + else + acpi_os_printf("\n%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); + + status = acpi_os_get_line(buffer, length, NULL); + if (ACPI_FAILURE(status)) + return -EINVAL; + return 0; +} + +static int acpi_aml_notify_command_complete(void) +{ + return 0; +} + +static int acpi_aml_open(struct inode *inode, struct file *file) +{ + int ret = 0; + acpi_status status; + + mutex_lock(&acpi_aml_io.lock); + /* + * The debugger interface is being closed, no new user is allowed + * during this period. + */ + if (acpi_aml_io.flags & ACPI_AML_CLOSED) { + ret = -EBUSY; + goto err_lock; + } + if ((file->f_flags & O_ACCMODE) != O_WRONLY) { + /* + * Only one reader is allowed to initiate the debugger + * thread. + */ + if (acpi_aml_active_reader) { + ret = -EBUSY; + goto err_lock; + } else { + pr_debug("Opening debugger reader.\n"); + acpi_aml_active_reader = file; + } + } else { + /* + * No writer is allowed unless the debugger thread is + * ready. + */ + if (!(acpi_aml_io.flags & ACPI_AML_OPENED)) { + ret = -ENODEV; + goto err_lock; + } + } + if (acpi_aml_active_reader == file) { + pr_debug("Opening debugger interface.\n"); + mutex_unlock(&acpi_aml_io.lock); + + pr_debug("Initializing debugger thread.\n"); + status = acpi_initialize_debugger(); + if (ACPI_FAILURE(status)) { + pr_err("Failed to initialize debugger.\n"); + ret = -EINVAL; + goto err_exit; + } + pr_debug("Debugger thread initialized.\n"); + + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.flags |= ACPI_AML_OPENED; + acpi_aml_io.out_crc.head = acpi_aml_io.out_crc.tail = 0; + acpi_aml_io.in_crc.head = acpi_aml_io.in_crc.tail = 0; + pr_debug("Debugger interface opened.\n"); + } + acpi_aml_io.users++; +err_lock: + if (IS_ERR_VALUE(ret)) { + if (acpi_aml_active_reader == file) + acpi_aml_active_reader = NULL; + } + mutex_unlock(&acpi_aml_io.lock); +err_exit: + return ret; +} + +static int acpi_aml_release(struct inode *inode, struct file *file) +{ + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.users--; + if (file == acpi_aml_active_reader) { + pr_debug("Closing debugger reader.\n"); + acpi_aml_active_reader = NULL; + + pr_debug("Closing debugger interface.\n"); + acpi_aml_io.flags |= ACPI_AML_CLOSED; + + /* + * Wake up all user space/kernel space blocked + * readers/writers. + */ + wake_up_interruptible(&acpi_aml_io.wait); + mutex_unlock(&acpi_aml_io.lock); + /* + * Wait all user space/kernel space readers/writers to + * stop so that ACPICA command loop of the debugger thread + * should fail all its command line reads after this point. + */ + wait_event(acpi_aml_io.wait, !acpi_aml_busy()); + + /* + * Then we try to terminate the debugger thread if it is + * not terminated. + */ + pr_debug("Terminating debugger thread.\n"); + acpi_terminate_debugger(); + wait_event(acpi_aml_io.wait, !acpi_aml_used()); + pr_debug("Debugger thread terminated.\n"); + + mutex_lock(&acpi_aml_io.lock); + acpi_aml_io.flags &= ~ACPI_AML_OPENED; + } + if (acpi_aml_io.users == 0) { + pr_debug("Debugger interface closed.\n"); + acpi_aml_io.flags &= ~ACPI_AML_CLOSED; + } + mutex_unlock(&acpi_aml_io.lock); + return 0; +} + +static int acpi_aml_read_user(char __user *buf, int len) +{ + int ret; + struct circ_buf *crc = &acpi_aml_io.out_crc; + int n; + char *p; + + ret = acpi_aml_lock_read(crc, ACPI_AML_OUT_USER); + if (IS_ERR_VALUE(ret)) + return ret; + /* sync head before removing logs */ + smp_rmb(); + p = &crc->buf[crc->tail]; + n = min(len, circ_count_to_end(crc)); + if (copy_to_user(buf, p, n)) { + ret = -EFAULT; + goto out; + } + /* sync tail after removing logs */ + smp_mb(); + crc->tail = (crc->tail + n) & (ACPI_AML_BUF_SIZE - 1); + ret = n; +out: + acpi_aml_unlock_fifo(ACPI_AML_OUT_USER, !IS_ERR_VALUE(ret)); + return ret; +} + +static ssize_t acpi_aml_read(struct file *file, char __user *buf, + size_t count, loff_t *ppos) +{ + int ret = 0; + int size = 0; + + if (!count) + return 0; + if (!access_ok(VERIFY_WRITE, buf, count)) + return -EFAULT; + + while (count > 0) { +again: + ret = acpi_aml_read_user(buf + size, count); + if (ret == -EAGAIN) { + if (file->f_flags & O_NONBLOCK) + break; + else { + ret = wait_event_interruptible(acpi_aml_io.wait, + acpi_aml_user_readable()); + /* + * We need to retry when the condition + * becomes true. + */ + if (ret == 0) + goto again; + } + } + if (IS_ERR_VALUE(ret)) { + if (!acpi_aml_running()) + ret = 0; + break; + } + if (ret) { + size += ret; + count -= ret; + *ppos += ret; + break; + } + } + return size > 0 ? size : ret; +} + +static int acpi_aml_write_user(const char __user *buf, int len) +{ + int ret; + struct circ_buf *crc = &acpi_aml_io.in_crc; + int n; + char *p; + + ret = acpi_aml_lock_write(crc, ACPI_AML_IN_USER); + if (IS_ERR_VALUE(ret)) + return ret; + /* sync tail before inserting cmds */ + smp_mb(); + p = &crc->buf[crc->head]; + n = min(len, circ_space_to_end(crc)); + if (copy_from_user(p, buf, n)) { + ret = -EFAULT; + goto out; + } + /* sync head after inserting cmds */ + smp_wmb(); + crc->head = (crc->head + n) & (ACPI_AML_BUF_SIZE - 1); + ret = n; +out: + acpi_aml_unlock_fifo(ACPI_AML_IN_USER, !IS_ERR_VALUE(ret)); + return n; +} + +static ssize_t acpi_aml_write(struct file *file, const char __user *buf, + size_t count, loff_t *ppos) +{ + int ret = 0; + int size = 0; + + if (!count) + return 0; + if (!access_ok(VERIFY_READ, buf, count)) + return -EFAULT; + + while (count > 0) { +again: + ret = acpi_aml_write_user(buf + size, count); + if (ret == -EAGAIN) { + if (file->f_flags & O_NONBLOCK) + break; + else { + ret = wait_event_interruptible(acpi_aml_io.wait, + acpi_aml_user_writable()); + /* + * We need to retry when the condition + * becomes true. + */ + if (ret == 0) + goto again; + } + } + if (IS_ERR_VALUE(ret)) { + if (!acpi_aml_running()) + ret = 0; + break; + } + if (ret) { + size += ret; + count -= ret; + *ppos += ret; + } + } + return size > 0 ? size : ret; +} + +static unsigned int acpi_aml_poll(struct file *file, poll_table *wait) +{ + int masks = 0; + + poll_wait(file, &acpi_aml_io.wait, wait); + if (acpi_aml_user_readable()) + masks |= POLLIN | POLLRDNORM; + if (acpi_aml_user_writable()) + masks |= POLLOUT | POLLWRNORM; + + return masks; +} + +static const struct file_operations acpi_aml_operations = { + .read = acpi_aml_read, + .write = acpi_aml_write, + .poll = acpi_aml_poll, + .open = acpi_aml_open, + .release = acpi_aml_release, + .llseek = generic_file_llseek, +}; + +static const struct acpi_debugger_ops acpi_aml_debugger = { + .create_thread = acpi_aml_create_thread, + .read_cmd = acpi_aml_read_cmd, + .write_log = acpi_aml_write_log, + .wait_command_ready = acpi_aml_wait_command_ready, + .notify_command_complete = acpi_aml_notify_command_complete, +}; + +int __init acpi_aml_init(void) +{ + int ret = 0; + + if (!acpi_debugfs_dir) { + ret = -ENOENT; + goto err_exit; + } + + /* Initialize AML IO interface */ + mutex_init(&acpi_aml_io.lock); + init_waitqueue_head(&acpi_aml_io.wait); + acpi_aml_io.out_crc.buf = acpi_aml_io.out_buf; + acpi_aml_io.in_crc.buf = acpi_aml_io.in_buf; + acpi_aml_dentry = debugfs_create_file("acpidbg", + S_IFREG | S_IRUGO | S_IWUSR, + acpi_debugfs_dir, NULL, + &acpi_aml_operations); + if (acpi_aml_dentry == NULL) { + ret = -ENODEV; + goto err_exit; + } + ret = acpi_register_debugger(THIS_MODULE, &acpi_aml_debugger); + if (ret) + goto err_fs; + acpi_aml_initialized = true; + +err_fs: + if (ret) { + debugfs_remove(acpi_aml_dentry); + acpi_aml_dentry = NULL; + } +err_exit: + return ret; +} + +void __exit acpi_aml_exit(void) +{ + if (acpi_aml_initialized) { + acpi_unregister_debugger(&acpi_aml_debugger); + if (acpi_aml_dentry) { + debugfs_remove(acpi_aml_dentry); + acpi_aml_dentry = NULL; + } + acpi_aml_initialized = false; + } +} + +module_init(acpi_aml_init); +module_exit(acpi_aml_exit); + +MODULE_AUTHOR("Lv Zheng"); +MODULE_DESCRIPTION("ACPI debugger userspace IO driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index f9e0d09f7..0872d5fec 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -15,8 +15,10 @@ #include <linux/clk-provider.h> #include <linux/err.h> #include <linux/io.h> +#include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/platform_data/clk-lpss.h> +#include <linux/pm_domain.h> #include <linux/pm_runtime.h> #include <linux/delay.h> @@ -26,6 +28,10 @@ ACPI_MODULE_NAME("acpi_lpss"); #ifdef CONFIG_X86_INTEL_LPSS +#include <asm/cpu_device_id.h> +#include <asm/iosf_mbi.h> +#include <asm/pmc_atom.h> + #define LPSS_ADDR(desc) ((unsigned long)&desc) #define LPSS_CLK_SIZE 0x04 @@ -71,7 +77,7 @@ struct lpss_device_desc { void (*setup)(struct lpss_private_data *pdata); }; -static struct lpss_device_desc lpss_dma_desc = { +static const struct lpss_device_desc lpss_dma_desc = { .flags = LPSS_CLK, }; @@ -84,6 +90,23 @@ struct lpss_private_data { u32 prv_reg_ctx[LPSS_PRV_REG_COUNT]; }; +/* LPSS run time quirks */ +static unsigned int lpss_quirks; + +/* + * LPSS_QUIRK_ALWAYS_POWER_ON: override power state for LPSS DMA device. + * + * The LPSS DMA controller has neither _PS0 nor _PS3 method. Moreover + * it can be powered off automatically whenever the last LPSS device goes down. + * In case of no power any access to the DMA controller will hang the system. + * The behaviour is reproduced on some HP laptops based on Intel BayTrail as + * well as on ASuS T100TA transformer. + * + * This quirk overrides power state of entire LPSS island to keep DMA powered + * on whenever we have at least one other device in use. + */ +#define LPSS_QUIRK_ALWAYS_POWER_ON BIT(0) + /* UART Component Parameter Register */ #define LPSS_UART_CPR 0xF4 #define LPSS_UART_CPR_AFCE BIT(4) @@ -196,13 +219,21 @@ static const struct lpss_device_desc bsw_i2c_dev_desc = { .setup = byt_i2c_setup, }; -static struct lpss_device_desc bsw_spi_dev_desc = { +static const struct lpss_device_desc bsw_spi_dev_desc = { .flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_SAVE_CTX | LPSS_NO_D3_DELAY, .prv_offset = 0x400, .setup = lpss_deassert_reset, }; +#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } + +static const struct x86_cpu_id lpss_cpu_ids[] = { + ICPU(0x37), /* Valleyview, Bay Trail */ + ICPU(0x4c), /* Braswell, Cherry Trail */ + {} +}; + #else #define LPSS_ADDR(desc) (0UL) @@ -574,6 +605,17 @@ static void acpi_lpss_restore_ctx(struct device *dev, { unsigned int i; + for (i = 0; i < LPSS_PRV_REG_COUNT; i++) { + unsigned long offset = i * sizeof(u32); + + __lpss_reg_write(pdata->prv_reg_ctx[i], pdata, offset); + dev_dbg(dev, "restoring 0x%08x to LPSS reg at offset 0x%02lx\n", + pdata->prv_reg_ctx[i], offset); + } +} + +static void acpi_lpss_d3_to_d0_delay(struct lpss_private_data *pdata) +{ /* * The following delay is needed or the subsequent write operations may * fail. The LPSS devices are actually PCI devices and the PCI spec @@ -586,14 +628,34 @@ static void acpi_lpss_restore_ctx(struct device *dev, delay = 0; msleep(delay); +} - for (i = 0; i < LPSS_PRV_REG_COUNT; i++) { - unsigned long offset = i * sizeof(u32); +static int acpi_lpss_activate(struct device *dev) +{ + struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); + int ret; - __lpss_reg_write(pdata->prv_reg_ctx[i], pdata, offset); - dev_dbg(dev, "restoring 0x%08x to LPSS reg at offset 0x%02lx\n", - pdata->prv_reg_ctx[i], offset); - } + ret = acpi_dev_runtime_resume(dev); + if (ret) + return ret; + + acpi_lpss_d3_to_d0_delay(pdata); + + /* + * This is called only on ->probe() stage where a device is either in + * known state defined by BIOS or most likely powered off. Due to this + * we have to deassert reset line to be sure that ->probe() will + * recognize the device. + */ + if (pdata->dev_desc->flags & LPSS_SAVE_CTX) + lpss_deassert_reset(pdata); + + return 0; +} + +static void acpi_lpss_dismiss(struct device *dev) +{ + acpi_dev_runtime_suspend(dev); } #ifdef CONFIG_PM_SLEEP @@ -621,6 +683,8 @@ static int acpi_lpss_resume_early(struct device *dev) if (ret) return ret; + acpi_lpss_d3_to_d0_delay(pdata); + if (pdata->dev_desc->flags & LPSS_SAVE_CTX) acpi_lpss_restore_ctx(dev, pdata); @@ -628,6 +692,89 @@ static int acpi_lpss_resume_early(struct device *dev) } #endif /* CONFIG_PM_SLEEP */ +/* IOSF SB for LPSS island */ +#define LPSS_IOSF_UNIT_LPIOEP 0xA0 +#define LPSS_IOSF_UNIT_LPIO1 0xAB +#define LPSS_IOSF_UNIT_LPIO2 0xAC + +#define LPSS_IOSF_PMCSR 0x84 +#define LPSS_PMCSR_D0 0 +#define LPSS_PMCSR_D3hot 3 +#define LPSS_PMCSR_Dx_MASK GENMASK(1, 0) + +#define LPSS_IOSF_GPIODEF0 0x154 +#define LPSS_GPIODEF0_DMA1_D3 BIT(2) +#define LPSS_GPIODEF0_DMA2_D3 BIT(3) +#define LPSS_GPIODEF0_DMA_D3_MASK GENMASK(3, 2) + +static DEFINE_MUTEX(lpss_iosf_mutex); + +static void lpss_iosf_enter_d3_state(void) +{ + u32 value1 = 0; + u32 mask1 = LPSS_GPIODEF0_DMA_D3_MASK; + u32 value2 = LPSS_PMCSR_D3hot; + u32 mask2 = LPSS_PMCSR_Dx_MASK; + /* + * PMC provides an information about actual status of the LPSS devices. + * Here we read the values related to LPSS power island, i.e. LPSS + * devices, excluding both LPSS DMA controllers, along with SCC domain. + */ + u32 func_dis, d3_sts_0, pmc_status, pmc_mask = 0xfe000ffe; + int ret; + + ret = pmc_atom_read(PMC_FUNC_DIS, &func_dis); + if (ret) + return; + + mutex_lock(&lpss_iosf_mutex); + + ret = pmc_atom_read(PMC_D3_STS_0, &d3_sts_0); + if (ret) + goto exit; + + /* + * Get the status of entire LPSS power island per device basis. + * Shutdown both LPSS DMA controllers if and only if all other devices + * are already in D3hot. + */ + pmc_status = (~(d3_sts_0 | func_dis)) & pmc_mask; + if (pmc_status) + goto exit; + + iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE, + LPSS_IOSF_PMCSR, value2, mask2); + + iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO2, MBI_CFG_WRITE, + LPSS_IOSF_PMCSR, value2, mask2); + + iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, + LPSS_IOSF_GPIODEF0, value1, mask1); +exit: + mutex_unlock(&lpss_iosf_mutex); +} + +static void lpss_iosf_exit_d3_state(void) +{ + u32 value1 = LPSS_GPIODEF0_DMA1_D3 | LPSS_GPIODEF0_DMA2_D3; + u32 mask1 = LPSS_GPIODEF0_DMA_D3_MASK; + u32 value2 = LPSS_PMCSR_D0; + u32 mask2 = LPSS_PMCSR_Dx_MASK; + + mutex_lock(&lpss_iosf_mutex); + + iosf_mbi_modify(LPSS_IOSF_UNIT_LPIOEP, MBI_CR_WRITE, + LPSS_IOSF_GPIODEF0, value1, mask1); + + iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO2, MBI_CFG_WRITE, + LPSS_IOSF_PMCSR, value2, mask2); + + iosf_mbi_modify(LPSS_IOSF_UNIT_LPIO1, MBI_CFG_WRITE, + LPSS_IOSF_PMCSR, value2, mask2); + + mutex_unlock(&lpss_iosf_mutex); +} + static int acpi_lpss_runtime_suspend(struct device *dev) { struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); @@ -640,7 +787,17 @@ static int acpi_lpss_runtime_suspend(struct device *dev) if (pdata->dev_desc->flags & LPSS_SAVE_CTX) acpi_lpss_save_ctx(dev, pdata); - return acpi_dev_runtime_suspend(dev); + ret = acpi_dev_runtime_suspend(dev); + + /* + * This call must be last in the sequence, otherwise PMC will return + * wrong status for devices being about to be powered off. See + * lpss_iosf_enter_d3_state() for further information. + */ + if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) + lpss_iosf_enter_d3_state(); + + return ret; } static int acpi_lpss_runtime_resume(struct device *dev) @@ -648,10 +805,19 @@ static int acpi_lpss_runtime_resume(struct device *dev) struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev)); int ret; + /* + * This call is kept first to be in symmetry with + * acpi_lpss_runtime_suspend() one. + */ + if (lpss_quirks & LPSS_QUIRK_ALWAYS_POWER_ON && iosf_mbi_available()) + lpss_iosf_exit_d3_state(); + ret = acpi_dev_runtime_resume(dev); if (ret) return ret; + acpi_lpss_d3_to_d0_delay(pdata); + if (pdata->dev_desc->flags & LPSS_SAVE_CTX) acpi_lpss_restore_ctx(dev, pdata); @@ -660,6 +826,10 @@ static int acpi_lpss_runtime_resume(struct device *dev) #endif /* CONFIG_PM */ static struct dev_pm_domain acpi_lpss_pm_domain = { +#ifdef CONFIG_PM + .activate = acpi_lpss_activate, + .dismiss = acpi_lpss_dismiss, +#endif .ops = { #ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP @@ -705,8 +875,15 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, } switch (action) { + case BUS_NOTIFY_BIND_DRIVER: + dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain); + break; + case BUS_NOTIFY_DRIVER_NOT_BOUND: + case BUS_NOTIFY_UNBOUND_DRIVER: + dev_pm_domain_set(&pdev->dev, NULL); + break; case BUS_NOTIFY_ADD_DEVICE: - pdev->dev.pm_domain = &acpi_lpss_pm_domain; + dev_pm_domain_set(&pdev->dev, &acpi_lpss_pm_domain); if (pdata->dev_desc->flags & LPSS_LTR) return sysfs_create_group(&pdev->dev.kobj, &lpss_attr_group); @@ -714,7 +891,7 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, case BUS_NOTIFY_DEL_DEVICE: if (pdata->dev_desc->flags & LPSS_LTR) sysfs_remove_group(&pdev->dev.kobj, &lpss_attr_group); - pdev->dev.pm_domain = NULL; + dev_pm_domain_set(&pdev->dev, NULL); break; default: break; @@ -754,10 +931,19 @@ static struct acpi_scan_handler lpss_handler = { void __init acpi_lpss_init(void) { - if (!lpt_clk_init()) { - bus_register_notifier(&platform_bus_type, &acpi_lpss_nb); - acpi_scan_add_handler(&lpss_handler); - } + const struct x86_cpu_id *id; + int ret; + + ret = lpt_clk_init(); + if (ret) + return; + + id = x86_match_cpu(lpss_cpu_ids); + if (id) + lpss_quirks |= LPSS_QUIRK_ALWAYS_POWER_ON; + + bus_register_notifier(&platform_bus_type, &acpi_lpss_nb); + acpi_scan_add_handler(&lpss_handler); } #else diff --git a/drivers/acpi/acpi_pnp.c b/drivers/acpi/acpi_pnp.c index 48fc3ad13..67d97c009 100644 --- a/drivers/acpi/acpi_pnp.c +++ b/drivers/acpi/acpi_pnp.c @@ -367,7 +367,7 @@ static struct acpi_scan_handler acpi_pnp_handler = { */ static int is_cmos_rtc_device(struct acpi_device *adev) { - struct acpi_device_id ids[] = { + static const struct acpi_device_id ids[] = { { "PNP0B00" }, { "PNP0B01" }, { "PNP0B02" }, diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 5fdac3942..a76f8be1b 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -77,6 +77,13 @@ module_param(allow_duplicates, bool, 0644); static int disable_backlight_sysfs_if = -1; module_param(disable_backlight_sysfs_if, int, 0444); +#define REPORT_OUTPUT_KEY_EVENTS 0x01 +#define REPORT_BRIGHTNESS_KEY_EVENTS 0x02 +static int report_key_events = -1; +module_param(report_key_events, int, 0644); +MODULE_PARM_DESC(report_key_events, + "0: none, 1: output changes, 2: brightness changes, 3: all"); + static bool device_id_scheme = false; module_param(device_id_scheme, bool, 0444); @@ -85,8 +92,8 @@ module_param(only_lcd, bool, 0444); static int register_count; static DEFINE_MUTEX(register_count_mutex); -static struct mutex video_list_lock; -static struct list_head video_bus_head; +static DEFINE_MUTEX(video_list_lock); +static LIST_HEAD(video_bus_head); static int acpi_video_bus_add(struct acpi_device *device); static int acpi_video_bus_remove(struct acpi_device *device); static void acpi_video_bus_notify(struct acpi_device *device, u32 event); @@ -412,6 +419,13 @@ static int video_enable_only_lcd(const struct dmi_system_id *d) return 0; } +static int video_set_report_key_events(const struct dmi_system_id *id) +{ + if (report_key_events == -1) + report_key_events = (uintptr_t)id->driver_data; + return 0; +} + static struct dmi_system_id video_dmi_table[] = { /* * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 @@ -518,6 +532,24 @@ static struct dmi_system_id video_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "ESPRIMO Mobile M9410"), }, }, + /* + * Some machines report wrong key events on the acpi-bus, suppress + * key event reporting on these. Note this is only intended to work + * around events which are plain wrong. In some cases we get double + * events, in this case acpi-video is considered the canonical source + * and the events from the other source should be filtered. E.g. + * by calling acpi_video_handles_brightness_key_presses() from the + * vendor acpi/wmi driver or by using /lib/udev/hwdb.d/60-keyboard.hwdb + */ + { + .callback = video_set_report_key_events, + .driver_data = (void *)((uintptr_t)REPORT_OUTPUT_KEY_EVENTS), + .ident = "Dell Vostro V131", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), + }, + }, {} }; @@ -1498,7 +1530,7 @@ static void acpi_video_bus_notify(struct acpi_device *device, u32 event) /* Something vetoed the keypress. */ keycode = 0; - if (keycode) { + if (keycode && (report_key_events & REPORT_OUTPUT_KEY_EVENTS)) { input_report_key(input, keycode, 1); input_sync(input); input_report_key(input, keycode, 0); @@ -1562,7 +1594,7 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) acpi_notifier_call_chain(device, event, 0); - if (keycode) { + if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) { input_report_key(input, keycode, 1); input_sync(input); input_report_key(input, keycode, 0); @@ -2044,9 +2076,6 @@ int acpi_video_register(void) goto leave; } - mutex_init(&video_list_lock); - INIT_LIST_HEAD(&video_bus_head); - dmi_check_system(video_dmi_table); ret = acpi_bus_register_driver(&acpi_video_bus); @@ -2090,6 +2119,19 @@ void acpi_video_unregister_backlight(void) mutex_unlock(®ister_count_mutex); } +bool acpi_video_handles_brightness_key_presses(void) +{ + bool have_video_busses; + + mutex_lock(&video_list_lock); + have_video_busses = !list_empty(&video_bus_head); + mutex_unlock(&video_list_lock); + + return have_video_busses && + (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS); +} +EXPORT_SYMBOL(acpi_video_handles_brightness_key_presses); + /* * This is kind of nasty. Hardware using Intel chipsets may require * the video opregion code to be run first in order to initialise diff --git a/drivers/acpi/acpica/Makefile b/drivers/acpi/acpica/Makefile index 885936f79..f682374c1 100644 --- a/drivers/acpi/acpica/Makefile +++ b/drivers/acpi/acpica/Makefile @@ -50,6 +50,7 @@ acpi-y += \ exdump.o \ exfield.o \ exfldio.o \ + exmisc.o \ exmutex.o \ exnames.o \ exoparg1.o \ @@ -57,7 +58,6 @@ acpi-y += \ exoparg3.o \ exoparg6.o \ exprep.o \ - exmisc.o \ exregion.o \ exresnte.o \ exresolv.o \ @@ -66,6 +66,7 @@ acpi-y += \ exstoren.o \ exstorob.o \ exsystem.o \ + extrace.o \ exutils.o acpi-y += \ @@ -196,7 +197,6 @@ acpi-$(ACPI_FUTURE_USAGE) += \ dbfileio.o \ dbtest.o \ utcache.o \ - utfileio.o \ utprint.o \ uttrack.o \ utuuid.o diff --git a/drivers/acpi/acpica/acapps.h b/drivers/acpi/acpica/acapps.h index e4cc48fbf..ca2c06071 100644 --- a/drivers/acpi/acpica/acapps.h +++ b/drivers/acpi/acpica/acapps.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,10 +44,12 @@ #ifndef _ACAPPS #define _ACAPPS +#include <stdio.h> + /* Common info for tool signons */ #define ACPICA_NAME "Intel ACPI Component Architecture" -#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2015 Intel Corporation" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2016 Intel Corporation" #if ACPI_MACHINE_WIDTH == 64 #define ACPI_WIDTH "-64" @@ -85,11 +87,40 @@ acpi_os_printf (description); #define ACPI_OPTION(name, description) \ - acpi_os_printf (" %-18s%s\n", name, description); + acpi_os_printf (" %-20s%s\n", name, description); + +/* Check for unexpected exceptions */ + +#define ACPI_CHECK_STATUS(name, status, expected) \ + if (status != expected) \ + { \ + acpi_os_printf ("Unexpected %s from %s (%s-%d)\n", \ + acpi_format_exception (status), #name, _acpi_module_name, __LINE__); \ + } + +/* Check for unexpected non-AE_OK errors */ + +#define ACPI_CHECK_OK(name, status) ACPI_CHECK_STATUS (name, status, AE_OK); #define FILE_SUFFIX_DISASSEMBLY "dsl" #define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */ +/* acfileio */ + +acpi_status +ac_get_all_tables_from_file(char *filename, + u8 get_only_aml_tables, + struct acpi_new_table_desc **return_list_head); + +u8 ac_is_file_binary(FILE * file); + +acpi_status ac_validate_table_header(FILE * file, long table_offset); + +/* Values for get_only_aml_tables */ + +#define ACPI_GET_ONLY_AML_TABLES TRUE +#define ACPI_GET_ALL_TABLES FALSE + /* * getopt */ @@ -107,30 +138,6 @@ extern char *acpi_gbl_optarg; */ u32 cm_get_file_size(ACPI_FILE file); -#ifndef ACPI_DUMP_APP -/* - * adisasm - */ -acpi_status -ad_aml_disassemble(u8 out_to_file, - char *filename, char *prefix, char **out_filename); - -void ad_print_statistics(void); - -acpi_status ad_find_dsdt(u8 **dsdt_ptr, u32 *dsdt_length); - -void ad_dump_tables(void); - -acpi_status ad_get_local_tables(void); - -acpi_status -ad_parse_table(struct acpi_table_header *table, - acpi_owner_id * owner_id, u8 load_table, u8 external); - -acpi_status ad_display_tables(char *filename, struct acpi_table_header *table); - -acpi_status ad_display_statistics(void); - /* * adwalk */ @@ -168,6 +175,5 @@ char *ad_generate_filename(char *prefix, char *table_id); void ad_write_table(struct acpi_table_header *table, u32 length, char *table_name, char *oem_table_id); -#endif #endif /* _ACAPPS */ diff --git a/drivers/acpi/acpica/accommon.h b/drivers/acpi/acpica/accommon.h index a8d8092ee..19d6ec815 100644 --- a/drivers/acpi/acpica/accommon.h +++ b/drivers/acpi/acpica/accommon.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index c928ba494..993af9eb0 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,9 +80,15 @@ struct acpi_db_execute_walk { /* * dbxface - external debugger interfaces */ -acpi_status -acpi_db_single_step(struct acpi_walk_state *walk_state, - union acpi_parse_object *op, u32 op_type); +ACPI_DBR_DEPENDENT_RETURN_OK(acpi_status + acpi_db_single_step(struct acpi_walk_state + *walk_state, + union acpi_parse_object *op, + u32 op_type)) + ACPI_DBR_DEPENDENT_RETURN_VOID(void + acpi_db_signal_break_point(struct + acpi_walk_state + *walk_state)) /* * dbcmds - debug commands and output routines @@ -182,11 +188,15 @@ void acpi_db_display_method_info(union acpi_parse_object *op); void acpi_db_decode_and_display_object(char *target, char *output_type); -void -acpi_db_display_result_object(union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +ACPI_DBR_DEPENDENT_RETURN_VOID(void + acpi_db_display_result_object(union + acpi_operand_object + *obj_desc, + struct + acpi_walk_state + *walk_state)) -acpi_status acpi_db_display_all_methods(char *display_count_arg); + acpi_status acpi_db_display_all_methods(char *display_count_arg); void acpi_db_display_arguments(void); @@ -198,9 +208,13 @@ void acpi_db_display_calling_tree(void); void acpi_db_display_object_type(char *object_arg); -void -acpi_db_display_argument_object(union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state); +ACPI_DBR_DEPENDENT_RETURN_VOID(void + acpi_db_display_argument_object(union + acpi_operand_object + *obj_desc, + struct + acpi_walk_state + *walk_state)) /* * dbexec - debugger control method execution @@ -231,10 +245,7 @@ void acpi_db_open_debug_file(char *name); acpi_status acpi_db_load_acpi_table(char *filename); -acpi_status -acpi_db_get_table_from_file(char *filename, - struct acpi_table_header **table, - u8 must_be_aml_table); +acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head); /* * dbhistry - debugger HISTORY command @@ -257,7 +268,7 @@ acpi_db_command_dispatch(char *input_buffer, void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context); -acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op); +acpi_status acpi_db_user_commands(void); char *acpi_db_get_next_token(char *string, char **next, acpi_object_type * return_type); diff --git a/drivers/acpi/acpica/acdispat.h b/drivers/acpi/acpica/acdispat.h index 7094dc89e..dcd48bfed 100644 --- a/drivers/acpi/acpica/acdispat.h +++ b/drivers/acpi/acpica/acdispat.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 228704b78..010cf81ba 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -161,6 +161,11 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, /* * evhandler - Address space handling */ +union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type + space_id, + union acpi_operand_object + *handler_obj); + u8 acpi_ev_has_default_handler(struct acpi_namespace_node *node, acpi_adr_space_type space_id); @@ -193,9 +198,11 @@ void acpi_ev_detach_region(union acpi_operand_object *region_obj, u8 acpi_ns_is_locked); -acpi_status +void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj); + +void acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, - acpi_adr_space_type space_id); + acpi_adr_space_type space_id, u32 function); acpi_status acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index faa97604d..55c819703 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -145,6 +145,7 @@ ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache); ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0); ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE); +ACPI_INIT_GLOBAL(u8, acpi_gbl_early_initialization, TRUE); /* Global handlers */ @@ -164,7 +165,7 @@ ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset); /* Initialization sequencing */ -ACPI_GLOBAL(u8, acpi_gbl_reg_methods_executed); +ACPI_INIT_GLOBAL(u8, acpi_gbl_reg_methods_enabled, FALSE); /* Misc */ @@ -326,7 +327,6 @@ ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list); #ifdef ACPI_DEBUGGER ACPI_INIT_GLOBAL(u8, acpi_gbl_abort_method, FALSE); -ACPI_INIT_GLOBAL(u8, acpi_gbl_method_executing, FALSE); ACPI_INIT_GLOBAL(acpi_thread_id, acpi_gbl_db_thread_id, ACPI_INVALID_THREAD_ID); ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_ini_methods); @@ -345,7 +345,6 @@ ACPI_GLOBAL(acpi_object_type, acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]); /* These buffers should all be the same size */ -ACPI_GLOBAL(char, acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]); ACPI_GLOBAL(char, acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]); ACPI_GLOBAL(char, acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]); ACPI_GLOBAL(char, acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]); @@ -360,9 +359,6 @@ ACPI_GLOBAL(u16, acpi_gbl_node_type_count_misc); ACPI_GLOBAL(u32, acpi_gbl_num_nodes); ACPI_GLOBAL(u32, acpi_gbl_num_objects); -ACPI_GLOBAL(acpi_mutex, acpi_gbl_db_command_ready); -ACPI_GLOBAL(acpi_mutex, acpi_gbl_db_command_complete); - #endif /* ACPI_DEBUGGER */ /***************************************************************************** diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h index 196a55244..27addcf50 100644 --- a/drivers/acpi/acpica/achware.h +++ b/drivers/acpi/acpica/achware.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/acinterp.h b/drivers/acpi/acpica/acinterp.h index e9e936e78..bae1a35c3 100644 --- a/drivers/acpi/acpica/acinterp.h +++ b/drivers/acpi/acpica/acinterp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index e1dd784d8..e4977fac9 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -219,6 +219,13 @@ struct acpi_table_list { #define ACPI_ROOT_ORIGIN_ALLOCATED (1) #define ACPI_ROOT_ALLOW_RESIZE (2) +/* List to manage incoming ACPI tables */ + +struct acpi_new_table_desc { + struct acpi_table_header *table; + struct acpi_new_table_desc *next; +}; + /* Predefined table indexes */ #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF) @@ -388,7 +395,8 @@ union acpi_predefined_info { /* Return object auto-repair info */ -typedef acpi_status(*acpi_object_converter) (union acpi_operand_object +typedef acpi_status(*acpi_object_converter) (struct acpi_namespace_node * scope, + union acpi_operand_object *original_object, union acpi_operand_object **converted_object); @@ -420,6 +428,7 @@ struct acpi_simple_repair_info { struct acpi_reg_walk_info { acpi_adr_space_type space_id; + u32 function; u32 reg_run_count; }; @@ -861,6 +870,7 @@ struct acpi_parse_state { #define ACPI_PARSEOP_CLOSING_PAREN 0x10 #define ACPI_PARSEOP_COMPOUND 0x20 #define ACPI_PARSEOP_ASSIGNMENT 0x40 +#define ACPI_PARSEOP_ELSEIF 0x80 /***************************************************************************** * diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index e85366ceb..411c18b7d 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -401,17 +401,6 @@ #endif /* - * Some code only gets executed when the debugger is built in. - * Note that this is entirely independent of whether the - * DEBUG_PRINT stuff (set by ACPI_DEBUG_OUTPUT) is on, or not. - */ -#ifdef ACPI_DEBUGGER -#define ACPI_DEBUGGER_EXEC(a) a -#else -#define ACPI_DEBUGGER_EXEC(a) -#endif - -/* * Macros used for ACPICA utilities only */ diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index 5d261c942..9684ed612 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ /* Object is not a package element */ #define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX +#define ACPI_ALL_PACKAGE_ELEMENTS (ACPI_UINT32_MAX-1) /* Always emit warning message, not dependent on node flags */ @@ -183,13 +184,20 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, union acpi_operand_object **return_object); acpi_status -acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, +acpi_ns_convert_to_unicode(struct acpi_namespace_node *scope, + union acpi_operand_object *original_object, union acpi_operand_object **return_object); acpi_status -acpi_ns_convert_to_resource(union acpi_operand_object *original_object, +acpi_ns_convert_to_resource(struct acpi_namespace_node *scope, + union acpi_operand_object *original_object, union acpi_operand_object **return_object); +acpi_status +acpi_ns_convert_to_reference(struct acpi_namespace_node *scope, + union acpi_operand_object *original_object, + union acpi_operand_object **return_object); + /* * nsdump - Namespace dump/print utilities */ diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 0bd02c4a5..094b04267 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,9 +93,10 @@ #define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ #define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ #define AOPOBJ_DATA_VALID 0x04 /* Object is initialized and data is valid */ -#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ -#define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ -#define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ +#define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized */ +#define AOPOBJ_REG_CONNECTED 0x10 /* _REG was run */ +#define AOPOBJ_SETUP_COMPLETE 0x20 /* Region setup is complete */ +#define AOPOBJ_INVALID 0x40 /* Host OS won't allow a Region address */ /****************************************************************************** * diff --git a/drivers/acpi/acpica/acopcode.h b/drivers/acpi/acpica/acopcode.h index f9acf92fa..ca4bda1a6 100644 --- a/drivers/acpi/acpica/acopcode.h +++ b/drivers/acpi/acpica/acopcode.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,7 +92,7 @@ #define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING) #define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME) +#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_NAME_OR_REF,ARGP_TARGET) #define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) #define ARGP_CONTINUE_OP ARG_NONE #define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME) @@ -152,13 +152,14 @@ #define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING) #define ARGP_NOOP_OP ARG_NONE #define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) +#define ARGP_OBJECT_TYPE_OP ARGP_LIST1 (ARGP_NAME_OR_REF) #define ARGP_ONE_OP ARG_NONE #define ARGP_ONES_OP ARG_NONE #define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST) #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) #define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA) -#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) +#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_NAME_OR_REF) #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) #define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING) @@ -185,7 +186,6 @@ #define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) #define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) -#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST) #define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG) @@ -223,7 +223,7 @@ #define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_BYTE_OP ARGI_INVALID_OPCODE #define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE -#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF) +#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_ANYTYPE, ARGI_ANYTYPE, ARGI_TARGETREF) #define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF) #define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF) #define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE @@ -285,6 +285,7 @@ #define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE #define ARGI_NOOP_OP ARG_NONE #define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER) +#define ARGI_OBJECT_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) #define ARGI_ONE_OP ARG_NONE #define ARGI_ONES_OP ARG_NONE #define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) @@ -318,7 +319,6 @@ #define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET) #define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET) -#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) #define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE) #define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER) #define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER) diff --git a/drivers/acpi/acpica/acparser.h b/drivers/acpi/acpica/acparser.h index 8fc8c7cea..7da639d62 100644 --- a/drivers/acpi/acpica/acparser.h +++ b/drivers/acpi/acpica/acparser.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,7 +92,13 @@ acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state, acpi_status acpi_ps_get_next_namepath(struct acpi_walk_state *walk_state, struct acpi_parse_state *parser_state, - union acpi_parse_object *arg, u8 method_call); + union acpi_parse_object *arg, + u8 possible_method_call); + +/* Values for u8 above */ + +#define ACPI_NOT_METHOD_CALL FALSE +#define ACPI_POSSIBLE_METHOD_CALL TRUE acpi_status acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, diff --git a/drivers/acpi/acpica/acpredef.h b/drivers/acpi/acpica/acpredef.h index b9474b529..52f6bee52 100644 --- a/drivers/acpi/acpica/acpredef.h +++ b/drivers/acpi/acpica/acpredef.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h index 6357efb01..5dd58beaf 100644 --- a/drivers/acpi/acpica/acresrc.h +++ b/drivers/acpi/acpica/acresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/acstruct.h b/drivers/acpi/acpica/acstruct.h index f9992dced..b3b386e0b 100644 --- a/drivers/acpi/acpica/acstruct.h +++ b/drivers/acpi/acpica/acstruct.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/actables.h b/drivers/acpi/acpica/actables.h index 591ea9531..848ad3ac9 100644 --- a/drivers/acpi/acpica/actables.h +++ b/drivers/acpi/acpica/actables.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index 8b8fef6cc..e43ab6f2a 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -184,24 +184,24 @@ acpi_status acpi_ut_init_globals(void); #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -char *acpi_ut_get_mutex_name(u32 mutex_id); +const char *acpi_ut_get_mutex_name(u32 mutex_id); const char *acpi_ut_get_notify_name(u32 notify_value, acpi_object_type type); #endif -char *acpi_ut_get_type_name(acpi_object_type type); +const char *acpi_ut_get_type_name(acpi_object_type type); -char *acpi_ut_get_node_name(void *object); +const char *acpi_ut_get_node_name(void *object); -char *acpi_ut_get_descriptor_name(void *object); +const char *acpi_ut_get_descriptor_name(void *object); const char *acpi_ut_get_reference_name(union acpi_operand_object *object); -char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); +const char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc); -char *acpi_ut_get_region_name(u8 space_id); +const char *acpi_ut_get_region_name(u8 space_id); -char *acpi_ut_get_event_name(u32 event_id); +const char *acpi_ut_get_event_name(u32 event_id); char acpi_ut_hex_to_ascii_char(u64 integer, u32 position); @@ -353,14 +353,6 @@ acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node, u8 method_count, u8 *out_values); /* - * utfileio - file operations - */ -#ifdef ACPI_APPLICATION -acpi_status -acpi_ut_read_table_from_file(char *filename, struct acpi_table_header **table); -#endif - -/* * utids - device ID support */ acpi_status @@ -372,10 +364,6 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node, struct acpi_pnp_device_id ** return_id); acpi_status -acpi_ut_execute_SUB(struct acpi_namespace_node *device_node, - struct acpi_pnp_device_id **return_id); - -acpi_status acpi_ut_execute_CID(struct acpi_namespace_node *device_node, struct acpi_pnp_device_id_list ** return_cid_list); diff --git a/drivers/acpi/acpica/amlcode.h b/drivers/acpi/acpica/amlcode.h index 883f20cfa..ceb4f7365 100644 --- a/drivers/acpi/acpica/amlcode.h +++ b/drivers/acpi/acpica/amlcode.h @@ -7,7 +7,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -120,7 +120,7 @@ #define AML_CREATE_WORD_FIELD_OP (u16) 0x8b #define AML_CREATE_BYTE_FIELD_OP (u16) 0x8c #define AML_CREATE_BIT_FIELD_OP (u16) 0x8d -#define AML_TYPE_OP (u16) 0x8e +#define AML_OBJECT_TYPE_OP (u16) 0x8e #define AML_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */ #define AML_LAND_OP (u16) 0x90 #define AML_LOR_OP (u16) 0x91 @@ -238,7 +238,8 @@ #define ARGP_TERMLIST 0x0F #define ARGP_WORDDATA 0x10 #define ARGP_QWORDDATA 0x11 -#define ARGP_SIMPLENAME 0x12 +#define ARGP_SIMPLENAME 0x12 /* name_string | local_term | arg_term */ +#define ARGP_NAME_OR_REF 0x13 /* For object_type only */ /* * Resolved argument types for the AML Interpreter diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h index ee0cdd60b..dee6c7ea4 100644 --- a/drivers/acpi/acpica/amlresrc.h +++ b/drivers/acpi/acpica/amlresrc.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/dbcmds.c b/drivers/acpi/acpica/dbcmds.c index 30414b3d7..7ec62c461 100644 --- a/drivers/acpi/acpica/dbcmds.c +++ b/drivers/acpi/acpica/dbcmds.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -798,7 +798,7 @@ acpi_db_device_resources(acpi_handle obj_handle, acpi_status status; node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); - parent_path = acpi_ns_get_external_pathname(node); + parent_path = acpi_ns_get_normalized_pathname(node, TRUE); if (!parent_path) { return (AE_NO_MEMORY); } @@ -1131,13 +1131,8 @@ void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg) u32 debug_layer = 0; u32 flags = 0; - if (enable_arg) { - acpi_ut_strupr(enable_arg); - } - - if (once_arg) { - acpi_ut_strupr(once_arg); - } + acpi_ut_strupr(enable_arg); + acpi_ut_strupr(once_arg); if (method_arg) { if (acpi_db_trace_method_name) { diff --git a/drivers/acpi/acpica/dbconvert.c b/drivers/acpi/acpica/dbconvert.c index a71632ca8..9fee88f1c 100644 --- a/drivers/acpi/acpica/dbconvert.c +++ b/drivers/acpi/acpica/dbconvert.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/dbdisply.c b/drivers/acpi/acpica/dbdisply.c index 672977ec7..502bb587f 100644 --- a/drivers/acpi/acpica/dbdisply.c +++ b/drivers/acpi/acpica/dbdisply.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include "acnamesp.h" #include "acparser.h" #include "acinterp.h" +#include "acevents.h" #include "acdebug.h" #define _COMPONENT ACPI_CA_DEBUGGER @@ -588,7 +589,7 @@ void acpi_db_display_calling_tree(void) * * FUNCTION: acpi_db_display_object_type * - * PARAMETERS: name - User entered NS node handle or name + * PARAMETERS: object_arg - User entered NS node handle * * RETURN: None * @@ -596,44 +597,36 @@ void acpi_db_display_calling_tree(void) * ******************************************************************************/ -void acpi_db_display_object_type(char *name) +void acpi_db_display_object_type(char *object_arg) { - struct acpi_namespace_node *node; + acpi_size arg; + acpi_handle handle; struct acpi_device_info *info; acpi_status status; u32 i; - node = acpi_db_convert_to_node(name); - if (!node) { - return; - } + arg = strtoul(object_arg, NULL, 16); + handle = ACPI_TO_POINTER(arg); - status = acpi_get_object_info(ACPI_CAST_PTR(acpi_handle, node), &info); + status = acpi_get_object_info(handle, &info); if (ACPI_FAILURE(status)) { acpi_os_printf("Could not get object info, %s\n", acpi_format_exception(status)); return; } - if (info->valid & ACPI_VALID_ADR) { - acpi_os_printf("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", - ACPI_FORMAT_UINT64(info->address), - info->current_status, info->flags); - } - if (info->valid & ACPI_VALID_SXDS) { - acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", - info->highest_dstates[0], - info->highest_dstates[1], - info->highest_dstates[2], - info->highest_dstates[3]); - } - if (info->valid & ACPI_VALID_SXWS) { - acpi_os_printf - ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", - info->lowest_dstates[0], info->lowest_dstates[1], - info->lowest_dstates[2], info->lowest_dstates[3], - info->lowest_dstates[4]); - } + acpi_os_printf("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n", + ACPI_FORMAT_UINT64(info->address), + info->current_status, info->flags); + + acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", + info->highest_dstates[0], info->highest_dstates[1], + info->highest_dstates[2], info->highest_dstates[3]); + + acpi_os_printf("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", + info->lowest_dstates[0], info->lowest_dstates[1], + info->lowest_dstates[2], info->lowest_dstates[3], + info->lowest_dstates[4]); if (info->valid & ACPI_VALID_HID) { acpi_os_printf("HID: %s\n", info->hardware_id.string); @@ -643,10 +636,6 @@ void acpi_db_display_object_type(char *name) acpi_os_printf("UID: %s\n", info->unique_id.string); } - if (info->valid & ACPI_VALID_SUB) { - acpi_os_printf("SUB: %s\n", info->subsystem_id.string); - } - if (info->valid & ACPI_VALID_CID) { for (i = 0; i < info->compatible_id_list.count; i++) { acpi_os_printf("CID %u: %s\n", i, @@ -679,6 +668,12 @@ acpi_db_display_result_object(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { +#ifndef ACPI_APPLICATION + if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { + return; + } +#endif + /* Only display if single stepping */ if (!acpi_gbl_cm_single_step) { @@ -708,6 +703,12 @@ acpi_db_display_argument_object(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { +#ifndef ACPI_APPLICATION + if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { + return; + } +#endif + if (!acpi_gbl_cm_single_step) { return; } @@ -951,28 +952,25 @@ void acpi_db_display_handlers(void) if (obj_desc) { for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) { space_id = acpi_gbl_space_id_list[i]; - handler_obj = obj_desc->device.handler; acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_region_name((u8)space_id), space_id); - while (handler_obj) { - if (acpi_gbl_space_id_list[i] == - handler_obj->address_space.space_id) { - acpi_os_printf - (ACPI_HANDLER_PRESENT_STRING, - (handler_obj->address_space. - handler_flags & - ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) - ? "Default" : "User", - handler_obj->address_space. - handler); - - goto found_handler; - } + handler_obj = + acpi_ev_find_region_handler(space_id, + obj_desc->common_notify. + handler); + if (handler_obj) { + acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, + (handler_obj->address_space. + handler_flags & + ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) + ? "Default" : "User", + handler_obj->address_space. + handler); - handler_obj = handler_obj->address_space.next; + goto found_handler; } /* There is no handler for this space_id */ @@ -984,7 +982,7 @@ found_handler: ; /* Find all handlers for user-defined space_IDs */ - handler_obj = obj_desc->device.handler; + handler_obj = obj_desc->common_notify.handler; while (handler_obj) { if (handler_obj->address_space.space_id >= ACPI_USER_REGION_BEGIN) { @@ -1079,14 +1077,14 @@ acpi_db_display_non_root_handlers(acpi_handle obj_handle, return (AE_OK); } - pathname = acpi_ns_get_external_pathname(node); + pathname = acpi_ns_get_normalized_pathname(node, TRUE); if (!pathname) { return (AE_OK); } /* Display all handlers associated with this device */ - handler_obj = obj_desc->device.handler; + handler_obj = obj_desc->common_notify.handler; while (handler_obj) { acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_region_name((u8)handler_obj-> diff --git a/drivers/acpi/acpica/dbexec.c b/drivers/acpi/acpica/dbexec.c index d713e2df6..c81485537 100644 --- a/drivers/acpi/acpica/dbexec.c +++ b/drivers/acpi/acpica/dbexec.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/dbfileio.c b/drivers/acpi/acpica/dbfileio.c index d0e6b20ce..483287942 100644 --- a/drivers/acpi/acpica/dbfileio.c +++ b/drivers/acpi/acpica/dbfileio.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,10 @@ #include "accommon.h" #include "acdebug.h" #include "actables.h" +#include <stdio.h> +#ifdef ACPI_APPLICATION +#include "acapps.h" +#endif #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME("dbfileio") @@ -110,122 +114,31 @@ void acpi_db_open_debug_file(char *name) } #endif -#ifdef ACPI_APPLICATION -#include "acapps.h" - -/******************************************************************************* - * - * FUNCTION: ae_local_load_table - * - * PARAMETERS: table - pointer to a buffer containing the entire - * table to be loaded - * - * RETURN: Status - * - * DESCRIPTION: This function is called to load a table from the caller's - * buffer. The buffer must contain an entire ACPI Table including - * a valid header. The header fields will be verified, and if it - * is determined that the table is invalid, the call will fail. - * - ******************************************************************************/ - -static acpi_status ae_local_load_table(struct acpi_table_header *table) -{ - acpi_status status = AE_OK; - - ACPI_FUNCTION_TRACE(ae_local_load_table); - -#if 0 -/* struct acpi_table_desc table_info; */ - - if (!table) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - table_info.pointer = table; - status = acpi_tb_recognize_table(&table_info, ACPI_TABLE_ALL); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Install the new table into the local data structures */ - - status = acpi_tb_init_table_descriptor(&table_info); - if (ACPI_FAILURE(status)) { - if (status == AE_ALREADY_EXISTS) { - - /* Table already exists, no error */ - - status = AE_OK; - } - - /* Free table allocated by acpi_tb_get_table */ - - acpi_tb_delete_single_table(&table_info); - return_ACPI_STATUS(status); - } -#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) - - status = - acpi_ns_load_table(table_info.installed_desc, acpi_gbl_root_node); - if (ACPI_FAILURE(status)) { - - /* Uninstall table and free the buffer */ - - acpi_tb_delete_tables_by_type(ACPI_TABLE_ID_DSDT); - return_ACPI_STATUS(status); - } -#endif -#endif - - return_ACPI_STATUS(status); -} -#endif - /******************************************************************************* * - * FUNCTION: acpi_db_get_table_from_file + * FUNCTION: acpi_db_load_tables * - * PARAMETERS: filename - File where table is located - * return_table - Where a pointer to the table is returned + * PARAMETERS: list_head - List of ACPI tables to load * * RETURN: Status * - * DESCRIPTION: Load an ACPI table from a file + * DESCRIPTION: Load ACPI tables from a previously constructed table list. * ******************************************************************************/ -acpi_status -acpi_db_get_table_from_file(char *filename, - struct acpi_table_header **return_table, - u8 must_be_aml_file) +acpi_status acpi_db_load_tables(struct acpi_new_table_desc *list_head) { -#ifdef ACPI_APPLICATION acpi_status status; + struct acpi_new_table_desc *table_list_head; struct acpi_table_header *table; - u8 is_aml_table = TRUE; - - status = acpi_ut_read_table_from_file(filename, &table); - if (ACPI_FAILURE(status)) { - return (status); - } - - if (must_be_aml_file) { - is_aml_table = acpi_ut_is_aml_table(table); - if (!is_aml_table) { - ACPI_EXCEPTION((AE_INFO, AE_OK, - "Input for -e is not an AML table: " - "\"%4.4s\" (must be DSDT/SSDT)", - table->signature)); - return (AE_TYPE); - } - } - if (is_aml_table) { + /* Load all ACPI tables in the list */ - /* Attempt to recognize and install the table */ + table_list_head = list_head; + while (table_list_head) { + table = table_list_head->table; - status = ae_local_load_table(table); + status = acpi_load_table(table); if (ACPI_FAILURE(status)) { if (status == AE_ALREADY_EXISTS) { acpi_os_printf @@ -239,18 +152,12 @@ acpi_db_get_table_from_file(char *filename, return (status); } - acpi_tb_print_table_header(0, table); - fprintf(stderr, "Acpi table [%4.4s] successfully installed and loaded\n", table->signature); - } - acpi_gbl_acpi_hardware_present = FALSE; - if (return_table) { - *return_table = table; + table_list_head = table_list_head->next; } -#endif /* ACPI_APPLICATION */ return (AE_OK); } diff --git a/drivers/acpi/acpica/dbhistry.c b/drivers/acpi/acpica/dbhistry.c index 9c66a9ead..46bd65d38 100644 --- a/drivers/acpi/acpica/dbhistry.c +++ b/drivers/acpi/acpica/dbhistry.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/dbinput.c b/drivers/acpi/acpica/dbinput.c index 048025443..417c02a89 100644 --- a/drivers/acpi/acpica/dbinput.c +++ b/drivers/acpi/acpica/dbinput.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,10 @@ #include "accommon.h" #include "acdebug.h" +#ifdef ACPI_APPLICATION +#include "acapps.h" +#endif + #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME("dbinput") @@ -53,8 +57,6 @@ static u32 acpi_db_get_line(char *input_buffer); static u32 acpi_db_match_command(char *user_command); -static void acpi_db_single_thread(void); - static void acpi_db_display_command_info(char *command, u8 display_all); static void acpi_db_display_help(char *command); @@ -623,9 +625,7 @@ static u32 acpi_db_get_line(char *input_buffer) /* Uppercase the actual command */ - if (acpi_gbl_db_args[0]) { - acpi_ut_strupr(acpi_gbl_db_args[0]); - } + acpi_ut_strupr(acpi_gbl_db_args[0]); count = i; if (count) { @@ -1050,11 +1050,17 @@ acpi_db_command_dispatch(char *input_buffer, acpi_db_close_debug_file(); break; - case CMD_LOAD: + case CMD_LOAD:{ + struct acpi_new_table_desc *list_head = NULL; - status = - acpi_db_get_table_from_file(acpi_gbl_db_args[1], NULL, - FALSE); + status = + ac_get_all_tables_from_file(acpi_gbl_db_args[1], + ACPI_GET_ALL_TABLES, + &list_head); + if (ACPI_SUCCESS(status)) { + acpi_db_load_tables(list_head); + } + } break; case CMD_OPEN: @@ -1149,55 +1155,16 @@ acpi_db_command_dispatch(char *input_buffer, void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context) { - acpi_status status = AE_OK; - acpi_status Mstatus; - - while (status != AE_CTRL_TERMINATE && !acpi_gbl_db_terminate_loop) { - acpi_gbl_method_executing = FALSE; - acpi_gbl_step_to_next_call = FALSE; - - Mstatus = acpi_os_acquire_mutex(acpi_gbl_db_command_ready, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(Mstatus)) { - return; - } - - status = - acpi_db_command_dispatch(acpi_gbl_db_line_buf, NULL, NULL); - acpi_os_release_mutex(acpi_gbl_db_command_complete); - } + (void)acpi_db_user_commands(); acpi_gbl_db_threads_terminated = TRUE; } /******************************************************************************* * - * FUNCTION: acpi_db_single_thread - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Debugger execute thread. Waits for a command line, then - * simply dispatches it. - * - ******************************************************************************/ - -static void acpi_db_single_thread(void) -{ - - acpi_gbl_method_executing = FALSE; - acpi_gbl_step_to_next_call = FALSE; - - (void)acpi_db_command_dispatch(acpi_gbl_db_line_buf, NULL, NULL); -} - -/******************************************************************************* - * * FUNCTION: acpi_db_user_commands * - * PARAMETERS: prompt - User prompt (depends on mode) - * op - Current executing parse op + * PARAMETERS: None * * RETURN: None * @@ -1206,7 +1173,7 @@ static void acpi_db_single_thread(void) * ******************************************************************************/ -acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op) +acpi_status acpi_db_user_commands(void) { acpi_status status = AE_OK; @@ -1216,52 +1183,31 @@ acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op) while (!acpi_gbl_db_terminate_loop) { - /* Force output to console until a command is entered */ - - acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT); - - /* Different prompt if method is executing */ - - if (!acpi_gbl_method_executing) { - acpi_os_printf("%1c ", ACPI_DEBUGGER_COMMAND_PROMPT); - } else { - acpi_os_printf("%1c ", ACPI_DEBUGGER_EXECUTE_PROMPT); - } + /* Wait the readiness of the command */ - /* Get the user input line */ - - status = acpi_os_get_line(acpi_gbl_db_line_buf, - ACPI_DB_LINE_BUFFER_SIZE, NULL); + status = acpi_os_wait_command_ready(); if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "While parsing command line")); - return (status); + break; } - /* Check for single or multithreaded debug */ + /* Just call to the command line interpreter */ - if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { - /* - * Signal the debug thread that we have a command to execute, - * and wait for the command to complete. - */ - acpi_os_release_mutex(acpi_gbl_db_command_ready); - if (ACPI_FAILURE(status)) { - return (status); - } + acpi_gbl_method_executing = FALSE; + acpi_gbl_step_to_next_call = FALSE; - status = - acpi_os_acquire_mutex(acpi_gbl_db_command_complete, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(status)) { - return (status); - } - } else { - /* Just call to the command line interpreter */ + (void)acpi_db_command_dispatch(acpi_gbl_db_line_buf, NULL, + NULL); + + /* Notify the completion of the command */ - acpi_db_single_thread(); + status = acpi_os_notify_command_complete(); + if (ACPI_FAILURE(status)) { + break; } } + if (ACPI_FAILURE(status) && status != AE_CTRL_TERMINATE) { + ACPI_EXCEPTION((AE_INFO, status, "While parsing command line")); + } return (status); } diff --git a/drivers/acpi/acpica/dbmethod.c b/drivers/acpi/acpica/dbmethod.c index 01e5a7114..f17a86f6b 100644 --- a/drivers/acpi/acpica/dbmethod.c +++ b/drivers/acpi/acpica/dbmethod.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/dbnames.c b/drivers/acpi/acpica/dbnames.c index 04ff1ebfd..3c23b5a10 100644 --- a/drivers/acpi/acpica/dbnames.c +++ b/drivers/acpi/acpica/dbnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -438,7 +438,7 @@ acpi_db_walk_for_predefined_names(acpi_handle obj_handle, return (AE_OK); } - pathname = acpi_ns_get_external_pathname(node); + pathname = acpi_ns_get_normalized_pathname(node, TRUE); if (!pathname) { return (AE_OK); } diff --git a/drivers/acpi/acpica/dbobject.c b/drivers/acpi/acpica/dbobject.c index 116f6db8c..1d59e8b6f 100644 --- a/drivers/acpi/acpica/dbobject.c +++ b/drivers/acpi/acpica/dbobject.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/dbstats.c b/drivers/acpi/acpica/dbstats.c index 4ba0a2081..a414e1fa6 100644 --- a/drivers/acpi/acpica/dbstats.c +++ b/drivers/acpi/acpica/dbstats.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -382,6 +382,7 @@ acpi_status acpi_db_display_statistics(char *type_arg) acpi_gbl_node_type_count[i], acpi_gbl_obj_type_count[i]); } + acpi_os_printf("%16.16s % 10ld% 10ld\n", "Misc/Unknown", acpi_gbl_node_type_count_misc, acpi_gbl_obj_type_count_misc); diff --git a/drivers/acpi/acpica/dbtest.c b/drivers/acpi/acpica/dbtest.c index 10ea8bf9b..74aa38156 100644 --- a/drivers/acpi/acpica/dbtest.c +++ b/drivers/acpi/acpica/dbtest.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -953,7 +953,7 @@ acpi_db_evaluate_one_predefined_name(acpi_handle obj_handle, return (AE_OK); } - pathname = acpi_ns_get_external_pathname(node); + pathname = acpi_ns_get_normalized_pathname(node, TRUE); if (!pathname) { return (AE_OK); } diff --git a/drivers/acpi/acpica/dbutils.c b/drivers/acpi/acpica/dbutils.c index 86790e080..b37a2c77b 100644 --- a/drivers/acpi/acpica/dbutils.c +++ b/drivers/acpi/acpica/dbutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -173,6 +173,7 @@ void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level) if (obj_desc->buffer.length > 16) { acpi_os_printf("\n"); } + acpi_ut_debug_dump_buffer(ACPI_CAST_PTR (u8, obj_desc->buffer.pointer), diff --git a/drivers/acpi/acpica/dbxface.c b/drivers/acpi/acpica/dbxface.c index 342298a6e..e94e0d80b 100644 --- a/drivers/acpi/acpica/dbxface.c +++ b/drivers/acpi/acpica/dbxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,46 +85,21 @@ acpi_db_start_command(struct acpi_walk_state *walk_state, acpi_gbl_method_executing = TRUE; status = AE_CTRL_TRUE; - while (status == AE_CTRL_TRUE) { - if (acpi_gbl_debugger_configuration == DEBUGGER_MULTI_THREADED) { - - /* Handshake with the front-end that gets user command lines */ - - acpi_os_release_mutex(acpi_gbl_db_command_complete); - - status = - acpi_os_acquire_mutex(acpi_gbl_db_command_ready, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(status)) { - return (status); - } - } else { - /* Single threaded, we must get a command line ourselves */ - - /* Force output to console until a command is entered */ - acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT); + while (status == AE_CTRL_TRUE) { - /* Different prompt if method is executing */ + /* Notify the completion of the command */ - if (!acpi_gbl_method_executing) { - acpi_os_printf("%1c ", - ACPI_DEBUGGER_COMMAND_PROMPT); - } else { - acpi_os_printf("%1c ", - ACPI_DEBUGGER_EXECUTE_PROMPT); - } + status = acpi_os_notify_command_complete(); + if (ACPI_FAILURE(status)) { + goto error_exit; + } - /* Get the user input line */ + /* Wait the readiness of the command */ - status = acpi_os_get_line(acpi_gbl_db_line_buf, - ACPI_DB_LINE_BUFFER_SIZE, - NULL); - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "While parsing command line")); - return (status); - } + status = acpi_os_wait_command_ready(); + if (ACPI_FAILURE(status)) { + goto error_exit; } status = @@ -134,11 +109,46 @@ acpi_db_start_command(struct acpi_walk_state *walk_state, /* acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); */ +error_exit: + if (ACPI_FAILURE(status) && status != AE_CTRL_TERMINATE) { + ACPI_EXCEPTION((AE_INFO, status, + "While parsing/handling command line")); + } return (status); } /******************************************************************************* * + * FUNCTION: acpi_db_signal_break_point + * + * PARAMETERS: walk_state - Current walk + * + * RETURN: Status + * + * DESCRIPTION: Called for AML_BREAK_POINT_OP + * + ******************************************************************************/ + +void acpi_db_signal_break_point(struct acpi_walk_state *walk_state) +{ + +#ifndef ACPI_APPLICATION + if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { + return; + } +#endif + + /* + * Set the single-step flag. This will cause the debugger (if present) + * to break to the console within the AML debugger at the start of the + * next AML instruction. + */ + acpi_gbl_cm_single_step = TRUE; + acpi_os_printf("**break** Executed AML BreakPoint opcode\n"); +} + +/******************************************************************************* + * * FUNCTION: acpi_db_single_step * * PARAMETERS: walk_state - Current walk @@ -420,15 +430,7 @@ acpi_status acpi_initialize_debugger(void) /* These were created with one unit, grab it */ - status = acpi_os_acquire_mutex(acpi_gbl_db_command_complete, - ACPI_WAIT_FOREVER); - if (ACPI_FAILURE(status)) { - acpi_os_printf("Could not get debugger mutex\n"); - return_ACPI_STATUS(status); - } - - status = acpi_os_acquire_mutex(acpi_gbl_db_command_ready, - ACPI_WAIT_FOREVER); + status = acpi_os_initialize_command_signals(); if (ACPI_FAILURE(status)) { acpi_os_printf("Could not get debugger mutex\n"); return_ACPI_STATUS(status); @@ -473,13 +475,14 @@ void acpi_terminate_debugger(void) acpi_gbl_db_terminate_loop = TRUE; if (acpi_gbl_debugger_configuration & DEBUGGER_MULTI_THREADED) { - acpi_os_release_mutex(acpi_gbl_db_command_ready); /* Wait the AML Debugger threads */ while (!acpi_gbl_db_threads_terminated) { acpi_os_sleep(100); } + + acpi_os_terminate_command_signals(); } if (acpi_gbl_db_buffer) { diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c index e2ab59e39..ad0413bee 100644 --- a/drivers/acpi/acpica/dsargs.c +++ b/drivers/acpi/acpica/dsargs.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -194,8 +194,8 @@ acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc) extra_desc = acpi_ns_get_secondary_object(obj_desc); node = obj_desc->buffer_field.node; - ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname(ACPI_TYPE_BUFFER_FIELD, - node, NULL)); + ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname + (ACPI_TYPE_BUFFER_FIELD, node, NULL)); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] BufferField Arg Init\n", acpi_ut_get_node_name(node))); @@ -385,7 +385,8 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) ACPI_DEBUG_EXEC(acpi_ut_display_init_pathname (ACPI_TYPE_REGION, node, NULL)); - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[%4.4s] OpRegion Arg Init at AML %p\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "[%4.4s] OpRegion Arg Init at AML %p\n", acpi_ut_get_node_name(node), extra_desc->extra.aml_start)); diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c index 435fc16e2..c9a663f21 100644 --- a/drivers/acpi/acpica/dscontrol.c +++ b/drivers/acpi/acpica/dscontrol.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include "amlcode.h" #include "acdispat.h" #include "acinterp.h" +#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME("dscontrol") @@ -348,14 +349,7 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state, case AML_BREAK_POINT_OP: - /* - * Set the single-step flag. This will cause the debugger (if present) - * to break to the console within the AML debugger at the start of the - * next AML instruction. - */ - ACPI_DEBUGGER_EXEC(acpi_gbl_cm_single_step = TRUE); - ACPI_DEBUGGER_EXEC(acpi_os_printf - ("**break** Executed AML BreakPoint opcode\n")); + acpi_db_signal_break_point(walk_state); /* Call to the OSL in case OS wants a piece of the action */ diff --git a/drivers/acpi/acpica/dsdebug.c b/drivers/acpi/acpica/dsdebug.c index 309556efc..56c3aadb4 100644 --- a/drivers/acpi/acpica/dsdebug.c +++ b/drivers/acpi/acpica/dsdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -161,6 +161,7 @@ acpi_ds_dump_method_stack(acpi_status status, ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "\n**** Exception %s during execution of method ", acpi_format_exception(status))); + acpi_ds_print_node_pathname(walk_state->method_node, NULL); /* Display stack of executing methods */ @@ -203,8 +204,8 @@ acpi_ds_dump_method_stack(acpi_status status, } else { /* * This method has called another method - * NOTE: the method call parse subtree is already deleted at this - * point, so we cannot disassemble the method invocation. + * NOTE: the method call parse subtree is already deleted at + * this point, so we cannot disassemble the method invocation. */ ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "Call to method ")); diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 20de14859..6a4b603d0 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -106,6 +106,7 @@ acpi_ds_create_external_region(acpi_status lookup_status, * insert the name into the namespace. */ acpi_dm_add_op_to_external_list(op, path, ACPI_TYPE_REGION, 0, 0); + status = acpi_ns_lookup(walk_state->scope_info, path, ACPI_TYPE_REGION, ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, walk_state, node); @@ -202,11 +203,10 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, /* Enter the name_string into the namespace */ - status = - acpi_ns_lookup(walk_state->scope_info, - arg->common.value.string, ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, flags, walk_state, - &node); + status = acpi_ns_lookup(walk_state->scope_info, + arg->common.value.string, ACPI_TYPE_ANY, + ACPI_IMODE_LOAD_PASS1, flags, + walk_state, &node); if (ACPI_FAILURE(status)) { ACPI_ERROR_NAMESPACE(arg->common.value.string, status); return_ACPI_STATUS(status); @@ -244,8 +244,8 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, } /* - * Remember location in AML stream of the field unit opcode and operands -- - * since the buffer and index operands must be evaluated. + * Remember location in AML stream of the field unit opcode and operands + * -- since the buffer and index operands must be evaluated. */ second_desc = obj_desc->common.next_object; second_desc->extra.aml_start = op->named.data; @@ -310,8 +310,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, switch (arg->common.aml_opcode) { case AML_INT_RESERVEDFIELD_OP: - position = (u64) info->field_bit_position - + (u64) arg->common.value.size; + position = (u64)info->field_bit_position + + (u64)arg->common.value.size; if (position > ACPI_UINT32_MAX) { ACPI_ERROR((AE_INFO, @@ -344,13 +344,13 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, /* access_attribute (attrib_quick, attrib_byte, etc.) */ - info->attribute = - (u8)((arg->common.value.integer >> 8) & 0xFF); + info->attribute = (u8) + ((arg->common.value.integer >> 8) & 0xFF); /* access_length (for serial/buffer protocols) */ - info->access_length = - (u8)((arg->common.value.integer >> 16) & 0xFF); + info->access_length = (u8) + ((arg->common.value.integer >> 16) & 0xFF); break; case AML_INT_CONNECTION_OP: @@ -425,8 +425,8 @@ acpi_ds_get_field_names(struct acpi_create_field_info *info, /* Keep track of bit position for the next field */ - position = (u64) info->field_bit_position - + (u64) arg->common.value.size; + position = (u64)info->field_bit_position + + (u64)arg->common.value.size; if (position > ACPI_UINT32_MAX) { ACPI_ERROR((AE_INFO, @@ -716,11 +716,12 @@ acpi_ds_create_bank_field(union acpi_parse_object *op, /* * Use Info.data_register_node to store bank_field Op - * It's safe because data_register_node will never be used when create bank field - * We store aml_start and aml_length in the bank_field Op for late evaluation - * Used in acpi_ex_prep_field_value(Info) + * It's safe because data_register_node will never be used when create + * bank field \we store aml_start and aml_length in the bank_field Op for + * late evaluation. Used in acpi_ex_prep_field_value(Info) * - * TBD: Or, should we add a field in struct acpi_create_field_info, like "void *ParentOp"? + * TBD: Or, should we add a field in struct acpi_create_field_info, like + * "void *ParentOp"? */ info.data_register_node = (struct acpi_namespace_node *)op; diff --git a/drivers/acpi/acpica/dsinit.c b/drivers/acpi/acpica/dsinit.c index 920f1b199..5aa1c5fee 100644 --- a/drivers/acpi/acpica/dsinit.c +++ b/drivers/acpi/acpica/dsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -247,7 +247,7 @@ acpi_ds_initialize_objects(u32 table_index, /* Summary of objects initialized */ ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, - "Table [%4.4s:%8.8s] (id %.2X) - %4u Objects with %3u Devices, " + "Table [%4.4s: %-8.8s] (id %.2X) - %4u Objects with %3u Devices, " "%3u Regions, %4u Methods (%u/%u/%u Serial/Non/Cvt)\n", table->signature, table->oem_table_id, owner_id, info.object_count, info.device_count, diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index bc32f3194..6a72047aa 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -118,10 +118,9 @@ acpi_ds_auto_serialize_method(struct acpi_namespace_node *node, return_ACPI_STATUS(AE_NO_MEMORY); } - status = - acpi_ds_init_aml_walk(walk_state, op, node, - obj_desc->method.aml_start, - obj_desc->method.aml_length, NULL, 0); + status = acpi_ds_init_aml_walk(walk_state, op, node, + obj_desc->method.aml_start, + obj_desc->method.aml_length, NULL, 0); if (ACPI_FAILURE(status)) { acpi_ds_delete_walk_state(walk_state); acpi_ps_free_op(op); @@ -375,7 +374,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, && (walk_state->thread->current_sync_level > obj_desc->method.mutex->mutex.sync_level)) { ACPI_ERROR((AE_INFO, - "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%u)", + "Cannot acquire Mutex for method [%4.4s]" + ", current SyncLevel is too large (%u)", acpi_ut_get_node_name(method_node), walk_state->thread->current_sync_level)); @@ -411,8 +411,19 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, obj_desc->method.mutex->mutex.thread_id = walk_state->thread->thread_id; - walk_state->thread->current_sync_level = - obj_desc->method.sync_level; + + /* + * Update the current sync_level only if this is not an auto- + * serialized method. In the auto case, we have to ignore + * the sync level for the method mutex (created for the + * auto-serialization) because we have no idea of what the + * sync level should be. Therefore, just ignore it. + */ + if (!(obj_desc->method.info_flags & + ACPI_METHOD_IGNORE_SYNC_LEVEL)) { + walk_state->thread->current_sync_level = + obj_desc->method.sync_level; + } } else { obj_desc->method.mutex->mutex. original_sync_level = @@ -501,16 +512,18 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, /* Init for new method, possibly wait on method mutex */ - status = acpi_ds_begin_method_execution(method_node, obj_desc, - this_walk_state); + status = + acpi_ds_begin_method_execution(method_node, obj_desc, + this_walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } /* Begin method parse/execution. Create a new walk state */ - next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id, - NULL, obj_desc, thread); + next_walk_state = + acpi_ds_create_walk_state(obj_desc->method.owner_id, NULL, obj_desc, + thread); if (!next_walk_state) { status = AE_NO_MEMORY; goto cleanup; @@ -797,7 +810,8 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, info_flags & ACPI_METHOD_SERIALIZED_PENDING) { if (walk_state) { ACPI_INFO((AE_INFO, - "Marking method %4.4s as Serialized because of AE_ALREADY_EXISTS error", + "Marking method %4.4s as Serialized " + "because of AE_ALREADY_EXISTS error", walk_state->method_node->name. ascii)); } @@ -815,6 +829,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, */ method_desc->method.info_flags &= ~ACPI_METHOD_SERIALIZED_PENDING; + method_desc->method.info_flags |= (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL); diff --git a/drivers/acpi/acpica/dsmthdat.c b/drivers/acpi/acpica/dsmthdat.c index 2e4c42b37..45cbebaa3 100644 --- a/drivers/acpi/acpica/dsmthdat.c +++ b/drivers/acpi/acpica/dsmthdat.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,6 +99,7 @@ void acpi_ds_method_data_init(struct acpi_walk_state *walk_state) for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { ACPI_MOVE_32_TO_32(&walk_state->arguments[i].name, NAMEOF_ARG_NTE); + walk_state->arguments[i].name.integer |= (i << 24); walk_state->arguments[i].descriptor_type = ACPI_DESC_TYPE_NAMED; walk_state->arguments[i].type = ACPI_TYPE_ANY; @@ -201,7 +202,7 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, if (!params) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "No param list passed to method\n")); + "No parameter list passed to method\n")); return_ACPI_STATUS(AE_OK); } @@ -214,9 +215,9 @@ acpi_ds_method_data_init_args(union acpi_operand_object **params, * Store the argument in the method/walk descriptor. * Do not copy the arg in order to implement call by reference */ - status = acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index, - params[index], - walk_state); + status = + acpi_ds_method_data_set_value(ACPI_REFCLASS_ARG, index, + params[index], walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -610,11 +611,11 @@ acpi_ds_store_object_to_local(u8 type, * do the indirect store */ if ((ACPI_GET_DESCRIPTOR_TYPE(current_obj_desc) == - ACPI_DESC_TYPE_OPERAND) - && (current_obj_desc->common.type == - ACPI_TYPE_LOCAL_REFERENCE) - && (current_obj_desc->reference.class == - ACPI_REFCLASS_REFOF)) { + ACPI_DESC_TYPE_OPERAND) && + (current_obj_desc->common.type == + ACPI_TYPE_LOCAL_REFERENCE) && + (current_obj_desc->reference.class == + ACPI_REFCLASS_REFOF)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Arg (%p) is an ObjRef(Node), storing in node %p\n", new_obj_desc, @@ -638,6 +639,7 @@ acpi_ds_store_object_to_local(u8 type, if (new_obj_desc != obj_desc) { acpi_ut_remove_reference(new_obj_desc); } + return_ACPI_STATUS(status); } } diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index 2beb7fd67..c303e9d92 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -463,10 +463,10 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, arg->common.node); } } else { - status = acpi_ds_build_internal_object(walk_state, arg, - &obj_desc-> - package. - elements[i]); + status = + acpi_ds_build_internal_object(walk_state, arg, + &obj_desc->package. + elements[i]); } if (*obj_desc_ptr) { @@ -525,7 +525,8 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, } ACPI_INFO((AE_INFO, - "Actual Package length (%u) is larger than NumElements field (%u), truncated", + "Actual Package length (%u) is larger than " + "NumElements field (%u), truncated", i, element_count)); } else if (i < element_count) { /* @@ -533,7 +534,8 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state, * Note: this is not an error, the package is padded out with NULLs. */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Package List length (%u) smaller than NumElements count (%u), padded with null elements\n", + "Package List length (%u) smaller than NumElements " + "count (%u), padded with null elements\n", i, element_count)); } @@ -584,8 +586,9 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state, /* Build an internal object for the argument(s) */ - status = acpi_ds_build_internal_object(walk_state, op->common.value.arg, - &obj_desc); + status = + acpi_ds_build_internal_object(walk_state, op->common.value.arg, + &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 81d7b9863..4cc9d989a 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -243,8 +243,9 @@ acpi_ds_init_buffer_field(u16 aml_opcode, * For field_flags, use LOCK_RULE = 0 (NO_LOCK), * UPDATE_RULE = 0 (UPDATE_PRESERVE) */ - status = acpi_ex_prep_common_field_object(obj_desc, field_flags, 0, - bit_offset, bit_count); + status = + acpi_ex_prep_common_field_object(obj_desc, field_flags, 0, + bit_offset, bit_count); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -330,8 +331,9 @@ acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state, /* Resolve the operands */ - status = acpi_ex_resolve_operands(op->common.aml_opcode, - ACPI_WALK_OPERANDS, walk_state); + status = + acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS, + walk_state); if (ACPI_FAILURE(status)) { ACPI_ERROR((AE_INFO, "(%s) bad operand(s), status 0x%X", acpi_ps_get_opcode_name(op->common.aml_opcode), @@ -414,8 +416,9 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, /* Resolve the length and address operands to numbers */ - status = acpi_ex_resolve_operands(op->common.aml_opcode, - ACPI_WALK_OPERANDS, walk_state); + status = + acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS, + walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -452,7 +455,6 @@ acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state, /* Now the address and length are valid for this opregion */ obj_desc->region.flags |= AOPOBJ_DATA_VALID; - return_ACPI_STATUS(status); } @@ -510,8 +512,9 @@ acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state, * Resolve the Signature string, oem_id string, * and oem_table_id string operands */ - status = acpi_ex_resolve_operands(op->common.aml_opcode, - ACPI_WALK_OPERANDS, walk_state); + status = + acpi_ex_resolve_operands(op->common.aml_opcode, ACPI_WALK_OPERANDS, + walk_state); if (ACPI_FAILURE(status)) { goto cleanup; } diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index ebc577bae..8ca941632 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -245,9 +245,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op, * we will use the return value */ if ((walk_state->control_state->common.state == - ACPI_CONTROL_PREDICATE_EXECUTING) - && (walk_state->control_state->control. - predicate_op == op)) { + ACPI_CONTROL_PREDICATE_EXECUTING) && + (walk_state->control_state->control.predicate_op == + op)) { goto result_used; } break; @@ -481,10 +481,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, /* Get the entire name string from the AML stream */ - status = - acpi_ex_get_name_string(ACPI_TYPE_ANY, - arg->common.value.buffer, - &name_string, &name_length); + status = acpi_ex_get_name_string(ACPI_TYPE_ANY, + arg->common.value.buffer, + &name_string, &name_length); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -503,9 +502,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, */ if ((walk_state->deferred_node) && (walk_state->deferred_node->type == ACPI_TYPE_BUFFER_FIELD) - && (arg_index == - (u32) ((walk_state->opcode == - AML_CREATE_FIELD_OP) ? 3 : 2))) { + && (arg_index == (u32) + ((walk_state->opcode == AML_CREATE_FIELD_OP) ? 3 : 2))) { obj_desc = ACPI_CAST_PTR(union acpi_operand_object, walk_state->deferred_node); @@ -522,9 +520,10 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, op_info = acpi_ps_get_opcode_info(parent_op->common. aml_opcode); - if ((op_info->flags & AML_NSNODE) - && (parent_op->common.aml_opcode != - AML_INT_METHODCALL_OP) + + if ((op_info->flags & AML_NSNODE) && + (parent_op->common.aml_opcode != + AML_INT_METHODCALL_OP) && (parent_op->common.aml_opcode != AML_REGION_OP) && (parent_op->common.aml_opcode != AML_INT_NAMEPATH_OP)) { @@ -605,8 +604,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } - ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object - (obj_desc, walk_state)); + + acpi_db_display_argument_object(obj_desc, walk_state); } else { /* Check for null name case */ @@ -633,15 +632,16 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, return_ACPI_STATUS(AE_NOT_IMPLEMENTED); } - if ((op_info->flags & AML_HAS_RETVAL) - || (arg->common.flags & ACPI_PARSEOP_IN_STACK)) { + if ((op_info->flags & AML_HAS_RETVAL) || + (arg->common.flags & ACPI_PARSEOP_IN_STACK)) { ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Argument previously created, already stacked\n")); - ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object - (walk_state-> - operands[walk_state->num_operands - - 1], walk_state)); + acpi_db_display_argument_object(walk_state-> + operands[walk_state-> + num_operands - + 1], + walk_state); /* * Use value that was already previously returned @@ -685,8 +685,7 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state, return_ACPI_STATUS(status); } - ACPI_DEBUGGER_EXEC(acpi_db_display_argument_object - (obj_desc, walk_state)); + acpi_db_display_argument_object(obj_desc, walk_state); } return_ACPI_STATUS(AE_OK); diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index df54d4622..402ecc590 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -172,14 +172,14 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, cleanup: - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Completed a predicate eval=%X Op=%p\n", 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_db_display_result_object(local_obj_desc, walk_state); /* * Delete the predicate result object (we know that @@ -264,8 +264,8 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, (walk_state->control_state->common.state == ACPI_CONTROL_CONDITIONAL_EXECUTING)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Exec predicate Op=%p State=%p\n", op, - walk_state)); + "Exec predicate Op=%p State=%p\n", + op, walk_state)); walk_state->control_state->common.state = ACPI_CONTROL_PREDICATE_EXECUTING; @@ -386,11 +386,10 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) /* Call debugger for single step support (DEBUG build only) */ - ACPI_DEBUGGER_EXEC(status = - acpi_db_single_step(walk_state, op, op_class)); - ACPI_DEBUGGER_EXEC(if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status);} - ) ; + status = acpi_db_single_step(walk_state, op, op_class); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } /* Decode the Opcode Class */ @@ -502,9 +501,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) "Method Reference in a Package, Op=%p\n", op)); - op->common.node = - (struct acpi_namespace_node *)op->asl.value. - arg->asl.node; + op->common.node = (struct acpi_namespace_node *) + op->asl.value.arg->asl.node; acpi_ut_add_reference(op->asl.value.arg->asl. node->object); return_ACPI_STATUS(AE_OK); @@ -586,8 +584,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) * Put the Node on the object stack (Contains the ACPI Name * of this object) */ - walk_state->operands[0] = - (void *)op->common.parent->common.node; + walk_state->operands[0] = (void *) + op->common.parent->common.node; walk_state->num_operands = 1; status = acpi_ds_create_node(walk_state, @@ -692,7 +690,8 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) default: ACPI_ERROR((AE_INFO, - "Unimplemented opcode, class=0x%X type=0x%X Opcode=0x%X Op=%p", + "Unimplemented opcode, class=0x%X " + "type=0x%X Opcode=0x%X Op=%p", op_class, op_type, op->common.aml_opcode, op)); @@ -728,8 +727,8 @@ cleanup: /* Break to debugger to display result */ - ACPI_DEBUGGER_EXEC(acpi_db_display_result_object - (walk_state->result_obj, walk_state)); + acpi_db_display_result_object(walk_state->result_obj, + walk_state); /* * Delete the result op if and only if: diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c index 097188a6b..d1cedcfda 100644 --- a/drivers/acpi/acpica/dswload.c +++ b/drivers/acpi/acpica/dswload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -476,13 +476,9 @@ acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state) status = acpi_ex_create_region(op->named.data, op->named.length, - (acpi_adr_space_type) ((op-> - common. - value. - arg)-> - common. - value. - integer), + (acpi_adr_space_type) + ((op->common.value.arg)-> + common.value.integer), walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index e2c08cd79..0bac6e141 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -598,11 +598,10 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) * Executing a method: initialize the region and unlock * the interpreter */ - status = - acpi_ex_create_region(op->named.data, - op->named.length, - region_space, - walk_state); + status = acpi_ex_create_region(op->named.data, + op->named.length, + region_space, + walk_state); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -664,6 +663,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) length, walk_state); } + walk_state->operands[0] = NULL; walk_state->num_operands = 0; diff --git a/drivers/acpi/acpica/dswscope.c b/drivers/acpi/acpica/dswscope.c index 43b3ea40c..9f32e08a0 100644 --- a/drivers/acpi/acpica/dswscope.c +++ b/drivers/acpi/acpica/dswscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -77,6 +77,7 @@ void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state) "Popped object type (%s)\n", acpi_ut_get_type_name(scope_info->common. value))); + acpi_ut_delete_generic_state(scope_info); } } diff --git a/drivers/acpi/acpica/dswstate.c b/drivers/acpi/acpica/dswstate.c index 89ac20224..3a26ddbae 100644 --- a/drivers/acpi/acpica/dswstate.c +++ b/drivers/acpi/acpica/dswstate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evevent.c b/drivers/acpi/acpica/evevent.c index bf6873f95..80fc0b9b1 100644 --- a/drivers/acpi/acpica/evevent.c +++ b/drivers/acpi/acpica/evevent.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c index b78dc7c6d..9f015782c 100644 --- a/drivers/acpi/acpica/evglock.c +++ b/drivers/acpi/acpica/evglock.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index ccf793247..b47e62aaf 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,8 +92,8 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info) ACPI_SET_BIT(gpe_register_info->enable_for_run, (u8)register_bit); } - gpe_register_info->enable_mask = gpe_register_info->enable_for_run; + gpe_register_info->enable_mask = gpe_register_info->enable_for_run; return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index e0f24c504..9275e626e 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -167,6 +167,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) if (gpe_block->next) { gpe_block->next->previous = gpe_block->previous; } + acpi_os_release_lock(acpi_gbl_gpe_lock, flags); } diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index ea4c0d3fc..9fdd8d091 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c index 3a958f361..66c4b5b7c 100644 --- a/drivers/acpi/acpica/evgpeutil.c +++ b/drivers/acpi/acpica/evgpeutil.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -346,6 +346,7 @@ acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info, ACPI_FREE(notify); notify = next; } + gpe_event_info->dispatch.notify_list = NULL; gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c index 74e8595f5..0f6be8956 100644 --- a/drivers/acpi/acpica/evhandler.c +++ b/drivers/acpi/acpica/evhandler.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -159,7 +159,7 @@ acpi_ev_has_default_handler(struct acpi_namespace_node *node, obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { - handler_obj = obj_desc->device.handler; + handler_obj = obj_desc->common_notify.handler; /* Walk the linked list of handlers for this object */ @@ -247,35 +247,31 @@ acpi_ev_install_handler(acpi_handle obj_handle, /* Check if this Device already has a handler for this address space */ - next_handler_obj = obj_desc->device.handler; - while (next_handler_obj) { + next_handler_obj = + acpi_ev_find_region_handler(handler_obj->address_space. + space_id, + obj_desc->common_notify. + handler); + if (next_handler_obj) { /* Found a handler, is it for the same address space? */ - if (next_handler_obj->address_space.space_id == - handler_obj->address_space.space_id) { - ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Found handler for region [%s] in device %p(%p) " - "handler %p\n", - acpi_ut_get_region_name - (handler_obj->address_space. - space_id), obj_desc, - next_handler_obj, - handler_obj)); - - /* - * Since the object we found it on was a device, then it - * means that someone has already installed a handler for - * the branch of the namespace from this device on. Just - * bail out telling the walk routine to not traverse this - * branch. This preserves the scoping rule for handlers. - */ - return (AE_CTRL_DEPTH); - } - - /* Walk the linked list of handlers attached to this device */ - - next_handler_obj = next_handler_obj->address_space.next; + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Found handler for region [%s] in device %p(%p) handler %p\n", + acpi_ut_get_region_name(handler_obj-> + address_space. + space_id), + obj_desc, next_handler_obj, + handler_obj)); + + /* + * Since the object we found it on was a device, then it means + * that someone has already installed a handler for the branch + * of the namespace from this device on. Just bail out telling + * the walk routine to not traverse this branch. This preserves + * the scoping rule for handlers. + */ + return (AE_CTRL_DEPTH); } /* @@ -309,6 +305,44 @@ acpi_ev_install_handler(acpi_handle obj_handle, /******************************************************************************* * + * FUNCTION: acpi_ev_find_region_handler + * + * PARAMETERS: space_id - The address space ID + * handler_obj - Head of the handler object list + * + * RETURN: Matching handler object. NULL if space ID not matched + * + * DESCRIPTION: Search a handler object list for a match on the address + * space ID. + * + ******************************************************************************/ + +union acpi_operand_object *acpi_ev_find_region_handler(acpi_adr_space_type + space_id, + union acpi_operand_object + *handler_obj) +{ + + /* Walk the handler list for this device */ + + while (handler_obj) { + + /* Same space_id indicates a handler is installed */ + + if (handler_obj->address_space.space_id == space_id) { + return (handler_obj); + } + + /* Next handler object */ + + handler_obj = handler_obj->address_space.next; + } + + return (NULL); +} + +/******************************************************************************* + * * FUNCTION: acpi_ev_install_space_handler * * PARAMETERS: node - Namespace node for the device @@ -332,15 +366,15 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj; - acpi_status status; + acpi_status status = AE_OK; acpi_object_type type; u8 flags = 0; ACPI_FUNCTION_TRACE(ev_install_space_handler); /* - * This registration is valid for only the types below and the root. This - * is where the default handlers get placed. + * This registration is valid for only the types below and the root. + * The root node is where the default handlers get installed. */ if ((node->type != ACPI_TYPE_DEVICE) && (node->type != ACPI_TYPE_PROCESSOR) && @@ -407,38 +441,30 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { /* - * The attached device object already exists. Make sure the handler - * is not already installed. + * The attached device object already exists. Now make sure + * the handler is not already installed. */ - handler_obj = obj_desc->device.handler; - - /* Walk the handler list for this device */ - - while (handler_obj) { - - /* Same space_id indicates a handler already installed */ + handler_obj = acpi_ev_find_region_handler(space_id, + obj_desc-> + common_notify. + handler); - if (handler_obj->address_space.space_id == space_id) { - if (handler_obj->address_space.handler == - handler) { - /* - * It is (relatively) OK to attempt to install the SAME - * handler twice. This can easily happen with the - * PCI_Config space. - */ - status = AE_SAME_HANDLER; - goto unlock_and_exit; - } else { - /* A handler is already installed */ - - status = AE_ALREADY_EXISTS; - } + if (handler_obj) { + if (handler_obj->address_space.handler == handler) { + /* + * It is (relatively) OK to attempt to install the SAME + * handler twice. This can easily happen with the + * PCI_Config space. + */ + status = AE_SAME_HANDLER; goto unlock_and_exit; - } + } else { + /* A handler is already installed */ - /* Walk the linked list of handlers */ + status = AE_ALREADY_EXISTS; + } - handler_obj = handler_obj->address_space.next; + goto unlock_and_exit; } } else { ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, @@ -477,7 +503,8 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, } ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Installing address handler for region %s(%X) on Device %4.4s %p(%p)\n", + "Installing address handler for region %s(%X) " + "on Device %4.4s %p(%p)\n", acpi_ut_get_region_name(space_id), space_id, acpi_ut_get_node_name(node), node, obj_desc)); @@ -506,28 +533,26 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, /* Install at head of Device.address_space list */ - handler_obj->address_space.next = obj_desc->device.handler; + handler_obj->address_space.next = obj_desc->common_notify.handler; /* * The Device object is the first reference on the handler_obj. * Each region that uses the handler adds a reference. */ - obj_desc->device.handler = handler_obj; + obj_desc->common_notify.handler = handler_obj; /* - * Walk the namespace finding all of the regions this - * handler will manage. + * Walk the namespace finding all of the regions this handler will + * manage. * - * Start at the device and search the branch toward - * the leaf nodes until either the leaf is encountered or - * a device is detected that has an address handler of the - * same type. + * Start at the device and search the branch toward the leaf nodes + * until either the leaf is encountered or a device is detected that + * has an address handler of the same type. * - * In either case, back up and search down the remainder - * of the branch + * In either case, back up and search down the remainder of the branch */ - status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, + status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, + ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, acpi_ev_install_handler, NULL, handler_obj, NULL); diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index f7c9dfe7b..c67d78c59 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -68,6 +68,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_notify_dispatch(void *context); u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node) { + switch (node->type) { case ACPI_TYPE_DEVICE: case ACPI_TYPE_PROCESSOR: @@ -170,8 +171,8 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node, acpi_ut_get_notify_name(notify_value, ACPI_TYPE_ANY), node)); - status = acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch, - info); + status = acpi_os_execute(OSL_NOTIFY_HANDLER, + acpi_ev_notify_dispatch, info); if (ACPI_FAILURE(status)) { acpi_ut_delete_generic_state(info); } diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 5ee79a16f..47092b4d6 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -97,15 +97,12 @@ acpi_status acpi_ev_initialize_op_regions(void) if (acpi_ev_has_default_handler(acpi_gbl_root_node, acpi_gbl_default_address_spaces [i])) { - status = - acpi_ev_execute_reg_methods(acpi_gbl_root_node, - acpi_gbl_default_address_spaces - [i]); + acpi_ev_execute_reg_methods(acpi_gbl_root_node, + acpi_gbl_default_address_spaces + [i], ACPI_REG_CONNECT); } } - acpi_gbl_reg_methods_executed = TRUE; - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(status); } @@ -127,6 +124,12 @@ acpi_status acpi_ev_initialize_op_regions(void) * DESCRIPTION: Dispatch an address space or operation region access to * a previously installed handler. * + * NOTE: During early initialization, we always install the default region + * handlers for Memory, I/O and PCI_Config. This ensures that these operation + * region address spaces are always available as per the ACPI specification. + * This is especially needed in order to support the execution of + * module-level AML code during loading of the ACPI tables. + * ******************************************************************************/ acpi_status @@ -498,6 +501,12 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, ACPI_FUNCTION_TRACE(ev_attach_region); + /* Install the region's handler */ + + if (region_obj->region.handler) { + return_ACPI_STATUS(AE_ALREADY_EXISTS); + } + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, "Adding Region [%4.4s] %p to address handler %p [%s]\n", acpi_ut_get_node_name(region_obj->region.node), @@ -509,17 +518,56 @@ acpi_ev_attach_region(union acpi_operand_object *handler_obj, region_obj->region.next = handler_obj->address_space.region_list; handler_obj->address_space.region_list = region_obj; + region_obj->region.handler = handler_obj; + acpi_ut_add_reference(handler_obj); - /* Install the region's handler */ + return_ACPI_STATUS(AE_OK); +} - if (region_obj->region.handler) { - return_ACPI_STATUS(AE_ALREADY_EXISTS); +/******************************************************************************* + * + * FUNCTION: acpi_ev_associate_reg_method + * + * PARAMETERS: region_obj - Region object + * + * RETURN: Status + * + * DESCRIPTION: Find and associate _REG method to a region + * + ******************************************************************************/ + +void acpi_ev_associate_reg_method(union acpi_operand_object *region_obj) +{ + acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; + struct acpi_namespace_node *method_node; + struct acpi_namespace_node *node; + union acpi_operand_object *region_obj2; + acpi_status status; + + ACPI_FUNCTION_TRACE(ev_associate_reg_method); + + region_obj2 = acpi_ns_get_secondary_object(region_obj); + if (!region_obj2) { + return_VOID; } - region_obj->region.handler = handler_obj; - acpi_ut_add_reference(handler_obj); + node = region_obj->region.node->parent; - return_ACPI_STATUS(AE_OK); + /* Find any "_REG" method associated with this region definition */ + + status = + acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, + &method_node); + if (ACPI_SUCCESS(status)) { + /* + * The _REG method is optional and there can be only one per region + * definition. This will be executed when the handler is attached + * or removed + */ + region_obj2->extra.method_REG = method_node; + } + + return_VOID; } /******************************************************************************* @@ -550,7 +598,18 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) return_ACPI_STATUS(AE_NOT_EXIST); } - if (region_obj2->extra.method_REG == NULL) { + if (region_obj2->extra.method_REG == NULL || + region_obj->region.handler == NULL || + !acpi_gbl_reg_methods_enabled) { + return_ACPI_STATUS(AE_OK); + } + + /* _REG(DISCONNECT) should be paired with _REG(CONNECT) */ + + if ((function == ACPI_REG_CONNECT && + region_obj->common.flags & AOPOBJ_REG_CONNECTED) || + (function == ACPI_REG_DISCONNECT && + !(region_obj->common.flags & AOPOBJ_REG_CONNECTED))) { return_ACPI_STATUS(AE_OK); } @@ -599,6 +658,16 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) status = acpi_ns_evaluate(info); acpi_ut_remove_reference(args[1]); + if (ACPI_FAILURE(status)) { + goto cleanup2; + } + + if (function == ACPI_REG_CONNECT) { + region_obj->common.flags |= AOPOBJ_REG_CONNECTED; + } else { + region_obj->common.flags &= ~AOPOBJ_REG_CONNECTED; + } + cleanup2: acpi_ut_remove_reference(args[0]); @@ -613,24 +682,25 @@ cleanup1: * * PARAMETERS: node - Namespace node for the device * space_id - The address space ID + * function - Passed to _REG: On (1) or Off (0) * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Run all _REG methods for the input Space ID; * Note: assumes namespace is locked, or system init time. * ******************************************************************************/ -acpi_status +void acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, - acpi_adr_space_type space_id) + acpi_adr_space_type space_id, u32 function) { - acpi_status status; struct acpi_reg_walk_info info; ACPI_FUNCTION_TRACE(ev_execute_reg_methods); info.space_id = space_id; + info.function = function; info.reg_run_count = 0; ACPI_DEBUG_PRINT_RAW((ACPI_DB_NAMES, @@ -643,9 +713,9 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, * regions and _REG methods. (i.e. handlers must be installed for all * regions of this Space ID before we can run any _REG methods) */ - status = acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, - ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, - NULL, &info, NULL); + (void)acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX, + ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL, + &info, NULL); /* Special case for EC: handle "orphan" _REG methods with no region */ @@ -658,7 +728,7 @@ acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, info.reg_run_count, acpi_ut_get_region_name(info.space_id))); - return_ACPI_STATUS(status); + return_VOID; } /******************************************************************************* @@ -717,7 +787,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, } info->reg_run_count++; - status = acpi_ev_execute_reg_method(obj_desc, ACPI_REG_CONNECT); + status = acpi_ev_execute_reg_method(obj_desc, info->function); return (status); } diff --git a/drivers/acpi/acpica/evrgnini.c b/drivers/acpi/acpica/evrgnini.c index da323390b..fda869c9a 100644 --- a/drivers/acpi/acpica/evrgnini.c +++ b/drivers/acpi/acpica/evrgnini.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -507,9 +507,6 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, acpi_adr_space_type space_id; struct acpi_namespace_node *node; acpi_status status; - struct acpi_namespace_node *method_node; - acpi_name *reg_name_ptr = (acpi_name *) METHOD_NAME__REG; - union acpi_operand_object *region_obj2; ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked); @@ -521,38 +518,15 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, return_ACPI_STATUS(AE_OK); } - region_obj2 = acpi_ns_get_secondary_object(region_obj); - if (!region_obj2) { - return_ACPI_STATUS(AE_NOT_EXIST); - } + acpi_ev_associate_reg_method(region_obj); + region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; node = region_obj->region.node->parent; space_id = region_obj->region.space_id; - /* Setup defaults */ - - region_obj->region.handler = NULL; - region_obj2->extra.method_REG = NULL; - region_obj->common.flags &= ~(AOPOBJ_SETUP_COMPLETE); - region_obj->common.flags |= AOPOBJ_OBJECT_INITIALIZED; - - /* Find any "_REG" method associated with this region definition */ - - status = - acpi_ns_search_one_scope(*reg_name_ptr, node, ACPI_TYPE_METHOD, - &method_node); - if (ACPI_SUCCESS(status)) { - /* - * The _REG method is optional and there can be only one per region - * definition. This will be executed when the handler is attached - * or removed - */ - region_obj2->extra.method_REG = method_node; - } - /* * The following loop depends upon the root Node having no parent - * ie: acpi_gbl_root_node->parent_entry being set to NULL + * ie: acpi_gbl_root_node->Parent being set to NULL */ while (node) { @@ -566,18 +540,10 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, switch (node->type) { case ACPI_TYPE_DEVICE: - - handler_obj = obj_desc->device.handler; - break; - case ACPI_TYPE_PROCESSOR: - - handler_obj = obj_desc->processor.handler; - break; - case ACPI_TYPE_THERMAL: - handler_obj = obj_desc->thermal_zone.handler; + handler_obj = obj_desc->common_notify.handler; break; case ACPI_TYPE_METHOD: @@ -602,60 +568,49 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, break; } - while (handler_obj) { - - /* Is this handler of the correct type? */ + handler_obj = + acpi_ev_find_region_handler(space_id, handler_obj); + if (handler_obj) { - if (handler_obj->address_space.space_id == - space_id) { + /* Found correct handler */ - /* Found correct handler */ + ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, + "Found handler %p for region %p in obj %p\n", + handler_obj, region_obj, + obj_desc)); - ACPI_DEBUG_PRINT((ACPI_DB_OPREGION, - "Found handler %p for region %p in obj %p\n", - handler_obj, + status = + acpi_ev_attach_region(handler_obj, region_obj, - obj_desc)); + acpi_ns_locked); + /* + * Tell all users that this region is usable by + * running the _REG method + */ + if (acpi_ns_locked) { status = - acpi_ev_attach_region(handler_obj, - region_obj, - acpi_ns_locked); - - /* - * Tell all users that this region is usable by - * running the _REG method - */ - if (acpi_ns_locked) { - status = - acpi_ut_release_mutex - (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS - (status); - } + acpi_ut_release_mutex + (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } + } + status = + acpi_ev_execute_reg_method(region_obj, + ACPI_REG_CONNECT); + + if (acpi_ns_locked) { status = - acpi_ev_execute_reg_method - (region_obj, ACPI_REG_CONNECT); - - if (acpi_ns_locked) { - status = - acpi_ut_acquire_mutex - (ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS - (status); - } + acpi_ut_acquire_mutex + (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); } - - return_ACPI_STATUS(AE_OK); } - /* Try next handler in the list */ - - handler_obj = handler_obj->address_space.next; + return_ACPI_STATUS(AE_OK); } } diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index 0366703d2..3b7757c9c 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 07d22bfba..e4e9260cd 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -879,9 +879,8 @@ acpi_install_gpe_handler(acpi_handle gpe_device, ACPI_FUNCTION_TRACE(acpi_install_gpe_handler); - status = - acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, FALSE, - address, context); + status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, + FALSE, address, context); return_ACPI_STATUS(status); } @@ -914,8 +913,8 @@ acpi_install_gpe_raw_handler(acpi_handle gpe_device, ACPI_FUNCTION_TRACE(acpi_install_gpe_raw_handler); - status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, TRUE, - address, context); + status = acpi_ev_install_gpe_handler(gpe_device, gpe_number, type, + TRUE, address, context); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 10ce48e16..9179e9abe 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 70eb47e3d..904567148 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index f21afbab0..d27430671 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,41 +112,9 @@ acpi_install_address_space_handler(acpi_handle device, goto unlock_and_exit; } - /* - * For the default space_IDs, (the IDs for which there are default region handlers - * installed) Only execute the _REG methods if the global initialization _REG - * methods have already been run (via acpi_initialize_objects). In other words, - * we will defer the execution of the _REG methods for these space_IDs until - * execution of acpi_initialize_objects. This is done because we need the handlers - * for the default spaces (mem/io/pci/table) to be installed before we can run - * any control methods (or _REG methods). There is known BIOS code that depends - * on this. - * - * For all other space_IDs, we can safely execute the _REG methods immediately. - * This means that for IDs like embedded_controller, this function should be called - * only after acpi_enable_subsystem has been called. - */ - switch (space_id) { - case ACPI_ADR_SPACE_SYSTEM_MEMORY: - case ACPI_ADR_SPACE_SYSTEM_IO: - case ACPI_ADR_SPACE_PCI_CONFIG: - case ACPI_ADR_SPACE_DATA_TABLE: - - if (!acpi_gbl_reg_methods_executed) { - - /* We will defer execution of the _REG methods for this space */ - goto unlock_and_exit; - } - break; - - default: - - break; - } - /* Run all _REG methods for this address space */ - status = acpi_ev_execute_reg_methods(node, space_id); + acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT); unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); @@ -215,8 +183,8 @@ acpi_remove_address_space_handler(acpi_handle device, /* Find the address handler the user requested */ - handler_obj = obj_desc->device.handler; - last_obj_ptr = &obj_desc->device.handler; + handler_obj = obj_desc->common_notify.handler; + last_obj_ptr = &obj_desc->common_notify.handler; while (handler_obj) { /* We have a handler, see if user requested this one */ diff --git a/drivers/acpi/acpica/exconfig.c b/drivers/acpi/acpica/exconfig.c index b540913c1..011df210b 100644 --- a/drivers/acpi/acpica/exconfig.c +++ b/drivers/acpi/acpica/exconfig.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -358,8 +358,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, } /* - * If the Region Address and Length have not been previously evaluated, - * evaluate them now and save the results. + * If the Region Address and Length have not been previously + * evaluated, evaluate them now and save the results. */ if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) { status = acpi_ds_get_region_arguments(obj_desc); @@ -454,8 +454,8 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc, } /* - * Copy the table from the buffer because the buffer could be modified - * or even deleted in the future + * Copy the table from the buffer because the buffer could be + * modified or even deleted in the future */ table = ACPI_ALLOCATE(length); if (!table) { diff --git a/drivers/acpi/acpica/exconvrt.c b/drivers/acpi/acpica/exconvrt.c index 1e4c5b6dc..0b9f2c13b 100644 --- a/drivers/acpi/acpica/exconvrt.c +++ b/drivers/acpi/acpica/exconvrt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -227,8 +227,8 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc, /* Copy the integer to the buffer, LSB first */ new_buf = return_desc->buffer.pointer; - memcpy(new_buf, - &obj_desc->integer.value, acpi_gbl_integer_byte_width); + memcpy(new_buf, &obj_desc->integer.value, + acpi_gbl_integer_byte_width); break; case ACPI_TYPE_STRING: @@ -354,9 +354,8 @@ acpi_ex_convert_to_ascii(u64 integer, u16 base, u8 *string, u8 data_width) /* Get one hex digit, most significant digits first */ - string[k] = - (u8) acpi_ut_hex_to_ascii_char(integer, - ACPI_MUL_4(j)); + string[k] = (u8) + acpi_ut_hex_to_ascii_char(integer, ACPI_MUL_4(j)); k++; } break; diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index ccb7219bd..bea9612e4 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -189,9 +189,9 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) /* Attach object to the Node */ - status = - acpi_ns_attach_object((struct acpi_namespace_node *)walk_state-> - operands[0], obj_desc, ACPI_TYPE_EVENT); + status = acpi_ns_attach_object((struct acpi_namespace_node *) + walk_state->operands[0], obj_desc, + ACPI_TYPE_EVENT); cleanup: /* @@ -326,9 +326,10 @@ acpi_ex_create_region(u8 * aml_start, * Remember location in AML stream of address & length * operands since they need to be evaluated at run time. */ - region_obj2 = obj_desc->common.next_object; + region_obj2 = acpi_ns_get_secondary_object(obj_desc); region_obj2->extra.aml_start = aml_start; region_obj2->extra.aml_length = aml_length; + region_obj2->extra.method_REG = NULL; if (walk_state->scope_info) { region_obj2->extra.scope_node = walk_state->scope_info->scope.node; @@ -342,6 +343,10 @@ acpi_ex_create_region(u8 * aml_start, obj_desc->region.address = 0; obj_desc->region.length = 0; obj_desc->region.node = node; + obj_desc->region.handler = NULL; + obj_desc->common.flags &= + ~(AOPOBJ_SETUP_COMPLETE | AOPOBJ_REG_CONNECTED | + AOPOBJ_OBJECT_INITIALIZED); /* Install the new region object in the parent Node */ @@ -492,10 +497,9 @@ acpi_ex_create_method(u8 * aml_start, * Disassemble the method flags. Split off the arg_count, Serialized * flag, and sync_level for efficiency. */ - method_flags = (u8) operand[1]->integer.value; - - obj_desc->method.param_count = - (u8) (method_flags & AML_METHOD_ARG_COUNT); + method_flags = (u8)operand[1]->integer.value; + obj_desc->method.param_count = (u8) + (method_flags & AML_METHOD_ARG_COUNT); /* * Get the sync_level. If method is serialized, a mutex will be diff --git a/drivers/acpi/acpica/exdebug.c b/drivers/acpi/acpica/exdebug.c index de9245823..37a509d01 100644 --- a/drivers/acpi/acpica/exdebug.c +++ b/drivers/acpi/acpica/exdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,21 +43,11 @@ #include <acpi/acpi.h> #include "accommon.h" -#include "acnamesp.h" #include "acinterp.h" -#include "acparser.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME("exdebug") -static union acpi_operand_object *acpi_gbl_trace_method_object = NULL; - -/* Local prototypes */ - -#ifdef ACPI_DEBUG_OUTPUT -static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type); -#endif - #ifndef ACPI_NO_ERROR_MESSAGES /******************************************************************************* * @@ -80,7 +70,6 @@ static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type); * enabled if necessary. * ******************************************************************************/ - void acpi_ex_do_debug_object(union acpi_operand_object *source_desc, u32 level, u32 index) @@ -99,20 +88,40 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, return_VOID; } - /* - * We will emit the current timer value (in microseconds) with each - * debug output. Only need the lower 26 bits. This allows for 67 - * million microseconds or 67 seconds before rollover. - */ - timer = ((u32)acpi_os_get_timer() / 10); /* (100 nanoseconds to microseconds) */ - timer &= 0x03FFFFFF; + /* Null string or newline -- don't emit the line header */ + + if (source_desc && + (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) && + (source_desc->common.type == ACPI_TYPE_STRING)) { + if ((source_desc->string.length == 0) || + ((source_desc->string.length == 1) && + (*source_desc->string.pointer == '\n'))) { + acpi_os_printf("\n"); + return_VOID; + } + } /* * Print line header as long as we are not in the middle of an * object display */ if (!((level > 0) && index == 0)) { - acpi_os_printf("[ACPI Debug %.8u] %*s", timer, level, " "); + if (acpi_gbl_display_debug_timer) { + /* + * We will emit the current timer value (in microseconds) with each + * debug output. Only need the lower 26 bits. This allows for 67 + * million microseconds or 67 seconds before rollover. + * + * Convert 100 nanosecond units to microseconds + */ + timer = ((u32)acpi_os_get_timer() / 10); + timer &= 0x03FFFFFF; + + acpi_os_printf("[ACPI Debug T=0x%8.8X] %*s", timer, + level, " "); + } else { + acpi_os_printf("[ACPI Debug] %*s", level, " "); + } } /* Display the index for package output only */ @@ -127,8 +136,15 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, } if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) { - acpi_os_printf("%s ", - acpi_ut_get_object_type_name(source_desc)); + + /* No object type prefix needed for integers and strings */ + + if ((source_desc->common.type != ACPI_TYPE_INTEGER) && + (source_desc->common.type != ACPI_TYPE_STRING)) { + acpi_os_printf("%s ", + acpi_ut_get_object_type_name + (source_desc)); + } if (!acpi_ut_valid_internal_object(source_desc)) { acpi_os_printf("%p, Invalid Internal Object!\n", @@ -137,7 +153,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, } } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_NAMED) { - acpi_os_printf("%s: %p\n", + acpi_os_printf("%s (Node %p)\n", acpi_ut_get_type_name(((struct acpi_namespace_node *) source_desc)->type), @@ -175,14 +191,12 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, case ACPI_TYPE_STRING: - acpi_os_printf("[0x%.2X] \"%s\"\n", - source_desc->string.length, - source_desc->string.pointer); + acpi_os_printf("\"%s\"\n", source_desc->string.pointer); break; case ACPI_TYPE_PACKAGE: - acpi_os_printf("[Contains 0x%.2X Elements]\n", + acpi_os_printf("(Contains 0x%.2X Elements):\n", source_desc->package.count); /* Output the entire contents of the package */ @@ -261,11 +275,14 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, if (ACPI_GET_DESCRIPTOR_TYPE (source_desc->reference.object) == ACPI_DESC_TYPE_NAMED) { - acpi_ex_do_debug_object(((struct - acpi_namespace_node *) + + /* Reference object is a namespace node */ + + acpi_ex_do_debug_object(ACPI_CAST_PTR + (union + acpi_operand_object, source_desc->reference. - object)->object, - level + 4, 0); + object), level + 4, 0); } else { object_desc = source_desc->reference.object; value = source_desc->reference.value; @@ -293,9 +310,14 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, case ACPI_TYPE_PACKAGE: acpi_os_printf("Package[%u] = ", value); - acpi_ex_do_debug_object(*source_desc-> - reference.where, - level + 4, 0); + if (!(*source_desc->reference.where)) { + acpi_os_printf + ("[Uninitialized Package Element]\n"); + } else { + acpi_ex_do_debug_object + (*source_desc->reference. + where, level + 4, 0); + } break; default: @@ -311,7 +333,7 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, default: - acpi_os_printf("%p\n", source_desc); + acpi_os_printf("(Descriptor %p)\n", source_desc); break; } @@ -319,316 +341,3 @@ acpi_ex_do_debug_object(union acpi_operand_object *source_desc, return_VOID; } #endif - -/******************************************************************************* - * - * FUNCTION: acpi_ex_interpreter_trace_enabled - * - * PARAMETERS: name - Whether method name should be matched, - * this should be checked before starting - * the tracer - * - * RETURN: TRUE if interpreter trace is enabled. - * - * DESCRIPTION: Check whether interpreter trace is enabled - * - ******************************************************************************/ - -static u8 acpi_ex_interpreter_trace_enabled(char *name) -{ - - /* Check if tracing is enabled */ - - if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED)) { - return (FALSE); - } - - /* - * Check if tracing is filtered: - * - * 1. If the tracer is started, acpi_gbl_trace_method_object should have - * been filled by the trace starter - * 2. If the tracer is not started, acpi_gbl_trace_method_name should be - * matched if it is specified - * 3. If the tracer is oneshot style, acpi_gbl_trace_method_name should - * not be cleared by the trace stopper during the first match - */ - if (acpi_gbl_trace_method_object) { - return (TRUE); - } - if (name && - (acpi_gbl_trace_method_name && - strcmp(acpi_gbl_trace_method_name, name))) { - return (FALSE); - } - if ((acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) && - !acpi_gbl_trace_method_name) { - return (FALSE); - } - - return (TRUE); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ex_get_trace_event_name - * - * PARAMETERS: type - Trace event type - * - * RETURN: Trace event name. - * - * DESCRIPTION: Used to obtain the full trace event name. - * - ******************************************************************************/ - -#ifdef ACPI_DEBUG_OUTPUT - -static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type) -{ - switch (type) { - case ACPI_TRACE_AML_METHOD: - - return "Method"; - - case ACPI_TRACE_AML_OPCODE: - - return "Opcode"; - - case ACPI_TRACE_AML_REGION: - - return "Region"; - - default: - - return ""; - } -} - -#endif - -/******************************************************************************* - * - * FUNCTION: acpi_ex_trace_point - * - * PARAMETERS: type - Trace event type - * begin - TRUE if before execution - * aml - Executed AML address - * pathname - Object path - * - * RETURN: None - * - * DESCRIPTION: Internal interpreter execution trace. - * - ******************************************************************************/ - -void -acpi_ex_trace_point(acpi_trace_event_type type, - u8 begin, u8 *aml, char *pathname) -{ - - ACPI_FUNCTION_NAME(ex_trace_point); - - if (pathname) { - ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, - "%s %s [0x%p:%s] execution.\n", - acpi_ex_get_trace_event_name(type), - begin ? "Begin" : "End", aml, pathname)); - } else { - ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, - "%s %s [0x%p] execution.\n", - acpi_ex_get_trace_event_name(type), - begin ? "Begin" : "End", aml)); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_ex_start_trace_method - * - * PARAMETERS: method_node - Node of the method - * obj_desc - The method object - * walk_state - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Start control method execution trace - * - ******************************************************************************/ - -void -acpi_ex_start_trace_method(struct acpi_namespace_node *method_node, - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state) -{ - acpi_status status; - char *pathname = NULL; - u8 enabled = FALSE; - - ACPI_FUNCTION_NAME(ex_start_trace_method); - - if (method_node) { - pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); - } - - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - goto exit; - } - - enabled = acpi_ex_interpreter_trace_enabled(pathname); - if (enabled && !acpi_gbl_trace_method_object) { - acpi_gbl_trace_method_object = obj_desc; - acpi_gbl_original_dbg_level = acpi_dbg_level; - acpi_gbl_original_dbg_layer = acpi_dbg_layer; - acpi_dbg_level = ACPI_TRACE_LEVEL_ALL; - acpi_dbg_layer = ACPI_TRACE_LAYER_ALL; - - if (acpi_gbl_trace_dbg_level) { - acpi_dbg_level = acpi_gbl_trace_dbg_level; - } - if (acpi_gbl_trace_dbg_layer) { - acpi_dbg_layer = acpi_gbl_trace_dbg_layer; - } - } - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - -exit: - if (enabled) { - ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, TRUE, - obj_desc ? obj_desc->method.aml_start : NULL, - pathname); - } - if (pathname) { - ACPI_FREE(pathname); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_ex_stop_trace_method - * - * PARAMETERS: method_node - Node of the method - * obj_desc - The method object - * walk_state - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Stop control method execution trace - * - ******************************************************************************/ - -void -acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node, - union acpi_operand_object *obj_desc, - struct acpi_walk_state *walk_state) -{ - acpi_status status; - char *pathname = NULL; - u8 enabled; - - ACPI_FUNCTION_NAME(ex_stop_trace_method); - - if (method_node) { - pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); - } - - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - goto exit_path; - } - - enabled = acpi_ex_interpreter_trace_enabled(NULL); - - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - - if (enabled) { - ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, FALSE, - obj_desc ? obj_desc->method.aml_start : NULL, - pathname); - } - - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - goto exit_path; - } - - /* Check whether the tracer should be stopped */ - - if (acpi_gbl_trace_method_object == obj_desc) { - - /* Disable further tracing if type is one-shot */ - - if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) { - acpi_gbl_trace_method_name = NULL; - } - - acpi_dbg_level = acpi_gbl_original_dbg_level; - acpi_dbg_layer = acpi_gbl_original_dbg_layer; - acpi_gbl_trace_method_object = NULL; - } - - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - -exit_path: - if (pathname) { - ACPI_FREE(pathname); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_ex_start_trace_opcode - * - * PARAMETERS: op - The parser opcode object - * walk_state - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Start opcode execution trace - * - ******************************************************************************/ - -void -acpi_ex_start_trace_opcode(union acpi_parse_object *op, - struct acpi_walk_state *walk_state) -{ - - ACPI_FUNCTION_NAME(ex_start_trace_opcode); - - if (acpi_ex_interpreter_trace_enabled(NULL) && - (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { - ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, TRUE, - op->common.aml, op->common.aml_op_name); - } -} - -/******************************************************************************* - * - * FUNCTION: acpi_ex_stop_trace_opcode - * - * PARAMETERS: op - The parser opcode object - * walk_state - current state, NULL if not yet executing - * a method. - * - * RETURN: None - * - * DESCRIPTION: Stop opcode execution trace - * - ******************************************************************************/ - -void -acpi_ex_stop_trace_opcode(union acpi_parse_object *op, - struct acpi_walk_state *walk_state) -{ - - ACPI_FUNCTION_NAME(ex_stop_trace_opcode); - - if (acpi_ex_interpreter_trace_enabled(NULL) && - (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { - ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, FALSE, - op->common.aml, op->common.aml_op_name); - } -} diff --git a/drivers/acpi/acpica/exdump.c b/drivers/acpi/acpica/exdump.c index d836f888b..ee30974b2 100644 --- a/drivers/acpi/acpica/exdump.c +++ b/drivers/acpi/acpica/exdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -508,7 +508,8 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, if (next) { acpi_os_printf("(%s %2.2X)", acpi_ut_get_object_type_name - (next), next->common.type); + (next), + next->address_space.space_id); while (next->address_space.next) { if ((next->common.type == @@ -520,7 +521,8 @@ acpi_ex_dump_object(union acpi_operand_object *obj_desc, acpi_os_printf("->%p(%s %2.2X)", next, acpi_ut_get_object_type_name (next), - next->common.type); + next->address_space. + space_id); if ((next == start) || (next == data)) { acpi_os_printf diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index 61fd9c7b8..d5d8020a8 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -167,10 +167,11 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, || obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus, GSBus or IPMI read. We must create a buffer to hold - * the data and then directly access the region handler. + * This is an SMBus, GSBus or IPMI read. We must create a buffer to + * hold the data and then directly access the region handler. * - * Note: SMBus and GSBus protocol value is passed in upper 16-bits of Function + * Note: SMBus and GSBus protocol value is passed in upper 16-bits + * of Function */ if (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_SMBUS) { @@ -180,17 +181,17 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, } else if (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) { accessor_type = obj_desc->field.attribute; - length = acpi_ex_get_serial_access_length(accessor_type, - obj_desc-> - field. - access_length); + length = + acpi_ex_get_serial_access_length(accessor_type, + obj_desc->field. + access_length); /* * Add additional 2 bytes for the generic_serial_bus data buffer: * - * Status; (Byte 0 of the data buffer) - * Length; (Byte 1 of the data buffer) - * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) */ length += 2; function = ACPI_READ | (accessor_type << 16); @@ -216,6 +217,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, buffer_desc-> buffer.pointer), function); + acpi_ex_release_global_lock(obj_desc->common_field.field_flags); goto exit; } @@ -232,6 +234,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, */ length = (acpi_size) ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->field.bit_length); + if (length > acpi_gbl_integer_byte_width) { /* Field is too large for an Integer, create a Buffer instead */ @@ -273,8 +276,10 @@ acpi_ex_read_data_from_field(struct acpi_walk_state * walk_state, /* Perform the write */ - status = acpi_ex_access_region(obj_desc, 0, - (u64 *)buffer, ACPI_READ); + status = + acpi_ex_access_region(obj_desc, 0, (u64 *)buffer, + ACPI_READ); + acpi_ex_release_global_lock(obj_desc->common_field.field_flags); if (ACPI_FAILURE(status)) { acpi_ut_remove_reference(buffer_desc); @@ -366,19 +371,22 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, || obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_IPMI)) { /* - * This is an SMBus, GSBus or IPMI write. We will bypass the entire field - * mechanism and handoff the buffer directly to the handler. For - * these address spaces, the buffer is bi-directional; on a write, - * return data is returned in the same buffer. + * This is an SMBus, GSBus or IPMI write. We will bypass the entire + * field mechanism and handoff the buffer directly to the handler. + * For these address spaces, the buffer is bi-directional; on a + * write, return data is returned in the same buffer. * * Source must be a buffer of sufficient size: - * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or ACPI_IPMI_BUFFER_SIZE. + * ACPI_SMBUS_BUFFER_SIZE, ACPI_GSBUS_BUFFER_SIZE, or + * ACPI_IPMI_BUFFER_SIZE. * - * Note: SMBus and GSBus protocol type is passed in upper 16-bits of Function + * Note: SMBus and GSBus protocol type is passed in upper 16-bits + * of Function */ if (source_desc->common.type != ACPI_TYPE_BUFFER) { ACPI_ERROR((AE_INFO, - "SMBus/IPMI/GenericSerialBus write requires Buffer, found type %s", + "SMBus/IPMI/GenericSerialBus write requires " + "Buffer, found type %s", acpi_ut_get_object_type_name(source_desc))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); @@ -392,17 +400,17 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, } else if (obj_desc->field.region_obj->region.space_id == ACPI_ADR_SPACE_GSBUS) { accessor_type = obj_desc->field.attribute; - length = acpi_ex_get_serial_access_length(accessor_type, - obj_desc-> - field. - access_length); + length = + acpi_ex_get_serial_access_length(accessor_type, + obj_desc->field. + access_length); /* * Add additional 2 bytes for the generic_serial_bus data buffer: * - * Status; (Byte 0 of the data buffer) - * Length; (Byte 1 of the data buffer) - * Data[x-1]; (Bytes 2-x of the arbitrary length data buffer) + * Status; (Byte 0 of the data buffer) + * Length; (Byte 1 of the data buffer) + * Data[x-1]: (Bytes 2-x of the arbitrary length data buffer) */ length += 2; function = ACPI_WRITE | (accessor_type << 16); @@ -414,7 +422,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, if (source_desc->buffer.length < length) { ACPI_ERROR((AE_INFO, - "SMBus/IPMI/GenericSerialBus write requires Buffer of length %u, found length %u", + "SMBus/IPMI/GenericSerialBus write requires " + "Buffer of length %u, found length %u", length, source_desc->buffer.length)); return_ACPI_STATUS(AE_AML_BUFFER_LIMIT); @@ -438,8 +447,8 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, * Perform the write (returns status and perhaps data in the * same buffer) */ - status = acpi_ex_access_region(obj_desc, 0, - (u64 *) buffer, function); + status = + acpi_ex_access_region(obj_desc, 0, (u64 *)buffer, function); acpi_ex_release_global_lock(obj_desc->common_field.field_flags); *result_desc = buffer_desc; @@ -460,7 +469,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", + "GPIO FieldWrite [FROM]: (%s:%X), Val %.8X [TO]: Pin %u Bits %u\n", acpi_ut_get_type_name(source_desc->common. type), source_desc->common.type, @@ -476,8 +485,9 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc, /* Perform the write */ - status = acpi_ex_access_region(obj_desc, 0, - (u64 *)buffer, ACPI_WRITE); + status = + acpi_ex_access_region(obj_desc, 0, (u64 *)buffer, + ACPI_WRITE); acpi_ex_release_global_lock(obj_desc->common_field.field_flags); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 70b7bbbb8..f0c5ed0b7 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -180,7 +180,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * byte, and a field with Dword access specified. */ ACPI_ERROR((AE_INFO, - "Field [%4.4s] access width (%u bytes) too large for region [%4.4s] (length %u)", + "Field [%4.4s] access width (%u bytes) " + "too large for region [%4.4s] (length %u)", acpi_ut_get_node_name(obj_desc-> common_field.node), obj_desc->common_field.access_byte_width, @@ -194,7 +195,8 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, * exceeds region length, indicate an error */ ACPI_ERROR((AE_INFO, - "Field [%4.4s] Base+Offset+Width %u+%u+%u is beyond end of region [%4.4s] (length %u)", + "Field [%4.4s] Base+Offset+Width %u+%u+%u " + "is beyond end of region [%4.4s] (length %u)", acpi_ut_get_node_name(obj_desc->common_field.node), obj_desc->common_field.base_byte_offset, field_datum_byte_offset, @@ -638,15 +640,15 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, ACPI_ERROR((AE_INFO, "Unknown UpdateRule value: 0x%X", - (obj_desc->common_field. - field_flags & + (obj_desc->common_field.field_flags & AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } } ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Mask %8.8X%8.8X, DatumOffset %X, Width %X, Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", + "Mask %8.8X%8.8X, DatumOffset %X, Width %X, " + "Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n", ACPI_FORMAT_UINT64(mask), field_datum_byte_offset, obj_desc->common_field.access_byte_width, @@ -655,8 +657,9 @@ acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc, /* Write the merged value */ - status = acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset, - &merged_value, ACPI_WRITE); + status = + acpi_ex_field_datum_io(obj_desc, field_datum_byte_offset, + &merged_value, ACPI_WRITE); return_ACPI_STATUS(status); } @@ -764,8 +767,9 @@ acpi_ex_extract_from_field(union acpi_operand_object *obj_desc, /* Get next input datum from the field */ field_offset += obj_desc->common_field.access_byte_width; - status = acpi_ex_field_datum_io(obj_desc, field_offset, - &raw_datum, ACPI_READ); + status = + acpi_ex_field_datum_io(obj_desc, field_offset, &raw_datum, + ACPI_READ); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -858,6 +862,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, new_buffer = NULL; required_length = ACPI_ROUND_BITS_UP_TO_BYTES(obj_desc->common_field.bit_length); + /* * We must have a buffer that is at least as long as the field * we are writing to. This is because individual fields are @@ -932,9 +937,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, /* Write merged datum to the target field */ merged_datum &= mask; - status = acpi_ex_write_with_update_rule(obj_desc, mask, - merged_datum, - field_offset); + status = + acpi_ex_write_with_update_rule(obj_desc, mask, merged_datum, + field_offset); if (ACPI_FAILURE(status)) { goto exit; } @@ -990,9 +995,9 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, /* Write the last datum to the field */ merged_datum &= mask; - status = acpi_ex_write_with_update_rule(obj_desc, - mask, merged_datum, - field_offset); + status = + acpi_ex_write_with_update_rule(obj_desc, mask, merged_datum, + field_offset); exit: /* Free temporary buffer if we used one */ diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index d02afece0..db30ae43d 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -98,9 +98,9 @@ acpi_ex_get_object_reference(union acpi_operand_object *obj_desc, default: - ACPI_ERROR((AE_INFO, "Unknown Reference Class 0x%2.2X", + ACPI_ERROR((AE_INFO, "Invalid Reference Class 0x%2.2X", obj_desc->reference.class)); - return_ACPI_STATUS(AE_AML_INTERNAL); + return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } break; @@ -247,6 +247,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, union acpi_operand_object *local_operand1 = operand1; union acpi_operand_object *return_desc; char *new_buf; + const char *type_string; acpi_status status; ACPI_FUNCTION_TRACE(ex_do_concatenate); @@ -266,9 +267,41 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, break; case ACPI_TYPE_STRING: + /* + * Per the ACPI spec, Concatenate only supports int/str/buf. + * However, we support all objects here as an extension. + * This improves the usefulness of the Printf() macro. + * 12/2015. + */ + switch (operand1->common.type) { + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_STRING: + case ACPI_TYPE_BUFFER: + + status = + acpi_ex_convert_to_string(operand1, &local_operand1, + ACPI_IMPLICIT_CONVERT_HEX); + break; + + default: + /* + * Just emit a string containing the object type. + */ + type_string = + acpi_ut_get_type_name(operand1->common.type); + + local_operand1 = acpi_ut_create_string_object(((acpi_size) strlen(type_string) + 9)); /* 9 For "[Object]" */ + if (!local_operand1) { + status = AE_NO_MEMORY; + goto cleanup; + } - status = acpi_ex_convert_to_string(operand1, &local_operand1, - ACPI_IMPLICIT_CONVERT_HEX); + strcpy(local_operand1->string.pointer, "["); + strcat(local_operand1->string.pointer, type_string); + strcat(local_operand1->string.pointer, " Object]"); + status = AE_OK; + break; + } break; case ACPI_TYPE_BUFFER: @@ -347,8 +380,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, /* Concatenate the strings */ strcpy(new_buf, operand0->string.pointer); - strcpy(new_buf + operand0->string.length, - local_operand1->string.pointer); + strcat(new_buf, local_operand1->string.pointer); break; case ACPI_TYPE_BUFFER: @@ -591,8 +623,9 @@ acpi_ex_do_logical_op(u16 opcode, case ACPI_TYPE_STRING: - status = acpi_ex_convert_to_string(operand1, &local_operand1, - ACPI_IMPLICIT_CONVERT_HEX); + status = + acpi_ex_convert_to_string(operand1, &local_operand1, + ACPI_IMPLICIT_CONVERT_HEX); break; case ACPI_TYPE_BUFFER: diff --git a/drivers/acpi/acpica/exmutex.c b/drivers/acpi/acpica/exmutex.c index 472030f2b..26faa91e9 100644 --- a/drivers/acpi/acpica/exmutex.c +++ b/drivers/acpi/acpica/exmutex.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -185,8 +185,9 @@ acpi_ex_acquire_mutex_object(u16 timeout, if (obj_desc == acpi_gbl_global_lock_mutex) { status = acpi_ev_acquire_global_lock(timeout); } else { - status = acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, - timeout); + status = + acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, + timeout); } if (ACPI_FAILURE(status)) { @@ -243,20 +244,30 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, } /* - * Current sync level must be less than or equal to the sync level of the - * mutex. This mechanism provides some deadlock prevention + * Current sync level must be less than or equal to the sync level + * of the mutex. This mechanism provides some deadlock prevention. */ if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { ACPI_ERROR((AE_INFO, - "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%u)", + "Cannot acquire Mutex [%4.4s], " + "current SyncLevel is too large (%u)", acpi_ut_get_node_name(obj_desc->mutex.node), walk_state->thread->current_sync_level)); return_ACPI_STATUS(AE_AML_MUTEX_ORDER); } - status = acpi_ex_acquire_mutex_object((u16) time_desc->integer.value, + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, " + "Depth %u TID %p\n", + obj_desc->mutex.sync_level, + walk_state->thread->current_sync_level, + obj_desc->mutex.acquisition_depth, + walk_state->thread)); + + status = acpi_ex_acquire_mutex_object((u16)time_desc->integer.value, obj_desc, walk_state->thread->thread_id); + if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { /* Save Thread object, original/current sync levels */ @@ -272,6 +283,12 @@ acpi_ex_acquire_mutex(union acpi_operand_object *time_desc, acpi_ex_link_mutex(obj_desc, walk_state->thread); } + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n", + obj_desc->mutex.sync_level, + walk_state->thread->current_sync_level, + obj_desc->mutex.acquisition_depth)); + return_ACPI_STATUS(status); } @@ -356,9 +373,9 @@ acpi_status acpi_ex_release_mutex(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { - acpi_status status = AE_OK; u8 previous_sync_level; struct acpi_thread_state *owner_thread; + acpi_status status = AE_OK; ACPI_FUNCTION_TRACE(ex_release_mutex); @@ -409,7 +426,8 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, */ if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) { ACPI_ERROR((AE_INFO, - "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %u current %u", + "Cannot release Mutex [%4.4s], SyncLevel mismatch: " + "mutex %u current %u", acpi_ut_get_node_name(obj_desc->mutex.node), obj_desc->mutex.sync_level, walk_state->thread->current_sync_level)); @@ -424,6 +442,15 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, previous_sync_level = owner_thread->acquired_mutex_list->mutex.original_sync_level; + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Releasing: Object SyncLevel %u, Thread SyncLevel %u, " + "Prev SyncLevel %u, Depth %u TID %p\n", + obj_desc->mutex.sync_level, + walk_state->thread->current_sync_level, + previous_sync_level, + obj_desc->mutex.acquisition_depth, + walk_state->thread)); + status = acpi_ex_release_mutex_object(obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); @@ -436,6 +463,14 @@ acpi_ex_release_mutex(union acpi_operand_object *obj_desc, owner_thread->current_sync_level = previous_sync_level; } + ACPI_DEBUG_PRINT((ACPI_DB_EXEC, + "Released: Object SyncLevel %u, Thread SyncLevel, %u, " + "Prev SyncLevel %u, Depth %u\n", + obj_desc->mutex.sync_level, + walk_state->thread->current_sync_level, + previous_sync_level, + obj_desc->mutex.acquisition_depth)); + return_ACPI_STATUS(status); } @@ -462,21 +497,17 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) union acpi_operand_object *next = thread->acquired_mutex_list; union acpi_operand_object *obj_desc; - ACPI_FUNCTION_NAME(ex_release_all_mutexes); + ACPI_FUNCTION_TRACE(ex_release_all_mutexes); /* Traverse the list of owned mutexes, releasing each one */ while (next) { obj_desc = next; - next = obj_desc->mutex.next; - - obj_desc->mutex.prev = NULL; - obj_desc->mutex.next = NULL; - obj_desc->mutex.acquisition_depth = 0; - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "Force-releasing held mutex: %p\n", - obj_desc)); + "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n", + obj_desc->mutex.node->name.ascii, + obj_desc->mutex.sync_level, + obj_desc->mutex.acquisition_depth)); /* Release the mutex, special case for Global Lock */ @@ -489,14 +520,21 @@ void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread) acpi_os_release_mutex(obj_desc->mutex.os_mutex); } - /* Mark mutex unowned */ - - obj_desc->mutex.owner_thread = NULL; - obj_desc->mutex.thread_id = 0; - /* Update Thread sync_level (Last mutex is the important one) */ thread->current_sync_level = obj_desc->mutex.original_sync_level; + + /* Mark mutex unowned */ + + next = obj_desc->mutex.next; + + obj_desc->mutex.prev = NULL; + obj_desc->mutex.next = NULL; + obj_desc->mutex.acquisition_depth = 0; + obj_desc->mutex.owner_thread = NULL; + obj_desc->mutex.thread_id = 0; } + + return_VOID; } diff --git a/drivers/acpi/acpica/exnames.c b/drivers/acpi/acpica/exnames.c index 20e87813c..27c11ab5e 100644 --- a/drivers/acpi/acpica/exnames.c +++ b/drivers/acpi/acpica/exnames.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -164,8 +164,8 @@ static acpi_status acpi_ex_name_segment(u8 ** in_aml_address, char *name_string) ACPI_FUNCTION_TRACE(ex_name_segment); /* - * If first character is a digit, then we know that we aren't looking at a - * valid name segment + * If first character is a digit, then we know that we aren't looking + * at a valid name segment */ char_buf[0] = *aml_address; diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index 77930683a..4e17506a7 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -484,22 +484,26 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) case AML_TO_DECSTRING_OP: /* to_decimal_string (Data, Result) */ - status = acpi_ex_convert_to_string(operand[0], &return_desc, - ACPI_EXPLICIT_CONVERT_DECIMAL); + status = + acpi_ex_convert_to_string(operand[0], &return_desc, + ACPI_EXPLICIT_CONVERT_DECIMAL); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference(return_desc); } break; case AML_TO_HEXSTRING_OP: /* to_hex_string (Data, Result) */ - status = acpi_ex_convert_to_string(operand[0], &return_desc, - ACPI_EXPLICIT_CONVERT_HEX); + status = + acpi_ex_convert_to_string(operand[0], &return_desc, + ACPI_EXPLICIT_CONVERT_HEX); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference(return_desc); } break; @@ -510,17 +514,20 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference(return_desc); } break; case AML_TO_INTEGER_OP: /* to_integer (Data, Result) */ - status = acpi_ex_convert_to_integer(operand[0], &return_desc, - ACPI_ANY_BASE); + status = + acpi_ex_convert_to_integer(operand[0], &return_desc, + ACPI_ANY_BASE); if (return_desc == operand[0]) { /* No conversion performed, add ref to handle return value */ + acpi_ut_add_reference(return_desc); } break; @@ -679,7 +686,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_store(return_desc, operand[0], walk_state); break; - case AML_TYPE_OP: /* object_type (source_object) */ + case AML_OBJECT_TYPE_OP: /* object_type (source_object) */ /* * Note: The operand is not resolved at this point because we want to * get the associated object, not its value. For example, we don't @@ -713,9 +720,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) /* Get the base object */ - status = acpi_ex_resolve_multiple(walk_state, - operand[0], &type, - &temp_desc); + status = + acpi_ex_resolve_multiple(walk_state, operand[0], &type, + &temp_desc); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -759,8 +766,10 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) default: ACPI_ERROR((AE_INFO, - "Operand must be Buffer/Integer/String/Package - found type %s", + "Operand must be Buffer/Integer/String/Package" + " - found type %s", acpi_ut_get_type_name(type))); + status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -981,6 +990,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) "Unknown Index TargetType 0x%X in reference object %p", operand[0]->reference. target_type, operand[0])); + status = AE_AML_OPERAND_TYPE; goto cleanup; } @@ -1050,6 +1060,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); + status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index b8944ebb1..79ef3b681 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -199,6 +199,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); + status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -299,8 +300,9 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) 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; case AML_TO_STRING_OP: /* to_string (Buffer, Length, Result) (ACPI 2.0) */ @@ -345,8 +347,9 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) /* concatenate_res_template (Buffer, Buffer, Result) (ACPI 2.0) */ - status = acpi_ex_concat_template(operand[0], operand[1], - &return_desc, walk_state); + status = + acpi_ex_concat_template(operand[0], operand[1], + &return_desc, walk_state); break; case AML_INDEX_OP: /* Index (Source Index Result) */ @@ -553,6 +556,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); + status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index fa100b3b9..28eb861c4 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,10 +95,11 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) case AML_FATAL_OP: /* Fatal (fatal_type fatal_code fatal_arg) */ ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", - (u32) operand[0]->integer.value, - (u32) operand[1]->integer.value, - (u32) operand[2]->integer.value)); + "FatalOp: Type %X Code %X Arg %X " + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + (u32)operand[0]->integer.value, + (u32)operand[1]->integer.value, + (u32)operand[2]->integer.value)); fatal = ACPI_ALLOCATE(sizeof(struct acpi_signal_fatal_info)); if (fatal) { @@ -131,6 +132,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); + status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -193,7 +195,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) /* Truncate request if larger than the actual String/Buffer */ 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; } @@ -237,8 +240,8 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) /* We have a buffer, copy the portion requested */ - memcpy(buffer, operand[0]->string.pointer + index, - length); + memcpy(buffer, + operand[0]->string.pointer + index, length); } /* Set the length of the new String/Buffer */ @@ -255,6 +258,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); + status = AE_AML_BAD_OPCODE; goto cleanup; } @@ -270,12 +274,11 @@ cleanup: if (ACPI_FAILURE(status) || walk_state->result_obj) { acpi_ut_remove_reference(return_desc); walk_state->result_obj = NULL; - } + } else { + /* Set the return object and exit */ - /* Set the return object and exit */ - - else { walk_state->result_obj = return_desc; } + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index c930edda3..e2b634838 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -310,6 +310,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) ACPI_ERROR((AE_INFO, "Unknown AML opcode 0x%X", walk_state->opcode)); + status = AE_AML_BAD_OPCODE; goto cleanup; } diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c index 4c2836dc8..aed8d3459 100644 --- a/drivers/acpi/acpica/exprep.c +++ b/drivers/acpi/acpica/exprep.c @@ -1,11 +1,11 @@ /****************************************************************************** * - * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities + * Module Name: exprep - ACPI AML field prep utilities * *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -103,8 +103,10 @@ acpi_ex_generate_access(u32 field_bit_offset, /* 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_end_offset = ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + - field_bit_offset, 8)); + + field_byte_end_offset = + ACPI_DIV_8(ACPI_ROUND_UP(field_bit_length + field_bit_offset, 8)); + field_byte_length = field_byte_end_offset - field_byte_offset; ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, @@ -159,7 +161,8 @@ acpi_ex_generate_access(u32 field_bit_offset, if (accesses <= 1) { ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "Entire field can be accessed with one operation of size %u\n", + "Entire field can be accessed " + "with one operation of size %u\n", access_byte_width)); return_VALUE(access_byte_width); } @@ -202,6 +205,7 @@ acpi_ex_generate_access(u32 field_bit_offset, */ ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "Cannot access field in one operation, using width 8\n")); + return_VALUE(8); } #endif /* ACPI_UNDER_DEVELOPMENT */ @@ -281,6 +285,7 @@ acpi_ex_decode_field_access(union acpi_operand_object *obj_desc, /* Invalid field access type */ ACPI_ERROR((AE_INFO, "Unknown field access type 0x%X", access)); + return_UINT32(0); } @@ -354,8 +359,8 @@ acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc, * For all other access types (Byte, Word, Dword, Qword), the Bitwidth is * the same (equivalent) as the byte_alignment. */ - access_bit_width = acpi_ex_decode_field_access(obj_desc, field_flags, - &byte_alignment); + access_bit_width = + acpi_ex_decode_field_access(obj_desc, field_flags, &byte_alignment); if (!access_bit_width) { return_ACPI_STATUS(AE_AML_OPERAND_VALUE); } @@ -595,7 +600,8 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) access_byte_width); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, - "IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n", + "IndexField: BitOff %X, Off %X, Value %X, " + "Gran %X, Index %p, Data %p\n", obj_desc->index_field.start_field_bit_offset, obj_desc->index_field.base_byte_offset, obj_desc->index_field.value, @@ -615,8 +621,9 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info) * Store the constructed descriptor (obj_desc) into the parent Node, * preserving the current type of that named_obj. */ - status = acpi_ns_attach_object(info->field_node, obj_desc, - acpi_ns_get_type(info->field_node)); + status = + acpi_ns_attach_object(info->field_node, obj_desc, + acpi_ns_get_type(info->field_node)); ACPI_DEBUG_PRINT((ACPI_DB_BFIELD, "Set NamedObj %p [%4.4s], ObjDesc %p\n", diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index b4a5e44c0..076074daf 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -392,7 +392,8 @@ acpi_ex_pci_config_space_handler(u32 function, pci_register = (u16) (u32) address; ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "Pci-Config %u (%u) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", + "Pci-Config %u (%u) Seg(%04x) Bus(%04x) " + "Dev(%04x) Func(%04x) Reg(%04x)\n", function, bit_width, pci_id->segment, pci_id->bus, pci_id->device, pci_id->function, pci_register)); @@ -400,14 +401,16 @@ acpi_ex_pci_config_space_handler(u32 function, case ACPI_READ: *value = 0; - status = acpi_os_read_pci_configuration(pci_id, pci_register, - value, bit_width); + status = + acpi_os_read_pci_configuration(pci_id, pci_register, value, + bit_width); break; case ACPI_WRITE: - status = acpi_os_write_pci_configuration(pci_id, pci_register, - *value, bit_width); + status = + acpi_os_write_pci_configuration(pci_id, pci_register, + *value, bit_width); break; default: diff --git a/drivers/acpi/acpica/exresnte.c b/drivers/acpi/acpica/exresnte.c index 1b372ef69..c1e8bfb0f 100644 --- a/drivers/acpi/acpica/exresnte.c +++ b/drivers/acpi/acpica/exresnte.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,7 +112,7 @@ acpi_ex_resolve_node_to_value(struct acpi_namespace_node **object_ptr, /* * Several object types require no further processing: - * 1) Device/Thermal objects don't have a "real" subobject, return the Node + * 1) Device/Thermal objects don't have a "real" subobject, return Node * 2) Method locals and arguments have a pseudo-Node * 3) 10/2007: Added method type to assist with Package construction. */ diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index a1afe1a1e..fedacf13d 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -217,7 +217,8 @@ acpi_ex_resolve_object_to_value(union acpi_operand_object **stack_ptr, * the package, can't dereference it */ ACPI_ERROR((AE_INFO, - "Attempt to dereference an Index to NULL package element Idx=%p", + "Attempt to dereference an Index to " + "NULL package element Idx=%p", stack_desc)); status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -361,10 +362,9 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, if (type == ACPI_TYPE_LOCAL_ALIAS) { type = ((struct acpi_namespace_node *)obj_desc)->type; - obj_desc = - acpi_ns_get_attached_object((struct - acpi_namespace_node *) - obj_desc); + obj_desc = acpi_ns_get_attached_object((struct + acpi_namespace_node + *)obj_desc); } if (!obj_desc) { diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index 424442d50..cc2c26c46 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -90,8 +90,8 @@ acpi_ex_check_object_type(acpi_object_type type_needed, * specification, a store to a constant is a noop.) */ if ((this_type == ACPI_TYPE_INTEGER) && - (((union acpi_operand_object *)object)->common. - flags & AOPOBJ_AML_CONSTANT)) { + (((union acpi_operand_object *)object)->common.flags & + AOPOBJ_AML_CONSTANT)) { return (AE_OK); } } @@ -196,10 +196,10 @@ acpi_ex_resolve_operands(u16 opcode, * thus, the attached object is always the aliased namespace node */ if (object_type == ACPI_TYPE_LOCAL_ALIAS) { - obj_desc = - acpi_ns_get_attached_object((struct - acpi_namespace_node - *)obj_desc); + obj_desc = acpi_ns_get_attached_object((struct + acpi_namespace_node + *) + obj_desc); *stack_ptr = obj_desc; object_type = ((struct acpi_namespace_node *)obj_desc)-> @@ -285,8 +285,8 @@ acpi_ex_resolve_operands(u16 opcode, case ARGI_REF_OR_STRING: /* Can be a String or Reference */ if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == - ACPI_DESC_TYPE_OPERAND) - && (obj_desc->common.type == ACPI_TYPE_STRING)) { + ACPI_DESC_TYPE_OPERAND) && + (obj_desc->common.type == ACPI_TYPE_STRING)) { /* * String found - the string references a named object and * must be resolved to a node @@ -465,8 +465,9 @@ acpi_ex_resolve_operands(u16 opcode, * But we can implicitly convert from a BUFFER or INTEGER * aka - "Implicit Source Operand Conversion" */ - status = acpi_ex_convert_to_string(obj_desc, stack_ptr, - ACPI_IMPLICIT_CONVERT_HEX); + status = + acpi_ex_convert_to_string(obj_desc, stack_ptr, + ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE(status)) { if (status == AE_TYPE) { ACPI_ERROR((AE_INFO, @@ -597,8 +598,10 @@ acpi_ex_resolve_operands(u16 opcode, case ARGI_REGION_OR_BUFFER: /* Used by Load() only */ - /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ - + /* + * Need an operand of type REGION or a BUFFER + * (which could be a resolved region field) + */ switch (obj_desc->common.type) { case ACPI_TYPE_BUFFER: case ACPI_TYPE_REGION: @@ -640,9 +643,9 @@ acpi_ex_resolve_operands(u16 opcode, if (acpi_gbl_enable_interpreter_slack) { /* - * Enable original behavior of Store(), allowing any and all - * objects as the source operand. The ACPI spec does not - * allow this, however. + * Enable original behavior of Store(), allowing any + * and all objects as the source operand. The ACPI + * spec does not allow this, however. */ break; } @@ -655,7 +658,8 @@ acpi_ex_resolve_operands(u16 opcode, } ACPI_ERROR((AE_INFO, - "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p", + "Needed Integer/Buffer/String/Package/Ref/Ddb]" + ", found [%s] %p", acpi_ut_get_object_type_name (obj_desc), obj_desc)); @@ -678,9 +682,10 @@ acpi_ex_resolve_operands(u16 opcode, * Make sure that the original object was resolved to the * required object type (Simple cases only). */ - status = acpi_ex_check_object_type(type_needed, - (*stack_ptr)->common.type, - *stack_ptr); + status = + acpi_ex_check_object_type(type_needed, + (*stack_ptr)->common.type, + *stack_ptr); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c index c076e9100..cd70cbcf6 100644 --- a/drivers/acpi/acpica/exstore.c +++ b/drivers/acpi/acpica/exstore.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -467,7 +467,8 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, case ACPI_TYPE_THERMAL: ACPI_ERROR((AE_INFO, - "Target must be [Buffer/Integer/String/Reference], found [%s] (%4.4s)", + "Target must be [Buffer/Integer/String/Reference]" + ", found [%s] (%4.4s)", acpi_ut_get_type_name(node->type), node->name.ascii)); @@ -504,8 +505,9 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, * an implicit conversion, as per the ACPI specification. * A direct store is performed instead. */ - status = acpi_ex_store_direct_to_node(source_desc, node, - walk_state); + status = + acpi_ex_store_direct_to_node(source_desc, node, + walk_state); break; } @@ -528,8 +530,9 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, * store has been performed such that the node/object type * has been changed. */ - status = acpi_ns_attach_object(node, new_desc, - new_desc->common.type); + status = + acpi_ns_attach_object(node, new_desc, + new_desc->common.type); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Store type [%s] into [%s] via Convert/Attach\n", @@ -563,8 +566,8 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc, * operator. (Note, for this default case, all normal * Store/Target operations exited above with an error). */ - status = acpi_ex_store_direct_to_node(source_desc, node, - walk_state); + status = + acpi_ex_store_direct_to_node(source_desc, node, walk_state); break; } diff --git a/drivers/acpi/acpica/exstoren.c b/drivers/acpi/acpica/exstoren.c index d1841defa..13bbb2b24 100644 --- a/drivers/acpi/acpica/exstoren.c +++ b/drivers/acpi/acpica/exstoren.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/exstorob.c b/drivers/acpi/acpica/exstorob.c index e1d4f4d51..28b724827 100644 --- a/drivers/acpi/acpica/exstorob.c +++ b/drivers/acpi/acpica/exstorob.c @@ -1,11 +1,11 @@ /****************************************************************************** * - * Module Name: exstorob - AML Interpreter object store support, store to object + * Module Name: exstorob - AML object store support, store to object * *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -203,8 +203,9 @@ acpi_ex_store_string_to_string(union acpi_operand_object *source_desc, ACPI_FREE(target_desc->string.pointer); } - target_desc->string.pointer = ACPI_ALLOCATE_ZEROED((acpi_size) - length + 1); + target_desc->string.pointer = + ACPI_ALLOCATE_ZEROED((acpi_size) length + 1); + if (!target_desc->string.pointer) { return_ACPI_STATUS(AE_NO_MEMORY); } diff --git a/drivers/acpi/acpica/exsystem.c b/drivers/acpi/acpica/exsystem.c index 05450656f..ac09c31cc 100644 --- a/drivers/acpi/acpica/exsystem.c +++ b/drivers/acpi/acpica/exsystem.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,7 +78,6 @@ acpi_status acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout) /* We must wait, so unlock the interpreter */ acpi_ex_exit_interpreter(); - status = acpi_os_wait_semaphore(semaphore, 1, timeout); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -124,7 +123,6 @@ acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout) /* We must wait, so unlock the interpreter */ acpi_ex_exit_interpreter(); - status = acpi_os_acquire_mutex(mutex, timeout); ACPI_DEBUG_PRINT((ACPI_DB_EXEC, @@ -169,8 +167,8 @@ acpi_status acpi_ex_system_do_stall(u32 how_long) * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_ERROR((AE_INFO, "Time parameter is too large (%u)", - how_long)); + ACPI_ERROR((AE_INFO, + "Time parameter is too large (%u)", how_long)); status = AE_AML_OPERAND_VALUE; } else { acpi_os_stall(how_long); diff --git a/drivers/acpi/acpica/extrace.c b/drivers/acpi/acpica/extrace.c new file mode 100644 index 000000000..b52e84841 --- /dev/null +++ b/drivers/acpi/acpica/extrace.c @@ -0,0 +1,377 @@ +/****************************************************************************** + * + * Module Name: extrace - Support for interpreter execution tracing + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include <acpi/acpi.h> +#include "accommon.h" +#include "acnamesp.h" +#include "acinterp.h" + +#define _COMPONENT ACPI_EXECUTER +ACPI_MODULE_NAME("extrace") + +static union acpi_operand_object *acpi_gbl_trace_method_object = NULL; + +/* Local prototypes */ + +#ifdef ACPI_DEBUG_OUTPUT +static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type); +#endif + +/******************************************************************************* + * + * FUNCTION: acpi_ex_interpreter_trace_enabled + * + * PARAMETERS: name - Whether method name should be matched, + * this should be checked before starting + * the tracer + * + * RETURN: TRUE if interpreter trace is enabled. + * + * DESCRIPTION: Check whether interpreter trace is enabled + * + ******************************************************************************/ + +static u8 acpi_ex_interpreter_trace_enabled(char *name) +{ + + /* Check if tracing is enabled */ + + if (!(acpi_gbl_trace_flags & ACPI_TRACE_ENABLED)) { + return (FALSE); + } + + /* + * Check if tracing is filtered: + * + * 1. If the tracer is started, acpi_gbl_trace_method_object should have + * been filled by the trace starter + * 2. If the tracer is not started, acpi_gbl_trace_method_name should be + * matched if it is specified + * 3. If the tracer is oneshot style, acpi_gbl_trace_method_name should + * not be cleared by the trace stopper during the first match + */ + if (acpi_gbl_trace_method_object) { + return (TRUE); + } + + if (name && + (acpi_gbl_trace_method_name && + strcmp(acpi_gbl_trace_method_name, name))) { + return (FALSE); + } + + if ((acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) && + !acpi_gbl_trace_method_name) { + return (FALSE); + } + + return (TRUE); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ex_get_trace_event_name + * + * PARAMETERS: type - Trace event type + * + * RETURN: Trace event name. + * + * DESCRIPTION: Used to obtain the full trace event name. + * + ******************************************************************************/ + +#ifdef ACPI_DEBUG_OUTPUT + +static const char *acpi_ex_get_trace_event_name(acpi_trace_event_type type) +{ + + switch (type) { + case ACPI_TRACE_AML_METHOD: + + return "Method"; + + case ACPI_TRACE_AML_OPCODE: + + return "Opcode"; + + case ACPI_TRACE_AML_REGION: + + return "Region"; + + default: + + return ""; + } +} + +#endif + +/******************************************************************************* + * + * FUNCTION: acpi_ex_trace_point + * + * PARAMETERS: type - Trace event type + * begin - TRUE if before execution + * aml - Executed AML address + * pathname - Object path + * + * RETURN: None + * + * DESCRIPTION: Internal interpreter execution trace. + * + ******************************************************************************/ + +void +acpi_ex_trace_point(acpi_trace_event_type type, + u8 begin, u8 *aml, char *pathname) +{ + + ACPI_FUNCTION_NAME(ex_trace_point); + + if (pathname) { + ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, + "%s %s [0x%p:%s] execution.\n", + acpi_ex_get_trace_event_name(type), + begin ? "Begin" : "End", aml, pathname)); + } else { + ACPI_DEBUG_PRINT((ACPI_DB_TRACE_POINT, + "%s %s [0x%p] execution.\n", + acpi_ex_get_trace_event_name(type), + begin ? "Begin" : "End", aml)); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ex_start_trace_method + * + * PARAMETERS: method_node - Node of the method + * obj_desc - The method object + * walk_state - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Start control method execution trace + * + ******************************************************************************/ + +void +acpi_ex_start_trace_method(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) +{ + acpi_status status; + char *pathname = NULL; + u8 enabled = FALSE; + + ACPI_FUNCTION_NAME(ex_start_trace_method); + + if (method_node) { + pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto exit; + } + + enabled = acpi_ex_interpreter_trace_enabled(pathname); + if (enabled && !acpi_gbl_trace_method_object) { + acpi_gbl_trace_method_object = obj_desc; + acpi_gbl_original_dbg_level = acpi_dbg_level; + acpi_gbl_original_dbg_layer = acpi_dbg_layer; + acpi_dbg_level = ACPI_TRACE_LEVEL_ALL; + acpi_dbg_layer = ACPI_TRACE_LAYER_ALL; + + if (acpi_gbl_trace_dbg_level) { + acpi_dbg_level = acpi_gbl_trace_dbg_level; + } + + if (acpi_gbl_trace_dbg_layer) { + acpi_dbg_layer = acpi_gbl_trace_dbg_layer; + } + } + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + +exit: + if (enabled) { + ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, TRUE, + obj_desc ? obj_desc->method.aml_start : NULL, + pathname); + } + + if (pathname) { + ACPI_FREE(pathname); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ex_stop_trace_method + * + * PARAMETERS: method_node - Node of the method + * obj_desc - The method object + * walk_state - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Stop control method execution trace + * + ******************************************************************************/ + +void +acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node, + union acpi_operand_object *obj_desc, + struct acpi_walk_state *walk_state) +{ + acpi_status status; + char *pathname = NULL; + u8 enabled; + + ACPI_FUNCTION_NAME(ex_stop_trace_method); + + if (method_node) { + pathname = acpi_ns_get_normalized_pathname(method_node, TRUE); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto exit_path; + } + + enabled = acpi_ex_interpreter_trace_enabled(NULL); + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + + if (enabled) { + ACPI_TRACE_POINT(ACPI_TRACE_AML_METHOD, FALSE, + obj_desc ? obj_desc->method.aml_start : NULL, + pathname); + } + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) { + goto exit_path; + } + + /* Check whether the tracer should be stopped */ + + if (acpi_gbl_trace_method_object == obj_desc) { + + /* Disable further tracing if type is one-shot */ + + if (acpi_gbl_trace_flags & ACPI_TRACE_ONESHOT) { + acpi_gbl_trace_method_name = NULL; + } + + acpi_dbg_level = acpi_gbl_original_dbg_level; + acpi_dbg_layer = acpi_gbl_original_dbg_layer; + acpi_gbl_trace_method_object = NULL; + } + + (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + +exit_path: + if (pathname) { + ACPI_FREE(pathname); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ex_start_trace_opcode + * + * PARAMETERS: op - The parser opcode object + * walk_state - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Start opcode execution trace + * + ******************************************************************************/ + +void +acpi_ex_start_trace_opcode(union acpi_parse_object *op, + struct acpi_walk_state *walk_state) +{ + + ACPI_FUNCTION_NAME(ex_start_trace_opcode); + + if (acpi_ex_interpreter_trace_enabled(NULL) && + (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { + ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, TRUE, + op->common.aml, op->common.aml_op_name); + } +} + +/******************************************************************************* + * + * FUNCTION: acpi_ex_stop_trace_opcode + * + * PARAMETERS: op - The parser opcode object + * walk_state - current state, NULL if not yet executing + * a method. + * + * RETURN: None + * + * DESCRIPTION: Stop opcode execution trace + * + ******************************************************************************/ + +void +acpi_ex_stop_trace_opcode(union acpi_parse_object *op, + struct acpi_walk_state *walk_state) +{ + + ACPI_FUNCTION_NAME(ex_stop_trace_opcode); + + if (acpi_ex_interpreter_trace_enabled(NULL) && + (acpi_gbl_trace_flags & ACPI_TRACE_OPCODE)) { + ACPI_TRACE_POINT(ACPI_TRACE_AML_OPCODE, FALSE, + op->common.aml, op->common.aml_op_name); + } +} diff --git a/drivers/acpi/acpica/exutils.c b/drivers/acpi/acpica/exutils.c index 30c3f464f..4d44bc1cb 100644 --- a/drivers/acpi/acpica/exutils.c +++ b/drivers/acpi/acpica/exutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -167,8 +167,8 @@ u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc) if ((acpi_gbl_integer_byte_width == 4) && (obj_desc->integer.value > (u64)ACPI_UINT32_MAX)) { /* - * We are executing in a 32-bit ACPI table. - * Truncate the value to 32 bits by zeroing out the upper 32-bit field + * We are executing in a 32-bit ACPI table. Truncate + * the value to 32 bits by zeroing out the upper 32-bit field */ obj_desc->integer.value &= (u64)ACPI_UINT32_MAX; return (TRUE); @@ -323,7 +323,8 @@ void acpi_ex_eisa_id_to_string(char *out_string, u64 compressed_id) if (compressed_id > ACPI_UINT32_MAX) { ACPI_WARNING((AE_INFO, - "Expected EISAID is larger than 32 bits: 0x%8.8X%8.8X, truncating", + "Expected EISAID is larger than 32 bits: " + "0x%8.8X%8.8X, truncating", ACPI_FORMAT_UINT64(compressed_id))); } diff --git a/drivers/acpi/acpica/hwacpi.c b/drivers/acpi/acpica/hwacpi.c index e5c5949f9..3ebbb0903 100644 --- a/drivers/acpi/acpica/hwacpi.c +++ b/drivers/acpi/acpica/hwacpi.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c index e5599f610..3f2fb4b31 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,8 +117,8 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state) /* Clear wake status (WAK_STS) */ - status = - acpi_write((u64)ACPI_X_WAKE_STATUS, &acpi_gbl_FADT.sleep_status); + status = acpi_write((u64)ACPI_X_WAKE_STATUS, + &acpi_gbl_FADT.sleep_status); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c index 73cfa5947..1c4f45186 100644 --- a/drivers/acpi/acpica/hwgpe.c +++ b/drivers/acpi/acpica/hwgpe.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -187,9 +187,8 @@ acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info * gpe_event_info) */ register_bit = acpi_hw_get_gpe_register_bit(gpe_event_info); - status = acpi_hw_write(register_bit, - &gpe_register_info->status_address); - + status = + acpi_hw_write(register_bit, &gpe_register_info->status_address); return (status); } @@ -297,6 +296,7 @@ acpi_hw_gpe_enable_write(u8 enable_mask, acpi_status status; gpe_register_info->enable_mask = enable_mask; + status = acpi_hw_write(enable_mask, &gpe_register_info->enable_address); return (status); } diff --git a/drivers/acpi/acpica/hwpci.c b/drivers/acpi/acpica/hwpci.c index f785ea788..3dd60c96a 100644 --- a/drivers/acpi/acpica/hwpci.c +++ b/drivers/acpi/acpica/hwpci.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index 3cf77afd1..5ba049841 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c index 7d21cae6d..d00c98108 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,8 +80,8 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state) /* Clear wake status */ - status = - acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, ACPI_CLEAR_STATUS); + status = acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, + ACPI_CLEAR_STATUS); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index 675c709a3..04cc9406c 100644 --- a/drivers/acpi/acpica/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c index 29033d714..ad0a74571 100644 --- a/drivers/acpi/acpica/hwvalid.c +++ b/drivers/acpi/acpica/hwvalid.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index 5f97468df..a01ddb393 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -504,11 +504,20 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) * Evaluate the \_Sx namespace object containing the register values * for this state */ - info->relative_pathname = - ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]); + info->relative_pathname = ACPI_CAST_PTR(char, + acpi_gbl_sleep_state_names + [sleep_state]); + status = acpi_ns_evaluate(info); if (ACPI_FAILURE(status)) { - goto cleanup; + if (status == AE_NOT_FOUND) { + + /* The _Sx states are optional, ignore NOT_FOUND */ + + goto final_cleanup; + } + + goto warning_cleanup; } /* Must have a return object */ @@ -517,7 +526,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]", info->relative_pathname)); status = AE_AML_NO_RETURN_VALUE; - goto cleanup; + goto warning_cleanup; } /* Return object must be of type Package */ @@ -526,7 +535,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) ACPI_ERROR((AE_INFO, "Sleep State return object is not a Package")); status = AE_AML_OPERAND_TYPE; - goto cleanup1; + goto return_value_cleanup; } /* @@ -570,16 +579,17 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) break; } -cleanup1: +return_value_cleanup: acpi_ut_remove_reference(info->return_object); -cleanup: +warning_cleanup: if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "While evaluating Sleep State [%s]", info->relative_pathname)); } +final_cleanup: ACPI_FREE(info); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index d62a61612..f76e0eab3 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,9 +52,9 @@ ACPI_MODULE_NAME("hwxfsleep") /* Local prototypes */ #if (!ACPI_REDUCED_HARDWARE) static acpi_status -acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, - acpi_physical_address physical_address, - acpi_physical_address physical_address64); +acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs, + acpi_physical_address physical_address, + acpi_physical_address physical_address64); #endif static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id); @@ -79,22 +79,20 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { /* * These functions are removed for the ACPI_REDUCED_HARDWARE case: - * acpi_set_firmware_waking_vectors * acpi_set_firmware_waking_vector - * acpi_set_firmware_waking_vector64 * acpi_enter_sleep_state_s4bios */ #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * - * FUNCTION: acpi_hw_set_firmware_waking_vectors + * FUNCTION: acpi_hw_set_firmware_waking_vector * * PARAMETERS: facs - Pointer to FACS table * physical_address - 32-bit physical address of ACPI real mode - * entry point. + * entry point * physical_address64 - 64-bit physical address of ACPI protected - * mode entry point. + * mode entry point * * RETURN: Status * @@ -103,11 +101,11 @@ static struct acpi_sleep_functions acpi_sleep_dispatch[] = { ******************************************************************************/ static acpi_status -acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, - acpi_physical_address physical_address, - acpi_physical_address physical_address64) +acpi_hw_set_firmware_waking_vector(struct acpi_table_facs *facs, + acpi_physical_address physical_address, + acpi_physical_address physical_address64) { - ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vectors); + ACPI_FUNCTION_TRACE(acpi_hw_set_firmware_waking_vector); /* @@ -140,12 +138,12 @@ acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, /******************************************************************************* * - * FUNCTION: acpi_set_firmware_waking_vectors + * FUNCTION: acpi_set_firmware_waking_vector * * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode - * entry point. + * entry point * physical_address64 - 64-bit physical address of ACPI protected - * mode entry point. + * mode entry point * * RETURN: Status * @@ -154,79 +152,23 @@ acpi_hw_set_firmware_waking_vectors(struct acpi_table_facs *facs, ******************************************************************************/ acpi_status -acpi_set_firmware_waking_vectors(acpi_physical_address physical_address, - acpi_physical_address physical_address64) +acpi_set_firmware_waking_vector(acpi_physical_address physical_address, + acpi_physical_address physical_address64) { - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vectors); + ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); if (acpi_gbl_FACS) { - (void)acpi_hw_set_firmware_waking_vectors(acpi_gbl_FACS, - physical_address, - physical_address64); + (void)acpi_hw_set_firmware_waking_vector(acpi_gbl_FACS, + physical_address, + physical_address64); } return_ACPI_STATUS(AE_OK); } -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vectors) - -/******************************************************************************* - * - * FUNCTION: acpi_set_firmware_waking_vector - * - * PARAMETERS: physical_address - 32-bit physical address of ACPI real mode - * entry point. - * - * RETURN: Status - * - * DESCRIPTION: Sets the 32-bit firmware_waking_vector field of the FACS - * - ******************************************************************************/ -acpi_status acpi_set_firmware_waking_vector(u32 physical_address) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector); - - status = acpi_set_firmware_waking_vectors((acpi_physical_address) - physical_address, 0); - - return_ACPI_STATUS(status); -} - ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector) -#if ACPI_MACHINE_WIDTH == 64 -/******************************************************************************* - * - * FUNCTION: acpi_set_firmware_waking_vector64 - * - * PARAMETERS: physical_address - 64-bit physical address of ACPI protected - * mode entry point. - * - * RETURN: Status - * - * DESCRIPTION: Sets the 64-bit X_firmware_waking_vector field of the FACS, if - * it exists in the table. This function is intended for use with - * 64-bit host operating systems. - * - ******************************************************************************/ -acpi_status acpi_set_firmware_waking_vector64(u64 physical_address) -{ - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_set_firmware_waking_vector64); - - status = acpi_set_firmware_waking_vectors(0, - (acpi_physical_address) - physical_address); - - return_ACPI_STATUS(status); -} - -ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) -#endif /******************************************************************************* * * FUNCTION: acpi_enter_sleep_state_s4bios @@ -286,6 +228,7 @@ acpi_status acpi_enter_sleep_state_s4bios(void) if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } + } while (!in_value); return_ACPI_STATUS(AE_OK); diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index c687b9979..697af810e 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index e107f929d..c2cf73fd3 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nsarguments.c b/drivers/acpi/acpica/nsarguments.c index 5d347a71b..f45bff632 100644 --- a/drivers/acpi/acpica/nsarguments.c +++ b/drivers/acpi/acpica/nsarguments.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nsconvert.c b/drivers/acpi/acpica/nsconvert.c index da55a1c60..878e8fb6a 100644 --- a/drivers/acpi/acpica/nsconvert.c +++ b/drivers/acpi/acpica/nsconvert.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -96,9 +96,9 @@ acpi_ns_convert_to_integer(union acpi_operand_object *original_object, /* Extract each buffer byte to create the integer */ for (i = 0; i < original_object->buffer.length; i++) { - value |= - ((u64)original_object->buffer. - pointer[i] << (i * 8)); + value |= ((u64) + original_object->buffer.pointer[i] << (i * + 8)); } break; @@ -153,10 +153,9 @@ acpi_ns_convert_to_string(union acpi_operand_object *original_object, return (AE_NO_MEMORY); } } else { - status = - acpi_ex_convert_to_string(original_object, - &new_object, - ACPI_IMPLICIT_CONVERT_HEX); + status = acpi_ex_convert_to_string(original_object, + &new_object, + ACPI_IMPLICIT_CONVERT_HEX); if (ACPI_FAILURE(status)) { return (status); } @@ -244,9 +243,8 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, /* String-to-Buffer conversion. Simple data copy */ - new_object = - acpi_ut_create_buffer_object(original_object->string. - length); + new_object = acpi_ut_create_buffer_object + (original_object->string.length); if (!new_object) { return (AE_NO_MEMORY); } @@ -308,7 +306,8 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, * * FUNCTION: acpi_ns_convert_to_unicode * - * PARAMETERS: original_object - ASCII String Object to be converted + * PARAMETERS: scope - Namespace node for the method/object + * original_object - ASCII String Object to be converted * return_object - Where the new converted object is returned * * RETURN: Status. AE_OK if conversion was successful. @@ -318,7 +317,8 @@ acpi_ns_convert_to_buffer(union acpi_operand_object *original_object, ******************************************************************************/ acpi_status -acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, +acpi_ns_convert_to_unicode(struct acpi_namespace_node * scope, + union acpi_operand_object *original_object, union acpi_operand_object **return_object) { union acpi_operand_object *new_object; @@ -372,7 +372,8 @@ acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, * * FUNCTION: acpi_ns_convert_to_resource * - * PARAMETERS: original_object - Object to be converted + * PARAMETERS: scope - Namespace node for the method/object + * original_object - Object to be converted * return_object - Where the new converted object is returned * * RETURN: Status. AE_OK if conversion was successful @@ -383,7 +384,8 @@ acpi_ns_convert_to_unicode(union acpi_operand_object *original_object, ******************************************************************************/ acpi_status -acpi_ns_convert_to_resource(union acpi_operand_object *original_object, +acpi_ns_convert_to_resource(struct acpi_namespace_node * scope, + union acpi_operand_object *original_object, union acpi_operand_object **return_object) { union acpi_operand_object *new_object; @@ -444,3 +446,78 @@ acpi_ns_convert_to_resource(union acpi_operand_object *original_object, *return_object = new_object; return (AE_OK); } + +/******************************************************************************* + * + * FUNCTION: acpi_ns_convert_to_reference + * + * PARAMETERS: scope - Namespace node for the method/object + * original_object - Object to be converted + * return_object - Where the new converted object is returned + * + * RETURN: Status. AE_OK if conversion was successful + * + * DESCRIPTION: Attempt to convert a Integer object to a object_reference. + * Buffer. + * + ******************************************************************************/ + +acpi_status +acpi_ns_convert_to_reference(struct acpi_namespace_node * scope, + union acpi_operand_object *original_object, + union acpi_operand_object **return_object) +{ + union acpi_operand_object *new_object = NULL; + acpi_status status; + struct acpi_namespace_node *node; + union acpi_generic_state scope_info; + char *name; + + ACPI_FUNCTION_NAME(ns_convert_to_reference); + + /* Convert path into internal presentation */ + + status = + acpi_ns_internalize_name(original_object->string.pointer, &name); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Find the namespace node */ + + scope_info.scope.node = + ACPI_CAST_PTR(struct acpi_namespace_node, scope); + status = + acpi_ns_lookup(&scope_info, name, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &node); + if (ACPI_FAILURE(status)) { + + /* Check if we are resolving a named reference within a package */ + + ACPI_ERROR_NAMESPACE(original_object->string.pointer, status); + goto error_exit; + } + + /* Create and init a new internal ACPI object */ + + new_object = acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE); + if (!new_object) { + status = AE_NO_MEMORY; + goto error_exit; + } + new_object->reference.node = node; + new_object->reference.object = node->object; + new_object->reference.class = ACPI_REFCLASS_NAME; + + /* + * Increase reference of the object if needed (the object is likely a + * null for device nodes). + */ + acpi_ut_add_reference(node->object); + +error_exit: + ACPI_FREE(name); + *return_object = new_object; + return (AE_OK); +} diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 37aa5c45c..af236e348 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -539,11 +539,13 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, acpi_os_printf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", obj_type); + bytes_to_dump = 32; } else { acpi_os_printf ("(Pointer to ACPI Object type %.2X [%s])\n", obj_type, acpi_ut_get_type_name(obj_type)); + bytes_to_dump = sizeof(union acpi_operand_object); } @@ -573,6 +575,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, */ bytes_to_dump = obj_desc->string.length; obj_desc = (void *)obj_desc->string.pointer; + acpi_os_printf("(Buffer/String pointer %p length %X)\n", obj_desc, bytes_to_dump); ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); @@ -717,7 +720,7 @@ acpi_ns_dump_one_object_path(acpi_handle obj_handle, return (AE_OK); } - pathname = acpi_ns_get_external_pathname(node); + pathname = acpi_ns_get_normalized_pathname(node, TRUE); path_indent = 1; if (level <= max_level) { diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 7dc367e6f..7060a5668 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 7eba578d3..65d58bea4 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,7 +135,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) /* Get the full pathname to the object, for use in warning messages */ - info->full_pathname = acpi_ns_get_external_pathname(info->node); + info->full_pathname = acpi_ns_get_normalized_pathname(info->node, TRUE); if (!info->full_pathname) { return_ACPI_STATUS(AE_NO_MEMORY); } @@ -418,7 +418,8 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj, * Get the parent node. We cheat by using the next_object field * of the method object descriptor. */ - parent_node = ACPI_CAST_PTR(struct acpi_namespace_node, + parent_node = + ACPI_CAST_PTR(struct acpi_namespace_node, method_obj->method.next_object); type = acpi_ns_get_type(parent_node); @@ -444,9 +445,9 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj, info->prefix_node = parent_node; /* - * Get the currently attached parent object. Add a reference, because the - * ref count will be decreased when the method object is installed to - * the parent node. + * Get the currently attached parent object. Add a reference, + * because the ref count will be decreased when the method object + * is installed to the parent node. */ parent_obj = acpi_ns_get_attached_object(parent_node); if (parent_obj) { @@ -455,8 +456,8 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj, /* Install the method (module-level code) in the parent node */ - status = acpi_ns_attach_object(parent_node, method_obj, - ACPI_TYPE_METHOD); + status = + acpi_ns_attach_object(parent_node, method_obj, ACPI_TYPE_METHOD); if (ACPI_FAILURE(status)) { goto exit; } diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index b744a5361..bd75d4623 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -582,7 +582,8 @@ acpi_ns_init_one_device(acpi_handle obj_handle, /* Ignore error and move on to next device */ - char *scope_name = acpi_ns_get_external_pathname(info->node); + char *scope_name = + acpi_ns_get_normalized_pathname(device_node, TRUE); ACPI_EXCEPTION((AE_INFO, status, "during %s._INI execution", scope_name)); diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 14ab83668..75cdb8790 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -149,6 +149,23 @@ unlock: ACPI_DEBUG_PRINT((ACPI_DB_INFO, "**** Completed Table Object Initialization\n")); + /* + * Execute any module-level code that was detected during the table load + * phase. Although illegal since ACPI 2.0, there are many machines that + * contain this type of code. Each block of detected executable AML code + * outside of any control method is wrapped with a temporary control + * method object and placed on a global list. The methods on this list + * are executed below. + * + * This case executes the module-level code for each table immediately + * after the table has been loaded. This provides compatibility with + * other ACPI implementations. Optionally, the execution can be deferred + * until later, see acpi_initialize_objects. + */ + if (!acpi_gbl_group_module_level_code) { + acpi_ns_exec_module_code_list(); + } + return_ACPI_STATUS(status); } @@ -321,7 +338,6 @@ acpi_status acpi_ns_unload_namespace(acpi_handle handle) /* This function does the real work */ status = acpi_ns_delete_subtree(handle); - return_ACPI_STATUS(status); } #endif diff --git a/drivers/acpi/acpica/nsnames.c b/drivers/acpi/acpica/nsnames.c index 8934b4edd..eb6e1b88a 100644 --- a/drivers/acpi/acpica/nsnames.c +++ b/drivers/acpi/acpica/nsnames.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,7 +70,6 @@ char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node) ACPI_FUNCTION_TRACE_PTR(ns_get_external_pathname, node); name_buffer = acpi_ns_get_normalized_pathname(node, FALSE); - return_PTR(name_buffer); } @@ -93,7 +92,6 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node) ACPI_FUNCTION_ENTRY(); size = acpi_ns_build_normalized_path(node, NULL, 0, FALSE); - return (size); } @@ -217,6 +215,7 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, ACPI_PATH_PUT8(full_path, path_size, AML_DUAL_NAME_PREFIX, length); } + ACPI_MOVE_32_TO_32(name, &next_node->name); do_no_trailing = no_trailing; for (i = 0; i < 4; i++) { @@ -228,8 +227,10 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, ACPI_PATH_PUT8(full_path, path_size, c, length); } } + next_node = next_node->parent; } + ACPI_PATH_PUT8(full_path, path_size, AML_ROOT_PREFIX, length); /* Reverse the path string */ @@ -237,6 +238,7 @@ acpi_ns_build_normalized_path(struct acpi_namespace_node *node, if (length <= path_size) { left = full_path; right = full_path + length - 1; + while (left < right) { c = *left; *left++ = *right; diff --git a/drivers/acpi/acpica/nsobject.c b/drivers/acpi/acpica/nsobject.c index 677bc9330..051306f0d 100644 --- a/drivers/acpi/acpica/nsobject.c +++ b/drivers/acpi/acpica/nsobject.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 3736d43b1..f631a4772 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -141,8 +141,8 @@ acpi_ns_one_complete_parse(u32 pass_number, /* Parse the AML */ - ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "*PARSE* pass %u parse\n", - pass_number)); + ACPI_DEBUG_PRINT((ACPI_DB_PARSE, + "*PARSE* pass %u parse\n", pass_number)); status = acpi_ps_parse_aml(walk_state); cleanup: @@ -181,6 +181,7 @@ acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node) * performs another complete parse of the AML. */ ACPI_DEBUG_PRINT((ACPI_DB_PARSE, "**** Start pass 1\n")); + status = acpi_ns_one_complete_parse(ACPI_IMODE_LOAD_PASS1, table_index, start_node); if (ACPI_FAILURE(status)) { diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index 0c20980bb..6d7844580 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 9bb251932..9047f2808 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -233,8 +233,9 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, /* First element is the (Integer) revision */ - status = acpi_ns_check_object_type(info, elements, - ACPI_RTYPE_INTEGER, 0); + status = + acpi_ns_check_object_type(info, elements, + ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE(status)) { return (status); } @@ -252,8 +253,9 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, /* First element is the (Integer) count of subpackages to follow */ - status = acpi_ns_check_object_type(info, elements, - ACPI_RTYPE_INTEGER, 0); + status = + acpi_ns_check_object_type(info, elements, + ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE(status)) { return (status); } diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index 77d8103d0..805e36de8 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -116,6 +116,11 @@ static const struct acpi_simple_repair_info acpi_object_repair_info[] = { ACPI_NOT_PACKAGE_ELEMENT, acpi_ns_convert_to_resource}, + /* Object reference conversions */ + + {"_DEP", ACPI_RTYPE_STRING, ACPI_ALL_PACKAGE_ELEMENTS, + acpi_ns_convert_to_reference}, + /* Unicode conversions */ {"_MLS", ACPI_RTYPE_STRING, 1, @@ -172,8 +177,8 @@ acpi_ns_simple_repair(struct acpi_evaluate_info *info, "Missing expected return value")); } - status = - predefined->object_converter(return_object, &new_object); + status = predefined->object_converter(info->node, return_object, + &new_object); if (ACPI_FAILURE(status)) { /* A fatal error occurred during a conversion */ @@ -360,12 +365,15 @@ static const struct acpi_simple_repair_info *acpi_ns_match_simple_repair(struct /* Check if we can actually repair this name/type combination */ if ((return_btype & this_name->unexpected_btypes) && - (package_index == this_name->package_index)) { + (this_name->package_index == + ACPI_ALL_PACKAGE_ELEMENTS + || package_index == this_name->package_index)) { return (this_name); } return (NULL); } + this_name++; } @@ -521,6 +529,7 @@ acpi_ns_remove_null_elements(struct acpi_evaluate_info *info, *dest = *source; dest++; } + source++; } @@ -572,8 +581,8 @@ acpi_ns_wrap_with_package(struct acpi_evaluate_info *info, ACPI_FUNCTION_NAME(ns_wrap_with_package); /* - * Create the new outer package and populate it. The new package will - * have a single element, the lone sub-object. + * Create the new outer package and populate it. The new + * package will have a single element, the lone sub-object. */ pkg_obj_desc = acpi_ut_create_package_object(1); if (!pkg_obj_desc) { diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 0515a70f4..63edbbbf9 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -225,6 +225,7 @@ static const struct acpi_repair_info *acpi_ns_match_complex_repair(struct if (ACPI_COMPARE_NAME(node->name.ascii, this_name->name)) { return (this_name); } + this_name++; } @@ -301,7 +302,8 @@ acpi_ns_repair_FDE(struct acpi_evaluate_info *info, /* We can only repair if we have exactly 5 BYTEs */ if (return_object->buffer.length != ACPI_FDE_BYTE_BUFFER_SIZE) { - ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, + ACPI_WARN_PREDEFINED((AE_INFO, + info->full_pathname, info->node_flags, "Incorrect return buffer length %u, expected %u", return_object->buffer.length, @@ -321,8 +323,8 @@ acpi_ns_repair_FDE(struct acpi_evaluate_info *info, /* Expand each byte to a DWORD */ byte_buffer = return_object->buffer.pointer; - dword_buffer = - ACPI_CAST_PTR(u32, buffer_object->buffer.pointer); + dword_buffer = ACPI_CAST_PTR(u32, + buffer_object->buffer.pointer); for (i = 0; i < ACPI_FDE_FIELD_COUNT; i++) { *dword_buffer = (u32) *byte_buffer; @@ -461,7 +463,8 @@ acpi_ns_repair_CST(struct acpi_evaluate_info *info, removing = FALSE; if ((*outer_elements)->package.count == 0) { - ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, + ACPI_WARN_PREDEFINED((AE_INFO, + info->full_pathname, info->node_flags, "SubPackage[%u] - removing entry due to zero count", i)); @@ -471,7 +474,8 @@ acpi_ns_repair_CST(struct acpi_evaluate_info *info, obj_desc = (*outer_elements)->package.elements[1]; /* Index1 = Type */ if ((u32)obj_desc->integer.value == 0) { - ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, + ACPI_WARN_PREDEFINED((AE_INFO, + info->full_pathname, info->node_flags, "SubPackage[%u] - removing entry due to invalid Type(0)", i)); @@ -538,8 +542,8 @@ acpi_ns_repair_HID(struct acpi_evaluate_info *info, } if (return_object->string.length == 0) { - ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, - info->node_flags, + ACPI_WARN_PREDEFINED((AE_INFO, + info->full_pathname, info->node_flags, "Invalid zero-length _HID or _CID string")); /* Return AE_OK anyway, let driver handle it */ @@ -710,8 +714,9 @@ acpi_ns_repair_PSS(struct acpi_evaluate_info *info, elements = (*outer_elements)->package.elements; obj_desc = elements[1]; /* Index1 = power_dissipation */ - if ((u32) obj_desc->integer.value > previous_value) { - ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname, + if ((u32)obj_desc->integer.value > previous_value) { + ACPI_WARN_PREDEFINED((AE_INFO, + info->full_pathname, info->node_flags, "SubPackage[%u,%u] - suspicious power dissipation values", i - 1, i)); @@ -969,6 +974,7 @@ acpi_ns_remove_element(union acpi_operand_object *obj_desc, u32 index) *dest = *source; dest++; } + source++; } diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index d73904013..61036d210 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -105,7 +105,7 @@ acpi_ns_search_one_scope(u32 target_name, if (ACPI_LV_NAMES & acpi_dbg_level) { char *scope_name; - scope_name = acpi_ns_get_external_pathname(parent_node); + scope_name = acpi_ns_get_normalized_pathname(parent_node, TRUE); if (scope_name) { ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "Searching %s (%p) For [%4.4s] (%s)\n", diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index de325ae04..c72cc62b9 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -173,9 +173,10 @@ void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info) info->fully_qualified = FALSE; /* - * For the internal name, the required length is 4 bytes per segment, plus - * 1 each for root_prefix, multi_name_prefix_op, segment count, trailing null - * (which is not really needed, but no there's harm in putting it there) + * For the internal name, the required length is 4 bytes per segment, + * plus 1 each for root_prefix, multi_name_prefix_op, segment count, + * trailing null (which is not really needed, but no there's harm in + * putting it there) * * strlen() + 1 covers the first name_seg, which has no path separator */ @@ -699,6 +700,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, if (!prefix_node) { *return_node = acpi_gbl_root_node; } + return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c index c68609a2b..ebd731fe8 100644 --- a/drivers/acpi/acpica/nswalk.c +++ b/drivers/acpi/acpica/nswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index 6ee1e52b9..a7deeaa8e 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -750,8 +750,8 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, /* We have a valid device, invoke the user function */ - status = info->user_function(obj_handle, nesting_level, info->context, - return_value); + status = info->user_function(obj_handle, nesting_level, + info->context, return_value); return (status); } diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 4b4d2f43d..285b82044 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c @@ -6,7 +6,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -159,7 +159,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) { acpi_status status; struct acpi_namespace_node *node; - char *node_name; + const char *node_name; /* Parameter validation */ @@ -238,7 +238,6 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, struct acpi_pnp_device_id *source, char *string_area) { - /* Create the destination PNP_DEVICE_ID */ dest->string = string_area; @@ -263,11 +262,18 @@ static char *acpi_ns_copy_device_id(struct acpi_pnp_device_id *dest, * namespace node and possibly by running several standard * control methods (Such as in the case of a device.) * - * For Device and Processor objects, run the Device _HID, _UID, _CID, _SUB, - * _CLS, _STA, _ADR, _sx_w, and _sx_d methods. + * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA, + * _CLS, _ADR, _sx_w, and _sx_d methods. * * Note: Allocates the return buffer, must be freed by the caller. * + * Note: This interface is intended to be used during the initial device + * discovery namespace traversal. Therefore, no complex methods can be + * executed, especially those that access operation regions. Therefore, do + * not add any additional methods that could cause problems in this area. + * this was the fate of the _SUB method which was found to cause such + * problems and was removed (11/2015). + * ******************************************************************************/ acpi_status @@ -279,7 +285,6 @@ acpi_get_object_info(acpi_handle handle, struct acpi_pnp_device_id_list *cid_list = NULL; struct acpi_pnp_device_id *hid = NULL; struct acpi_pnp_device_id *uid = NULL; - struct acpi_pnp_device_id *sub = NULL; struct acpi_pnp_device_id *cls = NULL; char *next_id_string; acpi_object_type type; @@ -325,7 +330,7 @@ acpi_get_object_info(acpi_handle handle, if ((type == ACPI_TYPE_DEVICE) || (type == ACPI_TYPE_PROCESSOR)) { /* * Get extra info for ACPI Device/Processor objects only: - * Run the Device _HID, _UID, _SUB, _CID, and _CLS methods. + * Run the Device _HID, _UID, _CLS, and _CID methods. * * Note: none of these methods are required, so they may or may * not be present for this device. The Info->Valid bitfield is used @@ -348,14 +353,6 @@ acpi_get_object_info(acpi_handle handle, valid |= ACPI_VALID_UID; } - /* Execute the Device._SUB method */ - - status = acpi_ut_execute_SUB(node, &sub); - if (ACPI_SUCCESS(status)) { - info_size += sub->length; - valid |= ACPI_VALID_SUB; - } - /* Execute the Device._CID method */ status = acpi_ut_execute_CID(node, &cid_list); @@ -456,9 +453,8 @@ acpi_get_object_info(acpi_handle handle, } /* - * Copy the HID, UID, SUB, and CIDs to the return buffer. - * The variable-length strings are copied to the reserved area - * at the end of the buffer. + * Copy the HID, UID, and CIDs to the return buffer. The variable-length + * strings are copied to the reserved area at the end of the buffer. * * For HID and CID, check if the ID is a PCI Root Bridge. */ @@ -476,11 +472,6 @@ acpi_get_object_info(acpi_handle handle, uid, next_id_string); } - if (sub) { - next_id_string = acpi_ns_copy_device_id(&info->subsystem_id, - sub, next_id_string); - } - if (cid_list) { info->compatible_id_list.count = cid_list->count; info->compatible_id_list.list_size = cid_list->list_size; @@ -522,9 +513,6 @@ cleanup: if (uid) { ACPI_FREE(uid); } - if (sub) { - ACPI_FREE(sub); - } if (cid_list) { ACPI_FREE(cid_list); } @@ -591,6 +579,7 @@ acpi_status acpi_install_method(u8 *buffer) parser_state.aml += acpi_ps_get_opcode_size(opcode); parser_state.pkg_end = acpi_ps_get_next_package_end(&parser_state); path = acpi_ps_get_next_namestring(&parser_state); + method_flags = *parser_state.aml++; aml_start = parser_state.aml; aml_length = ACPI_PTR_DIFF(parser_state.pkg_end, aml_start); diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 793383501..c312cd490 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c @@ -6,7 +6,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,10 +74,8 @@ acpi_status acpi_get_type(acpi_handle handle, acpi_object_type * ret_type) return (AE_BAD_PARAMETER); } - /* - * Special case for the predefined Root Node - * (return type ANY) - */ + /* Special case for the predefined Root Node (return type ANY) */ + if (handle == ACPI_ROOT_OBJECT) { *ret_type = ACPI_TYPE_ANY; return (AE_OK); diff --git a/drivers/acpi/acpica/psargs.c b/drivers/acpi/acpica/psargs.c index 29d8b7b01..d48cbed34 100644 --- a/drivers/acpi/acpica/psargs.c +++ b/drivers/acpi/acpica/psargs.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -733,6 +733,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, if (!arg) { return_ACPI_STATUS(AE_NO_MEMORY); } + acpi_ps_get_next_simple_arg(parser_state, arg_type, arg); break; @@ -798,6 +799,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, case ARGP_TARGET: case ARGP_SUPERNAME: case ARGP_SIMPLENAME: + case ARGP_NAME_OR_REF: subop = acpi_ps_peek_opcode(parser_state); if (subop == 0 || @@ -820,11 +822,11 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, status = acpi_ps_get_next_namepath(walk_state, parser_state, arg, - 1); + ACPI_POSSIBLE_METHOD_CALL); /* - * If the super_name arg of Unload is a method call, - * we have restored the AML pointer, just free this Arg + * If the super_name argument is a method call, we have + * already restored the AML pointer, just free this Arg */ if (arg->common.aml_opcode == AML_INT_METHODCALL_OP) { @@ -835,7 +837,7 @@ acpi_ps_get_next_arg(struct acpi_walk_state *walk_state, status = acpi_ps_get_next_namepath(walk_state, parser_state, arg, - 0); + ACPI_NOT_METHOD_CALL); } } else { /* Single complex argument, nothing returned */ diff --git a/drivers/acpi/acpica/psloop.c b/drivers/acpi/acpica/psloop.c index 03ac8c9a6..6a9f5059f 100644 --- a/drivers/acpi/acpica/psloop.c +++ b/drivers/acpi/acpica/psloop.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,10 +109,10 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - status = - acpi_ps_get_next_namepath(walk_state, - &(walk_state->parser_state), op, - 1); + status = acpi_ps_get_next_namepath(walk_state, + &(walk_state->parser_state), + op, + ACPI_POSSIBLE_METHOD_CALL); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -124,8 +124,8 @@ acpi_ps_get_arguments(struct acpi_walk_state *walk_state, /* * Op is not a constant or string, append each argument to the Op */ - while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) - && !walk_state->arg_count) { + while (GET_CURRENT_ARG_TYPE(walk_state->arg_types) && + !walk_state->arg_count) { walk_state->aml = walk_state->parser_state.aml; status = diff --git a/drivers/acpi/acpica/psobject.c b/drivers/acpi/acpica/psobject.c index e54bc2aa7..db0e90342 100644 --- a/drivers/acpi/acpica/psobject.c +++ b/drivers/acpi/acpica/psobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/psopcode.c b/drivers/acpi/acpica/psopcode.c index ed90fddf2..8e0c97dca 100644 --- a/drivers/acpi/acpica/psopcode.c +++ b/drivers/acpi/acpica/psopcode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -185,458 +185,458 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = { /* 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), + AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* 01 */ ACPI_OP("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, - AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), + 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), + ACPI_TYPE_LOCAL_ALIAS, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), /* 03 */ ACPI_OP("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, - AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | - AML_NSNODE | AML_NAMED), + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), /* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, - ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, - AML_TYPE_LITERAL, AML_CONSTANT), + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), /* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, - ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, - AML_TYPE_LITERAL, AML_CONSTANT), + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), /* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, - ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, - AML_TYPE_LITERAL, AML_CONSTANT), + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), /* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP, - ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, - AML_TYPE_LITERAL, AML_CONSTANT), + ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), /* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, - ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, - AML_TYPE_NAMED_NO_OBJ, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | - AML_NSNODE | AML_NAMED), + ACPI_TYPE_LOCAL_SCOPE, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_NO_OBJ, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), /* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, - ACPI_TYPE_BUFFER, AML_CLASS_CREATE, - AML_TYPE_CREATE_OBJECT, - AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), + ACPI_TYPE_BUFFER, AML_CLASS_CREATE, + AML_TYPE_CREATE_OBJECT, + AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), /* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, - ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, - AML_TYPE_CREATE_OBJECT, - AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), + ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, + AML_TYPE_CREATE_OBJECT, + AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), /* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, - ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, - AML_TYPE_NAMED_COMPLEX, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | - AML_NSNODE | AML_NAMED | AML_DEFER), + ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_COMPLEX, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED | AML_DEFER), /* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LOCAL_VARIABLE, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LOCAL_VARIABLE, 0), /* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_METHOD_ARGUMENT, 0), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_METHOD_ARGUMENT, 0), /* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_METHOD_ARGUMENT, 0), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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_OBJECT_TYPE_OP, ARGI_OBJECT_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_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_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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ /* 46 */ ACPI_OP("Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP, ACPI_TYPE_MUTEX, - AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | - AML_NSNODE | AML_NAMED), + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_NSNODE | AML_NAMED), /* 47 */ ACPI_OP("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, - AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, - AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), + AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, + AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, - ACPI_TYPE_ANY, AML_CLASS_EXECUTE, - AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), + ACPI_TYPE_ANY, AML_CLASS_EXECUTE, + AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), /* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP, - ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, - AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | - AML_DEFER | AML_FIELD | AML_CREATE), + ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, + AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | + AML_DEFER | AML_FIELD | AML_CREATE), /* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, - AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, - AML_FLAGS_EXEC_1A_1T_0R), + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R, + AML_FLAGS_EXEC_1A_1T_0R), /* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY, - AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, - AML_FLAGS_EXEC_1A_0T_0R), + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, + AML_FLAGS_EXEC_1A_0T_0R), /* 4C */ ACPI_OP("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, - AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, - AML_FLAGS_EXEC_1A_0T_0R), + AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, + AML_FLAGS_EXEC_1A_0T_0R), /* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, - ACPI_TYPE_ANY, AML_CLASS_EXECUTE, - AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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_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), + 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), + 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), + 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), + 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 | + 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_LOCAL_BANK_FIELD, + ACPI_TYPE_LOCAL_BANK_FIELD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_FIELD, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_FIELD | AML_DEFER), /* 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), + ACPI_TYPE_ANY, AML_CLASS_INTERNAL, + AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), /* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, - ACPI_TYPE_ANY, AML_CLASS_INTERNAL, - AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), + ACPI_TYPE_ANY, AML_CLASS_INTERNAL, + AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), /* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP, - ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, - AML_CLASS_INTERNAL, AML_TYPE_BOGUS, - AML_HAS_ARGS | AML_CONSTANT), + ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, + AML_CLASS_INTERNAL, AML_TYPE_BOGUS, + AML_HAS_ARGS | AML_CONSTANT), /* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, - ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, - AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), + ACPI_TYPE_LOCAL_REFERENCE, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE), /* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, - ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, - AML_TYPE_METHOD_CALL, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + AML_CLASS_PREFIX, AML_TYPE_BOGUS, AML_HAS_ARGS), /* ACPI 2.0 opcodes */ /* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, - ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, - AML_TYPE_LITERAL, AML_CONSTANT), + ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, + AML_TYPE_LITERAL, AML_CONSTANT), /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), /* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, - ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, - AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, - AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), + ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, - AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, - AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), + AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, + AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP, - ARGI_CREATE_QWORD_FIELD_OP, - ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, - AML_TYPE_CREATE_FIELD, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | - AML_DEFER | AML_CREATE), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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), + 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_COMPLEX, - AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | - AML_NSNODE | AML_NAMED | AML_DEFER), + ARGI_DATA_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), /* 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 | + ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, + AML_TYPE_NAMED_NO_OBJ, + AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE), /* ACPI 3.0 opcodes */ /* 7E */ ACPI_OP("Timer", ARGP_TIMER_OP, ARGI_TIMER_OP, ACPI_TYPE_ANY, - AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, + AML_CLASS_EXECUTE, AML_TYPE_EXEC_0A_0T_1R, AML_FLAGS_EXEC_0A_0T_1R), /* ACPI 5.0 opcodes */ diff --git a/drivers/acpi/acpica/psopinfo.c b/drivers/acpi/acpica/psopinfo.c index 58310907f..cfd17a4f2 100644 --- a/drivers/acpi/acpica/psopinfo.c +++ b/drivers/acpi/acpica/psopinfo.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 98001d7f6..8038ed2ac 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -526,8 +526,8 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) } /* - * If the transfer to the new method method call worked, a new walk - * state was created -- get it + * If the transfer to the new method method call worked + *, a new walk state was created -- get it */ walk_state = acpi_ds_get_current_walk_state(thread); continue; @@ -544,8 +544,8 @@ acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state) /* Check for possible multi-thread reentrancy problem */ if ((status == AE_ALREADY_EXISTS) && - (!(walk_state->method_desc->method. - info_flags & ACPI_METHOD_SERIALIZED))) { + (!(walk_state->method_desc->method.info_flags & + ACPI_METHOD_SERIALIZED))) { /* * Method is not serialized and tried to create an object * twice. The probable cause is that the method cannot diff --git a/drivers/acpi/acpica/psscope.c b/drivers/acpi/acpica/psscope.c index 9d669cc6c..560c3684e 100644 --- a/drivers/acpi/acpica/psscope.c +++ b/drivers/acpi/acpica/psscope.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/pstree.c b/drivers/acpi/acpica/pstree.c index cf2f2faf4..0288cdbda 100644 --- a/drivers/acpi/acpica/pstree.c +++ b/drivers/acpi/acpica/pstree.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/psutils.c b/drivers/acpi/acpica/psutils.c index 71d2877cd..b28b0da17 100644 --- a/drivers/acpi/acpica/psutils.c +++ b/drivers/acpi/acpica/psutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -175,8 +175,8 @@ void acpi_ps_free_op(union acpi_parse_object *op) ACPI_FUNCTION_NAME(ps_free_op); if (op->common.aml_opcode == AML_INT_RETURN_VALUE_OP) { - ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", - op)); + ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, + "Free retval op: %p\n", op)); } if (op->common.flags & ACPI_PARSEOP_GENERIC) { diff --git a/drivers/acpi/acpica/pswalk.c b/drivers/acpi/acpica/pswalk.c index ba5f69171..04f98c0a7 100644 --- a/drivers/acpi/acpica/pswalk.c +++ b/drivers/acpi/acpica/pswalk.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -99,6 +99,7 @@ void acpi_ps_delete_parse_tree(union acpi_parse_object *subtree_root) if (op == subtree_root) { return_VOID; } + if (next) { op = next; } else { diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index 4254805dd..04b37fcca 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rsaddr.c b/drivers/acpi/acpica/rsaddr.c index 66d406e8f..492d5b011 100644 --- a/drivers/acpi/acpica/rsaddr.c +++ b/drivers/acpi/acpica/rsaddr.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -312,8 +312,8 @@ acpi_rs_get_address_common(struct acpi_resource *resource, /* Validate the Resource Type */ - if ((aml->address.resource_type > 2) - && (aml->address.resource_type < 0xC0)) { + if ((aml->address.resource_type > 2) && + (aml->address.resource_type < 0xC0)) { return (FALSE); } diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index cb739a694..2b1209d73 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -143,16 +143,17 @@ acpi_rs_stream_option_length(u32 resource_length, ACPI_FUNCTION_ENTRY(); /* - * The resource_source_index and resource_source are optional elements of some - * Large-type resource descriptors. + * The resource_source_index and resource_source are optional elements of + * some Large-type resource descriptors. */ /* - * If the length of the actual resource descriptor is greater than the ACPI - * spec-defined minimum length, it means that a resource_source_index exists - * and is followed by a (required) null terminated string. The string length - * (including the null terminator) is the resource length minus the minimum - * length, minus one byte for the resource_source_index itself. + * If the length of the actual resource descriptor is greater than the + * ACPI spec-defined minimum length, it means that a resource_source_index + * exists and is followed by a (required) null terminated string. The + * string length (including the null terminator) is the resource length + * minus the minimum length, minus one byte for the resource_source_index + * itself. */ if (resource_length > minimum_aml_resource_length) { @@ -277,11 +278,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, * 16-Bit Address Resource: * Add the size of the optional resource_source info */ - total_size = (acpi_rs_length) - (total_size + - acpi_rs_struct_option_length(&resource->data. - address16. - resource_source)); + total_size = (acpi_rs_length) (total_size + + acpi_rs_struct_option_length + (&resource->data. + address16. + resource_source)); break; case ACPI_RESOURCE_TYPE_ADDRESS32: @@ -289,11 +290,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, * 32-Bit Address Resource: * Add the size of the optional resource_source info */ - total_size = (acpi_rs_length) - (total_size + - acpi_rs_struct_option_length(&resource->data. - address32. - resource_source)); + total_size = (acpi_rs_length) (total_size + + acpi_rs_struct_option_length + (&resource->data. + address32. + resource_source)); break; case ACPI_RESOURCE_TYPE_ADDRESS64: @@ -301,11 +302,11 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, * 64-Bit Address Resource: * Add the size of the optional resource_source info */ - total_size = (acpi_rs_length) - (total_size + - acpi_rs_struct_option_length(&resource->data. - address64. - resource_source)); + total_size = (acpi_rs_length) (total_size + + acpi_rs_struct_option_length + (&resource->data. + address64. + resource_source)); break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: @@ -314,26 +315,28 @@ acpi_rs_get_aml_length(struct acpi_resource *resource, * Add the size of each additional optional interrupt beyond the * required 1 (4 bytes for each u32 interrupt number) */ - total_size = (acpi_rs_length) - (total_size + - ((resource->data.extended_irq.interrupt_count - - 1) * 4) + - /* Add the size of the optional resource_source info */ - acpi_rs_struct_option_length(&resource->data. - extended_irq. - resource_source)); + total_size = (acpi_rs_length) (total_size + + ((resource->data. + extended_irq. + interrupt_count - + 1) * 4) + + /* Add the size of the optional resource_source info */ + acpi_rs_struct_option_length + (&resource->data. + extended_irq. + resource_source)); break; case ACPI_RESOURCE_TYPE_GPIO: - total_size = - (acpi_rs_length) (total_size + - (resource->data.gpio. - pin_table_length * 2) + - resource->data.gpio. - resource_source.string_length + - resource->data.gpio. - vendor_length); + total_size = (acpi_rs_length) (total_size + + (resource->data.gpio. + pin_table_length * 2) + + resource->data.gpio. + resource_source. + string_length + + resource->data.gpio. + vendor_length); break; @@ -566,8 +569,8 @@ acpi_rs_get_list_length(u8 * aml_buffer, acpi_gbl_resource_struct_sizes[resource_index] + extra_struct_bytes; } - buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); + buffer_size = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(buffer_size); *size_needed += buffer_size; ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index a5344428f..12978891e 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -81,8 +81,9 @@ acpi_buffer_to_resource(u8 *aml_buffer, /* Get the required length for the converted resource */ - status = acpi_rs_get_list_length(aml_buffer, aml_buffer_length, - &list_size_needed); + status = + acpi_rs_get_list_length(aml_buffer, aml_buffer_length, + &list_size_needed); if (status == AE_AML_NO_RESOURCE_END_TAG) { status = AE_OK; } @@ -232,8 +233,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* Get the required buffer length */ - status = acpi_rs_get_pci_routing_table_length(package_object, - &buffer_size_needed); + status = + acpi_rs_get_pci_routing_table_length(package_object, + &buffer_size_needed); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -270,9 +272,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); /* - * Fill in the Length field with the information we have at this point. - * The minus four is to subtract the size of the u8 Source[4] member - * because it is added below. + * Fill in the Length field with the information we have at this + * point. The minus four is to subtract the size of the u8 + * Source[4] member because it is added below. */ user_prt->length = (sizeof(struct acpi_pci_routing_table) - 4); @@ -345,11 +347,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, (u8 *) output_buffer->pointer); path_buffer.pointer = user_prt->source; - status = - acpi_ns_handle_to_pathname((acpi_handle) - node, - &path_buffer, - FALSE); + status = acpi_ns_handle_to_pathname((acpi_handle) node, &path_buffer, FALSE); /* +1 to include null terminator */ @@ -371,8 +369,8 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, case ACPI_TYPE_INTEGER: /* - * If this is a number, then the Source Name is NULL, since the - * entire buffer was zeroed out, we can leave this alone. + * If this is a number, then the Source Name is NULL, since + * the entire buffer was zeroed out, we can leave this alone. * * Add to the Length field the length of the u32 NULL */ @@ -451,9 +449,9 @@ acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, /* Get the buffer size needed for the AML byte stream */ - status = acpi_rs_get_aml_length(resource_list->pointer, - resource_list->length, - &aml_size_needed); + status = + acpi_rs_get_aml_length(resource_list->pointer, + resource_list->length, &aml_size_needed); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", (u32)aml_size_needed, acpi_format_exception(status))); diff --git a/drivers/acpi/acpica/rsdump.c b/drivers/acpi/acpica/rsdump.c index 2a09288e7..23a17c86d 100644 --- a/drivers/acpi/acpica/rsdump.c +++ b/drivers/acpi/acpica/rsdump.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -483,6 +483,7 @@ static void acpi_rs_dump_address_common(union acpi_resource_data *resource) static void acpi_rs_out_string(char *title, char *value) { + acpi_os_printf("%27s : %s", title, value); if (!*value) { acpi_os_printf("[NULL NAMESTRING]"); @@ -497,21 +498,25 @@ static void acpi_rs_out_integer8(char *title, u8 value) static void acpi_rs_out_integer16(char *title, u16 value) { + acpi_os_printf("%27s : %4.4X\n", title, value); } static void acpi_rs_out_integer32(char *title, u32 value) { + acpi_os_printf("%27s : %8.8X\n", title, value); } static void acpi_rs_out_integer64(char *title, u64 value) { + acpi_os_printf("%27s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); } static void acpi_rs_out_title(char *title) { + acpi_os_printf("%27s : ", title); } @@ -544,6 +549,7 @@ static void acpi_rs_dump_short_byte_list(u8 length, u8 * data) for (i = 0; i < length; i++) { acpi_os_printf("%X ", data[i]); } + acpi_os_printf("\n"); } diff --git a/drivers/acpi/acpica/rsdumpinfo.c b/drivers/acpi/acpica/rsdumpinfo.c index b29d9ec63..5c3491387 100644 --- a/drivers/acpi/acpica/rsdumpinfo.c +++ b/drivers/acpi/acpica/rsdumpinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rsinfo.c b/drivers/acpi/acpica/rsinfo.c index edecfc675..8e067cb73 100644 --- a/drivers/acpi/acpica/rsinfo.c +++ b/drivers/acpi/acpica/rsinfo.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rsio.c b/drivers/acpi/acpica/rsio.c index 5adba018b..07dfbed10 100644 --- a/drivers/acpi/acpica/rsio.c +++ b/drivers/acpi/acpica/rsio.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rsirq.c b/drivers/acpi/acpica/rsirq.c index 07cfa70a4..bc8f34590 100644 --- a/drivers/acpi/acpica/rsirq.c +++ b/drivers/acpi/acpica/rsirq.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rslist.c b/drivers/acpi/acpica/rslist.c index 50d5be2ee..8c42dd734 100644 --- a/drivers/acpi/acpica/rslist.c +++ b/drivers/acpi/acpica/rslist.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,6 +89,7 @@ acpi_rs_convert_aml_to_resources(u8 * aml, /* Get the appropriate conversion info table */ aml_resource = ACPI_CAST_PTR(union aml_resource, aml); + if (acpi_ut_get_resource_type(aml) == ACPI_RESOURCE_NAME_SERIAL_BUS) { if (aml_resource->common_serial_bus.type > AML_RESOURCE_MAX_SERIALBUSTYPE) { @@ -225,10 +226,10 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Perform final sanity check on the new AML resource descriptor */ - status = acpi_ut_validate_resource(NULL, - ACPI_CAST_PTR(union - aml_resource, - aml), NULL); + status = + acpi_ut_validate_resource(NULL, + ACPI_CAST_PTR(union aml_resource, + aml), NULL); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/rsmemory.c b/drivers/acpi/acpica/rsmemory.c index c6b808620..88b53ef91 100644 --- a/drivers/acpi/acpica/rsmemory.c +++ b/drivers/acpi/acpica/rsmemory.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index ac37852e0..ce3d0b77e 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -189,8 +189,8 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, item_count = ACPI_GET8(source); ACPI_SET8(destination, item_count); - resource->length = resource->length + - (info->value * item_count); + resource->length = + resource->length + (info->value * item_count); break; case ACPI_RSC_COUNT_GPIO_RES: @@ -445,8 +445,8 @@ exit: /* Round the resource struct length up to the next boundary (32 or 64) */ - resource->length = - (u32) ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); + resource->length = (u32) + ACPI_ROUND_UP_TO_NATIVE_WORD(resource->length); } return_ACPI_STATUS(AE_OK); } @@ -550,9 +550,8 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, item_count = ACPI_GET8(source); ACPI_SET8(destination, item_count); - aml_length = - (u16) (aml_length + - (info->value * (item_count - 1))); + aml_length = (u16) + (aml_length + (info->value * (item_count - 1))); break; case ACPI_RSC_COUNT16: @@ -723,11 +722,10 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, /* * 16-bit encoded bitmask (IRQ macro) */ - temp16 = acpi_rs_encode_bitmask(source, - *ACPI_ADD_PTR(u8, - resource, - info-> - value)); + temp16 = + acpi_rs_encode_bitmask(source, + *ACPI_ADD_PTR(u8, resource, + info->value)); ACPI_MOVE_16_TO_16(destination, &temp16); break; diff --git a/drivers/acpi/acpica/rsserial.c b/drivers/acpi/acpica/rsserial.c index 4c8c6fe6e..8a01296ac 100644 --- a/drivers/acpi/acpica/rsserial.c +++ b/drivers/acpi/acpica/rsserial.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 9486992ed..cf06e49cd 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -221,14 +221,13 @@ acpi_rs_set_resource_length(acpi_rsdesc_size total_length, ACPI_MOVE_16_TO_16(&aml->large_header.resource_length, &resource_length); } else { - /* Small descriptor -- bits 2:0 of byte 0 contain the length */ - + /* + * Small descriptor -- bits 2:0 of byte 0 contain the length + * Clear any existing length, preserving descriptor type bits + */ aml->small_header.descriptor_type = (u8) - - /* Clear any existing length, preserving descriptor type bits */ - ((aml->small_header. - descriptor_type & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) - + ((aml->small_header.descriptor_type & + ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK) | resource_length); } } @@ -333,8 +332,8 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, aml_resource_source = ACPI_ADD_PTR(u8, aml, minimum_length); /* - * resource_source is present if the length of the descriptor is longer than - * the minimum length. + * resource_source is present if the length of the descriptor is longer + * than the minimum length. * * Note: Some resource descriptors will have an additional null, so * we add 1 to the minimum length. @@ -366,6 +365,7 @@ acpi_rs_get_resource_source(acpi_rs_length resource_length, total_length = (u32)strlen(ACPI_CAST_PTR(char, &aml_resource_source[1])) + 1; + total_length = (u32)ACPI_ROUND_UP_TO_NATIVE_WORD(total_length); memset(resource_source->string_ptr, 0, total_length); @@ -438,8 +438,8 @@ acpi_rs_set_resource_source(union aml_resource * aml, * Add the length of the string (+ 1 for null terminator) to the * final descriptor length */ - descriptor_length += - ((acpi_rsdesc_size) resource_source->string_length + 1); + descriptor_length += ((acpi_rsdesc_size) + resource_source->string_length + 1); } /* Return the new total length of the AML descriptor */ @@ -478,8 +478,9 @@ acpi_rs_get_prt_method_data(struct acpi_namespace_node * node, /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__PRT, - ACPI_BTYPE_PACKAGE, &obj_desc); + status = + acpi_ut_evaluate_object(node, METHOD_NAME__PRT, ACPI_BTYPE_PACKAGE, + &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -527,8 +528,9 @@ acpi_rs_get_crs_method_data(struct acpi_namespace_node *node, /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__CRS, - ACPI_BTYPE_BUFFER, &obj_desc); + status = + acpi_ut_evaluate_object(node, METHOD_NAME__CRS, ACPI_BTYPE_BUFFER, + &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -577,8 +579,9 @@ acpi_rs_get_prs_method_data(struct acpi_namespace_node *node, /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__PRS, - ACPI_BTYPE_BUFFER, &obj_desc); + status = + acpi_ut_evaluate_object(node, METHOD_NAME__PRS, ACPI_BTYPE_BUFFER, + &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -627,8 +630,9 @@ acpi_rs_get_aei_method_data(struct acpi_namespace_node *node, /* Execute the method, no parameters */ - status = acpi_ut_evaluate_object(node, METHOD_NAME__AEI, - ACPI_BTYPE_BUFFER, &obj_desc); + status = + acpi_ut_evaluate_object(node, METHOD_NAME__AEI, ACPI_BTYPE_BUFFER, + &obj_desc); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 1e8cd5723..900933be9 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,7 +53,7 @@ ACPI_MODULE_NAME("rsxface") /* Local macros for 16,32-bit to 64-bit conversion */ #define ACPI_COPY_FIELD(out, in, field) ((out)->field = (in)->field) -#define ACPI_COPY_ADDRESS(out, in) \ +#define ACPI_COPY_ADDRESS(out, in) \ ACPI_COPY_FIELD(out, in, resource_type); \ ACPI_COPY_FIELD(out, in, producer_consumer); \ ACPI_COPY_FIELD(out, in, decode); \ diff --git a/drivers/acpi/acpica/tbdata.c b/drivers/acpi/acpica/tbdata.c index 5c9d5abf1..7da79ce74 100644 --- a/drivers/acpi/acpica/tbdata.c +++ b/drivers/acpi/acpica/tbdata.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -407,6 +407,7 @@ acpi_tb_verify_temp_table(struct acpi_table_desc * table_desc, char *signature) table_desc->signature.ascii : "????", ACPI_FORMAT_UINT64(table_desc-> address))); + goto invalidate_and_exit; } } diff --git a/drivers/acpi/acpica/tbfadt.c b/drivers/acpi/acpica/tbfadt.c index a6454f4a6..a79e4f30b 100644 --- a/drivers/acpi/acpica/tbfadt.c +++ b/drivers/acpi/acpica/tbfadt.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/tbfind.c b/drivers/acpi/acpica/tbfind.c index 405529d49..f2d080346 100644 --- a/drivers/acpi/acpica/tbfind.c +++ b/drivers/acpi/acpica/tbfind.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 6319b4242..b661a1e01 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -337,8 +337,8 @@ acpi_tb_install_standard_table(acpi_physical_address address, * need to be unregistered when they are unloaded, and slots in the * root table list should be reused when empty. */ - if (acpi_gbl_root_table_list.tables[i]. - flags & ACPI_TABLE_IS_LOADED) { + if (acpi_gbl_root_table_list.tables[i].flags & + ACPI_TABLE_IS_LOADED) { /* Table is still loaded, this is an error */ diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c index 709d5112f..fd4146d4f 100644 --- a/drivers/acpi/acpica/tbprint.c +++ b/drivers/acpi/acpica/tbprint.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -76,6 +76,7 @@ static void acpi_tb_fix_string(char *string, acpi_size length) if (!isprint((int)*string)) { *string = '?'; } + string++; length--; } diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index d8ddef38c..3269bef37 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -121,6 +121,7 @@ void acpi_tb_check_dsdt_header(void) ACPI_BIOS_ERROR((AE_INFO, "The DSDT has been corrupted or replaced - " "old, new headers below")); + acpi_tb_print_table_header(0, &acpi_gbl_original_dsdt_header); acpi_tb_print_table_header(0, acpi_gbl_DSDT); @@ -379,7 +380,6 @@ next_table: } acpi_os_unmap_memory(table, length); - return_ACPI_STATUS(AE_OK); } @@ -389,7 +389,7 @@ next_table: * * PARAMETERS: signature - Sig string to be validated * - * RETURN: TRUE if signature is correct length and has valid characters + * RETURN: TRUE if signature is has 4 valid ACPI characters * * DESCRIPTION: Validate an ACPI table signature. * @@ -399,12 +399,6 @@ u8 acpi_is_valid_signature(char *signature) { u32 i; - /* Validate the signature length */ - - if (strlen(signature) != ACPI_NAME_SIZE) { - return (FALSE); - } - /* Validate each character in the signature */ for (i = 0; i < ACPI_NAME_SIZE; i++) { diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index 5559e2c70..326df65de 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index 55ee14ca9..278666e39 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -191,6 +191,7 @@ acpi_status acpi_tb_load_namespace(void) "(%4.4s:%8.8s) while loading table", table->signature.ascii, table->pointer->oem_table_id)); + tables_failed++; ACPI_DEBUG_PRINT_RAW((ACPI_DB_INIT, @@ -206,7 +207,7 @@ acpi_status acpi_tb_load_namespace(void) if (!tables_failed) { ACPI_INFO((AE_INFO, - "%u ACPI AML tables successfully acquired and loaded", + "%u ACPI AML tables successfully acquired and loaded\n", tables_loaded)); } else { ACPI_ERROR((AE_INFO, diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index fa76a3603..b9a78e457 100644 --- a/drivers/acpi/acpica/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utaddress.c b/drivers/acpi/acpica/utaddress.c index 911ea8e7f..c986ec66a 100644 --- a/drivers/acpi/acpica/utaddress.c +++ b/drivers/acpi/acpica/utaddress.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -239,8 +239,9 @@ acpi_ut_check_address_range(acpi_adr_space_type space_id, overlap_count++; if (warn) { /* Optional warning message */ pathname = - acpi_ns_get_external_pathname(range_info-> - region_node); + acpi_ns_get_normalized_pathname(range_info-> + region_node, + TRUE); ACPI_WARNING((AE_INFO, "%s range 0x%8.8X%8.8X-0x%8.8X%8.8X conflicts with OpRegion 0x%8.8X%8.8X-0x%8.8X%8.8X (%s)", diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index 7a4101f06..3dbdc3ab8 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utbuffer.c b/drivers/acpi/acpica/utbuffer.c index 01c8709ca..0cfb2b8ed 100644 --- a/drivers/acpi/acpica/utbuffer.c +++ b/drivers/acpi/acpica/utbuffer.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index 0d21fbd99..c9a720f22 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index 257221d45..98d53e59c 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -257,9 +257,9 @@ acpi_ut_copy_ielement_to_eelement(u8 object_type, ACPI_FUNCTION_ENTRY(); this_index = state->pkg.index; - target_object = (union acpi_object *) - &((union acpi_object *)(state->pkg.dest_object))->package. - elements[this_index]; + target_object = (union acpi_object *)&((union acpi_object *) + (state->pkg.dest_object))-> + package.elements[this_index]; switch (object_type) { case ACPI_COPY_TYPE_SIMPLE: @@ -348,15 +348,15 @@ acpi_ut_copy_ipackage_to_epackage(union acpi_operand_object *internal_object, * Free space begins right after the first package */ info.length = ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); - info.free_space = - buffer + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); + info.free_space = buffer + + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)); info.object_space = 0; info.num_packages = 1; external_object->type = internal_object->common.type; external_object->package.count = internal_object->package.count; - external_object->package.elements = ACPI_CAST_PTR(union acpi_object, - info.free_space); + external_object->package.elements = + ACPI_CAST_PTR(union acpi_object, info.free_space); /* * Leave room for an array of ACPI_OBJECTS in the buffer @@ -593,8 +593,8 @@ acpi_ut_copy_epackage_to_ipackage(union acpi_object *external_object, package_elements = package_object->package.elements; /* - * Recursive implementation. Probably ok, since nested external packages - * as parameters should be very rare. + * Recursive implementation. Probably ok, since nested external + * packages as parameters should be very rare. */ for (i = 0; i < external_object->package.count; i++) { status = @@ -649,9 +649,8 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object, /* * Build a simple object (no nested objects) */ - status = - acpi_ut_copy_esimple_to_isimple(external_object, - internal_object); + status = acpi_ut_copy_esimple_to_isimple(external_object, + internal_object); } return_ACPI_STATUS(status); diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 414622910..1cfc5f69b 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index ecaaaffc0..6ba65b025 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -114,7 +114,7 @@ const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS] = { "PCC" /* 0x0A */ }; -char *acpi_ut_get_region_name(u8 space_id) +const char *acpi_ut_get_region_name(u8 space_id) { if (space_id >= ACPI_USER_REGION_BEGIN) { @@ -127,7 +127,7 @@ char *acpi_ut_get_region_name(u8 space_id) return ("InvalidSpaceId"); } - return (ACPI_CAST_PTR(char, acpi_gbl_region_types[space_id])); + return (acpi_gbl_region_types[space_id]); } /******************************************************************************* @@ -152,14 +152,14 @@ static const char *acpi_gbl_event_types[ACPI_NUM_FIXED_EVENTS] = { "RealTimeClock", }; -char *acpi_ut_get_event_name(u32 event_id) +const char *acpi_ut_get_event_name(u32 event_id) { if (event_id > ACPI_EVENT_MAX) { return ("InvalidEventID"); } - return (ACPI_CAST_PTR(char, acpi_gbl_event_types[event_id])); + return (acpi_gbl_event_types[event_id]); } /******************************************************************************* @@ -180,7 +180,8 @@ char *acpi_ut_get_event_name(u32 event_id) * * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; * when stored in a table it really means that we have thus far seen no - * evidence to indicate what type is actually going to be stored for this entry. + * evidence to indicate what type is actually going to be stored for this + & entry. */ static const char acpi_gbl_bad_type[] = "UNDEFINED"; @@ -220,17 +221,17 @@ static const char *acpi_gbl_ns_type_names[] = { /* 30 */ "Invalid" }; -char *acpi_ut_get_type_name(acpi_object_type type) +const char *acpi_ut_get_type_name(acpi_object_type type) { if (type > ACPI_TYPE_INVALID) { - return (ACPI_CAST_PTR(char, acpi_gbl_bad_type)); + return (acpi_gbl_bad_type); } - return (ACPI_CAST_PTR(char, acpi_gbl_ns_type_names[type])); + return (acpi_gbl_ns_type_names[type]); } -char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) +const char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) { ACPI_FUNCTION_TRACE(ut_get_object_type_name); @@ -267,7 +268,7 @@ char *acpi_ut_get_object_type_name(union acpi_operand_object *obj_desc) * ******************************************************************************/ -char *acpi_ut_get_node_name(void *object) +const char *acpi_ut_get_node_name(void *object) { struct acpi_namespace_node *node = (struct acpi_namespace_node *)object; @@ -333,7 +334,7 @@ static const char *acpi_gbl_desc_type_names[] = { /* 15 */ "Node" }; -char *acpi_ut_get_descriptor_name(void *object) +const char *acpi_ut_get_descriptor_name(void *object) { if (!object) { @@ -344,10 +345,7 @@ char *acpi_ut_get_descriptor_name(void *object) return ("Not a Descriptor"); } - return (ACPI_CAST_PTR(char, - acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE - (object)])); - + return (acpi_gbl_desc_type_names[ACPI_GET_DESCRIPTOR_TYPE(object)]); } /******************************************************************************* @@ -415,7 +413,7 @@ const char *acpi_ut_get_reference_name(union acpi_operand_object *object) /* Names for internal mutex objects, used for debug output */ -static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { +static const char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { "ACPI_MTX_Interpreter", "ACPI_MTX_Namespace", "ACPI_MTX_Tables", @@ -424,7 +422,7 @@ static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { "ACPI_MTX_Memory", }; -char *acpi_ut_get_mutex_name(u32 mutex_id) +const char *acpi_ut_get_mutex_name(u32 mutex_id) { if (mutex_id > ACPI_MAX_MUTEX) { diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index 1638312e3..529d6c38e 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -209,6 +209,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) acpi_ut_delete_object_desc(object->method.mutex); object->method.mutex = NULL; } + if (object->method.node) { object->method.node = NULL; } @@ -515,8 +516,8 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) } /* - * All sub-objects must have their reference count incremented also. - * Different object types have different subobjects. + * All sub-objects must have their reference count incremented + * also. Different object types have different subobjects. */ switch (object->common.type) { case ACPI_TYPE_DEVICE: diff --git a/drivers/acpi/acpica/uterror.c b/drivers/acpi/acpica/uterror.c index 9ef80f282..475932cec 100644 --- a/drivers/acpi/acpica/uterror.c +++ b/drivers/acpi/acpica/uterror.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -217,8 +217,9 @@ acpi_ut_namespace_error(const char *module_name, } else { /* Convert path to external format */ - status = acpi_ns_externalize_name(ACPI_UINT32_MAX, - internal_name, NULL, &name); + status = + acpi_ns_externalize_name(ACPI_UINT32_MAX, internal_name, + NULL, &name); /* Print target name */ @@ -271,9 +272,8 @@ acpi_ut_method_error(const char *module_name, acpi_os_printf(ACPI_MSG_ERROR); if (path) { - status = - acpi_ns_get_node(prefix_node, path, ACPI_NS_NO_UPSEARCH, - &node); + status = acpi_ns_get_node(prefix_node, path, + ACPI_NS_NO_UPSEARCH, &node); if (ACPI_FAILURE(status)) { acpi_os_printf("[Could not get node by pathname]"); } diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 6c738fa0c..17b9f3e6e 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c index 743a0ae9f..695240338 100644 --- a/drivers/acpi/acpica/utexcep.c +++ b/drivers/acpi/acpica/utexcep.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utfileio.c b/drivers/acpi/acpica/utfileio.c deleted file mode 100644 index d435b7b7e..000000000 --- a/drivers/acpi/acpica/utfileio.c +++ /dev/null @@ -1,334 +0,0 @@ -/******************************************************************************* - * - * Module Name: utfileio - simple file I/O routines - * - ******************************************************************************/ - -/* - * Copyright (C) 2000 - 2015, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include <acpi/acpi.h> -#include "accommon.h" -#include "actables.h" -#include "acapps.h" -#include "errno.h" - -#ifdef ACPI_ASL_COMPILER -#include "aslcompiler.h" -#endif - -#define _COMPONENT ACPI_CA_DEBUGGER -ACPI_MODULE_NAME("utfileio") - -#ifdef ACPI_APPLICATION -/* Local prototypes */ -static acpi_status -acpi_ut_check_text_mode_corruption(u8 *table, - u32 table_length, u32 file_length); - -static acpi_status -acpi_ut_read_table(FILE * fp, - struct acpi_table_header **table, u32 *table_length); - -/******************************************************************************* - * - * FUNCTION: acpi_ut_check_text_mode_corruption - * - * PARAMETERS: table - Table buffer - * table_length - Length of table from the table header - * file_length - Length of the file that contains the table - * - * RETURN: Status - * - * DESCRIPTION: Check table for text mode file corruption where all linefeed - * characters (LF) have been replaced by carriage return linefeed - * pairs (CR/LF). - * - ******************************************************************************/ - -static acpi_status -acpi_ut_check_text_mode_corruption(u8 *table, u32 table_length, u32 file_length) -{ - u32 i; - u32 pairs = 0; - - if (table_length != file_length) { - ACPI_WARNING((AE_INFO, - "File length (0x%X) is not the same as the table length (0x%X)", - file_length, table_length)); - } - - /* Scan entire table to determine if each LF has been prefixed with a CR */ - - for (i = 1; i < file_length; i++) { - if (table[i] == 0x0A) { - if (table[i - 1] != 0x0D) { - - /* The LF does not have a preceding CR, table not corrupted */ - - return (AE_OK); - } else { - /* Found a CR/LF pair */ - - pairs++; - } - i++; - } - } - - if (!pairs) { - return (AE_OK); - } - - /* - * Entire table scanned, each CR is part of a CR/LF pair -- - * meaning that the table was treated as a text file somewhere. - * - * NOTE: We can't "fix" the table, because any existing CR/LF pairs in the - * original table are left untouched by the text conversion process -- - * meaning that we cannot simply replace CR/LF pairs with LFs. - */ - acpi_os_printf("Table has been corrupted by text mode conversion\n"); - acpi_os_printf("All LFs (%u) were changed to CR/LF pairs\n", pairs); - acpi_os_printf("Table cannot be repaired!\n"); - return (AE_BAD_VALUE); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_read_table - * - * PARAMETERS: fp - File that contains table - * table - Return value, buffer with table - * table_length - Return value, length of table - * - * RETURN: Status - * - * DESCRIPTION: Load the DSDT from the file pointer - * - ******************************************************************************/ - -static acpi_status -acpi_ut_read_table(FILE * fp, - struct acpi_table_header **table, u32 *table_length) -{ - struct acpi_table_header table_header; - u32 actual; - acpi_status status; - u32 file_size; - u8 standard_header = TRUE; - s32 count; - - /* Get the file size */ - - file_size = cm_get_file_size(fp); - if (file_size == ACPI_UINT32_MAX) { - return (AE_ERROR); - } - - if (file_size < 4) { - return (AE_BAD_HEADER); - } - - /* Read the signature */ - - fseek(fp, 0, SEEK_SET); - - count = fread(&table_header, 1, sizeof(struct acpi_table_header), fp); - if (count != sizeof(struct acpi_table_header)) { - acpi_os_printf("Could not read the table header\n"); - return (AE_BAD_HEADER); - } - - /* The RSDP table does not have standard ACPI header */ - - if (ACPI_VALIDATE_RSDP_SIG(table_header.signature)) { - *table_length = file_size; - standard_header = FALSE; - } else { - -#if 0 - /* Validate the table header/length */ - - status = acpi_tb_validate_table_header(&table_header); - if (ACPI_FAILURE(status)) { - acpi_os_printf("Table header is invalid!\n"); - return (status); - } -#endif - - /* File size must be at least as long as the Header-specified length */ - - if (table_header.length > file_size) { - acpi_os_printf - ("TableHeader length [0x%X] greater than the input file size [0x%X]\n", - table_header.length, file_size); - -#ifdef ACPI_ASL_COMPILER - acpi_os_printf("File is corrupt or is ASCII text -- " - "it must be a binary file\n"); -#endif - return (AE_BAD_HEADER); - } -#ifdef ACPI_OBSOLETE_CODE - /* We only support a limited number of table types */ - - if (!ACPI_COMPARE_NAME - ((char *)table_header.signature, ACPI_SIG_DSDT) - && !ACPI_COMPARE_NAME((char *)table_header.signature, - ACPI_SIG_PSDT) - && !ACPI_COMPARE_NAME((char *)table_header.signature, - ACPI_SIG_SSDT)) { - acpi_os_printf - ("Table signature [%4.4s] is invalid or not supported\n", - (char *)table_header.signature); - ACPI_DUMP_BUFFER(&table_header, - sizeof(struct acpi_table_header)); - return (AE_ERROR); - } -#endif - - *table_length = table_header.length; - } - - /* Allocate a buffer for the table */ - - *table = acpi_os_allocate((size_t) file_size); - if (!*table) { - acpi_os_printf - ("Could not allocate memory for ACPI table %4.4s (size=0x%X)\n", - table_header.signature, *table_length); - return (AE_NO_MEMORY); - } - - /* Get the rest of the table */ - - fseek(fp, 0, SEEK_SET); - actual = fread(*table, 1, (size_t) file_size, fp); - if (actual == file_size) { - if (standard_header) { - - /* Now validate the checksum */ - - status = acpi_tb_verify_checksum((void *)*table, - ACPI_CAST_PTR(struct - acpi_table_header, - *table)-> - length); - - if (status == AE_BAD_CHECKSUM) { - status = - acpi_ut_check_text_mode_corruption((u8 *) - *table, - file_size, - (*table)-> - length); - return (status); - } - } - return (AE_OK); - } - - if (actual > 0) { - acpi_os_printf("Warning - reading table, asked for %X got %X\n", - file_size, actual); - return (AE_OK); - } - - acpi_os_printf("Error - could not read the table file\n"); - acpi_os_free(*table); - *table = NULL; - *table_length = 0; - return (AE_ERROR); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ut_read_table_from_file - * - * PARAMETERS: filename - File where table is located - * table - Where a pointer to the table is returned - * - * RETURN: Status - * - * DESCRIPTION: Get an ACPI table from a file - * - ******************************************************************************/ - -acpi_status -acpi_ut_read_table_from_file(char *filename, struct acpi_table_header ** table) -{ - FILE *file; - u32 file_size; - u32 table_length; - acpi_status status = AE_ERROR; - - /* Open the file, get current size */ - - file = fopen(filename, "rb"); - if (!file) { - perror("Could not open input file"); - - if (errno == ENOENT) { - return (AE_NOT_EXIST); - } - - return (status); - } - - file_size = cm_get_file_size(file); - if (file_size == ACPI_UINT32_MAX) { - goto exit; - } - - /* Get the entire file */ - - fprintf(stderr, - "Reading ACPI table from file %12s - Length %.8u (0x%06X)\n", - filename, file_size, file_size); - - status = acpi_ut_read_table(file, table, &table_length); - if (ACPI_FAILURE(status)) { - acpi_os_printf("Could not get table from the file\n"); - } - -exit: - fclose(file); - return (status); -} - -#endif diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index a72685c1e..48fffcfe9 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/uthex.c b/drivers/acpi/acpica/uthex.c index fda8b3def..4354fb800 100644 --- a/drivers/acpi/acpica/uthex.c +++ b/drivers/acpi/acpica/uthex.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -48,7 +48,7 @@ ACPI_MODULE_NAME("uthex") /* Hex to ASCII conversion table */ -static char acpi_gbl_hex_to_ascii[] = { +static const char acpi_gbl_hex_to_ascii[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index 7956df1e2..6fb4ec365 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,73 +127,6 @@ cleanup: /******************************************************************************* * - * FUNCTION: acpi_ut_execute_SUB - * - * PARAMETERS: device_node - Node for the device - * return_id - Where the _SUB is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _SUB control method that returns the subsystem - * ID of the device. The _SUB value is always a string containing - * either a valid PNP or ACPI ID. - * - * NOTE: Internal function, no parameter validation - * - ******************************************************************************/ - -acpi_status -acpi_ut_execute_SUB(struct acpi_namespace_node *device_node, - struct acpi_pnp_device_id **return_id) -{ - union acpi_operand_object *obj_desc; - struct acpi_pnp_device_id *sub; - u32 length; - acpi_status status; - - ACPI_FUNCTION_TRACE(ut_execute_SUB); - - status = acpi_ut_evaluate_object(device_node, METHOD_NAME__SUB, - ACPI_BTYPE_STRING, &obj_desc); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Get the size of the String to be returned, includes null terminator */ - - length = obj_desc->string.length + 1; - - /* Allocate a buffer for the SUB */ - - sub = - ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_pnp_device_id) + - (acpi_size) length); - if (!sub) { - status = AE_NO_MEMORY; - goto cleanup; - } - - /* Area for the string starts after PNP_DEVICE_ID struct */ - - sub->string = - ACPI_ADD_PTR(char, sub, sizeof(struct acpi_pnp_device_id)); - - /* Simply copy existing string */ - - strcpy(sub->string, obj_desc->string.pointer); - sub->length = length; - *return_id = sub; - -cleanup: - - /* On exit, we must delete the return object */ - - acpi_ut_remove_reference(obj_desc); - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * * FUNCTION: acpi_ut_execute_UID * * PARAMETERS: device_node - Node for the device diff --git a/drivers/acpi/acpica/utinit.c b/drivers/acpi/acpica/utinit.c index ccd0745f0..f91f724c4 100644 --- a/drivers/acpi/acpica/utinit.c +++ b/drivers/acpi/acpica/utinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -206,7 +206,6 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_next_owner_id_offset = 0; acpi_gbl_debugger_configuration = DEBUGGER_THREADING; acpi_gbl_osi_mutex = NULL; - acpi_gbl_reg_methods_executed = FALSE; acpi_gbl_max_loop_iterations = 0xFFFF; /* Hardware oriented */ diff --git a/drivers/acpi/acpica/utlock.c b/drivers/acpi/acpica/utlock.c index 089f78bbd..3cd097892 100644 --- a/drivers/acpi/acpica/utlock.c +++ b/drivers/acpi/acpica/utlock.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utmath.c b/drivers/acpi/acpica/utmath.c index f9ff100f0..667372093 100644 --- a/drivers/acpi/acpica/utmath.c +++ b/drivers/acpi/acpica/utmath.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,6 +111,7 @@ acpi_ut_short_divide(u64 dividend, */ ACPI_DIV_64_BY_32(0, dividend_ovl.part.hi, divisor, quotient.part.hi, remainder32); + ACPI_DIV_64_BY_32(remainder32, dividend_ovl.part.lo, divisor, quotient.part.lo, remainder32); @@ -179,6 +180,7 @@ acpi_ut_divide(u64 in_dividend, */ ACPI_DIV_64_BY_32(0, dividend.part.hi, divisor.part.lo, quotient.part.hi, partial1); + ACPI_DIV_64_BY_32(partial1, dividend.part.lo, divisor.part.lo, quotient.part.lo, remainder.part.lo); } @@ -206,12 +208,12 @@ acpi_ut_divide(u64 in_dividend, ACPI_DIV_64_BY_32(normalized_dividend.part.hi, normalized_dividend.part.lo, - normalized_divisor.part.lo, - quotient.part.lo, partial1); + normalized_divisor.part.lo, quotient.part.lo, + partial1); /* - * The quotient is always 32 bits, and simply requires adjustment. - * The 64-bit remainder must be generated. + * The quotient is always 32 bits, and simply requires + * adjustment. The 64-bit remainder must be generated. */ partial1 = quotient.part.lo * divisor.part.hi; partial2.full = (u64) quotient.part.lo * divisor.part.lo; diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c index bd4443bdc..d938c27cc 100644 --- a/drivers/acpi/acpica/utmisc.c +++ b/drivers/acpi/acpica/utmisc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -264,8 +264,8 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object, */ if ((!this_source_obj) || (ACPI_GET_DESCRIPTOR_TYPE(this_source_obj) != - ACPI_DESC_TYPE_OPERAND) - || (this_source_obj->common.type != ACPI_TYPE_PACKAGE)) { + ACPI_DESC_TYPE_OPERAND) || + (this_source_obj->common.type != ACPI_TYPE_PACKAGE)) { status = walk_callback(ACPI_COPY_TYPE_SIMPLE, this_source_obj, state, context); @@ -318,9 +318,10 @@ acpi_ut_walk_package_tree(union acpi_operand_object *source_object, * The callback above returned a new target package object. */ acpi_ut_push_generic_state(&state_list, state); - state = acpi_ut_create_pkg_state(this_source_obj, - state->pkg. - this_target_obj, 0); + state = + acpi_ut_create_pkg_state(this_source_obj, + state->pkg.this_target_obj, + 0); if (!state) { /* Free any stacked Update State objects */ diff --git a/drivers/acpi/acpica/utmutex.c b/drivers/acpi/acpica/utmutex.c index ce406e39b..15073375b 100644 --- a/drivers/acpi/acpica/utmutex.c +++ b/drivers/acpi/acpica/utmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -111,17 +111,6 @@ acpi_status acpi_ut_mutex_initialize(void) if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } -#ifdef ACPI_DEBUGGER - - /* Debugger Support */ - - status = acpi_os_create_mutex(&acpi_gbl_db_command_ready); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - status = acpi_os_create_mutex(&acpi_gbl_db_command_complete); -#endif return_ACPI_STATUS(status); } @@ -162,12 +151,6 @@ void acpi_ut_mutex_terminate(void) /* Delete the reader/writer lock */ acpi_ut_delete_rw_lock(&acpi_gbl_namespace_rw_lock); - -#ifdef ACPI_DEBUGGER - acpi_os_delete_mutex(acpi_gbl_db_command_ready); - acpi_os_delete_mutex(acpi_gbl_db_command_complete); -#endif - return_VOID; } @@ -290,8 +273,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id) (u32)this_thread_id, acpi_ut_get_mutex_name(mutex_id))); - status = acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, - ACPI_WAIT_FOREVER); + status = + acpi_os_acquire_mutex(acpi_gbl_mutex_info[mutex_id].mutex, + ACPI_WAIT_FOREVER); if (ACPI_SUCCESS(status)) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %u acquired Mutex [%s]\n", diff --git a/drivers/acpi/acpica/utnonansi.c b/drivers/acpi/acpica/utnonansi.c index 1d5f6b17b..c427a5cda 100644 --- a/drivers/acpi/acpica/utnonansi.c +++ b/drivers/acpi/acpica/utnonansi.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -282,8 +282,8 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) /* Divide the digit into the correct position */ - (void)acpi_ut_short_divide((dividend - (u64)this_digit), - base, "ient, NULL); + (void)acpi_ut_short_divide((dividend - (u64)this_digit), base, + "ient, NULL); if (return_value > quotient) { if (to_integer_op) { diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 7d83efe1e..edad3f043 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -112,9 +112,9 @@ union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char /* These types require a secondary object */ - second_object = acpi_ut_allocate_object_desc_dbg(module_name, - line_number, - component_id); + second_object = + acpi_ut_allocate_object_desc_dbg(module_name, line_number, + component_id); if (!second_object) { acpi_ut_delete_object_desc(object); return_PTR(NULL); @@ -253,7 +253,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size) buffer = ACPI_ALLOCATE_ZEROED(buffer_size); if (!buffer) { ACPI_ERROR((AE_INFO, "Could not allocate size %u", - (u32) buffer_size)); + (u32)buffer_size)); + acpi_ut_remove_reference(buffer_desc); return_PTR(NULL); } @@ -305,7 +306,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size) string = ACPI_ALLOCATE_ZEROED(string_size + 1); if (!string) { ACPI_ERROR((AE_INFO, "Could not allocate size %u", - (u32) string_size)); + (u32)string_size)); + acpi_ut_remove_reference(string_desc); return_PTR(NULL); } @@ -649,8 +651,9 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, info.object_space = 0; info.num_packages = 1; - status = acpi_ut_walk_package_tree(internal_object, NULL, - acpi_ut_get_element_length, &info); + status = + acpi_ut_walk_package_tree(internal_object, NULL, + acpi_ut_get_element_length, &info); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } @@ -660,7 +663,8 @@ acpi_ut_get_package_object_size(union acpi_operand_object *internal_object, * just add the length of the package objects themselves. * Round up to the next machine word. */ - info.length += ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) * + info.length += + ACPI_ROUND_UP_TO_NATIVE_WORD(sizeof(union acpi_object)) * (acpi_size) info.num_packages; /* Return the total package length */ @@ -692,8 +696,8 @@ acpi_ut_get_object_size(union acpi_operand_object *internal_object, ACPI_FUNCTION_ENTRY(); if ((ACPI_GET_DESCRIPTOR_TYPE(internal_object) == - ACPI_DESC_TYPE_OPERAND) - && (internal_object->common.type == ACPI_TYPE_PACKAGE)) { + ACPI_DESC_TYPE_OPERAND) && + (internal_object->common.type == ACPI_TYPE_PACKAGE)) { status = acpi_ut_get_package_object_size(internal_object, obj_length); diff --git a/drivers/acpi/acpica/utosi.c b/drivers/acpi/acpica/utosi.c index 8f3d203ae..b5cfe577f 100644 --- a/drivers/acpi/acpica/utosi.c +++ b/drivers/acpi/acpica/utosi.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -269,9 +269,10 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name) previous_interface = next_interface = acpi_gbl_supported_interfaces; while (next_interface) { if (!strcmp(interface_name, next_interface->name)) { - - /* Found: name is in either the static list or was added at runtime */ - + /* + * Found: name is in either the static list + * or was added at runtime + */ if (next_interface->flags & ACPI_OSI_DYNAMIC) { /* Interface was added dynamically, remove and free it */ @@ -288,8 +289,8 @@ acpi_status acpi_ut_remove_interface(acpi_string interface_name) ACPI_FREE(next_interface); } else { /* - * Interface is in static list. If marked invalid, then it - * does not actually exist. Else, mark it invalid. + * Interface is in static list. If marked invalid, then + * it does not actually exist. Else, mark it invalid. */ if (next_interface->flags & ACPI_OSI_INVALID) { return (AE_NOT_EXIST); diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c index 295921706..813520ab8 100644 --- a/drivers/acpi/acpica/utownerid.c +++ b/drivers/acpi/acpica/utownerid.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,8 +73,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) /* Guard against multiple allocations of ID to the same location */ if (*owner_id) { - ACPI_ERROR((AE_INFO, "Owner ID [0x%2.2X] already exists", - *owner_id)); + ACPI_ERROR((AE_INFO, + "Owner ID [0x%2.2X] already exists", *owner_id)); return_ACPI_STATUS(AE_ALREADY_EXISTS); } @@ -87,8 +87,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) /* * Find a free owner ID, cycle through all possible IDs on repeated - * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have - * to be scanned twice. + * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index + * may have to be scanned twice. */ for (i = 0, j = acpi_gbl_last_owner_id_index; i < (ACPI_NUM_OWNERID_MASKS + 1); i++, j++) { @@ -141,8 +141,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) * they are released when a table is unloaded or a method completes * execution. * - * If this error happens, there may be very deep nesting of invoked control - * methods, or there may be a bug where the IDs are not released. + * If this error happens, there may be very deep nesting of invoked + * control methods, or there may be a bug where the IDs are not released. */ status = AE_OWNER_ID_LIMIT; ACPI_ERROR((AE_INFO, diff --git a/drivers/acpi/acpica/utpredef.c b/drivers/acpi/acpica/utpredef.c index 97898ed71..770a1775b 100644 --- a/drivers/acpi/acpica/utpredef.c +++ b/drivers/acpi/acpica/utpredef.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -225,8 +225,10 @@ const union acpi_predefined_info *acpi_ut_match_resource_name(char *name) { const union acpi_predefined_info *this_name; - /* Quick check for a predefined name, first character must be underscore */ - + /* + * Quick check for a predefined name, first character must + * be underscore + */ if (name[0] != '_') { return (NULL); } diff --git a/drivers/acpi/acpica/utprint.c b/drivers/acpi/acpica/utprint.c index b26297c5d..8c218ad78 100644 --- a/drivers/acpi/acpica/utprint.c +++ b/drivers/acpi/acpica/utprint.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -314,8 +314,9 @@ static char *acpi_ut_format_number(char *string, if (need_prefix) { string = acpi_ut_bound_string_output(string, end, '0'); if (base == 16) { - string = acpi_ut_bound_string_output(string, end, - upper ? 'X' : 'x'); + string = + acpi_ut_bound_string_output(string, end, + upper ? 'X' : 'x'); } } if (!(type & ACPI_FORMAT_LEFT)) { @@ -400,6 +401,7 @@ acpi_ut_vsnprintf(char *string, } else { break; } + } while (1); /* Process width */ @@ -429,6 +431,7 @@ acpi_ut_vsnprintf(char *string, ++format; precision = va_arg(args, int); } + if (precision < 0) { precision = 0; } @@ -488,10 +491,12 @@ acpi_ut_vsnprintf(char *string, ' '); } } + for (i = 0; i < length; ++i) { pos = acpi_ut_bound_string_output(pos, end, *s); ++s; } + while (length < width--) { pos = acpi_ut_bound_string_output(pos, end, ' '); @@ -529,9 +534,9 @@ acpi_ut_vsnprintf(char *string, } p = va_arg(args, void *); - pos = acpi_ut_format_number(pos, end, - ACPI_TO_INTEGER(p), 16, - width, precision, type); + pos = + acpi_ut_format_number(pos, end, ACPI_TO_INTEGER(p), + 16, width, precision, type); continue; default: diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index b3505dbc7..1de3376da 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -441,8 +441,8 @@ acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state, acpi_ut_validate_resource(walk_state, aml, &resource_index); if (ACPI_FAILURE(status)) { /* - * Exit on failure. Cannot continue because the descriptor length - * may be bogus also. + * Exit on failure. Cannot continue because the descriptor + * length may be bogus also. */ return_ACPI_STATUS(status); } @@ -568,8 +568,8 @@ acpi_ut_validate_resource(struct acpi_walk_state *walk_state, } /* - * Check validity of the resource type, via acpi_gbl_resource_types. Zero - * indicates an invalid resource. + * Check validity of the resource type, via acpi_gbl_resource_types. + * Zero indicates an invalid resource. */ if (!acpi_gbl_resource_types[resource_index]) { goto invalid_resource; diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index f201171c5..f3d4dbd5f 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -246,6 +246,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, state->pkg.dest_object = external_object; state->pkg.index = index; state->pkg.num_packages = 1; + return (state); } @@ -279,6 +280,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void) state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL; state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; + return (state); } @@ -304,5 +306,6 @@ void acpi_ut_delete_generic_state(union acpi_generic_state *state) if (state) { (void)acpi_os_release_object(acpi_gbl_state_cache, state); } + return; } diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c index 4ddd105d9..0b005728d 100644 --- a/drivers/acpi/acpica/utstring.c +++ b/drivers/acpi/acpica/utstring.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,6 +135,7 @@ void acpi_ut_print_string(char *string, u16 max_length) break; } } + acpi_os_printf("\""); if (i == max_length && string[i]) { @@ -239,6 +240,14 @@ void acpi_ut_repair_name(char *name) ACPI_FUNCTION_NAME(ut_repair_name); + /* + * Special case for the root node. This can happen if we get an + * error during the execution of module-level code. + */ + if (ACPI_COMPARE_NAME(name, "\\___")) { + return; + } + ACPI_MOVE_NAME(&original_name, name); /* Check each character in the name */ diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c index 9a7dc8196..c7c2bb8f3 100644 --- a/drivers/acpi/acpica/uttrack.c +++ b/drivers/acpi/acpica/uttrack.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -150,9 +150,9 @@ void *acpi_ut_allocate_and_track(acpi_size size, return (NULL); } - status = acpi_ut_track_allocation(allocation, size, - ACPI_MEM_MALLOC, component, module, - line); + status = + acpi_ut_track_allocation(allocation, size, ACPI_MEM_MALLOC, + component, module, line); if (ACPI_FAILURE(status)) { acpi_os_free(allocation); return (NULL); @@ -161,6 +161,7 @@ void *acpi_ut_allocate_and_track(acpi_size size, acpi_gbl_global_list->total_allocated++; acpi_gbl_global_list->total_size += (u32)size; acpi_gbl_global_list->current_total_size += (u32)size; + if (acpi_gbl_global_list->current_total_size > acpi_gbl_global_list->max_occupied) { acpi_gbl_global_list->max_occupied = @@ -223,6 +224,7 @@ void *acpi_ut_allocate_zeroed_and_track(acpi_size size, acpi_gbl_global_list->total_allocated++; acpi_gbl_global_list->total_size += (u32)size; acpi_gbl_global_list->current_total_size += (u32)size; + if (acpi_gbl_global_list->current_total_size > acpi_gbl_global_list->max_occupied) { acpi_gbl_global_list->max_occupied = @@ -269,8 +271,8 @@ acpi_ut_free_and_track(void *allocation, acpi_gbl_global_list->total_freed++; acpi_gbl_global_list->current_total_size -= debug_block->size; - status = acpi_ut_remove_allocation(debug_block, - component, module, line); + status = + acpi_ut_remove_allocation(debug_block, component, module, line); if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "Could not free memory")); } @@ -525,35 +527,35 @@ void acpi_ut_dump_allocation_info(void) /* ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current allocations", - mem_list->current_count, - ROUND_UP_TO_1K (mem_list->current_size))); + ("%30s: %4d (%3d Kb)\n", "Current allocations", + mem_list->current_count, + ROUND_UP_TO_1K (mem_list->current_size))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", - mem_list->max_concurrent_count, - ROUND_UP_TO_1K (mem_list->max_concurrent_size))); + ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", + mem_list->max_concurrent_count, + ROUND_UP_TO_1K (mem_list->max_concurrent_size))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", - running_object_count, - ROUND_UP_TO_1K (running_object_size))); + ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", + running_object_count, + ROUND_UP_TO_1K (running_object_size))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", - running_alloc_count, - ROUND_UP_TO_1K (running_alloc_size))); + ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", + running_alloc_count, + ROUND_UP_TO_1K (running_alloc_size))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Nodes", - acpi_gbl_current_node_count, - ROUND_UP_TO_1K (acpi_gbl_current_node_size))); + ("%30s: %4d (%3d Kb)\n", "Current Nodes", + acpi_gbl_current_node_count, + ROUND_UP_TO_1K (acpi_gbl_current_node_size))); ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max Nodes", - acpi_gbl_max_concurrent_node_count, - ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * - sizeof (struct acpi_namespace_node))))); + ("%30s: %4d (%3d Kb)\n", "Max Nodes", + acpi_gbl_max_concurrent_node_count, + ROUND_UP_TO_1K ((acpi_gbl_max_concurrent_node_count * + sizeof (struct acpi_namespace_node))))); */ return_VOID; } diff --git a/drivers/acpi/acpica/utuuid.c b/drivers/acpi/acpica/utuuid.c index e6cab669b..81088ff9d 100644 --- a/drivers/acpi/acpica/utuuid.c +++ b/drivers/acpi/acpica/utuuid.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index f9c8f9ce1..68d4673f6 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -154,7 +154,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) * Populate the return buffer */ info_ptr = (struct acpi_system_info *)out_buffer->pointer; - info_ptr->acpi_ca_version = ACPI_CA_VERSION; /* System flags (ACPI capabilities) */ @@ -216,7 +215,6 @@ acpi_status acpi_get_statistics(struct acpi_statistics *stats) /* Other counters */ stats->method_count = acpi_method_count; - return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index 98d578753..6fe59597b 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -117,6 +117,7 @@ acpi_exception(const char *module_name, acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", acpi_format_exception(status)); } + va_start(arg_list, format); acpi_os_vprintf(format, arg_list); ACPI_MSG_SUFFIX; diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index a7137ec28..721b87cce 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -147,6 +147,28 @@ acpi_status __init acpi_enable_subsystem(u32 flags) ACPI_FUNCTION_TRACE(acpi_enable_subsystem); + /* + * The early initialization phase is complete. The namespace is loaded, + * and we can now support address spaces other than Memory, I/O, and + * PCI_Config. + */ + acpi_gbl_early_initialization = FALSE; + + /* + * Install the default operation region handlers. These are the + * handlers that are defined by the ACPI specification to be + * "always accessible" -- namely, system_memory, system_IO, and + * PCI_Config. This also means that no _REG methods need to be + * run for these address spaces. We need to have these handlers + * installed before any AML code can be executed, especially any + * module-level code (11/2015). + */ + status = acpi_ev_install_region_handlers(); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "During Region initialization")); + return_ACPI_STATUS(status); + } #if (!ACPI_REDUCED_HARDWARE) /* Enable ACPI mode */ @@ -175,23 +197,7 @@ acpi_status __init acpi_enable_subsystem(u32 flags) return_ACPI_STATUS(status); } } -#endif /* !ACPI_REDUCED_HARDWARE */ - - /* - * Install the default op_region handlers. These are installed unless - * other handlers have already been installed via the - * install_address_space_handler interface. - */ - if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { - ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "[Init] Installing default address space handlers\n")); - status = acpi_ev_install_region_handlers(); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - } -#if (!ACPI_REDUCED_HARDWARE) /* * Initialize ACPI Event handling (Fixed and General Purpose) * @@ -261,6 +267,7 @@ acpi_status __init acpi_initialize_objects(u32 flags) * initialized, even if they contain executable AML (see the call to * acpi_ns_initialize_objects below). */ + acpi_gbl_reg_methods_enabled = TRUE; if (!(flags & ACPI_NO_ADDRESS_SPACE_INIT)) { ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "[Init] Executing _REG OpRegion methods\n")); @@ -285,8 +292,14 @@ acpi_status __init acpi_initialize_objects(u32 flags) * outside of any control method is wrapped with a temporary control * method object and placed on a global list. The methods on this list * are executed below. + * + * This case executes the module-level code for all tables only after + * all of the tables have been loaded. It is a legacy option and is + * not compatible with other ACPI implementations. See acpi_ns_load_table. */ - acpi_ns_exec_module_code_list(); + if (acpi_gbl_group_module_level_code) { + acpi_ns_exec_module_code_list(); + } /* * Initialize the objects that remain uninitialized. This runs the diff --git a/drivers/acpi/acpica/utxfmutex.c b/drivers/acpi/acpica/utxfmutex.c index f2606af33..850de0155 100644 --- a/drivers/acpi/acpica/utxfmutex.c +++ b/drivers/acpi/acpica/utxfmutex.c @@ -5,7 +5,7 @@ ******************************************************************************/ /* - * Copyright (C) 2000 - 2015, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -89,9 +89,9 @@ acpi_ut_get_mutex_object(acpi_handle handle, mutex_node = handle; if (pathname != NULL) { - status = acpi_get_handle(handle, pathname, - ACPI_CAST_PTR(acpi_handle, - &mutex_node)); + status = + acpi_get_handle(handle, pathname, + ACPI_CAST_PTR(acpi_handle, &mutex_node)); if (ACPI_FAILURE(status)) { return (status); } diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 6682c5daf..6e6bc1059 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -32,6 +32,7 @@ #include <linux/hardirq.h> #include <linux/pstore.h> #include <linux/vmalloc.h> +#include <linux/mm.h> /* kvfree() */ #include <acpi/apei.h> #include "apei-internal.h" @@ -532,10 +533,7 @@ retry: return -ENOMEM; memcpy(new_entries, entries, erst_record_id_cache.len * sizeof(entries[0])); - if (erst_record_id_cache.size < PAGE_SIZE) - kfree(entries); - else - vfree(entries); + kvfree(entries); erst_record_id_cache.entries = entries = new_entries; erst_record_id_cache.size = new_size; } diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index c727e3972..96809cd99 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c @@ -313,37 +313,6 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { }, /* - * The following Lenovo models have a broken workaround in the - * acpi_video backlight implementation to meet the Windows 8 - * requirement of 101 backlight levels. Reverting to pre-Win8 - * behavoir fixes the problem. - */ - { - .callback = dmi_disable_osi_win8, - .ident = "Lenovo ThinkPad T430", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430"), - }, - }, - { - .callback = dmi_disable_osi_win8, - .ident = "Lenovo ThinkPad T430s", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T430s"), - }, - }, - { - .callback = dmi_disable_osi_win8, - .ident = "Lenovo ThinkPad X230", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X230"), - }, - }, - - /* * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. * Linux ignores it, except for the machines enumerated below. */ diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a212cefae..891c42d1c 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -180,14 +180,15 @@ static void acpi_print_osc_error(acpi_handle handle, int i; if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer))) - printk(KERN_DEBUG "%s\n", error); + printk(KERN_DEBUG "%s: %s\n", context->uuid_str, error); else { - printk(KERN_DEBUG "%s:%s\n", (char *)buffer.pointer, error); + printk(KERN_DEBUG "%s (%s): %s\n", + (char *)buffer.pointer, context->uuid_str, error); kfree(buffer.pointer); } - printk(KERN_DEBUG"_OSC request data:"); + printk(KERN_DEBUG "_OSC request data:"); for (i = 0; i < context->cap.length; i += sizeof(u32)) - printk("%x ", *((u32 *)(context->cap.pointer + i))); + printk(" %x", *((u32 *)(context->cap.pointer + i))); printk("\n"); } @@ -1094,6 +1095,7 @@ static int __init acpi_init(void) acpi_debugfs_init(); acpi_sleep_proc_init(); acpi_wakeup_device_init(); + acpi_debugger_init(); return 0; } diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 08a02cdc7..cd2c3d6d4 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -22,6 +22,7 @@ #include <linux/export.h> #include <linux/mutex.h> #include <linux/pm_qos.h> +#include <linux/pm_domain.h> #include <linux/pm_runtime.h> #include "internal.h" @@ -1059,7 +1060,7 @@ static void acpi_dev_pm_detach(struct device *dev, bool power_off) struct acpi_device *adev = ACPI_COMPANION(dev); if (adev && dev->pm_domain == &acpi_general_pm_domain) { - dev->pm_domain = NULL; + dev_pm_domain_set(dev, NULL); acpi_remove_pm_notifier(adev); if (power_off) { /* @@ -1111,7 +1112,7 @@ int acpi_dev_pm_attach(struct device *dev, bool power_on) return -EBUSY; acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func); - dev->pm_domain = &acpi_general_pm_domain; + dev_pm_domain_set(dev, &acpi_general_pm_domain); if (power_on) { acpi_dev_pm_full_power(adev); acpi_device_wakeup(adev, ACPI_STATE_S0, false); diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index e297a480e..6322db64b 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c @@ -339,7 +339,7 @@ static int acpi_fan_probe(struct platform_device *pdev) } else { result = acpi_device_update_power(device, NULL); if (result) { - dev_err(&device->dev, "Setting initial power state\n"); + dev_err(&device->dev, "Failed to set initial power state\n"); goto end; } } diff --git a/drivers/acpi/gsi.c b/drivers/acpi/gsi.c index fa4585a69..ee9e0f27b 100644 --- a/drivers/acpi/gsi.c +++ b/drivers/acpi/gsi.c @@ -17,25 +17,6 @@ enum acpi_irq_model_id acpi_irq_model; static struct fwnode_handle *acpi_gsi_domain_id; -static unsigned int acpi_gsi_get_irq_type(int trigger, int polarity) -{ - switch (polarity) { - case ACPI_ACTIVE_LOW: - return trigger == ACPI_EDGE_SENSITIVE ? - IRQ_TYPE_EDGE_FALLING : - IRQ_TYPE_LEVEL_LOW; - case ACPI_ACTIVE_HIGH: - return trigger == ACPI_EDGE_SENSITIVE ? - IRQ_TYPE_EDGE_RISING : - IRQ_TYPE_LEVEL_HIGH; - case ACPI_ACTIVE_BOTH: - if (trigger == ACPI_EDGE_SENSITIVE) - return IRQ_TYPE_EDGE_BOTH; - default: - return IRQ_TYPE_NONE; - } -} - /** * acpi_gsi_to_irq() - Retrieve the linux irq number for a given GSI * @gsi: GSI IRQ number to map @@ -82,7 +63,7 @@ int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, fwspec.fwnode = acpi_gsi_domain_id; fwspec.param[0] = gsi; - fwspec.param[1] = acpi_gsi_get_irq_type(trigger, polarity); + fwspec.param[1] = acpi_dev_get_irq_type(trigger, polarity); fwspec.param_count = 2; return irq_create_fwspec_mapping(&fwspec); diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index 11d87bf67..1e6833a5c 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h @@ -86,6 +86,14 @@ bool acpi_scan_is_offline(struct acpi_device *adev, bool uevent); #define ACPI_STA_DEFAULT (ACPI_STA_DEVICE_PRESENT | ACPI_STA_DEVICE_ENABLED | \ ACPI_STA_DEVICE_UI | ACPI_STA_DEVICE_FUNCTIONING) +extern struct list_head acpi_bus_id_list; + +struct acpi_device_bus_id { + char bus_id[15]; + unsigned int instance_no; + struct list_head node; +}; + int acpi_device_add(struct acpi_device *device, void (*release)(struct device *)); void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 11d8209e6..35947ac87 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -15,6 +15,7 @@ #include <linux/module.h> #include <linux/mutex.h> #include <linux/ndctl.h> +#include <linux/delay.h> #include <linux/list.h> #include <linux/acpi.h> #include <linux/sort.h> @@ -1472,6 +1473,209 @@ static void acpi_nfit_blk_region_disable(struct nvdimm_bus *nvdimm_bus, /* devm will free nfit_blk */ } +static int ars_get_cap(struct nvdimm_bus_descriptor *nd_desc, + struct nd_cmd_ars_cap *cmd, u64 addr, u64 length) +{ + cmd->address = addr; + cmd->length = length; + + return nd_desc->ndctl(nd_desc, NULL, ND_CMD_ARS_CAP, cmd, + sizeof(*cmd)); +} + +static int ars_do_start(struct nvdimm_bus_descriptor *nd_desc, + struct nd_cmd_ars_start *cmd, u64 addr, u64 length) +{ + int rc; + + cmd->address = addr; + cmd->length = length; + cmd->type = ND_ARS_PERSISTENT; + + while (1) { + rc = nd_desc->ndctl(nd_desc, NULL, ND_CMD_ARS_START, cmd, + sizeof(*cmd)); + if (rc) + return rc; + switch (cmd->status) { + case 0: + return 0; + case 1: + /* ARS unsupported, but we should never get here */ + return 0; + case 6: + /* ARS is in progress */ + msleep(1000); + break; + default: + return -ENXIO; + } + } +} + +static int ars_get_status(struct nvdimm_bus_descriptor *nd_desc, + struct nd_cmd_ars_status *cmd, u32 size) +{ + int rc; + + while (1) { + rc = nd_desc->ndctl(nd_desc, NULL, ND_CMD_ARS_STATUS, cmd, + size); + if (rc || cmd->status & 0xffff) + return -ENXIO; + + /* Check extended status (Upper two bytes) */ + switch (cmd->status >> 16) { + case 0: + return 0; + case 1: + /* ARS is in progress */ + msleep(1000); + break; + case 2: + /* No ARS performed for the current boot */ + return 0; + case 3: + /* TODO: error list overflow support */ + default: + return -ENXIO; + } + } +} + +static int ars_status_process_records(struct nvdimm_bus *nvdimm_bus, + struct nd_cmd_ars_status *ars_status, u64 start) +{ + int rc; + u32 i; + + /* + * The address field returned by ars_status should be either + * less than or equal to the address we last started ARS for. + * The (start, length) returned by ars_status should also have + * non-zero overlap with the range we started ARS for. + * If this is not the case, bail. + */ + if (ars_status->address > start || + (ars_status->address + ars_status->length < start)) + return -ENXIO; + + for (i = 0; i < ars_status->num_records; i++) { + rc = nvdimm_bus_add_poison(nvdimm_bus, + ars_status->records[i].err_address, + ars_status->records[i].length); + if (rc) + return rc; + } + + return 0; +} + +static int acpi_nfit_find_poison(struct acpi_nfit_desc *acpi_desc, + struct nd_region_desc *ndr_desc) +{ + struct nvdimm_bus_descriptor *nd_desc = &acpi_desc->nd_desc; + struct nvdimm_bus *nvdimm_bus = acpi_desc->nvdimm_bus; + struct nd_cmd_ars_status *ars_status = NULL; + struct nd_cmd_ars_start *ars_start = NULL; + struct nd_cmd_ars_cap *ars_cap = NULL; + u64 start, len, cur, remaining; + u32 ars_status_size; + int rc; + + ars_cap = kzalloc(sizeof(*ars_cap), GFP_KERNEL); + if (!ars_cap) + return -ENOMEM; + + start = ndr_desc->res->start; + len = ndr_desc->res->end - ndr_desc->res->start + 1; + + /* + * If ARS is unimplemented, unsupported, or if the 'Persistent Memory + * Scrub' flag in extended status is not set, skip this but continue + * initialization + */ + rc = ars_get_cap(nd_desc, ars_cap, start, len); + if (rc == -ENOTTY) { + dev_dbg(acpi_desc->dev, + "Address Range Scrub is not implemented, won't create an error list\n"); + rc = 0; + goto out; + } + if (rc) + goto out; + + if ((ars_cap->status & 0xffff) || + !(ars_cap->status >> 16 & ND_ARS_PERSISTENT)) { + dev_warn(acpi_desc->dev, + "ARS unsupported (status: 0x%x), won't create an error list\n", + ars_cap->status); + goto out; + } + + /* + * Check if a full-range ARS has been run. If so, use those results + * without having to start a new ARS. + */ + ars_status_size = ars_cap->max_ars_out; + ars_status = kzalloc(ars_status_size, GFP_KERNEL); + if (!ars_status) { + rc = -ENOMEM; + goto out; + } + + rc = ars_get_status(nd_desc, ars_status, ars_status_size); + if (rc) + goto out; + + if (ars_status->address <= start && + (ars_status->address + ars_status->length >= start + len)) { + rc = ars_status_process_records(nvdimm_bus, ars_status, start); + goto out; + } + + /* + * ARS_STATUS can overflow if the number of poison entries found is + * greater than the maximum buffer size (ars_cap->max_ars_out) + * To detect overflow, check if the length field of ars_status + * is less than the length we supplied. If so, process the + * error entries we got, adjust the start point, and start again + */ + ars_start = kzalloc(sizeof(*ars_start), GFP_KERNEL); + if (!ars_start) + return -ENOMEM; + + cur = start; + remaining = len; + do { + u64 done, end; + + rc = ars_do_start(nd_desc, ars_start, cur, remaining); + if (rc) + goto out; + + rc = ars_get_status(nd_desc, ars_status, ars_status_size); + if (rc) + goto out; + + rc = ars_status_process_records(nvdimm_bus, ars_status, cur); + if (rc) + goto out; + + end = min(cur + remaining, + ars_status->address + ars_status->length); + done = end - cur; + cur += done; + remaining -= done; + } while (remaining); + + out: + kfree(ars_cap); + kfree(ars_start); + kfree(ars_status); + return rc; +} + static int acpi_nfit_init_mapping(struct acpi_nfit_desc *acpi_desc, struct nd_mapping *nd_mapping, struct nd_region_desc *ndr_desc, struct acpi_nfit_memory_map *memdev, @@ -1584,6 +1788,13 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, nvdimm_bus = acpi_desc->nvdimm_bus; if (nfit_spa_type(spa) == NFIT_SPA_PM) { + rc = acpi_nfit_find_poison(acpi_desc, ndr_desc); + if (rc) { + dev_err(acpi_desc->dev, + "error while performing ARS to find poison: %d\n", + rc); + return rc; + } if (!nvdimm_pmem_region_create(nvdimm_bus, ndr_desc)) return -ENOMEM; } else if (nfit_spa_type(spa) == NFIT_SPA_VOLATILE) { diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 32d684af0..67da6fb72 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -220,6 +220,7 @@ void acpi_os_printf(const char *fmt, ...) acpi_os_vprintf(fmt, args); va_end(args); } +EXPORT_SYMBOL(acpi_os_printf); void acpi_os_vprintf(const char *fmt, va_list args) { @@ -234,7 +235,8 @@ void acpi_os_vprintf(const char *fmt, va_list args) printk(KERN_CONT "%s", buffer); } #else - printk(KERN_CONT "%s", buffer); + if (acpi_debugger_write_log(buffer) < 0) + printk(KERN_CONT "%s", buffer); #endif } @@ -364,6 +366,19 @@ static void acpi_unmap(acpi_physical_address pg_off, void __iomem *vaddr) iounmap(vaddr); } +/** + * acpi_os_map_iomem - Get a virtual address for a given physical address range. + * @phys: Start of the physical address range to map. + * @size: Size of the physical address range to map. + * + * Look up the given physical address range in the list of existing ACPI memory + * mappings. If found, get a reference to it and return a pointer to it (its + * virtual address). If not found, map it, add it to that list and return a + * pointer to it. + * + * During early init (when acpi_gbl_permanent_mmap has not been set yet) this + * routine simply calls __acpi_map_table() to get the job done. + */ void __iomem *__init_refok acpi_os_map_iomem(acpi_physical_address phys, acpi_size size) { @@ -439,6 +454,20 @@ static void acpi_os_map_cleanup(struct acpi_ioremap *map) } } +/** + * acpi_os_unmap_iomem - Drop a memory mapping reference. + * @virt: Start of the address range to drop a reference to. + * @size: Size of the address range to drop a reference to. + * + * Look up the given virtual address range in the list of existing ACPI memory + * mappings, drop a reference to it and unmap it if there are no more active + * references to it. + * + * During early init (when acpi_gbl_permanent_mmap has not been set yet) this + * routine simply calls __acpi_unmap_table() to get the job done. Since + * __acpi_unmap_table() is an __init function, the __ref annotation is needed + * here. + */ void __ref acpi_os_unmap_iomem(void __iomem *virt, acpi_size size) { struct acpi_ioremap *map; @@ -1101,6 +1130,200 @@ static void acpi_os_execute_deferred(struct work_struct *work) kfree(dpc); } +#ifdef CONFIG_ACPI_DEBUGGER +static struct acpi_debugger acpi_debugger; +static bool acpi_debugger_initialized; + +int acpi_register_debugger(struct module *owner, + const struct acpi_debugger_ops *ops) +{ + int ret = 0; + + mutex_lock(&acpi_debugger.lock); + if (acpi_debugger.ops) { + ret = -EBUSY; + goto err_lock; + } + + acpi_debugger.owner = owner; + acpi_debugger.ops = ops; + +err_lock: + mutex_unlock(&acpi_debugger.lock); + return ret; +} +EXPORT_SYMBOL(acpi_register_debugger); + +void acpi_unregister_debugger(const struct acpi_debugger_ops *ops) +{ + mutex_lock(&acpi_debugger.lock); + if (ops == acpi_debugger.ops) { + acpi_debugger.ops = NULL; + acpi_debugger.owner = NULL; + } + mutex_unlock(&acpi_debugger.lock); +} +EXPORT_SYMBOL(acpi_unregister_debugger); + +int acpi_debugger_create_thread(acpi_osd_exec_callback function, void *context) +{ + int ret; + int (*func)(acpi_osd_exec_callback, void *); + struct module *owner; + + if (!acpi_debugger_initialized) + return -ENODEV; + mutex_lock(&acpi_debugger.lock); + if (!acpi_debugger.ops) { + ret = -ENODEV; + goto err_lock; + } + if (!try_module_get(acpi_debugger.owner)) { + ret = -ENODEV; + goto err_lock; + } + func = acpi_debugger.ops->create_thread; + owner = acpi_debugger.owner; + mutex_unlock(&acpi_debugger.lock); + + ret = func(function, context); + + mutex_lock(&acpi_debugger.lock); + module_put(owner); +err_lock: + mutex_unlock(&acpi_debugger.lock); + return ret; +} + +ssize_t acpi_debugger_write_log(const char *msg) +{ + ssize_t ret; + ssize_t (*func)(const char *); + struct module *owner; + + if (!acpi_debugger_initialized) + return -ENODEV; + mutex_lock(&acpi_debugger.lock); + if (!acpi_debugger.ops) { + ret = -ENODEV; + goto err_lock; + } + if (!try_module_get(acpi_debugger.owner)) { + ret = -ENODEV; + goto err_lock; + } + func = acpi_debugger.ops->write_log; + owner = acpi_debugger.owner; + mutex_unlock(&acpi_debugger.lock); + + ret = func(msg); + + mutex_lock(&acpi_debugger.lock); + module_put(owner); +err_lock: + mutex_unlock(&acpi_debugger.lock); + return ret; +} + +ssize_t acpi_debugger_read_cmd(char *buffer, size_t buffer_length) +{ + ssize_t ret; + ssize_t (*func)(char *, size_t); + struct module *owner; + + if (!acpi_debugger_initialized) + return -ENODEV; + mutex_lock(&acpi_debugger.lock); + if (!acpi_debugger.ops) { + ret = -ENODEV; + goto err_lock; + } + if (!try_module_get(acpi_debugger.owner)) { + ret = -ENODEV; + goto err_lock; + } + func = acpi_debugger.ops->read_cmd; + owner = acpi_debugger.owner; + mutex_unlock(&acpi_debugger.lock); + + ret = func(buffer, buffer_length); + + mutex_lock(&acpi_debugger.lock); + module_put(owner); +err_lock: + mutex_unlock(&acpi_debugger.lock); + return ret; +} + +int acpi_debugger_wait_command_ready(void) +{ + int ret; + int (*func)(bool, char *, size_t); + struct module *owner; + + if (!acpi_debugger_initialized) + return -ENODEV; + mutex_lock(&acpi_debugger.lock); + if (!acpi_debugger.ops) { + ret = -ENODEV; + goto err_lock; + } + if (!try_module_get(acpi_debugger.owner)) { + ret = -ENODEV; + goto err_lock; + } + func = acpi_debugger.ops->wait_command_ready; + owner = acpi_debugger.owner; + mutex_unlock(&acpi_debugger.lock); + + ret = func(acpi_gbl_method_executing, + acpi_gbl_db_line_buf, ACPI_DB_LINE_BUFFER_SIZE); + + mutex_lock(&acpi_debugger.lock); + module_put(owner); +err_lock: + mutex_unlock(&acpi_debugger.lock); + return ret; +} + +int acpi_debugger_notify_command_complete(void) +{ + int ret; + int (*func)(void); + struct module *owner; + + if (!acpi_debugger_initialized) + return -ENODEV; + mutex_lock(&acpi_debugger.lock); + if (!acpi_debugger.ops) { + ret = -ENODEV; + goto err_lock; + } + if (!try_module_get(acpi_debugger.owner)) { + ret = -ENODEV; + goto err_lock; + } + func = acpi_debugger.ops->notify_command_complete; + owner = acpi_debugger.owner; + mutex_unlock(&acpi_debugger.lock); + + ret = func(); + + mutex_lock(&acpi_debugger.lock); + module_put(owner); +err_lock: + mutex_unlock(&acpi_debugger.lock); + return ret; +} + +int __init acpi_debugger_init(void) +{ + mutex_init(&acpi_debugger.lock); + acpi_debugger_initialized = true; + return 0; +} +#endif + /******************************************************************************* * * FUNCTION: acpi_os_execute @@ -1127,6 +1350,15 @@ acpi_status acpi_os_execute(acpi_execute_type type, "Scheduling function [%p(%p)] for deferred execution.\n", function, context)); + if (type == OSL_DEBUGGER_MAIN_THREAD) { + ret = acpi_debugger_create_thread(function, context); + if (ret) { + pr_err("Call to kthread_create() failed.\n"); + status = AE_ERROR; + } + goto out_thread; + } + /* * Allocate/initialize DPC structure. Note that this memory will be * freed by the callee. The kernel handles the work_struct list in a @@ -1151,11 +1383,17 @@ acpi_status acpi_os_execute(acpi_execute_type type, if (type == OSL_NOTIFY_HANDLER) { queue = kacpi_notify_wq; INIT_WORK(&dpc->work, acpi_os_execute_deferred); - } else { + } else if (type == OSL_GPE_HANDLER) { queue = kacpid_wq; INIT_WORK(&dpc->work, acpi_os_execute_deferred); + } else { + pr_err("Unsupported os_execute type %d.\n", type); + status = AE_ERROR; } + if (ACPI_FAILURE(status)) + goto err_workqueue; + /* * On some machines, a software-initiated SMI causes corruption unless * the SMI runs on CPU 0. An SMI can be initiated by any AML, but @@ -1164,13 +1402,15 @@ acpi_status acpi_os_execute(acpi_execute_type type, * queueing on CPU 0. */ ret = queue_work_on(0, queue, &dpc->work); - if (!ret) { printk(KERN_ERR PREFIX "Call to queue_work() failed.\n"); status = AE_ERROR; - kfree(dpc); } +err_workqueue: + if (ACPI_FAILURE(status)) + kfree(dpc); +out_thread: return status; } EXPORT_SYMBOL(acpi_os_execute); @@ -1358,10 +1598,39 @@ acpi_status acpi_os_get_line(char *buffer, u32 buffer_length, u32 *bytes_read) chars = strlen(buffer) - 1; buffer[chars] = '\0'; } +#else + int ret; + + ret = acpi_debugger_read_cmd(buffer, buffer_length); + if (ret < 0) + return AE_ERROR; + if (bytes_read) + *bytes_read = ret; #endif return AE_OK; } +EXPORT_SYMBOL(acpi_os_get_line); + +acpi_status acpi_os_wait_command_ready(void) +{ + int ret; + + ret = acpi_debugger_wait_command_ready(); + if (ret < 0) + return AE_ERROR; + return AE_OK; +} + +acpi_status acpi_os_notify_command_complete(void) +{ + int ret; + + ret = acpi_debugger_notify_command_complete(); + if (ret < 0) + return AE_ERROR; + return AE_OK; +} acpi_status acpi_os_signal(u32 function, void *info) { diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index c9336751e..c8e169e46 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -131,9 +131,6 @@ static void do_prt_fixups(struct acpi_prt_entry *entry, quirk = &prt_quirks[i]; /* All current quirks involve link devices, not GSIs */ - if (!prt->source) - continue; - if (dmi_check_system(quirk->system) && entry->id.segment == quirk->segment && entry->id.bus == quirk->bus && @@ -409,7 +406,7 @@ int acpi_pci_irq_enable(struct pci_dev *dev) return 0; } - if (pci_has_managed_irq(dev)) + if (dev->irq_managed && dev->irq > 0) return 0; entry = acpi_pci_irq_lookup(dev, pin); @@ -454,7 +451,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) kfree(entry); return rc; } - pci_set_managed_irq(dev, rc); + dev->irq = rc; + dev->irq_managed = 1; if (link) snprintf(link_desc, sizeof(link_desc), " -> Link[%s]", link); @@ -477,8 +475,16 @@ void acpi_pci_irq_disable(struct pci_dev *dev) u8 pin; pin = dev->pin; - if (!pin || !pci_has_managed_irq(dev)) + if (!pin || !dev->irq_managed || dev->irq <= 0) + return; + + /* Keep IOAPIC pin configuration when suspending */ + if (dev->dev.power.is_prepared) return; +#ifdef CONFIG_PM + if (dev->dev.power.runtime_status == RPM_SUSPENDING) + return; +#endif entry = acpi_pci_irq_lookup(dev, pin); if (!entry) @@ -499,6 +505,6 @@ void acpi_pci_irq_disable(struct pci_dev *dev) dev_dbg(&dev->dev, "PCI INT %c disabled\n", pin_name(pin)); if (gsi >= 0) { acpi_unregister_gsi(gsi); - pci_reset_managed_irq(dev); + dev->irq_managed = 0; } } diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 7c8408b94..ededa909d 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c @@ -67,12 +67,12 @@ static struct acpi_scan_handler pci_link_handler = { * later even the link is disable. Instead, we just repick the active irq */ struct acpi_pci_link_irq { - u8 active; /* Current IRQ */ + u32 active; /* Current IRQ */ u8 triggering; /* All IRQs */ u8 polarity; /* All IRQs */ u8 resource_type; u8 possible_count; - u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; + u32 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; u8 initialized:1; u8 reserved:7; }; diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 88f430674..2aee41655 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -346,7 +346,7 @@ void acpi_free_properties(struct acpi_device *adev) * * Return: %0 if property with @name has been found (success), * %-EINVAL if the arguments are invalid, - * %-ENODATA if the property doesn't exist, + * %-EINVAL if the property doesn't exist, * %-EPROTO if the property value type doesn't match @type. */ static int acpi_data_get_property(struct acpi_device_data *data, @@ -360,7 +360,7 @@ static int acpi_data_get_property(struct acpi_device_data *data, return -EINVAL; if (!data->pointer || !data->properties) - return -ENODATA; + return -EINVAL; properties = data->properties; for (i = 0; i < properties->package.count; i++) { @@ -375,13 +375,13 @@ static int acpi_data_get_property(struct acpi_device_data *data, if (!strcmp(name, propname->string.pointer)) { if (type != ACPI_TYPE_ANY && propvalue->type != type) return -EPROTO; - else if (obj) + if (obj) *obj = propvalue; return 0; } } - return -ENODATA; + return -EINVAL; } /** @@ -439,7 +439,7 @@ int acpi_node_prop_get(struct fwnode_handle *fwnode, const char *propname, * * Return: %0 if array property (package) with @name has been found (success), * %-EINVAL if the arguments are invalid, - * %-ENODATA if the property doesn't exist, + * %-EINVAL if the property doesn't exist, * %-EPROTO if the property is not a package or the type of its elements * doesn't match @type. */ diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c index cdc5c2599..d02fd5304 100644 --- a/drivers/acpi/resource.c +++ b/drivers/acpi/resource.c @@ -23,6 +23,7 @@ #include <linux/export.h> #include <linux/ioport.h> #include <linux/slab.h> +#include <linux/irq.h> #ifdef CONFIG_X86 #define valid_IRQ(i) (((i) != 0) && ((i) != 2)) @@ -336,6 +337,31 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable) } EXPORT_SYMBOL_GPL(acpi_dev_irq_flags); +/** + * acpi_dev_get_irq_type - Determine irq type. + * @triggering: Triggering type as provided by ACPI. + * @polarity: Interrupt polarity as provided by ACPI. + */ +unsigned int acpi_dev_get_irq_type(int triggering, int polarity) +{ + switch (polarity) { + case ACPI_ACTIVE_LOW: + return triggering == ACPI_EDGE_SENSITIVE ? + IRQ_TYPE_EDGE_FALLING : + IRQ_TYPE_LEVEL_LOW; + case ACPI_ACTIVE_HIGH: + return triggering == ACPI_EDGE_SENSITIVE ? + IRQ_TYPE_EDGE_RISING : + IRQ_TYPE_LEVEL_HIGH; + case ACPI_ACTIVE_BOTH: + if (triggering == ACPI_EDGE_SENSITIVE) + return IRQ_TYPE_EDGE_BOTH; + default: + return IRQ_TYPE_NONE; + } +} +EXPORT_SYMBOL_GPL(acpi_dev_get_irq_type); + static void acpi_dev_irqresource_disabled(struct resource *res, u32 gsi) { res->start = gsi; diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index cb3dedb1b..ad0b13ad4 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c @@ -417,11 +417,11 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery) if ((value & 0xf000) != sel) { value &= 0x0fff; value |= sel; - ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, + ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_MANAGER, 0x01, (u8 *)&value, 2); - if (ret) - goto end; + if (ret) + goto end; } } ret = acpi_smbus_write(sbs->hc, SMBUS_WRITE_WORD, ACPI_SBS_BATTERY, diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 78d5f02a0..407a3760e 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -39,7 +39,7 @@ static const char *dummy_hid = "device"; static LIST_HEAD(acpi_dep_list); static DEFINE_MUTEX(acpi_dep_list_lock); -static LIST_HEAD(acpi_bus_id_list); +LIST_HEAD(acpi_bus_id_list); static DEFINE_MUTEX(acpi_scan_lock); static LIST_HEAD(acpi_scan_handlers_list); DEFINE_MUTEX(acpi_device_lock); @@ -52,12 +52,6 @@ struct acpi_dep_data { acpi_handle slave; }; -struct acpi_device_bus_id{ - char bus_id[15]; - unsigned int instance_no; - struct list_head node; -}; - void acpi_scan_lock_acquire(void) { mutex_lock(&acpi_scan_lock); @@ -471,10 +465,24 @@ static void acpi_device_release(struct device *dev) static void acpi_device_del(struct acpi_device *device) { + struct acpi_device_bus_id *acpi_device_bus_id; + mutex_lock(&acpi_device_lock); if (device->parent) list_del(&device->node); + list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) + if (!strcmp(acpi_device_bus_id->bus_id, + acpi_device_hid(device))) { + if (acpi_device_bus_id->instance_no > 0) + acpi_device_bus_id->instance_no--; + else { + list_del(&acpi_device_bus_id->node); + kfree(acpi_device_bus_id); + } + break; + } + list_del(&device->wakeup_list); mutex_unlock(&acpi_device_lock); @@ -1461,7 +1469,7 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, *type = ACPI_BUS_TYPE_DEVICE; status = acpi_bus_get_status_handle(handle, sta); if (ACPI_FAILURE(status)) - return -ENODEV; + *sta = 0; break; case ACPI_TYPE_PROCESSOR: *type = ACPI_BUS_TYPE_PROCESSOR; diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 0d94621dc..9cb975200 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -61,7 +61,7 @@ static int acpi_sleep_prepare(u32 acpi_state) if (acpi_state == ACPI_STATE_S3) { if (!acpi_wakeup_address) return -EFAULT; - acpi_set_firmware_waking_vector(acpi_wakeup_address); + acpi_set_waking_vector(acpi_wakeup_address); } ACPI_FLUSH_CPU_CACHE(); @@ -410,7 +410,7 @@ static void acpi_pm_finish(void) acpi_leave_sleep_state(acpi_state); /* reset firmware waking vector */ - acpi_set_firmware_waking_vector((acpi_physical_address) 0); + acpi_set_waking_vector(0); acpi_target_sleep_state = ACPI_STATE_S0; diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h index c797ffa56..a9cc34e66 100644 --- a/drivers/acpi/sleep.h +++ b/drivers/acpi/sleep.h @@ -6,3 +6,9 @@ extern struct list_head acpi_wakeup_device_list; extern struct mutex acpi_device_lock; extern void acpi_resume_power_resources(void); + +static inline acpi_status acpi_set_waking_vector(u32 wakeup_address) +{ + return acpi_set_firmware_waking_vector( + (acpi_physical_address)wakeup_address, 0); +} diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 475c9079b..f2f9873bb 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -29,6 +29,7 @@ #include <linux/dynamic_debug.h> #include "internal.h" +#include "sleep.h" #define _COMPONENT ACPI_BUS_COMPONENT ACPI_MODULE_NAME("utils"); @@ -709,6 +710,36 @@ bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs) } EXPORT_SYMBOL(acpi_check_dsm); +/** + * acpi_dev_present - Detect presence of a given ACPI device in the system. + * @hid: Hardware ID of the device. + * + * Return %true if the device was present at the moment of invocation. + * Note that if the device is pluggable, it may since have disappeared. + * + * For this function to work, acpi_bus_scan() must have been executed + * which happens in the subsys_initcall() subsection. Hence, do not + * call from a subsys_initcall() or earlier (use acpi_get_devices() + * instead). Calling from module_init() is fine (which is synonymous + * with device_initcall()). + */ +bool acpi_dev_present(const char *hid) +{ + struct acpi_device_bus_id *acpi_device_bus_id; + bool found = false; + + mutex_lock(&acpi_device_lock); + list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) + if (!strcmp(acpi_device_bus_id->bus_id, hid)) { + found = true; + break; + } + mutex_unlock(&acpi_device_lock); + + return found; +} +EXPORT_SYMBOL(acpi_dev_present); + /* * acpi_backlight= handling, this is done here rather then in video_detect.c * because __setup cannot be used in modules. diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c index 80e55cb08..1316ddd92 100644 --- a/drivers/acpi/video_detect.c +++ b/drivers/acpi/video_detect.c @@ -242,6 +242,15 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "XPS L521X"), }, }, + { + /* https://bugzilla.kernel.org/show_bug.cgi?id=108971 */ + .callback = video_detect_force_video, + .ident = "SAMSUNG 530U4E/540U4E", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), + DMI_MATCH(DMI_PRODUCT_NAME, "530U4E/540U4E"), + }, + }, /* Non win8 machines which need native backlight nevertheless */ { @@ -271,6 +280,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro12,1"), }, }, + { + .callback = video_detect_force_native, + .ident = "Dell Vostro V131", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V131"), + }, + }, { }, }; |