Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 6594 → Rev 6595

/drivers/acpi/Makefile
0,0 → 1,192
 
CC = kos32-gcc
FASM = fasm.exe
 
DRV_DIR = $(CURDIR)/..
 
DRV_INCLUDES = $(DRV_DIR)/include
 
ACPI_INCLUDES = ./acpica/include
 
INCLUDES = -I$(DRV_INCLUDES) \
-I$(DRV_INCLUDES)/asm \
-I$(DRV_INCLUDES)/uapi
INCLUDES+= -I$(ACPI_INCLUDES) -I./
 
DEFINES = -D_LINUX -D__KERNEL__ -DCONFIG_X86 -DCONFIG_X86_32 -DCONFIG_PCI -DCONFIG_ACPI -DBUILDING_ACPICA
DEFINES += -DCONFIG_X86_CMPXCHG64 -DCONFIG_TINY_RCU -DCONFIG_X86_L1_CACHE_SHIFT=6
DEFINES += -DACPI_USE_LOCAL_CACHE -DACPI_NO_ERROR_MESSAGES
DEFINES += -DCONFIG_DMI -DCONFIG_ACPI_REDUCED_HARDWARE_ONLY -DKBUILD_MODNAME=\"acpi.dll\"
 
CFLAGS_OPT = -Os -march=i686 -fomit-frame-pointer -fno-ident -mno-stack-arg-probe
CFLAGS_OPT+= -fno-builtin-printf -fno-builtin-snprintf -fno-builtin-sscanf -fno-builtin-vsscanf
CFLAGS_OPT+= -fno-builtin-scnprintf -fno-builtin-vsprintf -fno-builtin-vsnprintf
CFLAGS_OPT+= -mno-ms-bitfields
CFLAGS = $(INCLUDES) $(DEFINES) $(CFLAGS_OPT)
 
 
PE_FLAGS=--major-os-version,0,--minor-os-version,7,--major-subsystem-version,0,--minor-subsystem-version,5,--subsystem,native
 
LDFLAGS=-e,_drvEntry,-nostdlib,-s,-pie,$(PE_FLAGS),--image-base,0,--file-alignment,512,--section-alignment,512
 
LIBPATH:= -L$(DRV_DIR)/ddk -L./acpica
 
LIBS:= -lcore
 
 
NAME= acpi
 
NAME_SRCS= acpi.c \
blacklist.c \
boot.c \
bus.c \
tables.c \
acpica/dsargs.c \
acpica/dscontrol.c \
acpica/dsdebug.c \
acpica/dsfield.c \
acpica/dsinit.c \
acpica/dsmethod.c \
acpica/dsmthdat.c \
acpica/dsobject.c \
acpica/dsopcode.c \
acpica/dsutils.c \
acpica/dswexec.c \
acpica/dswload.c \
acpica/dswload2.c \
acpica/dswscope.c \
acpica/dswstate.c \
acpica/evmisc.c \
acpica/evregion.c \
acpica/evrgnini.c \
acpica/exconfig.c \
acpica/exconvrt.c \
acpica/excreate.c \
acpica/exdebug.c \
acpica/exfield.c \
acpica/exfldio.c \
acpica/exmisc.c \
acpica/exmutex.c \
acpica/exnames.c \
acpica/exoparg1.c \
acpica/exoparg2.c \
acpica/exoparg3.c \
acpica/exoparg6.c \
acpica/exprep.c \
acpica/exresnte.c \
acpica/exresolv.c \
acpica/exresop.c \
acpica/exstore.c \
acpica/exstoren.c \
acpica/exstorob.c \
acpica/exsystem.c \
acpica/exutils.c \
acpica/nsaccess.c \
acpica/nsalloc.c \
acpica/nsarguments.c \
acpica/nsconvert.c \
acpica/nseval.c \
acpica/nsinit.c \
acpica/nsload.c \
acpica/nsnames.c \
acpica/nsobject.c \
acpica/nsparse.c \
acpica/nspredef.c \
acpica/nsprepkg.c \
acpica/nsrepair.c \
acpica/nsrepair2.c \
acpica/nssearch.c \
acpica/nsutils.c \
acpica/nswalk.c \
acpica/psargs.c \
acpica/psloop.c \
acpica/psobject.c \
acpica/psopcode.c \
acpica/psopinfo.c \
acpica/psparse.c \
acpica/psscope.c \
acpica/pstree.c \
acpica/psutils.c \
acpica/pswalk.c \
acpica/psxface.c \
acpica/tbdata.c \
acpica/tbfind.c \
acpica/tbfadt.c \
acpica/tbinstal.c \
acpica/tbprint.c \
acpica/tbutils.c \
acpica/tbxface.c \
acpica/tbxfload.c \
acpica/utaddress.c \
acpica/utalloc.c \
acpica/utbuffer.c \
acpica/utcache.c \
acpica/utcopy.c \
acpica/utdecode.c \
acpica/utdelete.c \
acpica/uterror.c \
acpica/utexcep.c \
acpica/utglobal.c \
acpica/uthex.c \
acpica/utinit.c \
acpica/utlock.c \
acpica/utmath.c \
acpica/utmisc.c \
acpica/utmutex.c \
acpica/utnonansi.c \
acpica/utobject.c \
acpica/utosi.c \
acpica/utownerid.c \
acpica/utpredef.c \
acpica/utresrc.c \
acpica/utstate.c \
acpica/utstring.c \
acpica/utxface.c \
acpica/utxferror.c \
acpica/utxfinit.c \
../ddk/debug/dbglog.c \
../ddk/io/create.c \
../ddk/io/finfo.c \
../ddk/io/ssize.c \
../ddk/io/write.c \
../ddk/malloc/malloc.c \
../ddk/linux/ctype.c \
../ddk/linux/div64.c \
../ddk/linux/dmi.c \
../ddk/linux/hexdump.c \
../ddk/stdio/vsprintf.c \
../ddk/string/strstr.c \
../ddk/string/_strncat.S\
../ddk/string/_strncmp.S\
../ddk/string/_strncpy.S\
../ddk/string/_strnlen.S\
../ddk/string/memcmp.S \
../ddk/string/strcat.S \
../ddk/string/strcmp.S \
../ddk/string/strcpy.S \
../ddk/string/strncmp.S \
../ddk/string/strncpy.S \
../ddk/string/strnlen.S \
$(NULL)
 
 
 
all: $(NAME).dll
 
NAME_OBJS = $(patsubst %.S, %.o, $(patsubst %.asm, %.o,\
$(patsubst %.c, %.o, $(NAME_SRCS))))
 
 
all: $(NAME).dll
 
$(NAME).dll: $(NAME_SRCS) acpi.lds Makefile
$(CC) $(CFLAGS) -nostdlib -fwhole-program -flto -Wl,-Map,acpi.map,-T,acpi.lds,$(LDFLAGS) -Wl,$(LIBPATH) -o $@ $(NAME_SRCS) $(LIBS)
strip $(NAME).dll
# kpack $(NAME).dll
 
%.o : %.S $(HFILES) Makefile
as -o $@ $<
 
 
 
/drivers/acpi/acpi
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/drivers/acpi/acpi.asm
0,0 → 1,27
 
use32
 
db 'MENUET01'
dd 1
dd start
dd i_end
dd mem
dd mem
dd 0
dd 0
 
start:
mov eax, 68
mov ebx, 21
mov ecx, sz_acpi
int 0x40
 
mov eax, -1
int 0x40
 
sz_acpi db '/rd/1/drivers/acpi.dll',0
 
align 4
i_end:
rb 128
mem:
/drivers/acpi/acpi.c
0,0 → 1,631
 
#include <syscall.h>
#include <linux/delay.h>
#include <linux/ktime.h>
#include <linux/acpi.h>
#include <linux/dmi.h>
 
 
#define PREFIX "ACPI: "
 
int sbf_port __initdata = -1;
 
static bool acpi_os_initialized;
 
 
u32 __attribute__((externally_visible)) drvEntry(int action, char *cmdline)
{
int result;
 
if(action != 1)
return 0;
 
if( !dbg_open("/tmp0/1/acpi.log") )
{
printk("Can't open /tmp0/1/acpi.log\nExit\n");
return 0;
}
 
dmi_scan_machine();
 
acpi_boot_table_init();
 
early_acpi_boot_init();
 
acpi_noirq_set();
 
acpi_early_init();
 
 
// if (acpi_disabled) {
// printk(KERN_INFO PREFIX "Interpreter disabled.\n");
// return -ENODEV;
// }
 
// init_acpi_device_notify();
// result = acpi_bus_init();
// if (result) {
// disable_acpi();
// return result;
// }
 
// pci_mmcfg_late_init();
// acpi_scan_init();
// acpi_ec_init();
// acpi_debugfs_init();
// acpi_sleep_proc_init();
// acpi_wakeup_device_init();
 
dbgprintf("module loaded\n");
 
 
return 0;
 
};
 
 
#define PREFIX "ACPI: "
 
u32 IMPORT AcpiGetRootPtr(void)__asm__("AcpiGetRootPtr");
 
acpi_physical_address __init acpi_os_get_root_pointer(void)
{
return AcpiGetRootPtr();
}
 
void* acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
{
return (void *)MapIoMem((addr_t)phys, size, PG_SW);
 
}
 
void acpi_os_unmap_memory(void *virt, acpi_size size)
{
u32 ptr = (u32)virt;
ptr &= 0xFFFFF000;
 
return FreeKernelSpace((void*)ptr);
}
 
void __init early_acpi_os_unmap_memory(void __iomem *virt, acpi_size size)
{
acpi_os_unmap_memory(virt, size);
}
 
 
int acpi_os_map_generic_address(struct acpi_generic_address *gas)
{
addr_t addr;
void *virt;
 
if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY)
return 0;
 
addr = (addr_t)gas->address;
 
if (!addr || !gas->bit_width)
return -EINVAL;
 
virt = (void *)MapIoMem(addr, gas->bit_width / 8, PG_SW);
if (!virt)
return -EIO;
 
return 0;
}
 
 
void acpi_os_printf(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
acpi_os_vprintf(fmt, args);
va_end(args);
}
 
void acpi_os_vprintf(const char *fmt, va_list args)
{
static char buffer[512];
 
vsprintf(buffer, fmt, args);
 
#ifdef ENABLE_DEBUGGER
if (acpi_in_debugger) {
kdb_printf("%s", buffer);
} else {
printk("%s", buffer);
}
#else
printk("%s", buffer);
#endif
}
 
 
static void acpi_table_taint(struct acpi_table_header *table)
{
pr_warn(PREFIX
"Override [%4.4s-%8.8s], this is unsafe: tainting kernel\n",
table->signature, table->oem_table_id);
add_taint(TAINT_OVERRIDDEN_ACPI_TABLE, LOCKDEP_NOW_UNRELIABLE);
}
 
 
 
 
acpi_status
acpi_os_table_override(struct acpi_table_header * existing_table,
struct acpi_table_header ** new_table)
{
if (!existing_table || !new_table)
return AE_BAD_PARAMETER;
 
*new_table = NULL;
 
#ifdef CONFIG_ACPI_CUSTOM_DSDT
if (strncmp(existing_table->signature, "DSDT", 4) == 0)
*new_table = (struct acpi_table_header *)AmlCode;
#endif
if (*new_table != NULL)
acpi_table_taint(existing_table);
return AE_OK;
}
 
acpi_status
acpi_os_physical_table_override(struct acpi_table_header *existing_table,
acpi_physical_address *address,
u32 *table_length)
{
#ifndef CONFIG_ACPI_INITRD_TABLE_OVERRIDE
*table_length = 0;
*address = 0;
return AE_OK;
#else
int table_offset = 0;
struct acpi_table_header *table;
 
*table_length = 0;
*address = 0;
 
if (!acpi_tables_addr)
return AE_OK;
 
do {
if (table_offset + ACPI_HEADER_SIZE > all_tables_size) {
WARN_ON(1);
return AE_OK;
}
 
table = acpi_os_map_memory(acpi_tables_addr + table_offset,
ACPI_HEADER_SIZE);
 
if (table_offset + table->length > all_tables_size) {
acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
WARN_ON(1);
return AE_OK;
}
 
table_offset += table->length;
 
if (memcmp(existing_table->signature, table->signature, 4)) {
acpi_os_unmap_memory(table,
ACPI_HEADER_SIZE);
continue;
}
 
/* Only override tables with matching oem id */
if (memcmp(table->oem_table_id, existing_table->oem_table_id,
ACPI_OEM_TABLE_ID_SIZE)) {
acpi_os_unmap_memory(table,
ACPI_HEADER_SIZE);
continue;
}
 
table_offset -= table->length;
*table_length = table->length;
acpi_os_unmap_memory(table, ACPI_HEADER_SIZE);
*address = acpi_tables_addr + table_offset;
break;
} while (table_offset + ACPI_HEADER_SIZE < all_tables_size);
 
if (*address != 0)
acpi_table_taint(existing_table);
return AE_OK;
#endif
}
 
 
static struct osi_linux {
unsigned int enable:1;
unsigned int dmi:1;
unsigned int cmdline:1;
unsigned int default_disabling:1;
 
} osi_linux = {0, 0, 0, 0};
 
#define OSI_STRING_LENGTH_MAX 64 /* arbitrary */
#define OSI_STRING_ENTRIES_MAX 16 /* arbitrary */
 
struct osi_setup_entry {
char string[OSI_STRING_LENGTH_MAX];
bool enable;
};
 
static struct osi_setup_entry
osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = {
{"Module Device", true},
{"Processor Device", true},
{"3.0 _SCP Extensions", true},
{"Processor Aggregator Device", true},
};
void __init acpi_osi_setup(char *str)
{
struct osi_setup_entry *osi;
bool enable = true;
int i;
 
if (!acpi_gbl_create_osi_method)
return;
 
if (str == NULL || *str == '\0') {
printk(KERN_INFO PREFIX "_OSI method disabled\n");
acpi_gbl_create_osi_method = FALSE;
return;
}
 
if (*str == '!') {
str++;
if (*str == '\0') {
osi_linux.default_disabling = 1;
return;
} else if (*str == '*') {
acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
osi->enable = false;
}
return;
}
enable = false;
}
 
for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
osi = &osi_setup_entries[i];
if (!strcmp(osi->string, str)) {
osi->enable = enable;
break;
} else if (osi->string[0] == '\0') {
osi->enable = enable;
strncpy(osi->string, str, OSI_STRING_LENGTH_MAX);
break;
}
}
}
 
static void __init set_osi_linux(unsigned int enable)
{
if (osi_linux.enable != enable)
osi_linux.enable = enable;
 
if (osi_linux.enable)
acpi_osi_setup("Linux");
else
acpi_osi_setup("!Linux");
 
return;
}
 
void __init acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d)
{
printk(KERN_NOTICE PREFIX "DMI detected: %s\n", d->ident);
 
if (enable == -1)
return;
 
osi_linux.dmi = 1; /* DMI knows that this box asks OSI(Linux) */
set_osi_linux(enable);
 
return;
}
 
acpi_status acpi_os_wait_semaphore(acpi_handle handle, u32 units, u16 timeout)
{
void *sem = (void*)handle;
 
if (!acpi_os_initialized)
return AE_OK;
 
if (!sem || (units < 1))
return AE_BAD_PARAMETER;
 
if (units > 1)
return AE_SUPPORT;
 
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Waiting for semaphore[%p|%d|%d]\n",
handle, units, timeout));
 
return AE_OK;
}
 
acpi_status acpi_os_signal_semaphore(acpi_handle handle, u32 units)
{
void *sem = (void*)handle;
 
if (!acpi_os_initialized)
return AE_OK;
 
if (!sem || (units < 1))
return AE_BAD_PARAMETER;
 
if (units > 1)
return AE_SUPPORT;
 
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Signaling semaphore[%p|%d]\n", handle,
units));
 
// up(sem);
 
return AE_OK;
}
 
 
acpi_status __init acpi_os_initialize(void)
{
// acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1a_event_block);
// acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1b_event_block);
// acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe0_block);
// acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe1_block);
if (acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) {
/*
* Use acpi_os_map_generic_address to pre-map the reset
* register if it's in system memory.
*/
int rv;
 
rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register);
pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv);
}
acpi_os_initialized = true;
 
return AE_OK;
}
 
acpi_status __init acpi_os_initialize1(void)
{
// kacpid_wq = alloc_workqueue("kacpid", 0, 1);
// kacpi_notify_wq = alloc_workqueue("kacpi_notify", 0, 1);
// kacpi_hotplug_wq = alloc_ordered_workqueue("kacpi_hotplug", 0);
// BUG_ON(!kacpid_wq);
// BUG_ON(!kacpi_notify_wq);
// BUG_ON(!kacpi_hotplug_wq);
// acpi_install_interface_handler(acpi_osi_handler);
// acpi_osi_setup_late();
return AE_OK;
}
 
 
acpi_status acpi_os_delete_semaphore(acpi_handle handle)
{
// void *sem = (void*)handle;
 
// if (!sem)
// return AE_BAD_PARAMETER;
 
// kfree(sem);
// sem = NULL;
 
return AE_OK;
}
 
acpi_status acpi_os_create_semaphore(u32 max_units,
u32 initial_units, acpi_handle * out_handle)
{
*out_handle = (acpi_handle) 1;
return (AE_OK);
}
 
acpi_status
acpi_os_create_mutex(acpi_handle * handle)
{
struct mutex *mtx = NULL;
 
mtx = kzalloc(sizeof(struct mutex),0);
 
if (!mtx)
return AE_NO_MEMORY;
 
mutex_init(mtx);
 
*handle = (acpi_handle *) mtx;
 
return AE_OK;
}
 
void acpi_os_release_mutex(acpi_mutex handle)
{
struct mutex *mtx = (struct mutex*)handle;
 
if (!acpi_os_initialized)
return;
 
mutex_unlock(mtx);
}
 
acpi_status acpi_os_acquire_mutex(acpi_mutex handle, u16 timeout)
{
struct mutex *mtx = (struct mutex*)handle;
 
if (!acpi_os_initialized)
return AE_OK;
 
mutex_lock(mtx);
 
return AE_OK;
}
 
void acpi_os_delete_mutex(acpi_mutex handle)
{
struct mutex *mtx = (struct mutex*)handle;
 
kfree(mtx);
};
 
acpi_cpu_flags acpi_os_acquire_lock(acpi_spinlock lockp)
{
acpi_cpu_flags flags;
spin_lock_irqsave(lockp, flags);
return flags;
}
 
 
void acpi_os_release_lock(acpi_spinlock lockp, acpi_cpu_flags flags)
{
spin_unlock_irqrestore(lockp, flags);
}
 
 
acpi_status acpi_os_signal(u32 function, void *info)
{
switch (function) {
case ACPI_SIGNAL_FATAL:
printk(KERN_ERR PREFIX "Fatal opcode executed\n");
break;
case ACPI_SIGNAL_BREAKPOINT:
/*
* AML Breakpoint
* ACPI spec. says to treat it as a NOP unless
* you are debugging. So if/when we integrate
* AML debugger into the kernel debugger its
* hook will go here. But until then it is
* not useful to print anything on breakpoints.
*/
break;
default:
break;
}
 
return AE_OK;
}
 
void acpi_os_sleep(u64 ms)
{
msleep(ms);
}
 
void acpi_os_stall(u32 us)
{
while (us) {
u32 delay = 1000;
 
if (delay > us)
delay = us;
udelay(delay);
// touch_nmi_watchdog();
us -= delay;
}
}
 
void msleep(unsigned int msecs)
{
msecs /= 10;
if(!msecs) msecs = 1;
 
__asm__ __volatile__ (
"call *__imp__Delay"
::"b" (msecs));
__asm__ __volatile__ (
"":::"ebx");
 
};
 
acpi_status acpi_os_execute(acpi_execute_type type,
acpi_osd_exec_callback function, void *context)
{
 
return AE_OK;
}
 
 
u64 acpi_os_get_timer(void)
{
u64 time_ns = ktime_to_ns(ktime_get());
do_div(time_ns, 100);
return time_ns;
}
 
ktime_t ktime_get(void)
{
ktime_t t;
 
t.tv64 = GetClockNs();
 
return t;
}
 
void __delay(unsigned long loops)
{
asm volatile(
"test %0,%0\n"
"jz 3f\n"
"jmp 1f\n"
 
".align 16\n"
"1: jmp 2f\n"
 
".align 16\n"
"2: dec %0\n"
" jnz 2b\n"
"3: dec %0\n"
 
: /* we don't need output */
: "a" (loops)
);
}
 
 
inline void __const_udelay(unsigned long xloops)
{
int d0;
 
xloops *= 4;
asm("mull %%edx"
: "=d" (xloops), "=&a" (d0)
: "1" (xloops), ""
(loops_per_jiffy * (HZ/4)));
 
__delay(++xloops);
}
 
void __udelay(unsigned long usecs)
{
__const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */
}
 
 
#define acpi_rev_override false
 
#define ACPI_MAX_OVERRIDE_LEN 100
 
static char acpi_os_name[ACPI_MAX_OVERRIDE_LEN];
 
 
acpi_status
acpi_os_predefined_override(const struct acpi_predefined_names *init_val,
char **new_val)
{
if (!init_val || !new_val)
return AE_BAD_PARAMETER;
 
*new_val = NULL;
if (!memcmp(init_val->name, "_OS_", 4) && strlen(acpi_os_name)) {
printk(KERN_INFO PREFIX "Overriding _OS definition to '%s'\n",
acpi_os_name);
*new_val = acpi_os_name;
}
 
if (!memcmp(init_val->name, "_REV", 4) && acpi_rev_override) {
printk(KERN_INFO PREFIX "Overriding _REV return value to 5\n");
*new_val = (char *)5;
}
 
return AE_OK;
}
 
/drivers/acpi/acpi.lds
0,0 → 1,69
 
 
OUTPUT_FORMAT(pei-i386)
 
ENTRY("_drvEntry")
 
SECTIONS
{
. = SIZEOF_HEADERS;
. = ALIGN(__section_alignment__);
 
.text __image_base__ + ( __section_alignment__ < 0x1000 ? . : __section_alignment__ ) :
{
*(.text)
*(SORT(.text$*))
*(.text.*)
. = ALIGN(16);
*(.rdata)
*(SORT(.rdata$*))
. = ALIGN(16);
*(.data)
*(.data2)
*(SORT(.data$*))
. = ALIGN(16);
*(.bss)
*(COMMON)
}
 
 
.idata ALIGN(__section_alignment__):
{
SORT(*)(.idata$2)
SORT(*)(.idata$3)
/* These zeroes mark the end of the import list. */
LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
SORT(*)(.idata$4)
SORT(*)(.idata$5)
SORT(*)(.idata$6)
SORT(*)(.idata$7)
}
 
.reloc ALIGN(__section_alignment__) :
{
*(.reloc)
}
 
/DISCARD/ :
{
*(.debug$S)
*(.debug$T)
*(.debug$F)
*(.drectve)
*(.edata)
*(.note.GNU-stack)
*(.comment)
*(.eh_frame)
*(.debug_abbrev)
*(.debug_info)
*(.debug_line)
*(.debug_frame)
*(.debug_loc)
*(.debug_pubnames)
*(.debug_aranges)
*(.debug_ranges)
}
 
 
}
 
/drivers/acpi/acpica/acapps.h
0,0 → 1,173
/******************************************************************************
*
* Module Name: acapps - common include for ACPI applications/tools
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef _ACAPPS
#define _ACAPPS
 
/* Common info for tool signons */
 
#define ACPICA_NAME "Intel ACPI Component Architecture"
#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2015 Intel Corporation"
 
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_WIDTH "-64"
 
#elif ACPI_MACHINE_WIDTH == 32
#define ACPI_WIDTH "-32"
 
#else
#error unknown ACPI_MACHINE_WIDTH
#define ACPI_WIDTH "-??"
 
#endif
 
/* Macros for signons and file headers */
 
#define ACPI_COMMON_SIGNON(utility_name) \
"\n%s\n%s version %8.8X%s\n%s\n\n", \
ACPICA_NAME, \
utility_name, ((u32) ACPI_CA_VERSION), ACPI_WIDTH, \
ACPICA_COPYRIGHT
 
#define ACPI_COMMON_HEADER(utility_name, prefix) \
"%s%s\n%s%s version %8.8X%s\n%s%s\n%s\n", \
prefix, ACPICA_NAME, \
prefix, utility_name, ((u32) ACPI_CA_VERSION), ACPI_WIDTH, \
prefix, ACPICA_COPYRIGHT, \
prefix
 
/* Macros for usage messages */
 
#define ACPI_USAGE_HEADER(usage) \
acpi_os_printf ("Usage: %s\nOptions:\n", usage);
 
#define ACPI_USAGE_TEXT(description) \
acpi_os_printf (description);
 
#define ACPI_OPTION(name, description) \
acpi_os_printf (" %-18s%s\n", name, description);
 
#define FILE_SUFFIX_DISASSEMBLY "dsl"
#define FILE_SUFFIX_BINARY_TABLE ".dat" /* Needs the dot */
 
/*
* getopt
*/
int acpi_getopt(int argc, char **argv, char *opts);
 
int acpi_getopt_argument(int argc, char **argv);
 
extern int acpi_gbl_optind;
extern int acpi_gbl_opterr;
extern int acpi_gbl_sub_opt_char;
extern char *acpi_gbl_optarg;
 
/*
* cmfsize - Common get file size function
*/
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
*/
void
acpi_dm_cross_reference_namespace(union acpi_parse_object *parse_tree_root,
struct acpi_namespace_node *namespace_root,
acpi_owner_id owner_id);
 
void acpi_dm_dump_tree(union acpi_parse_object *origin);
 
void acpi_dm_find_orphan_methods(union acpi_parse_object *origin);
 
void
acpi_dm_finish_namespace_load(union acpi_parse_object *parse_tree_root,
struct acpi_namespace_node *namespace_root,
acpi_owner_id owner_id);
 
void
acpi_dm_convert_resource_indexes(union acpi_parse_object *parse_tree_root,
struct acpi_namespace_node *namespace_root);
 
/*
* adfile
*/
acpi_status ad_initialize(void);
 
char *fl_generate_filename(char *input_filename, char *suffix);
 
acpi_status
fl_split_input_pathname(char *input_path,
char **out_directory_path, char **out_filename);
 
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 */
/drivers/acpi/acpica/accommon.h
0,0 → 1,66
/******************************************************************************
*
* Name: accommon.h - Common include files for generation of ACPICA source
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACCOMMON_H__
#define __ACCOMMON_H__
 
/*
* Common set of includes for all ACPICA source files.
* We put them here because we don't want to duplicate them
* in the the source code again and again.
*
* Note: The order of these include files is important.
*/
#include <acpi/acconfig.h> /* Global configuration constants */
#include "acmacros.h" /* C macros */
#include "aclocal.h" /* Internal data types */
#include "acobject.h" /* ACPI internal object */
#include "acstruct.h" /* Common structures */
#include "acglobal.h" /* All global variables */
#include "achware.h" /* Hardware defines and interfaces */
#include "acutils.h" /* Utility interfaces */
#ifndef ACPI_USE_SYSTEM_CLIBRARY
#include "acclib.h" /* C library interfaces */
#endif /* !ACPI_USE_SYSTEM_CLIBRARY */
 
#endif /* __ACCOMMON_H__ */
/drivers/acpi/acpica/acdebug.h
0,0 → 1,302
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACDEBUG_H__
#define __ACDEBUG_H__
 
/* The debugger is used in conjunction with the disassembler most of time */
 
#ifdef ACPI_DISASSEMBLER
#include "acdisasm.h"
#endif
 
#define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
 
struct acpi_db_command_info {
char *name; /* Command Name */
u8 min_args; /* Minimum arguments required */
};
 
struct acpi_db_command_help {
u8 line_count; /* Number of help lines */
char *invocation; /* Command Invocation */
char *description; /* Command Description */
};
 
struct acpi_db_argument_info {
char *name; /* Argument Name */
};
 
struct acpi_db_execute_walk {
u32 count;
u32 max_count;
};
 
#define PARAM_LIST(pl) pl
 
#define EX_NO_SINGLE_STEP 1
#define EX_SINGLE_STEP 2
 
/*
* dbxface - external debugger interfaces
*/
acpi_status
acpi_db_single_step(struct acpi_walk_state *walk_state,
union acpi_parse_object *op, u32 op_type);
 
/*
* dbcmds - debug commands and output routines
*/
struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string);
 
void acpi_db_display_table_info(char *table_arg);
 
void acpi_db_display_template(char *buffer_arg);
 
void acpi_db_unload_acpi_table(char *name);
 
void acpi_db_send_notify(char *name, u32 value);
 
void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg);
 
acpi_status acpi_db_sleep(char *object_arg);
 
void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg);
 
void acpi_db_display_locks(void);
 
void acpi_db_display_resources(char *object_arg);
 
ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_display_gpes(void))
 
void acpi_db_display_handlers(void);
 
ACPI_HW_DEPENDENT_RETURN_VOID(void
acpi_db_generate_gpe(char *gpe_arg,
char *block_arg))
ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void))
 
void acpi_db_execute_test(char *type_arg);
 
/*
* dbconvert - miscellaneous conversion routines
*/
acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value);
 
acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object);
 
acpi_status
acpi_db_convert_to_object(acpi_object_type type,
char *string, union acpi_object *object);
 
u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info);
 
void acpi_db_dump_pld_buffer(union acpi_object *obj_desc);
 
/*
* dbmethod - control method commands
*/
void
acpi_db_set_method_breakpoint(char *location,
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
void acpi_db_set_method_call_breakpoint(union acpi_parse_object *op);
 
void acpi_db_set_method_data(char *type_arg, char *index_arg, char *value_arg);
 
acpi_status acpi_db_disassemble_method(char *name);
 
void acpi_db_disassemble_aml(char *statements, union acpi_parse_object *op);
 
void acpi_db_batch_execute(char *count_arg);
 
/*
* dbnames - namespace commands
*/
void acpi_db_set_scope(char *name);
 
void acpi_db_dump_namespace(char *start_arg, char *depth_arg);
 
void acpi_db_dump_namespace_paths(void);
 
void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg);
 
acpi_status acpi_db_find_name_in_namespace(char *name_arg);
 
void acpi_db_check_predefined_names(void);
 
acpi_status
acpi_db_display_objects(char *obj_type_arg, char *display_count_arg);
 
void acpi_db_check_integrity(void);
 
void acpi_db_find_references(char *object_arg);
 
void acpi_db_get_bus_info(void);
 
/*
* dbdisply - debug display commands
*/
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_status acpi_db_display_all_methods(char *display_count_arg);
 
void acpi_db_display_arguments(void);
 
void acpi_db_display_locals(void);
 
void acpi_db_display_results(void);
 
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);
 
/*
* dbexec - debugger control method execution
*/
void
acpi_db_execute(char *name, char **args, acpi_object_type * types, u32 flags);
 
void
acpi_db_create_execution_threads(char *num_threads_arg,
char *num_loops_arg, char *method_name_arg);
 
void acpi_db_delete_objects(u32 count, union acpi_object *objects);
 
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
u32 acpi_db_get_cache_info(struct acpi_memory_list *cache);
#endif
 
/*
* dbfileio - Debugger file I/O commands
*/
acpi_object_type
acpi_db_match_argument(char *user_argument,
struct acpi_db_argument_info *arguments);
 
void acpi_db_close_debug_file(void);
 
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);
 
/*
* dbhistry - debugger HISTORY command
*/
void acpi_db_add_to_history(char *command_line);
 
void acpi_db_display_history(void);
 
char *acpi_db_get_from_history(char *command_num_arg);
 
char *acpi_db_get_history_by_index(u32 commandd_num);
 
/*
* dbinput - user front-end to the AML debugger
*/
acpi_status
acpi_db_command_dispatch(char *input_buffer,
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
void ACPI_SYSTEM_XFACE acpi_db_execute_thread(void *context);
 
acpi_status acpi_db_user_commands(char prompt, union acpi_parse_object *op);
 
char *acpi_db_get_next_token(char *string,
char **next, acpi_object_type * return_type);
 
/*
* dbobject
*/
void acpi_db_decode_internal_object(union acpi_operand_object *obj_desc);
 
void
acpi_db_display_internal_object(union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);
 
void acpi_db_decode_arguments(struct acpi_walk_state *walk_state);
 
void acpi_db_decode_locals(struct acpi_walk_state *walk_state);
 
void
acpi_db_dump_method_info(acpi_status status,
struct acpi_walk_state *walk_state);
 
/*
* dbstats - Generation and display of ACPI table statistics
*/
void acpi_db_generate_statistics(union acpi_parse_object *root, u8 is_method);
 
acpi_status acpi_db_display_statistics(char *type_arg);
 
/*
* dbutils - AML debugger utilities
*/
void acpi_db_set_output_destination(u32 where);
 
void acpi_db_dump_external_object(union acpi_object *obj_desc, u32 level);
 
void acpi_db_prep_namestring(char *name);
 
struct acpi_namespace_node *acpi_db_local_ns_lookup(char *name);
 
void acpi_db_uint32_to_hex_string(u32 value, char *buffer);
 
#endif /* __ACDEBUG_H__ */
/drivers/acpi/acpica/acdispat.h
0,0 → 1,365
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef _ACDISPAT_H_
#define _ACDISPAT_H_
 
#define NAMEOF_LOCAL_NTE "__L0"
#define NAMEOF_ARG_NTE "__A0"
 
/*
* dsargs - execution of dynamic arguments for static objects
*/
acpi_status
acpi_ds_get_buffer_field_arguments(union acpi_operand_object *obj_desc);
 
acpi_status
acpi_ds_get_bank_field_arguments(union acpi_operand_object *obj_desc);
 
acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *rgn_desc);
 
acpi_status acpi_ds_get_buffer_arguments(union acpi_operand_object *obj_desc);
 
acpi_status acpi_ds_get_package_arguments(union acpi_operand_object *obj_desc);
 
/*
* dscontrol - support for execution control opcodes
*/
acpi_status
acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ds_exec_end_control_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
/*
* dsopcode - support for late operand evaluation
*/
acpi_status
acpi_ds_eval_buffer_field_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ds_eval_region_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ds_eval_table_region_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
union acpi_operand_object *obj_desc);
 
acpi_status
acpi_ds_eval_bank_field_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status acpi_ds_initialize_region(acpi_handle obj_handle);
 
/*
* dsexec - Parser/Interpreter interface, method execution callbacks
*/
acpi_status
acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
union acpi_operand_object *result_obj);
 
acpi_status
acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state,
union acpi_parse_object **out_op);
 
acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *state);
 
/*
* dsfield - Parser/Interpreter interface for AML fields
*/
acpi_status
acpi_ds_create_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_create_bank_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_create_index_field(union acpi_parse_object *op,
struct acpi_namespace_node *region_node,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_create_buffer_field(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_init_field_objects(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);
 
/*
* dsload - Parser/Interpreter interface
*/
acpi_status
acpi_ds_init_callbacks(struct acpi_walk_state *walk_state, u32 pass_number);
 
/* dsload - pass 1 namespace load callbacks */
 
acpi_status
acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
union acpi_parse_object **out_op);
 
acpi_status acpi_ds_load1_end_op(struct acpi_walk_state *walk_state);
 
/* dsload - pass 2 namespace load callbacks */
 
acpi_status
acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
union acpi_parse_object **out_op);
 
acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state);
 
/*
* dsmthdat - method data (locals/args)
*/
acpi_status
acpi_ds_store_object_to_local(u8 type,
u32 index,
union acpi_operand_object *src_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_method_data_get_entry(u16 opcode,
u32 index,
struct acpi_walk_state *walk_state,
union acpi_operand_object ***node);
 
void acpi_ds_method_data_delete_all(struct acpi_walk_state *walk_state);
 
u8 acpi_ds_is_method_value(union acpi_operand_object *obj_desc);
 
acpi_status
acpi_ds_method_data_get_value(u8 type,
u32 index,
struct acpi_walk_state *walk_state,
union acpi_operand_object **dest_desc);
 
acpi_status
acpi_ds_method_data_init_args(union acpi_operand_object **params,
u32 max_param_count,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_method_data_get_node(u8 type,
u32 index,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node **node);
 
void acpi_ds_method_data_init(struct acpi_walk_state *walk_state);
 
/*
* dsmethod - Parser/Interpreter interface - control method parsing
*/
acpi_status
acpi_ds_auto_serialize_method(struct acpi_namespace_node *node,
union acpi_operand_object *obj_desc);
 
acpi_status
acpi_ds_call_control_method(struct acpi_thread_state *thread,
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ds_restart_control_method(struct acpi_walk_state *walk_state,
union acpi_operand_object *return_desc);
 
void
acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_method_error(acpi_status status, struct acpi_walk_state *walk_state);
 
/*
* dsinit
*/
acpi_status
acpi_ds_initialize_objects(u32 table_index,
struct acpi_namespace_node *start_node);
 
/*
* dsobject - Parser/Interpreter interface - object initialization and conversion
*/
acpi_status
acpi_ds_build_internal_buffer_obj(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
u32 buffer_length,
union acpi_operand_object **obj_desc_ptr);
 
acpi_status
acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
u32 package_length,
union acpi_operand_object **obj_desc);
 
acpi_status
acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
u16 opcode, union acpi_operand_object **obj_desc);
 
acpi_status
acpi_ds_create_node(struct acpi_walk_state *walk_state,
struct acpi_namespace_node *node,
union acpi_parse_object *op);
 
/*
* dsutils - Parser/Interpreter interface utility routines
*/
void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state);
 
u8
acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,
struct acpi_walk_state *walk_state,
u8 add_reference);
 
u8
acpi_ds_is_result_used(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);
 
void
acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,
union acpi_operand_object *result_obj,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_create_operand(struct acpi_walk_state *walk_state,
union acpi_parse_object *arg, u32 args_remaining);
 
acpi_status
acpi_ds_create_operands(struct acpi_walk_state *walk_state,
union acpi_parse_object *first_arg);
 
acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state);
 
void acpi_ds_clear_operands(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state);
 
/*
* dswscope - Scope Stack manipulation
*/
acpi_status
acpi_ds_scope_stack_push(struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_walk_state *walk_state);
 
acpi_status acpi_ds_scope_stack_pop(struct acpi_walk_state *walk_state);
 
void acpi_ds_scope_stack_clear(struct acpi_walk_state *walk_state);
 
/*
* dswstate - parser WALK_STATE management routines
*/
acpi_status
acpi_ds_obj_stack_push(void *object, struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_obj_stack_pop(u32 pop_count, struct acpi_walk_state *walk_state);
 
struct acpi_walk_state * acpi_ds_create_walk_state(acpi_owner_id owner_id,
union acpi_parse_object
*origin,
union acpi_operand_object
*mth_desc,
struct acpi_thread_state
*thread);
 
acpi_status
acpi_ds_init_aml_walk(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
struct acpi_namespace_node *method_node,
u8 * aml_start,
u32 aml_length,
struct acpi_evaluate_info *info, u8 pass_number);
 
void
acpi_ds_obj_stack_pop_and_delete(u32 pop_count,
struct acpi_walk_state *walk_state);
 
void acpi_ds_delete_walk_state(struct acpi_walk_state *walk_state);
 
struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state
*thread);
 
