diff options
Diffstat (limited to 'sys/contrib/dev/acpica')
-rw-r--r-- | sys/contrib/dev/acpica/acconfig.h | 93 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acenv.h | 2 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acfreebsd.h | 172 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acgcc.h | 162 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acpixf.h | 36 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acutils.h | 6 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dbdisasm.c | 117 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/dbfileio.c | 11 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exfldio.c | 46 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exsystem.c | 8 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/hwsleep.c | 142 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/psparse.c | 260 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/rscreate.c | 40 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tbget.c | 216 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/utglobal.c | 75 |
15 files changed, 809 insertions, 577 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index 12183b4..ba289f0 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -145,36 +145,36 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20020403 +#define ACPI_CA_VERSION 0x20020611 /* Version of ACPI supported */ -#define ACPI_CA_SUPPORT_LEVEL 2 +#define ACPI_CA_SUPPORT_LEVEL 2 /* Maximum objects in the various object caches */ -#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */ -#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ -#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ -#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +#define MAX_STATE_CACHE_DEPTH 64 /* State objects for stacks */ +#define MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ +#define MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ +#define MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ /* String size constants */ -#define MAX_STRING_LENGTH 512 -#define PATHNAME_MAX 256 /* A full namespace pathname */ +#define MAX_STRING_LENGTH 512 +#define PATHNAME_MAX 256 /* A full namespace pathname */ /* Maximum count for a semaphore object */ -#define MAX_SEMAPHORE_COUNT 256 +#define MAX_SEMAPHORE_COUNT 256 /* Max reference count (for debug only) */ -#define MAX_REFERENCE_COUNT 0x400 +#define MAX_REFERENCE_COUNT 0x400 /* Size of cached memory mapping for system memory operation region */ -#define SYSMEM_REGION_WINDOW_SIZE 4096 +#define SYSMEM_REGION_WINDOW_SIZE 4096 /****************************************************************************** @@ -183,31 +183,12 @@ * *****************************************************************************/ -/* - * Debugger threading model - * Use single threaded if the entire subsystem is contained in an application - * Use multiple threaded when the subsystem is running in the kernel. - * - * By default the model is single threaded if ACPI_APPLICATION is set, - * multi-threaded if ACPI_APPLICATION is not set. - */ -#define DEBUGGER_SINGLE_THREADED 0 -#define DEBUGGER_MULTI_THREADED 1 - -#ifndef DEBUGGER_THREADING -#ifdef ACPI_APPLICATION -#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED - -#else -#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED -#endif -#endif /* * Should the subystem abort the loading of an ACPI table if the * table checksum is incorrect? */ -#define ACPI_CHECKSUM_ABORT FALSE +#define ACPI_CHECKSUM_ABORT FALSE /****************************************************************************** @@ -218,54 +199,54 @@ /* Number of distinct GPE register blocks */ -#define ACPI_MAX_GPE_BLOCKS 2 +#define ACPI_MAX_GPE_BLOCKS 2 /* * Method info (in WALK_STATE), containing local variables and argumetns */ -#define MTH_NUM_LOCALS 8 -#define MTH_MAX_LOCAL 7 +#define MTH_NUM_LOCALS 8 +#define MTH_MAX_LOCAL 7 -#define MTH_NUM_ARGS 7 -#define MTH_MAX_ARG 6 +#define MTH_NUM_ARGS 7 +#define MTH_MAX_ARG 6 /* Maximum length of resulting string when converting from a buffer */ -#define ACPI_MAX_STRING_CONVERSION 200 +#define ACPI_MAX_STRING_CONVERSION 200 /* * Operand Stack (in WALK_STATE), Must be large enough to contain MTH_MAX_ARG */ -#define OBJ_NUM_OPERANDS 8 -#define OBJ_MAX_OPERAND 7 +#define OBJ_NUM_OPERANDS 8 +#define OBJ_MAX_OPERAND 7 /* Names within the namespace are 4 bytes long */ -#define ACPI_NAME_SIZE 4 -#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ -#define PATH_SEPARATOR '.' +#define ACPI_NAME_SIZE 4 +#define PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */ +#define PATH_SEPARATOR '.' /* Constants used in searching for the RSDP in low memory */ -#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */ -#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ -#define LO_RSDP_WINDOW_SIZE 0x400 -#define HI_RSDP_WINDOW_SIZE 0x20000 -#define RSDP_SCAN_STEP 16 +#define LO_RSDP_WINDOW_BASE 0 /* Physical Address */ +#define HI_RSDP_WINDOW_BASE 0xE0000 /* Physical Address */ +#define LO_RSDP_WINDOW_SIZE 0x400 +#define HI_RSDP_WINDOW_SIZE 0x20000 +#define RSDP_SCAN_STEP 16 /* Operation regions */ -#define ACPI_NUM_PREDEFINED_REGIONS 8 -#define ACPI_USER_REGION_BEGIN 0x80 +#define ACPI_NUM_PREDEFINED_REGIONS 8 +#define ACPI_USER_REGION_BEGIN 0x80 /* Maximum SpaceIds for Operation Regions */ -#define ACPI_MAX_ADDRESS_SPACE 255 +#define ACPI_MAX_ADDRESS_SPACE 255 /* RSDP checksums */ -#define ACPI_RSDP_CHECKSUM_LENGTH 20 -#define ACPI_RSDP_XCHECKSUM_LENGTH 36 +#define ACPI_RSDP_CHECKSUM_LENGTH 20 +#define ACPI_RSDP_XCHECKSUM_LENGTH 36 /****************************************************************************** @@ -275,10 +256,10 @@ *****************************************************************************/ -#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ +#define ACPI_DEBUGGER_MAX_ARGS 8 /* Must be max method args + 1 */ -#define ACPI_DEBUGGER_COMMAND_PROMPT '-' -#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' +#define ACPI_DEBUGGER_COMMAND_PROMPT '-' +#define ACPI_DEBUGGER_EXECUTE_PROMPT '%' #endif /* _ACCONFIG_H */ diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h index 04945ef..bc9f59b 100644 --- a/sys/contrib/dev/acpica/acenv.h +++ b/sys/contrib/dev/acpica/acenv.h @@ -256,12 +256,14 @@ #define DEBUGGER_SINGLE_THREADED 0 #define DEBUGGER_MULTI_THREADED 1 +#ifndef DEBUGGER_THREADING #ifdef ACPI_APPLICATION #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #else #define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED #endif +#endif /****************************************************************************** diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h index 43cf611..334af1c 100644 --- a/sys/contrib/dev/acpica/acfreebsd.h +++ b/sys/contrib/dev/acpica/acfreebsd.h @@ -136,20 +136,165 @@ #include <sys/libkern.h> #include <machine/stdarg.h> -#define asm __asm -#define __cli() disable_intr() -#define __sti() enable_intr() -#ifdef __i386__ -#define ACPI_FLUSH_CPU_CACHE() wbinvd() -#else +#ifdef __ia64__ +#define _IA64 + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* Asm macros */ + +#define ACPI_ASM_MACROS +#define BREAKPOINT3 +#define ACPI_DISABLE_IRQS() disable_intr() +#define ACPI_ENABLE_IRQS() enable_intr() + #define ACPI_FLUSH_CPU_CACHE() /* XXX ia64_fc()? */ -#endif -#ifdef ACPI_DEBUG +/*! [Begin] no source code translation */ + +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + __asm__ volatile ("1: ld4 r29=%1\n" \ + ";;\n" \ + "mov ar.ccv=r29\n" \ + "mov r2=r29\n" \ + "shr.u r30=r29,1\n" \ + "and r29=-4,r29\n" \ + ";;\n" \ + "add r29=2,r29\n" \ + "and r30=1,r30\n" \ + ";;\n" \ + "add r29=r29,r30\n" \ + ";;\n" \ + "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ + ";;\n" \ + "cmp.eq p6,p7=r2,r30\n" \ + "(p7) br.dpnt.few 1b\n" \ + "cmp.gt p8,p9=3,r29\n" \ + ";;\n" \ + "(p8) mov %0=-1\n" \ + "(p9) mov %0=r0\n" \ + :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \ + } while (0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + __asm__ volatile ("1: ld4 r29=%1\n" \ + ";;\n" \ + "mov ar.ccv=r29\n" \ + "mov r2=r29\n" \ + "and r29=-4,r29\n" \ + ";;\n" \ + "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ + ";;\n" \ + "cmp.eq p6,p7=r2,r30\n" \ + "(p7) br.dpnt.few 1b\n" \ + "and %0=1,r2\n" \ + ";;\n" \ + :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \ + } while (0) +/*! [End] no source code translation !*/ + + +#else /* DO IA32 */ + +/* + * Calling conventions: + * + * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) + * ACPI_EXTERNAL_XFACE - External ACPI interfaces + * ACPI_INTERNAL_XFACE - Internal ACPI interfaces + * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces + */ +#define ACPI_SYSTEM_XFACE +#define ACPI_EXTERNAL_XFACE +#define ACPI_INTERNAL_XFACE +#define ACPI_INTERNAL_VAR_XFACE + +/* Asm macros */ + +#define ACPI_ASM_MACROS +#define BREAKPOINT3 +#define ACPI_DISABLE_IRQS() disable_intr() +#define ACPI_ENABLE_IRQS() enable_intr() + +#define ACPI_FLUSH_CPU_CACHE() wbinvd() + +#define asm __asm +/*! [Begin] no source code translation + * + * A brief explanation as GNU inline assembly is a bit hairy + * %0 is the output parameter in EAX ("=a") + * %1 and %2 are the input parameters in ECX ("c") + * and an immediate value ("i") respectively + * All actual register references are preceded with "%%" as in "%%edx" + * Immediate values in the assembly are preceded by "$" as in "$0x1" + * The final asm parameter are the operation altered non-output registers. + */ +#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + int dummy; \ + asm("1: movl (%1),%%eax;" \ + "movl %%eax,%%edx;" \ + "andl %2,%%edx;" \ + "btsl $0x1,%%edx;" \ + "adcl $0x0,%%edx;" \ + "lock; cmpxchgl %%edx,(%1);" \ + "jnz 1b;" \ + "cmpb $0x3,%%dl;" \ + "sbbl %%eax,%%eax" \ + :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \ + } while(0) + +#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ + do { \ + int dummy; \ + asm("1: movl (%1),%%eax;" \ + "movl %%eax,%%edx;" \ + "andl %2,%%edx;" \ + "lock; cmpxchgl %%edx,(%1);" \ + "jnz 1b;" \ + "andl $0x1,%%eax" \ + :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \ + } while(0) + + +/* + * Math helper asm macros + */ +#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ + asm("divl %2;" \ + :"=a"(q32), "=d"(r32) \ + :"r"(d32), \ + "0"(n_lo), "1"(n_hi)) + + +#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ + asm("shrl $1,%2;" \ + "rcrl $1,%3;" \ + :"=r"(n_hi), "=r"(n_lo) \ + :"0"(n_hi), "1"(n_lo)) + +/*! [End] no source code translation !*/ + +#endif /* IA 32 */ + #ifdef DEBUGGER_THREADING #undef DEBUGGER_THREADING #endif /* DEBUGGER_THREADING */ #define DEBUGGER_THREADING 0 /* integrated with DDB */ +#ifdef ACPI_DEBUG #include "opt_ddb.h" #ifdef DDB #define ENABLE_DEBUGGER @@ -204,4 +349,15 @@ strstr(char *s, char *find) } #endif /* _KERNEL */ +#if defined(__ia64__) || defined(__x86_64__) +#define ACPI_MACHINE_WIDTH 64 +#define COMPILER_DEPENDENT_INT64 long +#define COMPILER_DEPENDENT_UINT64 unsigned long +#else +#define ACPI_MACHINE_WIDTH 32 +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long +#define ACPI_USE_NATIVE_DIVIDE +#endif + #endif /* __ACFREEBSD_H__ */ diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h index 514e63e..31ff6c9 100644 --- a/sys/contrib/dev/acpica/acgcc.h +++ b/sys/contrib/dev/acpica/acgcc.h @@ -117,168 +117,6 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ - -#ifdef __ia64__ -#define _IA64 - -#define COMPILER_DEPENDENT_INT64 long -#define COMPILER_DEPENDENT_UINT64 unsigned long - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -/* Single threaded */ - -#ifndef __FreeBSD__ -#define ACPI_APPLICATION -#endif - -/* Asm macros */ - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() __cli() -#define ACPI_ENABLE_IRQS() __sti() - -/*! [Begin] no source code translation */ - -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - __asm__ volatile ("1: ld4 r29=%1\n" \ - ";;\n" \ - "mov ar.ccv=r29\n" \ - "mov r2=r29\n" \ - "shr.u r30=r29,1\n" \ - "and r29=-4,r29\n" \ - ";;\n" \ - "add r29=2,r29\n" \ - "and r30=1,r30\n" \ - ";;\n" \ - "add r29=r29,r30\n" \ - ";;\n" \ - "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ - ";;\n" \ - "cmp.eq p6,p7=r2,r30\n" \ - "(p7) br.dpnt.few 1b\n" \ - "cmp.gt p8,p9=3,r29\n" \ - ";;\n" \ - "(p8) mov %0=-1\n" \ - "(p9) mov %0=r0\n" \ - :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \ - } while (0) - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - __asm__ volatile ("1: ld4 r29=%1\n" \ - ";;\n" \ - "mov ar.ccv=r29\n" \ - "mov r2=r29\n" \ - "and r29=-4,r29\n" \ - ";;\n" \ - "cmpxchg4.acq r30=%1,r29,ar.ccv\n" \ - ";;\n" \ - "cmp.eq p6,p7=r2,r30\n" \ - "(p7) br.dpnt.few 1b\n" \ - "and %0=1,r2\n" \ - ";;\n" \ - :"=r"(Acq):"m"(GLptr):"r2","r29","r30","memory"); \ - } while (0) -/*! [End] no source code translation !*/ - - -#else /* DO IA32 */ - -#define COMPILER_DEPENDENT_INT64 long long -#define COMPILER_DEPENDENT_UINT64 unsigned long long - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -/* Asm macros */ - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() __cli() -#define ACPI_ENABLE_IRQS() __sti() - -/*! [Begin] no source code translation - * - * A brief explanation as GNU inline assembly is a bit hairy - * %0 is the output parameter in EAX ("=a") - * %1 and %2 are the input parameters in ECX ("c") - * and an immediate value ("i") respectively - * All actual register references are preceded with "%%" as in "%%edx" - * Immediate values in the assembly are preceded by "$" as in "$0x1" - * The final asm parameter are the operation altered non-output registers. - */ -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - int dummy; \ - asm("1: movl (%1),%%eax;" \ - "movl %%eax,%%edx;" \ - "andl %2,%%edx;" \ - "btsl $0x1,%%edx;" \ - "adcl $0x0,%%edx;" \ - "lock; cmpxchgl %%edx,(%1);" \ - "jnz 1b;" \ - "cmpb $0x3,%%dl;" \ - "sbbl %%eax,%%eax" \ - :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \ - } while(0) - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ - do { \ - int dummy; \ - asm("1: movl (%1),%%eax;" \ - "movl %%eax,%%edx;" \ - "andl %2,%%edx;" \ - "lock; cmpxchgl %%edx,(%1);" \ - "jnz 1b;" \ - "andl $0x1,%%eax" \ - :"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \ - } while(0) - - -/* - * Math helper asm macros - */ -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ - asm("divl %2;" \ - :"=a"(q32), "=d"(r32) \ - :"r"(d32), \ - "0"(n_lo), "1"(n_hi)) - - -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ - asm("shrl $1,%2;" \ - "rcrl $1,%3;" \ - :"=r"(n_hi), "=r"(n_lo) \ - :"0"(n_hi), "1"(n_lo)) - -/*! [End] no source code translation !*/ - -#endif /* IA 32 */ - /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. */ diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h index 819bb67..046bc52 100644 --- a/sys/contrib/dev/acpica/acpixf.h +++ b/sys/contrib/dev/acpica/acpixf.h @@ -162,6 +162,10 @@ ACPI_STATUS AcpiPurgeCachedObjects ( void); +ACPI_STATUS +AcpiInstallInitializationHandler ( + ACPI_INIT_HANDLER Handler, + UINT32 Function); /* * ACPI Memory manager @@ -283,6 +287,14 @@ AcpiEvaluateObject ( ACPI_BUFFER *ReturnObjectBuffer); ACPI_STATUS +AcpiEvaluateObjectTyped ( + ACPI_HANDLE Object, + ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ExternalParams, + ACPI_BUFFER *ReturnBuffer, + ACPI_OBJECT_TYPE ReturnType); + +ACPI_STATUS AcpiGetObjectInfo ( ACPI_HANDLE Device, ACPI_DEVICE_INFO *Info); @@ -421,6 +433,18 @@ AcpiGetIrqRoutingTable ( */ ACPI_STATUS +AcpiGetRegister ( + UINT32 RegisterId, + UINT32 *ReturnValue, + UINT32 Flags); + +ACPI_STATUS +AcpiSetRegister ( + UINT32 RegisterId, + UINT32 Value, + UINT32 Flags); + +ACPI_STATUS AcpiSetFirmwareWakingVector ( ACPI_PHYSICAL_ADDRESS PhysicalAddress); @@ -428,17 +452,23 @@ ACPI_STATUS AcpiGetFirmwareWakingVector ( ACPI_PHYSICAL_ADDRESS *PhysicalAddress); +ACPI_STATUS +AcpiGetSleepTypeData ( + UINT8 SleepState, + UINT8 *Slp_TypA, + UINT8 *Slp_TypB); ACPI_STATUS AcpiEnterSleepStatePrep ( - UINT8 SleepState); + UINT8 SleepState); ACPI_STATUS AcpiEnterSleepState ( - UINT8 SleepState); + UINT8 SleepState); ACPI_STATUS AcpiLeaveSleepState ( - UINT8 SleepState); + UINT8 SleepState); + #endif /* __ACXFACE_H__ */ diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 3dc539a..7b94784 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -191,6 +191,9 @@ NATIVE_CHAR * AcpiUtGetMutexName ( UINT32 MutexId); +#endif + + NATIVE_CHAR * AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type); @@ -199,9 +202,6 @@ NATIVE_CHAR * AcpiUtGetObjectTypeName ( ACPI_OPERAND_OBJECT *ObjDesc); -#endif - - NATIVE_CHAR * AcpiUtGetRegionName ( UINT8 SpaceId); diff --git a/sys/contrib/dev/acpica/dbdisasm.c b/sys/contrib/dev/acpica/dbdisasm.c index c23c09e..9e67ada 100644 --- a/sys/contrib/dev/acpica/dbdisasm.c +++ b/sys/contrib/dev/acpica/dbdisasm.c @@ -131,7 +131,7 @@ #define BLOCK_PAREN 1 #define BLOCK_BRACE 2 #define DB_NO_OP_INFO " [%2.2d] " -#define DB_FULL_OP_INFO "%5.5X #%4.4X [%2.2d] " +#define DB_FULL_OP_INFO "%5.5X #%4.4hX [%2.2d] " @@ -152,7 +152,7 @@ AcpiDbBlockType ( ACPI_PARSE_OBJECT *Op) { - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: return (BLOCK_BRACE); @@ -191,9 +191,9 @@ AcpiPsDisplayObjectPathname ( char *Name; - if (Op->Flags & ACPI_PARSEOP_GENERIC) + if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) { - Name = Op->Value.Name; + Name = Op->Common.Value.Name; if (Name[0] == '\\') { AcpiOsPrintf (" (Fully Qualified Pathname)"); @@ -202,7 +202,7 @@ AcpiPsDisplayObjectPathname ( } else { - Name = (char *) &((ACPI_PARSE2_OBJECT *) Op)->Name; + Name = (char *) &Op->Named.Name; } /* Search parent tree up to the root if necessary */ @@ -250,12 +250,12 @@ AcpiPsDisplayObjectPathname ( /* Just get the Node out of the Op object */ - Node = Op->Node; + Node = Op->Common.Node; if (!Node) { /* Node not defined in this scope, look it up */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, ACPI_TYPE_ANY, + Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); if (ACPI_FAILURE (Status)) @@ -271,7 +271,7 @@ AcpiPsDisplayObjectPathname ( /* Save it for next time. */ - Op->Node = Node; + Op->Common.Node = Node; } /* Convert NamedDesc/handle to a full pathname */ @@ -345,12 +345,12 @@ AcpiDbDisplayOp ( /* Determine the nesting depth of this argument */ - for (depth = Op->Parent; depth; depth = depth->Parent) + for (depth = Op->Common.Parent; depth; depth = depth->Common.Parent) { arg = AcpiPsGetArg (depth, 0); while (arg && arg != Origin) { - arg = arg->Next; + arg = arg->Common.Next; } if (arg) @@ -385,10 +385,10 @@ AcpiDbDisplayOp ( else if (DepthCount < LastDepth) { - for (j = 0; j < (LastDepth - DepthCount); j++) + for (j = LastDepth; j >= (DepthCount + 1); j--) { - VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - j)); - for (i = 0; i < (LastDepth - j - 1); i++) + VERBOSE_PRINT ((DB_NO_OP_INFO, (j - 1))); + for (i = 1; i < j; i++) { AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); } @@ -406,7 +406,8 @@ AcpiDbDisplayOp ( /* In verbose mode, print the AML offset, opcode and depth count */ - VERBOSE_PRINT ((DB_FULL_OP_INFO, (unsigned) Op->AmlOffset, Op->Opcode, DepthCount)); + VERBOSE_PRINT ((DB_FULL_OP_INFO, (UINT32) Op->Common.AmlOffset, + Op->Common.AmlOpcode, DepthCount)); /* Indent the output according to the depth count */ @@ -422,11 +423,11 @@ AcpiDbDisplayOp ( /* Resolve a name reference */ - if ((Op->Opcode == AML_INT_NAMEPATH_OP && Op->Value.Name) && - (Op->Parent) && + if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP && Op->Common.Value.Name) && + (Op->Common.Parent) && (AcpiGbl_DbOpt_verbose)) { - AcpiPsDisplayObjectPathname (WalkState, Op); + (void) AcpiPsDisplayObjectPathname (WalkState, Op); } AcpiOsPrintf ("\n"); @@ -561,7 +562,7 @@ AcpiDbDisplayPath ( /* We are only interested in named objects */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (!(OpInfo->Flags & AML_NSNODE)) { return; @@ -571,7 +572,7 @@ AcpiDbDisplayPath ( { /* Field creation - check for a fully qualified namepath */ - if (Op->Opcode == AML_CREATE_FIELD_OP) + if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) { NamePath = AcpiPsGetArg (Op, 3); } @@ -581,10 +582,10 @@ AcpiDbDisplayPath ( } if ((NamePath) && - (NamePath->Value.String) && - (NamePath->Value.String[0] == '\\')) + (NamePath->Common.Value.String) && + (NamePath->Common.Value.String[0] == '\\')) { - AcpiDbDisplayNamestring (NamePath->Value.String); + AcpiDbDisplayNamestring (NamePath->Common.Value.String); return; } } @@ -598,19 +599,19 @@ AcpiDbDisplayPath ( Search = Op; for (; ;) { - if (Search->Parent == Prev) + if (Search->Common.Parent == Prev) { break; } /* Go up one level */ - Search = Search->Parent; + Search = Search->Common.Parent; } if (Prev) { - OpInfo = AcpiPsGetOpcodeInfo (Search->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Search->Common.AmlOpcode); if (!(OpInfo->Flags & AML_FIELD)) { /* below root scope, append scope name */ @@ -624,7 +625,7 @@ AcpiDbDisplayPath ( if (OpInfo->Flags & AML_CREATE) { - if (Op->Opcode == AML_CREATE_FIELD_OP) + if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) { NamePath = AcpiPsGetArg (Op, 3); } @@ -634,9 +635,9 @@ AcpiDbDisplayPath ( } if ((NamePath) && - (NamePath->Value.String)) + (NamePath->Common.Value.String)) { - AcpiOsPrintf ("%4.4s", NamePath->Value.String); + AcpiOsPrintf ("%4.4s", NamePath->Common.Value.String); } } else @@ -684,21 +685,22 @@ AcpiDbDisplayOpcode ( if (!Op) { AcpiOsPrintf ("<NULL OP PTR>"); + return; } /* op and arguments */ - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_BYTE_OP: if (AcpiGbl_DbOpt_verbose) { - AcpiOsPrintf ("(UINT8) 0x%2.2X", Op->Value.Integer8); + AcpiOsPrintf ("(UINT8) 0x%2.2hX", Op->Common.Value.Integer8); } else { - AcpiOsPrintf ("0x%2.2X", Op->Value.Integer8); + AcpiOsPrintf ("0x%2.2hX", Op->Common.Value.Integer8); } break; @@ -707,11 +709,11 @@ AcpiDbDisplayOpcode ( if (AcpiGbl_DbOpt_verbose) { - AcpiOsPrintf ("(UINT16) 0x%4.4X", Op->Value.Integer16); + AcpiOsPrintf ("(UINT16) 0x%4.4hX", Op->Common.Value.Integer16); } else { - AcpiOsPrintf ("0x%4.4X", Op->Value.Integer16); + AcpiOsPrintf ("0x%4.4hX", Op->Common.Value.Integer16); } break; @@ -720,11 +722,11 @@ AcpiDbDisplayOpcode ( if (AcpiGbl_DbOpt_verbose) { - AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Value.Integer32); + AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Common.Value.Integer32); } else { - AcpiOsPrintf ("0x%8.8X", Op->Value.Integer32); + AcpiOsPrintf ("0x%8.8X", Op->Common.Value.Integer32); } break; @@ -733,22 +735,22 @@ AcpiDbDisplayOpcode ( if (AcpiGbl_DbOpt_verbose) { - AcpiOsPrintf ("(UINT64) 0x%8.8X%8.8X", Op->Value.Integer64.Hi, - Op->Value.Integer64.Lo); + AcpiOsPrintf ("(UINT64) 0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi, + Op->Common.Value.Integer64.Lo); } else { - AcpiOsPrintf ("0x%8.8X%8.8X", Op->Value.Integer64.Hi, - Op->Value.Integer64.Lo); + AcpiOsPrintf ("0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi, + Op->Common.Value.Integer64.Lo); } break; case AML_STRING_OP: - if (Op->Value.String) + if (Op->Common.Value.String) { - AcpiOsPrintf ("\"%s\"", Op->Value.String); + AcpiOsPrintf ("\"%s\"", Op->Common.Value.String); } else { @@ -759,9 +761,9 @@ AcpiDbDisplayOpcode ( case AML_INT_STATICSTRING_OP: - if (Op->Value.String) + if (Op->Common.Value.String) { - AcpiOsPrintf ("\"%s\"", Op->Value.String); + AcpiOsPrintf ("\"%s\"", Op->Common.Value.String); } else { @@ -772,25 +774,25 @@ AcpiDbDisplayOpcode ( case AML_INT_NAMEPATH_OP: - AcpiDbDisplayNamestring (Op->Value.Name); + AcpiDbDisplayNamestring (Op->Common.Value.Name); break; case AML_INT_NAMEDFIELD_OP: - AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Value.Integer32); + AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Common.Value.Integer32); break; case AML_INT_RESERVEDFIELD_OP: - AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Value.Integer32); + AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Common.Value.Integer32); break; case AML_INT_ACCESSFIELD_OP: - AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Value.Integer32); + AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Common.Value.Integer32); break; @@ -798,14 +800,14 @@ AcpiDbDisplayOpcode ( if (AcpiGbl_DbOpt_verbose) { - AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Value.Integer32); + AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Common.Value.Integer32); } else { - AcpiOsPrintf ("0x%2.2X", Op->Value.Integer32); + AcpiOsPrintf ("0x%2.2X", Op->Common.Value.Integer32); - ByteCount = Op->Value.Integer32; - ByteData = ((ACPI_PARSE2_OBJECT *) Op)->Data; + ByteCount = Op->Common.Value.Integer32; + ByteData = Op->Named.Data; for (i = 0; i < ByteCount; i++) { @@ -819,12 +821,13 @@ AcpiDbDisplayOpcode ( /* Just get the opcode name and print it */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); AcpiOsPrintf ("%s", OpInfo->Name); #ifndef PARSER_ONLY - if ((Op->Opcode == AML_INT_RETURN_VALUE_OP) && + if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && + (WalkState) && (WalkState->Results) && (WalkState->Results->Results.NumResults)) { @@ -838,7 +841,7 @@ AcpiDbDisplayOpcode ( { /* If there is another element in the list, add a comma */ - if (Op->Next) + if (Op->Common.Next) { AcpiOsPrintf (","); } @@ -847,15 +850,15 @@ AcpiDbDisplayOpcode ( /* * If this is a named opcode, print the associated name value */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (Op && (OpInfo->Flags & AML_NAMED)) { Name = AcpiPsGetName (Op); AcpiOsPrintf (" %4.4s", &Name); - if ((AcpiGbl_DbOpt_verbose) && (Op->Opcode != AML_INT_NAMEDFIELD_OP)) + if ((AcpiGbl_DbOpt_verbose) && (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)) { - AcpiPsDisplayObjectPathname (WalkState, Op); + (void) AcpiPsDisplayObjectPathname (WalkState, Op); } } } diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index f621192..d96c510 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/dbfileio.c @@ -119,8 +119,6 @@ #include "acpi.h" #include "acdebug.h" #include "acnamesp.h" -#include "acparser.h" -#include "acevents.h" #include "actables.h" #ifdef ENABLE_DEBUGGER @@ -139,7 +137,6 @@ FILE *AcpiGbl_DebugFile = NULL; #endif - /******************************************************************************* * * FUNCTION: AcpiDbMatchArgument @@ -262,7 +259,7 @@ AcpiDbOpenDebugFile ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiDbLoadTable( FILE *fp, ACPI_TABLE_HEADER **TablePtr, @@ -387,7 +384,7 @@ AeLocalLoadTable ( TableInfo.Pointer = TablePtr; - Status = AcpiTbInstallTable (NULL, &TableInfo); + Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { /* Free table allocated by AcpiTbGetTable */ @@ -481,7 +478,7 @@ AcpiDbLoadAcpiTable ( if (Status == AE_ALREADY_EXISTS) { AcpiOsPrintf ("Table %4.4s is already installed\n", - &AcpiGbl_DbTablePtr->Signature); + AcpiGbl_DbTablePtr->Signature); } else { @@ -493,7 +490,7 @@ AcpiDbLoadAcpiTable ( } AcpiOsPrintf ("%4.4s at %p successfully installed and loaded\n", - &AcpiGbl_DbTablePtr->Signature, AcpiGbl_DbTablePtr); + AcpiGbl_DbTablePtr->Signature, AcpiGbl_DbTablePtr); AcpiGbl_AcpiHardwarePresent = FALSE; diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index 2f4328b..1402618 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -120,8 +120,6 @@ #include "acpi.h" #include "acinterp.h" #include "amlcode.h" -#include "acnamesp.h" -#include "achware.h" #include "acevents.h" #include "acdispat.h" @@ -159,10 +157,12 @@ AcpiExSetupRegion ( RgnDesc = ObjDesc->CommonField.RegionObj; - if (ACPI_TYPE_REGION != RgnDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %x %s\n", - RgnDesc->Common.Type, AcpiUtGetTypeName (RgnDesc->Common.Type))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n", + ACPI_GET_OBJECT_TYPE (RgnDesc), + AcpiUtGetObjectTypeName (RgnDesc))); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -197,8 +197,8 @@ AcpiExSetupRegion ( */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", - (char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.AccessByteWidth, - (char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length)); + ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.AccessByteWidth, + RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length)); } /* @@ -207,9 +207,9 @@ AcpiExSetupRegion ( */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n", - (char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.BaseByteOffset, + ObjDesc->CommonField.Node->Name.Ascii, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, - (char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length)); + RgnDesc->Region.Node->Name.Ascii, RgnDesc->Region.Length)); return_ACPI_STATUS (AE_AML_REGION_LIMIT); } @@ -339,7 +339,7 @@ AcpiExRegisterOverflow ( return (FALSE); } - if (Value >= (ACPI_INTEGER) (1 << ObjDesc->CommonField.BitLength)) + if (Value >= ((ACPI_INTEGER) 1 << ObjDesc->CommonField.BitLength)) { /* * The Value is larger than the maximum value that can fit into @@ -407,7 +407,7 @@ AcpiExFieldDatumIo ( * BankFields - Write to a Bank Register, then read/write from/to an OpRegion * IndexFields - Write to an Index Register, then read/write from/to a Data Register */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_BUFFER_FIELD: /* @@ -455,7 +455,7 @@ AcpiExFieldDatumIo ( /* Ensure that the BankValue is not beyond the capacity of the register */ if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj, - ObjDesc->BankField.Value)) + (ACPI_INTEGER) ObjDesc->BankField.Value)) { return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); } @@ -477,7 +477,7 @@ AcpiExFieldDatumIo ( * RegionField case and write the datum to the Operation Region */ - /* No break; ! */ + /*lint -fallthrough */ case INTERNAL_TYPE_REGION_FIELD: @@ -502,7 +502,7 @@ AcpiExFieldDatumIo ( /* Ensure that the IndexValue is not beyond the capacity of the register */ if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj, - ObjDesc->IndexField.Value)) + (ACPI_INTEGER) ObjDesc->IndexField.Value)) { return_ACPI_STATUS (AE_AML_REGISTER_LIMIT); } @@ -537,7 +537,7 @@ AcpiExFieldDatumIo ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p, Wrong object type - %s\n", - ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type))); + ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); Status = AE_AML_INTERNAL; break; } @@ -594,7 +594,7 @@ AcpiExWriteWithUpdateRule ( /* If the mask is all ones, we don't need to worry about the update rule */ - if (Mask != ACPI_UINT32_MAX) + if (Mask != ACPI_INTEGER_MAX) { /* Decode the update rule */ @@ -634,7 +634,7 @@ AcpiExWriteWithUpdateRule ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "WriteWithUpdateRule: Unknown UpdateRule setting: %x\n", + "WriteWithUpdateRule: Unknown UpdateRule setting: %X\n", (ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK))); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -705,6 +705,10 @@ AcpiExGetBufferDatum( ACPI_MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset])); break; + + default: + /* Should not get here */ + break; } } @@ -758,6 +762,10 @@ AcpiExSetBufferDatum ( ACPI_MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum); break; + + default: + /* Should not get here */ + break; } } @@ -813,7 +821,7 @@ AcpiExExtractFromField ( ObjDesc->CommonField.AccessByteWidth); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "ByteLen=%x, DatumLen=%x, ByteGran=%x\n", + "ByteLen=%X, DatumLen=%X, ByteGran=%X\n", ByteFieldLength, DatumCount,ObjDesc->CommonField.AccessByteWidth)); /* @@ -1002,7 +1010,7 @@ AcpiExInsertIntoField ( DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "ByteLen=%x, DatumLen=%x, ByteGran=%x\n", + "ByteLen=%X, DatumLen=%X, ByteGran=%X\n", ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessByteWidth)); /* diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c index 758567b..5b7230a 100644 --- a/sys/contrib/dev/acpica/exsystem.c +++ b/sys/contrib/dev/acpica/exsystem.c @@ -119,8 +119,6 @@ #include "acpi.h" #include "acinterp.h" -#include "acnamesp.h" -#include "achware.h" #include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -347,8 +345,8 @@ AcpiExSystemReleaseMutex ( */ if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore) { - AcpiEvReleaseGlobalLock (); - return_ACPI_STATUS (AE_OK); + Status = AcpiEvReleaseGlobalLock (); + return_ACPI_STATUS (Status); } Status = AcpiOsSignalSemaphore (ObjDesc->Mutex.Semaphore, 1); @@ -454,7 +452,7 @@ AcpiExSystemResetEvent ( Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore); if (ACPI_SUCCESS (Status)) { - AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore); + (void) AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore); ObjDesc->Event.Semaphore = TempSemaphore; } diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index e31242b..bc8cde1 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -116,8 +116,6 @@ *****************************************************************************/ #include "acpi.h" -#include "acnamesp.h" -#include "achware.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwsleep") @@ -148,11 +146,13 @@ AcpiSetFirmwareWakingVector ( if (AcpiGbl_CommonFACS.VectorWidth == 32) { - *(UINT32 *) AcpiGbl_CommonFACS.FirmwareWakingVector = (UINT32) PhysicalAddress; + *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector)) + = (UINT32) PhysicalAddress; } else { - *AcpiGbl_CommonFACS.FirmwareWakingVector = PhysicalAddress; + *AcpiGbl_CommonFACS.FirmwareWakingVector + = PhysicalAddress; } return_ACPI_STATUS (AE_OK); @@ -190,11 +190,13 @@ AcpiGetFirmwareWakingVector ( if (AcpiGbl_CommonFACS.VectorWidth == 32) { - *PhysicalAddress = *(UINT32 *) AcpiGbl_CommonFACS.FirmwareWakingVector; + *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) + *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector)); } else { - *PhysicalAddress = *AcpiGbl_CommonFACS.FirmwareWakingVector; + *PhysicalAddress = + *AcpiGbl_CommonFACS.FirmwareWakingVector; } return_ACPI_STATUS (AE_OK); @@ -231,7 +233,7 @@ AcpiEnterSleepStatePrep ( /* * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ - Status = AcpiHwGetSleepTypeData (SleepState, + Status = AcpiGetSleepTypeData (SleepState, &AcpiGbl_SleepTypeA, &AcpiGbl_SleepTypeB); if (ACPI_FAILURE (Status)) { @@ -281,11 +283,13 @@ ACPI_STATUS AcpiEnterSleepState ( UINT8 SleepState) { - UINT16 PM1AControl; - UINT16 PM1BControl; + UINT32 PM1AControl; + UINT32 PM1BControl; ACPI_BIT_REGISTER_INFO *SleepTypeRegInfo; ACPI_BIT_REGISTER_INFO *SleepEnableRegInfo; + UINT32 InValue; UINT32 Retry; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("AcpiEnterSleepState"); @@ -294,7 +298,7 @@ AcpiEnterSleepState ( if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) || (AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX)) { - ACPI_REPORT_ERROR (("Sleep values out of range: A=%x B=%x\n", + ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n", AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB)); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -305,16 +309,39 @@ AcpiEnterSleepState ( /* Clear wake status */ - AcpiHwBitRegisterWrite (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK); - AcpiHwClearAcpiStatus(); + Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - /* TBD: Disable arbitration here? */ + Status = AcpiHwClearAcpiStatus(); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Disable BM arbitration */ + + Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - AcpiHwDisableNonWakeupGpes(); + Status = AcpiHwDisableNonWakeupGpes(); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Get current value of PM1A control */ - PM1AControl = (UINT16) AcpiHwRegisterRead (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL); + Status = AcpiHwRegisterRead (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } ACPI_DEBUG_PRINT ((ACPI_DB_OK, "Entering S%d\n", SleepState)); /* Clear SLP_EN and SLP_TYP fields */ @@ -329,8 +356,17 @@ AcpiEnterSleepState ( /* Write #1: fill in SLP_TYP data */ - AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); - AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + Status = AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Insert SLP_ENABLE bit */ @@ -338,36 +374,63 @@ AcpiEnterSleepState ( PM1BControl |= SleepEnableRegInfo->AccessBitMask; /* Write #2: SLP_TYP + SLP_EN */ - ACPI_FLUSH_CPU_CACHE(); - AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); - AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + ACPI_FLUSH_CPU_CACHE (); + + Status = AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* * Wait a second, then try again. This is to get S4/5 to work on all machines. */ if (SleepState > ACPI_STATE_S3) { - AcpiOsStall (1000000); - - AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL, - SleepEnableRegInfo->AccessBitMask); + /* + * We wait so long to allow chipsets that poll this reg very slowly to + * still read the right value. Ideally, this entire block would go + * away entirely. + */ + AcpiOsStall (10000000); + + Status = AcpiHwRegisterWrite (ACPI_MTX_LOCK, ACPI_REGISTER_PM1_CONTROL, + SleepEnableRegInfo->AccessBitMask); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } /* Wait until we enter sleep state */ - /* Spin until we wake */ Retry = 1000; - while (!AcpiHwBitRegisterRead (ACPI_BITREG_WAKE_STATUS, ACPI_MTX_LOCK)) + do { - /* - * Some BIOSes don't set WAK_STS at all, - * give up waiting for wakeup if we time out. - */ - if (Retry-- == 0) { - break; /* giving up */ - } - } + Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* + * Some BIOSes don't set WAK_STS at all, + * give up waiting for wakeup if we time out. + */ + if (Retry-- == 0) { + break; /* giving up */ + } + + /* Spin until we wake */ + + } while (!InValue); return_ACPI_STATUS (AE_OK); } @@ -424,7 +487,14 @@ AcpiLeaveSleepState ( /* _WAK returns stuff - do we want to look at it? */ - AcpiHwEnableNonWakeupGpes(); + Status = AcpiHwEnableNonWakeupGpes(); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - return_ACPI_STATUS (AE_OK); + /* Disable BM arbitration */ + Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK); + + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index 561a796..7fc5543 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -129,15 +129,13 @@ #include "acdispat.h" #include "amlcode.h" #include "acnamesp.h" -#include "acdebug.h" #include "acinterp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psparse") -UINT32 AcpiGbl_Depth = 0; -extern UINT32 AcpiGbl_ScopeDepth; +static UINT32 AcpiGbl_Depth = 0; /******************************************************************************* @@ -267,13 +265,13 @@ AcpiPsFindObject ( * PARAMETERS: WalkState - Current State * Op - Op to complete * - * RETURN: TRUE if Op and subtree was deleted + * RETURN: None. * * DESCRIPTION: Perform any cleanup at the completion of an Op. * ******************************************************************************/ -BOOLEAN +void AcpiPsCompleteThisOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) @@ -292,7 +290,7 @@ AcpiPsCompleteThisOp ( if (!Op) { - return_VALUE (TRUE); + return_VOID; } /* Delete this op and the subtree below it if asked to */ @@ -302,13 +300,13 @@ AcpiPsCompleteThisOp ( { /* Make sure that we only delete this subtree */ - if (Op->Parent) + if (Op->Common.Parent) { /* * Check if we need to replace the operator and its subtree * with a return value op (placeholder op) */ - ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); + ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); switch (ParentInfo->Class) { @@ -324,7 +322,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - return_VALUE (FALSE); + return_VOID; } break; @@ -334,37 +332,35 @@ AcpiPsCompleteThisOp ( * These opcodes contain TermArg operands. The current * op must be replaced by a placeholder return op */ - if ((Op->Parent->Opcode == AML_REGION_OP) || - (Op->Parent->Opcode == AML_DATA_REGION_OP) || - (Op->Parent->Opcode == AML_BUFFER_OP) || - (Op->Parent->Opcode == AML_PACKAGE_OP) || - (Op->Parent->Opcode == AML_VAR_PACKAGE_OP)) + if ((Op->Common.Parent->Common.AmlOpcode == AML_REGION_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_DATA_REGION_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - return_VALUE (FALSE); + return_VOID; } } - if ((Op->Parent->Opcode == AML_NAME_OP) && + if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && (WalkState->DescendingCallback != AcpiDsExecBeginOp)) { - if ((Op->Opcode == AML_BUFFER_OP) || - (Op->Opcode == AML_PACKAGE_OP) || - (Op->Opcode == AML_VAR_PACKAGE_OP)) + if ((Op->Common.AmlOpcode == AML_BUFFER_OP) || + (Op->Common.AmlOpcode == AML_PACKAGE_OP) || + (Op->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { - ReplacementOp = AcpiPsAllocOp (Op->Opcode); + ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); if (!ReplacementOp) { - return_VALUE (FALSE); + return_VOID; } - ((ACPI_PARSE2_OBJECT *) ReplacementOp)->Data = - ((ACPI_PARSE2_OBJECT *) Op)->Data; - ((ACPI_PARSE2_OBJECT *) ReplacementOp)->Length = - ((ACPI_PARSE2_OBJECT *) Op)->Length; + ReplacementOp->Named.Data = Op->Named.Data; + ReplacementOp->Named.Length = Op->Named.Length; } } break; @@ -373,28 +369,28 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - return_VALUE (FALSE); + return_VOID; } } /* We must unlink this op from the parent tree */ - Prev = Op->Parent->Value.Arg; + Prev = Op->Common.Parent->Common.Value.Arg; if (Prev == Op) { /* This op is the first in the list */ if (ReplacementOp) { - ReplacementOp->Parent = Op->Parent; - ReplacementOp->Value.Arg = NULL; - ReplacementOp->Node = Op->Node; - Op->Parent->Value.Arg = ReplacementOp; - ReplacementOp->Next = Op->Next; + ReplacementOp->Common.Parent = Op->Common.Parent; + ReplacementOp->Common.Value.Arg = NULL; + ReplacementOp->Common.Node = Op->Common.Node; + Op->Common.Parent->Common.Value.Arg = ReplacementOp; + ReplacementOp->Common.Next = Op->Common.Next; } else { - Op->Parent->Value.Arg = Op->Next; + Op->Common.Parent->Common.Value.Arg = Op->Common.Next; } } @@ -404,21 +400,21 @@ AcpiPsCompleteThisOp ( { /* Traverse all siblings in the parent's argument list */ - Next = Prev->Next; + Next = Prev->Common.Next; if (Next == Op) { if (ReplacementOp) { - ReplacementOp->Parent = Op->Parent; - ReplacementOp->Value.Arg = NULL; - ReplacementOp->Node = Op->Node; - Prev->Next = ReplacementOp; - ReplacementOp->Next = Op->Next; + ReplacementOp->Common.Parent = Op->Common.Parent; + ReplacementOp->Common.Value.Arg = NULL; + ReplacementOp->Common.Node = Op->Common.Node; + Prev->Common.Next = ReplacementOp; + ReplacementOp->Common.Next = Op->Common.Next; Next = NULL; } else { - Prev->Next = Op->Next; + Prev->Common.Next = Op->Common.Next; Next = NULL; } } @@ -431,13 +427,13 @@ AcpiPsCompleteThisOp ( AcpiPsDeleteParseTree (Op); - return_VALUE (TRUE); + return_VOID; } - return_VALUE (FALSE); + return_VOID; #else - return (FALSE); + return; #endif } @@ -537,7 +533,7 @@ AcpiPsNextParseState ( Status = AE_CTRL_TRANSFER; WalkState->PrevOp = Op; WalkState->MethodCallOp = Op; - WalkState->MethodCallNode = (Op->Value.Arg)->Node; + WalkState->MethodCallNode = (Op->Common.Value.Arg)->Common.Node; /* Will return value (if any) be used by the caller? */ @@ -585,6 +581,11 @@ AcpiPsParseLoop ( ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState); + if (WalkState->DescendingCallback == NULL) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + ParserState = &WalkState->ParserState; WalkState->ArgTypes = 0; @@ -601,8 +602,8 @@ AcpiPsParseLoop ( * was just completed */ if ((ParserState->Scope->ParseScope.Op) && - ((ParserState->Scope->ParseScope.Op->Opcode == AML_IF_OP) || - (ParserState->Scope->ParseScope.Op->Opcode == AML_WHILE_OP)) && + ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) || + (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) && (WalkState->ControlState) && (WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING)) @@ -649,13 +650,13 @@ AcpiPsParseLoop ( */ while ((ParserState->Aml < ParserState->AmlEnd) || (Op)) { + AmlOpStart = ParserState->Aml; if (!Op) { /* Get the next opcode from the AML stream */ - AmlOpStart = ParserState->Aml; - WalkState->AmlOffset = ParserState->Aml - ParserState->AmlStart; - WalkState->Opcode = AcpiPsPeekOpcode (ParserState); + WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, ParserState->AmlStart); + WalkState->Opcode = AcpiPsPeekOpcode (ParserState); /* * First cut to determine what we have found: @@ -704,8 +705,8 @@ AcpiPsParseLoop ( if (WalkState->OpInfo->Flags & AML_NAMED) { - PreOp.Value.Arg = NULL; - PreOp.Opcode = WalkState->Opcode; + PreOp.Common.Value.Arg = NULL; + PreOp.Common.AmlOpcode = WalkState->Opcode; while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME) { @@ -720,44 +721,41 @@ AcpiPsParseLoop ( INCREMENT_ARG_LIST (WalkState->ArgTypes); - if (WalkState->DescendingCallback != NULL) - { - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - WalkState->Op = NULL; + /* + * Find the object. This will either insert the object into + * the namespace or simply look it up + */ + WalkState->Op = NULL; - Status = WalkState->DescendingCallback (WalkState, &Op); - if (ACPI_FAILURE (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", - AcpiFormatException (Status))); - goto CloseThisOp; - } + Status = WalkState->DescendingCallback (WalkState, &Op); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", + AcpiFormatException (Status))); + goto CloseThisOp; + } - if (Op == NULL) - { - continue; - } + if (Op == NULL) + { + continue; + } - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_OK; - goto CloseThisOp; - } + Status = AcpiPsNextParseState (WalkState, Op, Status); + if (Status == AE_CTRL_PENDING) + { + Status = AE_OK; + goto CloseThisOp; + } - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } + if (ACPI_FAILURE (Status)) + { + goto CloseThisOp; } - AcpiPsAppendArg (Op, PreOp.Value.Arg); + AcpiPsAppendArg (Op, PreOp.Common.Value.Arg); AcpiGbl_Depth++; - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { /* * Defer final parsing of an OperationRegion body, @@ -771,8 +769,8 @@ AcpiPsParseLoop ( * * (Length is unknown until parse of the body complete) */ - ((ACPI_PARSE2_OBJECT * ) Op)->Data = AmlOpStart; - ((ACPI_PARSE2_OBJECT * ) Op)->Length = 0; + Op->Named.Data = AmlOpStart; + Op->Named.Length = 0; } } else @@ -792,8 +790,8 @@ AcpiPsParseLoop ( * Backup to beginning of CreateXXXfield declaration * BodyLength is unknown until we parse the body */ - ((ACPI_PARSE2_OBJECT * ) Op)->Data = AmlOpStart; - ((ACPI_PARSE2_OBJECT * ) Op)->Length = 0; + Op->Named.Data = AmlOpStart; + Op->Named.Length = 0; } AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op); @@ -821,13 +819,14 @@ AcpiPsParseLoop ( } } - Op->AmlOffset = WalkState->AmlOffset; + Op->Common.AmlOffset = WalkState->AmlOffset; if (WalkState->OpInfo) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", - Op->Opcode, WalkState->OpInfo->Name, Op, ParserState->Aml, Op->AmlOffset)); + "Opcode %4.4hX [%s] Op %p Aml %p AmlOffset %5.5X\n", + Op->Common.AmlOpcode, WalkState->OpInfo->Name, + Op, ParserState->Aml, Op->Common.AmlOffset)); } } @@ -840,7 +839,7 @@ AcpiPsParseLoop ( { /* Get arguments */ - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ case AML_WORD_OP: /* AML_WORDDATA_ARG */ @@ -867,20 +866,21 @@ AcpiPsParseLoop ( while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && !WalkState->ArgCount) { - WalkState->AmlOffset = ParserState->Aml - ParserState->AmlStart; + WalkState->AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); Arg = AcpiPsGetNextArg (ParserState, GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &WalkState->ArgCount); if (Arg) { - Arg->AmlOffset = WalkState->AmlOffset; + Arg->Common.AmlOffset = WalkState->AmlOffset; AcpiPsAppendArg (Op, Arg); } INCREMENT_ARG_LIST (WalkState->ArgTypes); } - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: @@ -891,9 +891,8 @@ AcpiPsParseLoop ( * because we don't have enough info in the first pass * to parse them correctly. */ - ((ACPI_PARSE2_OBJECT * ) Op)->Data = ParserState->Aml; - ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd - - ParserState->Aml); + Op->Named.Data = ParserState->Aml; + Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml); /* * Skip body of method. For OpRegions, we must continue * parsing because the opregion is not a standalone @@ -907,8 +906,8 @@ AcpiPsParseLoop ( case AML_PACKAGE_OP: case AML_VAR_PACKAGE_OP: - if ((Op->Parent) && - (Op->Parent->Opcode == AML_NAME_OP) && + if ((Op->Common.Parent) && + (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && (WalkState->DescendingCallback != AcpiDsExecBeginOp)) { /* @@ -916,9 +915,8 @@ AcpiPsParseLoop ( * because we don't have enough info in the first pass * to parse them correctly. */ - ((ACPI_PARSE2_OBJECT * ) Op)->Data = AmlOpStart; - ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->PkgEnd - - AmlOpStart); + Op->Named.Data = AmlOpStart; + Op->Named.Length = (UINT32) (ParserState->PkgEnd - AmlOpStart); /* * Skip body */ @@ -934,6 +932,10 @@ AcpiPsParseLoop ( WalkState->ControlState->Control.PackageEnd = ParserState->PkgEnd; } break; + + default: + /* No action for all other opcodes */ + break; } break; } @@ -945,14 +947,18 @@ AcpiPsParseLoop ( { /* There are arguments (complex ones), push Op and prepare for argument */ - AcpiPsPushScope (ParserState, Op, WalkState->ArgTypes, WalkState->ArgCount); + Status = AcpiPsPushScope (ParserState, Op, WalkState->ArgTypes, WalkState->ArgCount); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } Op = NULL; continue; } /* All arguments have been processed -- Op is complete, prepare for next */ - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (WalkState->OpInfo->Flags & AML_NAMED) { if (AcpiGbl_Depth) @@ -960,7 +966,7 @@ AcpiPsParseLoop ( AcpiGbl_Depth--; } - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { /* * Skip parsing of control method or opregion body, @@ -970,8 +976,7 @@ AcpiPsParseLoop ( * Completed parsing an OpRegion declaration, we now * know the length. */ - ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml - - ((ACPI_PARSE2_OBJECT * ) Op)->Data); + Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); } } @@ -983,8 +988,7 @@ AcpiPsParseLoop ( * * BodyLength is unknown until we parse the body */ - ((ACPI_PARSE2_OBJECT * ) Op)->Length = (UINT32) (ParserState->Aml - - ((ACPI_PARSE2_OBJECT * ) Op)->Data); + Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); } /* This op complete, notify the dispatcher */ @@ -992,7 +996,7 @@ AcpiPsParseLoop ( if (WalkState->AscendingCallback != NULL) { WalkState->Op = Op; - WalkState->Opcode = Op->Opcode; + WalkState->Opcode = Op->Common.AmlOpcode; Status = WalkState->AscendingCallback (WalkState); Status = AcpiPsNextParseState (WalkState, Op, Status); @@ -1010,12 +1014,10 @@ CloseThisOp: */ ParserState->Scope->ParseScope.ArgCount--; - /* Close this Op (may result in parse subtree deletion) */ + /* Close this Op (will result in parse subtree deletion) */ - if (AcpiPsCompleteThisOp (WalkState, Op)) - { - Op = NULL; - } + AcpiPsCompleteThisOp (WalkState, Op); + Op = NULL; switch (Status) { @@ -1038,8 +1040,8 @@ CloseThisOp: AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - WalkState->Opcode = Op->Opcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + WalkState->Opcode = Op->Common.AmlOpcode; Status = WalkState->AscendingCallback (WalkState); Status = AcpiPsNextParseState (WalkState, Op, Status); @@ -1055,7 +1057,7 @@ CloseThisOp: /* Pop off scopes until we find the While */ - while (!Op || (Op->Opcode != AML_WHILE_OP)) + while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP)) { AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, &WalkState->ArgCount); } @@ -1063,8 +1065,8 @@ CloseThisOp: /* Close this iteration of the While loop */ WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - WalkState->Opcode = Op->Opcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + WalkState->Opcode = Op->Common.AmlOpcode; Status = WalkState->AscendingCallback (WalkState); Status = AcpiPsNextParseState (WalkState, Op, Status); @@ -1150,8 +1152,8 @@ CloseThisOp: if (WalkState->AscendingCallback != NULL) { WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - WalkState->Opcode = Op->Opcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + WalkState->Opcode = Op->Common.AmlOpcode; Status = WalkState->AscendingCallback (WalkState); Status = AcpiPsNextParseState (WalkState, Op, Status); @@ -1315,7 +1317,14 @@ AcpiPsParseAml ( */ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - AcpiDsTerminateControlMethod (WalkState); + Status = AcpiDsTerminateControlMethod (WalkState); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not terminate control method properly\n")); + Status = AE_OK; + + /* Ignore error and continue */ + } } /* Delete this walk state and all linked control states */ @@ -1339,8 +1348,11 @@ AcpiPsParseAml ( * If the method return value is not used by the parent, * The object is deleted */ - AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ReturnDesc); - WalkState->WalkType |= ACPI_WALK_METHOD_RESTART; + Status = AcpiDsRestartControlMethod (WalkState, PreviousWalkState->ReturnDesc); + if (ACPI_SUCCESS (Status)) + { + WalkState->WalkType |= ACPI_WALK_METHOD_RESTART; + } } else { @@ -1388,7 +1400,7 @@ AcpiPsParseAml ( AcpiUtRemoveReference (EffectiveReturnDesc); AcpiExReleaseAllMutexes (Thread); - AcpiUtDeleteGenericState ((ACPI_GENERIC_STATE *) Thread); + AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread)); AcpiGbl_CurrentWalkList = PrevWalkList; return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index 51e9934..a0cf550 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/rscreate.c @@ -172,11 +172,11 @@ AcpiRsCreateResourceList ( * Pass the ByteStreamBuffer into a module that can calculate * the buffer size needed for the linked list */ - Status = AcpiRsCalculateListLength (ByteStreamStart, ByteStreamBufferLength, + Status = AcpiRsGetListLength (ByteStreamStart, ByteStreamBufferLength, &ListSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", - Status, ListSizeNeeded)); + Status, (UINT32) ListSizeNeeded)); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -200,7 +200,7 @@ AcpiRsCreateResourceList ( } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -253,14 +253,14 @@ AcpiRsCreatePciRoutingTable ( /* * Get the required buffer length */ - Status = AcpiRsCalculatePciRoutingTableLength (PackageObject, + Status = AcpiRsGetPciRoutingTableLength (PackageObject, &BufferSizeNeeded); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", BufferSizeNeeded)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", (UINT32) BufferSizeNeeded)); /* Validate/Allocate/Clear caller buffer */ @@ -277,7 +277,7 @@ AcpiRsCreatePciRoutingTable ( TopObjectList = PackageObject->Package.Elements; NumberOfElements = PackageObject->Package.Count; Buffer = OutputBuffer->Pointer; - UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer; + UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); for (Index = 0; Index < NumberOfElements; Index++) { @@ -288,7 +288,7 @@ AcpiRsCreatePciRoutingTable ( * be zero because we cleared the return buffer earlier */ Buffer += UserPrt->Length; - UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer; + UserPrt = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); /* * Fill in the Length field with the information we have at this point. @@ -311,14 +311,14 @@ AcpiRsCreatePciRoutingTable ( /* * 1) First subobject: Dereference the Address */ - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_INTEGER) { UserPrt->Address = (*SubObjectList)->Integer.Value; } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + AcpiUtGetObjectTypeName (*SubObjectList))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -327,14 +327,14 @@ AcpiRsCreatePciRoutingTable ( */ SubObjectList++; - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_INTEGER) { UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value; } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + AcpiUtGetObjectTypeName (*SubObjectList))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -343,7 +343,7 @@ AcpiRsCreatePciRoutingTable ( */ SubObjectList++; - switch ((*SubObjectList)->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (*SubObjectList)) { case INTERNAL_TYPE_REFERENCE: @@ -362,7 +362,7 @@ AcpiRsCreatePciRoutingTable ( (UINT32) ((UINT8 *) UserPrt->Source - (UINT8 *) OutputBuffer->Pointer); PathBuffer.Pointer = UserPrt->Source; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node, &PathBuffer); + Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer); UserPrt->Length += ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */ break; @@ -393,7 +393,7 @@ AcpiRsCreatePciRoutingTable ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + AcpiUtGetObjectTypeName (*SubObjectList))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -406,14 +406,14 @@ AcpiRsCreatePciRoutingTable ( */ SubObjectList++; - if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) + if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_INTEGER) { UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value; } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n", - AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); + AcpiUtGetObjectTypeName (*SubObjectList))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -423,7 +423,7 @@ AcpiRsCreatePciRoutingTable ( } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } @@ -466,11 +466,11 @@ AcpiRsCreateByteStream ( * Pass the LinkedListBuffer into a module that calculates * the buffer size needed for the byte stream. */ - Status = AcpiRsCalculateByteStreamLength (LinkedListBuffer, + Status = AcpiRsGetByteStreamLength (LinkedListBuffer, &ByteStreamSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n", - ByteStreamSizeNeeded, AcpiFormatException (Status))); + (UINT32) ByteStreamSizeNeeded, AcpiFormatException (Status))); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -494,7 +494,7 @@ AcpiRsCreateByteStream ( } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c index c138c33..e7728ba 100644 --- a/sys/contrib/dev/acpica/tbget.c +++ b/sys/contrib/dev/acpica/tbget.c @@ -126,6 +126,128 @@ /******************************************************************************* * + * FUNCTION: AcpiTbTableOverride + * + * PARAMETERS: *TableInfo - Info for current table + * + * RETURN: None + * + * DESCRIPTION: Attempts override of current table with a new one if provided + * by the host OS. + * + ******************************************************************************/ + +void +AcpiTbTableOverride ( + ACPI_TABLE_DESC *TableInfo) +{ + ACPI_TABLE_HEADER *NewTable; + ACPI_STATUS Status; + ACPI_POINTER Address; + ACPI_TABLE_DESC NewTableInfo; + + + ACPI_FUNCTION_TRACE ("AcpiTbTableOverride"); + + + Status = AcpiOsTableOverride (TableInfo->Pointer, &NewTable); + if (ACPI_FAILURE (Status)) + { + /* Some severe error from the OSL, but we basically ignore it */ + + ACPI_REPORT_ERROR (("Could not override ACPI table, %s\n", + AcpiFormatException (Status))); + return_VOID; + } + + if (!NewTable) + { + /* No table override */ + + return_VOID; + } + + /* + * We have a new table to override the old one. Get a copy of + * the new one. We know that the new table has a logical pointer. + */ + Address.PointerType = ACPI_LOGICAL_POINTER; + Address.Pointer.Logical = NewTable; + + Status = AcpiTbGetTable (&Address, &NewTableInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not copy ACPI table override\n")); + return_VOID; + } + + /* + * Delete the original table + */ + AcpiTbDeleteSingleTable (TableInfo); + + /* Copy the table info */ + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Successful table override [%4.4s]\n", + ((ACPI_TABLE_HEADER *) NewTableInfo.Pointer)->Signature)); + + ACPI_MEMCPY (TableInfo, &NewTableInfo, sizeof (ACPI_TABLE_DESC)); + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbGetTableWithOverride + * + * PARAMETERS: Address - Physical or logical address of table + * *TableInfo - Where the table info is returned + * + * RETURN: Status + * + * DESCRIPTION: Gets and installs the table with possible table override by OS. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiTbGetTableWithOverride ( + ACPI_POINTER *Address, + ACPI_TABLE_DESC *TableInfo) +{ + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE ("AcpiTbGetTableWithOverride"); + + + Status = AcpiTbGetTable (Address, TableInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not get ACPI table, %s\n", + AcpiFormatException (Status))); + return_ACPI_STATUS (Status); + } + + /* + * Attempt override. It either happens or it doesn't, no status + */ + AcpiTbTableOverride (TableInfo); + + /* Install the table */ + + Status = AcpiTbInstallTable (TableInfo); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not install ACPI table, %s\n", + AcpiFormatException (Status))); + } + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiTbGetTablePtr * * PARAMETERS: TableType - one of the defined table types @@ -209,10 +331,8 @@ AcpiTbGetTablePtr ( * * FUNCTION: AcpiTbGetTable * - * PARAMETERS: PhysicalAddress - Physical address of table to retrieve - * *BufferPtr - If BufferPtr is valid, read data from - * buffer rather than searching memory - * *TableInfo - Where the table info is returned + * PARAMETERS: Address - Physical address of table to retrieve + * *TableInfo - Where the table info is returned * * RETURN: Status * @@ -227,7 +347,7 @@ AcpiTbGetTable ( { ACPI_TABLE_HEADER *TableHeader = NULL; ACPI_TABLE_HEADER *FullTable = NULL; - UINT32 Size; + ACPI_SIZE Size; UINT8 Allocation; ACPI_STATUS Status = AE_OK; @@ -259,7 +379,7 @@ AcpiTbGetTable ( /* Copy the entire table (including header) to the local buffer */ - Size = TableHeader->Length; + Size = (ACPI_SIZE) TableHeader->Length; ACPI_MEMCPY (FullTable, TableHeader, Size); /* Save allocation type */ @@ -314,7 +434,6 @@ AcpiTbGetTable ( * FUNCTION: AcpiTbGetAllTables * * PARAMETERS: NumberOfTables - Number of tables to get - * TablePtr - Input buffer pointer, optional * * RETURN: Status * @@ -331,8 +450,7 @@ AcpiTbGetTable ( ACPI_STATUS AcpiTbGetAllTables ( - UINT32 NumberOfTables, - ACPI_TABLE_HEADER *TablePtr) + UINT32 NumberOfTables) { ACPI_STATUS Status = AE_OK; UINT32 Index; @@ -371,7 +489,7 @@ AcpiTbGetAllTables ( /* Recognize and install the table */ - Status = AcpiTbInstallTable (TablePtr, &TableInfo); + Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { /* @@ -379,11 +497,17 @@ AcpiTbGetAllTables ( * error. Just get as many tables as we can, later we will * determine if there are enough tables to continue. */ - AcpiTbUninstallTable (&TableInfo); + (void) AcpiTbUninstallTable (&TableInfo); Status = AE_OK; } } + if (!AcpiGbl_FADT) + { + ACPI_REPORT_ERROR (("No FADT present in R/XSDT\n")); + return_ACPI_STATUS (AE_NO_ACPI_TABLES); + } + /* * Convert the FADT to a common format. This allows earlier revisions of the * table to coexist with newer versions, using common access code. @@ -405,16 +529,18 @@ AcpiTbGetAllTables ( Status = AcpiTbGetTable (&Address, &TableInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not get the FACS\n")); + ACPI_REPORT_ERROR (("Could not get the FACS, %s\n", + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } /* Install the FACS */ - Status = AcpiTbInstallTable (TablePtr, &TableInfo); + Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not install the FACS\n")); + ACPI_REPORT_ERROR (("Could not install the FACS, %s\n", + AcpiFormatException (Status))); return_ACPI_STATUS (Status); } @@ -425,42 +551,31 @@ AcpiTbGetAllTables ( Status = AcpiTbBuildCommonFacs (&TableInfo); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not convert FACS to common internal format\n")); return_ACPI_STATUS (Status); } /* - * Get the DSDT (We know that the FADT is valid now) + * Get/install the DSDT (We know that the FADT is valid now) */ Address.PointerType = AcpiGbl_TableFlags; Address.Pointer.Value = ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt); - if (AcpiGbl_DSDT != NULL) - { - Address.PointerType = ACPI_LOGICAL_POINTER; - Address.Pointer.Value = ACPI_GET_ADDRESS ((NATIVE_UINT)AcpiGbl_DSDT); - } - Status = AcpiTbGetTable (&Address, &TableInfo); + Status = AcpiTbGetTableWithOverride (&Address, &TableInfo); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("Could not get the DSDT\n")); return_ACPI_STATUS (Status); } - /* Install the DSDT */ + /* Set Integer Width (32/64) based upon DSDT revision */ - Status = AcpiTbInstallTable (TablePtr, &TableInfo); - if (ACPI_FAILURE (Status)) - { - ACPI_REPORT_ERROR (("Could not install the DSDT\n")); - return_ACPI_STATUS (Status); - } + AcpiUtSetIntegerWidth (AcpiGbl_DSDT->Revision); /* Dump the entire DSDT */ ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, - "Hex dump of entire DSDT, size %d (0x%X)\n", - AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length)); + "Hex dump of entire DSDT, size %d (0x%X), Integer width = %d\n", + AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length, AcpiGbl_IntegerBitWidth)); ACPI_DUMP_BUFFER ((UINT8 *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length); /* Always delete the RSDP mapping, we are done with it */ @@ -549,7 +664,7 @@ AcpiTbVerifyRsdp ( /* The RSDP supplied is OK */ - TableInfo.Pointer = (ACPI_TABLE_HEADER *) Rsdp; + TableInfo.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp); TableInfo.Length = sizeof (RSDP_DESCRIPTOR); TableInfo.Allocation = ACPI_MEM_MAPPED; TableInfo.BasePointer = Rsdp; @@ -564,7 +679,7 @@ AcpiTbVerifyRsdp ( /* Save the RSDP in a global for easy access */ - AcpiGbl_RSDP = (RSDP_DESCRIPTOR *) TableInfo.Pointer; + AcpiGbl_RSDP = ACPI_CAST_PTR (RSDP_DESCRIPTOR, TableInfo.Pointer); return_ACPI_STATUS (Status); @@ -633,7 +748,7 @@ ACPI_STATUS AcpiTbValidateRsdt ( ACPI_TABLE_HEADER *TablePtr) { - UINT32 NoMatch; + int NoMatch; ACPI_FUNCTION_NAME ("TbValidateRsdt"); @@ -663,8 +778,9 @@ AcpiTbValidateRsdt ( ACPI_DUMP_BUFFER (AcpiGbl_RSDP, 20); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, - "RSDT/XSDT signature at %X is invalid\n", - AcpiGbl_RSDP->RsdtPhysicalAddress)); + "RSDT/XSDT signature at %X (%p) is invalid\n", + AcpiGbl_RSDP->RsdtPhysicalAddress, + (void *) (NATIVE_UINT) AcpiGbl_RSDP->RsdtPhysicalAddress)); return (AE_BAD_SIGNATURE); } @@ -691,7 +807,7 @@ ACPI_STATUS AcpiTbGetTablePointer ( ACPI_POINTER *Address, UINT32 Flags, - UINT32 *Size, + ACPI_SIZE *Size, ACPI_TABLE_HEADER **TablePtr) { ACPI_STATUS Status = AE_OK; @@ -720,6 +836,9 @@ AcpiTbGetTablePointer ( *TablePtr = Address->Pointer.Logical; *Size = 0; break; + + default: + return (AE_BAD_PARAMETER); } } else @@ -737,6 +856,9 @@ AcpiTbGetTablePointer ( Status = AE_BAD_PARAMETER; break; + + default: + return (AE_BAD_PARAMETER); } } @@ -768,27 +890,23 @@ AcpiTbGetTableRsdt ( ACPI_FUNCTION_TRACE ("TbGetTableRsdt"); - /* - * Get the RSDT from the RSDP - */ - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", - AcpiGbl_RSDP, - ACPI_HIDWORD (AcpiGbl_RSDP->RsdtPhysicalAddress), - ACPI_LODWORD (AcpiGbl_RSDP->RsdtPhysicalAddress))); - - - /* Get the RSDT/XSDT */ + /* Get the RSDT/XSDT from the RSDP */ AcpiTbGetRsdtAddress (&Address); Status = AcpiTbGetTable (&Address, &TableInfo); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the RSDT, %s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not get the R/XSDT, %s\n", AcpiFormatException (Status))); return_ACPI_STATUS (Status); } + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", + AcpiGbl_RSDP, + ACPI_HIDWORD (Address.Pointer.Value), + ACPI_LODWORD (Address.Pointer.Value))); + /* Check the RSDT or XSDT signature */ Status = AcpiTbValidateRsdt (TableInfo.Pointer); diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index ecfd394..95d10f0 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utglobal.c @@ -118,11 +118,7 @@ #define DEFINE_ACPI_GLOBALS #include "acpi.h" -#include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" - #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utglobal") @@ -245,7 +241,6 @@ UINT32 AcpiGbl_NestingLevel = 0; BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; BOOLEAN AcpiGbl_MethodExecuting = FALSE; NATIVE_CHAR *AcpiGbl_DbDisasmIndent = "...."; -ACPI_TABLE_HEADER *AcpiGbl_DbTablePtr = NULL; /* System flags */ @@ -282,15 +277,15 @@ const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES] = { const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { - {"_GPE", INTERNAL_TYPE_DEF_ANY}, - {"_PR_", INTERNAL_TYPE_DEF_ANY}, - {"_SB_", ACPI_TYPE_DEVICE}, - {"_SI_", INTERNAL_TYPE_DEF_ANY}, - {"_TZ_", INTERNAL_TYPE_DEF_ANY}, + {"_GPE", INTERNAL_TYPE_DEF_ANY, NULL}, + {"_PR_", INTERNAL_TYPE_DEF_ANY, NULL}, + {"_SB_", ACPI_TYPE_DEVICE, NULL}, + {"_SI_", INTERNAL_TYPE_DEF_ANY, NULL}, + {"_TZ_", INTERNAL_TYPE_DEF_ANY, NULL}, {"_REV", ACPI_TYPE_INTEGER, "2"}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, "0"}, - {NULL, ACPI_TYPE_ANY} /* Table terminator */ + {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */ }; @@ -345,9 +340,9 @@ const UINT8 AcpiGbl_NsProperties[] = /* Hex to ASCII conversion table */ -const NATIVE_CHAR AcpiGbl_HexToAscii[] = +static const NATIVE_CHAR AcpiGbl_HexToAscii[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; + '8','9','A','B','C','D','E','F'}; /***************************************************************************** * @@ -363,7 +358,7 @@ const NATIVE_CHAR AcpiGbl_HexToAscii[] = * ****************************************************************************/ -UINT8 +char AcpiUtHexToAsciiChar ( ACPI_INTEGER Integer, UINT32 Position) @@ -463,7 +458,7 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] = /* Region type decoding */ -const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = +static const NATIVE_CHAR *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = { "SystemMemory", "SystemIO", @@ -509,7 +504,7 @@ AcpiUtGetRegionName ( /* Event type decoding */ -const NATIVE_CHAR *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = +static const NATIVE_CHAR *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] = { "PM_Timer", "GlobalLock", @@ -533,7 +528,7 @@ AcpiUtGetEventName ( } -#ifdef ACPI_DEBUG +#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) /* * Strings and procedures used for debug only @@ -566,6 +561,8 @@ AcpiUtGetMutexName ( return (AcpiGbl_MutexNames[MutexId]); } +#endif + /***************************************************************************** * @@ -647,16 +644,35 @@ AcpiUtGetTypeName ( } +NATIVE_CHAR * +AcpiUtGetObjectTypeName ( + ACPI_OPERAND_OBJECT *ObjDesc) +{ + + if (!ObjDesc) + { + return ("[NULL Object Descriptor]"); + } + + return (AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc))); +} + + +/* Various strings for future use */ + +#if 0 +#include "amlcode.h" + /* Data used in keeping track of fields */ -const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = +static const NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = { "skip", "?access?" }; /* FE = Field Element */ -const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = +static const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = { "Error", "MTR", @@ -670,7 +686,7 @@ const NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = /* Access type decoding */ -const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = +static const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = { "AnyAcc", "ByteAcc", @@ -683,14 +699,13 @@ const NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = /* Update rule decoding */ -const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = +static const NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = { "Preserve", "WriteAsOnes", "WriteAsZeros" }; - -#endif +#endif /* Future use */ /***************************************************************************** @@ -772,6 +787,9 @@ AcpiUtAllocateOwnerId ( AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID; } break; + + default: + break; } (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES); @@ -804,15 +822,15 @@ AcpiUtInitGlobals ( ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS); AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Next), NULL); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE2_OBJECT *) NULL)->Next), NULL); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL); AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL); AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL); AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE); AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJECT); - AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE2_OBJECT); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON); + AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED); AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT); AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE); @@ -855,6 +873,7 @@ AcpiUtInitGlobals ( AcpiGbl_SysNotify.Handler = NULL; AcpiGbl_DrvNotify.Handler = NULL; + AcpiGbl_InitHandler = NULL; /* Global "typed" ACPI table pointers */ @@ -904,7 +923,7 @@ AcpiUtInitGlobals ( #ifdef ACPI_DEBUG - AcpiGbl_LowestStackPointer = ACPI_UINT32_MAX; + AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX; #endif return_VOID; |