acpi driver
git-svn-id: svn://kolibrios.org@6595 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -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 $@ $<
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
@@ -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:
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
@@ -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__ */
|
||||
@@ -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__ */
|
||||
@@ -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_ */
|
||||
@@ -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__ */
|
||||
@@ -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__ */
|
||||
@@ -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__ */
|
||||
@@ -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__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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 */
|
||||
@@ -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__ */
|
||||
@@ -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 */
|
||||
@@ -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__ */
|
||||
@@ -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__ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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__ */
|
||||
@@ -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
|
||||
@@ -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__ */
|
||||
@@ -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 */
|
||||
@@ -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__ */
|
||||
@@ -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
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||