void
acpi_ds_push_walk_state(struct acpi_walk_state *walk_state,
struct acpi_thread_state *thread);
 
acpi_status acpi_ds_result_stack_clear(struct acpi_walk_state *walk_state);
 
struct acpi_walk_state *acpi_ds_get_current_walk_state(struct acpi_thread_state
*thread);
 
acpi_status
acpi_ds_result_pop(union acpi_operand_object **object,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ds_result_push(union acpi_operand_object *object,
struct acpi_walk_state *walk_state);
 
/*
* dsdebug - parser debugging routines
*/
void
acpi_ds_dump_method_stack(acpi_status status,
struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
#endif /* _ACDISPAT_H_ */
/drivers/acpi/acpica/acevents.h
0,0 → 1,253
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACEVENTS_H__
#define __ACEVENTS_H__
 
/*
* evevent
*/
acpi_status acpi_ev_initialize_events(void);
 
acpi_status acpi_ev_install_xrupt_handlers(void);
 
u32 acpi_ev_fixed_event_detect(void);
 
/*
* evmisc
*/
u8 acpi_ev_is_notify_object(struct acpi_namespace_node *node);
 
u32 acpi_ev_get_gpe_number_index(u32 gpe_number);
 
acpi_status
acpi_ev_queue_notify_request(struct acpi_namespace_node *node,
u32 notify_value);
 
/*
* evglock - Global Lock support
*/
acpi_status acpi_ev_init_global_lock_handler(void);
 
ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
acpi_ev_acquire_global_lock(u16 timeout))
ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void))
acpi_status acpi_ev_remove_global_lock_handler(void);
 
/*
* evgpe - Low-level GPE support
*/
u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info *gpe_xrupt_list);
 
acpi_status
acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
 
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
acpi_status
acpi_ev_add_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
 
acpi_status
acpi_ev_remove_gpe_reference(struct acpi_gpe_event_info *gpe_event_info);
 
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
u32 gpe_number);
 
struct acpi_gpe_event_info *acpi_ev_low_get_gpe_info(u32 gpe_number,
struct acpi_gpe_block_info
*gpe_block);
 
acpi_status acpi_ev_finish_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
/*
* evgpeblk - Upper-level GPE block support
*/
acpi_status
acpi_ev_create_gpe_block(struct acpi_namespace_node *gpe_device,
u64 address,
u8 space_id,
u32 register_count,
u16 gpe_block_base_number,
u32 interrupt_number,
struct acpi_gpe_block_info **return_gpe_block);
 
acpi_status
acpi_ev_initialize_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block,
void *context);
 
ACPI_HW_DEPENDENT_RETURN_OK(acpi_status
acpi_ev_delete_gpe_block(struct acpi_gpe_block_info
*gpe_block))
 
u32
acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device,
struct acpi_gpe_event_info *gpe_event_info,
u32 gpe_number);
 
/*
* evgpeinit - GPE initialization and update
*/
acpi_status acpi_ev_gpe_initialize(void);
 
ACPI_HW_DEPENDENT_RETURN_VOID(void
acpi_ev_update_gpes(acpi_owner_id table_owner_id))
 
acpi_status
acpi_ev_match_gpe_method(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
 
/*
* evgpeutil - GPE utilities
*/
acpi_status
acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context);
 
acpi_status
acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context);
 
acpi_status
acpi_ev_get_gpe_xrupt_block(u32 interrupt_number,
struct acpi_gpe_xrupt_info **gpe_xrupt_block);
 
acpi_status acpi_ev_delete_gpe_xrupt(struct acpi_gpe_xrupt_info *gpe_xrupt);
 
acpi_status
acpi_ev_delete_gpe_handlers(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block,
void *context);
 
/*
* evhandler - Address space handling
*/
u8
acpi_ev_has_default_handler(struct acpi_namespace_node *node,
acpi_adr_space_type space_id);
 
acpi_status acpi_ev_install_region_handlers(void);
 
acpi_status
acpi_ev_install_space_handler(struct acpi_namespace_node *node,
acpi_adr_space_type space_id,
acpi_adr_space_handler handler,
acpi_adr_space_setup setup, void *context);
 
/*
* evregion - Operation region support
*/
acpi_status acpi_ev_initialize_op_regions(void);
 
acpi_status
acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
union acpi_operand_object *field_obj,
u32 function,
u32 region_offset, u32 bit_width, u64 *value);
 
acpi_status
acpi_ev_attach_region(union acpi_operand_object *handler_obj,
union acpi_operand_object *region_obj,
u8 acpi_ns_is_locked);
 
void
acpi_ev_detach_region(union acpi_operand_object *region_obj,
u8 acpi_ns_is_locked);
 
acpi_status
acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
acpi_adr_space_type space_id);
 
acpi_status
acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function);
 
/*
* evregini - Region initialization and setup
*/
acpi_status
acpi_ev_system_memory_region_setup(acpi_handle handle,
u32 function,
void *handler_context,
void **region_context);
 
acpi_status
acpi_ev_io_space_region_setup(acpi_handle handle,
u32 function,
void *handler_context, void **region_context);
 
acpi_status
acpi_ev_pci_config_region_setup(acpi_handle handle,
u32 function,
void *handler_context, void **region_context);
 
acpi_status
acpi_ev_cmos_region_setup(acpi_handle handle,
u32 function,
void *handler_context, void **region_context);
 
acpi_status
acpi_ev_pci_bar_region_setup(acpi_handle handle,
u32 function,
void *handler_context, void **region_context);
 
acpi_status
acpi_ev_default_region_setup(acpi_handle handle,
u32 function,
void *handler_context, void **region_context);
 
acpi_status
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
u8 acpi_ns_locked);
 
/*
* evsci - SCI (System Control Interrupt) handling/dispatch
*/
u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context);
 
u32 acpi_ev_sci_dispatch(void);
 
u32 acpi_ev_install_sci_handler(void);
 
acpi_status acpi_ev_remove_all_sci_handlers(void);
 
ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_ev_terminate(void))
#endif /* __ACEVENTS_H__ */
/drivers/acpi/acpica/acglobal.h
0,0 → 1,395
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACGLOBAL_H__
#define __ACGLOBAL_H__
 
/*****************************************************************************
*
* Globals related to the ACPI tables
*
****************************************************************************/
 
/* Master list of all ACPI tables that were found in the RSDT/XSDT */
 
ACPI_GLOBAL(struct acpi_table_list, acpi_gbl_root_table_list);
 
/* DSDT information. Used to check for DSDT corruption */
 
ACPI_GLOBAL(struct acpi_table_header *, acpi_gbl_DSDT);
ACPI_GLOBAL(struct acpi_table_header, acpi_gbl_original_dsdt_header);
ACPI_INIT_GLOBAL(u32, acpi_gbl_dsdt_index, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL(u32, acpi_gbl_facs_index, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL(u32, acpi_gbl_xfacs_index, ACPI_INVALID_TABLE_INDEX);
ACPI_INIT_GLOBAL(u32, acpi_gbl_fadt_index, ACPI_INVALID_TABLE_INDEX);
 
#if (!ACPI_REDUCED_HARDWARE)
ACPI_GLOBAL(struct acpi_table_facs *, acpi_gbl_FACS);
 
#endif /* !ACPI_REDUCED_HARDWARE */
 
/* These addresses are calculated from the FADT Event Block addresses */
 
ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1a_status);
ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1a_enable);
 
ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1b_status);
ACPI_GLOBAL(struct acpi_generic_address, acpi_gbl_xpm1b_enable);
 
/*
* Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is
* determined by the revision of the DSDT: If the DSDT revision is less than
* 2, use only the lower 32 bits of the internal 64-bit Integer.
*/
ACPI_GLOBAL(u8, acpi_gbl_integer_bit_width);
ACPI_GLOBAL(u8, acpi_gbl_integer_byte_width);
ACPI_GLOBAL(u8, acpi_gbl_integer_nybble_width);
 
/*****************************************************************************
*
* Mutual exclusion within ACPICA subsystem
*
****************************************************************************/
 
/*
* Predefined mutex objects. This array contains the
* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
* (The table maps local handles to the real OS handles)
*/
ACPI_GLOBAL(struct acpi_mutex_info, acpi_gbl_mutex_info[ACPI_NUM_MUTEX]);
 
/*
* Global lock mutex is an actual AML mutex object
* Global lock semaphore works in conjunction with the actual global lock
* Global lock spinlock is used for "pending" handshake
*/
ACPI_GLOBAL(union acpi_operand_object *, acpi_gbl_global_lock_mutex);
ACPI_GLOBAL(acpi_semaphore, acpi_gbl_global_lock_semaphore);
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_global_lock_pending_lock);
ACPI_GLOBAL(u16, acpi_gbl_global_lock_handle);
ACPI_GLOBAL(u8, acpi_gbl_global_lock_acquired);
ACPI_GLOBAL(u8, acpi_gbl_global_lock_present);
ACPI_GLOBAL(u8, acpi_gbl_global_lock_pending);
 
/*
* Spinlocks are used for interfaces that can be possibly called at
* interrupt level
*/
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_gpe_lock); /* For GPE data structs and registers */
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_hardware_lock); /* For ACPI H/W except GPE registers */
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_reference_count_lock);
 
/* Mutex for _OSI support */
 
ACPI_GLOBAL(acpi_mutex, acpi_gbl_osi_mutex);
 
/* Reader/Writer lock is used for namespace walk and dynamic table unload */
 
ACPI_GLOBAL(struct acpi_rw_lock, acpi_gbl_namespace_rw_lock);
 
/*****************************************************************************
*
* Miscellaneous globals
*
****************************************************************************/
 
/* Object caches */
 
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_namespace_cache);
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_state_cache);
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_ps_node_cache);
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_ps_node_ext_cache);
ACPI_GLOBAL(acpi_cache_t *, acpi_gbl_operand_cache);
 
/* System */
 
ACPI_INIT_GLOBAL(u32, acpi_gbl_startup_flags, 0);
ACPI_INIT_GLOBAL(u8, acpi_gbl_shutdown, TRUE);
 
/* Global handlers */
 
ACPI_GLOBAL(struct acpi_global_notify_handler, acpi_gbl_global_notify[2]);
ACPI_GLOBAL(acpi_exception_handler, acpi_gbl_exception_handler);
ACPI_GLOBAL(acpi_init_handler, acpi_gbl_init_handler);
ACPI_GLOBAL(acpi_table_handler, acpi_gbl_table_handler);
ACPI_GLOBAL(void *, acpi_gbl_table_handler_context);
ACPI_GLOBAL(acpi_interface_handler, acpi_gbl_interface_handler);
ACPI_GLOBAL(struct acpi_sci_handler_info *, acpi_gbl_sci_handler_list);
 
/* Owner ID support */
 
ACPI_GLOBAL(u32, acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS]);
ACPI_GLOBAL(u8, acpi_gbl_last_owner_id_index);
ACPI_GLOBAL(u8, acpi_gbl_next_owner_id_offset);
 
/* Initialization sequencing */
 
ACPI_GLOBAL(u8, acpi_gbl_reg_methods_executed);
 
/* Misc */
 
ACPI_GLOBAL(u32, acpi_gbl_original_mode);
ACPI_GLOBAL(u32, acpi_gbl_ns_lookup_count);
ACPI_GLOBAL(u32, acpi_gbl_ps_find_count);
ACPI_GLOBAL(u16, acpi_gbl_pm1_enable_register_save);
ACPI_GLOBAL(u8, acpi_gbl_debugger_configuration);
ACPI_GLOBAL(u8, acpi_gbl_step_to_next_call);
ACPI_GLOBAL(u8, acpi_gbl_acpi_hardware_present);
ACPI_GLOBAL(u8, acpi_gbl_events_initialized);
ACPI_GLOBAL(struct acpi_interface_info *, acpi_gbl_supported_interfaces);
ACPI_GLOBAL(struct acpi_address_range *,
acpi_gbl_address_range_list[ACPI_ADDRESS_RANGE_MAX]);
 
/* Other miscellaneous, declared and initialized in utglobal */
 
extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];
extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];
extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];
extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
 
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
 
/* Lists for tracking memory allocations (debug only) */
 
ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_global_list);
ACPI_GLOBAL(struct acpi_memory_list *, acpi_gbl_ns_node_list);
ACPI_GLOBAL(u8, acpi_gbl_display_final_mem_stats);
ACPI_GLOBAL(u8, acpi_gbl_disable_mem_tracking);
#endif
 
/*****************************************************************************
*
* Namespace globals
*
****************************************************************************/
 
#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
#define NUM_PREDEFINED_NAMES 10
#else
#define NUM_PREDEFINED_NAMES 9
#endif
 
ACPI_GLOBAL(struct acpi_namespace_node, acpi_gbl_root_node_struct);
ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_root_node);
ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_fadt_gpe_device);
ACPI_GLOBAL(union acpi_operand_object *, acpi_gbl_module_code_list);
 
extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];
extern const struct acpi_predefined_names
acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];
 
#ifdef ACPI_DEBUG_OUTPUT
ACPI_GLOBAL(u32, acpi_gbl_current_node_count);
ACPI_GLOBAL(u32, acpi_gbl_current_node_size);
ACPI_GLOBAL(u32, acpi_gbl_max_concurrent_node_count);
ACPI_GLOBAL(acpi_size *, acpi_gbl_entry_stack_pointer);
ACPI_GLOBAL(acpi_size *, acpi_gbl_lowest_stack_pointer);
ACPI_GLOBAL(u32, acpi_gbl_deepest_nesting);
ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0);
#endif
 
/*****************************************************************************
*
* Interpreter globals
*
****************************************************************************/
 
ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);
 
/* Maximum number of While() loop iterations before forced abort */
 
ACPI_GLOBAL(u16, acpi_gbl_max_loop_iterations);
 
/* Control method single step flag */
 
ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
 
/*****************************************************************************
*
* Hardware globals
*
****************************************************************************/
 
extern struct acpi_bit_register_info
acpi_gbl_bit_register_info[ACPI_NUM_BITREG];
 
ACPI_GLOBAL(u8, acpi_gbl_sleep_type_a);
ACPI_GLOBAL(u8, acpi_gbl_sleep_type_b);
 
/*****************************************************************************
*
* Event and GPE globals
*
****************************************************************************/
 
#if (!ACPI_REDUCED_HARDWARE)
 
ACPI_GLOBAL(u8, acpi_gbl_all_gpes_initialized);
ACPI_GLOBAL(struct acpi_gpe_xrupt_info *, acpi_gbl_gpe_xrupt_list_head);
ACPI_GLOBAL(struct acpi_gpe_block_info *,
acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS]);
ACPI_GLOBAL(acpi_gbl_event_handler, acpi_gbl_global_event_handler);
ACPI_GLOBAL(void *, acpi_gbl_global_event_handler_context);
ACPI_GLOBAL(struct acpi_fixed_event_handler,
acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS]);
 
extern struct acpi_fixed_event_info
acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
 
#endif /* !ACPI_REDUCED_HARDWARE */
 
/*****************************************************************************
*
* Debug support
*
****************************************************************************/
 
/* Event counters */
 
ACPI_GLOBAL(u32, acpi_method_count);
ACPI_GLOBAL(u32, acpi_gpe_count);
ACPI_GLOBAL(u32, acpi_sci_count);
ACPI_GLOBAL(u32, acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]);
 
/* Support for dynamic control method tracing mechanism */
 
ACPI_GLOBAL(u32, acpi_gbl_original_dbg_level);
ACPI_GLOBAL(u32, acpi_gbl_original_dbg_layer);
 
/*****************************************************************************
*
* Debugger and Disassembler globals
*
****************************************************************************/
 
ACPI_INIT_GLOBAL(u8, acpi_gbl_db_output_flags, ACPI_DB_CONSOLE_OUTPUT);
 
#ifdef ACPI_DISASSEMBLER
 
/* Do not disassemble buffers to resource descriptors */
 
ACPI_INIT_GLOBAL(u8, acpi_gbl_no_resource_disassembly, FALSE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_ignore_noop_operator, FALSE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_cstyle_disassembly, TRUE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_force_aml_disassembly, FALSE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_opt_verbose, TRUE);
 
ACPI_GLOBAL(u8, acpi_gbl_dm_opt_disasm);
ACPI_GLOBAL(u8, acpi_gbl_dm_opt_listing);
ACPI_GLOBAL(u8, acpi_gbl_num_external_methods);
ACPI_GLOBAL(u32, acpi_gbl_resolved_external_methods);
ACPI_GLOBAL(struct acpi_external_list *, acpi_gbl_external_list);
ACPI_GLOBAL(struct acpi_external_file *, acpi_gbl_external_file_list);
#endif
 
#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);
ACPI_GLOBAL(u8, acpi_gbl_db_opt_no_region_support);
ACPI_GLOBAL(u8, acpi_gbl_db_output_to_file);
ACPI_GLOBAL(char *, acpi_gbl_db_buffer);
ACPI_GLOBAL(char *, acpi_gbl_db_filename);
ACPI_GLOBAL(u32, acpi_gbl_db_debug_level);
ACPI_GLOBAL(u32, acpi_gbl_db_console_debug_level);
ACPI_GLOBAL(struct acpi_namespace_node *, acpi_gbl_db_scope_node);
ACPI_GLOBAL(u8, acpi_gbl_db_terminate_loop);
ACPI_GLOBAL(u8, acpi_gbl_db_threads_terminated);
 
ACPI_GLOBAL(char *, acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]);
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]);
 
/*
* Statistic globals
*/
ACPI_GLOBAL(u16, acpi_gbl_obj_type_count[ACPI_TOTAL_TYPES]);
ACPI_GLOBAL(u16, acpi_gbl_node_type_count[ACPI_TOTAL_TYPES]);
ACPI_GLOBAL(u16, acpi_gbl_obj_type_count_misc);
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 */
 
/*****************************************************************************
*
* Application globals
*
****************************************************************************/
 
#ifdef ACPI_APPLICATION
 
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_debug_file, NULL);
ACPI_INIT_GLOBAL(ACPI_FILE, acpi_gbl_output_file, NULL);
 
/* Print buffer */
 
ACPI_GLOBAL(acpi_spinlock, acpi_gbl_print_lock); /* For print buffer */
ACPI_GLOBAL(char, acpi_gbl_print_buffer[1024]);
 
#endif /* ACPI_APPLICATION */
 
/*****************************************************************************
*
* Info/help support
*
****************************************************************************/
 
extern const struct ah_predefined_name asl_predefined_info[];
extern const struct ah_device_id asl_device_ids[];
 
#endif /* __ACGLOBAL_H__ */
/drivers/acpi/acpica/achware.h
0,0 → 1,150
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACHWARE_H__
#define __ACHWARE_H__
 
/* Values for the _SST predefined method */
 
#define ACPI_SST_INDICATOR_OFF 0
#define ACPI_SST_WORKING 1
#define ACPI_SST_WAKING 2
#define ACPI_SST_SLEEPING 3
#define ACPI_SST_SLEEP_CONTEXT 4
 
/*
* hwacpi - high level functions
*/
acpi_status acpi_hw_set_mode(u32 mode);
 
u32 acpi_hw_get_mode(void);
 
/*
* hwregs - ACPI Register I/O
*/
acpi_status
acpi_hw_validate_register(struct acpi_generic_address *reg,
u8 max_bit_width, u64 *address);
 
acpi_status acpi_hw_read(u32 *value, struct acpi_generic_address *reg);
 
acpi_status acpi_hw_write(u32 value, struct acpi_generic_address *reg);
 
struct acpi_bit_register_info *acpi_hw_get_bit_register_info(u32 register_id);
 
acpi_status acpi_hw_write_pm1_control(u32 pm1a_control, u32 pm1b_control);
 
acpi_status acpi_hw_register_read(u32 register_id, u32 *return_value);
 
acpi_status acpi_hw_register_write(u32 register_id, u32 value);
 
acpi_status acpi_hw_clear_acpi_status(void);
 
/*
* hwsleep - sleep/wake support (Legacy sleep registers)
*/
acpi_status acpi_hw_legacy_sleep(u8 sleep_state);
 
acpi_status acpi_hw_legacy_wake_prep(u8 sleep_state);
 
acpi_status acpi_hw_legacy_wake(u8 sleep_state);
 
/*
* hwesleep - sleep/wake support (Extended FADT-V5 sleep registers)
*/
void acpi_hw_execute_sleep_method(char *method_name, u32 integer_argument);
 
acpi_status acpi_hw_extended_sleep(u8 sleep_state);
 
acpi_status acpi_hw_extended_wake_prep(u8 sleep_state);
 
acpi_status acpi_hw_extended_wake(u8 sleep_state);
 
/*
* hwvalid - Port I/O with validation
*/
acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width);
 
acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width);
 
/*
* hwgpe - GPE support
*/
u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info);
 
acpi_status
acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action);
 
acpi_status
acpi_hw_disable_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context);
 
acpi_status acpi_hw_clear_gpe(struct acpi_gpe_event_info *gpe_event_info);
 
acpi_status
acpi_hw_clear_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block, void *context);
 
acpi_status
acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info,
acpi_event_status *event_status);
 
acpi_status acpi_hw_disable_all_gpes(void);
 
acpi_status acpi_hw_enable_all_runtime_gpes(void);
 
acpi_status acpi_hw_enable_all_wakeup_gpes(void);
 
acpi_status
acpi_hw_enable_runtime_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block,
void *context);
 
/*
* hwpci - PCI configuration support
*/
acpi_status
acpi_hw_derive_pci_id(struct acpi_pci_id *pci_id,
acpi_handle root_pci_device, acpi_handle pci_region);
 
#endif /* __ACHWARE_H__ */
/drivers/acpi/acpica/acinterp.h
0,0 → 1,556
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACINTERP_H__
#define __ACINTERP_H__
 
#define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
 
/* Macros for tables used for debug output */
 
#define ACPI_EXD_OFFSET(f) (u8) ACPI_OFFSET (union acpi_operand_object,f)
#define ACPI_EXD_NSOFFSET(f) (u8) ACPI_OFFSET (struct acpi_namespace_node,f)
#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (struct acpi_exdump_info))
 
/*
* If possible, pack the following structures to byte alignment, since we
* don't care about performance for debug output. Two cases where we cannot
* pack the structures:
*
* 1) Hardware does not support misaligned memory transfers
* 2) Compiler does not support pointers within packed structures
*/
#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
#pragma pack(1)
#endif
 
typedef const struct acpi_exdump_info {
u8 opcode;
u8 offset;
char *name;
 
} acpi_exdump_info;
 
/* Values for the Opcode field above */
 
#define ACPI_EXD_INIT 0
#define ACPI_EXD_TYPE 1
#define ACPI_EXD_UINT8 2
#define ACPI_EXD_UINT16 3
#define ACPI_EXD_UINT32 4
#define ACPI_EXD_UINT64 5
#define ACPI_EXD_LITERAL 6
#define ACPI_EXD_POINTER 7
#define ACPI_EXD_ADDRESS 8
#define ACPI_EXD_STRING 9
#define ACPI_EXD_BUFFER 10
#define ACPI_EXD_PACKAGE 11
#define ACPI_EXD_FIELD 12
#define ACPI_EXD_REFERENCE 13
#define ACPI_EXD_LIST 14 /* Operand object list */
#define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */
#define ACPI_EXD_RGN_LIST 16 /* Region list */
#define ACPI_EXD_NODE 17 /* Namespace Node */
 
/* restore default alignment */
 
#pragma pack()
 
/*
* exconvrt - object conversion
*/
acpi_status
acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, u32 flags);
 
acpi_status
acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc);
 
acpi_status
acpi_ex_convert_to_string(union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc, u32 type);
 
/* Types for ->String conversion */
 
#define ACPI_EXPLICIT_BYTE_COPY 0x00000000
#define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
#define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
#define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
 
acpi_status
acpi_ex_convert_to_target_type(acpi_object_type destination_type,
union acpi_operand_object *source_desc,
union acpi_operand_object **result_desc,
struct acpi_walk_state *walk_state);
 
/*
* exdebug - AML debug object
*/
void
acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
u32 level, u32 index);
 
void
acpi_ex_start_trace_method(struct acpi_namespace_node *method_node,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);
 
void
acpi_ex_stop_trace_method(struct acpi_namespace_node *method_node,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);
 
void
acpi_ex_start_trace_opcode(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);
 
void
acpi_ex_stop_trace_opcode(union acpi_parse_object *op,
struct acpi_walk_state *walk_state);
 
void
acpi_ex_trace_point(acpi_trace_event_type type,
u8 begin, u8 *aml, char *pathname);
 
/*
* exfield - ACPI AML (p-code) execution - field manipulation
*/
acpi_status
acpi_ex_common_buffer_setup(union acpi_operand_object *obj_desc,
u32 buffer_length, u32 * datum_count);
 
acpi_status
acpi_ex_write_with_update_rule(union acpi_operand_object *obj_desc,
u64 mask,
u64 field_value, u32 field_datum_byte_offset);
 
void
acpi_ex_get_buffer_datum(u64 *datum,
void *buffer,
u32 buffer_length,
u32 byte_granularity, u32 buffer_offset);
 
void
acpi_ex_set_buffer_datum(u64 merged_datum,
void *buffer,
u32 buffer_length,
u32 byte_granularity, u32 buffer_offset);
 
acpi_status
acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
union acpi_operand_object *obj_desc,
union acpi_operand_object **ret_buffer_desc);
 
acpi_status
acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
union acpi_operand_object *obj_desc,
union acpi_operand_object **result_desc);
 
/*
* exfldio - low level field I/O
*/
acpi_status
acpi_ex_extract_from_field(union acpi_operand_object *obj_desc,
void *buffer, u32 buffer_length);
 
acpi_status
acpi_ex_insert_into_field(union acpi_operand_object *obj_desc,
void *buffer, u32 buffer_length);
 
acpi_status
acpi_ex_access_region(union acpi_operand_object *obj_desc,
u32 field_datum_byte_offset, u64 *value, u32 read_write);
 
/*
* exmisc - misc support routines
*/
acpi_status
acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
union acpi_operand_object **return_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_concat_template(union acpi_operand_object *obj_desc,
union acpi_operand_object *obj_desc2,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_do_concatenate(union acpi_operand_object *obj_desc,
union acpi_operand_object *obj_desc2,
union acpi_operand_object **actual_return_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_do_logical_numeric_op(u16 opcode,
u64 integer0, u64 integer1, u8 *logical_result);
 
acpi_status
acpi_ex_do_logical_op(u16 opcode,
union acpi_operand_object *operand0,
union acpi_operand_object *operand1, u8 *logical_result);
 
u64 acpi_ex_do_math_op(u16 opcode, u64 operand0, u64 operand1);
 
acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_create_processor(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_create_power_resource(struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_create_region(u8 * aml_start,
u32 aml_length,
u8 region_space, struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_create_alias(struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_create_method(u8 * aml_start,
u32 aml_length, struct acpi_walk_state *walk_state);
 
/*
* exconfig - dynamic table load/unload
*/
acpi_status
acpi_ex_load_op(union acpi_operand_object *obj_desc,
union acpi_operand_object *target,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_load_table_op(struct acpi_walk_state *walk_state,
union acpi_operand_object **return_desc);
 
acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle);
 
/*
* exmutex - mutex support
*/
acpi_status
acpi_ex_acquire_mutex(union acpi_operand_object *time_desc,
union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_acquire_mutex_object(u16 timeout,
union acpi_operand_object *obj_desc,
acpi_thread_id thread_id);
 
acpi_status
acpi_ex_release_mutex(union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_release_mutex_object(union acpi_operand_object *obj_desc);
 
void acpi_ex_release_all_mutexes(struct acpi_thread_state *thread);
 
void acpi_ex_unlink_mutex(union acpi_operand_object *obj_desc);
 
/*
* exprep - ACPI AML execution - prep utilities
*/
acpi_status
acpi_ex_prep_common_field_object(union acpi_operand_object *obj_desc,
u8 field_flags,
u8 field_attribute,
u32 field_bit_position, u32 field_bit_length);
 
acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info);
 
/*
* exsystem - Interface to OS services
*/
acpi_status
acpi_ex_system_do_notify_op(union acpi_operand_object *value,
union acpi_operand_object *obj_desc);
 
acpi_status acpi_ex_system_do_sleep(u64 time);
 
acpi_status acpi_ex_system_do_stall(u32 time);
 
acpi_status acpi_ex_system_signal_event(union acpi_operand_object *obj_desc);
 
acpi_status
acpi_ex_system_wait_event(union acpi_operand_object *time,
union acpi_operand_object *obj_desc);
 
acpi_status acpi_ex_system_reset_event(union acpi_operand_object *obj_desc);
 
acpi_status
acpi_ex_system_wait_semaphore(acpi_semaphore semaphore, u16 timeout);
 
acpi_status acpi_ex_system_wait_mutex(acpi_mutex mutex, u16 timeout);
 
/*
* exoparg1 - ACPI AML execution, 1 operand
*/
acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state);
 
/*
* exoparg2 - ACPI AML execution, 2 operands
*/
acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state);
 
/*
* exoparg3 - ACPI AML execution, 3 operands
*/
acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state);
 
acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state);
 
/*
* exoparg6 - ACPI AML execution, 6 operands
*/
acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state *walk_state);
 
/*
* exresolv - Object resolution and get value functions
*/
acpi_status
acpi_ex_resolve_to_value(union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state,
union acpi_operand_object *operand,
acpi_object_type * return_type,
union acpi_operand_object **return_desc);
 
/*
* exresnte - resolve namespace node
*/
acpi_status
acpi_ex_resolve_node_to_value(struct acpi_namespace_node **stack_ptr,
struct acpi_walk_state *walk_state);
 
/*
* exresop - resolve operand to value
*/
acpi_status
acpi_ex_resolve_operands(u16 opcode,
union acpi_operand_object **stack_ptr,
struct acpi_walk_state *walk_state);
 
/*
* exdump - Interpreter debug output routines
*/
void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth);
 
void
acpi_ex_dump_operands(union acpi_operand_object **operands,
const char *opcode_name, u32 num_opcodes);
 
void
acpi_ex_dump_object_descriptor(union acpi_operand_object *object, u32 flags);
 
void acpi_ex_dump_namespace_node(struct acpi_namespace_node *node, u32 flags);
 
/*
* exnames - AML namestring support
*/
acpi_status
acpi_ex_get_name_string(acpi_object_type data_type,
u8 * in_aml_address,
char **out_name_string, u32 * out_name_length);
 
/*
* exstore - Object store support
*/
acpi_status
acpi_ex_store(union acpi_operand_object *val_desc,
union acpi_operand_object *dest_desc,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
struct acpi_namespace_node *node,
struct acpi_walk_state *walk_state,
u8 implicit_conversion);
 
#define ACPI_IMPLICIT_CONVERSION TRUE
#define ACPI_NO_IMPLICIT_CONVERSION FALSE
 
/*
* exstoren - resolve/store object
*/
acpi_status
acpi_ex_resolve_object(union acpi_operand_object **source_desc_ptr,
acpi_object_type target_type,
struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ex_store_object_to_object(union acpi_operand_object *source_desc,
union acpi_operand_object *dest_desc,
union acpi_operand_object **new_desc,
struct acpi_walk_state *walk_state);
 
/*
* exstorob - store object - buffer/string
*/
acpi_status
acpi_ex_store_buffer_to_buffer(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc);
 
acpi_status
acpi_ex_store_string_to_string(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc);
 
/*
* excopy - object copy
*/
acpi_status
acpi_ex_copy_integer_to_index_field(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc);
 
acpi_status
acpi_ex_copy_integer_to_bank_field(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc);
 
acpi_status
acpi_ex_copy_data_to_named_field(union acpi_operand_object *source_desc,
struct acpi_namespace_node *node);
 
acpi_status
acpi_ex_copy_integer_to_buffer_field(union acpi_operand_object *source_desc,
union acpi_operand_object *target_desc);
 
/*
* exutils - interpreter/scanner utilities
*/
void acpi_ex_enter_interpreter(void);
 
void acpi_ex_exit_interpreter(void);
 
u8 acpi_ex_truncate_for32bit_table(union acpi_operand_object *obj_desc);
 
void acpi_ex_acquire_global_lock(u32 rule);
 
void acpi_ex_release_global_lock(u32 rule);
 
void acpi_ex_eisa_id_to_string(char *dest, u64 compressed_id);
 
void acpi_ex_integer_to_string(char *dest, u64 value);
 
void acpi_ex_pci_cls_to_string(char *dest, u8 class_code[3]);
 
u8 acpi_is_valid_space_id(u8 space_id);
 
/*
* exregion - default op_region handlers
*/
acpi_status
acpi_ex_system_memory_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context,
void *region_context);
 
acpi_status
acpi_ex_system_io_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context, void *region_context);
 
acpi_status
acpi_ex_pci_config_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context, void *region_context);
 
acpi_status
acpi_ex_cmos_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context, void *region_context);
 
acpi_status
acpi_ex_pci_bar_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context, void *region_context);
 
acpi_status
acpi_ex_embedded_controller_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context,
void *region_context);
 
acpi_status
acpi_ex_sm_bus_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context, void *region_context);
 
acpi_status
acpi_ex_data_table_space_handler(u32 function,
acpi_physical_address address,
u32 bit_width,
u64 *value,
void *handler_context, void *region_context);
 
#endif /* __INTERP_H__ */
/drivers/acpi/acpica/aclocal.h
0,0 → 1,1210
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACLOCAL_H__
#define __ACLOCAL_H__
 
/* acpisrc:struct_defs -- for acpisrc conversion */
 
#define ACPI_SERIALIZED 0xFF
 
typedef u32 acpi_mutex_handle;
#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)
 
/* Total number of aml opcodes defined */
 
#define AML_NUM_OPCODES 0x82
 
/* Forward declarations */
 
struct acpi_walk_state;
struct acpi_obj_mutex;
union acpi_parse_object;
 
/*****************************************************************************
*
* Mutex typedefs and structs
*
****************************************************************************/
 
/*
* Predefined handles for the mutex objects used within the subsystem
* All mutex objects are automatically created by acpi_ut_mutex_initialize.
*
* The acquire/release ordering protocol is implied via this list. Mutexes
* with a lower value must be acquired before mutexes with a higher value.
*
* NOTE: any changes here must be reflected in the acpi_gbl_mutex_names
* table below also!
*/
#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
 
#define ACPI_MAX_MUTEX 5
#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
 
/* Lock structure for reader/writer interfaces */
 
struct acpi_rw_lock {
acpi_mutex writer_mutex;
acpi_mutex reader_mutex;
u32 num_readers;
};
 
/*
* Predefined handles for spinlocks used within the subsystem.
* These spinlocks are created by acpi_ut_mutex_initialize
*/
#define ACPI_LOCK_GPES 0
#define ACPI_LOCK_HARDWARE 1
 
#define ACPI_MAX_LOCK 1
#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
 
/* This Thread ID means that the mutex is not in use (unlocked) */
 
#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0
 
/* This Thread ID means an invalid thread ID */
 
#ifdef ACPI_OS_INVALID_THREAD_ID
#define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID
#else
#define ACPI_INVALID_THREAD_ID ((acpi_thread_id) 0xFFFFFFFF)
#endif
 
/* Table for the global mutexes */
 
struct acpi_mutex_info {
acpi_mutex mutex;
u32 use_count;
acpi_thread_id thread_id;
};
 
/* Lock flag parameter for various interfaces */
 
#define ACPI_MTX_DO_NOT_LOCK 0
#define ACPI_MTX_LOCK 1
 
/* Field access granularities */
 
#define ACPI_FIELD_BYTE_GRANULARITY 1
#define ACPI_FIELD_WORD_GRANULARITY 2
#define ACPI_FIELD_DWORD_GRANULARITY 4
#define ACPI_FIELD_QWORD_GRANULARITY 8
 
#define ACPI_ENTRY_NOT_FOUND NULL
 
/*****************************************************************************
*
* Namespace typedefs and structs
*
****************************************************************************/
 
/* Operational modes of the AML interpreter/scanner */
 
typedef enum {
ACPI_IMODE_LOAD_PASS1 = 0x01,
ACPI_IMODE_LOAD_PASS2 = 0x02,
ACPI_IMODE_EXECUTE = 0x03
} acpi_interpreter_mode;
 
/*
* The Namespace Node describes a named object that appears in the AML.
* descriptor_type is used to differentiate between internal descriptors.
*
* The node is optimized for both 32-bit and 64-bit platforms:
* 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
*
* Note: The descriptor_type and Type fields must appear in the identical
* position in both the struct acpi_namespace_node and union acpi_operand_object
* structures.
*/
struct acpi_namespace_node {
union acpi_operand_object *object; /* Interpreter object */
u8 descriptor_type; /* Differentiate object descriptor types */
u8 type; /* ACPI Type associated with this name */
u8 flags; /* Miscellaneous flags */
acpi_owner_id owner_id; /* Node creator */
union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */
struct acpi_namespace_node *parent; /* Parent node */
struct acpi_namespace_node *child; /* First child */
struct acpi_namespace_node *peer; /* First peer */
 
/*
* The following fields are used by the ASL compiler and disassembler only
*/
#ifdef ACPI_LARGE_NAMESPACE_NODE
union acpi_parse_object *op;
void *method_locals;
void *method_args;
u32 value;
u32 length;
u8 arg_count;
 
#endif
};
 
/* Namespace Node flags */
 
#define ANOBJ_RESERVED 0x01 /* Available for use */
#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */
 
#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
 
/* Internal ACPI table management - master table list */
 
struct acpi_table_list {
struct acpi_table_desc *tables; /* Table descriptor array */
u32 current_table_count; /* Tables currently in the array */
u32 max_table_count; /* Max tables array will hold */
u8 flags;
};
 
/* Flags for above */
 
#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
#define ACPI_ROOT_ALLOW_RESIZE (2)
 
/* Predefined table indexes */
 
#define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF)
 
struct acpi_find_context {
char *search_for;
acpi_handle *list;
u32 *count;
};
 
struct acpi_ns_search_data {
struct acpi_namespace_node *node;
};
 
/* Object types used during package copies */
 
#define ACPI_COPY_TYPE_SIMPLE 0
#define ACPI_COPY_TYPE_PACKAGE 1
 
/* Info structure used to convert external<->internal namestrings */
 
struct acpi_namestring_info {
const char *external_name;
const char *next_external_char;
char *internal_name;
u32 length;
u32 num_segments;
u32 num_carats;
u8 fully_qualified;
};
 
/* Field creation info */
 
struct acpi_create_field_info {
struct acpi_namespace_node *region_node;
struct acpi_namespace_node *field_node;
struct acpi_namespace_node *register_node;
struct acpi_namespace_node *data_register_node;
struct acpi_namespace_node *connection_node;
u8 *resource_buffer;
u32 bank_value;
u32 field_bit_position;
u32 field_bit_length;
u16 resource_length;
u16 pin_number_index;
u8 field_flags;
u8 attribute;
u8 field_type;
u8 access_length;
};
 
typedef
acpi_status(*acpi_internal_method) (struct acpi_walk_state * walk_state);
 
/*
* Bitmapped ACPI types. Used internally only
*/
#define ACPI_BTYPE_ANY 0x00000000
#define ACPI_BTYPE_INTEGER 0x00000001
#define ACPI_BTYPE_STRING 0x00000002
#define ACPI_BTYPE_BUFFER 0x00000004
#define ACPI_BTYPE_PACKAGE 0x00000008
#define ACPI_BTYPE_FIELD_UNIT 0x00000010
#define ACPI_BTYPE_DEVICE 0x00000020
#define ACPI_BTYPE_EVENT 0x00000040
#define ACPI_BTYPE_METHOD 0x00000080
#define ACPI_BTYPE_MUTEX 0x00000100
#define ACPI_BTYPE_REGION 0x00000200
#define ACPI_BTYPE_POWER 0x00000400
#define ACPI_BTYPE_PROCESSOR 0x00000800
#define ACPI_BTYPE_THERMAL 0x00001000
#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
#define ACPI_BTYPE_DDB_HANDLE 0x00004000
#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
#define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), ref_of(), etc (type6_opcodes) */
#define ACPI_BTYPE_RESOURCE 0x00020000
#define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */
 
#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
 
#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
 
/* Used by Copy, de_ref_of, Store, Printf, Fprintf */
 
#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
 
#pragma pack(1)
 
/*
* Information structure for ACPI predefined names.
* Each entry in the table contains the following items:
*
* name - The ACPI reserved name
* param_count - Number of arguments to the method
* expected_return_btypes - Allowed type(s) for the return value
*/
struct acpi_name_info {
char name[ACPI_NAME_SIZE];
u16 argument_list;
u8 expected_btypes;
};
 
/*
* Secondary information structures for ACPI predefined objects that return
* package objects. This structure appears as the next entry in the table
* after the NAME_INFO structure above.
*
* The reason for this is to minimize the size of the predefined name table.
*/
 
/*
* Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
* ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
* ACPI_PTYPE2_FIX_VAR
*/
struct acpi_package_info {
u8 type;
u8 object_type1;
u8 count1;
u8 object_type2;
u8 count2;
u16 reserved;
};
 
/* Used for ACPI_PTYPE2_FIXED */
 
struct acpi_package_info2 {
u8 type;
u8 count;
u8 object_type[4];
u8 reserved;
};
 
/* Used for ACPI_PTYPE1_OPTION */
 
struct acpi_package_info3 {
u8 type;
u8 count;
u8 object_type[2];
u8 tail_object_type;
u16 reserved;
};
 
struct acpi_package_info4 {
u8 type;
u8 object_type1;
u8 count1;
u8 sub_object_types;
u8 pkg_count;
u16 reserved;
};
 
union acpi_predefined_info {
struct acpi_name_info info;
struct acpi_package_info ret_info;
struct acpi_package_info2 ret_info2;
struct acpi_package_info3 ret_info3;
struct acpi_package_info4 ret_info4;
};
 
/* Reset to default packing */
 
#pragma pack()
 
/* Return object auto-repair info */
 
typedef acpi_status(*acpi_object_converter) (union acpi_operand_object
*original_object,
union acpi_operand_object
**converted_object);
 
struct acpi_simple_repair_info {
char name[ACPI_NAME_SIZE];
u32 unexpected_btypes;
u32 package_index;
acpi_object_converter object_converter;
};
 
/*
* Bitmapped return value types
* Note: the actual data types must be contiguous, a loop in nspredef.c
* depends on this.
*/
#define ACPI_RTYPE_ANY 0x00
#define ACPI_RTYPE_NONE 0x01
#define ACPI_RTYPE_INTEGER 0x02
#define ACPI_RTYPE_STRING 0x04
#define ACPI_RTYPE_BUFFER 0x08
#define ACPI_RTYPE_PACKAGE 0x10
#define ACPI_RTYPE_REFERENCE 0x20
#define ACPI_RTYPE_ALL 0x3F
 
#define ACPI_NUM_RTYPES 5 /* Number of actual object types */
 
/* Info for running the _REG methods */
 
struct acpi_reg_walk_info {
acpi_adr_space_type space_id;
u32 reg_run_count;
};
 
/*****************************************************************************
*
* Event typedefs and structs
*
****************************************************************************/
 
/* Dispatch info for each host-installed SCI handler */
 
struct acpi_sci_handler_info {
struct acpi_sci_handler_info *next;
acpi_sci_handler address; /* Address of handler */
void *context; /* Context to be passed to handler */
};
 
/* Dispatch info for each GPE -- either a method or handler, cannot be both */
 
struct acpi_gpe_handler_info {
acpi_gpe_handler address; /* Address of handler, if any */
void *context; /* Context to be passed to handler */
struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
u8 original_flags; /* Original (pre-handler) GPE info */
u8 originally_enabled; /* True if GPE was originally enabled */
};
 
/* Notify info for implicit notify, multiple device objects */
 
struct acpi_gpe_notify_info {
struct acpi_namespace_node *device_node; /* Device to be notified */
struct acpi_gpe_notify_info *next;
};
 
/*
* GPE dispatch info. At any time, the GPE can have at most one type
* of dispatch - Method, Handler, or Implicit Notify.
*/
union acpi_gpe_dispatch_info {
struct acpi_namespace_node *method_node; /* Method node for this GPE level */
struct acpi_gpe_handler_info *handler; /* Installed GPE handler */
struct acpi_gpe_notify_info *notify_list; /* List of _PRW devices for implicit notifies */
};
 
/*
* Information about a GPE, one per each GPE in an array.
* NOTE: Important to keep this struct as small as possible.
*/
struct acpi_gpe_event_info {
union acpi_gpe_dispatch_info dispatch; /* Either Method, Handler, or notify_list */
struct acpi_gpe_register_info *register_info; /* Backpointer to register info */
u8 flags; /* Misc info about this GPE */
u8 gpe_number; /* This GPE */
u8 runtime_count; /* References to a run GPE */
};
 
/* Information about a GPE register pair, one per each status/enable pair in an array */
 
struct acpi_gpe_register_info {
struct acpi_generic_address status_address; /* Address of status reg */
struct acpi_generic_address enable_address; /* Address of enable reg */
u16 base_gpe_number; /* Base GPE number for this register */
u8 enable_for_wake; /* GPEs to keep enabled when sleeping */
u8 enable_for_run; /* GPEs to keep enabled when running */
u8 enable_mask; /* Current mask of enabled GPEs */
};
 
/*
* Information about a GPE register block, one per each installed block --
* GPE0, GPE1, and one per each installed GPE Block Device.
*/
struct acpi_gpe_block_info {
struct acpi_namespace_node *node;
struct acpi_gpe_block_info *previous;
struct acpi_gpe_block_info *next;
struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */
struct acpi_gpe_register_info *register_info; /* One per GPE register pair */
struct acpi_gpe_event_info *event_info; /* One for each GPE */
u64 address; /* Base address of the block */
u32 register_count; /* Number of register pairs in block */
u16 gpe_count; /* Number of individual GPEs in block */
u16 block_base_number; /* Base GPE number for this block */
u8 space_id;
u8 initialized; /* TRUE if this block is initialized */
};
 
/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
 
struct acpi_gpe_xrupt_info {
struct acpi_gpe_xrupt_info *previous;
struct acpi_gpe_xrupt_info *next;
struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */
u32 interrupt_number; /* System interrupt number */
};
 
struct acpi_gpe_walk_info {
struct acpi_namespace_node *gpe_device;
struct acpi_gpe_block_info *gpe_block;
u16 count;
acpi_owner_id owner_id;
u8 execute_by_owner_id;
};
 
struct acpi_gpe_device_info {
u32 index;
u32 next_block_base_index;
acpi_status status;
struct acpi_namespace_node *gpe_device;
};
 
typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *
gpe_xrupt_info,
struct acpi_gpe_block_info *gpe_block,
void *context);
 
/* Information about each particular fixed event */
 
struct acpi_fixed_event_handler {
acpi_event_handler handler; /* Address of handler. */
void *context; /* Context to be passed to handler */
};
 
struct acpi_fixed_event_info {
u8 status_register_id;
u8 enable_register_id;
u16 status_bit_mask;
u16 enable_bit_mask;
};
 
/* Information used during field processing */
 
struct acpi_field_info {
u8 skip_field;
u8 field_flag;
u32 pkg_length;
};
 
/*****************************************************************************
*
* Generic "state" object for stacks
*
****************************************************************************/
 
#define ACPI_CONTROL_NORMAL 0xC0
#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
#define ACPI_CONTROL_PREDICATE_FALSE 0xC3
#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
 
#define ACPI_STATE_COMMON \
void *next; \
u8 descriptor_type; /* To differentiate various internal objs */\
u8 flags; \
u16 value; \
u16 state;
 
/* There are 2 bytes available here until the next natural alignment boundary */
 
struct acpi_common_state {
ACPI_STATE_COMMON};
 
/*
* Update state - used to traverse complex objects such as packages
*/
struct acpi_update_state {
ACPI_STATE_COMMON union acpi_operand_object *object;
};
 
/*
* Pkg state - used to traverse nested package structures
*/
struct acpi_pkg_state {
ACPI_STATE_COMMON u16 index;
union acpi_operand_object *source_object;
union acpi_operand_object *dest_object;
struct acpi_walk_state *walk_state;
void *this_target_obj;
u32 num_packages;
};
 
/*
* Control state - one per if/else and while constructs.
* Allows nesting of these constructs
*/
struct acpi_control_state {
ACPI_STATE_COMMON u16 opcode;
union acpi_parse_object *predicate_op;
u8 *aml_predicate_start; /* Start of if/while predicate */
u8 *package_end; /* End of if/while block */
u32 loop_count; /* While() loop counter */
};
 
/*
* Scope state - current scope during namespace lookups
*/
struct acpi_scope_state {
ACPI_STATE_COMMON struct acpi_namespace_node *node;
};
 
struct acpi_pscope_state {
ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */
union acpi_parse_object *op; /* Current op being parsed */
u8 *arg_end; /* Current argument end */
u8 *pkg_end; /* Current package end */
u32 arg_list; /* Next argument to parse */
};
 
/*
* Thread state - one per thread across multiple walk states. Multiple walk
* states are created when there are nested control methods executing.
*/
struct acpi_thread_state {
ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */
struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */
union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */
acpi_thread_id thread_id; /* Running thread ID */
};
 
/*
* Result values - used to accumulate the results of nested
* AML arguments
*/
struct acpi_result_values {
ACPI_STATE_COMMON
union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];
};
 
typedef
acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,
union acpi_parse_object ** out_op);
 
typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);
 
/* Global handlers for AML Notifies */
 
struct acpi_global_notify_handler {
acpi_notify_handler handler;
void *context;
};
 
/*
* Notify info - used to pass info to the deferred notify
* handler/dispatcher.
*/
struct acpi_notify_info {
ACPI_STATE_COMMON u8 handler_list_id;
struct acpi_namespace_node *node;
union acpi_operand_object *handler_list_head;
struct acpi_global_notify_handler *global;
};
 
/* Generic state is union of structs above */
 
union acpi_generic_state {
struct acpi_common_state common;
struct acpi_control_state control;
struct acpi_update_state update;
struct acpi_scope_state scope;
struct acpi_pscope_state parse_scope;
struct acpi_pkg_state pkg;
struct acpi_thread_state thread;
struct acpi_result_values results;
struct acpi_notify_info notify;
};
 
/*****************************************************************************
*
* Interpreter typedefs and structs
*
****************************************************************************/
 
typedef acpi_status(*acpi_execute_op) (struct acpi_walk_state * walk_state);
 
/* Address Range info block */
 
struct acpi_address_range {
struct acpi_address_range *next;
struct acpi_namespace_node *region_node;
acpi_physical_address start_address;
acpi_physical_address end_address;
};
 
/*****************************************************************************
*
* Parser typedefs and structs
*
****************************************************************************/
 
/*
* AML opcode, name, and argument layout
*/
struct acpi_opcode_info {
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
char *name; /* Opcode name (disassembler/debug only) */
#endif
u32 parse_args; /* Grammar/Parse time arguments */
u32 runtime_args; /* Interpret time arguments */
u16 flags; /* Misc flags */
u8 object_type; /* Corresponding internal object type */
u8 class; /* Opcode class */
u8 type; /* Opcode type */
};
 
/* Value associated with the parse object */
 
union acpi_parse_value {
u64 integer; /* Integer constant (Up to 64 bits) */
u32 size; /* bytelist or field size */
char *string; /* NULL terminated string */
u8 *buffer; /* buffer or string */
char *name; /* NULL terminated string */
union acpi_parse_object *arg; /* arguments and contained ops */
};
 
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
#define ACPI_DISASM_ONLY_MEMBERS(a) a;
#else
#define ACPI_DISASM_ONLY_MEMBERS(a)
#endif
 
#define ACPI_PARSE_COMMON \
union acpi_parse_object *parent; /* Parent op */\
u8 descriptor_type; /* To differentiate various internal objs */\
u8 flags; /* Type of Op */\
u16 aml_opcode; /* AML opcode */\
u8 *aml; /* Address of declaration in AML */\
union acpi_parse_object *next; /* Next op */\
struct acpi_namespace_node *node; /* For use by interpreter */\
union acpi_parse_value value; /* Value or args associated with the opcode */\
u8 arg_list_length; /* Number of elements in the arg list */\
ACPI_DISASM_ONLY_MEMBERS (\
u8 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
char *operator_symbol;/* Used for C-style operator name strings */\
char aml_op_name[16]) /* Op name (debug only) */
 
/* Flags for disasm_flags field above */
 
#define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
#define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
#define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
#define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
#define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
#define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */
#define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */
#define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */
#define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a Lnot_equal (etc.) pair of opcodes */
#define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a Lnot_equal (etc.) pair of opcodes */
#define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
#define ACPI_DASM_IGNORE 0x0B /* Not used at this time */
 
/*
* Generic operation (for example: If, While, Store)
*/
struct acpi_parse_obj_common {
ACPI_PARSE_COMMON};
 
/*
* Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),
* and bytelists.
*/
struct acpi_parse_obj_named {
ACPI_PARSE_COMMON u8 *path;
u8 *data; /* AML body or bytelist data */
u32 length; /* AML length */
u32 name; /* 4-byte name or zero if no name */
};
 
/* This version is used by the iASL compiler only */
 
#define ACPI_MAX_PARSEOP_NAME 20
 
struct acpi_parse_obj_asl {
ACPI_PARSE_COMMON union acpi_parse_object *child;
union acpi_parse_object *parent_method;
char *filename;
char *external_name;
char *namepath;
char name_seg[4];
u32 extra_value;
u32 column;
u32 line_number;
u32 logical_line_number;
u32 logical_byte_offset;
u32 end_line;
u32 end_logical_line;
u32 acpi_btype;
u32 aml_length;
u32 aml_subtree_length;
u32 final_aml_length;
u32 final_aml_offset;
u32 compile_flags;
u16 parse_opcode;
u8 aml_opcode_length;
u8 aml_pkg_len_bytes;
u8 extra;
char parse_op_name[ACPI_MAX_PARSEOP_NAME];
};
 
union acpi_parse_object {
struct acpi_parse_obj_common common;
struct acpi_parse_obj_named named;
struct acpi_parse_obj_asl asl;
};
 
/*
* Parse state - one state per parser invocation and each control
* method.
*/
struct acpi_parse_state {
u8 *aml_start; /* First AML byte */
u8 *aml; /* Next AML byte */
u8 *aml_end; /* (last + 1) AML byte */
u8 *pkg_start; /* Current package begin */
u8 *pkg_end; /* Current package end */
union acpi_parse_object *start_op; /* Root of parse tree */
struct acpi_namespace_node *start_node;
union acpi_generic_state *scope; /* Current scope */
union acpi_parse_object *start_scope;
u32 aml_size;
};
 
/* Parse object flags */
 
#define ACPI_PARSEOP_GENERIC 0x01
#define ACPI_PARSEOP_NAMED 0x02
#define ACPI_PARSEOP_DEFERRED 0x04
#define ACPI_PARSEOP_BYTELIST 0x08
#define ACPI_PARSEOP_IN_STACK 0x10
#define ACPI_PARSEOP_TARGET 0x20
#define ACPI_PARSEOP_IN_CACHE 0x80
 
/* Parse object disasm_flags */
 
#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMLIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_PREDEF_CHECKED 0x08
#define ACPI_PARSEOP_CLOSING_PAREN 0x10
#define ACPI_PARSEOP_COMPOUND 0x20
#define ACPI_PARSEOP_ASSIGNMENT 0x40
 
/*****************************************************************************
*
* Hardware (ACPI registers) and PNP
*
****************************************************************************/
 
struct acpi_bit_register_info {
u8 parent_register;
u8 bit_position;
u16 access_bit_mask;
};
 
/*
* Some ACPI registers have bits that must be ignored -- meaning that they
* must be preserved.
*/
#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
 
/* Write-only bits must be zeroed by software */
 
#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */
 
/* For control registers, both ignored and reserved bits must be preserved */
 
/*
* For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
* ACPI specification to be a "preserved" bit - "OSPM always preserves this
* bit position", section 4.7.3.2.1. However, on some machines the OS must
* write a one to this bit after resume for the machine to work properly.
* To enable this, we no longer attempt to preserve this bit. No machines
* are known to fail if the bit is not preserved. (May 2009)
*/
#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */
#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
#define ACPI_PM1_CONTROL_PRESERVED_BITS \
(ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
 
#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */
 
/*
* Register IDs
* These are the full ACPI registers
*/
#define ACPI_REGISTER_PM1_STATUS 0x01
#define ACPI_REGISTER_PM1_ENABLE 0x02
#define ACPI_REGISTER_PM1_CONTROL 0x03
#define ACPI_REGISTER_PM2_CONTROL 0x04
#define ACPI_REGISTER_PM_TIMER 0x05
#define ACPI_REGISTER_PROCESSOR_BLOCK 0x06
#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07
 
/* Masks used to access the bit_registers */
 
#define ACPI_BITMASK_TIMER_STATUS 0x0001
#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_WAKE_STATUS 0x8000
 
#define ACPI_BITMASK_ALL_FIXED_STATUS (\
ACPI_BITMASK_TIMER_STATUS | \
ACPI_BITMASK_BUS_MASTER_STATUS | \
ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
ACPI_BITMASK_POWER_BUTTON_STATUS | \
ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
ACPI_BITMASK_RT_CLOCK_STATUS | \
ACPI_BITMASK_PCIEXP_WAKE_STATUS | \
ACPI_BITMASK_WAKE_STATUS)
 
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
 
#define ACPI_BITMASK_SCI_ENABLE 0x0001
#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
#define ACPI_BITMASK_SLEEP_TYPE 0x1C00
#define ACPI_BITMASK_SLEEP_ENABLE 0x2000
 
#define ACPI_BITMASK_ARB_DISABLE 0x0001
 
/* Raw bit position of each bit_register */
 
#define ACPI_BITPOSITION_TIMER_STATUS 0x00
#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
 
#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
 
#define ACPI_BITPOSITION_SCI_ENABLE 0x00
#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
#define ACPI_BITPOSITION_SLEEP_TYPE 0x0A
#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
 
#define ACPI_BITPOSITION_ARB_DISABLE 0x00
 
/* Structs and definitions for _OSI support and I/O port validation */
 
#define ACPI_ALWAYS_ILLEGAL 0x00
 
struct acpi_interface_info {
char *name;
struct acpi_interface_info *next;
u8 flags;
u8 value;
};
 
#define ACPI_OSI_INVALID 0x01
#define ACPI_OSI_DYNAMIC 0x02
#define ACPI_OSI_FEATURE 0x04
#define ACPI_OSI_DEFAULT_INVALID 0x08
#define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
 
struct acpi_port_info {
char *name;
u16 start;
u16 end;
u8 osi_dependency;
};
 
/*****************************************************************************
*
* Resource descriptors
*
****************************************************************************/
 
/* resource_type values */
 
#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
#define ACPI_ADDRESS_TYPE_IO_RANGE 1
#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
 
/* Resource descriptor types and masks */
 
#define ACPI_RESOURCE_NAME_LARGE 0x80
#define ACPI_RESOURCE_NAME_SMALL 0x00
 
#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
 
/*
* Small resource descriptor "names" as defined by the ACPI specification.
* Note: Bits 2:0 are used for the descriptor length
*/
#define ACPI_RESOURCE_NAME_IRQ 0x20
#define ACPI_RESOURCE_NAME_DMA 0x28
#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
#define ACPI_RESOURCE_NAME_IO 0x40
#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
#define ACPI_RESOURCE_NAME_FIXED_DMA 0x50
#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
#define ACPI_RESOURCE_NAME_END_TAG 0x78
 
/*
* Large resource descriptor "names" as defined by the ACPI specification.
* Note: includes the Large Descriptor bit in bit[7]
*/
#define ACPI_RESOURCE_NAME_MEMORY24 0x81
#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
#define ACPI_RESOURCE_NAME_MEMORY32 0x85
#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
#define ACPI_RESOURCE_NAME_ADDRESS32 0x87
#define ACPI_RESOURCE_NAME_ADDRESS16 0x88
#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
#define ACPI_RESOURCE_NAME_GPIO 0x8C
#define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E
#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E
 
/*****************************************************************************
*
* Miscellaneous
*
****************************************************************************/
 
#define ACPI_ASCII_ZERO 0x30
 
/*****************************************************************************
*
* Disassembler
*
****************************************************************************/
 
struct acpi_external_list {
char *path;
char *internal_path;
struct acpi_external_list *next;
u32 value;
u16 length;
u16 flags;
u8 type;
};
 
/* Values for Flags field above */
 
#define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */
#define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
#define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
#define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
 
struct acpi_external_file {
char *path;
struct acpi_external_file *next;
};
 
/*****************************************************************************
*
* Debugger
*
****************************************************************************/
 
struct acpi_db_method_info {
acpi_handle method;
acpi_handle main_thread_gate;
acpi_handle thread_complete_gate;
acpi_handle info_gate;
acpi_thread_id *threads;
u32 num_threads;
u32 num_created;
u32 num_completed;
 
char *name;
u32 flags;
u32 num_loops;
char pathname[ACPI_DB_LINE_BUFFER_SIZE];
char **args;
acpi_object_type *types;
 
/*
* Arguments to be passed to method for the command
* Threads -
* the Number of threads, ID of current thread and
* Index of current thread inside all them created.
*/
char init_args;
#ifdef ACPI_DEBUGGER
acpi_object_type arg_types[4];
#endif
char *arguments[4];
char num_threads_str[11];
char id_of_thread_str[11];
char index_of_thread_str[11];
};
 
struct acpi_integrity_info {
u32 nodes;
u32 objects;
};
 
#define ACPI_DB_DISABLE_OUTPUT 0x00
#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
#define ACPI_DB_CONSOLE_OUTPUT 0x02
#define ACPI_DB_DUPLICATE_OUTPUT 0x03
 
struct acpi_object_info {
u32 types[ACPI_TOTAL_TYPES];
};
 
/*****************************************************************************
*
* Debug
*
****************************************************************************/
 
/* Entry for a memory allocation (debug only) */
 
#define ACPI_MEM_MALLOC 0
#define ACPI_MEM_CALLOC 1
#define ACPI_MAX_MODULE_NAME 16
 
#define ACPI_COMMON_DEBUG_MEM_HEADER \
struct acpi_debug_mem_block *previous; \
struct acpi_debug_mem_block *next; \
u32 size; \
u32 component; \
u32 line; \
char module[ACPI_MAX_MODULE_NAME]; \
u8 alloc_type;
 
struct acpi_debug_mem_header {
ACPI_COMMON_DEBUG_MEM_HEADER};
 
struct acpi_debug_mem_block {
ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;
};
 
#define ACPI_MEM_LIST_GLOBAL 0
#define ACPI_MEM_LIST_NSNODE 1
#define ACPI_MEM_LIST_MAX 1
#define ACPI_NUM_MEM_LISTS 2
 
/*****************************************************************************
*
* Info/help support
*
****************************************************************************/
 
struct ah_predefined_name {
char *name;
char *description;
#ifndef ACPI_ASL_COMPILER
char *action;
#endif
};
 
struct ah_device_id {
char *name;
char *description;
};
 
struct ah_uuid {
char *description;
char *string;
};
 
struct ah_table {
char *signature;
char *description;
};
 
#endif /* __ACLOCAL_H__ */
/drivers/acpi/acpica/acmacros.h
0,0 → 1,428
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACMACROS_H__
#define __ACMACROS_H__
 
/*
* Extract data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below.
* Use with care.
*/
#define ACPI_CAST8(ptr) ACPI_CAST_PTR (u8, (ptr))
#define ACPI_CAST16(ptr) ACPI_CAST_PTR (u16, (ptr))
#define ACPI_CAST32(ptr) ACPI_CAST_PTR (u32, (ptr))
#define ACPI_CAST64(ptr) ACPI_CAST_PTR (u64, (ptr))
#define ACPI_GET8(ptr) (*ACPI_CAST8 (ptr))
#define ACPI_GET16(ptr) (*ACPI_CAST16 (ptr))
#define ACPI_GET32(ptr) (*ACPI_CAST32 (ptr))
#define ACPI_GET64(ptr) (*ACPI_CAST64 (ptr))
#define ACPI_SET8(ptr, val) (*ACPI_CAST8 (ptr) = (u8) (val))
#define ACPI_SET16(ptr, val) (*ACPI_CAST16 (ptr) = (u16) (val))
#define ACPI_SET32(ptr, val) (*ACPI_CAST32 (ptr) = (u32) (val))
#define ACPI_SET64(ptr, val) (*ACPI_CAST64 (ptr) = (u64) (val))
 
/*
* printf() format helper. This macros is a workaround for the difficulties
* with emitting 64-bit integers and 64-bit pointers with the same code
* for both 32-bit and 64-bit hosts.
*/
#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i), ACPI_LODWORD(i)
 
/*
* Macros for moving data around to/from buffers that are possibly unaligned.
* If the hardware supports the transfer of unaligned data, just do the store.
* Otherwise, we have to move one byte at a time.
*/
#ifdef ACPI_BIG_ENDIAN
/*
* Macros for big-endian machines
*/
 
/* These macros reverse the bytes during the move, converting little-endian to big endian */
 
/* Big Endian <== Little Endian */
/* Hi...Lo Lo...Hi */
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[0];}
 
#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d))=0;\
((u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
 
#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
 
/* 32-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
 
#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[0];}
 
#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d))=0;\
((u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
((u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
((u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
((u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
 
/* 64-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
 
#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
 
#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[7];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[6];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[5];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[4];\
(( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[0];}
#else
/*
* Macros for little-endian machines
*/
 
#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
 
/* The hardware supports unaligned transfers, just do the little-endian move */
 
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d, s) *(u16 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
#define ACPI_MOVE_16_TO_64(d, s) *(u64 *)(void *)(d) = *(u16 *)(void *)(s)
 
/* 32-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
#define ACPI_MOVE_32_TO_32(d, s) *(u32 *)(void *)(d) = *(u32 *)(void *)(s)
#define ACPI_MOVE_32_TO_64(d, s) *(u64 *)(void *)(d) = *(u32 *)(void *)(s)
 
/* 64-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
#define ACPI_MOVE_64_TO_64(d, s) *(u64 *)(void *)(d) = *(u64 *)(void *)(s)
 
#else
/*
* The hardware does not support unaligned transfers. We must move the
* data one byte at a time. These macros work whether the source or
* the destination (or both) is/are unaligned. (Little-endian move)
*/
 
/* 16-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_16_TO_16(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];}
 
#define ACPI_MOVE_16_TO_32(d, s) {(*(u32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
#define ACPI_MOVE_16_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
 
/* 32-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
 
#define ACPI_MOVE_32_TO_32(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];}
 
#define ACPI_MOVE_32_TO_64(d, s) {(*(u64 *)(void *)(d)) = 0; ACPI_MOVE_32_TO_32(d, s);}
 
/* 64-bit source, 16/32/64 destination */
 
#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
#define ACPI_MOVE_64_TO_64(d, s) {(( u8 *)(void *)(d))[0] = ((u8 *)(void *)(s))[0];\
(( u8 *)(void *)(d))[1] = ((u8 *)(void *)(s))[1];\
(( u8 *)(void *)(d))[2] = ((u8 *)(void *)(s))[2];\
(( u8 *)(void *)(d))[3] = ((u8 *)(void *)(s))[3];\
(( u8 *)(void *)(d))[4] = ((u8 *)(void *)(s))[4];\
(( u8 *)(void *)(d))[5] = ((u8 *)(void *)(s))[5];\
(( u8 *)(void *)(d))[6] = ((u8 *)(void *)(s))[6];\
(( u8 *)(void *)(d))[7] = ((u8 *)(void *)(s))[7];}
#endif
#endif
 
/*
* Fast power-of-two math macros for non-optimized compilers
*/
#define _ACPI_DIV(value, power_of2) ((u32) ((value) >> (power_of2)))
#define _ACPI_MUL(value, power_of2) ((u32) ((value) << (power_of2)))
#define _ACPI_MOD(value, divisor) ((u32) ((value) & ((divisor) -1)))
 
#define ACPI_DIV_2(a) _ACPI_DIV(a, 1)
#define ACPI_MUL_2(a) _ACPI_MUL(a, 1)
#define ACPI_MOD_2(a) _ACPI_MOD(a, 2)
 
#define ACPI_DIV_4(a) _ACPI_DIV(a, 2)
#define ACPI_MUL_4(a) _ACPI_MUL(a, 2)
#define ACPI_MOD_4(a) _ACPI_MOD(a, 4)
 
#define ACPI_DIV_8(a) _ACPI_DIV(a, 3)
#define ACPI_MUL_8(a) _ACPI_MUL(a, 3)
#define ACPI_MOD_8(a) _ACPI_MOD(a, 8)
 
#define ACPI_DIV_16(a) _ACPI_DIV(a, 4)
#define ACPI_MUL_16(a) _ACPI_MUL(a, 4)
#define ACPI_MOD_16(a) _ACPI_MOD(a, 16)
 
#define ACPI_DIV_32(a) _ACPI_DIV(a, 5)
#define ACPI_MUL_32(a) _ACPI_MUL(a, 5)
#define ACPI_MOD_32(a) _ACPI_MOD(a, 32)
 
/* Test for ASCII character */
 
#define ACPI_IS_ASCII(c) ((c) < 0x80)
 
/* Signed integers */
 
#define ACPI_SIGN_POSITIVE 0
#define ACPI_SIGN_NEGATIVE 1
 
/*
* Rounding macros (Power of two boundaries only)
*/
#define ACPI_ROUND_DOWN(value, boundary) (((acpi_size)(value)) & \
(~(((acpi_size) boundary)-1)))
 
#define ACPI_ROUND_UP(value, boundary) ((((acpi_size)(value)) + \
(((acpi_size) boundary)-1)) & \
(~(((acpi_size) boundary)-1)))
 
/* Note: sizeof(acpi_size) evaluates to either 4 or 8 (32- vs 64-bit mode) */
 
#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a, 4)
#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a, 8)
#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a, sizeof(acpi_size))
 
#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a, 4)
#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a, 8)
#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a, sizeof(acpi_size))
 
#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
 
#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
 
/* Generic (non-power-of-two) rounding */
 
#define ACPI_ROUND_UP_TO(value, boundary) (((value) + ((boundary)-1)) / (boundary))
 
#define ACPI_IS_MISALIGNED(value) (((acpi_size) value) & (sizeof(acpi_size)-1))
 
/*
* Bitmask creation
* Bit positions start at zero.
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_UINT64_MAX) << ((u32) (position))))
#define ACPI_MASK_BITS_BELOW(position) ((ACPI_UINT64_MAX) << ((u32) (position)))
 
/* Bitfields within ACPI registers */
 
#define ACPI_REGISTER_PREPARE_BITS(val, pos, mask) \
((val << pos) & mask)
 
#define ACPI_REGISTER_INSERT_VALUE(reg, pos, mask, val) \
reg = (reg & (~(mask))) | ACPI_REGISTER_PREPARE_BITS(val, pos, mask)
 
#define ACPI_INSERT_BITS(target, mask, source) \
target = ((target & (~(mask))) | (source & mask))
 
/* Generic bitfield macros and masks */
 
#define ACPI_GET_BITS(source_ptr, position, mask) \
((*source_ptr >> position) & mask)
 
#define ACPI_SET_BITS(target_ptr, position, mask, value) \
(*target_ptr |= ((value & mask) << position))
 
#define ACPI_1BIT_MASK 0x00000001
#define ACPI_2BIT_MASK 0x00000003
#define ACPI_3BIT_MASK 0x00000007
#define ACPI_4BIT_MASK 0x0000000F
#define ACPI_5BIT_MASK 0x0000001F
#define ACPI_6BIT_MASK 0x0000003F
#define ACPI_7BIT_MASK 0x0000007F
#define ACPI_8BIT_MASK 0x000000FF
#define ACPI_16BIT_MASK 0x0000FFFF
#define ACPI_24BIT_MASK 0x00FFFFFF
 
/* Macros to extract flag bits from position zero */
 
#define ACPI_GET_1BIT_FLAG(value) ((value) & ACPI_1BIT_MASK)
#define ACPI_GET_2BIT_FLAG(value) ((value) & ACPI_2BIT_MASK)
#define ACPI_GET_3BIT_FLAG(value) ((value) & ACPI_3BIT_MASK)
#define ACPI_GET_4BIT_FLAG(value) ((value) & ACPI_4BIT_MASK)
 
/* Macros to extract flag bits from position one and above */
 
#define ACPI_EXTRACT_1BIT_FLAG(field, position) (ACPI_GET_1BIT_FLAG ((field) >> position))
#define ACPI_EXTRACT_2BIT_FLAG(field, position) (ACPI_GET_2BIT_FLAG ((field) >> position))
#define ACPI_EXTRACT_3BIT_FLAG(field, position) (ACPI_GET_3BIT_FLAG ((field) >> position))
#define ACPI_EXTRACT_4BIT_FLAG(field, position) (ACPI_GET_4BIT_FLAG ((field) >> position))
 
/* ACPI Pathname helpers */
 
#define ACPI_IS_ROOT_PREFIX(c) ((c) == (u8) 0x5C) /* Backslash */
#define ACPI_IS_PARENT_PREFIX(c) ((c) == (u8) 0x5E) /* Carat */
#define ACPI_IS_PATH_SEPARATOR(c) ((c) == (u8) 0x2E) /* Period (dot) */
 
/*
* An object of type struct acpi_namespace_node can appear in some contexts
* where a pointer to an object of type union acpi_operand_object can also
* appear. This macro is used to distinguish them.
*
* The "DescriptorType" field is the second field in both structures.
*/
#define ACPI_GET_DESCRIPTOR_PTR(d) (((union acpi_descriptor *)(void *)(d))->common.common_pointer)
#define ACPI_SET_DESCRIPTOR_PTR(d, p) (((union acpi_descriptor *)(void *)(d))->common.common_pointer = (p))
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = (t))
 
/*
* Macros for the master AML opcode table
*/
#if defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
{name, (u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
#else
#define ACPI_OP(name, Pargs, Iargs, obj_type, class, type, flags) \
{(u32)(Pargs), (u32)(Iargs), (u32)(flags), obj_type, class, type}
#endif
 
#define ARG_TYPE_WIDTH 5
#define ARG_1(x) ((u32)(x))
#define ARG_2(x) ((u32)(x) << (1 * ARG_TYPE_WIDTH))
#define ARG_3(x) ((u32)(x) << (2 * ARG_TYPE_WIDTH))
#define ARG_4(x) ((u32)(x) << (3 * ARG_TYPE_WIDTH))
#define ARG_5(x) ((u32)(x) << (4 * ARG_TYPE_WIDTH))
#define ARG_6(x) ((u32)(x) << (5 * ARG_TYPE_WIDTH))
 
#define ARGI_LIST1(a) (ARG_1(a))
#define ARGI_LIST2(a, b) (ARG_1(b)|ARG_2(a))
#define ARGI_LIST3(a, b, c) (ARG_1(c)|ARG_2(b)|ARG_3(a))
#define ARGI_LIST4(a, b, c, d) (ARG_1(d)|ARG_2(c)|ARG_3(b)|ARG_4(a))
#define ARGI_LIST5(a, b, c, d, e) (ARG_1(e)|ARG_2(d)|ARG_3(c)|ARG_4(b)|ARG_5(a))
#define ARGI_LIST6(a, b, c, d, e, f) (ARG_1(f)|ARG_2(e)|ARG_3(d)|ARG_4(c)|ARG_5(b)|ARG_6(a))
 
#define ARGP_LIST1(a) (ARG_1(a))
#define ARGP_LIST2(a, b) (ARG_1(a)|ARG_2(b))
#define ARGP_LIST3(a, b, c) (ARG_1(a)|ARG_2(b)|ARG_3(c))
#define ARGP_LIST4(a, b, c, d) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d))
#define ARGP_LIST5(a, b, c, d, e) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e))
#define ARGP_LIST6(a, b, c, d, e, f) (ARG_1(a)|ARG_2(b)|ARG_3(c)|ARG_4(d)|ARG_5(e)|ARG_6(f))
 
#define GET_CURRENT_ARG_TYPE(list) (list & ((u32) 0x1F))
#define INCREMENT_ARG_LIST(list) (list >>= ((u32) ARG_TYPE_WIDTH))
 
/*
* Ascii error messages can be configured out
*/
#ifndef ACPI_NO_ERROR_MESSAGES
/*
* Error reporting. Callers module and line number are inserted by AE_INFO,
* the plist contains a set of parens to allow variable-length lists.
* These macros are used for both the debug and non-debug versions of the code.
*/
#define ACPI_ERROR_NAMESPACE(s, e) acpi_ut_namespace_error (AE_INFO, s, e);
#define ACPI_ERROR_METHOD(s, n, p, e) acpi_ut_method_error (AE_INFO, s, n, p, e);
#define ACPI_WARN_PREDEFINED(plist) acpi_ut_predefined_warning plist
#define ACPI_INFO_PREDEFINED(plist) acpi_ut_predefined_info plist
#define ACPI_BIOS_ERROR_PREDEFINED(plist) acpi_ut_predefined_bios_error plist
 
#else
 
/* No error messages */
 
#define ACPI_ERROR_NAMESPACE(s, e)
#define ACPI_ERROR_METHOD(s, n, p, e)
#define ACPI_WARN_PREDEFINED(plist)
#define ACPI_INFO_PREDEFINED(plist)
#define ACPI_BIOS_ERROR_PREDEFINED(plist)
 
#endif /* ACPI_NO_ERROR_MESSAGES */
 
#if (!ACPI_REDUCED_HARDWARE)
#define ACPI_HW_OPTIONAL_FUNCTION(addr) addr
#else
#define ACPI_HW_OPTIONAL_FUNCTION(addr) NULL
#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
*/
 
/* Generate a UUID */
 
#define ACPI_INIT_UUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
(a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
(b) & 0xFF, ((b) >> 8) & 0xFF, \
(c) & 0xFF, ((c) >> 8) & 0xFF, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
 
#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
 
#endif /* ACMACROS_H */
/drivers/acpi/acpica/acnamesp.h
0,0 → 1,407
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACNAMESP_H__
#define __ACNAMESP_H__
 
/* To search the entire name space, pass this as search_base */
 
#define ACPI_NS_ALL ((acpi_handle)0)
 
/*
* Elements of acpi_ns_properties are bit significant
* and should be one-to-one with values of acpi_object_type
*/
#define ACPI_NS_NORMAL 0
#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
 
/* Flags for acpi_ns_lookup, acpi_ns_search_and_enter */
 
#define ACPI_NS_NO_UPSEARCH 0
#define ACPI_NS_SEARCH_PARENT 0x01
#define ACPI_NS_DONT_OPEN_SCOPE 0x02
#define ACPI_NS_NO_PEER_SEARCH 0x04
#define ACPI_NS_ERROR_IF_FOUND 0x08
#define ACPI_NS_PREFIX_IS_SCOPE 0x10
#define ACPI_NS_EXTERNAL 0x20
#define ACPI_NS_TEMPORARY 0x40
#define ACPI_NS_OVERRIDE_IF_FOUND 0x80
 
/* Flags for acpi_ns_walk_namespace */
 
#define ACPI_NS_WALK_NO_UNLOCK 0
#define ACPI_NS_WALK_UNLOCK 0x01
#define ACPI_NS_WALK_TEMP_NODES 0x02
 
/* Object is not a package element */
 
#define ACPI_NOT_PACKAGE_ELEMENT ACPI_UINT32_MAX
 
/* Always emit warning message, not dependent on node flags */
 
#define ACPI_WARN_ALWAYS 0
 
/*
* nsinit - Namespace initialization
*/
acpi_status acpi_ns_initialize_objects(void);
 
acpi_status acpi_ns_initialize_devices(void);
 
/*
* nsload - Namespace loading
*/
acpi_status acpi_ns_load_namespace(void);
 
acpi_status
acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node);
 
/*
* nswalk - walk the namespace
*/
acpi_status
acpi_ns_walk_namespace(acpi_object_type type,
acpi_handle start_object,
u32 max_depth,
u32 flags,
acpi_walk_callback descending_callback,
acpi_walk_callback ascending_callback,
void *context, void **return_value);
 
struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node
*parent,
struct acpi_namespace_node
*child);
 
struct acpi_namespace_node *acpi_ns_get_next_node_typed(acpi_object_type type,
struct
acpi_namespace_node
*parent,
struct
acpi_namespace_node
*child);
 
/*
* nsparse - table parsing
*/
acpi_status
acpi_ns_parse_table(u32 table_index, struct acpi_namespace_node *start_node);
 
acpi_status
acpi_ns_one_complete_parse(u32 pass_number,
u32 table_index,
struct acpi_namespace_node *start_node);
 
/*
* nsaccess - Top-level namespace access
*/
acpi_status acpi_ns_root_initialize(void);
 
acpi_status
acpi_ns_lookup(union acpi_generic_state *scope_info,
char *name,
acpi_object_type type,
acpi_interpreter_mode interpreter_mode,
u32 flags,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node **ret_node);
 
/*
* nsalloc - Named object allocation/deallocation
*/
struct acpi_namespace_node *acpi_ns_create_node(u32 name);
 
void acpi_ns_delete_node(struct acpi_namespace_node *node);
 
void acpi_ns_remove_node(struct acpi_namespace_node *node);
 
void
acpi_ns_delete_namespace_subtree(struct acpi_namespace_node *parent_handle);
 
void acpi_ns_delete_namespace_by_owner(acpi_owner_id owner_id);
 
void acpi_ns_detach_object(struct acpi_namespace_node *node);
 
void acpi_ns_delete_children(struct acpi_namespace_node *parent);
 
int acpi_ns_compare_names(char *name1, char *name2);
 
/*
* nsconvert - Dynamic object conversion routines
*/
acpi_status
acpi_ns_convert_to_integer(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
 
acpi_status
acpi_ns_convert_to_string(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
 
acpi_status
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,
union acpi_operand_object **return_object);
 
acpi_status
acpi_ns_convert_to_resource(union acpi_operand_object *original_object,
union acpi_operand_object **return_object);
 
/*
* nsdump - Namespace dump/print utilities
*/
void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth);
 
void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level);
 
void
acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component);
 
void acpi_ns_print_pathname(u32 num_segments, char *pathname);
 
acpi_status
acpi_ns_dump_one_object(acpi_handle obj_handle,
u32 level, void *context, void **return_value);
 
void
acpi_ns_dump_objects(acpi_object_type type,
u8 display_type,
u32 max_depth,
acpi_owner_id owner_id, acpi_handle start_handle);
 
void
acpi_ns_dump_object_paths(acpi_object_type type,
u8 display_type,
u32 max_depth,
acpi_owner_id owner_id, acpi_handle start_handle);
 
/*
* nseval - Namespace evaluation functions
*/
acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info);
 
void acpi_ns_exec_module_code_list(void);
 
/*
* nsarguments - Argument count/type checking for predefined/reserved names
*/
void
acpi_ns_check_argument_count(char *pathname,
struct acpi_namespace_node *node,
u32 user_param_count,
const union acpi_predefined_info *info);
 
void
acpi_ns_check_acpi_compliance(char *pathname,
struct acpi_namespace_node *node,
const union acpi_predefined_info *predefined);
 
void acpi_ns_check_argument_types(struct acpi_evaluate_info *info);
 
/*
* nspredef - Return value checking for predefined/reserved names
*/
acpi_status
acpi_ns_check_return_value(struct acpi_namespace_node *node,
struct acpi_evaluate_info *info,
u32 user_param_count,
acpi_status return_status,
union acpi_operand_object **return_object);
 
acpi_status
acpi_ns_check_object_type(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr,
u32 expected_btypes, u32 package_index);
 
/*
* nsprepkg - Validation of predefined name packages
*/
acpi_status
acpi_ns_check_package(struct acpi_evaluate_info *info,
union acpi_operand_object **return_object_ptr);
 
/*
* nsnames - Name and Scope manipulation
*/
u32 acpi_ns_opens_scope(acpi_object_type type);
 
char *acpi_ns_get_external_pathname(struct acpi_namespace_node *node);
 
u32
acpi_ns_build_normalized_path(struct acpi_namespace_node *node,
char *full_path, u32 path_size, u8 no_trailing);
 
char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,
u8 no_trailing);
 
char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);
 
acpi_status
acpi_ns_handle_to_pathname(acpi_handle target_handle,
struct acpi_buffer *buffer, u8 no_trailing);
 
u8
acpi_ns_pattern_match(struct acpi_namespace_node *obj_node, char *search_for);
 
acpi_status
acpi_ns_get_node(struct acpi_namespace_node *prefix_node,
const char *external_pathname,
u32 flags, struct acpi_namespace_node **out_node);
 
acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node);
 
/*
* nsobject - Object management for namespace nodes
*/
acpi_status
acpi_ns_attach_object(struct acpi_namespace_node *node,
union acpi_operand_object *object, acpi_object_type type);
 
union acpi_operand_object *acpi_ns_get_attached_object(struct
acpi_namespace_node
*node);
 
union acpi_operand_object *acpi_ns_get_secondary_object(union
acpi_operand_object
*obj_desc);
 
acpi_status
acpi_ns_attach_data(struct acpi_namespace_node *node,
acpi_object_handler handler, void *data);
 
acpi_status
acpi_ns_detach_data(struct acpi_namespace_node *node,
acpi_object_handler handler);
 
acpi_status
acpi_ns_get_attached_data(struct acpi_namespace_node *node,
acpi_object_handler handler, void **data);
 
/*
* nsrepair - General return object repair for all
* predefined methods/objects
*/
acpi_status
acpi_ns_simple_repair(struct acpi_evaluate_info *info,
u32 expected_btypes,
u32 package_index,
union acpi_operand_object **return_object_ptr);
 
acpi_status
acpi_ns_wrap_with_package(struct acpi_evaluate_info *info,
union acpi_operand_object *original_object,
union acpi_operand_object **obj_desc_ptr);
 
acpi_status
acpi_ns_repair_null_element(struct acpi_evaluate_info *info,
u32 expected_btypes,
u32 package_index,
union acpi_operand_object **return_object_ptr);
 
void
acpi_ns_remove_null_elements(struct acpi_evaluate_info *info,
u8 package_type,
union acpi_operand_object *obj_desc);
 
/*
* nsrepair2 - Return object repair for specific
* predefined methods/objects
*/
acpi_status
acpi_ns_complex_repairs(struct acpi_evaluate_info *info,
struct acpi_namespace_node *node,
acpi_status validate_status,
union acpi_operand_object **return_object_ptr);
 
/*
* nssearch - Namespace searching and entry
*/
acpi_status
acpi_ns_search_and_enter(u32 entry_name,
struct acpi_walk_state *walk_state,
struct acpi_namespace_node *node,
acpi_interpreter_mode interpreter_mode,
acpi_object_type type,
u32 flags, struct acpi_namespace_node **ret_node);
 
acpi_status
acpi_ns_search_one_scope(u32 entry_name,
struct acpi_namespace_node *node,
acpi_object_type type,
struct acpi_namespace_node **ret_node);
 
void
acpi_ns_install_node(struct acpi_walk_state *walk_state,
struct acpi_namespace_node *parent_node,
struct acpi_namespace_node *node, acpi_object_type type);
 
/*
* nsutils - Utility functions
*/
acpi_object_type acpi_ns_get_type(struct acpi_namespace_node *node);
 
u32 acpi_ns_local(acpi_object_type type);
 
void
acpi_ns_print_node_pathname(struct acpi_namespace_node *node, const char *msg);
 
acpi_status acpi_ns_build_internal_name(struct acpi_namestring_info *info);
 
void acpi_ns_get_internal_name_length(struct acpi_namestring_info *info);
 
acpi_status
acpi_ns_internalize_name(const char *dotted_name, char **converted_name);
 
acpi_status
acpi_ns_externalize_name(u32 internal_name_length,
const char *internal_name,
u32 * converted_name_length, char **converted_name);
 
struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle);
 
void acpi_ns_terminate(void);
 
#endif /* __ACNAMESP_H__ */
/drivers/acpi/acpica/acobject.h
0,0 → 1,465
/******************************************************************************
*
* Name: acobject.h - Definition of union acpi_operand_object (Internal object only)
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef _ACOBJECT_H
#define _ACOBJECT_H
 
/* acpisrc:struct_defs -- for acpisrc conversion */
 
/*
* The union acpi_operand_object is used to pass AML operands from the dispatcher
* to the interpreter, and to keep track of the various handlers such as
* address space handlers and notify handlers. The object is a constant
* size in order to allow it to be cached and reused.
*
* Note: The object is optimized to be aligned and will not work if it is
* byte-packed.
*/
#if ACPI_MACHINE_WIDTH == 64
#pragma pack(8)
#else
#pragma pack(4)
#endif
 
/*******************************************************************************
*
* Common Descriptors
*
******************************************************************************/
 
/*
* Common area for all objects.
*
* descriptor_type is used to differentiate between internal descriptors, and
* must be in the same place across all descriptors
*
* Note: The descriptor_type and Type fields must appear in the identical
* position in both the struct acpi_namespace_node and union acpi_operand_object
* structures.
*/
#define ACPI_OBJECT_COMMON_HEADER \
union acpi_operand_object *next_object; /* Objects linked to parent NS node */\
u8 descriptor_type; /* To differentiate various internal objs */\
u8 type; /* acpi_object_type */\
u16 reference_count; /* For object deletion management */\
u8 flags;
/*
* Note: There are 3 bytes available here before the
* next natural alignment boundary (for both 32/64 cases)
*/
 
/* Values for Flag byte above */
 
#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 */
 
/******************************************************************************
*
* Basic data types
*
*****************************************************************************/
 
struct acpi_object_common {
ACPI_OBJECT_COMMON_HEADER};
 
struct acpi_object_integer {
ACPI_OBJECT_COMMON_HEADER u8 fill[3]; /* Prevent warning on some compilers */
u64 value;
};
 
/*
* Note: The String and Buffer object must be identical through the
* pointer and length elements. There is code that depends on this.
*
* Fields common to both Strings and Buffers
*/
#define ACPI_COMMON_BUFFER_INFO(_type) \
_type *pointer; \
u32 length;
 
struct acpi_object_string { /* Null terminated, ASCII characters only */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(char) /* String in AML stream or allocated string */
};
 
struct acpi_object_buffer {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_BUFFER_INFO(u8) /* Buffer in AML stream or allocated buffer */
u32 aml_length;
u8 *aml_start;
struct acpi_namespace_node *node; /* Link back to parent node */
};
 
struct acpi_object_package {
ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Link back to parent node */
union acpi_operand_object **elements; /* Array of pointers to acpi_objects */
u8 *aml_start;
u32 aml_length;
u32 count; /* # of elements in package */
};
 
/******************************************************************************
*
* Complex data types
*
*****************************************************************************/
 
struct acpi_object_event {
ACPI_OBJECT_COMMON_HEADER acpi_semaphore os_semaphore; /* Actual OS synchronization object */
};
 
struct acpi_object_mutex {
ACPI_OBJECT_COMMON_HEADER u8 sync_level; /* 0-15, specified in Mutex() call */
u16 acquisition_depth; /* Allow multiple Acquires, same thread */
acpi_mutex os_mutex; /* Actual OS synchronization object */
acpi_thread_id thread_id; /* Current owner of the mutex */
struct acpi_thread_state *owner_thread; /* Current owner of the mutex */
union acpi_operand_object *prev; /* Link for list of acquired mutexes */
union acpi_operand_object *next; /* Link for list of acquired mutexes */
struct acpi_namespace_node *node; /* Containing namespace node */
u8 original_sync_level; /* Owner's original sync level (0-15) */
};
 
struct acpi_object_region {
ACPI_OBJECT_COMMON_HEADER u8 space_id;
struct acpi_namespace_node *node; /* Containing namespace node */
union acpi_operand_object *handler; /* Handler for region access */
union acpi_operand_object *next;
acpi_physical_address address;
u32 length;
};
 
struct acpi_object_method {
ACPI_OBJECT_COMMON_HEADER u8 info_flags;
u8 param_count;
u8 sync_level;
union acpi_operand_object *mutex;
union acpi_operand_object *node;
u8 *aml_start;
union {
acpi_internal_method implementation;
union acpi_operand_object *handler;
} dispatch;
 
u32 aml_length;
u8 thread_count;
acpi_owner_id owner_id;
};
 
/* Flags for info_flags field above */
 
#define ACPI_METHOD_MODULE_LEVEL 0x01 /* Method is actually module-level code */
#define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */
#define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */
#define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */
#define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */
#define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */
 
/******************************************************************************
*
* Objects that can be notified. All share a common notify_info area.
*
*****************************************************************************/
 
/*
* Common fields for objects that support ASL notifications
*/
#define ACPI_COMMON_NOTIFY_INFO \
union acpi_operand_object *notify_list[2]; /* Handlers for system/device notifies */\
union acpi_operand_object *handler; /* Handler for Address space */
 
struct acpi_object_notify_common { /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
 
struct acpi_object_device {
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_NOTIFY_INFO struct acpi_gpe_block_info *gpe_block;
};
 
struct acpi_object_power_resource {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO u32 system_level;
u32 resource_order;
};
 
struct acpi_object_processor {
ACPI_OBJECT_COMMON_HEADER
/* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
u8 proc_id;
u8 length;
ACPI_COMMON_NOTIFY_INFO acpi_io_address address;
};
 
struct acpi_object_thermal_zone {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_NOTIFY_INFO};
 
/******************************************************************************
*
* Fields. All share a common header/info field.
*
*****************************************************************************/
 
/*
* Common bitfield for the field objects
* "Field Datum" -- a datum from the actual field object
* "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
*/
#define ACPI_COMMON_FIELD_INFO \
u8 field_flags; /* Access, update, and lock bits */\
u8 attribute; /* From access_as keyword */\
u8 access_byte_width; /* Read/Write size in bytes */\
struct acpi_namespace_node *node; /* Link back to parent node */\
u32 bit_length; /* Length of field in bits */\
u32 base_byte_offset; /* Byte offset within containing object */\
u32 value; /* Value to store into the Bank or Index register */\
u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
u8 access_length; /* For serial regions/fields */
 
 
struct acpi_object_field_common { /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Parent Operation Region object (REGION/BANK fields only) */
};
 
struct acpi_object_region_field {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO u16 resource_length;
union acpi_operand_object *region_obj; /* Containing op_region object */
u8 *resource_buffer; /* resource_template for serial regions/fields */
u16 pin_number_index; /* Index relative to previous Connection/Template */
};
 
struct acpi_object_bank_field {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *region_obj; /* Containing op_region object */
union acpi_operand_object *bank_obj; /* bank_select Register object */
};
 
struct acpi_object_index_field {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO
/*
* No "RegionObj" pointer needed since the Index and Data registers
* are each field definitions unto themselves.
*/
union acpi_operand_object *index_obj; /* Index register */
union acpi_operand_object *data_obj; /* Data register */
};
 
/* The buffer_field is different in that it is part of a Buffer, not an op_region */
 
struct acpi_object_buffer_field {
ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO union acpi_operand_object *buffer_obj; /* Containing Buffer object */
};
 
/******************************************************************************
*
* Objects for handlers
*
*****************************************************************************/
 
struct acpi_object_notify_handler {
ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *node; /* Parent device */
u32 handler_type; /* Type: Device/System/Both */
acpi_notify_handler handler; /* Handler address */
void *context;
union acpi_operand_object *next[2]; /* Device and System handler lists */
};
 
struct acpi_object_addr_handler {
ACPI_OBJECT_COMMON_HEADER u8 space_id;
u8 handler_flags;
acpi_adr_space_handler handler;
struct acpi_namespace_node *node; /* Parent device */
void *context;
acpi_adr_space_setup setup;
union acpi_operand_object *region_list; /* Regions using this handler */
union acpi_operand_object *next;
};
 
/* Flags for address handler (handler_flags) */
 
#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
 
/******************************************************************************
*
* Special internal objects
*
*****************************************************************************/
 
/*
* The Reference object is used for these opcodes:
* Arg[0-6], Local[0-7], index_op, name_op, ref_of_op, load_op, load_table_op, debug_op
* The Reference.Class differentiates these types.
*/
struct acpi_object_reference {
ACPI_OBJECT_COMMON_HEADER u8 class; /* Reference Class */
u8 target_type; /* Used for Index Op */
u8 reserved;
void *object; /* name_op=>HANDLE to obj, index_op=>union acpi_operand_object */
struct acpi_namespace_node *node; /* ref_of or Namepath */
union acpi_operand_object **where; /* Target of Index */
u8 *index_pointer; /* Used for Buffers and Strings */
u32 value; /* Used for Local/Arg/Index/ddb_handle */
};
 
/* Values for Reference.Class above */
 
typedef enum {
ACPI_REFCLASS_LOCAL = 0, /* Method local */
ACPI_REFCLASS_ARG = 1, /* Method argument */
ACPI_REFCLASS_REFOF = 2, /* Result of ref_of() TBD: Split to Ref/Node and Ref/operand_obj? */
ACPI_REFCLASS_INDEX = 3, /* Result of Index() */
ACPI_REFCLASS_TABLE = 4, /* ddb_handle - Load(), load_table() */
ACPI_REFCLASS_NAME = 5, /* Reference to a named object */
ACPI_REFCLASS_DEBUG = 6, /* Debug object */
 
ACPI_REFCLASS_MAX = 6
} ACPI_REFERENCE_CLASSES;
 
/*
* Extra object is used as additional storage for types that
* have AML code in their declarations (term_args) that must be
* evaluated at run time.
*
* Currently: Region and field_unit types
*/
struct acpi_object_extra {
ACPI_OBJECT_COMMON_HEADER struct acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
struct acpi_namespace_node *scope_node;
void *region_context; /* Region-specific data */
u8 *aml_start;
u32 aml_length;
};
 
/* Additional data that can be attached to namespace nodes */
 
struct acpi_object_data {
ACPI_OBJECT_COMMON_HEADER acpi_object_handler handler;
void *pointer;
};
 
/* Structure used when objects are cached for reuse */
 
struct acpi_object_cache_list {
ACPI_OBJECT_COMMON_HEADER union acpi_operand_object *next; /* Link for object cache and internal lists */
};
 
/******************************************************************************
*
* union acpi_operand_object descriptor - a giant union of all of the above
*
*****************************************************************************/
 
union acpi_operand_object {
struct acpi_object_common common;
struct acpi_object_integer integer;
struct acpi_object_string string;
struct acpi_object_buffer buffer;
struct acpi_object_package package;
struct acpi_object_event event;
struct acpi_object_method method;
struct acpi_object_mutex mutex;
struct acpi_object_region region;
struct acpi_object_notify_common common_notify;
struct acpi_object_device device;
struct acpi_object_power_resource power_resource;
struct acpi_object_processor processor;
struct acpi_object_thermal_zone thermal_zone;
struct acpi_object_field_common common_field;
struct acpi_object_region_field field;
struct acpi_object_buffer_field buffer_field;
struct acpi_object_bank_field bank_field;
struct acpi_object_index_field index_field;
struct acpi_object_notify_handler notify;
struct acpi_object_addr_handler address_space;
struct acpi_object_reference reference;
struct acpi_object_extra extra;
struct acpi_object_data data;
struct acpi_object_cache_list cache;
 
/*
* Add namespace node to union in order to simplify code that accepts both
* ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
* a common descriptor_type field in order to differentiate them.
*/
struct acpi_namespace_node node;
};
 
/******************************************************************************
*
* union acpi_descriptor - objects that share a common descriptor identifier
*
*****************************************************************************/
 
/* Object descriptor types */
 
#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
#define ACPI_DESC_TYPE_STATE 0x02
#define ACPI_DESC_TYPE_STATE_UPDATE 0x03
#define ACPI_DESC_TYPE_STATE_PACKAGE 0x04
#define ACPI_DESC_TYPE_STATE_CONTROL 0x05
#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06
#define ACPI_DESC_TYPE_STATE_PSCOPE 0x07
#define ACPI_DESC_TYPE_STATE_WSCOPE 0x08
#define ACPI_DESC_TYPE_STATE_RESULT 0x09
#define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A
#define ACPI_DESC_TYPE_STATE_THREAD 0x0B
#define ACPI_DESC_TYPE_WALK 0x0C
#define ACPI_DESC_TYPE_PARSER 0x0D
#define ACPI_DESC_TYPE_OPERAND 0x0E
#define ACPI_DESC_TYPE_NAMED 0x0F
#define ACPI_DESC_TYPE_MAX 0x0F
 
struct acpi_common_descriptor {
void *common_pointer;
u8 descriptor_type; /* To differentiate various internal objs */
};
 
union acpi_descriptor {
struct acpi_common_descriptor common;
union acpi_operand_object object;
struct acpi_namespace_node node;
union acpi_parse_object op;
};
 
#pragma pack()
 
#endif /* _ACOBJECT_H */
/drivers/acpi/acpica/acopcode.h
0,0 → 1,329
/******************************************************************************
*
* Name: acopcode.h - AML opcode information for the AML parser and interpreter
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACOPCODE_H__
#define __ACOPCODE_H__
 
#define MAX_EXTENDED_OPCODE 0x88
#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
#define MAX_INTERNAL_OPCODE
#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
 
/* Used for non-assigned opcodes */
 
#define _UNK 0x6B
 
/*
* Reserved ASCII characters. Do not use any of these for
* internal opcodes, since they are used to differentiate
* name strings from AML opcodes
*/
#define _ASC 0x6C
#define _NAM 0x6C
#define _PFX 0x6D
 
/*
* All AML opcodes and the parse-time arguments for each. Used by the AML
* parser Each list is compressed into a 32-bit number and stored in the
* master opcode table (in psopcode.c).
*/
#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
#define ARGP_ARG0 ARG_NONE
#define ARGP_ARG1 ARG_NONE
#define ARGP_ARG2 ARG_NONE
#define ARGP_ARG3 ARG_NONE
#define ARGP_ARG4 ARG_NONE
#define ARGP_ARG5 ARG_NONE
#define ARGP_ARG6 ARG_NONE
#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_BREAK_OP ARG_NONE
#define ARGP_BREAK_POINT_OP ARG_NONE
#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
#define ARGP_CONNECTFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_CONTINUE_OP ARG_NONE
#define ARGP_COPY_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SIMPLENAME)
#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_DEBUG_OP ARG_NONE
#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
#define ARGP_EXTERNAL_OP ARGP_LIST3 (ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_BYTEDATA)
#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_LOCAL0 ARG_NONE
#define ARGP_LOCAL1 ARG_NONE
#define ARGP_LOCAL2 ARG_NONE
#define ARGP_LOCAL3 ARG_NONE
#define ARGP_LOCAL4 ARG_NONE
#define ARGP_LOCAL5 ARG_NONE
#define ARGP_LOCAL6 ARG_NONE
#define ARGP_LOCAL7 ARG_NONE
#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_NOOP_OP ARG_NONE
#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
#define ARGP_ONE_OP ARG_NONE
#define ARGP_ONES_OP ARG_NONE
#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_REVISION_OP ARG_NONE
#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
#define ARGP_SERIALFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
#define ARGP_TIMER_OP ARG_NONE
#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
#define ARGP_ZERO_OP ARG_NONE
 
/*
* All AML opcodes and the runtime arguments for each. Used by the AML
* interpreter Each list is compressed into a 32-bit number and stored
* in the master opcode table (in psopcode.c).
*
* (Used by prep_operands procedure and the ASL Compiler)
*/
#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
#define ARGI_ARG0 ARG_NONE
#define ARGI_ARG1 ARG_NONE
#define ARGI_ARG2 ARG_NONE
#define ARGI_ARG3 ARG_NONE
#define ARGI_ARG4 ARG_NONE
#define ARGI_ARG5 ARG_NONE
#define ARGI_ARG6 ARG_NONE
#define ARGI_BANK_FIELD_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_BREAK_OP ARG_NONE
#define ARGI_BREAK_POINT_OP ARG_NONE
#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
#define ARGI_CONNECTFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
#define ARGI_DEBUG_OP ARG_NONE
#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_TARGETREF)
#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
#define ARGI_EXTERNAL_OP ARGI_LIST3 (ARGI_STRING, ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_IF_OP ARGI_INVALID_OPCODE
#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_TARGETREF)
#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_BUFFER,ARGI_TARGETREF)
#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
#define ARGI_LOCAL0 ARG_NONE
#define ARGI_LOCAL1 ARG_NONE
#define ARGI_LOCAL2 ARG_NONE
#define ARGI_LOCAL3 ARG_NONE
#define ARGI_LOCAL4 ARG_NONE
#define ARGI_LOCAL5 ARG_NONE
#define ARGI_LOCAL6 ARG_NONE
#define ARGI_LOCAL7 ARG_NONE
#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_COMPUTEDATA, ARGI_INTEGER,ARGI_COMPUTEDATA,ARGI_INTEGER)
#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
#define ARGI_NAME_OP ARGI_INVALID_OPCODE
#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
#define ARGI_NOOP_OP ARG_NONE
#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
#define ARGI_ONE_OP ARG_NONE
#define ARGI_ONES_OP ARG_NONE
#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
#define ARGI_REVISION_OP ARG_NONE
#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
#define ARGI_SERIALFIELD_OP ARGI_INVALID_OPCODE
#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT)
#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
#define ARGI_STORE_OP ARGI_LIST2 (ARGI_DATAREFOBJ, ARGI_STORE_TARGET)
#define ARGI_STRING_OP ARGI_INVALID_OPCODE
#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
#define ARGI_TIMER_OP ARG_NONE
#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE)
#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
#define ARGI_WORD_OP ARGI_INVALID_OPCODE
#define ARGI_ZERO_OP ARG_NONE
 
#endif /* __ACOPCODE_H__ */
/drivers/acpi/acpica/acparser.h
0,0 → 1,253
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACPARSER_H__
#define __ACPARSER_H__
 
#define OP_HAS_RETURN_VALUE 1
 
/* Variable number of arguments. This field must be 32 bits */
 
#define ACPI_VAR_ARGS ACPI_UINT32_MAX
 
#define ACPI_PARSE_DELETE_TREE 0x0001
#define ACPI_PARSE_NO_TREE_DELETE 0x0000
#define ACPI_PARSE_TREE_MASK 0x0001
 
#define ACPI_PARSE_LOAD_PASS1 0x0010
#define ACPI_PARSE_LOAD_PASS2 0x0020
#define ACPI_PARSE_EXECUTE 0x0030
#define ACPI_PARSE_MODE_MASK 0x0030
 
#define ACPI_PARSE_DEFERRED_OP 0x0100
#define ACPI_PARSE_DISASSEMBLE 0x0200
 
#define ACPI_PARSE_MODULE_LEVEL 0x0400
 
/******************************************************************************
*
* Parser interfaces
*
*****************************************************************************/
 
extern const u8 acpi_gbl_short_op_index[];
extern const u8 acpi_gbl_long_op_index[];
 
/*
* psxface - Parser external interfaces
*/
acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info);
 
/*
* psargs - Parse AML opcode arguments
*/
u8 *acpi_ps_get_next_package_end(struct acpi_parse_state *parser_state);
 
char *acpi_ps_get_next_namestring(struct acpi_parse_state *parser_state);
 
void
acpi_ps_get_next_simple_arg(struct acpi_parse_state *parser_state,
u32 arg_type, union acpi_parse_object *arg);
 
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);
 
acpi_status
acpi_ps_get_next_arg(struct acpi_walk_state *walk_state,
struct acpi_parse_state *parser_state,
u32 arg_type, union acpi_parse_object **return_arg);
 
/*
* psfind
*/
union acpi_parse_object *acpi_ps_find_name(union acpi_parse_object *scope,
u32 name, u32 opcode);
 
union acpi_parse_object *acpi_ps_get_parent(union acpi_parse_object *op);
 
/*
* psobject - support for parse object processing
*/
acpi_status
acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
u8 *aml_op_start,
union acpi_parse_object *unnamed_op,
union acpi_parse_object **op);
 
acpi_status
acpi_ps_create_op(struct acpi_walk_state *walk_state,
u8 *aml_op_start, union acpi_parse_object **new_op);
 
acpi_status
acpi_ps_complete_op(struct acpi_walk_state *walk_state,
union acpi_parse_object **op, acpi_status status);
 
acpi_status
acpi_ps_complete_final_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op, acpi_status status);
 
/*
* psopinfo - AML Opcode information
*/
const struct acpi_opcode_info *acpi_ps_get_opcode_info(u16 opcode);
 
char *acpi_ps_get_opcode_name(u16 opcode);
 
u8 acpi_ps_get_argument_count(u32 op_type);
 
/*
* psparse - top level parsing routines
*/
acpi_status acpi_ps_parse_aml(struct acpi_walk_state *walk_state);
 
u32 acpi_ps_get_opcode_size(u32 opcode);
 
u16 acpi_ps_peek_opcode(struct acpi_parse_state *state);
 
acpi_status
acpi_ps_complete_this_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op);
 
acpi_status
acpi_ps_next_parse_state(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
acpi_status callback_status);
 
/*
* psloop - main parse loop
*/
acpi_status acpi_ps_parse_loop(struct acpi_walk_state *walk_state);
 
/*
* psscope - Scope stack management routines
*/
acpi_status
acpi_ps_init_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *root);
 
union acpi_parse_object *acpi_ps_get_parent_scope(struct acpi_parse_state
*state);
 
u8 acpi_ps_has_completed_scope(struct acpi_parse_state *parser_state);
 
void
acpi_ps_pop_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object **op, u32 *arg_list, u32 *arg_count);
 
acpi_status
acpi_ps_push_scope(struct acpi_parse_state *parser_state,
union acpi_parse_object *op,
u32 remaining_args, u32 arg_count);
 
void acpi_ps_cleanup_scope(struct acpi_parse_state *state);
 
/*
* pstree - parse tree manipulation routines
*/
void
acpi_ps_append_arg(union acpi_parse_object *op, union acpi_parse_object *arg);
 
union acpi_parse_object *acpi_ps_find(union acpi_parse_object *scope,
char *path, u16 opcode, u32 create);
 
union acpi_parse_object *acpi_ps_get_arg(union acpi_parse_object *op, u32 argn);
 
union acpi_parse_object *acpi_ps_get_depth_next(union acpi_parse_object *origin,
union acpi_parse_object *op);
 
/*
* pswalk - parse tree walk routines
*/
acpi_status
acpi_ps_walk_parsed_aml(union acpi_parse_object *start_op,
union acpi_parse_object *end_op,
union acpi_operand_object *mth_desc,
struct acpi_namespace_node *start_node,
union acpi_operand_object **params,
union acpi_operand_object **caller_return_desc,
acpi_owner_id owner_id,
acpi_parse_downwards descending_callback,
acpi_parse_upwards ascending_callback);
 
acpi_status
acpi_ps_get_next_walk_op(struct acpi_walk_state *walk_state,
union acpi_parse_object *op,
acpi_parse_upwards ascending_callback);
 
acpi_status acpi_ps_delete_completed_op(struct acpi_walk_state *walk_state);
 
void acpi_ps_delete_parse_tree(union acpi_parse_object *root);
 
/*
* psutils - parser utilities
*/
union acpi_parse_object *acpi_ps_create_scope_op(u8 *aml);
 
void acpi_ps_init_op(union acpi_parse_object *op, u16 opcode);
 
union acpi_parse_object *acpi_ps_alloc_op(u16 opcode, u8 *aml);
 
void acpi_ps_free_op(union acpi_parse_object *op);
 
u8 acpi_ps_is_leading_char(u32 c);
 
u32 acpi_ps_get_name(union acpi_parse_object *op);
 
void acpi_ps_set_name(union acpi_parse_object *op, u32 name);
 
/*
* psdump - display parser tree
*/
u32
acpi_ps_sprint_path(char *buffer_start,
u32 buffer_size, union acpi_parse_object *op);
 
u32
acpi_ps_sprint_op(char *buffer_start,
u32 buffer_size, union acpi_parse_object *op);
 
void acpi_ps_show(union acpi_parse_object *op);
 
#endif /* __ACPARSER_H__ */
/drivers/acpi/acpica/acpredef.h
0,0 → 1,1140
/******************************************************************************
*
* Name: acpredef - Information table for ACPI predefined methods and objects
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACPREDEF_H__
#define __ACPREDEF_H__
 
/******************************************************************************
*
* Return Package types
*
* 1) PTYPE1 packages do not contain subpackages.
*
* ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types:
* object type
* count
* object type
* count
*
* ACPI_PTYPE1_VAR: Variable-length length. Zero-length package is allowed:
* object type (Int/Buf/Ref)
*
* ACPI_PTYPE1_OPTION: Package has some required and some optional elements
* (Used for _PRW)
*
*
* 2) PTYPE2 packages contain a Variable-length number of subpackages. Each
* of the different types describe the contents of each of the subpackages.
*
* ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length
* parent package is allowed:
* object type
* count
* object type
* count
* (Used for _ALR,_MLS,_PSS,_TRT,_TSS)
*
* ACPI_PTYPE2_COUNT: Each subpackage has a count as first element.
* Zero-length parent package is allowed:
* object type
* (Used for _CSD,_PSD,_TSD)
*
* ACPI_PTYPE2_PKG_COUNT: Count of subpackages at start, 1 or 2 object types:
* object type
* count
* object type
* count
* (Used for _CST)
*
* ACPI_PTYPE2_FIXED: Each subpackage is of Fixed-length. Zero-length
* parent package is allowed.
* (Used for _PRT)
*
* ACPI_PTYPE2_MIN: Each subpackage has a Variable-length but minimum length.
* Zero-length parent package is allowed:
* (Used for _HPX)
*
* ACPI_PTYPE2_REV_FIXED: Revision at start, each subpackage is Fixed-length
* (Used for _ART, _FPS)
*
* ACPI_PTYPE2_FIX_VAR: Each subpackage consists of some fixed-length elements
* followed by an optional element. Zero-length parent package is allowed.
* object type
* count
* object type
* count = 0 (optional)
* (Used for _DLM)
*
* ACPI_PTYPE2_VAR_VAR: Variable number of subpackages, each of either a
* constant or variable length. The subpackages are preceded by a
* constant number of objects.
* (Used for _LPI, _RDI)
*
* ACPI_PTYPE2_UUID_PAIR: Each subpackage is preceded by a UUID Buffer. The UUID
* defines the format of the package. Zero-length parent package is
* allowed.
* (Used for _DSD)
*
*****************************************************************************/
 
enum acpi_return_package_types {
ACPI_PTYPE1_FIXED = 1,
ACPI_PTYPE1_VAR = 2,
ACPI_PTYPE1_OPTION = 3,
ACPI_PTYPE2 = 4,
ACPI_PTYPE2_COUNT = 5,
ACPI_PTYPE2_PKG_COUNT = 6,
ACPI_PTYPE2_FIXED = 7,
ACPI_PTYPE2_MIN = 8,
ACPI_PTYPE2_REV_FIXED = 9,
ACPI_PTYPE2_FIX_VAR = 10,
ACPI_PTYPE2_VAR_VAR = 11,
ACPI_PTYPE2_UUID_PAIR = 12
};
 
/* Support macros for users of the predefined info table */
 
#define METHOD_PREDEF_ARGS_MAX 4
#define METHOD_ARG_BIT_WIDTH 3
#define METHOD_ARG_MASK 0x0007
#define ARG_COUNT_IS_MINIMUM 0x8000
#define METHOD_MAX_ARG_TYPE ACPI_TYPE_PACKAGE
 
#define METHOD_GET_ARG_COUNT(arg_list) ((arg_list) & METHOD_ARG_MASK)
#define METHOD_GET_NEXT_TYPE(arg_list) (((arg_list) >>= METHOD_ARG_BIT_WIDTH) & METHOD_ARG_MASK)
 
/* Macros used to build the predefined info table */
 
#define METHOD_0ARGS 0
#define METHOD_1ARGS(a1) (1 | (a1 << 3))
#define METHOD_2ARGS(a1,a2) (2 | (a1 << 3) | (a2 << 6))
#define METHOD_3ARGS(a1,a2,a3) (3 | (a1 << 3) | (a2 << 6) | (a3 << 9))
#define METHOD_4ARGS(a1,a2,a3,a4) (4 | (a1 << 3) | (a2 << 6) | (a3 << 9) | (a4 << 12))
 
#define METHOD_RETURNS(type) (type)
#define METHOD_NO_RETURN_VALUE 0
 
#define PACKAGE_INFO(a,b,c,d,e,f) {{{(a),(b),(c),(d)}, ((((u16)(f)) << 8) | (e)), 0}}
 
/* Support macros for the resource descriptor info table */
 
#define WIDTH_1 0x0001
#define WIDTH_2 0x0002
#define WIDTH_3 0x0004
#define WIDTH_8 0x0008
#define WIDTH_16 0x0010
#define WIDTH_32 0x0020
#define WIDTH_64 0x0040
#define VARIABLE_DATA 0x0080
#define NUM_RESOURCE_WIDTHS 8
 
#define WIDTH_ADDRESS WIDTH_16 | WIDTH_32 | WIDTH_64
 
#ifdef ACPI_CREATE_PREDEFINED_TABLE
/******************************************************************************
*
* Predefined method/object information table.
*
* These are the names that can actually be evaluated via acpi_evaluate_object.
* Not present in this table are the following:
*
* 1) Predefined/Reserved names that are not usually evaluated via
* acpi_evaluate_object:
* _Lxx and _Exx GPE methods
* _Qxx EC methods
* _T_x compiler temporary variables
* _Wxx wake events
*
* 2) Predefined names that never actually exist within the AML code:
* Predefined resource descriptor field names
*
* 3) Predefined names that are implemented within ACPICA:
* _OSI
*
* The main entries in the table each contain the following items:
*
* name - The ACPI reserved name
* argument_list - Contains (in 16 bits), the number of required
* arguments to the method (3 bits), and a 3-bit type
* field for each argument (up to 4 arguments). The
* METHOD_?ARGS macros generate the correct packed data.
* expected_btypes - Allowed type(s) for the return value.
* 0 means that no return value is expected.
*
* For methods that return packages, the next entry in the table contains
* information about the expected structure of the package. This information
* is saved here (rather than in a separate table) in order to minimize the
* overall size of the stored data.
*
* Note: The additional braces are intended to promote portability.
*
* Note2: Table is used by the kernel-resident subsystem, the iASL compiler,
* and the acpi_help utility.
*
* TBD: _PRT - currently ignore reversed entries. Attempt to fix in nsrepair.
* Possibly fixing package elements like _BIF, etc.
*
*****************************************************************************/
 
const union acpi_predefined_info acpi_gbl_predefined_methods[] = {
{{"_AC0", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC1", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC2", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC3", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC4", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC5", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC6", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC7", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC8", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AC9", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_ADR", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_AEI", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_AL0", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL1", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL2", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL3", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL4", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL5", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL6", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL7", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL8", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_AL9", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_ALC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_ALI", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_ALP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_ALR", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 (Ints) */
PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 2, 0, 0, 0),
 
{{"_ALT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_ART", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Ref/11 Int) */
PACKAGE_INFO(ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_REFERENCE, 2,
ACPI_RTYPE_INTEGER, 11, 0),
 
{{"_BBN", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BCL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
 
{{"_BCM", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_BCT", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BDN", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BFS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_BIF", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (9 Int),(4 Str) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 9,
ACPI_RTYPE_STRING, 4, 0),
 
{{"_BIX", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int),(4 Str) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16,
ACPI_RTYPE_STRING, 4, 0),
 
{{"_BLT",
METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_BMA", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BMC", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_BMD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (5 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0),
 
{{"_BMS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BQC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BST", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
 
{{"_BTH", METHOD_1ARGS(ACPI_TYPE_INTEGER), /* ACPI 6.0 */
METHOD_NO_RETURN_VALUE}},
 
{{"_BTM", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_BTP", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_CBA", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See PCI firmware spec 3.0 */
 
{{"_CCA", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* ACPI 5.1 */
 
{{"_CDM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_CID", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Strs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING, 0,
0, 0, 0),
 
{{"_CLS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0, 0, 0),
 
{{"_CPC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints/Bufs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER, 0,
0, 0, 0),
 
{{"_CR3", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_CRS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_CRT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_CSD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n-1 Int) */
PACKAGE_INFO(ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
 
{{"_CST", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(n), n Pkg (1 Buf/3 Int) */
PACKAGE_INFO(ACPI_PTYPE2_PKG_COUNT, ACPI_RTYPE_BUFFER, 1,
ACPI_RTYPE_INTEGER, 3, 0),
 
{{"_CWS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_DCK", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_DCS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_DDC", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER)}},
 
{{"_DDN", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_STRING)}},
 
{{"_DEP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_DGS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_DIS", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_DLM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Ref, 0/1 Optional Buf/Ref) */
PACKAGE_INFO(ACPI_PTYPE2_FIX_VAR, ACPI_RTYPE_REFERENCE, 1,
ACPI_RTYPE_REFERENCE | ACPI_RTYPE_BUFFER, 0, 0),
 
{{"_DMA", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_DOD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
 
{{"_DOS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_DSD", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Buf, 1 Pkg */
PACKAGE_INFO(ACPI_PTYPE2_UUID_PAIR, ACPI_RTYPE_BUFFER, 1,
ACPI_RTYPE_PACKAGE, 1, 0),
 
{{"_DSM",
METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
ACPI_TYPE_PACKAGE),
METHOD_RETURNS(ACPI_RTYPE_ALL)}}, /* Must return a value, but it can be of any type */
 
{{"_DSS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_DSW",
METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_DTI", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_EC_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_EDL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_EJ0", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_EJ1", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_EJ2", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_EJ3", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_EJ4", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_EJD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_STRING)}},
 
{{"_ERR",
METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_STRING, ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* Internal use only, used by ACPICA test suites */
 
{{"_EVT", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_FDE", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_FDI", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (16 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 16, 0, 0, 0),
 
{{"_FDM", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_FIF", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
 
{{"_FIX", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Ints) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
 
{{"_FPS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (5 Int) */
PACKAGE_INFO(ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 5, 0, 0, 0),
 
{{"_FSL", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_FST", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3, 0, 0, 0),
 
{{"_GAI", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_GCP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_GHL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_GLK", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_GPD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_GPE", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* _GPE method, not _GPE scope */
 
{{"_GRT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_GSB", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_GTF", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_GTM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_GTS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_GWS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_HID", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}},
 
{{"_HOT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_HPP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
 
/*
* For _HPX, a single package is returned, containing a variable-length number
* of subpackages. Each subpackage contains a PCI record setting.
* There are several different type of record settings, of different
* lengths, but all elements of all settings are Integers.
*/
{{"_HPX", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (var Ints) */
PACKAGE_INFO(ACPI_PTYPE2_MIN, ACPI_RTYPE_INTEGER, 5, 0, 0, 0),
 
{{"_HRV", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_IFT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */
 
{{"_INI", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_IRC", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_LCK", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_LID", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_LPD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int(rev), n Pkg (2 Int) */
PACKAGE_INFO(ACPI_PTYPE2_REV_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0),
 
{{"_LPI", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (3 Int, n Pkg (10 Int/Buf) */
PACKAGE_INFO(ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 3,
ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER | ACPI_RTYPE_STRING,
10, 0),
 
{{"_MAT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_MBM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (8 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 8, 0, 0, 0),
 
{{"_MLS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (1 Str/1 Buf) */
PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, ACPI_RTYPE_BUFFER, 1,
0),
 
{{"_MSG", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_MSM",
METHOD_4ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_MTL", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_NTT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_OFF", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_ON_", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_OS_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_STRING)}},
 
{{"_OSC",
METHOD_4ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER,
ACPI_TYPE_BUFFER),
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_OST",
METHOD_3ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER),
METHOD_NO_RETURN_VALUE}},
 
{{"_PAI", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PCL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PCT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0),
 
{{"_PDC", METHOD_1ARGS(ACPI_TYPE_BUFFER),
METHOD_NO_RETURN_VALUE}},
 
{{"_PDL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PIC", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_PIF", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (3 Int),(3 Str) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,
ACPI_RTYPE_STRING, 3, 0),
 
{{"_PLD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Bufs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_BUFFER, 0, 0, 0, 0),
 
{{"_PMC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (11 Int),(3 Str) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 11,
ACPI_RTYPE_STRING, 3, 0),
 
{{"_PMD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PMM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PPC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PPE", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See dig64 spec */
 
{{"_PR0", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PR1", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PR2", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PR3", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PRE", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PRL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PRR", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Ref) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_REFERENCE, 1, 0, 0, 0),
 
{{"_PRS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
/*
* For _PRT, many BIOSs reverse the 3rd and 4th Package elements (Source
* and source_index). This bug is so prevalent that there is code in the
* ACPICA Resource Manager to detect this and switch them back. For now,
* do not allow and issue a warning. To allow this and eliminate the
* warning, add the ACPI_RTYPE_REFERENCE type to the 4th element (index 3)
* in the statement below.
*/
{{"_PRT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (4): Int,Int,Int/Ref,Int */
PACKAGE_INFO(ACPI_PTYPE2_FIXED, 4, ACPI_RTYPE_INTEGER,
ACPI_RTYPE_INTEGER,
ACPI_RTYPE_INTEGER | ACPI_RTYPE_REFERENCE,
ACPI_RTYPE_INTEGER),
 
{{"_PRW", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: Pkg/Int,Int,[Variable-length Refs] (Pkg is Ref/Int) */
PACKAGE_INFO(ACPI_PTYPE1_OPTION, 2,
ACPI_RTYPE_INTEGER | ACPI_RTYPE_PACKAGE,
ACPI_RTYPE_INTEGER, ACPI_RTYPE_REFERENCE, 0),
 
{{"_PS0", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_PS1", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_PS2", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_PS3", METHOD_0ARGS,
METHOD_NO_RETURN_VALUE}},
 
{{"_PSC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PSD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (5 Int) with count */
PACKAGE_INFO(ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 0, 0, 0, 0),
 
{{"_PSE", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_PSL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_PSR", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PSS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each (6 Int) */
PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 6, 0, 0, 0),
 
{{"_PSV", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PSW", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_PTC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Buf) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_BUFFER, 2, 0, 0, 0),
 
{{"_PTP", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_PTS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_PUR", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (2 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0),
 
{{"_PXM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_RDI", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (1 Int, n Pkg (m Ref)) */
PACKAGE_INFO(ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 1,
ACPI_RTYPE_REFERENCE, 0, 0),
 
{{"_REG", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_REV", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_RMV", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_ROM", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_RST", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_NO_RETURN_VALUE}},
 
{{"_RTV", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
/*
* For _S0_ through _S5_, the ACPI spec defines a return Package
* containing 1 Integer, but most DSDTs have it wrong - 2,3, or 4 integers.
* Allow this by making the objects "Variable-length length", but all elements
* must be Integers.
*/
{{"_S0_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0),
 
{{"_S1_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0),
 
{{"_S2_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0),
 
{{"_S3_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0),
 
{{"_S4_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0),
 
{{"_S5_", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (1 Int) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_INTEGER, 1, 0, 0, 0),
 
{{"_S1D", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S2D", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S3D", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S4D", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S0W", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S1W", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S2W", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S3W", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_S4W", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SBS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SCP", METHOD_1ARGS(ACPI_TYPE_INTEGER) | ARG_COUNT_IS_MINIMUM,
METHOD_NO_RETURN_VALUE}}, /* Acpi 1.0 allowed 1 integer arg. Acpi 3.0 expanded to 3 args. Allow both. */
 
{{"_SDD", METHOD_1ARGS(ACPI_TYPE_BUFFER),
METHOD_NO_RETURN_VALUE}},
 
{{"_SEG", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SHL", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SLI", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_SPD", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SRS", METHOD_1ARGS(ACPI_TYPE_BUFFER),
METHOD_NO_RETURN_VALUE}},
 
{{"_SRT", METHOD_1ARGS(ACPI_TYPE_BUFFER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SRV", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}}, /* See IPMI spec */
 
{{"_SST", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_STA", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_STM",
METHOD_3ARGS(ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER, ACPI_TYPE_BUFFER),
METHOD_NO_RETURN_VALUE}},
 
{{"_STP", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_STR", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_STV", METHOD_2ARGS(ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SUB", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_STRING)}},
 
{{"_SUN", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_SWS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TC1", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TC2", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TDL", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TFP", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TIP", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TIV", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TMP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TPC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TPT", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_TRT", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */
PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER,
6, 0),
 
{{"_TSD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int with count */
PACKAGE_INFO(ACPI_PTYPE2_COUNT, ACPI_RTYPE_INTEGER, 5, 0, 0, 0),
 
{{"_TSN", METHOD_0ARGS, /* ACPI 6.0 */
METHOD_RETURNS(ACPI_RTYPE_REFERENCE)}},
 
{{"_TSP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TSS", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each 5 Int */
PACKAGE_INFO(ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5, 0, 0, 0),
 
{{"_TST", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_TTS", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_NO_RETURN_VALUE}},
 
{{"_TZD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */
PACKAGE_INFO(ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0, 0, 0, 0),
 
{{"_TZM", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_REFERENCE)}},
 
{{"_TZP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_UID", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}},
 
{{"_UPC", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_PACKAGE)}}, /* Fixed-length (4 Int) */
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 4, 0, 0, 0),
 
{{"_UPD", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_UPP", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
{{"_VPO", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_INTEGER)}},
 
/* Acpi 1.0 defined _WAK with no return value. Later, it was changed to return a package */
 
{{"_WAK", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_NONE | ACPI_RTYPE_INTEGER |
ACPI_RTYPE_PACKAGE)}},
PACKAGE_INFO(ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 2, 0, 0, 0), /* Fixed-length (2 Int), but is optional */
 
/* _WDG/_WED are MS extensions defined by "Windows Instrumentation" */
 
{{"_WDG", METHOD_0ARGS,
METHOD_RETURNS(ACPI_RTYPE_BUFFER)}},
 
{{"_WED", METHOD_1ARGS(ACPI_TYPE_INTEGER),
METHOD_RETURNS(ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING |
ACPI_RTYPE_BUFFER)}},
 
PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */
};
#else
extern const union acpi_predefined_info acpi_gbl_predefined_methods[];
#endif
 
#if (defined ACPI_CREATE_RESOURCE_TABLE && defined ACPI_APPLICATION)
/******************************************************************************
*
* Predefined names for use in Resource Descriptors. These names do not
* appear in the global Predefined Name table (since these names never
* appear in actual AML byte code, only in the original ASL)
*
* Note: Used by iASL compiler and acpi_help utility only.
*
*****************************************************************************/
 
const union acpi_predefined_info acpi_gbl_resource_names[] = {
{{"_ADR", WIDTH_16 | WIDTH_64, 0}},
{{"_ALN", WIDTH_8 | WIDTH_16 | WIDTH_32, 0}},
{{"_ASI", WIDTH_8, 0}},
{{"_ASZ", WIDTH_8, 0}},
{{"_ATT", WIDTH_64, 0}},
{{"_BAS", WIDTH_16 | WIDTH_32, 0}},
{{"_BM_", WIDTH_1, 0}},
{{"_DBT", WIDTH_16, 0}}, /* Acpi 5.0 */
{{"_DEC", WIDTH_1, 0}},
{{"_DMA", WIDTH_8, 0}},
{{"_DPL", WIDTH_1, 0}}, /* Acpi 5.0 */
{{"_DRS", WIDTH_16, 0}}, /* Acpi 5.0 */
{{"_END", WIDTH_1, 0}}, /* Acpi 5.0 */
{{"_FLC", WIDTH_2, 0}}, /* Acpi 5.0 */
{{"_GRA", WIDTH_ADDRESS, 0}},
{{"_HE_", WIDTH_1, 0}},
{{"_INT", WIDTH_16 | WIDTH_32, 0}},
{{"_IOR", WIDTH_2, 0}}, /* Acpi 5.0 */
{{"_LEN", WIDTH_8 | WIDTH_ADDRESS, 0}},
{{"_LIN", WIDTH_8, 0}}, /* Acpi 5.0 */
{{"_LL_", WIDTH_1, 0}},
{{"_MAF", WIDTH_1, 0}},
{{"_MAX", WIDTH_ADDRESS, 0}},
{{"_MEM", WIDTH_2, 0}},
{{"_MIF", WIDTH_1, 0}},
{{"_MIN", WIDTH_ADDRESS, 0}},
{{"_MOD", WIDTH_1, 0}}, /* Acpi 5.0 */
{{"_MTP", WIDTH_2, 0}},
{{"_PAR", WIDTH_8, 0}}, /* Acpi 5.0 */
{{"_PHA", WIDTH_1, 0}}, /* Acpi 5.0 */
{{"_PIN", WIDTH_16, 0}}, /* Acpi 5.0 */
{{"_PPI", WIDTH_8, 0}}, /* Acpi 5.0 */
{{"_POL", WIDTH_1 | WIDTH_2, 0}}, /* Acpi 5.0 */
{{"_RBO", WIDTH_8, 0}},
{{"_RBW", WIDTH_8, 0}},
{{"_RNG", WIDTH_1, 0}},
{{"_RT_", WIDTH_8, 0}}, /* Acpi 3.0 */
{{"_RW_", WIDTH_1, 0}},
{{"_RXL", WIDTH_16, 0}}, /* Acpi 5.0 */
{{"_SHR", WIDTH_2, 0}},
{{"_SIZ", WIDTH_2, 0}},
{{"_SLV", WIDTH_1, 0}}, /* Acpi 5.0 */
{{"_SPE", WIDTH_32, 0}}, /* Acpi 5.0 */
{{"_STB", WIDTH_2, 0}}, /* Acpi 5.0 */
{{"_TRA", WIDTH_ADDRESS, 0}},
{{"_TRS", WIDTH_1, 0}},
{{"_TSF", WIDTH_8, 0}}, /* Acpi 3.0 */
{{"_TTP", WIDTH_1, 0}},
{{"_TXL", WIDTH_16, 0}}, /* Acpi 5.0 */
{{"_TYP", WIDTH_2 | WIDTH_16, 0}},
{{"_VEN", VARIABLE_DATA, 0}}, /* Acpi 5.0 */
PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */
};
 
static const union acpi_predefined_info acpi_gbl_scope_names[] = {
{{"_GPE", 0, 0}},
{{"_PR_", 0, 0}},
{{"_SB_", 0, 0}},
{{"_SI_", 0, 0}},
{{"_TZ_", 0, 0}},
PACKAGE_INFO(0, 0, 0, 0, 0, 0) /* Table terminator */
};
#else
extern const union acpi_predefined_info acpi_gbl_resource_names[];
#endif
 
#endif
/drivers/acpi/acpica/acresrc.h
0,0 → 1,383
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACRESRC_H__
#define __ACRESRC_H__
 
/* Need the AML resource descriptor structs */
 
#include "amlresrc.h"
 
/*
* If possible, pack the following structures to byte alignment, since we
* don't care about performance for debug output. Two cases where we cannot
* pack the structures:
*
* 1) Hardware does not support misaligned memory transfers
* 2) Compiler does not support pointers within packed structures
*/
#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
#pragma pack(1)
#endif
 
/*
* Individual entry for the resource conversion tables
*/
typedef const struct acpi_rsconvert_info {
u8 opcode;
u8 resource_offset;
u8 aml_offset;
u8 value;
 
} acpi_rsconvert_info;
 
/* Resource conversion opcodes */
 
typedef enum {
ACPI_RSC_INITGET = 0,
ACPI_RSC_INITSET,
ACPI_RSC_FLAGINIT,
ACPI_RSC_1BITFLAG,
ACPI_RSC_2BITFLAG,
ACPI_RSC_3BITFLAG,
ACPI_RSC_ADDRESS,
ACPI_RSC_BITMASK,
ACPI_RSC_BITMASK16,
ACPI_RSC_COUNT,
ACPI_RSC_COUNT16,
ACPI_RSC_COUNT_GPIO_PIN,
ACPI_RSC_COUNT_GPIO_RES,
ACPI_RSC_COUNT_GPIO_VEN,
ACPI_RSC_COUNT_SERIAL_RES,
ACPI_RSC_COUNT_SERIAL_VEN,
ACPI_RSC_DATA8,
ACPI_RSC_EXIT_EQ,
ACPI_RSC_EXIT_LE,
ACPI_RSC_EXIT_NE,
ACPI_RSC_LENGTH,
ACPI_RSC_MOVE_GPIO_PIN,
ACPI_RSC_MOVE_GPIO_RES,
ACPI_RSC_MOVE_SERIAL_RES,
ACPI_RSC_MOVE_SERIAL_VEN,
ACPI_RSC_MOVE8,
ACPI_RSC_MOVE16,
ACPI_RSC_MOVE32,
ACPI_RSC_MOVE64,
ACPI_RSC_SET8,
ACPI_RSC_SOURCE,
ACPI_RSC_SOURCEX
} ACPI_RSCONVERT_OPCODES;
 
/* Resource Conversion sub-opcodes */
 
#define ACPI_RSC_COMPARE_AML_LENGTH 0
#define ACPI_RSC_COMPARE_VALUE 1
 
#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (struct acpi_rsconvert_info))
 
#define ACPI_RS_OFFSET(f) (u8) ACPI_OFFSET (struct acpi_resource,f)
#define AML_OFFSET(f) (u8) ACPI_OFFSET (union aml_resource,f)
 
/*
* Individual entry for the resource dump tables
*/
typedef const struct acpi_rsdump_info {
u8 opcode;
u8 offset;
char *name;
const char **pointer;
 
} acpi_rsdump_info;
 
/* Values for the Opcode field above */
 
typedef enum {
ACPI_RSD_TITLE = 0,
ACPI_RSD_1BITFLAG,
ACPI_RSD_2BITFLAG,
ACPI_RSD_3BITFLAG,
ACPI_RSD_ADDRESS,
ACPI_RSD_DWORDLIST,
ACPI_RSD_LITERAL,
ACPI_RSD_LONGLIST,
ACPI_RSD_SHORTLIST,
ACPI_RSD_SHORTLISTX,
ACPI_RSD_SOURCE,
ACPI_RSD_STRING,
ACPI_RSD_UINT8,
ACPI_RSD_UINT16,
ACPI_RSD_UINT32,
ACPI_RSD_UINT64,
ACPI_RSD_WORDLIST
} ACPI_RSDUMP_OPCODES;
 
/* restore default alignment */
 
#pragma pack()
 
/* Resource tables indexed by internal resource type */
 
extern const u8 acpi_gbl_aml_resource_sizes[];
extern const u8 acpi_gbl_aml_resource_serial_bus_sizes[];
extern struct acpi_rsconvert_info *acpi_gbl_set_resource_dispatch[];
 
/* Resource tables indexed by raw AML resource descriptor type */
 
extern const u8 acpi_gbl_resource_struct_sizes[];
extern const u8 acpi_gbl_resource_struct_serial_bus_sizes[];
extern struct acpi_rsconvert_info *acpi_gbl_get_resource_dispatch[];
 
extern struct acpi_rsconvert_info
*acpi_gbl_convert_resource_serial_bus_dispatch[];
 
struct acpi_vendor_walk_info {
struct acpi_vendor_uuid *uuid;
struct acpi_buffer *buffer;
acpi_status status;
};
 
/*
* rscreate
*/
acpi_status
acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer,
struct acpi_buffer *output_buffer);
 
acpi_status
acpi_rs_create_aml_resources(struct acpi_buffer *resource_list,
struct acpi_buffer *output_buffer);
 
acpi_status
acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
struct acpi_buffer *output_buffer);
 
/*
* rsutils
*/
 
acpi_status
acpi_rs_get_prt_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_rs_get_crs_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_rs_get_prs_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_rs_get_method_data(acpi_handle handle,
char *path, struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_rs_set_srs_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_rs_get_aei_method_data(struct acpi_namespace_node *node,
struct acpi_buffer *ret_buffer);
 
/*
* rscalc
*/
acpi_status
acpi_rs_get_list_length(u8 * aml_buffer,
u32 aml_buffer_length, acpi_size * size_needed);
 
acpi_status
acpi_rs_get_aml_length(struct acpi_resource *resource_list,
acpi_size resource_list_size, acpi_size * size_needed);
 
acpi_status
acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object,
acpi_size * buffer_size_needed);
 
acpi_status
acpi_rs_convert_aml_to_resources(u8 * aml,
u32 length,
u32 offset, u8 resource_index, void **context);
 
acpi_status
acpi_rs_convert_resources_to_aml(struct acpi_resource *resource,
acpi_size aml_size_needed, u8 * output_buffer);
 
/*
* rsaddr
*/
void
acpi_rs_set_address_common(union aml_resource *aml,
struct acpi_resource *resource);
 
u8
acpi_rs_get_address_common(struct acpi_resource *resource,
union aml_resource *aml);
 
/*
* rsmisc
*/
acpi_status
acpi_rs_convert_aml_to_resource(struct acpi_resource *resource,
union aml_resource *aml,
struct acpi_rsconvert_info *info);
 
acpi_status
acpi_rs_convert_resource_to_aml(struct acpi_resource *resource,
union aml_resource *aml,
struct acpi_rsconvert_info *info);
 
/*
* rsutils
*/
void
acpi_rs_move_data(void *destination,
void *source, u16 item_count, u8 move_type);
 
u8 acpi_rs_decode_bitmask(u16 mask, u8 * list);
 
u16 acpi_rs_encode_bitmask(u8 * list, u8 count);
 
acpi_rs_length
acpi_rs_get_resource_source(acpi_rs_length resource_length,
acpi_rs_length minimum_length,
struct acpi_resource_source *resource_source,
union aml_resource *aml, char *string_ptr);
 
acpi_rsdesc_size
acpi_rs_set_resource_source(union aml_resource *aml,
acpi_rs_length minimum_length,
struct acpi_resource_source *resource_source);
 
void
acpi_rs_set_resource_header(u8 descriptor_type,
acpi_rsdesc_size total_length,
union aml_resource *aml);
 
void
acpi_rs_set_resource_length(acpi_rsdesc_size total_length,
union aml_resource *aml);
 
/*
* rsdump - Debugger support
*/
#ifdef ACPI_DEBUGGER
void acpi_rs_dump_resource_list(struct acpi_resource *resource);
 
void acpi_rs_dump_irq_list(u8 *route_table);
#endif
 
/*
* Resource conversion tables
*/
extern struct acpi_rsconvert_info acpi_rs_convert_dma[];
extern struct acpi_rsconvert_info acpi_rs_convert_end_dpf[];
extern struct acpi_rsconvert_info acpi_rs_convert_io[];
extern struct acpi_rsconvert_info acpi_rs_convert_fixed_io[];
extern struct acpi_rsconvert_info acpi_rs_convert_end_tag[];
extern struct acpi_rsconvert_info acpi_rs_convert_memory24[];
extern struct acpi_rsconvert_info acpi_rs_convert_generic_reg[];
extern struct acpi_rsconvert_info acpi_rs_convert_memory32[];
extern struct acpi_rsconvert_info acpi_rs_convert_fixed_memory32[];
extern struct acpi_rsconvert_info acpi_rs_convert_address32[];
extern struct acpi_rsconvert_info acpi_rs_convert_address16[];
extern struct acpi_rsconvert_info acpi_rs_convert_ext_irq[];
extern struct acpi_rsconvert_info acpi_rs_convert_address64[];
extern struct acpi_rsconvert_info acpi_rs_convert_ext_address64[];
extern struct acpi_rsconvert_info acpi_rs_convert_gpio[];
extern struct acpi_rsconvert_info acpi_rs_convert_fixed_dma[];
extern struct acpi_rsconvert_info acpi_rs_convert_i2c_serial_bus[];
extern struct acpi_rsconvert_info acpi_rs_convert_spi_serial_bus[];
extern struct acpi_rsconvert_info acpi_rs_convert_uart_serial_bus[];
 
/* These resources require separate get/set tables */
 
extern struct acpi_rsconvert_info acpi_rs_get_irq[];
extern struct acpi_rsconvert_info acpi_rs_get_start_dpf[];
extern struct acpi_rsconvert_info acpi_rs_get_vendor_small[];
extern struct acpi_rsconvert_info acpi_rs_get_vendor_large[];
 
extern struct acpi_rsconvert_info acpi_rs_set_irq[];
extern struct acpi_rsconvert_info acpi_rs_set_start_dpf[];
extern struct acpi_rsconvert_info acpi_rs_set_vendor[];
 
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*
* rsinfo
*/
extern struct acpi_rsdump_info *acpi_gbl_dump_resource_dispatch[];
extern struct acpi_rsdump_info *acpi_gbl_dump_serial_bus_dispatch[];
 
/*
* rsdumpinfo
*/
extern struct acpi_rsdump_info acpi_rs_dump_irq[];
extern struct acpi_rsdump_info acpi_rs_dump_prt[];
extern struct acpi_rsdump_info acpi_rs_dump_dma[];
extern struct acpi_rsdump_info acpi_rs_dump_start_dpf[];
extern struct acpi_rsdump_info acpi_rs_dump_end_dpf[];
extern struct acpi_rsdump_info acpi_rs_dump_io[];
extern struct acpi_rsdump_info acpi_rs_dump_io_flags[];
extern struct acpi_rsdump_info acpi_rs_dump_fixed_io[];
extern struct acpi_rsdump_info acpi_rs_dump_vendor[];
extern struct acpi_rsdump_info acpi_rs_dump_end_tag[];
extern struct acpi_rsdump_info acpi_rs_dump_memory24[];
extern struct acpi_rsdump_info acpi_rs_dump_memory32[];
extern struct acpi_rsdump_info acpi_rs_dump_memory_flags[];
extern struct acpi_rsdump_info acpi_rs_dump_fixed_memory32[];
extern struct acpi_rsdump_info acpi_rs_dump_address16[];
extern struct acpi_rsdump_info acpi_rs_dump_address32[];
extern struct acpi_rsdump_info acpi_rs_dump_address64[];
extern struct acpi_rsdump_info acpi_rs_dump_ext_address64[];
extern struct acpi_rsdump_info acpi_rs_dump_ext_irq[];
extern struct acpi_rsdump_info acpi_rs_dump_generic_reg[];
extern struct acpi_rsdump_info acpi_rs_dump_gpio[];
extern struct acpi_rsdump_info acpi_rs_dump_fixed_dma[];
extern struct acpi_rsdump_info acpi_rs_dump_common_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_i2c_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_spi_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_uart_serial_bus[];
extern struct acpi_rsdump_info acpi_rs_dump_general_flags[];
#endif
 
#endif /* __ACRESRC_H__ */
/drivers/acpi/acpica/acstruct.h
0,0 → 1,243
/******************************************************************************
*
* Name: acstruct.h - Internal structs
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__
 
/* acpisrc:struct_defs -- for acpisrc conversion */
 
/*****************************************************************************
*
* Tree walking typedefs and structs
*
****************************************************************************/
 
/*
* Walk state - current state of a parse tree walk. Used for both a leisurely
* stroll through the tree (for whatever reason), and for control method
* execution.
*/
#define ACPI_NEXT_OP_DOWNWARD 1
#define ACPI_NEXT_OP_UPWARD 2
 
/*
* Groups of definitions for walk_type used for different implementations of
* walkers (never simultaneously) - flags for interpreter:
*/
#define ACPI_WALK_NON_METHOD 0
#define ACPI_WALK_METHOD 0x01
#define ACPI_WALK_METHOD_RESTART 0x02
 
struct acpi_walk_state {
struct acpi_walk_state *next; /* Next walk_state in list */
u8 descriptor_type; /* To differentiate various internal objs */
u8 walk_type;
u16 opcode; /* Current AML opcode */
u8 next_op_info; /* Info about next_op */
u8 num_operands; /* Stack pointer for Operands[] array */
u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */
acpi_owner_id owner_id; /* Owner of objects created during the walk */
u8 last_predicate; /* Result of last predicate */
u8 current_result;
u8 return_used;
u8 scope_depth;
u8 pass_number; /* Parse pass during table load */
u8 namespace_override; /* Override existing objects */
u8 result_size; /* Total elements for the result stack */
u8 result_count; /* Current number of occupied elements of result stack */
u8 *aml;
u32 arg_types;
u32 method_breakpoint; /* For single stepping */
u32 user_breakpoint; /* User AML breakpoint */
u32 parse_flags;
 
struct acpi_parse_state parser_state; /* Current state of parser */
u32 prev_arg_types;
u32 arg_count; /* push for fixed or var args */
 
struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
union acpi_operand_object **params;
 
u8 *aml_last_while;
union acpi_operand_object **caller_return_desc;
union acpi_generic_state *control_state; /* List of control states (nested IFs) */
struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */
union acpi_operand_object *implicit_return_obj;
struct acpi_namespace_node *method_call_node; /* Called method Node */
union acpi_parse_object *method_call_op; /* method_call Op if running a method */
union acpi_operand_object *method_desc; /* Method descriptor if running a method */
struct acpi_namespace_node *method_node; /* Method node if running a method. */
union acpi_parse_object *op; /* Current parser op */
const struct acpi_opcode_info *op_info; /* Info on current opcode */
union acpi_parse_object *origin; /* Start of walk [Obsolete] */
union acpi_operand_object *result_obj;
union acpi_generic_state *results; /* Stack of accumulated results */
union acpi_operand_object *return_desc; /* Return object, if any */
union acpi_generic_state *scope_info; /* Stack of nested scopes */
union acpi_parse_object *prev_op; /* Last op that was processed */
union acpi_parse_object *next_op; /* next op to be processed */
struct acpi_thread_state *thread;
acpi_parse_downwards descending_callback;
acpi_parse_upwards ascending_callback;
};
 
/* Info used by acpi_ns_initialize_objects and acpi_ds_initialize_objects */
 
struct acpi_init_walk_info {
u32 table_index;
u32 object_count;
u32 method_count;
u32 serial_method_count;
u32 non_serial_method_count;
u32 serialized_method_count;
u32 device_count;
u32 op_region_count;
u32 field_count;
u32 buffer_count;
u32 package_count;
u32 op_region_init;
u32 field_init;
u32 buffer_init;
u32 package_init;
acpi_owner_id owner_id;
};
 
struct acpi_get_devices_info {
acpi_walk_callback user_function;
void *context;
const char *hid;
};
 
union acpi_aml_operands {
union acpi_operand_object *operands[7];
 
struct {
struct acpi_object_integer *type;
struct acpi_object_integer *code;
struct acpi_object_integer *argument;
 
} fatal;
 
struct {
union acpi_operand_object *source;
struct acpi_object_integer *index;
union acpi_operand_object *target;
 
} index;
 
struct {
union acpi_operand_object *source;
struct acpi_object_integer *index;
struct acpi_object_integer *length;
union acpi_operand_object *target;
 
} mid;
};
 
/*
* Structure used to pass object evaluation information and parameters.
* Purpose is to reduce CPU stack use.
*/
struct acpi_evaluate_info {
/* The first 3 elements are passed by the caller to acpi_ns_evaluate */
 
struct acpi_namespace_node *prefix_node; /* Input: starting node */
char *relative_pathname; /* Input: path relative to prefix_node */
union acpi_operand_object **parameters; /* Input: argument list */
 
struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */
union acpi_operand_object *obj_desc; /* Object attached to the resolved node */
char *full_pathname; /* Full pathname of the resolved node */
 
const union acpi_predefined_info *predefined; /* Used if Node is a predefined name */
union acpi_operand_object *return_object; /* Object returned from the evaluation */
union acpi_operand_object *parent_package; /* Used if return object is a Package */
 
u32 return_flags; /* Used for return value analysis */
u32 return_btype; /* Bitmapped type of the returned object */
u16 param_count; /* Count of the input argument list */
u8 pass_number; /* Parser pass number */
u8 return_object_type; /* Object type of the returned object */
u8 node_flags; /* Same as Node->Flags */
u8 flags; /* General flags */
};
 
/* Values for Flags above */
 
#define ACPI_IGNORE_RETURN_VALUE 1
 
/* Defines for return_flags field above */
 
#define ACPI_OBJECT_REPAIRED 1
#define ACPI_OBJECT_WRAPPED 2
 
/* Info used by acpi_ns_initialize_devices */
 
struct acpi_device_walk_info {
struct acpi_table_desc *table_desc;
struct acpi_evaluate_info *evaluate_info;
u32 device_count;
u32 num_STA;
u32 num_INI;
};
 
/* TBD: [Restructure] Merge with struct above */
 
struct acpi_walk_info {
u32 debug_level;
u32 count;
acpi_owner_id owner_id;
u8 display_type;
};
 
/* Display Types */
 
#define ACPI_DISPLAY_SUMMARY (u8) 0
#define ACPI_DISPLAY_OBJECTS (u8) 1
#define ACPI_DISPLAY_MASK (u8) 1
 
#define ACPI_DISPLAY_SHORT (u8) 2
 
#endif
/drivers/acpi/acpica/actables.h
0,0 → 1,171
/******************************************************************************
*
* Name: actables.h - ACPI table management
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __ACTABLES_H__
#define __ACTABLES_H__
 
acpi_status acpi_allocate_root_table(u32 initial_table_count);
 
/*
* tbxfroot - Root pointer utilities
*/
u32 acpi_tb_get_rsdp_length(struct acpi_table_rsdp *rsdp);
 
acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp);
 
u8 *acpi_tb_scan_memory_for_rsdp(u8 *start_address, u32 length);
 
/*
* tbdata - table data structure management
*/
acpi_status
acpi_tb_get_next_table_descriptor(u32 *table_index,
struct acpi_table_desc **table_desc);
 
void
acpi_tb_init_table_descriptor(struct acpi_table_desc *table_desc,
acpi_physical_address address,
u8 flags, struct acpi_table_header *table);
 
acpi_status
acpi_tb_acquire_temp_table(struct acpi_table_desc *table_desc,
acpi_physical_address address, u8 flags);
 
void acpi_tb_release_temp_table(struct acpi_table_desc *table_desc);
 
acpi_status acpi_tb_validate_temp_table(struct acpi_table_desc *table_desc);
 
acpi_status
acpi_tb_verify_temp_table(struct acpi_table_desc *table_desc, char *signature);
 
u8 acpi_tb_is_table_loaded(u32 table_index);
 
void acpi_tb_set_table_loaded_flag(u32 table_index, u8 is_loaded);
 
/*
* tbfadt - FADT parse/convert/validate
*/
void acpi_tb_parse_fadt(void);
 
void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length);
 
/*
* tbfind - find ACPI table
*/
acpi_status
acpi_tb_find_table(char *signature,
char *oem_id, char *oem_table_id, u32 *table_index);
 
/*
* tbinstal - Table removal and deletion
*/
acpi_status acpi_tb_resize_root_table_list(void);
 
acpi_status acpi_tb_validate_table(struct acpi_table_desc *table_desc);
 
void acpi_tb_invalidate_table(struct acpi_table_desc *table_desc);
 
void acpi_tb_override_table(struct acpi_table_desc *old_table_desc);
 
acpi_status
acpi_tb_acquire_table(struct acpi_table_desc *table_desc,
struct acpi_table_header **table_ptr,
u32 *table_length, u8 *table_flags);
 
void
acpi_tb_release_table(struct acpi_table_header *table,
u32 table_length, u8 table_flags);
 
acpi_status
acpi_tb_install_standard_table(acpi_physical_address address,
u8 flags,
u8 reload, u8 override, u32 *table_index);
 
void acpi_tb_uninstall_table(struct acpi_table_desc *table_desc);
 
void acpi_tb_terminate(void);
 
acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index);
 
acpi_status acpi_tb_allocate_owner_id(u32 table_index);
 
acpi_status acpi_tb_release_owner_id(u32 table_index);
 
acpi_status acpi_tb_get_owner_id(u32 table_index, acpi_owner_id *owner_id);
 
/*
* tbutils - table manager utilities
*/
acpi_status acpi_tb_initialize_facs(void);
 
void
acpi_tb_print_table_header(acpi_physical_address address,
struct acpi_table_header *header);
 
u8 acpi_tb_checksum(u8 *buffer, u32 length);
 
acpi_status
acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length);
 
void acpi_tb_check_dsdt_header(void);
 
struct acpi_table_header *acpi_tb_copy_dsdt(u32 table_index);
 
void
acpi_tb_install_table_with_override(struct acpi_table_desc *new_table_desc,
u8 override, u32 *table_index);
 
acpi_status
acpi_tb_install_fixed_table(acpi_physical_address address,
char *signature, u32 *table_index);
 
acpi_status acpi_tb_parse_root_table(acpi_physical_address rsdp_address);
 
u8 acpi_is_valid_signature(char *signature);
 
/*
* tbxfload
*/
acpi_status acpi_tb_load_namespace(void);
 
#endif /* __ACTABLES_H__ */
/drivers/acpi/acpica/acutils.h
0,0 → 1,733
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef _ACUTILS_H
#define _ACUTILS_H
 
extern const u8 acpi_gbl_resource_aml_sizes[];
extern const u8 acpi_gbl_resource_aml_serial_bus_sizes[];
 
/* Strings used by the disassembler and debugger resource dump routines */
 
#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
 
extern const char *acpi_gbl_bm_decode[];
extern const char *acpi_gbl_config_decode[];
extern const char *acpi_gbl_consume_decode[];
extern const char *acpi_gbl_dec_decode[];
extern const char *acpi_gbl_he_decode[];
extern const char *acpi_gbl_io_decode[];
extern const char *acpi_gbl_ll_decode[];
extern const char *acpi_gbl_max_decode[];
extern const char *acpi_gbl_mem_decode[];
extern const char *acpi_gbl_min_decode[];
extern const char *acpi_gbl_mtp_decode[];
extern const char *acpi_gbl_rng_decode[];
extern const char *acpi_gbl_rw_decode[];
extern const char *acpi_gbl_shr_decode[];
extern const char *acpi_gbl_siz_decode[];
extern const char *acpi_gbl_trs_decode[];
extern const char *acpi_gbl_ttp_decode[];
extern const char *acpi_gbl_typ_decode[];
extern const char *acpi_gbl_ppc_decode[];
extern const char *acpi_gbl_ior_decode[];
extern const char *acpi_gbl_dts_decode[];
extern const char *acpi_gbl_ct_decode[];
extern const char *acpi_gbl_sbt_decode[];
extern const char *acpi_gbl_am_decode[];
extern const char *acpi_gbl_sm_decode[];
extern const char *acpi_gbl_wm_decode[];
extern const char *acpi_gbl_cph_decode[];
extern const char *acpi_gbl_cpo_decode[];
extern const char *acpi_gbl_dp_decode[];
extern const char *acpi_gbl_ed_decode[];
extern const char *acpi_gbl_bpb_decode[];
extern const char *acpi_gbl_sb_decode[];
extern const char *acpi_gbl_fc_decode[];
extern const char *acpi_gbl_pt_decode[];
#endif
 
/*
* For the iASL compiler case, the output is redirected to stderr so that
* any of the various ACPI errors and warnings do not appear in the output
* files, for either the compiler or disassembler portions of the tool.
*/
#ifdef ACPI_ASL_COMPILER
 
#include <stdio.h>
 
#define ACPI_MSG_REDIRECT_BEGIN \
FILE *output_file = acpi_gbl_output_file; \
acpi_os_redirect_output (stderr);
 
#define ACPI_MSG_REDIRECT_END \
acpi_os_redirect_output (output_file);
 
#else
/*
* non-iASL case - no redirection, nothing to do
*/
#define ACPI_MSG_REDIRECT_BEGIN
#define ACPI_MSG_REDIRECT_END
#endif
 
/*
* Common error message prefixes
*/
#define ACPI_MSG_ERROR "ACPI Error: "
#define ACPI_MSG_EXCEPTION "ACPI Exception: "
#define ACPI_MSG_WARNING "ACPI Warning: "
#define ACPI_MSG_INFO "ACPI: "
 
#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
 
/*
* Common message suffix
*/
#define ACPI_MSG_SUFFIX \
acpi_os_printf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
 
/* Types for Resource descriptor entries */
 
#define ACPI_INVALID_RESOURCE 0
#define ACPI_FIXED_LENGTH 1
#define ACPI_VARIABLE_LENGTH 2
#define ACPI_SMALL_VARIABLE_LENGTH 3
 
typedef
acpi_status(*acpi_walk_aml_callback) (u8 *aml,
u32 length,
u32 offset,
u8 resource_index, void **context);
 
typedef
acpi_status(*acpi_pkg_callback) (u8 object_type,
union acpi_operand_object *source_object,
union acpi_generic_state * state,
void *context);
 
struct acpi_pkg_info {
u8 *free_space;
acpi_size length;
u32 object_space;
u32 num_packages;
};
 
/* Object reference counts */
 
#define REF_INCREMENT (u16) 0
#define REF_DECREMENT (u16) 1
 
/* acpi_ut_dump_buffer */
 
#define DB_BYTE_DISPLAY 1
#define DB_WORD_DISPLAY 2
#define DB_DWORD_DISPLAY 4
#define DB_QWORD_DISPLAY 8
 
/*
* utnonansi - Non-ANSI C library functions
*/
void acpi_ut_strupr(char *src_string);
 
void acpi_ut_strlwr(char *src_string);
 
int acpi_ut_stricmp(char *string1, char *string2);
 
acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer);
 
/*
* utglobal - Global data structures and procedures
*/
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_notify_name(u32 notify_value, acpi_object_type type);
#endif
 
char *acpi_ut_get_type_name(acpi_object_type type);
 
char *acpi_ut_get_node_name(void *object);
 
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);
 
char *acpi_ut_get_region_name(u8 space_id);
 
char *acpi_ut_get_event_name(u32 event_id);
 
char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);
 
u8 acpi_ut_ascii_char_to_hex(int hex_char);
 
u8 acpi_ut_valid_object_type(acpi_object_type type);
 
/*
* utinit - miscellaneous initialization and shutdown
*/
acpi_status acpi_ut_hardware_initialize(void);
 
void acpi_ut_subsystem_shutdown(void);
 
/*
* utcopy - Object construction and conversion interfaces
*/
acpi_status
acpi_ut_build_simple_object(union acpi_operand_object *obj,
union acpi_object *user_obj,
u8 *data_space, u32 *buffer_space_used);
 
acpi_status
acpi_ut_build_package_object(union acpi_operand_object *obj,
u8 *buffer, u32 *space_used);
 
acpi_status
acpi_ut_copy_iobject_to_eobject(union acpi_operand_object *obj,
struct acpi_buffer *ret_buffer);
 
acpi_status
acpi_ut_copy_eobject_to_iobject(union acpi_object *obj,
union acpi_operand_object **internal_obj);
 
acpi_status
acpi_ut_copy_isimple_to_isimple(union acpi_operand_object *source_obj,
union acpi_operand_object *dest_obj);
 
acpi_status
acpi_ut_copy_iobject_to_iobject(union acpi_operand_object *source_desc,
union acpi_operand_object **dest_desc,
struct acpi_walk_state *walk_state);
 
/*
* utcreate - Object creation
*/
acpi_status
acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action);
 
/*
* utdebug - Debug interfaces
*/
void acpi_ut_init_stack_ptr_trace(void);
 
void acpi_ut_track_stack_ptr(void);
 
void
acpi_ut_trace(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id);
 
void
acpi_ut_trace_ptr(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id, void *pointer);
 
void
acpi_ut_trace_u32(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id, u32 integer);
 
void
acpi_ut_trace_str(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id, char *string);
 
void
acpi_ut_exit(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id);
 
void
acpi_ut_status_exit(u32 line_number,
const char *function_name,
const char *module_name,
u32 component_id, acpi_status status);
 
void
acpi_ut_value_exit(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id, u64 value);
 
void
acpi_ut_ptr_exit(u32 line_number,
const char *function_name,
const char *module_name, u32 component_id, u8 *ptr);
 
void
acpi_ut_debug_dump_buffer(u8 *buffer, u32 count, u32 display, u32 component_id);
 
void acpi_ut_dump_buffer(u8 *buffer, u32 count, u32 display, u32 offset);
 
#ifdef ACPI_APPLICATION
void
acpi_ut_dump_buffer_to_file(ACPI_FILE file,
u8 *buffer,
u32 count, u32 display, u32 base_offset);
#endif
 
void acpi_ut_report_error(char *module_name, u32 line_number);
 
void acpi_ut_report_info(char *module_name, u32 line_number);
 
void acpi_ut_report_warning(char *module_name, u32 line_number);
 
/*
* utdelete - Object deletion and reference counts
*/
void acpi_ut_add_reference(union acpi_operand_object *object);
 
void acpi_ut_remove_reference(union acpi_operand_object *object);
 
void acpi_ut_delete_internal_package_object(union acpi_operand_object *object);
 
void acpi_ut_delete_internal_simple_object(union acpi_operand_object *object);
 
void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list);
 
/*
* uteval - object evaluation
*/
acpi_status
acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
char *path,
u32 expected_return_btypes,
union acpi_operand_object **return_desc);
 
acpi_status
acpi_ut_evaluate_numeric_object(char *object_name,
struct acpi_namespace_node *device_node,
u64 *value);
 
acpi_status
acpi_ut_execute_STA(struct acpi_namespace_node *device_node, u32 *status_flags);
 
acpi_status
acpi_ut_execute_power_methods(struct acpi_namespace_node *device_node,
const char **method_names,
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
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
struct acpi_pnp_device_id ** return_id);
 
acpi_status
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);
 
acpi_status
acpi_ut_execute_CLS(struct acpi_namespace_node *device_node,
struct acpi_pnp_device_id **return_id);
 
/*
* utlock - reader/writer locks
*/
acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock);
 
void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock);
 
acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock);
 
acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock);
 
acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock);
 
void acpi_ut_release_write_lock(struct acpi_rw_lock *lock);
 
/*
* utobject - internal object create/delete/cache routines
*/
union acpi_operand_object *acpi_ut_create_internal_object_dbg(const char
*module_name,
u32 line_number,
u32 component_id,
acpi_object_type
type);
 
void *acpi_ut_allocate_object_desc_dbg(const char *module_name,
u32 line_number, u32 component_id);
 
#define acpi_ut_create_internal_object(t) acpi_ut_create_internal_object_dbg (_acpi_module_name,__LINE__,_COMPONENT,t)
#define acpi_ut_allocate_object_desc() acpi_ut_allocate_object_desc_dbg (_acpi_module_name,__LINE__,_COMPONENT)
 
void acpi_ut_delete_object_desc(union acpi_operand_object *object);
 
u8 acpi_ut_valid_internal_object(void *object);
 
union acpi_operand_object *acpi_ut_create_package_object(u32 count);
 
union acpi_operand_object *acpi_ut_create_integer_object(u64 value);
 
union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size);
 
union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size);
 
acpi_status
acpi_ut_get_object_size(union acpi_operand_object *obj, acpi_size * obj_length);
 
/*
* utosi - Support for the _OSI predefined control method
*/
acpi_status acpi_ut_initialize_interfaces(void);
 
acpi_status acpi_ut_interface_terminate(void);
 
acpi_status acpi_ut_install_interface(acpi_string interface_name);
 
acpi_status acpi_ut_remove_interface(acpi_string interface_name);
 
acpi_status acpi_ut_update_interfaces(u8 action);
 
struct acpi_interface_info *acpi_ut_get_interface(acpi_string interface_name);
 
acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state);
 
/*
* utpredef - support for predefined names
*/
const union acpi_predefined_info *acpi_ut_get_next_predefined_method(const union
acpi_predefined_info
*this_name);
 
const union acpi_predefined_info *acpi_ut_match_predefined_method(char *name);
 
void acpi_ut_get_expected_return_types(char *buffer, u32 expected_btypes);
 
#if (defined ACPI_ASL_COMPILER || defined ACPI_HELP_APP)
const union acpi_predefined_info *acpi_ut_match_resource_name(char *name);
 
void
acpi_ut_display_predefined_method(char *buffer,
const union acpi_predefined_info *this_name,
u8 multi_line);
 
u32 acpi_ut_get_resource_bit_width(char *buffer, u16 types);
#endif
 
/*
* utstate - Generic state creation/cache routines
*/
void
acpi_ut_push_generic_state(union acpi_generic_state **list_head,
union acpi_generic_state *state);
 
union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
**list_head);
 
union acpi_generic_state *acpi_ut_create_generic_state(void);
 
struct acpi_thread_state *acpi_ut_create_thread_state(void);
 
union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
*object, u16 action);
 
union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
void *external_object,
u16 index);
 
acpi_status
acpi_ut_create_update_state_and_push(union acpi_operand_object *object,
u16 action,
union acpi_generic_state **state_list);
 
union acpi_generic_state *acpi_ut_create_control_state(void);
 
void acpi_ut_delete_generic_state(union acpi_generic_state *state);
 
/*
* utmath
*/
acpi_status
acpi_ut_divide(u64 in_dividend,
u64 in_divisor, u64 *out_quotient, u64 *out_remainder);
 
acpi_status
acpi_ut_short_divide(u64 in_dividend,
u32 divisor, u64 *out_quotient, u32 *out_remainder);
 
/*
* utmisc
*/
const struct acpi_exception_info *acpi_ut_validate_exception(acpi_status
status);
 
u8 acpi_ut_is_pci_root_bridge(char *id);
 
#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_NAMES_APP)
u8 acpi_ut_is_aml_table(struct acpi_table_header *table);
#endif
 
acpi_status
acpi_ut_walk_package_tree(union acpi_operand_object *source_object,
void *target_object,
acpi_pkg_callback walk_callback, void *context);
 
/* Values for Base above (16=Hex, 10=Decimal) */
 
#define ACPI_ANY_BASE 0
 
u32 acpi_ut_dword_byte_swap(u32 value);
 
void acpi_ut_set_integer_width(u8 revision);
 
#ifdef ACPI_DEBUG_OUTPUT
void
acpi_ut_display_init_pathname(u8 type,
struct acpi_namespace_node *obj_handle,
char *path);
#endif
 
/*
* utownerid - Support for Table/Method Owner IDs
*/
acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id);
 
void acpi_ut_release_owner_id(acpi_owner_id * owner_id);
 
/*
* utresrc
*/
acpi_status
acpi_ut_walk_aml_resources(struct acpi_walk_state *walk_state,
u8 *aml,
acpi_size aml_length,
acpi_walk_aml_callback user_function,
void **context);
 
acpi_status
acpi_ut_validate_resource(struct acpi_walk_state *walk_state,
void *aml, u8 *return_index);
 
u32 acpi_ut_get_descriptor_length(void *aml);
 
u16 acpi_ut_get_resource_length(void *aml);
 
u8 acpi_ut_get_resource_header_length(void *aml);
 
u8 acpi_ut_get_resource_type(void *aml);
 
acpi_status
acpi_ut_get_resource_end_tag(union acpi_operand_object *obj_desc, u8 **end_tag);
 
/*
* utstring - String and character utilities
*/
void acpi_ut_print_string(char *string, u16 max_length);
 
#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP
void ut_convert_backslashes(char *pathname);
#endif
 
u8 acpi_ut_valid_acpi_name(char *name);
 
u8 acpi_ut_valid_acpi_char(char character, u32 position);
 
void acpi_ut_repair_name(char *name);
 
#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source);
 
u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source);
 
u8
acpi_ut_safe_strncat(char *dest,
acpi_size dest_size,
char *source, acpi_size max_transfer_length);
#endif
 
/*
* utmutex - mutex support
*/
acpi_status acpi_ut_mutex_initialize(void);
 
void acpi_ut_mutex_terminate(void);
 
acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id);
 
acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id);
 
/*
* utalloc - memory allocation and object caching
*/
acpi_status acpi_ut_create_caches(void);
 
acpi_status acpi_ut_delete_caches(void);
 
acpi_status acpi_ut_validate_buffer(struct acpi_buffer *buffer);
 
acpi_status
acpi_ut_initialize_buffer(struct acpi_buffer *buffer,
acpi_size required_length);
 
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
void *acpi_ut_allocate_and_track(acpi_size size,
u32 component, const char *module, u32 line);
 
void *acpi_ut_allocate_zeroed_and_track(acpi_size size,
u32 component,
const char *module, u32 line);
 
void
acpi_ut_free_and_track(void *address,
u32 component, const char *module, u32 line);
 
void acpi_ut_dump_allocation_info(void);
 
void acpi_ut_dump_allocations(u32 component, const char *module);
 
acpi_status
acpi_ut_create_list(char *list_name,
u16 object_size, struct acpi_memory_list **return_cache);
 
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
 
/*
* utaddress - address range check
*/
acpi_status
acpi_ut_add_address_range(acpi_adr_space_type space_id,
acpi_physical_address address,
u32 length, struct acpi_namespace_node *region_node);
 
void
acpi_ut_remove_address_range(acpi_adr_space_type space_id,
struct acpi_namespace_node *region_node);
 
u32
acpi_ut_check_address_range(acpi_adr_space_type space_id,
acpi_physical_address address, u32 length, u8 warn);
 
void acpi_ut_delete_address_lists(void);
 
/*
* utxferror - various error/warning output functions
*/
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_warning(const char *module_name,
u32 line_number,
char *pathname,
u8 node_flags, const char *format, ...);
 
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_info(const char *module_name,
u32 line_number,
char *pathname, u8 node_flags, const char *format, ...);
 
void ACPI_INTERNAL_VAR_XFACE
acpi_ut_predefined_bios_error(const char *module_name,
u32 line_number,
char *pathname,
u8 node_flags, const char *format, ...);
 
void
acpi_ut_namespace_error(const char *module_name,
u32 line_number,
const char *internal_name, acpi_status lookup_status);
 
void
acpi_ut_method_error(const char *module_name,
u32 line_number,
const char *message,
struct acpi_namespace_node *node,
const char *path, acpi_status lookup_status);
 
/*
* Utility functions for ACPI names and IDs
*/
const struct ah_predefined_name *acpi_ah_match_predefined_name(char *nameseg);
 
const struct ah_device_id *acpi_ah_match_hardware_id(char *hid);
 
const char *acpi_ah_match_uuid(u8 *data);
 
/*
* utprint - printf/vprintf output functions
*/
const char *acpi_ut_scan_number(const char *string, u64 *number_ptr);
 
const char *acpi_ut_print_number(char *string, u64 number);
 
int
acpi_ut_vsnprintf(char *string,
acpi_size size, const char *format, va_list args);
 
int acpi_ut_snprintf(char *string, acpi_size size, const char *format, ...);
 
#ifdef ACPI_APPLICATION
int acpi_ut_file_vprintf(ACPI_FILE file, const char *format, va_list args);
 
int acpi_ut_file_printf(ACPI_FILE file, const char *format, ...);
#endif
 
/*
* utuuid -- UUID support functions
*/
#if (defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP || defined ACPI_HELP_APP)
void acpi_ut_convert_string_to_uuid(char *in_string, u8 *uuid_buffer);
#endif
 
#endif /* _ACUTILS_H */
/drivers/acpi/acpica/amlcode.h
0,0 → 1,488
/******************************************************************************
*
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
*
*****************************************************************************/
 
/*
* 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.
*/
 
#ifndef __AMLCODE_H__
#define __AMLCODE_H__
 
/* primary opcodes */
 
#define AML_NULL_CHAR (u16) 0x00
 
#define AML_ZERO_OP (u16) 0x00
#define AML_ONE_OP (u16) 0x01
#define AML_UNASSIGNED (u16) 0x02
#define AML_ALIAS_OP (u16) 0x06
#define AML_NAME_OP (u16) 0x08
#define AML_BYTE_OP (u16) 0x0a
#define AML_WORD_OP (u16) 0x0b
#define AML_DWORD_OP (u16) 0x0c
#define AML_STRING_OP (u16) 0x0d
#define AML_QWORD_OP (u16) 0x0e /* ACPI 2.0 */
#define AML_SCOPE_OP (u16) 0x10
#define AML_BUFFER_OP (u16) 0x11
#define AML_PACKAGE_OP (u16) 0x12
#define AML_VAR_PACKAGE_OP (u16) 0x13 /* ACPI 2.0 */
#define AML_METHOD_OP (u16) 0x14
#define AML_EXTERNAL_OP (u16) 0x15 /* ACPI 6.0 */
#define AML_DUAL_NAME_PREFIX (u16) 0x2e
#define AML_MULTI_NAME_PREFIX_OP (u16) 0x2f
#define AML_NAME_CHAR_SUBSEQ (u16) 0x30
#define AML_NAME_CHAR_FIRST (u16) 0x41
#define AML_EXTENDED_OP_PREFIX (u16) 0x5b
#define AML_ROOT_PREFIX (u16) 0x5c
#define AML_PARENT_PREFIX (u16) 0x5e
#define AML_LOCAL_OP (u16) 0x60
#define AML_LOCAL0 (u16) 0x60
#define AML_LOCAL1 (u16) 0x61
#define AML_LOCAL2 (u16) 0x62
#define AML_LOCAL3 (u16) 0x63
#define AML_LOCAL4 (u16) 0x64
#define AML_LOCAL5 (u16) 0x65
#define AML_LOCAL6 (u16) 0x66
#define AML_LOCAL7 (u16) 0x67
#define AML_ARG_OP (u16) 0x68
#define AML_ARG0 (u16) 0x68
#define AML_ARG1 (u16) 0x69
#define AML_ARG2 (u16) 0x6a
#define AML_ARG3 (u16) 0x6b
#define AML_ARG4 (u16) 0x6c
#define AML_ARG5 (u16) 0x6d
#define AML_ARG6 (u16) 0x6e
#define AML_STORE_OP (u16) 0x70
#define AML_REF_OF_OP (u16) 0x71
#define AML_ADD_OP (u16) 0x72
#define AML_CONCAT_OP (u16) 0x73
#define AML_SUBTRACT_OP (u16) 0x74
#define AML_INCREMENT_OP (u16) 0x75
#define AML_DECREMENT_OP (u16) 0x76
#define AML_MULTIPLY_OP (u16) 0x77
#define AML_DIVIDE_OP (u16) 0x78
#define AML_SHIFT_LEFT_OP (u16) 0x79
#define AML_SHIFT_RIGHT_OP (u16) 0x7a
#define AML_BIT_AND_OP (u16) 0x7b
#define AML_BIT_NAND_OP (u16) 0x7c
#define AML_BIT_OR_OP (u16) 0x7d
#define AML_BIT_NOR_OP (u16) 0x7e
#define AML_BIT_XOR_OP (u16) 0x7f
#define AML_BIT_NOT_OP (u16) 0x80
#define AML_FIND_SET_LEFT_BIT_OP (u16) 0x81
#define AML_FIND_SET_RIGHT_BIT_OP (u16) 0x82
#define AML_DEREF_OF_OP (u16) 0x83
#define AML_CONCAT_RES_OP (u16) 0x84 /* ACPI 2.0 */
#define AML_MOD_OP (u16) 0x85 /* ACPI 2.0 */
#define AML_NOTIFY_OP (u16) 0x86
#define AML_SIZE_OF_OP (u16) 0x87
#define AML_INDEX_OP (u16) 0x88
#define AML_MATCH_OP (u16) 0x89
#define AML_CREATE_DWORD_FIELD_OP (u16) 0x8a
#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_CREATE_QWORD_FIELD_OP (u16) 0x8f /* ACPI 2.0 */
#define AML_LAND_OP (u16) 0x90
#define AML_LOR_OP (u16) 0x91
#define AML_LNOT_OP (u16) 0x92
#define AML_LEQUAL_OP (u16) 0x93
#define AML_LGREATER_OP (u16) 0x94
#define AML_LLESS_OP (u16) 0x95
#define AML_TO_BUFFER_OP (u16) 0x96 /* ACPI 2.0 */
#define AML_TO_DECSTRING_OP (u16) 0x97 /* ACPI 2.0 */
#define AML_TO_HEXSTRING_OP (u16) 0x98 /* ACPI 2.0 */
#define AML_TO_INTEGER_OP (u16) 0x99 /* ACPI 2.0 */
#define AML_TO_STRING_OP (u16) 0x9c /* ACPI 2.0 */
#define AML_COPY_OP (u16) 0x9d /* ACPI 2.0 */
#define AML_MID_OP (u16) 0x9e /* ACPI 2.0 */
#define AML_CONTINUE_OP (u16) 0x9f /* ACPI 2.0 */
#define AML_IF_OP (u16) 0xa0
#define AML_ELSE_OP (u16) 0xa1
#define AML_WHILE_OP (u16) 0xa2
#define AML_NOOP_OP (u16) 0xa3
#define AML_RETURN_OP (u16) 0xa4
#define AML_BREAK_OP (u16) 0xa5
#define AML_BREAK_POINT_OP (u16) 0xcc
#define AML_ONES_OP (u16) 0xff
 
/* prefixed opcodes */
 
#define AML_EXTENDED_OPCODE (u16) 0x5b00 /* prefix for 2-byte opcodes */
 
#define AML_MUTEX_OP (u16) 0x5b01
#define AML_EVENT_OP (u16) 0x5b02
#define AML_SHIFT_RIGHT_BIT_OP (u16) 0x5b10
#define AML_SHIFT_LEFT_BIT_OP (u16) 0x5b11
#define AML_COND_REF_OF_OP (u16) 0x5b12
#define AML_CREATE_FIELD_OP (u16) 0x5b13
#define AML_LOAD_TABLE_OP (u16) 0x5b1f /* ACPI 2.0 */
#define AML_LOAD_OP (u16) 0x5b20
#define AML_STALL_OP (u16) 0x5b21
#define AML_SLEEP_OP (u16) 0x5b22
#define AML_ACQUIRE_OP (u16) 0x5b23
#define AML_SIGNAL_OP (u16) 0x5b24
#define AML_WAIT_OP (u16) 0x5b25
#define AML_RESET_OP (u16) 0x5b26
#define AML_RELEASE_OP (u16) 0x5b27
#define AML_FROM_BCD_OP (u16) 0x5b28
#define AML_TO_BCD_OP (u16) 0x5b29
#define AML_UNLOAD_OP (u16) 0x5b2a
#define AML_REVISION_OP (u16) 0x5b30
#define AML_DEBUG_OP (u16) 0x5b31
#define AML_FATAL_OP (u16) 0x5b32
#define AML_TIMER_OP (u16) 0x5b33 /* ACPI 3.0 */
#define AML_REGION_OP (u16) 0x5b80
#define AML_FIELD_OP (u16) 0x5b81
#define AML_DEVICE_OP (u16) 0x5b82
#define AML_PROCESSOR_OP (u16) 0x5b83
#define AML_POWER_RES_OP (u16) 0x5b84
#define AML_THERMAL_ZONE_OP (u16) 0x5b85
#define AML_INDEX_FIELD_OP (u16) 0x5b86
#define AML_BANK_FIELD_OP (u16) 0x5b87
#define AML_DATA_REGION_OP (u16) 0x5b88 /* ACPI 2.0 */
 
/*
* Combination opcodes (actually two one-byte opcodes)
* Used by the disassembler and iASL compiler
*/
#define AML_LGREATEREQUAL_OP (u16) 0x9295
#define AML_LLESSEQUAL_OP (u16) 0x9294
#define AML_LNOTEQUAL_OP (u16) 0x9293
 
/*
* Opcodes for "Field" operators
*/
#define AML_FIELD_OFFSET_OP (u8) 0x00
#define AML_FIELD_ACCESS_OP (u8) 0x01
#define AML_FIELD_CONNECTION_OP (u8) 0x02 /* ACPI 5.0 */
#define AML_FIELD_EXT_ACCESS_OP (u8) 0x03 /* ACPI 5.0 */
 
/*
* Internal opcodes
* Use only "Unknown" AML opcodes, don't attempt to use
* any valid ACPI ASCII values (A-Z, 0-9, '-')
*/
#define AML_INT_NAMEPATH_OP (u16) 0x002d
#define AML_INT_NAMEDFIELD_OP (u16) 0x0030
#define AML_INT_RESERVEDFIELD_OP (u16) 0x0031
#define AML_INT_ACCESSFIELD_OP (u16) 0x0032
#define AML_INT_BYTELIST_OP (u16) 0x0033
#define AML_INT_METHODCALL_OP (u16) 0x0035
#define AML_INT_RETURN_VALUE_OP (u16) 0x0036
#define AML_INT_EVAL_SUBTREE_OP (u16) 0x0037
#define AML_INT_CONNECTION_OP (u16) 0x0038
#define AML_INT_EXTACCESSFIELD_OP (u16) 0x0039
 
#define ARG_NONE 0x0
 
/*
* Argument types for the AML Parser
* Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types
* Zero is reserved as end-of-list indicator
*/
#define ARGP_BYTEDATA 0x01
#define ARGP_BYTELIST 0x02
#define ARGP_CHARLIST 0x03
#define ARGP_DATAOBJ 0x04
#define ARGP_DATAOBJLIST 0x05
#define ARGP_DWORDDATA 0x06
#define ARGP_FIELDLIST 0x07
#define ARGP_NAME 0x08
#define ARGP_NAMESTRING 0x09
#define ARGP_OBJLIST 0x0A
#define ARGP_PKGLENGTH 0x0B
#define ARGP_SUPERNAME 0x0C
#define ARGP_TARGET 0x0D
#define ARGP_TERMARG 0x0E
#define ARGP_TERMLIST 0x0F
#define ARGP_WORDDATA 0x10
#define ARGP_QWORDDATA 0x11
#define ARGP_SIMPLENAME 0x12
 
/*
* Resolved argument types for the AML Interpreter
* Each field in the arg_types u32 is 5 bits, allowing for a maximum of 6 arguments.
* There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
*
* Note1: These values are completely independent from the ACPI_TYPEs
* i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
*
* Note2: If and when 5 bits becomes insufficient, it would probably be best
* to convert to a 6-byte array of argument types, allowing 8 bits per argument.
*/
 
/* Single, simple types */
 
#define ARGI_ANYTYPE 0x01 /* Don't care */
#define ARGI_PACKAGE 0x02
#define ARGI_EVENT 0x03
#define ARGI_MUTEX 0x04
#define ARGI_DDBHANDLE 0x05
 
/* Interchangeable types (via implicit conversion) */
 
#define ARGI_INTEGER 0x06
#define ARGI_STRING 0x07
#define ARGI_BUFFER 0x08
#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */
#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */
 
/* Reference objects */
 
#define ARGI_INTEGER_REF 0x0B
#define ARGI_OBJECT_REF 0x0C
#define ARGI_DEVICE_REF 0x0D
#define ARGI_REFERENCE 0x0E
#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */
#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */
#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */
#define ARGI_STORE_TARGET 0x12 /* Target for store is TARGETREF + package objects */
 
/* Multiple/complex types */
 
#define ARGI_DATAOBJECT 0x13 /* Buffer, String, package or reference to a node - Used only by size_of operator */
#define ARGI_COMPLEXOBJ 0x14 /* Buffer, String, or package (Used by INDEX op only) */
#define ARGI_REF_OR_STRING 0x15 /* Reference or String (Used by DEREFOF op only) */
#define ARGI_REGION_OR_BUFFER 0x16 /* Used by LOAD op only */
#define ARGI_DATAREFOBJ 0x17
 
/* Note: types above can expand to 0x1F maximum */
 
#define ARGI_INVALID_OPCODE 0xFFFFFFFF
 
/*
* hash offsets
*/
#define AML_EXTOP_HASH_OFFSET 22
#define AML_LNOT_HASH_OFFSET 19
 
/*
* opcode groups and types
*/
#define OPGRP_NAMED 0x01
#define OPGRP_FIELD 0x02
#define OPGRP_BYTELIST 0x04
 
/*
* Opcode information
*/
 
/* Opcode flags */
 
#define AML_LOGICAL 0x0001
#define AML_LOGICAL_NUMERIC 0x0002
#define AML_MATH 0x0004
#define AML_CREATE 0x0008
#define AML_FIELD 0x0010
#define AML_DEFER 0x0020
#define AML_NAMED 0x0040
#define AML_NSNODE 0x0080
#define AML_NSOPCODE 0x0100
#define AML_NSOBJECT 0x0200
#define AML_HAS_RETVAL 0x0400
#define AML_HAS_TARGET 0x0800
#define AML_HAS_ARGS 0x1000
#define AML_CONSTANT 0x2000
#define AML_NO_OPERAND_RESOLVE 0x4000
 
/* Convenient flag groupings */
 
#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL
#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */
#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */
#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET
#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* monadic2_r */
#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */
#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */
#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* dyadic2_r */
#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS
#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL
 
/*
* The opcode Type is used in a dispatch table, do not change
* without updating the table.
*/
#define AML_TYPE_EXEC_0A_0T_1R 0x00
#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */
#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */
#define AML_TYPE_EXEC_1A_1T_0R 0x03
#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* monadic2_r */
#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */
#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */
#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* dyadic2_r */
#define AML_TYPE_EXEC_2A_2T_1R 0x08
#define AML_TYPE_EXEC_3A_0T_0R 0x09
#define AML_TYPE_EXEC_3A_1T_1R 0x0A
#define AML_TYPE_EXEC_6A_0T_1R 0x0B
/* End of types used in dispatch table */
 
#define AML_TYPE_LITERAL 0x0B
#define AML_TYPE_CONSTANT 0x0C
#define AML_TYPE_METHOD_ARGUMENT 0x0D
#define AML_TYPE_LOCAL_VARIABLE 0x0E
#define AML_TYPE_DATA_TERM 0x0F
 
/* Generic for an op that returns a value */
 
#define AML_TYPE_METHOD_CALL 0x10
 
/* Misc */
 
#define AML_TYPE_CREATE_FIELD 0x11
#define AML_TYPE_CREATE_OBJECT 0x12
#define AML_TYPE_CONTROL 0x13
#define AML_TYPE_NAMED_NO_OBJ 0x14
#define AML_TYPE_NAMED_FIELD 0x15
#define AML_TYPE_NAMED_SIMPLE 0x16
#define AML_TYPE_NAMED_COMPLEX 0x17
#define AML_TYPE_RETURN 0x18
 
#define AML_TYPE_UNDEFINED 0x19
#define AML_TYPE_BOGUS 0x1A
 
/* AML Package Length encodings */
 
#define ACPI_AML_PACKAGE_TYPE1 0x40
#define ACPI_AML_PACKAGE_TYPE2 0x4000
#define ACPI_AML_PACKAGE_TYPE3 0x400000
#define ACPI_AML_PACKAGE_TYPE4 0x40000000
 
/*
* Opcode classes
*/
#define AML_CLASS_EXECUTE 0x00
#define AML_CLASS_CREATE 0x01
#define AML_CLASS_ARGUMENT 0x02
#define AML_CLASS_NAMED_OBJECT 0x03
#define AML_CLASS_CONTROL 0x04
#define AML_CLASS_ASCII 0x05
#define AML_CLASS_PREFIX 0x06
#define AML_CLASS_INTERNAL 0x07
#define AML_CLASS_RETURN_VALUE 0x08
#define AML_CLASS_METHOD_CALL 0x09
#define AML_CLASS_UNKNOWN 0x0A
 
/* Comparison operation codes for match_op operator */
 
typedef enum {
MATCH_MTR = 0,
MATCH_MEQ = 1,
MATCH_MLE = 2,
MATCH_MLT = 3,
MATCH_MGE = 4,
MATCH_MGT = 5
} AML_MATCH_OPERATOR;
 
#define MAX_MATCH_OPERATOR 5
 
/*
* field_flags
*
* This byte is extracted from the AML and includes three separate
* pieces of information about the field:
* 1) The field access type
* 2) The field update rule
* 3) The lock rule for the field
*
* Bits 00 - 03 : access_type (any_acc, byte_acc, etc.)
* 04 : lock_rule (1 == Lock)
* 05 - 06 : update_rule
*/
#define AML_FIELD_ACCESS_TYPE_MASK 0x0F
#define AML_FIELD_LOCK_RULE_MASK 0x10
#define AML_FIELD_UPDATE_RULE_MASK 0x60
 
/* 1) Field Access Types */
 
typedef enum {
AML_FIELD_ACCESS_ANY = 0x00,
AML_FIELD_ACCESS_BYTE = 0x01,
AML_FIELD_ACCESS_WORD = 0x02,
AML_FIELD_ACCESS_DWORD = 0x03,
AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */
AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */
} AML_ACCESS_TYPE;
 
/* 2) Field Lock Rules */
 
typedef enum {
AML_FIELD_LOCK_NEVER = 0x00,
AML_FIELD_LOCK_ALWAYS = 0x10
} AML_LOCK_RULE;
 
/* 3) Field Update Rules */
 
typedef enum {
AML_FIELD_UPDATE_PRESERVE = 0x00,
AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20,
AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
} AML_UPDATE_RULE;
 
/*
* Field Access Attributes.
* This byte is extracted from the AML via the
* access_as keyword
*/
typedef enum {
AML_FIELD_ATTRIB_QUICK = 0x02,
AML_FIELD_ATTRIB_SEND_RCV = 0x04,
AML_FIELD_ATTRIB_BYTE = 0x06,
AML_FIELD_ATTRIB_WORD = 0x08,
AML_FIELD_ATTRIB_BLOCK = 0x0A,
AML_FIELD_ATTRIB_MULTIBYTE = 0x0B,
AML_FIELD_ATTRIB_WORD_CALL = 0x0C,
AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D,
AML_FIELD_ATTRIB_RAW_BYTES = 0x0E,
AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F
} AML_ACCESS_ATTRIBUTE;
 
/* Bit fields in the AML method_flags byte */
 
#define AML_METHOD_ARG_COUNT 0x07
#define AML_METHOD_SERIALIZED 0x08
#define AML_METHOD_SYNC_LEVEL 0xF0
 
#endif /* __AMLCODE_H__ */
/drivers/acpi/acpica/amlresrc.h
0,0 → 1,486
/******************************************************************************
*
* Module Name: amlresrc.h - AML resource descriptors
*
*****************************************************************************/
 
/*
* 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.
*/
 
/* acpisrc:struct_defs -- for acpisrc conversion */
 
#ifndef __AMLRESRC_H
#define __AMLRESRC_H
 
/*
* Resource descriptor tags, as defined in the ACPI specification.
* Used to symbolically reference fields within a descriptor.
*/
#define ACPI_RESTAG_ADDRESS "_ADR"
#define ACPI_RESTAG_ALIGNMENT "_ALN"
#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
#define ACPI_RESTAG_BASEADDRESS "_BAS"
#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
#define ACPI_RESTAG_DEBOUNCETIME "_DBT"
#define ACPI_RESTAG_DECODE "_DEC"
#define ACPI_RESTAG_DEVICEPOLARITY "_DPL"
#define ACPI_RESTAG_DMA "_DMA"
#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
#define ACPI_RESTAG_DRIVESTRENGTH "_DRS"
#define ACPI_RESTAG_ENDIANNESS "_END"
#define ACPI_RESTAG_FLOWCONTROL "_FLC"
#define ACPI_RESTAG_GRANULARITY "_GRA"
#define ACPI_RESTAG_INTERRUPT "_INT"
#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* active_lo(1), active_hi(0) */
#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), no_share(0) */
#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
#define ACPI_RESTAG_IORESTRICTION "_IOR"
#define ACPI_RESTAG_LENGTH "_LEN"
#define ACPI_RESTAG_LINE "_LIN"
#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
#define ACPI_RESTAG_MEMTYPE "_MEM" /* non_cache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
#define ACPI_RESTAG_MAXADDR "_MAX"
#define ACPI_RESTAG_MINADDR "_MIN"
#define ACPI_RESTAG_MAXTYPE "_MAF"
#define ACPI_RESTAG_MINTYPE "_MIF"
#define ACPI_RESTAG_MODE "_MOD"
#define ACPI_RESTAG_PARITY "_PAR"
#define ACPI_RESTAG_PHASE "_PHA"
#define ACPI_RESTAG_PIN "_PIN"
#define ACPI_RESTAG_PINCONFIG "_PPI"
#define ACPI_RESTAG_POLARITY "_POL"
#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
#define ACPI_RESTAG_RANGETYPE "_RNG"
#define ACPI_RESTAG_READWRITETYPE "_RW_" /* read_only(0), Writeable (1) */
#define ACPI_RESTAG_LENGTH_RX "_RXL"
#define ACPI_RESTAG_LENGTH_TX "_TXL"
#define ACPI_RESTAG_SLAVEMODE "_SLV"
#define ACPI_RESTAG_SPEED "_SPE"
#define ACPI_RESTAG_STOPBITS "_STB"
#define ACPI_RESTAG_TRANSLATION "_TRA"
#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
#define ACPI_RESTAG_VENDORDATA "_VEN"
 
/* Default sizes for "small" resource descriptors */
 
#define ASL_RDESC_IRQ_SIZE 0x02
#define ASL_RDESC_DMA_SIZE 0x02
#define ASL_RDESC_ST_DEPEND_SIZE 0x00
#define ASL_RDESC_END_DEPEND_SIZE 0x00
#define ASL_RDESC_IO_SIZE 0x07
#define ASL_RDESC_FIXED_IO_SIZE 0x03
#define ASL_RDESC_FIXED_DMA_SIZE 0x05
#define ASL_RDESC_END_TAG_SIZE 0x01
 
struct asl_resource_node {
u32 buffer_length;
void *buffer;
struct asl_resource_node *next;
};
 
struct asl_resource_info {
union acpi_parse_object *descriptor_type_op; /* Resource descriptor parse node */
union acpi_parse_object *mapping_op; /* Used for mapfile support */
u32 current_byte_offset; /* Offset in resource template */
};
 
/* Macros used to generate AML resource length fields */
 
#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (struct aml_resource_large_header))
#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (struct aml_resource_small_header))
 
/*
* Resource descriptors defined in the ACPI specification.
*
* Packing/alignment must be BYTE because these descriptors
* are used to overlay the raw AML byte stream.
*/
#pragma pack(1)
 
/*
* SMALL descriptors
*/
#define AML_RESOURCE_SMALL_HEADER_COMMON \
u8 descriptor_type;
 
struct aml_resource_small_header {
AML_RESOURCE_SMALL_HEADER_COMMON};
 
struct aml_resource_irq {
AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
u8 flags;
};
 
struct aml_resource_irq_noflags {
AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
};
 
struct aml_resource_dma {
AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
u8 flags;
};
 
struct aml_resource_start_dependent {
AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
};
 
struct aml_resource_start_dependent_noprio {
AML_RESOURCE_SMALL_HEADER_COMMON};
 
struct aml_resource_end_dependent {
AML_RESOURCE_SMALL_HEADER_COMMON};
 
struct aml_resource_io {
AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
u16 minimum;
u16 maximum;
u8 alignment;
u8 address_length;
};
 
struct aml_resource_fixed_io {
AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
u8 address_length;
};
 
struct aml_resource_vendor_small {
AML_RESOURCE_SMALL_HEADER_COMMON};
 
struct aml_resource_end_tag {
AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
};
 
struct aml_resource_fixed_dma {
AML_RESOURCE_SMALL_HEADER_COMMON u16 request_lines;
u16 channels;
u8 width;
};
 
/*
* LARGE descriptors
*/
#define AML_RESOURCE_LARGE_HEADER_COMMON \
u8 descriptor_type;\
u16 resource_length;
 
struct aml_resource_large_header {
AML_RESOURCE_LARGE_HEADER_COMMON};
 
/* General Flags for address space resource descriptors */
 
#define ACPI_RESOURCE_FLAG_DEC 2
#define ACPI_RESOURCE_FLAG_MIF 4
#define ACPI_RESOURCE_FLAG_MAF 8
 
struct aml_resource_memory24 {
AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u16 minimum;
u16 maximum;
u16 alignment;
u16 address_length;
};
 
struct aml_resource_vendor_large {
AML_RESOURCE_LARGE_HEADER_COMMON};
 
struct aml_resource_memory32 {
AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u32 minimum;
u32 maximum;
u32 alignment;
u32 address_length;
};
 
struct aml_resource_fixed_memory32 {
AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u32 address;
u32 address_length;
};
 
#define AML_RESOURCE_ADDRESS_COMMON \
u8 resource_type; \
u8 flags; \
u8 specific_flags;
 
struct aml_resource_address {
AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
 
struct aml_resource_extended_address64 {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON u8 revision_ID;
u8 reserved;
u64 granularity;
u64 minimum;
u64 maximum;
u64 translation_offset;
u64 address_length;
u64 type_specific;
};
 
#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
 
struct aml_resource_address64 {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON u64 granularity;
u64 minimum;
u64 maximum;
u64 translation_offset;
u64 address_length;
};
 
struct aml_resource_address32 {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON u32 granularity;
u32 minimum;
u32 maximum;
u32 translation_offset;
u32 address_length;
};
 
struct aml_resource_address16 {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_ADDRESS_COMMON u16 granularity;
u16 minimum;
u16 maximum;
u16 translation_offset;
u16 address_length;
};
 
struct aml_resource_extended_irq {
AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u8 interrupt_count;
u32 interrupts[1];
/* res_source_index, res_source optional fields follow */
};
 
struct aml_resource_generic_register {
AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
u8 bit_width;
u8 bit_offset;
u8 access_size; /* ACPI 3.0, was previously Reserved */
u64 address;
};
 
/* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */
 
struct aml_resource_gpio {
AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id;
u8 connection_type;
u16 flags;
u16 int_flags;
u8 pin_config;
u16 drive_strength;
u16 debounce_timeout;
u16 pin_table_offset;
u8 res_source_index;
u16 res_source_offset;
u16 vendor_offset;
u16 vendor_length;
/*
* Optional fields follow immediately:
* 1) PIN list (Words)
* 2) Resource Source String
* 3) Vendor Data bytes
*/
};
 
#define AML_RESOURCE_GPIO_REVISION 1 /* ACPI 5.0 */
 
/* Values for connection_type above */
 
#define AML_RESOURCE_GPIO_TYPE_INT 0
#define AML_RESOURCE_GPIO_TYPE_IO 1
#define AML_RESOURCE_MAX_GPIOTYPE 1
 
/* Common preamble for all serial descriptors (ACPI 5.0) */
 
#define AML_RESOURCE_SERIAL_COMMON \
u8 revision_id; \
u8 res_source_index; \
u8 type; \
u8 flags; \
u16 type_specific_flags; \
u8 type_revision_id; \
u16 type_data_length; \
 
/* Values for the type field above */
 
#define AML_RESOURCE_I2C_SERIALBUSTYPE 1
#define AML_RESOURCE_SPI_SERIALBUSTYPE 2
#define AML_RESOURCE_UART_SERIALBUSTYPE 3
#define AML_RESOURCE_MAX_SERIALBUSTYPE 3
#define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
 
struct aml_resource_common_serialbus {
AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_SERIAL_COMMON};
 
struct aml_resource_i2c_serialbus {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_SERIAL_COMMON u32 connection_speed;
u16 slave_address;
/*
* Optional fields follow immediately:
* 1) Vendor Data bytes
* 2) Resource Source String
*/
};
 
#define AML_RESOURCE_I2C_REVISION 1 /* ACPI 5.0 */
#define AML_RESOURCE_I2C_TYPE_REVISION 1 /* ACPI 5.0 */
#define AML_RESOURCE_I2C_MIN_DATA_LEN 6
 
struct aml_resource_spi_serialbus {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_SERIAL_COMMON u32 connection_speed;
u8 data_bit_length;
u8 clock_phase;
u8 clock_polarity;
u16 device_selection;
/*
* Optional fields follow immediately:
* 1) Vendor Data bytes
* 2) Resource Source String
*/
};
 
#define AML_RESOURCE_SPI_REVISION 1 /* ACPI 5.0 */
#define AML_RESOURCE_SPI_TYPE_REVISION 1 /* ACPI 5.0 */
#define AML_RESOURCE_SPI_MIN_DATA_LEN 9
 
struct aml_resource_uart_serialbus {
AML_RESOURCE_LARGE_HEADER_COMMON
AML_RESOURCE_SERIAL_COMMON u32 default_baud_rate;
u16 rx_fifo_size;
u16 tx_fifo_size;
u8 parity;
u8 lines_enabled;
/*
* Optional fields follow immediately:
* 1) Vendor Data bytes
* 2) Resource Source String
*/
};
 
#define AML_RESOURCE_UART_REVISION 1 /* ACPI 5.0 */
#define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */
#define AML_RESOURCE_UART_MIN_DATA_LEN 10
 
/* restore default alignment */
 
#pragma pack()
 
/* Union of all resource descriptors, so we can allocate the worst case */
 
union aml_resource {
/* Descriptor headers */
 
u8 descriptor_type;
struct aml_resource_small_header small_header;
struct aml_resource_large_header large_header;
 
/* Small resource descriptors */
 
struct aml_resource_irq irq;
struct aml_resource_dma dma;
struct aml_resource_start_dependent start_dpf;
struct aml_resource_end_dependent end_dpf;
struct aml_resource_io io;
struct aml_resource_fixed_io fixed_io;
struct aml_resource_fixed_dma fixed_dma;
struct aml_resource_vendor_small vendor_small;
struct aml_resource_end_tag end_tag;
 
/* Large resource descriptors */
 
struct aml_resource_memory24 memory24;
struct aml_resource_generic_register generic_reg;
struct aml_resource_vendor_large vendor_large;
struct aml_resource_memory32 memory32;
struct aml_resource_fixed_memory32 fixed_memory32;
struct aml_resource_address16 address16;
struct aml_resource_address32 address32;
struct aml_resource_address64 address64;
struct aml_resource_extended_address64 ext_address64;
struct aml_resource_extended_irq extended_irq;
struct aml_resource_gpio gpio;
struct aml_resource_i2c_serialbus i2c_serial_bus;
struct aml_resource_spi_serialbus spi_serial_bus;
struct aml_resource_uart_serialbus uart_serial_bus;
struct aml_resource_common_serialbus common_serial_bus;
 
/* Utility overlays */
 
struct aml_resource_address address;
u32 dword_item;
u16 word_item;
u8 byte_item;
};
 
/* Interfaces used by both the disassembler and compiler */
 
void
mp_save_gpio_info(union acpi_parse_object *op,
union aml_resource *resource,
u32 pin_count, u16 *pin_list, char *device_name);
 
void
mp_save_serial_info(union acpi_parse_object *op,
union aml_resource *resource, char *device_name);
 
char *mp_get_hid_from_parse_tree(struct acpi_namespace_node *hid_node);
 
char *mp_get_hid_via_namestring(char *device_name);
 
char *mp_get_connection_info(union acpi_parse_object *op,
u32 pin_index,
struct acpi_namespace_node **target_node,
char **target_name);
 
char *mp_get_parent_device_hid(union acpi_parse_object *op,
struct acpi_namespace_node **target_node,
char **parent_device_name);
 
char *mp_get_ddn_value(char *device_name);
 
char *mp_get_hid_value(struct acpi_namespace_node *device_node);
 
#endif
/drivers/acpi/acpica/dbcmds.c
0,0 → 1,1187
/*******************************************************************************
*
* Module Name: dbcmds - Miscellaneous debug commands and output 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 "acevents.h"
#include "acdebug.h"
#include "acnamesp.h"
#include "acresrc.h"
#include "actables.h"
 
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbcmds")
 
/* Local prototypes */
static void
acpi_dm_compare_aml_resources(u8 *aml1_buffer,
acpi_rsdesc_size aml1_buffer_length,
u8 *aml2_buffer,
acpi_rsdesc_size aml2_buffer_length);
 
static acpi_status
acpi_dm_test_resource_conversion(struct acpi_namespace_node *node, char *name);
 
static acpi_status
acpi_db_resource_callback(struct acpi_resource *resource, void *context);
 
static acpi_status
acpi_db_device_resources(acpi_handle obj_handle,
u32 nesting_level, void *context, void **return_value);
 
static void acpi_db_do_one_sleep_state(u8 sleep_state);
 
static char *acpi_db_trace_method_name = NULL;
 
/*******************************************************************************
*
* FUNCTION: acpi_db_convert_to_node
*
* PARAMETERS: in_string - String to convert
*
* RETURN: Pointer to a NS node
*
* DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
* alphanumeric strings.
*
******************************************************************************/
 
struct acpi_namespace_node *acpi_db_convert_to_node(char *in_string)
{
struct acpi_namespace_node *node;
acpi_size address;
 
if ((*in_string >= 0x30) && (*in_string <= 0x39)) {
 
/* Numeric argument, convert */
 
address = strtoul(in_string, NULL, 16);
node = ACPI_TO_POINTER(address);
if (!acpi_os_readable(node, sizeof(struct acpi_namespace_node))) {
acpi_os_printf("Address %p is invalid", node);
return (NULL);
}
 
/* Make sure pointer is valid NS node */
 
if (ACPI_GET_DESCRIPTOR_TYPE(node) != ACPI_DESC_TYPE_NAMED) {
acpi_os_printf
("Address %p is not a valid namespace node [%s]\n",
node, acpi_ut_get_descriptor_name(node));
return (NULL);
}
} else {
/*
* Alpha argument: The parameter is a name string that must be
* resolved to a Namespace object.
*/
node = acpi_db_local_ns_lookup(in_string);
if (!node) {
acpi_os_printf
("Could not find [%s] in namespace, defaulting to root node\n",
in_string);
node = acpi_gbl_root_node;
}
}
 
return (node);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_sleep
*
* PARAMETERS: object_arg - Desired sleep state (0-5). NULL means
* invoke all possible sleep states.
*
* RETURN: Status
*
* DESCRIPTION: Simulate sleep/wake sequences
*
******************************************************************************/
 
acpi_status acpi_db_sleep(char *object_arg)
{
u8 sleep_state;
u32 i;
 
ACPI_FUNCTION_TRACE(acpi_db_sleep);
 
/* Null input (no arguments) means to invoke all sleep states */
 
if (!object_arg) {
acpi_os_printf("Invoking all possible sleep states, 0-%d\n",
ACPI_S_STATES_MAX);
 
for (i = 0; i <= ACPI_S_STATES_MAX; i++) {
acpi_db_do_one_sleep_state((u8)i);
}
 
return_ACPI_STATUS(AE_OK);
}
 
/* Convert argument to binary and invoke the sleep state */
 
sleep_state = (u8)strtoul(object_arg, NULL, 0);
acpi_db_do_one_sleep_state(sleep_state);
return_ACPI_STATUS(AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_do_one_sleep_state
*
* PARAMETERS: sleep_state - Desired sleep state (0-5)
*
* RETURN: None
*
* DESCRIPTION: Simulate a sleep/wake sequence
*
******************************************************************************/
 
static void acpi_db_do_one_sleep_state(u8 sleep_state)
{
acpi_status status;
u8 sleep_type_a;
u8 sleep_type_b;
 
/* Validate parameter */
 
if (sleep_state > ACPI_S_STATES_MAX) {
acpi_os_printf("Sleep state %d out of range (%d max)\n",
sleep_state, ACPI_S_STATES_MAX);
return;
}
 
acpi_os_printf("\n---- Invoking sleep state S%d (%s):\n",
sleep_state, acpi_gbl_sleep_state_names[sleep_state]);
 
/* Get the values for the sleep type registers (for display only) */
 
status =
acpi_get_sleep_type_data(sleep_state, &sleep_type_a, &sleep_type_b);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not evaluate [%s] method, %s\n",
acpi_gbl_sleep_state_names[sleep_state],
acpi_format_exception(status));
return;
}
 
acpi_os_printf
("Register values for sleep state S%d: Sleep-A: %.2X, Sleep-B: %.2X\n",
sleep_state, sleep_type_a, sleep_type_b);
 
/* Invoke the various sleep/wake interfaces */
 
acpi_os_printf("**** Sleep: Prepare to sleep (S%d) ****\n",
sleep_state);
status = acpi_enter_sleep_state_prep(sleep_state);
if (ACPI_FAILURE(status)) {
goto error_exit;
}
 
acpi_os_printf("**** Sleep: Going to sleep (S%d) ****\n", sleep_state);
status = acpi_enter_sleep_state(sleep_state);
if (ACPI_FAILURE(status)) {
goto error_exit;
}
 
acpi_os_printf("**** Wake: Prepare to return from sleep (S%d) ****\n",
sleep_state);
status = acpi_leave_sleep_state_prep(sleep_state);
if (ACPI_FAILURE(status)) {
goto error_exit;
}
 
acpi_os_printf("**** Wake: Return from sleep (S%d) ****\n",
sleep_state);
status = acpi_leave_sleep_state(sleep_state);
if (ACPI_FAILURE(status)) {
goto error_exit;
}
 
return;
 
error_exit:
ACPI_EXCEPTION((AE_INFO, status, "During invocation of sleep state S%d",
sleep_state));
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_locks
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display information about internal mutexes.
*
******************************************************************************/
 
void acpi_db_display_locks(void)
{
u32 i;
 
for (i = 0; i < ACPI_MAX_MUTEX; i++) {
acpi_os_printf("%26s : %s\n", acpi_ut_get_mutex_name(i),
acpi_gbl_mutex_info[i].thread_id ==
ACPI_MUTEX_NOT_ACQUIRED ? "Locked" : "Unlocked");
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_table_info
*
* PARAMETERS: table_arg - Name of table to be displayed
*
* RETURN: None
*
* DESCRIPTION: Display information about loaded tables. Current
* implementation displays all loaded tables.
*
******************************************************************************/
 
void acpi_db_display_table_info(char *table_arg)
{
u32 i;
struct acpi_table_desc *table_desc;
acpi_status status;
 
/* Header */
 
acpi_os_printf("Idx ID Status Type "
"TableHeader (Sig, Address, Length, Misc)\n");
 
/* Walk the entire root table list */
 
for (i = 0; i < acpi_gbl_root_table_list.current_table_count; i++) {
table_desc = &acpi_gbl_root_table_list.tables[i];
 
/* Index and Table ID */
 
acpi_os_printf("%3u %.2u ", i, table_desc->owner_id);
 
/* Decode the table flags */
 
if (!(table_desc->flags & ACPI_TABLE_IS_LOADED)) {
acpi_os_printf("NotLoaded ");
} else {
acpi_os_printf(" Loaded ");
}
 
switch (table_desc->flags & ACPI_TABLE_ORIGIN_MASK) {
case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
 
acpi_os_printf("External/virtual ");
break;
 
case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
 
acpi_os_printf("Internal/physical ");
break;
 
case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
 
acpi_os_printf("Internal/virtual ");
break;
 
default:
 
acpi_os_printf("INVALID TYPE ");
break;
}
 
/* Make sure that the table is mapped */
 
status = acpi_tb_validate_table(table_desc);
if (ACPI_FAILURE(status)) {
return;
}
 
/* Dump the table header */
 
if (table_desc->pointer) {
acpi_tb_print_table_header(table_desc->address,
table_desc->pointer);
} else {
/* If the pointer is null, the table has been unloaded */
 
ACPI_INFO((AE_INFO, "%4.4s - Table has been unloaded",
table_desc->signature.ascii));
}
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_unload_acpi_table
*
* PARAMETERS: object_name - Namespace pathname for an object that
* is owned by the table to be unloaded
*
* RETURN: None
*
* DESCRIPTION: Unload an ACPI table, via any namespace node that is owned
* by the table.
*
******************************************************************************/
 
void acpi_db_unload_acpi_table(char *object_name)
{
struct acpi_namespace_node *node;
acpi_status status;
 
/* Translate name to an Named object */
 
node = acpi_db_convert_to_node(object_name);
if (!node) {
return;
}
 
status = acpi_unload_parent_table(ACPI_CAST_PTR(acpi_handle, node));
if (ACPI_SUCCESS(status)) {
acpi_os_printf("Parent of [%s] (%p) unloaded and uninstalled\n",
object_name, node);
} else {
acpi_os_printf("%s, while unloading parent table of [%s]\n",
acpi_format_exception(status), object_name);
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_send_notify
*
* PARAMETERS: name - Name of ACPI object where to send notify
* value - Value of the notify to send.
*
* RETURN: None
*
* DESCRIPTION: Send an ACPI notification. The value specified is sent to the
* named object as an ACPI notify.
*
******************************************************************************/
 
void acpi_db_send_notify(char *name, u32 value)
{
struct acpi_namespace_node *node;
acpi_status status;
 
/* Translate name to an Named object */
 
node = acpi_db_convert_to_node(name);
if (!node) {
return;
}
 
/* Dispatch the notify if legal */
 
if (acpi_ev_is_notify_object(node)) {
status = acpi_ev_queue_notify_request(node, value);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not queue notify\n");
}
} else {
acpi_os_printf("Named object [%4.4s] Type %s, "
"must be Device/Thermal/Processor type\n",
acpi_ut_get_node_name(node),
acpi_ut_get_type_name(node->type));
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_interfaces
*
* PARAMETERS: action_arg - Null, "install", or "remove"
* interface_name_arg - Name for install/remove options
*
* RETURN: None
*
* DESCRIPTION: Display or modify the global _OSI interface list
*
******************************************************************************/
 
void acpi_db_display_interfaces(char *action_arg, char *interface_name_arg)
{
struct acpi_interface_info *next_interface;
char *sub_string;
acpi_status status;
 
/* If no arguments, just display current interface list */
 
if (!action_arg) {
(void)acpi_os_acquire_mutex(acpi_gbl_osi_mutex,
ACPI_WAIT_FOREVER);
 
next_interface = acpi_gbl_supported_interfaces;
while (next_interface) {
if (!(next_interface->flags & ACPI_OSI_INVALID)) {
acpi_os_printf("%s\n", next_interface->name);
}
 
next_interface = next_interface->next;
}
 
acpi_os_release_mutex(acpi_gbl_osi_mutex);
return;
}
 
/* If action_arg exists, so must interface_name_arg */
 
if (!interface_name_arg) {
acpi_os_printf("Missing Interface Name argument\n");
return;
}
 
/* Uppercase the action for match below */
 
acpi_ut_strupr(action_arg);
 
/* install - install an interface */
 
sub_string = strstr("INSTALL", action_arg);
if (sub_string) {
status = acpi_install_interface(interface_name_arg);
if (ACPI_FAILURE(status)) {
acpi_os_printf("%s, while installing \"%s\"\n",
acpi_format_exception(status),
interface_name_arg);
}
return;
}
 
/* remove - remove an interface */
 
sub_string = strstr("REMOVE", action_arg);
if (sub_string) {
status = acpi_remove_interface(interface_name_arg);
if (ACPI_FAILURE(status)) {
acpi_os_printf("%s, while removing \"%s\"\n",
acpi_format_exception(status),
interface_name_arg);
}
return;
}
 
/* Invalid action_arg */
 
acpi_os_printf("Invalid action argument: %s\n", action_arg);
return;
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_template
*
* PARAMETERS: buffer_arg - Buffer name or address
*
* RETURN: None
*
* DESCRIPTION: Dump a buffer that contains a resource template
*
******************************************************************************/
 
void acpi_db_display_template(char *buffer_arg)
{
struct acpi_namespace_node *node;
acpi_status status;
struct acpi_buffer return_buffer;
 
/* Translate buffer_arg to an Named object */
 
node = acpi_db_convert_to_node(buffer_arg);
if (!node || (node == acpi_gbl_root_node)) {
acpi_os_printf("Invalid argument: %s\n", buffer_arg);
return;
}
 
/* We must have a buffer object */
 
if (node->type != ACPI_TYPE_BUFFER) {
acpi_os_printf
("Not a Buffer object, cannot be a template: %s\n",
buffer_arg);
return;
}
 
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
return_buffer.pointer = acpi_gbl_db_buffer;
 
/* Attempt to convert the raw buffer to a resource list */
 
status = acpi_rs_create_resource_list(node->object, &return_buffer);
 
acpi_db_set_output_destination(ACPI_DB_REDIRECTABLE_OUTPUT);
acpi_dbg_level |= ACPI_LV_RESOURCES;
 
if (ACPI_FAILURE(status)) {
acpi_os_printf
("Could not convert Buffer to a resource list: %s, %s\n",
buffer_arg, acpi_format_exception(status));
goto dump_buffer;
}
 
/* Now we can dump the resource list */
 
acpi_rs_dump_resource_list(ACPI_CAST_PTR(struct acpi_resource,
return_buffer.pointer));
 
dump_buffer:
acpi_os_printf("\nRaw data buffer:\n");
acpi_ut_debug_dump_buffer((u8 *)node->object->buffer.pointer,
node->object->buffer.length,
DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
 
acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
return;
}
 
/*******************************************************************************
*
* FUNCTION: acpi_dm_compare_aml_resources
*
* PARAMETERS: aml1_buffer - Contains first resource list
* aml1_buffer_length - Length of first resource list
* aml2_buffer - Contains second resource list
* aml2_buffer_length - Length of second resource list
*
* RETURN: None
*
* DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
* order to isolate a miscompare to an individual resource)
*
******************************************************************************/
 
static void
acpi_dm_compare_aml_resources(u8 *aml1_buffer,
acpi_rsdesc_size aml1_buffer_length,
u8 *aml2_buffer,
acpi_rsdesc_size aml2_buffer_length)
{
u8 *aml1;
u8 *aml2;
u8 *aml1_end;
u8 *aml2_end;
acpi_rsdesc_size aml1_length;
acpi_rsdesc_size aml2_length;
acpi_rsdesc_size offset = 0;
u8 resource_type;
u32 count = 0;
u32 i;
 
/* Compare overall buffer sizes (may be different due to size rounding) */
 
if (aml1_buffer_length != aml2_buffer_length) {
acpi_os_printf("**** Buffer length mismatch in converted "
"AML: Original %X, New %X ****\n",
aml1_buffer_length, aml2_buffer_length);
}
 
aml1 = aml1_buffer;
aml2 = aml2_buffer;
aml1_end = aml1_buffer + aml1_buffer_length;
aml2_end = aml2_buffer + aml2_buffer_length;
 
/* Walk the descriptor lists, comparing each descriptor */
 
while ((aml1 < aml1_end) && (aml2 < aml2_end)) {
 
/* Get the lengths of each descriptor */
 
aml1_length = acpi_ut_get_descriptor_length(aml1);
aml2_length = acpi_ut_get_descriptor_length(aml2);
resource_type = acpi_ut_get_resource_type(aml1);
 
/* Check for descriptor length match */
 
if (aml1_length != aml2_length) {
acpi_os_printf
("**** Length mismatch in descriptor [%.2X] type %2.2X, "
"Offset %8.8X Len1 %X, Len2 %X ****\n", count,
resource_type, offset, aml1_length, aml2_length);
}
 
/* Check for descriptor byte match */
 
else if (memcmp(aml1, aml2, aml1_length)) {
acpi_os_printf
("**** Data mismatch in descriptor [%.2X] type %2.2X, "
"Offset %8.8X ****\n", count, resource_type,
offset);
 
for (i = 0; i < aml1_length; i++) {
if (aml1[i] != aml2[i]) {
acpi_os_printf
("Mismatch at byte offset %.2X: is %2.2X, "
"should be %2.2X\n", i, aml2[i],
aml1[i]);
}
}
}
 
/* Exit on end_tag descriptor */
 
if (resource_type == ACPI_RESOURCE_NAME_END_TAG) {
return;
}
 
/* Point to next descriptor in each buffer */
 
count++;
offset += aml1_length;
aml1 += aml1_length;
aml2 += aml2_length;
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_dm_test_resource_conversion
*
* PARAMETERS: node - Parent device node
* name - resource method name (_CRS)
*
* RETURN: Status
*
* DESCRIPTION: Compare the original AML with a conversion of the AML to
* internal resource list, then back to AML.
*
******************************************************************************/
 
static acpi_status
acpi_dm_test_resource_conversion(struct acpi_namespace_node *node, char *name)
{
acpi_status status;
struct acpi_buffer return_buffer;
struct acpi_buffer resource_buffer;
struct acpi_buffer new_aml;
union acpi_object *original_aml;
 
acpi_os_printf("Resource Conversion Comparison:\n");
 
new_aml.length = ACPI_ALLOCATE_LOCAL_BUFFER;
return_buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
resource_buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
/* Get the original _CRS AML resource template */
 
status = acpi_evaluate_object(node, name, NULL, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not obtain %s: %s\n",
name, acpi_format_exception(status));
return (status);
}
 
/* Get the AML resource template, converted to internal resource structs */
 
status = acpi_get_current_resources(node, &resource_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiGetCurrentResources failed: %s\n",
acpi_format_exception(status));
goto exit1;
}
 
/* Convert internal resource list to external AML resource template */
 
status = acpi_rs_create_aml_resources(&resource_buffer, &new_aml);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiRsCreateAmlResources failed: %s\n",
acpi_format_exception(status));
goto exit2;
}
 
/* Compare original AML to the newly created AML resource list */
 
original_aml = return_buffer.pointer;
 
acpi_dm_compare_aml_resources(original_aml->buffer.pointer,
(acpi_rsdesc_size) original_aml->buffer.
length, new_aml.pointer,
(acpi_rsdesc_size) new_aml.length);
 
/* Cleanup and exit */
 
ACPI_FREE(new_aml.pointer);
exit2:
ACPI_FREE(resource_buffer.pointer);
exit1:
ACPI_FREE(return_buffer.pointer);
return (status);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_resource_callback
*
* PARAMETERS: acpi_walk_resource_callback
*
* RETURN: Status
*
* DESCRIPTION: Simple callback to exercise acpi_walk_resources and
* acpi_walk_resource_buffer.
*
******************************************************************************/
 
static acpi_status
acpi_db_resource_callback(struct acpi_resource *resource, void *context)
{
 
return (AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_device_resources
*
* PARAMETERS: acpi_walk_callback
*
* RETURN: Status
*
* DESCRIPTION: Display the _PRT/_CRS/_PRS resources for a device object.
*
******************************************************************************/
 
static acpi_status
acpi_db_device_resources(acpi_handle obj_handle,
u32 nesting_level, void *context, void **return_value)
{
struct acpi_namespace_node *node;
struct acpi_namespace_node *prt_node = NULL;
struct acpi_namespace_node *crs_node = NULL;
struct acpi_namespace_node *prs_node = NULL;
struct acpi_namespace_node *aei_node = NULL;
char *parent_path;
struct acpi_buffer return_buffer;
acpi_status status;
 
node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
parent_path = acpi_ns_get_external_pathname(node);
if (!parent_path) {
return (AE_NO_MEMORY);
}
 
/* Get handles to the resource methods for this device */
 
(void)acpi_get_handle(node, METHOD_NAME__PRT,
ACPI_CAST_PTR(acpi_handle, &prt_node));
(void)acpi_get_handle(node, METHOD_NAME__CRS,
ACPI_CAST_PTR(acpi_handle, &crs_node));
(void)acpi_get_handle(node, METHOD_NAME__PRS,
ACPI_CAST_PTR(acpi_handle, &prs_node));
(void)acpi_get_handle(node, METHOD_NAME__AEI,
ACPI_CAST_PTR(acpi_handle, &aei_node));
 
if (!prt_node && !crs_node && !prs_node && !aei_node) {
goto cleanup; /* Nothing to do */
}
 
acpi_os_printf("\nDevice: %s\n", parent_path);
 
/* Prepare for a return object of arbitrary size */
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
/* _PRT */
 
if (prt_node) {
acpi_os_printf("Evaluating _PRT\n");
 
status =
acpi_evaluate_object(prt_node, NULL, NULL, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not evaluate _PRT: %s\n",
acpi_format_exception(status));
goto get_crs;
}
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
status = acpi_get_irq_routing_table(node, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("GetIrqRoutingTable failed: %s\n",
acpi_format_exception(status));
goto get_crs;
}
 
acpi_rs_dump_irq_list(ACPI_CAST_PTR(u8, acpi_gbl_db_buffer));
}
 
/* _CRS */
 
get_crs:
if (crs_node) {
acpi_os_printf("Evaluating _CRS\n");
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
status =
acpi_evaluate_object(crs_node, NULL, NULL, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not evaluate _CRS: %s\n",
acpi_format_exception(status));
goto get_prs;
}
 
/* This code exercises the acpi_walk_resources interface */
 
status = acpi_walk_resources(node, METHOD_NAME__CRS,
acpi_db_resource_callback, NULL);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiWalkResources failed: %s\n",
acpi_format_exception(status));
goto get_prs;
}
 
/* Get the _CRS resource list (test ALLOCATE buffer) */
 
return_buffer.pointer = NULL;
return_buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
 
status = acpi_get_current_resources(node, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiGetCurrentResources failed: %s\n",
acpi_format_exception(status));
goto get_prs;
}
 
/* This code exercises the acpi_walk_resource_buffer interface */
 
status = acpi_walk_resource_buffer(&return_buffer,
acpi_db_resource_callback,
NULL);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiWalkResourceBuffer failed: %s\n",
acpi_format_exception(status));
goto end_crs;
}
 
/* Dump the _CRS resource list */
 
acpi_rs_dump_resource_list(ACPI_CAST_PTR(struct acpi_resource,
return_buffer.
pointer));
 
/*
* Perform comparison of original AML to newly created AML. This
* tests both the AML->Resource conversion and the Resource->AML
* conversion.
*/
(void)acpi_dm_test_resource_conversion(node, METHOD_NAME__CRS);
 
/* Execute _SRS with the resource list */
 
acpi_os_printf("Evaluating _SRS\n");
 
status = acpi_set_current_resources(node, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiSetCurrentResources failed: %s\n",
acpi_format_exception(status));
goto end_crs;
}
 
end_crs:
ACPI_FREE(return_buffer.pointer);
}
 
/* _PRS */
 
get_prs:
if (prs_node) {
acpi_os_printf("Evaluating _PRS\n");
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
status =
acpi_evaluate_object(prs_node, NULL, NULL, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not evaluate _PRS: %s\n",
acpi_format_exception(status));
goto get_aei;
}
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
status = acpi_get_possible_resources(node, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiGetPossibleResources failed: %s\n",
acpi_format_exception(status));
goto get_aei;
}
 
acpi_rs_dump_resource_list(ACPI_CAST_PTR
(struct acpi_resource,
acpi_gbl_db_buffer));
}
 
/* _AEI */
 
get_aei:
if (aei_node) {
acpi_os_printf("Evaluating _AEI\n");
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
status =
acpi_evaluate_object(aei_node, NULL, NULL, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not evaluate _AEI: %s\n",
acpi_format_exception(status));
goto cleanup;
}
 
return_buffer.pointer = acpi_gbl_db_buffer;
return_buffer.length = ACPI_DEBUG_BUFFER_SIZE;
 
status = acpi_get_event_resources(node, &return_buffer);
if (ACPI_FAILURE(status)) {
acpi_os_printf("AcpiGetEventResources failed: %s\n",
acpi_format_exception(status));
goto cleanup;
}
 
acpi_rs_dump_resource_list(ACPI_CAST_PTR
(struct acpi_resource,
acpi_gbl_db_buffer));
}
 
cleanup:
ACPI_FREE(parent_path);
return (AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_resources
*
* PARAMETERS: object_arg - String object name or object pointer.
* NULL or "*" means "display resources for
* all devices"
*
* RETURN: None
*
* DESCRIPTION: Display the resource objects associated with a device.
*
******************************************************************************/
 
void acpi_db_display_resources(char *object_arg)
{
struct acpi_namespace_node *node;
 
acpi_db_set_output_destination(ACPI_DB_REDIRECTABLE_OUTPUT);
acpi_dbg_level |= ACPI_LV_RESOURCES;
 
/* Asterisk means "display resources for all devices" */
 
if (!object_arg || (!strcmp(object_arg, "*"))) {
(void)acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
acpi_db_device_resources, NULL, NULL,
NULL);
} else {
/* Convert string to object pointer */
 
node = acpi_db_convert_to_node(object_arg);
if (node) {
if (node->type != ACPI_TYPE_DEVICE) {
acpi_os_printf
("%4.4s: Name is not a device object (%s)\n",
node->name.ascii,
acpi_ut_get_type_name(node->type));
} else {
(void)acpi_db_device_resources(node, 0, NULL,
NULL);
}
}
}
 
acpi_db_set_output_destination(ACPI_DB_CONSOLE_OUTPUT);
}
 
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: acpi_db_generate_gpe
*
* PARAMETERS: gpe_arg - Raw GPE number, ascii string
* block_arg - GPE block number, ascii string
* 0 or 1 for FADT GPE blocks
*
* RETURN: None
*
* DESCRIPTION: Simulate firing of a GPE
*
******************************************************************************/
 
void acpi_db_generate_gpe(char *gpe_arg, char *block_arg)
{
u32 block_number = 0;
u32 gpe_number;
struct acpi_gpe_event_info *gpe_event_info;
 
gpe_number = strtoul(gpe_arg, NULL, 0);
 
/*
* If no block arg, or block arg == 0 or 1, use the FADT-defined
* GPE blocks.
*/
if (block_arg) {
block_number = strtoul(block_arg, NULL, 0);
if (block_number == 1) {
block_number = 0;
}
}
 
gpe_event_info =
acpi_ev_get_gpe_event_info(ACPI_TO_POINTER(block_number),
gpe_number);
if (!gpe_event_info) {
acpi_os_printf("Invalid GPE\n");
return;
}
 
(void)acpi_ev_gpe_dispatch(NULL, gpe_event_info, gpe_number);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_generate_sci
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Simulate an SCI -- just call the SCI dispatch.
*
******************************************************************************/
 
void acpi_db_generate_sci(void)
{
acpi_ev_sci_dispatch();
}
 
#endif /* !ACPI_REDUCED_HARDWARE */
 
/*******************************************************************************
*
* FUNCTION: acpi_db_trace
*
* PARAMETERS: enable_arg - ENABLE/AML to enable tracer
* DISABLE to disable tracer
* method_arg - Method to trace
* once_arg - Whether trace once
*
* RETURN: None
*
* DESCRIPTION: Control method tracing facility
*
******************************************************************************/
 
void acpi_db_trace(char *enable_arg, char *method_arg, char *once_arg)
{
u32 debug_level = 0;
u32 debug_layer = 0;
u32 flags = 0;
 
if (enable_arg) {
acpi_ut_strupr(enable_arg);
}
 
if (once_arg) {
acpi_ut_strupr(once_arg);
}
 
if (method_arg) {
if (acpi_db_trace_method_name) {
ACPI_FREE(acpi_db_trace_method_name);
acpi_db_trace_method_name = NULL;
}
 
acpi_db_trace_method_name =
ACPI_ALLOCATE(strlen(method_arg) + 1);
if (!acpi_db_trace_method_name) {
acpi_os_printf("Failed to allocate method name (%s)\n",
method_arg);
return;
}
 
strcpy(acpi_db_trace_method_name, method_arg);
}
 
if (!strcmp(enable_arg, "ENABLE") ||
!strcmp(enable_arg, "METHOD") || !strcmp(enable_arg, "OPCODE")) {
if (!strcmp(enable_arg, "ENABLE")) {
 
/* Inherit current console settings */
 
debug_level = acpi_gbl_db_console_debug_level;
debug_layer = acpi_dbg_layer;
} else {
/* Restrict console output to trace points only */
 
debug_level = ACPI_LV_TRACE_POINT;
debug_layer = ACPI_EXECUTER;
}
 
flags = ACPI_TRACE_ENABLED;
 
if (!strcmp(enable_arg, "OPCODE")) {
flags |= ACPI_TRACE_OPCODE;
}
 
if (once_arg && !strcmp(once_arg, "ONCE")) {
flags |= ACPI_TRACE_ONESHOT;
}
}
 
(void)acpi_debug_trace(acpi_db_trace_method_name,
debug_level, debug_layer, flags);
}
/drivers/acpi/acpica/dbconvert.c
0,0 → 1,484
/*******************************************************************************
*
* Module Name: dbconvert - debugger miscellaneous conversion 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 "acdebug.h"
 
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbconvert")
 
#define DB_DEFAULT_PKG_ELEMENTS 33
/*******************************************************************************
*
* FUNCTION: acpi_db_hex_char_to_value
*
* PARAMETERS: hex_char - Ascii Hex digit, 0-9|a-f|A-F
* return_value - Where the converted value is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert a single hex character to a 4-bit number (0-16).
*
******************************************************************************/
acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value)
{
u8 value;
 
/* Digit must be ascii [0-9a-fA-F] */
 
if (!isxdigit(hex_char)) {
return (AE_BAD_HEX_CONSTANT);
}
 
if (hex_char <= 0x39) {
value = (u8)(hex_char - 0x30);
} else {
value = (u8)(toupper(hex_char) - 0x37);
}
 
*return_value = value;
return (AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_hex_byte_to_binary
*
* PARAMETERS: hex_byte - Double hex digit (0x00 - 0xFF) in format:
* hi_byte then lo_byte.
* return_value - Where the converted value is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert two hex characters to an 8 bit number (0 - 255).
*
******************************************************************************/
 
static acpi_status acpi_db_hex_byte_to_binary(char *hex_byte, u8 *return_value)
{
u8 local0;
u8 local1;
acpi_status status;
 
/* High byte */
 
status = acpi_db_hex_char_to_value(hex_byte[0], &local0);
if (ACPI_FAILURE(status)) {
return (status);
}
 
/* Low byte */
 
status = acpi_db_hex_char_to_value(hex_byte[1], &local1);
if (ACPI_FAILURE(status)) {
return (status);
}
 
*return_value = (u8)((local0 << 4) | local1);
return (AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_convert_to_buffer
*
* PARAMETERS: string - Input string to be converted
* object - Where the buffer object is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert a string to a buffer object. String is treated a list
* of buffer elements, each separated by a space or comma.
*
******************************************************************************/
 
static acpi_status
acpi_db_convert_to_buffer(char *string, union acpi_object *object)
{
u32 i;
u32 j;
u32 length;
u8 *buffer;
acpi_status status;
 
/* Generate the final buffer length */
 
for (i = 0, length = 0; string[i];) {
i += 2;
length++;
 
while (string[i] && ((string[i] == ',') || (string[i] == ' '))) {
i++;
}
}
 
buffer = ACPI_ALLOCATE(length);
if (!buffer) {
return (AE_NO_MEMORY);
}
 
/* Convert the command line bytes to the buffer */
 
for (i = 0, j = 0; string[i];) {
status = acpi_db_hex_byte_to_binary(&string[i], &buffer[j]);
if (ACPI_FAILURE(status)) {
ACPI_FREE(buffer);
return (status);
}
 
j++;
i += 2;
while (string[i] && ((string[i] == ',') || (string[i] == ' '))) {
i++;
}
}
 
object->type = ACPI_TYPE_BUFFER;
object->buffer.pointer = buffer;
object->buffer.length = length;
return (AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_convert_to_package
*
* PARAMETERS: string - Input string to be converted
* object - Where the package object is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert a string to a package object. Handles nested packages
* via recursion with acpi_db_convert_to_object.
*
******************************************************************************/
 
acpi_status acpi_db_convert_to_package(char *string, union acpi_object * object)
{
char *this;
char *next;
u32 i;
acpi_object_type type;
union acpi_object *elements;
acpi_status status;
 
elements =
ACPI_ALLOCATE_ZEROED(DB_DEFAULT_PKG_ELEMENTS *
sizeof(union acpi_object));
 
this = string;
for (i = 0; i < (DB_DEFAULT_PKG_ELEMENTS - 1); i++) {
this = acpi_db_get_next_token(this, &next, &type);
if (!this) {
break;
}
 
/* Recursive call to convert each package element */
 
status = acpi_db_convert_to_object(type, this, &elements[i]);
if (ACPI_FAILURE(status)) {
acpi_db_delete_objects(i + 1, elements);
ACPI_FREE(elements);
return (status);
}
 
this = next;
}
 
object->type = ACPI_TYPE_PACKAGE;
object->package.count = i;
object->package.elements = elements;
return (AE_OK);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_convert_to_object
*
* PARAMETERS: type - Object type as determined by parser
* string - Input string to be converted
* object - Where the new object is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert a typed and tokenized string to an union acpi_object. Typing:
* 1) String objects were surrounded by quotes.
* 2) Buffer objects were surrounded by parentheses.
* 3) Package objects were surrounded by brackets "[]".
* 4) All standalone tokens are treated as integers.
*
******************************************************************************/
 
acpi_status
acpi_db_convert_to_object(acpi_object_type type,
char *string, union acpi_object * object)
{
acpi_status status = AE_OK;
 
switch (type) {
case ACPI_TYPE_STRING:
 
object->type = ACPI_TYPE_STRING;
object->string.pointer = string;
object->string.length = (u32)strlen(string);
break;
 
case ACPI_TYPE_BUFFER:
 
status = acpi_db_convert_to_buffer(string, object);
break;
 
case ACPI_TYPE_PACKAGE:
 
status = acpi_db_convert_to_package(string, object);
break;
 
default:
 
object->type = ACPI_TYPE_INTEGER;
status = acpi_ut_strtoul64(string, 16, &object->integer.value);
break;
}
 
return (status);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_encode_pld_buffer
*
* PARAMETERS: pld_info - _PLD buffer struct (Using local struct)
*
* RETURN: Encode _PLD buffer suitable for return value from _PLD
*
* DESCRIPTION: Bit-packs a _PLD buffer struct. Used to test the _PLD macros
*
******************************************************************************/
 
u8 *acpi_db_encode_pld_buffer(struct acpi_pld_info *pld_info)
{
u32 *buffer;
u32 dword;
 
buffer = ACPI_ALLOCATE_ZEROED(ACPI_PLD_BUFFER_SIZE);
if (!buffer) {
return (NULL);
}
 
/* First 32 bits */
 
dword = 0;
ACPI_PLD_SET_REVISION(&dword, pld_info->revision);
ACPI_PLD_SET_IGNORE_COLOR(&dword, pld_info->ignore_color);
ACPI_PLD_SET_RED(&dword, pld_info->red);
ACPI_PLD_SET_GREEN(&dword, pld_info->green);
ACPI_PLD_SET_BLUE(&dword, pld_info->blue);
ACPI_MOVE_32_TO_32(&buffer[0], &dword);
 
/* Second 32 bits */
 
dword = 0;
ACPI_PLD_SET_WIDTH(&dword, pld_info->width);
ACPI_PLD_SET_HEIGHT(&dword, pld_info->height);
ACPI_MOVE_32_TO_32(&buffer[1], &dword);
 
/* Third 32 bits */
 
dword = 0;
ACPI_PLD_SET_USER_VISIBLE(&dword, pld_info->user_visible);
ACPI_PLD_SET_DOCK(&dword, pld_info->dock);
ACPI_PLD_SET_LID(&dword, pld_info->lid);
ACPI_PLD_SET_PANEL(&dword, pld_info->panel);
ACPI_PLD_SET_VERTICAL(&dword, pld_info->vertical_position);
ACPI_PLD_SET_HORIZONTAL(&dword, pld_info->horizontal_position);
ACPI_PLD_SET_SHAPE(&dword, pld_info->shape);
ACPI_PLD_SET_ORIENTATION(&dword, pld_info->group_orientation);
ACPI_PLD_SET_TOKEN(&dword, pld_info->group_token);
ACPI_PLD_SET_POSITION(&dword, pld_info->group_position);
ACPI_PLD_SET_BAY(&dword, pld_info->bay);
ACPI_MOVE_32_TO_32(&buffer[2], &dword);
 
/* Fourth 32 bits */
 
dword = 0;
ACPI_PLD_SET_EJECTABLE(&dword, pld_info->ejectable);
ACPI_PLD_SET_OSPM_EJECT(&dword, pld_info->ospm_eject_required);
ACPI_PLD_SET_CABINET(&dword, pld_info->cabinet_number);
ACPI_PLD_SET_CARD_CAGE(&dword, pld_info->card_cage_number);
ACPI_PLD_SET_REFERENCE(&dword, pld_info->reference);
ACPI_PLD_SET_ROTATION(&dword, pld_info->rotation);
ACPI_PLD_SET_ORDER(&dword, pld_info->order);
ACPI_MOVE_32_TO_32(&buffer[3], &dword);
 
if (pld_info->revision >= 2) {
 
/* Fifth 32 bits */
 
dword = 0;
ACPI_PLD_SET_VERT_OFFSET(&dword, pld_info->vertical_offset);
ACPI_PLD_SET_HORIZ_OFFSET(&dword, pld_info->horizontal_offset);
ACPI_MOVE_32_TO_32(&buffer[4], &dword);
}
 
return (ACPI_CAST_PTR(u8, buffer));
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_dump_pld_buffer
*
* PARAMETERS: obj_desc - Object returned from _PLD method
*
* RETURN: None.
*
* DESCRIPTION: Dumps formatted contents of a _PLD return buffer.
*
******************************************************************************/
 
#define ACPI_PLD_OUTPUT "%20s : %-6X\n"
 
void acpi_db_dump_pld_buffer(union acpi_object *obj_desc)
{
union acpi_object *buffer_desc;
struct acpi_pld_info *pld_info;
u8 *new_buffer;
acpi_status status;
 
/* Object must be of type Package with at least one Buffer element */
 
if (obj_desc->type != ACPI_TYPE_PACKAGE) {
return;
}
 
buffer_desc = &obj_desc->package.elements[0];
if (buffer_desc->type != ACPI_TYPE_BUFFER) {
return;
}
 
/* Convert _PLD buffer to local _PLD struct */
 
status = acpi_decode_pld_buffer(buffer_desc->buffer.pointer,
buffer_desc->buffer.length, &pld_info);
if (ACPI_FAILURE(status)) {
return;
}
 
/* Encode local _PLD struct back to a _PLD buffer */
 
new_buffer = acpi_db_encode_pld_buffer(pld_info);
if (!new_buffer) {
return;
}
 
/* The two bit-packed buffers should match */
 
if (memcmp(new_buffer, buffer_desc->buffer.pointer,
buffer_desc->buffer.length)) {
acpi_os_printf
("Converted _PLD buffer does not compare. New:\n");
 
acpi_ut_dump_buffer(new_buffer,
buffer_desc->buffer.length, DB_BYTE_DISPLAY,
0);
}
 
/* First 32-bit dword */
 
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Revision", pld_info->revision);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_IgnoreColor",
pld_info->ignore_color);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Red", pld_info->red);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Green", pld_info->green);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Blue", pld_info->blue);
 
/* Second 32-bit dword */
 
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Width", pld_info->width);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Height", pld_info->height);
 
/* Third 32-bit dword */
 
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_UserVisible",
pld_info->user_visible);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Dock", pld_info->dock);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Lid", pld_info->lid);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Panel", pld_info->panel);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalPosition",
pld_info->vertical_position);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalPosition",
pld_info->horizontal_position);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Shape", pld_info->shape);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupOrientation",
pld_info->group_orientation);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupToken",
pld_info->group_token);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_GroupPosition",
pld_info->group_position);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Bay", pld_info->bay);
 
/* Fourth 32-bit dword */
 
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Ejectable", pld_info->ejectable);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_EjectRequired",
pld_info->ospm_eject_required);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CabinetNumber",
pld_info->cabinet_number);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_CardCageNumber",
pld_info->card_cage_number);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Reference", pld_info->reference);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Rotation", pld_info->rotation);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_Order", pld_info->order);
 
/* Fifth 32-bit dword */
 
if (buffer_desc->buffer.length > 16) {
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_VerticalOffset",
pld_info->vertical_offset);
acpi_os_printf(ACPI_PLD_OUTPUT, "PLD_HorizontalOffset",
pld_info->horizontal_offset);
}
 
ACPI_FREE(pld_info);
ACPI_FREE(new_buffer);
}
/drivers/acpi/acpica/dbdisply.c
0,0 → 1,1108
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
*
******************************************************************************/
 
/*
* 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 "amlcode.h"
#include "acdispat.h"
#include "acnamesp.h"
#include "acparser.h"
#include "acinterp.h"
#include "acdebug.h"
 
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbdisply")
 
/* Local prototypes */
static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op);
 
static void *acpi_db_get_pointer(void *target);
 
static acpi_status
acpi_db_display_non_root_handlers(acpi_handle obj_handle,
u32 nesting_level,
void *context, void **return_value);
 
/*
* System handler information.
* Used for Handlers command, in acpi_db_display_handlers.
*/
#define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
#define ACPI_HANDLER_NAME_STRING "%30s : "
#define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
#define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)"
#define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
 
/* All predefined Address Space IDs */
 
static acpi_adr_space_type acpi_gbl_space_id_list[] = {
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC,
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_GPIO,
ACPI_ADR_SPACE_GSBUS,
ACPI_ADR_SPACE_DATA_TABLE,
ACPI_ADR_SPACE_FIXED_HARDWARE
};
 
/* Global handler information */
 
typedef struct acpi_handler_info {
void *handler;
char *name;
 
} acpi_handler_info;
 
static struct acpi_handler_info acpi_gbl_handler_list[] = {
{&acpi_gbl_global_notify[0].handler, "System Notifications"},
{&acpi_gbl_global_notify[1].handler, "Device Notifications"},
{&acpi_gbl_table_handler, "ACPI Table Events"},
{&acpi_gbl_exception_handler, "Control Method Exceptions"},
{&acpi_gbl_interface_handler, "OSI Invocations"}
};
 
/*******************************************************************************
*
* FUNCTION: acpi_db_get_pointer
*
* PARAMETERS: target - Pointer to string to be converted
*
* RETURN: Converted pointer
*
* DESCRIPTION: Convert an ascii pointer value to a real value
*
******************************************************************************/
 
static void *acpi_db_get_pointer(void *target)
{
void *obj_ptr;
acpi_size address;
 
address = strtoul(target, NULL, 16);
obj_ptr = ACPI_TO_POINTER(address);
return (obj_ptr);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_dump_parser_descriptor
*
* PARAMETERS: op - A parser Op descriptor
*
* RETURN: None
*
* DESCRIPTION: Display a formatted parser object
*
******************************************************************************/
 
static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op)
{
const struct acpi_opcode_info *info;
 
info = acpi_ps_get_opcode_info(op->common.aml_opcode);
 
acpi_os_printf("Parser Op Descriptor:\n");
acpi_os_printf("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
 
ACPI_DEBUG_ONLY_MEMBERS(acpi_os_printf("%20.20s : %s\n", "Opcode Name",
info->name));
 
acpi_os_printf("%20.20s : %p\n", "Value/ArgList", op->common.value.arg);
acpi_os_printf("%20.20s : %p\n", "Parent", op->common.parent);
acpi_os_printf("%20.20s : %p\n", "NextOp", op->common.next);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_decode_and_display_object
*
* PARAMETERS: target - String with object to be displayed. Names
* and hex pointers are supported.
* output_type - Byte, Word, Dword, or Qword (B|W|D|Q)
*
* RETURN: None
*
* DESCRIPTION: Display a formatted ACPI object
*
******************************************************************************/
 
void acpi_db_decode_and_display_object(char *target, char *output_type)
{
void *obj_ptr;
struct acpi_namespace_node *node;
union acpi_operand_object *obj_desc;
u32 display = DB_BYTE_DISPLAY;
char buffer[80];
struct acpi_buffer ret_buf;
acpi_status status;
u32 size;
 
if (!target) {
return;
}
 
/* Decode the output type */
 
if (output_type) {
acpi_ut_strupr(output_type);
if (output_type[0] == 'W') {
display = DB_WORD_DISPLAY;
} else if (output_type[0] == 'D') {
display = DB_DWORD_DISPLAY;
} else if (output_type[0] == 'Q') {
display = DB_QWORD_DISPLAY;
}
}
 
ret_buf.length = sizeof(buffer);
ret_buf.pointer = buffer;
 
/* Differentiate between a number and a name */
 
if ((target[0] >= 0x30) && (target[0] <= 0x39)) {
obj_ptr = acpi_db_get_pointer(target);
if (!acpi_os_readable(obj_ptr, 16)) {
acpi_os_printf
("Address %p is invalid in this address space\n",
obj_ptr);
return;
}
 
/* Decode the object type */
 
switch (ACPI_GET_DESCRIPTOR_TYPE(obj_ptr)) {
case ACPI_DESC_TYPE_NAMED:
 
/* This is a namespace Node */
 
if (!acpi_os_readable
(obj_ptr, sizeof(struct acpi_namespace_node))) {
acpi_os_printf
("Cannot read entire Named object at address %p\n",
obj_ptr);
return;
}
 
node = obj_ptr;
goto dump_node;
 
case ACPI_DESC_TYPE_OPERAND:
 
/* This is a ACPI OPERAND OBJECT */
 
if (!acpi_os_readable
(obj_ptr, sizeof(union acpi_operand_object))) {
acpi_os_printf
("Cannot read entire ACPI object at address %p\n",
obj_ptr);
return;
}
 
acpi_ut_debug_dump_buffer(obj_ptr,
sizeof(union
acpi_operand_object),
display, ACPI_UINT32_MAX);
acpi_ex_dump_object_descriptor(obj_ptr, 1);
break;
 
case ACPI_DESC_TYPE_PARSER:
 
/* This is a Parser Op object */
 
if (!acpi_os_readable
(obj_ptr, sizeof(union acpi_parse_object))) {
acpi_os_printf
("Cannot read entire Parser object at address %p\n",
obj_ptr);
return;
}
 
acpi_ut_debug_dump_buffer(obj_ptr,
sizeof(union
acpi_parse_object),
display, ACPI_UINT32_MAX);
acpi_db_dump_parser_descriptor((union acpi_parse_object
*)obj_ptr);
break;
 
default:
 
/* Is not a recognizeable object */
 
acpi_os_printf
("Not a known ACPI internal object, descriptor type %2.2X\n",
ACPI_GET_DESCRIPTOR_TYPE(obj_ptr));
 
size = 16;
if (acpi_os_readable(obj_ptr, 64)) {
size = 64;
}
 
/* Just dump some memory */
 
acpi_ut_debug_dump_buffer(obj_ptr, size, display,
ACPI_UINT32_MAX);
break;
}
 
return;
}
 
/* The parameter is a name string that must be resolved to a Named obj */
 
node = acpi_db_local_ns_lookup(target);
if (!node) {
return;
}
 
dump_node:
/* Now dump the NS node */
 
status = acpi_get_name(node, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf);
if (ACPI_FAILURE(status)) {
acpi_os_printf("Could not convert name to pathname\n");
}
 
else {
acpi_os_printf("Object (%p) Pathname: %s\n",
node, (char *)ret_buf.pointer);
}
 
if (!acpi_os_readable(node, sizeof(struct acpi_namespace_node))) {
acpi_os_printf("Invalid Named object at address %p\n", node);
return;
}
 
acpi_ut_debug_dump_buffer((void *)node,
sizeof(struct acpi_namespace_node), display,
ACPI_UINT32_MAX);
acpi_ex_dump_namespace_node(node, 1);
 
obj_desc = acpi_ns_get_attached_object(node);
if (obj_desc) {
acpi_os_printf("\nAttached Object (%p):\n", obj_desc);
if (!acpi_os_readable
(obj_desc, sizeof(union acpi_operand_object))) {
acpi_os_printf
("Invalid internal ACPI Object at address %p\n",
obj_desc);
return;
}
 
acpi_ut_debug_dump_buffer((void *)obj_desc,
sizeof(union acpi_operand_object),
display, ACPI_UINT32_MAX);
acpi_ex_dump_object_descriptor(obj_desc, 1);
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_method_info
*
* PARAMETERS: start_op - Root of the control method parse tree
*
* RETURN: None
*
* DESCRIPTION: Display information about the current method
*
******************************************************************************/
 
void acpi_db_display_method_info(union acpi_parse_object *start_op)
{
struct acpi_walk_state *walk_state;
union acpi_operand_object *obj_desc;
struct acpi_namespace_node *node;
union acpi_parse_object *root_op;
union acpi_parse_object *op;
const struct acpi_opcode_info *op_info;
u32 num_ops = 0;
u32 num_operands = 0;
u32 num_operators = 0;
u32 num_remaining_ops = 0;
u32 num_remaining_operands = 0;
u32 num_remaining_operators = 0;
u8 count_remaining = FALSE;
 
walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
if (!walk_state) {
acpi_os_printf("There is no method currently executing\n");
return;
}
 
obj_desc = walk_state->method_desc;
node = walk_state->method_node;
 
acpi_os_printf("Currently executing control method is [%4.4s]\n",
acpi_ut_get_node_name(node));
acpi_os_printf("%X Arguments, SyncLevel = %X\n",
(u32)obj_desc->method.param_count,
(u32)obj_desc->method.sync_level);
 
root_op = start_op;
while (root_op->common.parent) {
root_op = root_op->common.parent;
}
 
op = root_op;
 
while (op) {
if (op == start_op) {
count_remaining = TRUE;
}
 
num_ops++;
if (count_remaining) {
num_remaining_ops++;
}
 
/* Decode the opcode */
 
op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
switch (op_info->class) {
case AML_CLASS_ARGUMENT:
 
if (count_remaining) {
num_remaining_operands++;
}
 
num_operands++;
break;
 
case AML_CLASS_UNKNOWN:
 
/* Bad opcode or ASCII character */
 
continue;
 
default:
 
if (count_remaining) {
num_remaining_operators++;
}
 
num_operators++;
break;
}
 
op = acpi_ps_get_depth_next(start_op, op);
}
 
acpi_os_printf
("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
num_ops, num_operators, num_operands);
 
acpi_os_printf
("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
num_remaining_ops, num_remaining_operators,
num_remaining_operands);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_locals
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display all locals for the currently running control method
*
******************************************************************************/
 
void acpi_db_display_locals(void)
{
struct acpi_walk_state *walk_state;
 
walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
if (!walk_state) {
acpi_os_printf("There is no method currently executing\n");
return;
}
 
acpi_db_decode_locals(walk_state);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_arguments
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display all arguments for the currently running control method
*
******************************************************************************/
 
void acpi_db_display_arguments(void)
{
struct acpi_walk_state *walk_state;
 
walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
if (!walk_state) {
acpi_os_printf("There is no method currently executing\n");
return;
}
 
acpi_db_decode_arguments(walk_state);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_results
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display current contents of a method result stack
*
******************************************************************************/
 
void acpi_db_display_results(void)
{
u32 i;
struct acpi_walk_state *walk_state;
union acpi_operand_object *obj_desc;
u32 result_count = 0;
struct acpi_namespace_node *node;
union acpi_generic_state *frame;
u32 index; /* Index onto current frame */
 
walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
if (!walk_state) {
acpi_os_printf("There is no method currently executing\n");
return;
}
 
obj_desc = walk_state->method_desc;
node = walk_state->method_node;
 
if (walk_state->results) {
result_count = walk_state->result_count;
}
 
acpi_os_printf("Method [%4.4s] has %X stacked result objects\n",
acpi_ut_get_node_name(node), result_count);
 
/* From the top element of result stack */
 
frame = walk_state->results;
index = (result_count - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
 
for (i = 0; i < result_count; i++) {
obj_desc = frame->results.obj_desc[index];
acpi_os_printf("Result%u: ", i);
acpi_db_display_internal_object(obj_desc, walk_state);
 
if (index == 0) {
frame = frame->results.next;
index = ACPI_RESULTS_FRAME_OBJ_NUM;
}
 
index--;
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_calling_tree
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display current calling tree of nested control methods
*
******************************************************************************/
 
void acpi_db_display_calling_tree(void)
{
struct acpi_walk_state *walk_state;
struct acpi_namespace_node *node;
 
walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
if (!walk_state) {
acpi_os_printf("There is no method currently executing\n");
return;
}
 
node = walk_state->method_node;
acpi_os_printf("Current Control Method Call Tree\n");
 
while (walk_state) {
node = walk_state->method_node;
acpi_os_printf(" [%4.4s]\n", acpi_ut_get_node_name(node));
 
walk_state = walk_state->next;
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_object_type
*
* PARAMETERS: name - User entered NS node handle or name
*
* RETURN: None
*
* DESCRIPTION: Display type of an arbitrary NS node
*
******************************************************************************/
 
void acpi_db_display_object_type(char *name)
{
struct acpi_namespace_node *node;
struct acpi_device_info *info;
acpi_status status;
u32 i;
 
node = acpi_db_convert_to_node(name);
if (!node) {
return;
}
 
status = acpi_get_object_info(ACPI_CAST_PTR(acpi_handle, node), &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]);
}
 
if (info->valid & ACPI_VALID_HID) {
acpi_os_printf("HID: %s\n", info->hardware_id.string);
}
 
if (info->valid & ACPI_VALID_UID) {
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,
info->compatible_id_list.ids[i].string);
}
}
 
ACPI_FREE(info);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_result_object
*
* PARAMETERS: obj_desc - Object to be displayed
* walk_state - Current walk state
*
* RETURN: None
*
* DESCRIPTION: Display the result of an AML opcode
*
* Note: Curently only displays the result object if we are single stepping.
* However, this output may be useful in other contexts and could be enabled
* to do so if needed.
*
******************************************************************************/
 
void
acpi_db_display_result_object(union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state)
{
 
/* Only display if single stepping */
 
if (!acpi_gbl_cm_single_step) {
return;
}
 
acpi_os_printf("ResultObj: ");
acpi_db_display_internal_object(obj_desc, walk_state);
acpi_os_printf("\n");
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_argument_object
*
* PARAMETERS: obj_desc - Object to be displayed
* walk_state - Current walk state
*
* RETURN: None
*
* DESCRIPTION: Display the result of an AML opcode
*
******************************************************************************/
 
void
acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
struct acpi_walk_state *walk_state)
{
 
if (!acpi_gbl_cm_single_step) {
return;
}
 
acpi_os_printf("ArgObj: ");
acpi_db_display_internal_object(obj_desc, walk_state);
}
 
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
* FUNCTION: acpi_db_display_gpes
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display the current GPE structures
*
******************************************************************************/
 
void acpi_db_display_gpes(void)
{
struct acpi_gpe_block_info *gpe_block;
struct acpi_gpe_xrupt_info *gpe_xrupt_info;
struct acpi_gpe_event_info *gpe_event_info;
struct acpi_gpe_register_info *gpe_register_info;
char *gpe_type;
struct acpi_gpe_notify_info *notify;
u32 gpe_index;
u32 block = 0;
u32 i;
u32 j;
u32 count;
char buffer[80];
struct acpi_buffer ret_buf;
acpi_status status;
 
ret_buf.length = sizeof(buffer);
ret_buf.pointer = buffer;
 
block = 0;
 
/* Walk the GPE lists */
 
gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
while (gpe_xrupt_info) {
gpe_block = gpe_xrupt_info->gpe_block_list_head;
while (gpe_block) {
status = acpi_get_name(gpe_block->node,
ACPI_FULL_PATHNAME_NO_TRAILING,
&ret_buf);
if (ACPI_FAILURE(status)) {
acpi_os_printf
("Could not convert name to pathname\n");
}
 
if (gpe_block->node == acpi_gbl_fadt_gpe_device) {
gpe_type = "FADT-defined GPE block";
} else {
gpe_type = "GPE Block Device";
}
 
acpi_os_printf
("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
block, gpe_block, gpe_block->node, buffer,
gpe_type);
 
acpi_os_printf(" Registers: %u (%u GPEs)\n",
gpe_block->register_count,
gpe_block->gpe_count);
 
acpi_os_printf
(" GPE range: 0x%X to 0x%X on interrupt %u\n",
gpe_block->block_base_number,
gpe_block->block_base_number +
(gpe_block->gpe_count - 1),
gpe_xrupt_info->interrupt_number);
 
acpi_os_printf
(" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
gpe_block->register_info,
ACPI_FORMAT_UINT64(gpe_block->register_info->
status_address.address),
ACPI_FORMAT_UINT64(gpe_block->register_info->
enable_address.address));
 
acpi_os_printf(" EventInfo: %p\n",
gpe_block->event_info);
 
/* Examine each GPE Register within the block */
 
for (i = 0; i < gpe_block->register_count; i++) {
gpe_register_info =
&gpe_block->register_info[i];
 
acpi_os_printf(" Reg %u: (GPE %.2X-%.2X) "
"RunEnable %2.2X WakeEnable %2.2X"
" Status %8.8X%8.8X Enable %8.8X%8.8X\n",
i,
gpe_register_info->
base_gpe_number,
gpe_register_info->
base_gpe_number +
(ACPI_GPE_REGISTER_WIDTH - 1),
gpe_register_info->
enable_for_run,
gpe_register_info->
enable_for_wake,
ACPI_FORMAT_UINT64
(gpe_register_info->
status_address.address),
ACPI_FORMAT_UINT64
(gpe_register_info->
enable_address.address));
 
/* Now look at the individual GPEs in this byte register */
 
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
gpe_index =
(i * ACPI_GPE_REGISTER_WIDTH) + j;
gpe_event_info =
&gpe_block->event_info[gpe_index];
 
if (ACPI_GPE_DISPATCH_TYPE
(gpe_event_info->flags) ==
ACPI_GPE_DISPATCH_NONE) {
 
/* This GPE is not used (no method or handler), ignore it */
 
continue;
}
 
acpi_os_printf
(" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (",
gpe_block->block_base_number +
gpe_index, gpe_event_info,
gpe_event_info->runtime_count,
gpe_event_info->flags);
 
/* Decode the flags byte */
 
if (gpe_event_info->
flags & ACPI_GPE_LEVEL_TRIGGERED) {
acpi_os_printf("Level, ");
} else {
acpi_os_printf("Edge, ");
}
 
if (gpe_event_info->
flags & ACPI_GPE_CAN_WAKE) {
acpi_os_printf("CanWake, ");
} else {
acpi_os_printf("RunOnly, ");
}
 
switch (ACPI_GPE_DISPATCH_TYPE
(gpe_event_info->flags)) {
case ACPI_GPE_DISPATCH_NONE:
 
acpi_os_printf("NotUsed");
break;
 
case ACPI_GPE_DISPATCH_METHOD:
 
acpi_os_printf("Method");
break;
 
case ACPI_GPE_DISPATCH_HANDLER:
 
acpi_os_printf("Handler");
break;
 
case ACPI_GPE_DISPATCH_NOTIFY:
 
count = 0;
notify =
gpe_event_info->dispatch.
notify_list;
while (notify) {
count++;
notify = notify->next;
}
 
acpi_os_printf
("Implicit Notify on %u devices",
count);
break;
 
case ACPI_GPE_DISPATCH_RAW_HANDLER:
 
acpi_os_printf("RawHandler");
break;
 
default:
 
acpi_os_printf("UNKNOWN: %X",
ACPI_GPE_DISPATCH_TYPE
(gpe_event_info->
flags));
break;
}
 
acpi_os_printf(")\n");
}
}
 
block++;
gpe_block = gpe_block->next;
}
 
gpe_xrupt_info = gpe_xrupt_info->next;
}
}
#endif /* !ACPI_REDUCED_HARDWARE */
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_handlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display the currently installed global handlers
*
******************************************************************************/
 
void acpi_db_display_handlers(void)
{
union acpi_operand_object *obj_desc;
union acpi_operand_object *handler_obj;
acpi_adr_space_type space_id;
u32 i;
 
/* Operation region handlers */
 
acpi_os_printf("\nOperation Region Handlers at the namespace root:\n");
 
obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
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 = handler_obj->address_space.next;
}
 
/* There is no handler for this space_id */
 
acpi_os_printf("None\n");
 
found_handler: ;
}
 
/* Find all handlers for user-defined space_IDs */
 
handler_obj = obj_desc->device.handler;
while (handler_obj) {
if (handler_obj->address_space.space_id >=
ACPI_USER_REGION_BEGIN) {
acpi_os_printf(ACPI_PREDEFINED_PREFIX,
"User-defined ID",
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);
}
 
handler_obj = handler_obj->address_space.next;
}
}
#if (!ACPI_REDUCED_HARDWARE)
 
/* Fixed event handlers */
 
acpi_os_printf("\nFixed Event Handlers:\n");
 
for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
acpi_os_printf(ACPI_PREDEFINED_PREFIX,
acpi_ut_get_event_name(i), i);
if (acpi_gbl_fixed_event_handlers[i].handler) {
acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User",
acpi_gbl_fixed_event_handlers[i].
handler);
} else {
acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None");
}
}
 
#endif /* !ACPI_REDUCED_HARDWARE */
 
/* Miscellaneous global handlers */
 
acpi_os_printf("\nMiscellaneous Global Handlers:\n");
 
for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_handler_list); i++) {
acpi_os_printf(ACPI_HANDLER_NAME_STRING,
acpi_gbl_handler_list[i].name);
 
if (acpi_gbl_handler_list[i].handler) {
acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User",
acpi_gbl_handler_list[i].handler);
} else {
acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None");
}
}
 
/* Other handlers that are installed throughout the namespace */
 
acpi_os_printf("\nOperation Region Handlers for specific devices:\n");
 
(void)acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX,
acpi_db_display_non_root_handlers, NULL, NULL,
NULL);
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_display_non_root_handlers
*
* PARAMETERS: acpi_walk_callback
*
* RETURN: Status
*
* DESCRIPTION: Display information about all handlers installed for a
* device object.
*
******************************************************************************/
 
static acpi_status
acpi_db_display_non_root_handlers(acpi_handle obj_handle,
u32 nesting_level,
void *context, void **return_value)
{
struct acpi_namespace_node *node =
ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
union acpi_operand_object *obj_desc;
union acpi_operand_object *handler_obj;
char *pathname;
 
obj_desc = acpi_ns_get_attached_object(node);
if (!obj_desc) {
return (AE_OK);
}
 
pathname = acpi_ns_get_external_pathname(node);
if (!pathname) {
return (AE_OK);
}
 
/* Display all handlers associated with this device */
 
handler_obj = obj_desc->device.handler;
while (handler_obj) {
acpi_os_printf(ACPI_PREDEFINED_PREFIX,
acpi_ut_get_region_name((u8)handler_obj->
address_space.space_id),
handler_obj->address_space.space_id);
 
acpi_os_printf(ACPI_HANDLER_PRESENT_STRING2,
(handler_obj->address_space.handler_flags &
ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default"
: "User", handler_obj->address_space.handler);
 
acpi_os_printf(" Device Name: %s (%p)\n", pathname, node);
 
handler_obj = handler_obj->address_space.next;
}
 
ACPI_FREE(pathname);
return (AE_OK);
}
/drivers/acpi/acpica/dbexec.c
0,0 → 1,764
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
*
******************************************************************************/
 
/*
* 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 "acdebug.h"
#include "acnamesp.h"
 
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME("dbexec")
 
static struct acpi_db_method_info acpi_gbl_db_method_info;
 
/* Local prototypes */
 
static acpi_status
acpi_db_execute_method(struct acpi_db_method_info *info,
struct acpi_buffer *return_obj);
 
static acpi_status acpi_db_execute_setup(struct acpi_db_method_info *info);
 
static u32 acpi_db_get_outstanding_allocations(void);
 
static void ACPI_SYSTEM_XFACE acpi_db_method_thread(void *context);
 
static acpi_status
acpi_db_execution_walk(acpi_handle obj_handle,
u32 nesting_level, void *context, void **return_value);
 
/*******************************************************************************
*
* FUNCTION: acpi_db_delete_objects
*
* PARAMETERS: count - Count of objects in the list
* objects - Array of ACPI_OBJECTs to be deleted
*
* RETURN: None
*
* DESCRIPTION: Delete a list of ACPI_OBJECTS. Handles packages and nested
* packages via recursion.
*
******************************************************************************/
 
void acpi_db_delete_objects(u32 count, union acpi_object *objects)
{
u32 i;
 
for (i = 0; i < count; i++) {
switch (objects[i].type) {
case ACPI_TYPE_BUFFER:
 
ACPI_FREE(objects[i].buffer.pointer);
break;
 
case ACPI_TYPE_PACKAGE:
 
/* Recursive call to delete package elements */
 
acpi_db_delete_objects(objects[i].package.count,
objects[i].package.elements);
 
/* Free the elements array */
 
ACPI_FREE(objects[i].package.elements);
break;
 
default:
 
break;
}
}
}
 
/*******************************************************************************
*
* FUNCTION: acpi_db_execute_method
*
* PARAMETERS: info - Valid info segment
* return_obj - Where to put return object
*
* RETURN: Status
*
* DESCRIPTION: Execute a control method.
*
******************************************************************************/
 
static acpi_status
acpi_db_execute_method(struct acpi_db_method_info *info,
struct acpi_buffer *return_obj)
{
acpi_status status;
struct acpi_object_list param_objects;
union acpi_object params[ACPI_DEBUGGER_MAX_ARGS + 1];
u32 i;
 
ACPI_FUNCTION_TRACE(db_execute_method);
 
if (acpi_gbl_db_output_to_file && !acpi_dbg_level) {
acpi_os_printf("Warning: debug output is not enabled!\n");
}
 
param_objects.count = 0;
param_objects.pointer = NULL;
 
/* Pass through any command-line arguments */
 
if (info->args && info->args[0]) {