diff options
116 files changed, 4522 insertions, 3394 deletions
diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h index 975d4d4..543289b 100644 --- a/sys/contrib/dev/acpica/acdebug.h +++ b/sys/contrib/dev/acpica/acdebug.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdebug.h - ACPI/AML debugger - * $Revision: 58 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -154,7 +154,7 @@ typedef struct ArgumentInfo * dbapi - external debugger interfaces */ -int +ACPI_STATUS AcpiDbInitialize ( void); @@ -173,7 +173,6 @@ AcpiDbSingleStep ( * dbcmds - debug commands and output routines */ - void AcpiDbDisplayTableInfo ( NATIVE_CHAR *TableArg); @@ -244,6 +243,39 @@ void AcpiDbDisplayResources ( NATIVE_CHAR *ObjectArg); +void +AcpiDbCheckIntegrity ( + void); + +ACPI_STATUS +AcpiDbIntegrityWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDbWalkAndMatchName ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDbWalkForReferences ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +ACPI_STATUS +AcpiDbWalkForSpecificObjects ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + + /* * dbdisasm - AML disassembler @@ -272,12 +304,20 @@ void AcpiDbDecodeInternalObject ( ACPI_OPERAND_OBJECT *ObjDesc); +UINT32 +AcpiDbBlockType ( + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiPsDisplayObjectPathname ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + /* * dbdisply - debug display commands */ - void AcpiDbDisplayMethodInfo ( ACPI_PARSE_OBJECT *Op); @@ -322,6 +362,14 @@ AcpiDbDisplayArgumentObject ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); +void +AcpiDbDumpParserDescriptor ( + ACPI_PARSE_OBJECT *Op); + +void * +AcpiDbGetPointer ( + void *Target); + /* * dbexec - debugger control method execution @@ -339,6 +387,23 @@ AcpiDbCreateExecutionThreads ( NATIVE_CHAR *NumLoopsArg, NATIVE_CHAR *MethodNameArg); +ACPI_STATUS +AcpiDbExecuteMethod ( + ACPI_DB_METHOD_INFO *Info, + ACPI_BUFFER *ReturnObj); + +void +AcpiDbExecuteSetup ( + ACPI_DB_METHOD_INFO *Info); + +UINT32 +AcpiDbGetOutstandingAllocations ( + void); + +void ACPI_SYSTEM_XFACE +AcpiDbMethodThread ( + void *Context); + /* * dbfileio - Debugger file I/O commands @@ -349,6 +414,9 @@ AcpiDbMatchArgument ( NATIVE_CHAR *UserArgument, ARGUMENT_INFO *Arguments); +ACPI_STATUS +AeLocalLoadTable ( + ACPI_TABLE_HEADER *TablePtr); void AcpiDbCloseDebugFile ( @@ -401,6 +469,27 @@ AcpiDbUserCommands ( NATIVE_CHAR Prompt, ACPI_PARSE_OBJECT *Op); +void +AcpiDbDisplayHelp ( + NATIVE_CHAR *HelpType); + +NATIVE_CHAR * +AcpiDbGetNextToken ( + NATIVE_CHAR *String, + NATIVE_CHAR **Next); + +UINT32 +AcpiDbGetLine ( + NATIVE_CHAR *InputBuffer); + +UINT32 +AcpiDbMatchCommand ( + NATIVE_CHAR *UserCommand); + +void +AcpiDbSingleThread ( + void); + /* * dbstats - Generation and display of ACPI table statistics @@ -416,6 +505,21 @@ ACPI_STATUS AcpiDbDisplayStatistics ( NATIVE_CHAR *TypeArg); +ACPI_STATUS +AcpiDbClassifyOneObject ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); + +void +AcpiDbCountNamespaceObjects ( + void); + +void +AcpiDbEnumerateObject ( + ACPI_OPERAND_OBJECT *ObjDesc); + /* * dbutils - AML debugger utilities diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h index d76b9f6..453bbc9 100644 --- a/sys/contrib/dev/acpica/acdispat.h +++ b/sys/contrib/dev/acpica/acdispat.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acdispat.h - dispatcher (parser to interpreter interface) - * $Revision: 52 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -149,6 +149,13 @@ AcpiDsObjStackPopObject ( /* dsopcode - support for late evaluation */ ACPI_STATUS +AcpiDsExecuteArguments ( + ACPI_NAMESPACE_NODE *Node, + ACPI_NAMESPACE_NODE *ScopeNode, + UINT32 AmlLength, + UINT8 *AmlStart); + +ACPI_STATUS AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT *ObjDesc); @@ -164,6 +171,35 @@ ACPI_STATUS AcpiDsGetPackageArguments ( ACPI_OPERAND_OBJECT *ObjDesc); +ACPI_STATUS +AcpiDsInitBufferField ( + UINT16 AmlOpcode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT *BufferDesc, + ACPI_OPERAND_OBJECT *OffsetDesc, + ACPI_OPERAND_OBJECT *LengthDesc, + ACPI_OPERAND_OBJECT *ResultDesc); + +ACPI_STATUS +AcpiDsEvalBufferFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsEvalRegionOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op); + +ACPI_STATUS +AcpiDsEvalDataObjectOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + ACPI_OPERAND_OBJECT *ObjDesc); + +ACPI_STATUS +AcpiDsInitializeRegion ( + ACPI_HANDLE ObjHandle); + /* dsctrl - Parser/Interpreter interface, control stack routines */ @@ -200,6 +236,12 @@ AcpiDsExecEndOp ( /* dsfield - Parser/Interpreter interface for AML fields */ ACPI_STATUS +AcpiDsGetFieldNames ( + ACPI_CREATE_FIELD_INFO *Info, + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Arg); + +ACPI_STATUS AcpiDsCreateField ( ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *RegionNode, @@ -271,7 +313,7 @@ AcpiDsMethodDataGetEntry ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT ***Node); -ACPI_STATUS +void AcpiDsMethodDataDeleteAll ( ACPI_WALK_STATE *WalkState); @@ -292,7 +334,7 @@ AcpiDsMethodDataGetValue ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc); -ACPI_STATUS +void AcpiDsMethodDataDeleteValue ( UINT16 Opcode, UINT32 Index, @@ -311,7 +353,7 @@ AcpiDsMethodDataGetNode ( ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE **Node); -ACPI_STATUS +void AcpiDsMethodDataInit ( ACPI_WALK_STATE *WalkState); @@ -399,29 +441,6 @@ AcpiDsCreateNode ( ACPI_PARSE_OBJECT *Op); -/* dsregn - Parser/Interpreter interface - Op Region parsing */ - -ACPI_STATUS -AcpiDsEvalBufferFieldOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsEvalRegionOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -AcpiDsEvalDataObjectOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op, - ACPI_OPERAND_OBJECT *ObjDesc); - -ACPI_STATUS -AcpiDsInitializeRegion ( - ACPI_HANDLE ObjHandle); - - /* dsutils - Parser/Interpreter interface utility routines */ BOOLEAN diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h index 0646c3b..04945ef 100644 --- a/sys/contrib/dev/acpica/acenv.h +++ b/sys/contrib/dev/acpica/acenv.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acenv.h - Generation environment specific items - * $Revision: 86 $ + * $Revision: 95 $ * *****************************************************************************/ @@ -142,22 +142,11 @@ #ifdef _ACPI_ASL_COMPILER #define ACPI_DEBUG #define ACPI_APPLICATION -#define ENABLE_DEBUGGER +/* #define ENABLE_DEBUGGER */ #define ACPI_USE_SYSTEM_CLIBRARY #endif /* - * Memory allocation tracking. Used only if - * 1) This is the debug version - * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) - */ -#ifdef ACPI_DEBUG -#ifndef _IA16 -#define ACPI_DBG_TRACK_ALLOCATIONS -#endif -#endif - -/* * Environment configuration. The purpose of this file is to interface to the * local generation environment. * @@ -202,15 +191,15 @@ #elif defined(_AED_EFI) #include "acefi.h" -#elif defined(MSDOS) -#include "acdos16.h" - #elif defined(WIN32) #include "acwin.h" #elif defined(WIN64) #include "acwin64.h" +#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */ +#include "acdos16.h" + #elif defined(__FreeBSD__) #include "acfreebsd.h" @@ -226,6 +215,10 @@ #define ACPI_USE_STANDARD_HEADERS +#define COMPILER_DEPENDENT_INT64 long long +#define COMPILER_DEPENDENT_UINT64 unsigned long long + + /* Name of host operating system (returned by the _OS_ namespace object) */ #define ACPI_OS_NAME "Intel ACPI/CA Core Subsystem" @@ -238,8 +231,39 @@ #endif +/* + * Memory allocation tracking. Used only if + * 1) This is the debug version + * 2) This is NOT a 16-bit version of the code (not enough real-mode memory) + */ +#ifdef ACPI_DEBUG +#if ACPI_MACHINE_WIDTH != 16 +#define ACPI_DBG_TRACK_ALLOCATIONS +#endif +#endif + /*! [End] no source code translation !*/ + +/* + * 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 + +#ifdef ACPI_APPLICATION +#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED + +#else +#define DEBUGGER_THREADING DEBUGGER_MULTI_THREADED +#endif + + /****************************************************************************** * * C library configuration @@ -269,20 +293,23 @@ */ #define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) -#define ACPI_STRUPR(s) AcpiUtStrupr ((s)) -#define ACPI_STRLEN(s) (UINT32) strlen((s)) -#define ACPI_STRCPY(d,s) strcpy((d), (s)) -#define ACPI_STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n)) -#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n)) +#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) +#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) +#define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) +#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRNCMP(d,s,n) strncmp((d), (s), (ACPI_SIZE)(n)) #define ACPI_STRCMP(d,s) strcmp((d), (s)) -#define ACPI_STRCAT(d,s) strcat((d), (s)) -#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (NATIVE_INT)(n)) -#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (NATIVE_INT)(n)) -#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (NATIVE_INT)(n)) -#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (NATIVE_INT)(n)) +#define ACPI_STRCAT(d,s) (void) strcat((d), (s)) +#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) #define ACPI_TOUPPER toupper #define ACPI_TOLOWER tolower #define ACPI_IS_XDIGIT isxdigit +#define ACPI_IS_DIGIT isdigit +#define ACPI_IS_SPACE isspace +#define ACPI_IS_UPPER isupper /****************************************************************************** * @@ -325,17 +352,17 @@ typedef char *va_list; #define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) -#define ACPI_STRUPR(s) AcpiUtStrupr ((s)) -#define ACPI_STRLEN(s) AcpiUtStrlen ((s)) -#define ACPI_STRCPY(d,s) AcpiUtStrcpy ((d), (s)) -#define ACPI_STRNCPY(d,s,n) AcpiUtStrncpy ((d), (s), (n)) -#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (n)) +#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) +#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) +#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) +#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n)) #define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) -#define ACPI_STRCAT(d,s) AcpiUtStrcat ((d), (s)) -#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (n)) -#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s),(n)) -#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (n)) -#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (n)) +#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) +#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) #define ACPI_TOUPPER AcpiUtToUpper #define ACPI_TOLOWER AcpiUtToLower diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h index bd87e14..db6f709 100644 --- a/sys/contrib/dev/acpica/acevents.h +++ b/sys/contrib/dev/acpica/acevents.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acevents.h - Event subcomponent prototypes and defines - * $Revision: 76 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -156,7 +156,7 @@ ACPI_STATUS AcpiEvAcquireGlobalLock( UINT32 Timeout); -void +ACPI_STATUS AcpiEvReleaseGlobalLock( void); @@ -207,7 +207,7 @@ AcpiEvGpeDetect ( */ ACPI_STATUS -AcpiEvInstallDefaultAddressSpaceHandlers ( +AcpiEvInitAddressSpaces ( void); ACPI_STATUS @@ -216,7 +216,7 @@ AcpiEvAddressSpaceDispatch ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value); + void *Value); ACPI_STATUS AcpiEvAddrHandlerHelper ( @@ -225,17 +225,17 @@ AcpiEvAddrHandlerHelper ( void *Context, void **ReturnValue); -void -AcpiEvDisassociateRegionFromHandler( - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsIsLocked); - ACPI_STATUS -AcpiEvAssociateRegionAndHandler ( +AcpiEvAttachRegion ( ACPI_OPERAND_OBJECT *HandlerObj, ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked); +void +AcpiEvDetachRegion ( + ACPI_OPERAND_OBJECT *RegionObj, + BOOLEAN AcpiNsIsLocked); + /* * Evregini - Region initialization and setup diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h index 15d3860..a2ccb42 100644 --- a/sys/contrib/dev/acpica/acexcep.h +++ b/sys/contrib/dev/acpica/acexcep.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acexcep.h - Exception codes returned by the ACPI subsystem - * $Revision: 59 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -193,8 +193,9 @@ #define AE_BAD_CHECKSUM (ACPI_STATUS) (0x0003 | AE_CODE_ACPI_TABLES) #define AE_BAD_VALUE (ACPI_STATUS) (0x0004 | AE_CODE_ACPI_TABLES) #define AE_TABLE_NOT_SUPPORTED (ACPI_STATUS) (0x0005 | AE_CODE_ACPI_TABLES) +#define AE_INVALID_TABLE_LENGTH (ACPI_STATUS) (0x0006 | AE_CODE_ACPI_TABLES) -#define AE_CODE_TBL_MAX 0x0005 +#define AE_CODE_TBL_MAX 0x0006 /* @@ -229,8 +230,11 @@ #define AE_AML_INVALID_INDEX (ACPI_STATUS) (0x001A | AE_CODE_AML) #define AE_AML_REGISTER_LIMIT (ACPI_STATUS) (0x001B | AE_CODE_AML) #define AE_AML_NO_WHILE (ACPI_STATUS) (0x001C | AE_CODE_AML) +#define AE_AML_ALIGNMENT (ACPI_STATUS) (0x001D | AE_CODE_AML) +#define AE_AML_NO_RESOURCE_END_TAG (ACPI_STATUS) (0x001E | AE_CODE_AML) +#define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x001C +#define AE_CODE_AML_MAX 0x001F /* * Internal exceptions used for control @@ -306,7 +310,8 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Tbl[] = "AE_BAD_HEADER", "AE_BAD_CHECKSUM", "AE_BAD_VALUE", - "AE_TABLE_NOT_SUPPORTED" + "AE_TABLE_NOT_SUPPORTED", + "AE_INVALID_TABLE_LENGTH" }; NATIVE_CHAR const *AcpiGbl_ExceptionNames_Aml[] = @@ -338,7 +343,10 @@ NATIVE_CHAR const *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_INVALID_RESOURCE_TYPE", "AE_AML_INVALID_INDEX", "AE_AML_REGISTER_LIMIT", - "AE_AML_NO_WHILE" + "AE_AML_NO_WHILE", + "AE_AML_ALIGNMENT", + "AE_AML_NO_RESOURCE_END_TAG", + "AE_AML_BAD_RESOURCE_VALUE" }; NATIVE_CHAR const *AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h index 7465b7c..c4cf5e4 100644 --- a/sys/contrib/dev/acpica/acglobal.h +++ b/sys/contrib/dev/acpica/acglobal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acglobal.h - Declarations for global variables - * $Revision: 121 $ + * $Revision: 125 $ * *****************************************************************************/ @@ -171,6 +171,14 @@ ACPI_EXTERN FACS_DESCRIPTOR *AcpiGbl_FACS; ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS; /* + * Handle both ACPI 1.0 and ACPI 2.0 Integer widths + * If we are running a method that exists in a 32-bit ACPI table. + * Use only 32 bits of the Integer for conversion. + */ +ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; +ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; + +/* * Since there may be multiple SSDTs and PSDTS, a single pointer is not * sufficient; Therefore, there isn't one! */ @@ -200,6 +208,7 @@ ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_AcpiMutexInfo [NUM_MTX]; ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS]; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify; +ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore; @@ -222,6 +231,7 @@ extern BOOLEAN AcpiGbl_Shutdown; extern UINT32 AcpiGbl_StartupFlags; extern const UINT8 AcpiGbl_DecodeTo8bit[8]; extern const NATIVE_CHAR *AcpiGbl_DbSleepStates[ACPI_NUM_SLEEP_STATES]; +extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; /***************************************************************************** @@ -277,7 +287,7 @@ ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot; * ****************************************************************************/ -ACPI_EXTERN ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; +extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA; ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; @@ -320,13 +330,11 @@ ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; #ifdef ENABLE_DEBUGGER -ACPI_EXTERN BOOLEAN AcpiGbl_MethodExecuting; -ACPI_EXTERN BOOLEAN AcpiGbl_DbTerminateThreads; +extern BOOLEAN AcpiGbl_MethodExecuting; +extern BOOLEAN AcpiGbl_DbTerminateThreads; ACPI_EXTERN int optind; ACPI_EXTERN NATIVE_CHAR *optarg; -ACPI_EXTERN UINT8 *AmlStart; -ACPI_EXTERN UINT32 AmlLength; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h index 8efcfd5..4411ea2 100644 --- a/sys/contrib/dev/acpica/achware.h +++ b/sys/contrib/dev/acpica/achware.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: achware.h -- hardware specific interfaces - * $Revision: 58 $ + * $Revision: 60 $ * *****************************************************************************/ @@ -155,49 +155,44 @@ ACPI_BIT_REGISTER_INFO * AcpiHwGetBitRegisterInfo ( UINT32 RegisterId); -UINT32 -AcpiHwBitRegisterRead ( - UINT32 RegisterId, - UINT32 Flags); - -UINT32 -AcpiHwBitRegisterWrite ( - UINT32 RegisterId, - UINT32 Value, - UINT32 Flags); - -UINT32 +ACPI_STATUS AcpiHwRegisterRead ( BOOLEAN UseLock, - UINT32 RegisterId); + UINT32 RegisterId, + UINT32 *ReturnValue); -void +ACPI_STATUS AcpiHwRegisterWrite ( BOOLEAN UseLock, UINT32 RegisterId, UINT32 Value); -UINT32 +ACPI_STATUS AcpiHwLowLevelRead ( UINT32 Width, + UINT32 *Value, ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset); -void +ACPI_STATUS AcpiHwLowLevelWrite ( UINT32 Width, UINT32 Value, ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset); -void +ACPI_STATUS AcpiHwClearAcpiStatus ( void); /* GPE support */ -void +UINT8 +AcpiHwGetGpeBitMask ( + UINT32 GpeNumber); + +ACPI_STATUS AcpiHwEnableGpe ( UINT32 GpeNumber); @@ -205,7 +200,7 @@ void AcpiHwEnableGpeForWakeup ( UINT32 GpeNumber); -void +ACPI_STATUS AcpiHwDisableGpe ( UINT32 GpeNumber); @@ -213,33 +208,24 @@ void AcpiHwDisableGpeForWakeup ( UINT32 GpeNumber); -void +ACPI_STATUS AcpiHwClearGpe ( UINT32 GpeNumber); -void +ACPI_STATUS AcpiHwGetGpeStatus ( UINT32 GpeNumber, ACPI_EVENT_STATUS *EventStatus); -void +ACPI_STATUS AcpiHwDisableNonWakeupGpes ( void); -void +ACPI_STATUS AcpiHwEnableNonWakeupGpes ( void); -/* Sleep Prototypes */ - -ACPI_STATUS -AcpiHwGetSleepTypeData ( - UINT8 SleepState, - UINT8 *Slp_TypA, - UINT8 *Slp_TypB); - - /* ACPI Timer prototypes */ ACPI_STATUS diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index 4a7df65..9593aef 100644 --- a/sys/contrib/dev/acpica/acinterp.h +++ b/sys/contrib/dev/acpica/acinterp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acinterp.h - Interpreter subcomponent prototypes and defines - * $Revision: 133 $ + * $Revision: 138 $ * *****************************************************************************/ @@ -127,6 +127,11 @@ AcpiExResolveOperands ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState); +ACPI_STATUS +AcpiExCheckObjectType ( + ACPI_OBJECT_TYPE TypeNeeded, + ACPI_OBJECT_TYPE ThisType, + void *Object); /* * exxface - External interpreter interfaces @@ -174,6 +179,11 @@ AcpiExConvertToTargetType ( ACPI_OPERAND_OBJECT **ResultDesc, ACPI_WALK_STATE *WalkState); +UINT32 +AcpiExConvertToAscii ( + ACPI_INTEGER Integer, + UINT32 Base, + UINT8 *String); /* * exfield - ACPI AML (p-code) execution - field manipulation @@ -263,6 +273,12 @@ ACPI_STATUS AcpiExOpcode_6A_0T_1R ( ACPI_WALK_STATE *WalkState); +BOOLEAN +AcpiExDoMatch ( + UINT32 MatchOp, + ACPI_INTEGER PackageValue, + ACPI_INTEGER MatchValue); + ACPI_STATUS AcpiExGetObjectReference ( ACPI_OPERAND_OBJECT *ObjDesc, @@ -374,7 +390,7 @@ AcpiExReleaseMutex ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); -ACPI_STATUS +void AcpiExReleaseAllMutexes ( ACPI_THREAD_STATE *Thread); @@ -514,13 +530,6 @@ AcpiExResolveObjectToValue ( */ void -AcpiExShowHexValue ( - UINT32 ByteCount, - UINT8 *AmlStart, - UINT32 LeadSpace); - - -ACPI_STATUS AcpiExDumpOperand ( ACPI_OPERAND_OBJECT *EntryDesc); @@ -539,12 +548,31 @@ AcpiExDumpObjectDescriptor ( ACPI_OPERAND_OBJECT *Object, UINT32 Flags); - void AcpiExDumpNode ( ACPI_NAMESPACE_NODE *Node, UINT32 Flags); +void +AcpiExOutString ( + char *Title, + char *Value); + +void +AcpiExOutPointer ( + char *Title, + void *Value); + +void +AcpiExOutInteger ( + char *Title, + UINT32 Value); + +void +AcpiExOutAddress ( + char *Title, + ACPI_PHYSICAL_ADDRESS Value); + /* * exnames - interpreter/scanner name load/execute @@ -666,8 +694,7 @@ AcpiExExitInterpreter ( void AcpiExTruncateFor32bitTable ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState); + ACPI_OPERAND_OBJECT *ObjDesc); BOOLEAN AcpiExValidateObjectType ( @@ -677,7 +704,7 @@ BOOLEAN AcpiExAcquireGlobalLock ( UINT32 Rule); -ACPI_STATUS +void AcpiExReleaseGlobalLock ( BOOLEAN Locked); @@ -686,12 +713,12 @@ AcpiExDigitsNeeded ( ACPI_INTEGER Value, UINT32 Base); -ACPI_STATUS +void AcpiExEisaIdToString ( UINT32 NumericId, NATIVE_CHAR *OutString); -ACPI_STATUS +void AcpiExUnsignedIntegerToString ( ACPI_INTEGER Value, NATIVE_CHAR *OutString); diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h index ad3fad5..5a4c732 100644 --- a/sys/contrib/dev/acpica/aclocal.h +++ b/sys/contrib/dev/acpica/aclocal.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: aclocal.h - Internal data types used across the ACPI subsystem - * $Revision: 162 $ + * $Revision: 167 $ * *****************************************************************************/ @@ -128,23 +128,9 @@ typedef UINT32 ACPI_MUTEX_HANDLE; #define ACPI_LOGICAL_ADDRESSING 0x00 #define ACPI_PHYSICAL_ADDRESSING 0x01 -/* Object descriptor types */ +/* Total number of aml opcodes defined */ -#define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */ -#define ACPI_DESC_TYPE_STATE 0x20 -#define ACPI_DESC_TYPE_STATE_UPDATE 0x21 -#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22 -#define ACPI_DESC_TYPE_STATE_CONTROL 0x23 -#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24 -#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25 -#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26 -#define ACPI_DESC_TYPE_STATE_RESULT 0x27 -#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28 -#define ACPI_DESC_TYPE_STATE_THREAD 0x29 -#define ACPI_DESC_TYPE_WALK 0x44 -#define ACPI_DESC_TYPE_PARSER 0x66 -#define ACPI_DESC_TYPE_INTERNAL 0x88 -#define ACPI_DESC_TYPE_NAMED 0xAA +#define AML_NUM_OPCODES 0x7E @@ -326,7 +312,7 @@ typedef struct AcpiTableDesc UINT8 *AmlStart; UINT64 PhysicalAddress; UINT32 AmlLength; - UINT32 Length; + ACPI_SIZE Length; UINT32 Count; ACPI_OWNER_ID TableId; UINT8 Type; @@ -503,8 +489,8 @@ typedef struct /* Forward declarations */ struct acpi_walk_state; -struct acpi_parse_obj; struct acpi_obj_mutex; +union acpi_parse_obj; #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ @@ -555,7 +541,7 @@ typedef struct acpi_pkg_state typedef struct acpi_control_state { ACPI_STATE_COMMON - struct acpi_parse_obj *PredicateOp; + union acpi_parse_obj *PredicateOp; UINT8 *AmlPredicateStart; /* Start of if/while predicate */ UINT8 *PackageEnd; /* End of if/while block */ UINT16 Opcode; @@ -577,7 +563,7 @@ typedef struct acpi_scope_state typedef struct acpi_pscope_state { ACPI_STATE_COMMON - struct acpi_parse_obj *Op; /* current op being parsed */ + union acpi_parse_obj *Op; /* current op being parsed */ UINT8 *ArgEnd; /* current argument end */ UINT8 *PkgEnd; /* current package end */ UINT32 ArgList; /* next argument to parse */ @@ -618,7 +604,7 @@ typedef struct acpi_result_values typedef ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) ( struct acpi_walk_state *WalkState, - struct acpi_parse_obj **OutOp); + union acpi_parse_obj **OutOp); typedef ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( @@ -701,7 +687,7 @@ typedef union acpi_parse_val NATIVE_CHAR *String; /* NULL terminated string */ UINT8 *Buffer; /* buffer or string */ NATIVE_CHAR *Name; /* NULL terminated string */ - struct acpi_parse_obj *Arg; /* arguments and contained ops */ + union acpi_parse_obj *Arg; /* arguments and contained ops */ } ACPI_PARSE_VALUE; @@ -709,12 +695,12 @@ typedef union acpi_parse_val #define ACPI_PARSE_COMMON \ UINT8 DataType; /* To differentiate various internal objs */\ UINT8 Flags; /* Type of Op */\ - UINT16 Opcode; /* AML opcode */\ + UINT16 AmlOpcode; /* AML opcode */\ UINT32 AmlOffset; /* offset of declaration in AML */\ - struct acpi_parse_obj *Parent; /* parent op */\ - struct acpi_parse_obj *Next; /* next op */\ + union acpi_parse_obj *Parent; /* parent op */\ + union acpi_parse_obj *Next; /* next op */\ ACPI_DEBUG_ONLY_MEMBERS (\ - NATIVE_CHAR OpName[16]) /* op name (debug only) */\ + NATIVE_CHAR AmlOpName[16]) /* op name (debug only) */\ /* NON-DEBUG members below: */\ ACPI_NAMESPACE_NODE *Node; /* for use by interpreter */\ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\ @@ -723,24 +709,69 @@ typedef union acpi_parse_val /* * generic operation (eg. If, While, Store) */ -typedef struct acpi_parse_obj +typedef struct acpi_parseobj_common { ACPI_PARSE_COMMON -} ACPI_PARSE_OBJECT; +} ACPI_PARSE_OBJ_COMMON; /* * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions), * and bytelists. */ -typedef struct acpi_parse2_obj +typedef struct acpi_parseobj_named { ACPI_PARSE_COMMON UINT8 *Data; /* AML body or bytelist data */ UINT32 Length; /* AML length */ UINT32 Name; /* 4-byte name or zero if no name */ -} ACPI_PARSE2_OBJECT; +} ACPI_PARSE_OBJ_NAMED; + + +/* The parse node is the fundamental element of the parse tree */ + +typedef struct acpi_parseobj_asl +{ + ACPI_PARSE_COMMON + + union acpi_parse_obj *Child; + + + union acpi_parse_obj *ParentMethod; + char *Filename; + char *ExternalName; + char *Namepath; + UINT32 ExtraValue; + UINT32 Column; + UINT32 LineNumber; + UINT32 LogicalLineNumber; + UINT32 LogicalByteOffset; + UINT32 EndLine; + UINT32 EndLogicalLine; + UINT16 ParseOpcode; + UINT32 AcpiBtype; + UINT32 AmlLength; + UINT32 AmlSubtreeLength; + UINT32 FinalAmlLength; + UINT32 FinalAmlOffset; + UINT8 AmlOpcodeLength; + UINT8 AmlPkgLenBytes; + UINT16 CompileFlags; + UINT8 Extra; + char ParseOpName[12]; + +} ACPI_PARSE_OBJ_ASL; + + +typedef union acpi_parse_obj +{ + ACPI_PARSE_OBJ_COMMON Common; + ACPI_PARSE_OBJ_NAMED Named; + ACPI_PARSE_OBJ_ASL Asl; + +} ACPI_PARSE_OBJECT; + /* @@ -755,10 +786,10 @@ typedef struct acpi_parse_state UINT8 *AmlEnd; /* (last + 1) AML byte */ UINT8 *PkgStart; /* current package begin */ UINT8 *PkgEnd; /* current package end */ - struct acpi_parse_obj *StartOp; /* root of parse tree */ + union acpi_parse_obj *StartOp; /* root of parse tree */ struct acpi_node *StartNode; union acpi_gen_state *Scope; /* current scope */ - struct acpi_parse_obj *StartScope; + union acpi_parse_obj *StartScope; } ACPI_PARSE_STATE; @@ -804,38 +835,6 @@ typedef struct #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x09 -/* - * BitRegister IDs - * These are bitfields defined within the full ACPI registers - */ -#define ACPI_BITREG_TIMER_STATUS 0x00 -#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 -#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 -#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 -#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 -#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 -#define ACPI_BITREG_WAKE_STATUS 0x06 - -#define ACPI_BITREG_TIMER_ENABLE 0x07 -#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08 -#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09 -#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A -#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B -#define ACPI_BITREG_WAKE_ENABLE 0x0C - -#define ACPI_BITREG_SCI_ENABLE 0x0D -#define ACPI_BITREG_BUS_MASTER_RLD 0x0E -#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F -#define ACPI_BITREG_SLEEP_TYPE_A 0x10 -#define ACPI_BITREG_SLEEP_TYPE_B 0x11 -#define ACPI_BITREG_SLEEP_ENABLE 0x12 - -#define ACPI_BITREG_ARB_DISABLE 0x13 - -#define ACPI_BITREG_MAX 0x13 -#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 - - /* Masks used to access the BitRegisters */ #define ACPI_BITMASK_TIMER_STATUS 0x0001 @@ -963,6 +962,7 @@ typedef struct #define ACPI_ASCII_ZERO 0x30 + /***************************************************************************** * * Debugger diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index d730eca..d557015 100644 --- a/sys/contrib/dev/acpica/acmacros.h +++ b/sys/contrib/dev/acpica/acmacros.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acmacros.h - C macros for the entire subsystem. - * $Revision: 115 $ + * $Revision: 124 $ * *****************************************************************************/ @@ -122,22 +122,23 @@ * Data manipulation macros */ -#define ACPI_LOWORD(l) ((UINT16)(NATIVE_UINT)(l)) -#define ACPI_HIWORD(l) ((UINT16)((((NATIVE_UINT)(l)) >> 16) & 0xFFFF)) +#define ACPI_LOWORD(l) ((UINT16)(UINT32)(l)) +#define ACPI_HIWORD(l) ((UINT16)((((UINT32)(l)) >> 16) & 0xFFFF)) #define ACPI_LOBYTE(l) ((UINT8)(UINT16)(l)) #define ACPI_HIBYTE(l) ((UINT8)((((UINT16)(l)) >> 8) & 0xFF)) -#ifdef _IA16 +#if ACPI_MACHINE_WIDTH == 16 + /* * For 16-bit addresses, we have to assume that the upper 32 bits * are zero. */ -#define ACPI_LODWORD(l) (l) -#define ACPI_HIDWORD(l) (0) +#define ACPI_LODWORD(l) ((UINT32)(l)) +#define ACPI_HIDWORD(l) ((UINT32)(0)) #define ACPI_GET_ADDRESS(a) ((a).Lo) -#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(b);} +#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(UINT32)(b);} #define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo) #else @@ -146,7 +147,7 @@ * ACPI_INTEGER is 32-bits, no 64-bit support on this platform */ #define ACPI_LODWORD(l) ((UINT32)(l)) -#define ACPI_HIDWORD(l) (0) +#define ACPI_HIDWORD(l) ((UINT32)(0)) #define ACPI_GET_ADDRESS(a) (a) #define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) @@ -158,10 +159,10 @@ * Full 64-bit address/integer on both 32-bit and 64-bit platforms */ #define ACPI_LODWORD(l) ((UINT32)(UINT64)(l)) -#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(&l))).Hi)) +#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi)) #define ACPI_GET_ADDRESS(a) (a) -#define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) +#define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b)) #define ACPI_VALID_ADDRESS(a) (a) #endif #endif @@ -174,20 +175,23 @@ /* Pointer arithmetic */ -#define ACPI_PTR_ADD(t,a,b) (t *) ((char *)(a) + (b)) +#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (NATIVE_UINT)(b)) #define ACPI_PTR_DIFF(a,b) (NATIVE_UINT) ((char *)(a) - (char *)(b)) /* Pointer/Integer type conversions */ -#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void,NULL,(NATIVE_UINT)i) -#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,NULL) -#define ACPI_OFFSET(d,o) ((ACPI_SIZE) ACPI_TO_INTEGER (&(((d *)0)->o))) -#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o) +#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(NATIVE_UINT)i) +#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL) +#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL) +#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f) +#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p)) +#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p)) -#ifdef _IA16 +#if ACPI_MACHINE_WIDTH == 16 +#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_UNALIGNED32_TO_32(d,s) #define ACPI_PHYSADDR_TO_PTR(i) (void *)(i) -#define ACPI_PTR_TO_PHYSADDR(i) (char *)(i) +#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i) #else #define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i) #define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i) @@ -203,10 +207,10 @@ /* The hardware supports unaligned transfers, just do the move */ -#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(UINT16 *)(d) = *(UINT16 *)(s) -#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(UINT32 *)(d) = *(UINT32 *)(s) -#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(UINT32 *)(d) = *(UINT16 *)(s) -#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(UINT64 *)(d) = *(UINT64 *)(s) +#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) +#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s) +#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s) #else /* @@ -215,24 +219,24 @@ * the destination (or both) is/are unaligned. */ -#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ - ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];} +#define ACPI_MOVE_UNALIGNED16_TO_16(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} -#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ - ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\ - ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\ - ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];} +#define ACPI_MOVE_UNALIGNED32_TO_32(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ + ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];} -#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);} +#define ACPI_MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(void *)(d)) = 0; ACPI_MOVE_UNALIGNED16_TO_16(d,s);} -#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(d))[0] = ((UINT8 *)(s))[0];\ - ((UINT8 *)(d))[1] = ((UINT8 *)(s))[1];\ - ((UINT8 *)(d))[2] = ((UINT8 *)(s))[2];\ - ((UINT8 *)(d))[3] = ((UINT8 *)(s))[3];\ - ((UINT8 *)(d))[4] = ((UINT8 *)(s))[4];\ - ((UINT8 *)(d))[5] = ((UINT8 *)(s))[5];\ - ((UINT8 *)(d))[6] = ((UINT8 *)(s))[6];\ - ((UINT8 *)(d))[7] = ((UINT8 *)(s))[7];} +#define ACPI_MOVE_UNALIGNED64_TO_64(d,s) {((UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ + ((UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];\ + ((UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[2];\ + ((UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[3];\ + ((UINT8 *)(void *)(d))[4] = ((UINT8 *)(void *)(s))[4];\ + ((UINT8 *)(void *)(d))[5] = ((UINT8 *)(void *)(s))[5];\ + ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[6];\ + ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[7];} #endif @@ -265,8 +269,8 @@ /* * Rounding macros (Power of two boundaries only) */ -#define ACPI_ROUND_DOWN(value,boundary) (((NATIVE_UINT)(value)) & (~((boundary)-1))) -#define ACPI_ROUND_UP(value,boundary) ((((NATIVE_UINT)(value)) + ((boundary)-1)) & (~((boundary)-1))) +#define ACPI_ROUND_DOWN(value,boundary) (((NATIVE_UINT)(value)) & (~(((NATIVE_UINT) boundary)-1))) +#define ACPI_ROUND_UP(value,boundary) ((((NATIVE_UINT)(value)) + (((NATIVE_UINT) boundary)-1)) & (~(((NATIVE_UINT) boundary)-1))) #define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4) #define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8) @@ -292,22 +296,33 @@ * 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_INTEGER)(-1)) << ((UINT32) (position)))) -#define ACPI_MASK_BITS_BELOW(position) (((ACPI_INTEGER)(-1)) << ((UINT32) (position))) +#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position)))) +#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position))) #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) /* Macros for GAS addressing */ -#ifndef _IA16 +#if ACPI_MACHINE_WIDTH != 16 #define ACPI_PCI_DEVICE_MASK (UINT64) 0x0000FFFF00000000 #define ACPI_PCI_FUNCTION_MASK (UINT64) 0x00000000FFFF0000 #define ACPI_PCI_REGISTER_MASK (UINT64) 0x000000000000FFFF -#define ACPI_PCI_FUNCTION(a) (UINT16) ((((a) & ACPI_PCI_FUNCTION_MASK) >> 16)) -#define ACPI_PCI_DEVICE(a) (UINT16) ((((a) & ACPI_PCI_DEVICE_MASK) >> 32)) -#define ACPI_PCI_REGISTER(a) (UINT16) (((a) & ACPI_PCI_REGISTER_MASK)) +/* + * Obsolete + */ + +/* +#define ACPI_PCI_FUNCTION(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_FUNCTION_MASK)) >> 16)) +#define ACPI_PCI_DEVICE(a) (UINT16) ((((UINT64)((UINT64)(a) & ACPI_PCI_DEVICE_MASK)) >> 32)) +#define ACPI_PCI_REGISTER(a) (UINT16) (((UINT64)((UINT64)(a) & ACPI_PCI_REGISTER_MASK))) +*/ + + +#define ACPI_PCI_DEVICE(a) (UINT16) ((ACPI_HIDWORD ((a))) & 0x0000FFFF) +#define ACPI_PCI_FUNCTION(a) (UINT16) ((ACPI_LODWORD ((a))) >> 16) +#define ACPI_PCI_REGISTER(a) (UINT16) ((ACPI_LODWORD ((a))) & 0x0000FFFF) #else @@ -332,13 +347,13 @@ * * The "Descriptor" field is the first field in both structures. */ -#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_NAMESPACE_NODE *)d)->Descriptor) -#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_NAMESPACE_NODE *)d)->Descriptor = t) +#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId) +#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId = t) /* Macro to test the object type */ -#define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)d)->Common.Type) +#define ACPI_GET_OBJECT_TYPE(d) (((ACPI_OPERAND_OBJECT *)(void *)(d))->Common.Type) /* Macro to check the table flags for SINGLE or MULTIPLE tables are allowed */ @@ -350,7 +365,7 @@ * as a pointer to an ACPI_TABLE_HEADER. (b+1) then points past the header, * and ((UINT8 *)b+b->Length) points one byte past the end of the table. */ -#ifndef _IA16 +#if ACPI_MACHINE_WIDTH != 16 #define ACPI_IS_IN_ACPI_TABLE(a,b) (((UINT8 *)(a) >= (UINT8 *)(b + 1)) &&\ ((UINT8 *)(a) < ((UINT8 *)b + b->Length))) @@ -363,7 +378,7 @@ /* * Macros for the master AML opcode table */ -#ifdef ACPI_DEBUG +#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) #define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {Name,PArgs,IArgs,Flags,ObjType,Class,Type} #else #define ACPI_OP(Name,PArgs,IArgs,ObjType,Class,Type,Flags) {PArgs,IArgs,Flags,ObjType,Class,Type} @@ -408,7 +423,7 @@ a.RegisterBitWidth = (UINT8) ACPI_MUL_8 (b);\ a.RegisterBitOffset = 0;\ a.Reserved = 0;\ - ACPI_STORE_ADDRESS (a.Address,c);} + ACPI_STORE_ADDRESS (a.Address,(ACPI_PHYSICAL_ADDRESS) c);} /* ACPI V1.0 entries -- address space is always I/O */ @@ -493,11 +508,16 @@ * One of the FUNCTION_TRACE macros above must be used in conjunction with these macros * so that "_ProcName" is defined. */ -#define return_VOID {AcpiUtExit(__LINE__,&_Dbg);return;} -#define return_ACPI_STATUS(s) {AcpiUtStatusExit(__LINE__,&_Dbg,s);return(s);} -#define return_VALUE(s) {AcpiUtValueExit(__LINE__,&_Dbg,s);return(s);} -#define return_PTR(s) {AcpiUtPtrExit(__LINE__,&_Dbg,(UINT8 *)s);return(s);} +#ifdef ACPI_USE_DO_WHILE_0 +#define ACPI_DO_WHILE0(a) do a while(0) +#else +#define ACPI_DO_WHILE0(a) a +#endif +#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(__LINE__,&_Dbg);return;}) +#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(__LINE__,&_Dbg,(s));return((s));}) +#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(__LINE__,&_Dbg,(ACPI_INTEGER)(s));return((s));}) +#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(__LINE__,&_Dbg,(UINT8 *)(s));return((s));}) /* Conditional execution */ @@ -518,7 +538,7 @@ #define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) #define ACPI_DUMP_TABLES(a,b) AcpiNsDumpTables(a,b) -#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d) +#define ACPI_DUMP_PATHNAME(a,b,c,d) (void) AcpiNsDumpPathname(a,b,c,d) #define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a) #define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) #define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a)) @@ -586,6 +606,10 @@ #define return_VALUE(s) return(s) #define return_PTR(s) return(s) +#ifdef ENABLE_DEBUGGER +#define _OPCODE_NAMES +#endif + #endif /* @@ -604,7 +628,7 @@ * For 16-bit code, we want to shrink some things even though * we are using ACPI_DEBUG to get the debug output */ -#ifdef _IA16 +#if ACPI_MACHINE_WIDTH == 16 #undef ACPI_DEBUG_ONLY_MEMBERS #undef _VERBOSE_STRUCTURES #define ACPI_DEBUG_ONLY_MEMBERS(a) @@ -632,8 +656,8 @@ /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__) #define ACPI_MEM_FREE(a) AcpiOsFree(a) #define ACPI_MEM_TRACKING(a) @@ -642,8 +666,8 @@ /* Memory allocation */ -#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__) -#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack(a, _COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__) +#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__) #define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__) #define ACPI_MEM_TRACKING(a) a diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h index e45c93a..6c230dd 100644 --- a/sys/contrib/dev/acpica/acnamesp.h +++ b/sys/contrib/dev/acpica/acnamesp.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acnamesp.h - Namespace subcomponent prototypes and defines - * $Revision: 123 $ + * $Revision: 125 $ * *****************************************************************************/ @@ -199,7 +199,7 @@ AcpiNsGetNextNode ( ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child); -ACPI_STATUS +void AcpiNsDeleteNamespaceByOwner ( UINT16 TableId); @@ -230,7 +230,6 @@ AcpiNsLoadTableByType ( * Top-level namespace access - nsaccess */ - ACPI_STATUS AcpiNsRootInitialize ( void); @@ -250,7 +249,6 @@ AcpiNsLookup ( * Named object allocation/deallocation - nsalloc */ - ACPI_NAMESPACE_NODE * AcpiNsCreateNode ( UINT32 Name); @@ -259,7 +257,7 @@ void AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node); -ACPI_STATUS +void AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE *ParentHandle); @@ -311,10 +309,24 @@ AcpiNsPrintPathname ( UINT32 NumSegments, char *Pathname); +ACPI_STATUS +AcpiNsDumpOneDevice ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + void AcpiNsDumpRootDevices ( void); +ACPI_STATUS +AcpiNsDumpOneObject ( + ACPI_HANDLE ObjHandle, + UINT32 Level, + void *Context, + void **ReturnValue); + void AcpiNsDumpObjects ( ACPI_OBJECT_TYPE Type, @@ -380,6 +392,12 @@ UINT32 AcpiNsOpensScope ( ACPI_OBJECT_TYPE Type); +void +AcpiNsBuildExternalPath ( + ACPI_NAMESPACE_NODE *Node, + ACPI_SIZE Size, + NATIVE_CHAR *NameBuffer); + NATIVE_CHAR * AcpiNsGetExternalPathname ( ACPI_NAMESPACE_NODE *Node); @@ -499,7 +517,7 @@ ACPI_STATUS AcpiNsBuildInternalName ( ACPI_NAMESTRING_INFO *Info); -ACPI_STATUS +void AcpiNsGetInternalNameLength ( ACPI_NAMESTRING_INFO *Info); diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h index 5ce1bae..b5caeba 100644 --- a/sys/contrib/dev/acpica/acobject.h +++ b/sys/contrib/dev/acpica/acobject.h @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only) - * $Revision: 110 $ + * $Revision: 112 $ * *****************************************************************************/ @@ -147,7 +147,7 @@ /* Values for flag byte above */ -#define AOPOBJ_RESERVED 0x01 +#define AOPOBJ_AML_CONSTANT 0x01 #define AOPOBJ_STATIC_POINTER 0x02 #define AOPOBJ_DATA_VALID 0x04 #define AOPOBJ_OBJECT_INITIALIZED 0x08 @@ -580,4 +580,45 @@ typedef union acpi_operand_obj } ACPI_OPERAND_OBJECT; + + + + +/****************************************************************************** + * + * ACPI_DESCRIPTOR - objects that share a common descriptor identifier + * + *****************************************************************************/ + + +/* Object descriptor types */ + +#define ACPI_DESC_TYPE_CACHED 0x11 /* Used only when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x20 +#define ACPI_DESC_TYPE_STATE_UPDATE 0x21 +#define ACPI_DESC_TYPE_STATE_PACKAGE 0x22 +#define ACPI_DESC_TYPE_STATE_CONTROL 0x23 +#define ACPI_DESC_TYPE_STATE_RPSCOPE 0x24 +#define ACPI_DESC_TYPE_STATE_PSCOPE 0x25 +#define ACPI_DESC_TYPE_STATE_WSCOPE 0x26 +#define ACPI_DESC_TYPE_STATE_RESULT 0x27 +#define ACPI_DESC_TYPE_STATE_NOTIFY 0x28 +#define ACPI_DESC_TYPE_STATE_THREAD 0x29 +#define ACPI_DESC_TYPE_WALK 0x44 +#define ACPI_DESC_TYPE_PARSER 0x66 +#define ACPI_DESC_TYPE_OPERAND 0x88 +#define ACPI_DESC_TYPE_NAMED 0xAA + + + +typedef union acpi_desc +{ + UINT8 DescriptorId; /* To differentiate various internal objs */\ + ACPI_OPERAND_OBJECT Object; + ACPI_NAMESPACE_NODE Node; + ACPI_PARSE_OBJECT Op; + +} ACPI_DESCRIPTOR; + + #endif /* _ACOBJECT_H */ diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/acoutput.h index 2bfb7a5..923cd5e 100644 --- a/sys/contrib/dev/acpica/acoutput.h +++ b/sys/contrib/dev/acpica/acoutput.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acoutput.h -- debug output - * $Revision: 86 $ + * $Revision: 87 $ * *****************************************************************************/ @@ -196,6 +196,16 @@ #define ACPI_LV_INTERRUPTS 0x08000000 #define ACPI_LV_VERBOSITY3 0x0F000000 | ACPI_LV_VERBOSITY2 +/* Exceptionally verbose output -- also used in the global "DebugLevel" */ + +#define ACPI_LV_AML_DISASSEMBLE 0x10000000 +#define ACPI_LV_VERBOSE_INFO 0x20000000 +#define ACPI_LV_FULL_TABLES 0x40000000 +#define ACPI_LV_EVENTS 0x80000000 + +#define ACPI_LV_VERBOSE 0xF0000000 + + /* * Debug level macros that are used in the DEBUG_PRINT macros */ @@ -236,17 +246,8 @@ #define ACPI_DB_MUTEX ACPI_DEBUG_LEVEL (ACPI_LV_MUTEX) #define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT) -#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (0x0FFFFF80) - - -/* Exceptionally verbose output -- also used in the global "DebugLevel" */ - -#define ACPI_DB_AML_DISASSEMBLE 0x10000000 -#define ACPI_DB_VERBOSE_INFO 0x20000000 -#define ACPI_DB_FULL_TABLES 0x40000000 -#define ACPI_DB_EVENTS 0x80000000 +#define ACPI_DB_ALL ACPI_DEBUG_LEVEL (ACPI_LV_ALL) -#define ACPI_DB_VERBOSE 0xF0000000 /* Defaults for DebugLevel, debug and normal */ diff --git a/sys/contrib/dev/acpica/acparser.h b/sys/contrib/dev/acpica/acparser.h index 43feb50..a7e2e50 100644 --- a/sys/contrib/dev/acpica/acparser.h +++ b/sys/contrib/dev/acpica/acparser.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: acparser.h - AML Parser subcomponent prototypes and defines - * $Revision: 58 $ + * $Revision: 59 $ * *****************************************************************************/ @@ -225,7 +225,7 @@ UINT32 AcpiPsGetOpcodeSize ( UINT32 Opcode); -BOOLEAN +void AcpiPsCompleteThisOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op); diff --git a/sys/contrib/dev/acpica/acresrc.h b/sys/contrib/dev/acpica/acresrc.h index a620bdf..9f09766 100644 --- a/sys/contrib/dev/acpica/acresrc.h +++ b/sys/contrib/dev/acpica/acresrc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acresrc.h - Resource Manager function prototypes - * $Revision: 30 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -161,8 +161,59 @@ AcpiRsCreatePciRoutingTable ( /* - *Function prototypes called from AcpiRsCreate* + * Function prototypes called from AcpiRsCreate* */ +void +AcpiRsDumpIrq ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpAddress16 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpAddress32 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpAddress64 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpDma ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpIo ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpExtendedIrq ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpFixedIo ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpFixedMemory32 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpMemory24 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpMemory32 ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpStartDependFns ( + ACPI_RESOURCE_DATA *Data); + +void +AcpiRsDumpVendorSpecific ( + ACPI_RESOURCE_DATA *Data); void AcpiRsDumpResourceList ( @@ -179,18 +230,18 @@ AcpiRsGetByteStreamStart ( UINT32 *Size); ACPI_STATUS -AcpiRsCalculateListLength ( +AcpiRsGetListLength ( UINT8 *ByteStreamBuffer, UINT32 ByteStreamBufferLength, ACPI_SIZE *SizeNeeded); ACPI_STATUS -AcpiRsCalculateByteStreamLength ( +AcpiRsGetByteStreamLength ( ACPI_RESOURCE *LinkedListBuffer, ACPI_SIZE *SizeNeeded); ACPI_STATUS -AcpiRsCalculatePciRoutingTableLength ( +AcpiRsGetPciRoutingTableLength ( ACPI_OPERAND_OBJECT *PackageObject, ACPI_SIZE *BufferSizeNeeded); @@ -203,7 +254,7 @@ AcpiRsByteStreamToList ( ACPI_STATUS AcpiRsListToByteStream ( ACPI_RESOURCE *LinkedList, - UINT32 ByteStreamSizeNeeded, + ACPI_SIZE ByteStreamSizeNeeded, UINT8 *OutputBuffer); ACPI_STATUS diff --git a/sys/contrib/dev/acpica/acstruct.h b/sys/contrib/dev/acpica/acstruct.h index d4d24a9..30323a6 100644 --- a/sys/contrib/dev/acpica/acstruct.h +++ b/sys/contrib/dev/acpica/acstruct.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acstruct.h - Internal structs - * $Revision: 17 $ + * $Revision: 19 $ * *****************************************************************************/ @@ -130,12 +130,14 @@ * the tree (for whatever reason), and for control method execution. */ -#define ACPI_NEXT_OP_DOWNWARD 1 -#define ACPI_NEXT_OP_UPWARD 2 +#define ACPI_NEXT_OP_DOWNWARD 1 +#define ACPI_NEXT_OP_UPWARD 2 -#define ACPI_WALK_NON_METHOD 0 -#define ACPI_WALK_METHOD 1 -#define ACPI_WALK_METHOD_RESTART 2 +#define ACPI_WALK_NON_METHOD 0 +#define ACPI_WALK_METHOD 1 +#define ACPI_WALK_METHOD_RESTART 2 +#define ACPI_WALK_CONST_REQUIRED 3 +#define ACPI_WALK_CONST_OPTIONAL 4 typedef struct acpi_walk_state { @@ -193,6 +195,7 @@ typedef struct acpi_walk_state typedef struct acpi_init_walk_info { UINT16 MethodCount; + UINT16 DeviceCount; UINT16 OpRegionCount; UINT16 FieldCount; UINT16 BufferCount; diff --git a/sys/contrib/dev/acpica/actables.h b/sys/contrib/dev/acpica/actables.h index 39678a3..4919d27 100644 --- a/sys/contrib/dev/acpica/actables.h +++ b/sys/contrib/dev/acpica/actables.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actables.h - ACPI table management - * $Revision: 36 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -154,6 +154,15 @@ AcpiTbGetTableCount ( * tbget - Table "get" routines */ +void +AcpiTbTableOverride ( + ACPI_TABLE_DESC *TableInfo); + +ACPI_STATUS +AcpiTbGetTableWithOverride ( + ACPI_POINTER *Address, + ACPI_TABLE_DESC *TableInfo); + ACPI_STATUS AcpiTbGetTablePtr ( ACPI_TABLE_TYPE TableType, @@ -181,7 +190,7 @@ ACPI_STATUS AcpiTbGetTablePointer ( ACPI_POINTER *Address, UINT32 Flags, - UINT32 *Size, + ACPI_SIZE *Size, ACPI_TABLE_HEADER **TablePtr); /* @@ -190,8 +199,7 @@ AcpiTbGetTablePointer ( ACPI_STATUS AcpiTbGetAllTables ( - UINT32 NumberOfTables, - ACPI_TABLE_HEADER *BufferPtr); + UINT32 NumberOfTables); /* @@ -200,7 +208,6 @@ AcpiTbGetAllTables ( ACPI_STATUS AcpiTbInstallTable ( - ACPI_TABLE_HEADER *TablePtr, ACPI_TABLE_DESC *TableInfo); ACPI_STATUS @@ -210,7 +217,6 @@ AcpiTbMatchSignature ( ACPI_STATUS AcpiTbRecognizeTable ( - ACPI_TABLE_HEADER *TablePtr, ACPI_TABLE_DESC *TableInfo); ACPI_STATUS @@ -277,7 +283,7 @@ AcpiTbFindTable ( ACPI_STATUS AcpiTbMapAcpiTable ( ACPI_PHYSICAL_ADDRESS PhysicalAddress, - UINT32 *Size, + ACPI_SIZE *Size, ACPI_TABLE_HEADER **LogicalAddress); ACPI_STATUS diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index a7a99bb..dbff910 100644 --- a/sys/contrib/dev/acpica/actypes.h +++ b/sys/contrib/dev/acpica/actypes.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actypes.h - Common data types for the entire ACPI subsystem - * $Revision: 227 $ + * $Revision: 237 $ * *****************************************************************************/ @@ -119,13 +119,23 @@ /*! [Begin] no source code translation (keep the typedefs) */ + + +/* + * Data type ranges + */ +#define ACPI_UINT8_MAX (UINT8) 0xFF +#define ACPI_UINT16_MAX (UINT16) 0xFFFF +#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF +#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF +#define ACPI_ASCII_MAX 0x7F + + + /* * Data types - Fixed across all compilation models * * BOOLEAN Logical Boolean. - * 1 byte value containing a 0 for FALSE or a 1 for TRUE. - * Other values are undefined. - * * INT8 8-bit (1 byte) signed value * UINT8 8-bit (1 byte) unsigned value * INT16 16-bit (2 byte) signed value @@ -138,8 +148,11 @@ * NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value */ +#ifndef ACPI_MACHINE_WIDTH +#error ACPI_MACHINE_WIDTH not defined +#endif -#ifdef _IA64 +#if ACPI_MACHINE_WIDTH == 64 /* * 64-bit type definitions */ @@ -151,8 +164,11 @@ typedef unsigned int UINT32; typedef COMPILER_DEPENDENT_INT64 INT64; typedef COMPILER_DEPENDENT_UINT64 UINT64; +typedef INT64 NATIVE_INT; typedef UINT64 NATIVE_UINT; -typedef UINT64 NATIVE_INT; + +typedef UINT32 NATIVE_UINT_MAX32; +typedef UINT64 NATIVE_UINT_MIN32; typedef UINT64 ACPI_TBLPTR; typedef UINT64 ACPI_IO_ADDRESS; @@ -161,10 +177,11 @@ typedef UINT64 ACPI_SIZE; #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ #define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ -#define ACPI_MAX_PTR 0xFFFFFFFFFFFFFFFF +#define ACPI_MAX_PTR ACPI_UINT64_MAX +#define ACPI_SIZE_MAX ACPI_UINT64_MAX -#elif _IA16 +#elif ACPI_MACHINE_WIDTH == 16 /* * 16-bit type definitions */ @@ -185,15 +202,19 @@ typedef struct typedef UINT16 NATIVE_UINT; typedef INT16 NATIVE_INT; +typedef UINT16 NATIVE_UINT_MAX32; +typedef UINT32 NATIVE_UINT_MIN32; + typedef UINT32 ACPI_TBLPTR; typedef UINT32 ACPI_IO_ADDRESS; typedef char *ACPI_PHYSICAL_ADDRESS; -typedef UINT32 ACPI_SIZE; +typedef UINT16 ACPI_SIZE; #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 #define _HW_ALIGNMENT_SUPPORT #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ -#define ACPI_MAX_PTR 0xFFFF +#define ACPI_MAX_PTR ACPI_UINT16_MAX +#define ACPI_SIZE_MAX ACPI_UINT16_MAX /* * (16-bit only) internal integers must be 32-bits, so @@ -202,7 +223,7 @@ typedef UINT32 ACPI_SIZE; #define ACPI_NO_INTEGER64_SUPPORT -#else +#elif ACPI_MACHINE_WIDTH == 32 /* * 32-bit type definitions (default) */ @@ -214,8 +235,11 @@ typedef unsigned int UINT32; typedef COMPILER_DEPENDENT_INT64 INT64; typedef COMPILER_DEPENDENT_UINT64 UINT64; -typedef UINT32 NATIVE_UINT; typedef INT32 NATIVE_INT; +typedef UINT32 NATIVE_UINT; + +typedef UINT32 NATIVE_UINT_MAX32; +typedef UINT32 NATIVE_UINT_MIN32; typedef UINT64 ACPI_TBLPTR; typedef UINT32 ACPI_IO_ADDRESS; @@ -224,9 +248,12 @@ typedef UINT32 ACPI_SIZE; #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 #define _HW_ALIGNMENT_SUPPORT -#define ACPI_MAX_PTR 0xFFFFFFFF -#endif +#define ACPI_MAX_PTR ACPI_UINT32_MAX +#define ACPI_SIZE_MAX ACPI_UINT32_MAX +#else +#error unknown ACPI_MACHINE_WIDTH +#endif /* @@ -238,16 +265,6 @@ typedef NATIVE_UINT ACPI_PTRDIFF; typedef char NATIVE_CHAR; -/* - * Data type ranges - */ -#define ACPI_UINT8_MAX (UINT8) 0xFF -#define ACPI_UINT16_MAX (UINT16) 0xFFFF -#define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF -#define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF -#define ACPI_ASCII_MAX 0x7F - - #ifdef DEFINE_ALTERNATE_TYPES /* * Types used only in translated source, defined here to enable @@ -266,7 +283,7 @@ typedef UINT64 u64; * Pointer overlays to avoid lots of typecasting for * code that accepts both physical and logical pointers. */ -typedef union AcpiPointers +typedef union acpi_ptrs { ACPI_PHYSICAL_ADDRESS Physical; void *Logical; @@ -277,7 +294,7 @@ typedef union AcpiPointers typedef struct AcpiPointer { UINT32 PointerType; - ACPI_POINTERS Pointer; + union acpi_ptrs Pointer; } ACPI_POINTER; @@ -329,6 +346,13 @@ typedef union } UINT64_OVERLAY; +typedef struct +{ + UINT32 Lo; + UINT32 Hi; + +} UINT32_STRUCT; + /* * Acpi integer width. In ACPI version 1, integers are @@ -362,7 +386,7 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_MAX_BCD_DIGITS 16 #define ACPI_MAX_DECIMAL_DIGITS 19 -#ifdef _IA64 +#if ACPI_MACHINE_WIDTH == 64 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ #endif #endif @@ -372,7 +396,7 @@ typedef UINT64 ACPI_INTEGER; * Constants with special meanings */ -#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_UINT32_MAX) +#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) /* @@ -653,6 +677,37 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; /* + * BitRegister IDs + * These are bitfields defined within the full ACPI registers + */ +#define ACPI_BITREG_TIMER_STATUS 0x00 +#define ACPI_BITREG_BUS_MASTER_STATUS 0x01 +#define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 +#define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 +#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 +#define ACPI_BITREG_RT_CLOCK_STATUS 0x05 +#define ACPI_BITREG_WAKE_STATUS 0x06 + +#define ACPI_BITREG_TIMER_ENABLE 0x07 +#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08 +#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09 +#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A +#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B +#define ACPI_BITREG_WAKE_ENABLE 0x0C + +#define ACPI_BITREG_SCI_ENABLE 0x0D +#define ACPI_BITREG_BUS_MASTER_RLD 0x0E +#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F +#define ACPI_BITREG_SLEEP_TYPE_A 0x10 +#define ACPI_BITREG_SLEEP_TYPE_B 0x11 +#define ACPI_BITREG_SLEEP_ENABLE 0x12 + +#define ACPI_BITREG_ARB_DISABLE 0x13 + +#define ACPI_BITREG_MAX 0x13 +#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 + +/* * External ACPI object definition */ @@ -811,6 +866,13 @@ void (*ACPI_OBJECT_HANDLER) ( UINT32 Function, void *Data); +typedef +ACPI_STATUS (*ACPI_INIT_HANDLER) ( + ACPI_HANDLE Object, + UINT32 Function); + +#define ACPI_INIT_DEVICE_INI 1 + /* Address Spaces (Operation Regions */ @@ -823,7 +885,7 @@ ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( void *HandlerContext, void *RegionContext); -#define ACPI_DEFAULT_HANDLER ((ACPI_ADR_SPACE_HANDLER) NULL) +#define ACPI_DEFAULT_HANDLER NULL typedef @@ -898,7 +960,7 @@ typedef struct ACPI_PHYSICAL_ADDRESS Address; ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; UINT8 *MappedLogicalAddress; - UINT32 MappedLength; + ACPI_SIZE MappedLength; } ACPI_MEM_SPACE_CONTEXT; diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 8c2f5f0..3dc539a 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 130 $ + * $Revision: 139 $ * *****************************************************************************/ @@ -173,7 +173,7 @@ ACPI_STATUS AcpiUtHardwareInitialize ( void); -ACPI_STATUS +void AcpiUtSubsystemShutdown ( void); @@ -185,7 +185,7 @@ AcpiUtValidateFadt ( * UtGlobal - Global data structures and procedures */ -#ifdef ACPI_DEBUG +#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) NATIVE_CHAR * AcpiUtGetMutexName ( @@ -195,6 +195,10 @@ NATIVE_CHAR * AcpiUtGetTypeName ( ACPI_OBJECT_TYPE Type); +NATIVE_CHAR * +AcpiUtGetObjectTypeName ( + ACPI_OPERAND_OBJECT *ObjDesc); + #endif @@ -206,7 +210,7 @@ NATIVE_CHAR * AcpiUtGetEventName ( UINT32 EventId); -UINT8 +char AcpiUtHexToAsciiChar ( ACPI_INTEGER Integer, UINT32 Position); @@ -241,7 +245,7 @@ AcpiUtStrncpy ( const NATIVE_CHAR *SrcString, NATIVE_UINT Count); -UINT32 +int AcpiUtStrncmp ( const NATIVE_CHAR *String1, const NATIVE_CHAR *String2, @@ -286,13 +290,32 @@ AcpiUtMemset ( NATIVE_UINT Value, NATIVE_UINT Count); -UINT32 +int AcpiUtToUpper ( - UINT32 c); + int c); -UINT32 +int AcpiUtToLower ( - UINT32 c); + int c); + +extern const UINT8 _acpi_ctype[]; + +#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ +#define _ACPI_XS 0x40 /* extra space */ +#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ +#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ +#define _ACPI_DI 0x04 /* '0'-'9' */ +#define _ACPI_LO 0x02 /* 'a'-'z' */ +#define _ACPI_PU 0x10 /* punctuation */ +#define _ACPI_SP 0x08 /* space */ +#define _ACPI_UP 0x01 /* 'A'-'Z' */ +#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ + +#define ACPI_IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) +#define ACPI_IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) +#define ACPI_IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) +#define ACPI_IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) +#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) #endif /* ACPI_USE_SYSTEM_CLIBRARY */ @@ -314,6 +337,20 @@ AcpiUtBuildPackageObject ( UINT32 *SpaceUsed); ACPI_STATUS +AcpiUtCopyIelementToEelement ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + +ACPI_STATUS +AcpiUtCopyIelementToIelement ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + +ACPI_STATUS AcpiUtCopyIobjectToEobject ( ACPI_OPERAND_OBJECT *Obj, ACPI_BUFFER *RetBuffer); @@ -477,7 +514,7 @@ void AcpiUtDeleteInternalSimpleObject ( ACPI_OPERAND_OBJECT *Object); -ACPI_STATUS +void AcpiUtDeleteInternalObjectList ( ACPI_OPERAND_OBJECT **ObjList); @@ -615,6 +652,13 @@ AcpiUtGetObjectSize( ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength); +ACPI_STATUS +AcpiUtGetElementLength ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context); + /* * UtState - Generic state creation/cache routines @@ -704,14 +748,16 @@ BOOLEAN AcpiUtValidAcpiCharacter ( NATIVE_CHAR Character); +ACPI_STATUS +AcpiUtStrtoul64 ( + NATIVE_CHAR *String, + UINT32 Base, + ACPI_INTEGER *RetInteger); + NATIVE_CHAR * AcpiUtStrupr ( NATIVE_CHAR *SrcString); -ACPI_STATUS -AcpiUtResolvePackageReferences ( - ACPI_OPERAND_OBJECT *ObjDesc); - UINT8 * AcpiUtGetResourceEndTag ( ACPI_OPERAND_OBJECT *ObjDesc); @@ -721,6 +767,14 @@ AcpiUtGenerateChecksum ( UINT8 *Buffer, UINT32 Length); +UINT32 +AcpiUtDwordByteSwap ( + UINT32 Value); + +void +AcpiUtSetIntegerWidth ( + UINT8 Revision); + #ifdef ACPI_DEBUG void AcpiUtDisplayInitPathname ( @@ -796,6 +850,12 @@ AcpiUtFreeAndTrack ( UINT32 Component, NATIVE_CHAR *Module, UINT32 Line); + +ACPI_DEBUG_MEM_BLOCK * +AcpiUtFindAllocation ( + UINT32 ListId, + void *Allocation); + ACPI_STATUS AcpiUtTrackAllocation ( UINT32 ListId, diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h index ebb45ef..732c01b 100644 --- a/sys/contrib/dev/acpica/amlcode.h +++ b/sys/contrib/dev/acpica/amlcode.h @@ -3,7 +3,7 @@ * Name: amlcode.h - Definitions for AML, as included in "definition blocks" * Declarations and definitions contained herein are derived * directly from the ACPI specification. - * $Revision: 67 $ + * $Revision: 68 $ * *****************************************************************************/ @@ -119,7 +119,6 @@ #ifndef __AMLCODE_H__ #define __AMLCODE_H__ - /* primary opcodes */ #define AML_NULL_CHAR (UINT16) 0x00 @@ -381,6 +380,7 @@ #define AML_CREATE 0x0004 #define AML_MATH 0x0002 #define AML_LOGICAL 0x0001 +#define AML_CONSTANT 0x1000 /* Convenient flag groupings */ diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index 467546d..271301d 100644 --- a/sys/contrib/dev/acpica/dbcmds.c +++ b/sys/contrib/dev/acpica/dbcmds.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbcmds - debug commands and output routines - * $Revision: 79 $ + * $Revision: 84 $ * ******************************************************************************/ @@ -116,15 +116,11 @@ #include "acpi.h" -#include "acparser.h" #include "acdispat.h" #include "amlcode.h" #include "acnamesp.h" -#include "acparser.h" #include "acevents.h" -#include "acinterp.h" #include "acdebug.h" -#include "actables.h" #include "acresrc.h" #ifdef ENABLE_DEBUGGER @@ -138,7 +134,7 @@ * These object types map directly to the ACPI_TYPES */ -ARGUMENT_INFO AcpiDbObjectTypes [] = +static ARGUMENT_INFO AcpiDbObjectTypes [] = { {"ANY"}, {"NUMBERS"}, @@ -190,14 +186,14 @@ AcpiDbWalkForReferences ( if (Node == (void *) ObjDesc) { - AcpiOsPrintf ("Object is a Node [%4.4s]\n", &Node->Name); + AcpiOsPrintf ("Object is a Node [%4.4s]\n", Node->Name.Ascii); } /* Check for match against the object attached to the node */ if (AcpiNsGetAttachedObject (Node) == ObjDesc) { - AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, &Node->Name); + AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", Node, Node->Name.Ascii); } return (AE_OK); @@ -229,7 +225,7 @@ AcpiDbFindReferences ( /* Search all nodes in namespace */ - AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkForReferences, (void *) ObjDesc, NULL); } @@ -377,9 +373,9 @@ AcpiDbSetMethodBreakpoint ( /* Get and verify the breakpoint address */ Address = ACPI_STRTOUL (Location, NULL, 16); - if (Address <= Op->AmlOffset) + if (Address <= Op->Common.AmlOffset) { - AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->AmlOffset); + AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->Common.AmlOffset); } /* Save breakpoint in current walk */ @@ -596,6 +592,7 @@ AcpiDbSendNotify ( UINT32 Value) { ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; /* Translate name to an Named object */ @@ -615,7 +612,11 @@ AcpiDbSendNotify ( /* Send the notify */ - AcpiEvQueueNotifyRequest (Node, Value); + Status = AcpiEvQueueNotifyRequest (Node, Value); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not queue notify\n"); + } break; default: @@ -652,6 +653,7 @@ AcpiDbSetMethodData ( UINT32 Value; ACPI_WALK_STATE *WalkState; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; /* Validate TypeArg */ @@ -698,13 +700,18 @@ AcpiDbSetMethodData ( /* Set a method argument */ - if (Index > MTH_NUM_ARGS) + if (Index > MTH_MAX_ARG) { AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index); return; } - AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState); + Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + return; + } + ObjDesc = WalkState->Arguments[Index].Object; AcpiOsPrintf ("Arg%d: ", Index); @@ -715,13 +722,18 @@ AcpiDbSetMethodData ( /* Set a method local */ - if (Index > MTH_NUM_LOCALS) + if (Index > MTH_MAX_LOCAL) { AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index); return; } - AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState); + Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + return; + } + ObjDesc = WalkState->LocalVariables[Index].Object; AcpiOsPrintf ("Local%d: ", Index); @@ -778,7 +790,7 @@ AcpiDbWalkForSpecificObjects ( if (ObjDesc) { - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_METHOD: AcpiOsPrintf (" #Args %d Concurrency %X", ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency); @@ -803,6 +815,10 @@ AcpiDbWalkForSpecificObjects ( case ACPI_TYPE_BUFFER: AcpiOsPrintf (" Length %X", ObjDesc->Buffer.Length); break; + + default: + /* Ignore other object types */ + break; } } @@ -842,13 +858,14 @@ AcpiDbDisplayObjects ( } AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n", AcpiUtGetTypeName (Type)); + AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n", + AcpiUtGetTypeName (Type)); AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); /* Walk the namespace from the root */ - AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkForSpecificObjects, (void *) &Type, NULL); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); @@ -889,7 +906,7 @@ AcpiDbWalkAndMatchName ( /* Wildcard support */ if ((RequestedName[i] != '?') && - (RequestedName[i] != ((NATIVE_CHAR *) (&((ACPI_NAMESPACE_NODE *) ObjHandle)->Name))[i])) + (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i])) { /* No match, just exit */ @@ -943,7 +960,7 @@ AcpiDbFindNameInNamespace ( /* Walk the namespace from the root */ - AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NameArg, NULL); AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); @@ -1035,7 +1052,8 @@ void AcpiDbDisplayResources ( NATIVE_CHAR *ObjectArg) { -#ifndef _IA16 +#if ACPI_MACHINE_WIDTH != 16 + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_BUFFER ReturnObj; @@ -1106,7 +1124,7 @@ GetCrs: else { - AcpiRsDumpResourceList ((ACPI_RESOURCE *) AcpiGbl_DbBuffer); + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); } Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj); @@ -1143,7 +1161,7 @@ GetPrs: else { - AcpiRsDumpResourceList ((ACPI_RESOURCE *) AcpiGbl_DbBuffer); + AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); } @@ -1156,4 +1174,96 @@ Cleanup: } + + +typedef struct +{ + UINT32 Nodes; + UINT32 Objects; +} ACPI_INTEGRITY_INFO; + +/******************************************************************************* + * + * FUNCTION: AcpiDbIntegrityWalk + * + * PARAMETERS: Callback from WalkNamespace + * + * RETURN: Status + * + * DESCRIPTION: Examine one NS node for valid values. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDbIntegrityWalk ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue) +{ + ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; + ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; + ACPI_OPERAND_OBJECT *Object; + + + Info->Nodes++; + if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) + { + AcpiOsPrintf ("Invalid Descriptor Type for Node %p, Type = %X\n", + Node, ACPI_GET_DESCRIPTOR_TYPE (Node)); + } + + if (Node->Type > INTERNAL_TYPE_MAX) + { + AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", + Node, Node->Type); + } + + if (!AcpiUtValidAcpiName (Node->Name.Integer)) + { + AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); + } + + Object = AcpiNsGetAttachedObject (Node); + if (Object) + { + Info->Objects++; + if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) + { + AcpiOsPrintf ("Invalid Descriptor Type for Object %p, Type = %X\n", + Object, ACPI_GET_DESCRIPTOR_TYPE (Object)); + } + } + + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbCheckIntegrity + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Check entire namespace for data structure integrity + * + ******************************************************************************/ + +void +AcpiDbCheckIntegrity (void) +{ + ACPI_INTEGRITY_INFO Info = {0,0}; + + /* Search all nodes in namespace */ + + (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + AcpiDbIntegrityWalk, (void *) &Info, NULL); + + AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects); + +} + #endif /* ENABLE_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index 536c808..39783c6 100644 --- a/sys/contrib/dev/acpica/dbdisply.c +++ b/sys/contrib/dev/acpica/dbdisply.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisply - debug display commands - * $Revision: 67 $ + * $Revision: 75 $ * ******************************************************************************/ @@ -116,12 +116,10 @@ #include "acpi.h" -#include "acparser.h" #include "amlcode.h" #include "acdispat.h" #include "acnamesp.h" #include "acparser.h" -#include "acevents.h" #include "acinterp.h" #include "acdebug.h" @@ -152,7 +150,7 @@ AcpiDbGetPointer ( void *ObjPtr; -#ifdef _IA16 +#if ACPI_MACHINE_WIDTH == 16 #include <stdio.h> /* Have to handle 16-bit pointers of the form segment:offset */ @@ -193,16 +191,16 @@ AcpiDbDumpParserDescriptor ( const ACPI_OPCODE_INFO *Info; - Info = AcpiPsGetOpcodeInfo (Op->Opcode); + Info = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); AcpiOsPrintf ("Parser Op Descriptor:\n"); - AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Opcode); + AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode); ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name)); - AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Value); - AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Parent); - AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Next); + AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg); + AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent); + AcpiOsPrintf ("%20.20s : %p\n", "NextOp", Op->Common.Next); } @@ -291,7 +289,7 @@ AcpiDbDecodeAndDisplayObject ( goto DumpNte; - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: /* This is a ACPI OPERAND OBJECT */ @@ -413,14 +411,14 @@ AcpiDbDecodeInternalObject ( return; } - AcpiOsPrintf (" %s", AcpiUtGetTypeName (ObjDesc->Common.Type)); + AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: - AcpiOsPrintf (" %.8X%.8X", ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); + AcpiOsPrintf (" %8.8X%8.8X", ACPI_HIDWORD (ObjDesc->Integer.Value), + ACPI_LODWORD (ObjDesc->Integer.Value)); break; @@ -448,6 +446,11 @@ AcpiDbDecodeInternalObject ( AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); } break; + + + default: + /* No additional display for other types */ + break; } } @@ -494,7 +497,7 @@ AcpiDbDisplayInternalObject ( case ACPI_DESC_TYPE_NAMED: AcpiOsPrintf ("<Node> Name %4.4s Type-%s", - &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name, + ((ACPI_NAMESPACE_NODE *)ObjDesc)->Name.Ascii, AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG) @@ -508,38 +511,22 @@ AcpiDbDisplayInternalObject ( break; - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: - Type = ObjDesc->Common.Type; + Type = ACPI_GET_OBJECT_TYPE (ObjDesc); if (Type > INTERNAL_TYPE_MAX) { - AcpiOsPrintf (" Type %x [Invalid Type]", Type); + AcpiOsPrintf (" Type %hX [Invalid Type]", Type); return; } /* Decode the ACPI object type */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case INTERNAL_TYPE_REFERENCE: switch (ObjDesc->Reference.Opcode) { - case AML_ZERO_OP: - AcpiOsPrintf ("[Const] Zero (0) [Null Target]", 0); - break; - - case AML_ONES_OP: - AcpiOsPrintf ("[Const] Ones (0xFFFFFFFFFFFFFFFF) [No Limit]"); - break; - - case AML_ONE_OP: - AcpiOsPrintf ("[Const] One (1)"); - break; - - case AML_REVISION_OP: - AcpiOsPrintf ("[Const] Revision (%X)", ACPI_CA_SUPPORT_LEVEL); - break; - case AML_LOCAL_OP: AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset); if (WalkState) @@ -570,6 +557,8 @@ AcpiDbDisplayInternalObject ( break; default: + AcpiOsPrintf ("Unknown Reference opcode %X\n", + ObjDesc->Reference.Opcode); break; } @@ -640,14 +629,14 @@ AcpiDbDisplayMethodInfo ( NumArgs = ObjDesc->Method.ParamCount; Concurrency = ObjDesc->Method.Concurrency; - AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", &Node->Name); + AcpiOsPrintf ("Currently executing control method is [%4.4s]\n", Node->Name.Ascii); AcpiOsPrintf ("%X arguments, max concurrency = %X\n", NumArgs, Concurrency); RootOp = StartOp; - while (RootOp->Parent) + while (RootOp->Common.Parent) { - RootOp = RootOp->Parent; + RootOp = RootOp->Common.Parent; } Op = RootOp; @@ -667,7 +656,7 @@ AcpiDbDisplayMethodInfo ( /* Decode the opcode */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); switch (OpInfo->Class) { case AML_CLASS_ARGUMENT: @@ -735,7 +724,7 @@ AcpiDbDisplayLocals (void) ObjDesc = WalkState->MethodDesc; Node = WalkState->MethodNode; - AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", &Node->Name); + AcpiOsPrintf ("Local Variables for method [%4.4s]:\n", Node->Name.Ascii); for (i = 0; i < MTH_NUM_LOCALS; i++) { @@ -783,7 +772,7 @@ AcpiDbDisplayArguments (void) Concurrency = ObjDesc->Method.Concurrency; AcpiOsPrintf ("Method [%4.4s] has %X arguments, max concurrency = %X\n", - &Node->Name, NumArgs, Concurrency); + Node->Name.Ascii, NumArgs, Concurrency); for (i = 0; i < NumArgs; i++) { @@ -832,7 +821,7 @@ AcpiDbDisplayResults (void) } AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n", - &Node->Name, NumResults); + Node->Name.Ascii, NumResults); for (i = 0; i < NumResults; i++) { @@ -858,7 +847,6 @@ AcpiDbDisplayResults (void) void AcpiDbDisplayCallingTree (void) { - UINT32 i; ACPI_WALK_STATE *WalkState; ACPI_NAMESPACE_NODE *Node; @@ -873,11 +861,11 @@ AcpiDbDisplayCallingTree (void) Node = WalkState->MethodNode; AcpiOsPrintf ("Current Control Method Call Tree\n"); - for (i = 0; WalkState; i++) + while (WalkState) { Node = WalkState->MethodNode; - AcpiOsPrintf (" [%4.4s]\n", &Node->Name); + AcpiOsPrintf (" [%4.4s]\n", Node->Name.Ascii); WalkState = WalkState->Next; } diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c index 28cb0b3..e2176ec 100644 --- a/sys/contrib/dev/acpica/dbexec.c +++ b/sys/contrib/dev/acpica/dbexec.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbexec - debugger control method execution - * $Revision: 39 $ + * $Revision: 41 $ * ******************************************************************************/ @@ -116,15 +116,7 @@ #include "acpi.h" -#include "acparser.h" -#include "acdispat.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acevents.h" -#include "acinterp.h" #include "acdebug.h" -#include "actables.h" #ifdef ENABLE_DEBUGGER @@ -132,7 +124,7 @@ ACPI_MODULE_NAME ("dbexec") -ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; +static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo; /******************************************************************************* @@ -222,7 +214,7 @@ AcpiDbExecuteMethod ( void AcpiDbExecuteSetup ( - ACPI_DB_METHOD_INFO *Info) + ACPI_DB_METHOD_INFO *Info) { /* Catenate the current scope to the supplied name */ @@ -270,7 +262,8 @@ AcpiDbExecuteSetup ( ******************************************************************************/ UINT32 -AcpiDbGetOutstandingAllocations (void) +AcpiDbGetOutstandingAllocations ( + void) { UINT32 Outstanding = 0; @@ -415,7 +408,11 @@ AcpiDbMethodThread ( /* Signal our completion */ - AcpiOsSignalSemaphore (Info->ThreadGate, 1); + Status = AcpiOsSignalSemaphore (Info->ThreadGate, 1); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not signal debugger semaphore\n"); + } } @@ -482,7 +479,11 @@ AcpiDbCreateExecutionThreads ( for (i = 0; i < (NumThreads); i++) { - AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo); + Status = AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo); + if (ACPI_FAILURE (Status)) + { + break; + } } /* Wait for all threads to complete */ @@ -496,7 +497,7 @@ AcpiDbCreateExecutionThreads ( /* Cleanup and exit */ - AcpiOsDeleteSemaphore (ThreadGate); + (void) AcpiOsDeleteSemaphore (ThreadGate); AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads); diff --git a/sys/contrib/dev/acpica/dbhistry.c b/sys/contrib/dev/acpica/dbhistry.c index 1aceadc..58cdc50 100644 --- a/sys/contrib/dev/acpica/dbhistry.c +++ b/sys/contrib/dev/acpica/dbhistry.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dbhistry - debugger HISTORY command - * $Revision: 22 $ + * $Revision: 24 $ * *****************************************************************************/ @@ -116,15 +116,7 @@ #include "acpi.h" -#include "acparser.h" -#include "acdispat.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acevents.h" -#include "acinterp.h" #include "acdebug.h" -#include "actables.h" #ifdef ENABLE_DEBUGGER @@ -145,11 +137,11 @@ typedef struct HistoryInfo } HISTORY_INFO; -HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE]; -UINT16 AcpiGbl_LoHistory = 0; -UINT16 AcpiGbl_NumHistory = 0; -UINT16 AcpiGbl_NextHistoryIndex = 0; -UINT32 AcpiGbl_NextCmdNum = 1; +static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE]; +static UINT16 AcpiGbl_LoHistory = 0; +static UINT16 AcpiGbl_NumHistory = 0; +static UINT16 AcpiGbl_NextHistoryIndex = 0; +static UINT32 AcpiGbl_NextCmdNum = 1; /******************************************************************************* diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c index f669ddb..bc3c385 100644 --- a/sys/contrib/dev/acpica/dbinput.c +++ b/sys/contrib/dev/acpica/dbinput.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbinput - user front-end to the AML debugger - * $Revision: 81 $ + * $Revision: 86 $ * ******************************************************************************/ @@ -116,10 +116,6 @@ #include "acpi.h" -#include "acparser.h" -#include "actables.h" -#include "acnamesp.h" -#include "acinterp.h" #include "acdebug.h" @@ -158,6 +154,7 @@ enum AcpiExDebuggerCommands CMD_HISTORY_EXE, CMD_HISTORY_LAST, CMD_INFORMATION, + CMD_INTEGRITY, CMD_INTO, CMD_LEVEL, CMD_LIST, @@ -188,7 +185,7 @@ enum AcpiExDebuggerCommands #define CMD_FIRST_VALID 2 -const COMMAND_INFO AcpiGbl_DbCommands[] = +static const COMMAND_INFO AcpiGbl_DbCommands[] = { {"<NOT FOUND>", 0}, {"<NULL>", 0}, @@ -212,6 +209,7 @@ const COMMAND_INFO AcpiGbl_DbCommands[] = {"!", 1}, {"!!", 0}, {"INFORMATION", 0}, + {"INTEGRITY", 0}, {"INTO", 0}, {"LEVEL", 0}, {"LIST", 0}, @@ -343,7 +341,7 @@ AcpiDbDisplayHelp ( return; default: - AcpiOsPrintf ("Unrecognized Command Class: %x\n", HelpType); + AcpiOsPrintf ("Unrecognized Command Class: %X\n", HelpType); return; } } @@ -618,7 +616,7 @@ AcpiDbCommandDispatch ( break; case CMD_FIND: - AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); + Status = AcpiDbFindNameInNamespace (AcpiGbl_DbArgs[1]); break; case CMD_GO: @@ -666,6 +664,10 @@ AcpiDbCommandDispatch ( AcpiDbDisplayMethodInfo (Op); break; + case CMD_INTEGRITY: + AcpiDbCheckIntegrity (); + break; + case CMD_INTO: if (Op) { @@ -715,7 +717,7 @@ AcpiDbCommandDispatch ( break; case CMD_METHODS: - AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); + Status = AcpiDbDisplayObjects ("METHOD", AcpiGbl_DbArgs[1]); break; case CMD_NAMESPACE: @@ -728,7 +730,8 @@ AcpiDbCommandDispatch ( break; case CMD_OBJECT: - AcpiDbDisplayObjects (ACPI_STRUPR (AcpiGbl_DbArgs[1]), AcpiGbl_DbArgs[2]); + ACPI_STRUPR (AcpiGbl_DbArgs[1]); + Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]); break; case CMD_OPEN: @@ -760,11 +763,11 @@ AcpiDbCommandDispatch ( break; case CMD_STATS: - AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); + Status = AcpiDbDisplayStatistics (AcpiGbl_DbArgs[1]); break; case CMD_STOP: - return (AE_AML_ERROR); + return (AE_NOT_IMPLEMENTED); case CMD_TABLES: AcpiDbDisplayTableInfo (AcpiGbl_DbArgs[1]); @@ -814,6 +817,7 @@ AcpiDbCommandDispatch ( return (AE_CTRL_TERMINATE); case CMD_NOT_FOUND: + default: AcpiOsPrintf ("Unknown Command\n"); return (AE_CTRL_TRUE); } @@ -886,13 +890,11 @@ void AcpiDbSingleThread ( void) { - ACPI_STATUS Status; - AcpiGbl_MethodExecuting = FALSE; AcpiGbl_StepToNextCall = FALSE; - Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); + (void) AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, NULL, NULL); } @@ -939,8 +941,7 @@ AcpiDbUserCommands ( /* Get the user input line */ - AcpiOsGetLine (AcpiGbl_DbLineBuf); - + (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); /* Check for single or multithreaded debug */ @@ -974,7 +975,7 @@ AcpiDbUserCommands ( * Only this thread (the original thread) should actually terminate the subsystem, * because all the semaphores are deleted during termination */ - AcpiTerminate (); + Status = AcpiTerminate (); return (Status); } diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c index ae09193..a6db41e 100644 --- a/sys/contrib/dev/acpica/dbstats.c +++ b/sys/contrib/dev/acpica/dbstats.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbstats - Generation and display of ACPI table statistics - * $Revision: 55 $ + * $Revision: 60 $ * ******************************************************************************/ @@ -117,8 +117,6 @@ #include <acpi.h> #include <acdebug.h> -#include <amlcode.h> -#include <acparser.h> #include <acnamesp.h> #ifdef ENABLE_DEBUGGER @@ -129,7 +127,7 @@ /* * Statistics subcommands */ -ARGUMENT_INFO AcpiDbStatTypes [] = +static ARGUMENT_INFO AcpiDbStatTypes [] = { {"ALLOCATIONS"}, {"OBJECTS"}, @@ -141,13 +139,13 @@ ARGUMENT_INFO AcpiDbStatTypes [] = {NULL} /* Must be null terminated */ }; -#define CMD_ALLOCATIONS 0 -#define CMD_OBJECTS 1 -#define CMD_MEMORY 2 -#define CMD_MISC 3 -#define CMD_TABLES 4 -#define CMD_SIZES 5 -#define CMD_STACK 6 +#define CMD_STAT_ALLOCATIONS 0 +#define CMD_STAT_OBJECTS 1 +#define CMD_STAT_MEMORY 2 +#define CMD_STAT_MISC 3 +#define CMD_STAT_TABLES 4 +#define CMD_STAT_SIZES 5 +#define CMD_STAT_STACK 6 /******************************************************************************* @@ -181,18 +179,18 @@ AcpiDbEnumerateObject ( AcpiGbl_NumObjects++; - if (ObjDesc->Common.Type > INTERNAL_TYPE_NODE_MAX) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) > INTERNAL_TYPE_NODE_MAX) { AcpiGbl_ObjTypeCountMisc++; } else { - AcpiGbl_ObjTypeCount [ObjDesc->Common.Type]++; + AcpiGbl_ObjTypeCount [ACPI_GET_OBJECT_TYPE (ObjDesc)]++; } /* Count the sub-objects */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_PACKAGE: for (i = 0; i < ObjDesc->Package.Count; i++) @@ -235,6 +233,9 @@ AcpiDbEnumerateObject ( AcpiDbEnumerateObject (ObjDesc->ThermalZone.DrvHandler); AcpiDbEnumerateObject (ObjDesc->ThermalZone.AddrHandler); break; + + default: + break; } } @@ -324,7 +325,7 @@ AcpiDbClassifyOneObject ( * ******************************************************************************/ -ACPI_STATUS +void AcpiDbCountNamespaceObjects ( void) { @@ -341,10 +342,8 @@ AcpiDbCountNamespaceObjects ( AcpiGbl_NodeTypeCount [i] = 0; } - AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, + (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL); - - return (AE_OK); } #endif @@ -397,14 +396,14 @@ AcpiDbDisplayStatistics ( switch (Type) { #ifndef PARSER_ONLY - case CMD_ALLOCATIONS: + case CMD_STAT_ALLOCATIONS: #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiUtDumpAllocationInfo (); #endif break; #endif - case CMD_TABLES: + case CMD_STAT_TABLES: AcpiOsPrintf ("ACPI Table Information:\n\n"); if (AcpiGbl_DSDT) @@ -413,7 +412,7 @@ AcpiDbDisplayStatistics ( } break; - case CMD_OBJECTS: + case CMD_STAT_OBJECTS: #ifndef PARSER_ONLY @@ -437,7 +436,7 @@ AcpiDbDisplayStatistics ( #endif break; - case CMD_MEMORY: + case CMD_STAT_MEMORY: #ifdef ACPI_DBG_TRACK_ALLOCATIONS AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n"); @@ -483,7 +482,7 @@ AcpiDbDisplayStatistics ( break; - case CMD_MISC: + case CMD_STAT_MISC: AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n"); AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", AcpiGbl_PsFindCount); @@ -499,7 +498,7 @@ AcpiDbDisplayStatistics ( break; - case CMD_SIZES: + case CMD_STAT_SIZES: AcpiOsPrintf ("\nInternal object sizes:\n\n"); @@ -528,23 +527,29 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("\n"); - AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJECT)); - AcpiOsPrintf ("Parse2Object %3d\n", sizeof (ACPI_PARSE2_OBJECT)); + AcpiOsPrintf ("ParseObject %3d\n", sizeof (ACPI_PARSE_OBJ_COMMON)); + AcpiOsPrintf ("ParseObjectNamed %3d\n", sizeof (ACPI_PARSE_OBJ_NAMED)); + AcpiOsPrintf ("ParseObjectAsl %3d\n", sizeof (ACPI_PARSE_OBJ_ASL)); AcpiOsPrintf ("OperandObject %3d\n", sizeof (ACPI_OPERAND_OBJECT)); AcpiOsPrintf ("NamespaceNode %3d\n", sizeof (ACPI_NAMESPACE_NODE)); break; - case CMD_STACK: + case CMD_STAT_STACK: +#if defined(ACPI_DEBUG) - Size = AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer; + Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer); AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n"); AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer); AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer); AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size); AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting); +#endif + break; + + default: break; } diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c index c97b72a..f939f35 100644 --- a/sys/contrib/dev/acpica/dbutils.c +++ b/sys/contrib/dev/acpica/dbutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbutils - AML debugger utilities - * $Revision: 52 $ + * $Revision: 55 $ * ******************************************************************************/ @@ -119,9 +119,6 @@ #include "acparser.h" #include "amlcode.h" #include "acnamesp.h" -#include "acparser.h" -#include "acevents.h" -#include "acinterp.h" #include "acdebug.h" #include "acdispat.h" @@ -362,7 +359,7 @@ AcpiDbSecondPassParse ( ACPI_PARSE_OBJECT *Root) { ACPI_PARSE_OBJECT *Op = Root; - ACPI_PARSE2_OBJECT *Method; + ACPI_PARSE_OBJECT *Method; ACPI_PARSE_OBJECT *SearchOp; ACPI_PARSE_OBJECT *StartOp; ACPI_STATUS Status = AE_OK; @@ -375,12 +372,13 @@ AcpiDbSecondPassParse ( AcpiOsPrintf ("Pass two parse ....\n"); - while (Op) { - if (Op->Opcode == AML_METHOD_OP) + if (Op->Common.AmlOpcode == AML_METHOD_OP) { - Method = (ACPI_PARSE2_OBJECT *) Op; + Method = Op; + + /* Create a new walk state for the parse */ WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); @@ -389,33 +387,33 @@ AcpiDbSecondPassParse ( return (AE_NO_MEMORY); } + /* Init the Walk State */ WalkState->ParserState.Aml = - WalkState->ParserState.AmlStart = Method->Data; + WalkState->ParserState.AmlStart = Method->Named.Data; WalkState->ParserState.AmlEnd = - WalkState->ParserState.PkgEnd = Method->Data + Method->Length; + WalkState->ParserState.PkgEnd = Method->Named.Data + Method->Named.Length; WalkState->ParserState.StartScope = Op; WalkState->DescendingCallback = AcpiDsLoad1BeginOp; WalkState->AscendingCallback = AcpiDsLoad1EndOp; + /* Perform the AML parse */ Status = AcpiPsParseAml (WalkState); - - BaseAmlOffset = (Method->Value.Arg)->AmlOffset + 1; - StartOp = (Method->Value.Arg)->Next; + BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1; + StartOp = (Method->Common.Value.Arg)->Common.Next; SearchOp = StartOp; while (SearchOp) { - SearchOp->AmlOffset += BaseAmlOffset; + SearchOp->Common.AmlOffset += BaseAmlOffset; SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); } - } - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { /* TBD: [Investigate] this isn't quite the right thing to do! */ /* diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c index 9225aff..fe2f8c7 100644 --- a/sys/contrib/dev/acpica/dbxface.c +++ b/sys/contrib/dev/acpica/dbxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbxface - AML Debugger external interfaces - * $Revision: 55 $ + * $Revision: 59 $ * ******************************************************************************/ @@ -116,12 +116,7 @@ #include "acpi.h" -#include "acparser.h" #include "amlcode.h" -#include "acnamesp.h" -#include "acparser.h" -#include "acevents.h" -#include "acinterp.h" #include "acdebug.h" @@ -162,12 +157,13 @@ AcpiDbSingleStep ( /* Check for single-step breakpoint */ - if (WalkState->MethodBreakpoint && (WalkState->MethodBreakpoint <= Op->AmlOffset)) + if (WalkState->MethodBreakpoint && + (WalkState->MethodBreakpoint <= Op->Common.AmlOffset)) { /* Check if the breakpoint has been reached or passed */ /* Hit the breakpoint, resume single step, reset breakpoint */ - AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->AmlOffset); + AcpiOsPrintf ("***Break*** at AML offset %X\n", Op->Common.AmlOffset); AcpiGbl_CmSingleStep = TRUE; AcpiGbl_StepToNextCall = FALSE; WalkState->MethodBreakpoint = 0; @@ -175,9 +171,10 @@ AcpiDbSingleStep ( /* Check for user breakpoint (Must be on exact Aml offset) */ - else if (WalkState->UserBreakpoint && (WalkState->UserBreakpoint == Op->AmlOffset)) + else if (WalkState->UserBreakpoint && + (WalkState->UserBreakpoint == Op->Common.AmlOffset)) { - AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", Op->AmlOffset); + AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", Op->Common.AmlOffset); AcpiGbl_CmSingleStep = TRUE; AcpiGbl_StepToNextCall = FALSE; WalkState->MethodBreakpoint = 0; @@ -188,7 +185,7 @@ AcpiDbSingleStep ( * Check if this is an opcode that we are interested in -- * namely, opcodes that have arguments */ - if (Op->Opcode == AML_INT_NAMEDFIELD_OP) + if (Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { return (AE_OK); } @@ -198,6 +195,10 @@ AcpiDbSingleStep ( case AML_CLASS_UNKNOWN: case AML_CLASS_ARGUMENT: /* constants, literals, etc. do nothing */ return (AE_OK); + + default: + /* All other opcodes -- continue */ + break; } /* @@ -220,12 +221,12 @@ AcpiDbSingleStep ( */ OriginalDebugLevel = AcpiDbgLevel; AcpiDbgLevel &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS); - Next = Op->Next; - Op->Next = NULL; + Next = Op->Common.Next; + Op->Common.Next = NULL; DisplayOp = Op; - ParentOp = Op->Parent; + ParentOp = Op->Common.Parent; if (ParentOp) { if ((WalkState->ControlState) && @@ -238,29 +239,29 @@ AcpiDbSingleStep ( */ while (ParentOp) { - if ((ParentOp->Opcode == AML_IF_OP) || - (ParentOp->Opcode == AML_WHILE_OP)) + if ((ParentOp->Common.AmlOpcode == AML_IF_OP) || + (ParentOp->Common.AmlOpcode == AML_WHILE_OP)) { DisplayOp = ParentOp; break; } - ParentOp = ParentOp->Parent; + ParentOp = ParentOp->Common.Parent; } } else { while (ParentOp) { - if ((ParentOp->Opcode == AML_IF_OP) || - (ParentOp->Opcode == AML_ELSE_OP) || - (ParentOp->Opcode == AML_SCOPE_OP) || - (ParentOp->Opcode == AML_METHOD_OP) || - (ParentOp->Opcode == AML_WHILE_OP)) + if ((ParentOp->Common.AmlOpcode == AML_IF_OP) || + (ParentOp->Common.AmlOpcode == AML_ELSE_OP) || + (ParentOp->Common.AmlOpcode == AML_SCOPE_OP) || + (ParentOp->Common.AmlOpcode == AML_METHOD_OP) || + (ParentOp->Common.AmlOpcode == AML_WHILE_OP)) { break; } DisplayOp = ParentOp; - ParentOp = ParentOp->Parent; + ParentOp = ParentOp->Common.Parent; } } } @@ -269,8 +270,8 @@ AcpiDbSingleStep ( AcpiDbDisplayOp (WalkState, DisplayOp, ACPI_UINT32_MAX); - if ((Op->Opcode == AML_IF_OP) || - (Op->Opcode == AML_WHILE_OP)) + if ((Op->Common.AmlOpcode == AML_IF_OP) || + (Op->Common.AmlOpcode == AML_WHILE_OP)) { if (WalkState->ControlState->Common.Value) { @@ -282,14 +283,14 @@ AcpiDbSingleStep ( } } - else if (Op->Opcode == AML_ELSE_OP) + else if (Op->Common.AmlOpcode == AML_ELSE_OP) { AcpiOsPrintf ("Predicate = [False], ELSE block was executed\n"); } /* Restore everything */ - Op->Next = Next; + Op->Common.Next = Next; AcpiOsPrintf ("\n"); AcpiDbgLevel = OriginalDebugLevel; } @@ -307,7 +308,7 @@ AcpiDbSingleStep ( */ if (AcpiGbl_StepToNextCall) { - if (Op->Opcode != AML_INT_METHODCALL_OP) + if (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP) { /* Not a method call, just keep executing */ @@ -323,7 +324,7 @@ AcpiDbSingleStep ( * If the next opcode is a method call, we will "step over" it * by default. */ - if (Op->Opcode == AML_INT_METHODCALL_OP) + if (Op->Common.AmlOpcode == AML_INT_METHODCALL_OP) { AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */ @@ -380,7 +381,7 @@ AcpiDbSingleStep ( /* Get the user input line */ - AcpiOsGetLine (AcpiGbl_DbLineBuf); + (void) AcpiOsGetLine (AcpiGbl_DbLineBuf); } Status = AcpiDbCommandDispatch (AcpiGbl_DbLineBuf, WalkState, Op); @@ -406,9 +407,11 @@ AcpiDbSingleStep ( * ******************************************************************************/ -int +ACPI_STATUS AcpiDbInitialize (void) { + ACPI_STATUS Status; + /* Init globals */ @@ -429,7 +432,7 @@ AcpiDbInitialize (void) AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); if (!AcpiGbl_DbBuffer) { - return 0; + return (AE_NO_MEMORY); } ACPI_MEMSET (AcpiGbl_DbBuffer, 0, ACPI_DEBUG_BUFFER_SIZE); @@ -448,12 +451,27 @@ AcpiDbInitialize (void) { /* These were created with one unit, grab it */ - AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not get debugger mutex\n"); + return (Status); + } + Status = AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not get debugger mutex\n"); + return (Status); + } /* Create the debug execution thread to execute commands */ - AcpiOsQueueForExecution (0, AcpiDbExecuteThread, NULL); + Status = AcpiOsQueueForExecution (0, AcpiDbExecuteThread, NULL); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not start debugger thread\n"); + return (Status); + } } if (!AcpiGbl_DbOpt_verbose) @@ -463,7 +481,7 @@ AcpiDbInitialize (void) AcpiGbl_DbOpt_stats = FALSE; } - return (0); + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c index 87dd8c0..9188b8d 100644 --- a/sys/contrib/dev/acpica/dsfield.c +++ b/sys/contrib/dev/acpica/dsfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsfield - Dispatcher field routines - * $Revision: 62 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -166,7 +166,7 @@ AcpiDsCreateBufferField ( /* Get the NameString argument */ - if (Op->Opcode == AML_CREATE_FIELD_OP) + if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) { Arg = AcpiPsGetArg (Op, 3); } @@ -199,7 +199,7 @@ AcpiDsCreateBufferField ( /* * Enter the NameString into the namespace */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); if (ACPI_FAILURE (Status)) @@ -211,7 +211,7 @@ AcpiDsCreateBufferField ( * for now, we will put it in the "op" object that the parser uses, so we * can get it again at the end of this scope */ - Op->Node = Node; + Op->Common.Node = Node; /* * If there is no object attached to the node, this node was just created and @@ -244,8 +244,8 @@ AcpiDsCreateBufferField ( * operands must be evaluated. */ SecondDesc = ObjDesc->Common.NextObject; - SecondDesc->Extra.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data; - SecondDesc->Extra.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length; + SecondDesc->Extra.AmlStart = Op->Named.Data; + SecondDesc->Extra.AmlLength = Op->Named.Length; ObjDesc->BufferField.Node = Node; /* Attach constructed field descriptors to parent node */ @@ -288,6 +288,7 @@ AcpiDsGetFieldNames ( ACPI_PARSE_OBJECT *Arg) { ACPI_STATUS Status; + ACPI_INTEGER Position; ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info); @@ -307,18 +308,20 @@ AcpiDsGetFieldNames ( * 2) AccessAs - changes the access mode * 3) Name - Enters a new named field into the namespace */ - switch (Arg->Opcode) + switch (Arg->Common.AmlOpcode) { case AML_INT_RESERVEDFIELD_OP: - if (((ACPI_INTEGER) Info->FieldBitPosition + Arg->Value.Size) > - ACPI_UINT32_MAX) + Position = (ACPI_INTEGER) Info->FieldBitPosition + + (ACPI_INTEGER) Arg->Common.Value.Size; + + if (Position > ACPI_UINT32_MAX) { ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); return_ACPI_STATUS (AE_SUPPORT); } - Info->FieldBitPosition += Arg->Value.Size; + Info->FieldBitPosition = (UINT32) Position; break; @@ -331,9 +334,9 @@ AcpiDsGetFieldNames ( * In FieldFlags, preserve the flag bits other than the ACCESS_TYPE bits */ Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | - ((UINT8) (Arg->Value.Integer32 >> 8))); + ((UINT8) (Arg->Common.Value.Integer32 >> 8))); - Info->Attribute = (UINT8) (Arg->Value.Integer32); + Info->Attribute = (UINT8) (Arg->Common.Value.Integer32); break; @@ -342,7 +345,7 @@ AcpiDsGetFieldNames ( /* Lookup the name */ Status = AcpiNsLookup (WalkState->ScopeInfo, - (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, + (NATIVE_CHAR *) &Arg->Named.Name, Info->FieldType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) @@ -353,12 +356,12 @@ AcpiDsGetFieldNames ( } ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", - &((ACPI_PARSE2_OBJECT *)Arg)->Name)); + &Arg->Named.Name)); } else { - Arg->Node = Info->FieldNode; - Info->FieldBitLength = Arg->Value.Size; + Arg->Common.Node = Info->FieldNode; + Info->FieldBitLength = Arg->Common.Value.Size; /* Create and initialize an object for the new Field Node */ @@ -371,8 +374,10 @@ AcpiDsGetFieldNames ( /* Keep track of bit position for the next field */ - if (((ACPI_INTEGER) Info->FieldBitPosition + Arg->Value.Size) > - ACPI_UINT32_MAX) + Position = (ACPI_INTEGER) Info->FieldBitPosition + + (ACPI_INTEGER) Arg->Common.Value.Size; + + if (Position > ACPI_UINT32_MAX) { ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", &Info->FieldNode->Name)); @@ -386,11 +391,11 @@ AcpiDsGetFieldNames ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", - Arg->Opcode)); - return_ACPI_STATUS (AE_AML_ERROR); + Arg->Common.AmlOpcode)); + return_ACPI_STATUS (AE_AML_BAD_OPCODE); } - Arg = Arg->Next; + Arg = Arg->Common.Next; } return_ACPI_STATUS (AE_OK); @@ -417,7 +422,7 @@ AcpiDsCreateField ( ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status = AE_AML_ERROR; + ACPI_STATUS Status; ACPI_PARSE_OBJECT *Arg; ACPI_CREATE_FIELD_INFO Info; @@ -427,10 +432,10 @@ AcpiDsCreateField ( /* First arg is the name of the parent OpRegion (must already exist) */ - Arg = Op->Value.Arg; + Arg = Op->Common.Value.Arg; if (!RegionNode) { - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name, + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); if (ACPI_FAILURE (Status)) @@ -441,8 +446,8 @@ AcpiDsCreateField ( /* Second arg is the field flags */ - Arg = Arg->Next; - Info.FieldFlags = Arg->Value.Integer8; + Arg = Arg->Common.Next; + Info.FieldFlags = Arg->Common.Value.Integer8; Info.Attribute = 0; /* Each remaining arg is a Named Field */ @@ -450,7 +455,7 @@ AcpiDsCreateField ( Info.FieldType = INTERNAL_TYPE_REGION_FIELD; Info.RegionNode = RegionNode; - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Next); + Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); return_ACPI_STATUS (Status); } @@ -476,7 +481,7 @@ AcpiDsInitFieldObjects ( ACPI_PARSE_OBJECT *Op, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status = AE_AML_ERROR; + ACPI_STATUS Status; ACPI_PARSE_OBJECT *Arg = NULL; ACPI_NAMESPACE_NODE *Node; UINT8 Type = 0; @@ -501,6 +506,9 @@ AcpiDsInitFieldObjects ( Arg = AcpiPsGetArg (Op, 3); Type = INTERNAL_TYPE_INDEX_FIELD; break; + + default: + return_ACPI_STATUS (AE_BAD_PARAMETER); } /* @@ -510,10 +518,10 @@ AcpiDsInitFieldObjects ( { /* Ignore OFFSET and ACCESSAS terms here */ - if (Arg->Opcode == AML_INT_NAMEDFIELD_OP) + if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { Status = AcpiNsLookup (WalkState->ScopeInfo, - (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, + (NATIVE_CHAR *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, WalkState, &Node); @@ -525,18 +533,22 @@ AcpiDsInitFieldObjects ( } ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", - &((ACPI_PARSE2_OBJECT *)Arg)->Name)); + &Arg->Named.Name)); + + /* Name already exists, just ignore this error */ + + Status = AE_OK; } - Arg->Node = Node; + Arg->Common.Node = Node; } /* Move to next field in the list */ - Arg = Arg->Next; + Arg = Arg->Common.Next; } - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } @@ -560,7 +572,7 @@ AcpiDsCreateBankField ( ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status = AE_AML_ERROR; + ACPI_STATUS Status; ACPI_PARSE_OBJECT *Arg; ACPI_CREATE_FIELD_INFO Info; @@ -570,10 +582,10 @@ AcpiDsCreateBankField ( /* First arg is the name of the parent OpRegion (must already exist) */ - Arg = Op->Value.Arg; + Arg = Op->Common.Value.Arg; if (!RegionNode) { - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name, + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); if (ACPI_FAILURE (Status)) @@ -584,8 +596,8 @@ AcpiDsCreateBankField ( /* Second arg is the Bank Register (must already exist) */ - Arg = Arg->Next; - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + Arg = Arg->Common.Next; + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) @@ -595,20 +607,20 @@ AcpiDsCreateBankField ( /* Third arg is the BankValue */ - Arg = Arg->Next; - Info.BankValue = Arg->Value.Integer32; + Arg = Arg->Common.Next; + Info.BankValue = Arg->Common.Value.Integer32; /* Fourth arg is the field flags */ - Arg = Arg->Next; - Info.FieldFlags = Arg->Value.Integer8; + Arg = Arg->Common.Next; + Info.FieldFlags = Arg->Common.Value.Integer8; /* Each remaining arg is a Named Field */ Info.FieldType = INTERNAL_TYPE_BANK_FIELD; Info.RegionNode = RegionNode; - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Next); + Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); return_ACPI_STATUS (Status); } @@ -644,8 +656,8 @@ AcpiDsCreateIndexField ( /* First arg is the name of the Index register (must already exist) */ - Arg = Op->Value.Arg; - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + Arg = Op->Common.Value.Arg; + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) @@ -655,8 +667,8 @@ AcpiDsCreateIndexField ( /* Second arg is the data register (must already exist) */ - Arg = Arg->Next; - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + Arg = Arg->Common.Next; + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); if (ACPI_FAILURE (Status)) @@ -666,8 +678,8 @@ AcpiDsCreateIndexField ( /* Next arg is the field flags */ - Arg = Arg->Next; - Info.FieldFlags = Arg->Value.Integer8; + Arg = Arg->Common.Next; + Info.FieldFlags = Arg->Common.Value.Integer8; /* Each remaining arg is a Named Field */ @@ -675,7 +687,7 @@ AcpiDsCreateIndexField ( Info.FieldType = INTERNAL_TYPE_INDEX_FIELD; Info.RegionNode = RegionNode; - Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Next); + Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c index 1b9a262..bab521a 100644 --- a/sys/contrib/dev/acpica/dsmethod.c +++ b/sys/contrib/dev/acpica/dsmethod.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsmethod - Parser/Interpreter interface - control method parsing - * $Revision: 81 $ + * $Revision: 86 $ * *****************************************************************************/ @@ -122,8 +122,6 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "actables.h" -#include "acdebug.h" #define _COMPONENT ACPI_DISPATCHER @@ -171,7 +169,7 @@ AcpiDsParseMethod ( } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n", - (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle)); + ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle)); /* Extract the method object from the method Node */ @@ -209,7 +207,7 @@ AcpiDsParseMethod ( /* Init new op with the method name and pointer back to the Node */ AcpiPsSetName (Op, Node->Name.Integer); - Op->Node = Node; + Op->Common.Node = Node; /* * Get a new OwnerId for objects created by this method. Namespace @@ -221,8 +219,7 @@ AcpiDsParseMethod ( /* Create and initialize a new walk state */ - WalkState = AcpiDsCreateWalkState (OwnerId, - NULL, NULL, NULL); + WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL); if (!WalkState) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -252,8 +249,9 @@ AcpiDsParseMethod ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", - (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, ObjHandle, Op)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", + ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, ObjHandle, Op)); AcpiPsDeleteParseTree (Op); return_ACPI_STATUS (Status); @@ -461,8 +459,8 @@ AcpiDsCallControlMethod ( ThisWalkState->NumOperands = 0; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Starting nested execution, newstate=%p\n", - NextWalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Starting nested execution, newstate=%p\n", NextWalkState)); return_ACPI_STATUS (AE_OK); @@ -470,7 +468,7 @@ AcpiDsCallControlMethod ( /* On error, we must delete the new walk state */ Cleanup: - AcpiDsTerminateControlMethod (NextWalkState); + (void) AcpiDsTerminateControlMethod (NextWalkState); AcpiDsDeleteWalkState (NextWalkState); return_ACPI_STATUS (Status); @@ -561,6 +559,11 @@ AcpiDsTerminateControlMethod ( ACPI_FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState); + if (!WalkState) + { + return (AE_BAD_PARAMETER); + } + /* The current method object was saved in the walk state */ ObjDesc = WalkState->MethodDesc; @@ -588,8 +591,15 @@ AcpiDsTerminateControlMethod ( if (WalkState->MethodDesc->Method.Semaphore) { - AcpiOsSignalSemaphore ( - WalkState->MethodDesc->Method.Semaphore, 1); + Status = AcpiOsSignalSemaphore ( + WalkState->MethodDesc->Method.Semaphore, 1); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not signal method semaphore\n")); + Status = AE_OK; + + /* Ignore error and continue cleanup */ + } } /* Decrement the thread count on the method parse tree */ diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c index d55ed30..12bfc85 100644 --- a/sys/contrib/dev/acpica/dsmthdat.c +++ b/sys/contrib/dev/acpica/dsmthdat.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 59 $ + * $Revision: 62 $ * ******************************************************************************/ @@ -117,9 +117,7 @@ #define __DSMTHDAT_C__ #include "acpi.h" -#include "acparser.h" #include "acdispat.h" -#include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" @@ -149,7 +147,7 @@ * ******************************************************************************/ -ACPI_STATUS +void AcpiDsMethodDataInit ( ACPI_WALK_STATE *WalkState) { @@ -184,7 +182,7 @@ AcpiDsMethodDataInit ( WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL; } - return_ACPI_STATUS (AE_OK); + return_VOID; } @@ -194,14 +192,14 @@ AcpiDsMethodDataInit ( * * PARAMETERS: WalkState - Current walk state object * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Delete method locals and arguments. Arguments are only * deleted if this method was called from another method. * ******************************************************************************/ -ACPI_STATUS +void AcpiDsMethodDataDeleteAll ( ACPI_WALK_STATE *WalkState) { @@ -223,7 +221,7 @@ AcpiDsMethodDataDeleteAll ( /* Detach object (if present) and remove a reference */ AcpiNsDetachObject (&WalkState->LocalVariables[Index]); - } + } } /* Detach the arguments */ @@ -241,7 +239,7 @@ AcpiDsMethodDataDeleteAll ( } } - return_ACPI_STATUS (AE_OK); + return_VOID; } @@ -463,7 +461,7 @@ AcpiDsMethodDataGetType ( /* Get the object type */ - return_VALUE (Object->Common.Type); + return_VALUE (ACPI_GET_OBJECT_TYPE (Object)); } @@ -546,6 +544,9 @@ AcpiDsMethodDataGetValue ( Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); + + default: + return_ACPI_STATUS (AE_AML_INTERNAL); } } @@ -568,14 +569,14 @@ AcpiDsMethodDataGetValue ( * Index - Which localVar or argument to delete * WalkState - Current walk state object * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts * a null into the stack slot after the object is deleted. * ******************************************************************************/ -ACPI_STATUS +void AcpiDsMethodDataDeleteValue ( UINT16 Opcode, UINT32 Index, @@ -594,7 +595,7 @@ AcpiDsMethodDataDeleteValue ( Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + return_VOID; } /* Get the associated object */ @@ -609,7 +610,7 @@ AcpiDsMethodDataDeleteValue ( Node->Object = NULL; if ((Object) && - (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_INTERNAL)) + (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_OPERAND)) { /* * There is a valid object. @@ -619,7 +620,7 @@ AcpiDsMethodDataDeleteValue ( AcpiUtRemoveReference (Object); } - return_ACPI_STATUS (AE_OK); + return_VOID; } @@ -719,7 +720,7 @@ AcpiDsStoreObjectToLocal ( * (perform the indirect store) */ Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) CurrentObjDesc, - ObjDesc, ObjDesc->Common.Type); + ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc)); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c index d367c91..3a1ca0d 100644 --- a/sys/contrib/dev/acpica/dsobject.c +++ b/sys/contrib/dev/acpica/dsobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 91 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -120,8 +120,8 @@ #include "acparser.h" #include "amlcode.h" #include "acdispat.h" -#include "acinterp.h" #include "acnamesp.h" +#include "acinterp.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsobject") @@ -157,15 +157,11 @@ AcpiDsInitOneObject ( ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; - UINT8 TableRevision; ACPI_FUNCTION_NAME ("DsInitOneObject"); - Info->ObjectCount++; - TableRevision = Info->TableDesc->Pointer->Revision; - /* * We are only interested in objects owned by the table that * was just loaded @@ -176,6 +172,8 @@ AcpiDsInitOneObject ( return (AE_OK); } + Info->ObjectCount++; + /* And even then, we are only interested in a few object types */ Type = AcpiNsGetType (ObjHandle); @@ -184,7 +182,13 @@ AcpiDsInitOneObject ( { case ACPI_TYPE_REGION: - AcpiDsInitializeRegion (ObjHandle); + Status = AcpiDsInitializeRegion (ObjHandle); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n", + ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, + AcpiFormatException (Status))); + } Info->OpRegionCount++; break; @@ -202,10 +206,12 @@ AcpiDsInitOneObject ( /* * Set the execution data width (32 or 64) based upon the * revision number of the parent ACPI table. + * TBD: This is really for possible future support of integer width + * on a per-table basis. Currently, we just use a global for the width. */ - if (TableRevision == 1) + if (Info->TableDesc->Pointer->Revision == 1) { - ((ACPI_NAMESPACE_NODE *)ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32; + ((ACPI_NAMESPACE_NODE *) ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32; } /* @@ -216,7 +222,7 @@ AcpiDsInitOneObject ( if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", - ObjHandle, (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, + ObjHandle, ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii, AcpiFormatException (Status))); /* This parse failed, but we will continue parsing more methods */ @@ -232,6 +238,13 @@ AcpiDsInitOneObject ( AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId); break; + + case ACPI_TYPE_DEVICE: + + Info->DeviceCount++; + break; + + default: break; } @@ -274,10 +287,10 @@ AcpiDsInitializeObjects ( "**** Starting initialization of namespace objects ****\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Parsing Methods:")); - Info.MethodCount = 0; Info.OpRegionCount = 0; Info.ObjectCount = 0; + Info.DeviceCount = 0; Info.TableDesc = TableDesc; /* Walk entire namespace from the supplied root */ @@ -286,16 +299,17 @@ AcpiDsInitializeObjects ( AcpiDsInitOneObject, &Info, NULL); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed, %s\n", + AcpiFormatException (Status))); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "\n%d Control Methods found and parsed (%d nodes total)\n", - Info.MethodCount, Info.ObjectCount)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%d Control Methods found\n", Info.MethodCount)); + "\nTable [%4.4s] - %hd Objects with %hd Devices %hd Methods %hd Regions\n", + TableDesc->Pointer->Signature, Info.ObjectCount, + Info.DeviceCount, Info.MethodCount, Info.OpRegionCount)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%d Op Regions found\n", Info.OpRegionCount)); + "%hd Methods, %hd Regions\n", Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } @@ -327,9 +341,10 @@ AcpiDsInitObjectFromOp ( { const ACPI_OPCODE_INFO *OpInfo; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status = AE_OK; - ACPI_FUNCTION_NAME ("DsInitObjectFromOp"); + ACPI_FUNCTION_TRACE ("DsInitObjectFromOp"); ObjDesc = *RetObjDesc; @@ -338,12 +353,12 @@ AcpiDsInitObjectFromOp ( { /* Unknown opcode */ - return (AE_TYPE); + return_ACPI_STATUS (AE_TYPE); } /* Perform per-object initialization */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_BUFFER: @@ -351,8 +366,8 @@ AcpiDsInitObjectFromOp ( * Defer evaluation of Buffer TermArg operand */ ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; - ObjDesc->Buffer.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data; - ObjDesc->Buffer.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length; + ObjDesc->Buffer.AmlStart = Op->Named.Data; + ObjDesc->Buffer.AmlLength = Op->Named.Length; break; @@ -362,21 +377,78 @@ AcpiDsInitObjectFromOp ( * Defer evaluation of Package TermArg operand */ ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; - ObjDesc->Package.AmlStart = ((ACPI_PARSE2_OBJECT *) Op)->Data; - ObjDesc->Package.AmlLength = ((ACPI_PARSE2_OBJECT *) Op)->Length; + ObjDesc->Package.AmlStart = Op->Named.Data; + ObjDesc->Package.AmlLength = Op->Named.Length; break; case ACPI_TYPE_INTEGER: - ObjDesc->Integer.Value = Op->Value.Integer; + switch (OpInfo->Type) + { + case AML_TYPE_CONSTANT: + /* + * Resolve AML Constants here - AND ONLY HERE! + * All constants are integers. + * We mark the integer with a flag that indicates that it started life + * as a constant -- so that stores to constants will perform as expected (noop). + * (ZeroOp is used as a placeholder for optional target operands.) + */ + ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT; + + switch (Opcode) + { + case AML_ZERO_OP: + + ObjDesc->Integer.Value = 0; + break; + + case AML_ONE_OP: + + ObjDesc->Integer.Value = 1; + break; + + case AML_ONES_OP: + + ObjDesc->Integer.Value = ACPI_INTEGER_MAX; + + /* Truncate value if we are executing from a 32-bit ACPI table */ + + AcpiExTruncateFor32bitTable (ObjDesc); + break; + + case AML_REVISION_OP: + + ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL; + break; + + default: + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", Opcode)); + Status = AE_AML_OPERAND_TYPE; + break; + } + break; + + + case AML_TYPE_LITERAL: + + ObjDesc->Integer.Value = Op->Common.Value.Integer; + break; + + + default: + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", OpInfo->Type)); + Status = AE_AML_OPERAND_TYPE; + break; + } break; case ACPI_TYPE_STRING: - ObjDesc->String.Pointer = Op->Value.String; - ObjDesc->String.Length = ACPI_STRLEN (Op->Value.String); + ObjDesc->String.Pointer = Op->Common.Value.String; + ObjDesc->String.Length = ACPI_STRLEN (Op->Common.Value.String); /* * The string is contained in the ACPI table, don't ever try @@ -412,13 +484,13 @@ AcpiDsInitObjectFromOp ( break; - default: /* Constants, Literals, etc.. */ + default: /* Other literals, etc.. */ - if (Op->Opcode == AML_INT_NAMEPATH_OP) + if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { /* Node was saved in Op */ - ObjDesc->Reference.Node = Op->Node; + ObjDesc->Reference.Node = Op->Common.Node; } ObjDesc->Reference.Opcode = Opcode; @@ -429,13 +501,14 @@ AcpiDsInitObjectFromOp ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %x\n", - ObjDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n", + ACPI_GET_OBJECT_TYPE (ObjDesc))); + Status = AE_AML_OPERAND_TYPE; break; } - return (AE_OK); + return_ACPI_STATUS (Status); } @@ -468,37 +541,36 @@ AcpiDsBuildInternalObject ( ACPI_FUNCTION_TRACE ("DsBuildInternalObject"); - if (Op->Opcode == AML_INT_NAMEPATH_OP) + if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { /* - * This is an object reference. If this name was + * This is an named object reference. If this name was * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ - if (!Op->Node) + if (!Op->Common.Node) { - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, + Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - (ACPI_NAMESPACE_NODE **) &(Op->Node)); + (ACPI_NAMESPACE_NODE **) &(Op->Common.Node)); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { Name = NULL; - AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, NULL, &Name); - - if (Name) + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, NULL, &Name); + if (ACPI_SUCCESS (Status)) { ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n", - Name, Op->AmlOffset)); + Name, Op->Common.AmlOffset)); ACPI_MEM_FREE (Name); } else { ACPI_REPORT_WARNING (("Reference %s at AML %X not found\n", - Op->Value.String, Op->AmlOffset)); + Op->Common.Value.String, Op->Common.AmlOffset)); } *ObjDescPtr = NULL; @@ -513,13 +585,13 @@ AcpiDsBuildInternalObject ( /* Create and init the internal ACPI object */ - ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Opcode))->ObjectType); + ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Opcode, &ObjDesc); + Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, &ObjDesc); if (ACPI_FAILURE (Status)) { AcpiUtRemoveReference (ObjDesc); @@ -535,7 +607,9 @@ AcpiDsBuildInternalObject ( * * FUNCTION: AcpiDsBuildInternalBufferObj * - * PARAMETERS: Op - Parser object to be translated + * PARAMETERS: WalkState - Current walk state + * Op - Parser object to be translated + * BufferLength - Length of the buffer * ObjDescPtr - Where the ACPI internal object is returned * * RETURN: Status @@ -554,7 +628,7 @@ AcpiDsBuildInternalBufferObj ( { ACPI_PARSE_OBJECT *Arg; ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE2_OBJECT *ByteList; + ACPI_PARSE_OBJECT *ByteList; UINT32 ByteListLength = 0; @@ -586,22 +660,22 @@ AcpiDsBuildInternalBufferObj ( * individual bytes or a string initializer. In either case, a * ByteList appears in the AML. */ - Arg = Op->Value.Arg; /* skip first arg */ + Arg = Op->Common.Value.Arg; /* skip first arg */ - ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next; + ByteList = Arg->Named.Next; if (ByteList) { - if (ByteList->Opcode != AML_INT_BYTELIST_OP) + if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got AML opcode %X in op %p\n", - ByteList->Opcode, ByteList)); + ByteList->Common.AmlOpcode, ByteList)); AcpiUtRemoveReference (ObjDesc); return (AE_TYPE); } - ByteListLength = ByteList->Value.Integer32; + ByteListLength = ByteList->Common.Value.Integer32; } /* @@ -636,12 +710,12 @@ AcpiDsBuildInternalBufferObj ( if (ByteList) { - ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data, + ACPI_MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Named.Data, ByteListLength); } ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; - Op->Node = (ACPI_NAMESPACE_NODE *) ObjDesc; + Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc; return_ACPI_STATUS (AE_OK); } @@ -650,7 +724,9 @@ AcpiDsBuildInternalBufferObj ( * * FUNCTION: AcpiDsBuildInternalPackageObj * - * PARAMETERS: Op - Parser object to be translated + * PARAMETERS: WalkState - Current walk state + * Op - Parser object to be translated + * PackageLength - Number of elements in the package * ObjDescPtr - Where the ACPI internal object is returned * * RETURN: Status @@ -680,12 +756,11 @@ AcpiDsBuildInternalPackageObj ( /* Find the parent of a possibly nested package */ - - Parent = Op->Parent; - while ((Parent->Opcode == AML_PACKAGE_OP) || - (Parent->Opcode == AML_VAR_PACKAGE_OP)) + Parent = Op->Common.Parent; + while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)) { - Parent = Parent->Parent; + Parent = Parent->Common.Parent; } ObjDesc = *ObjDescPtr; @@ -705,7 +780,7 @@ AcpiDsBuildInternalPackageObj ( return_ACPI_STATUS (AE_NO_MEMORY); } - ObjDesc->Package.Node = Parent->Node; + ObjDesc->Package.Node = Parent->Common.Node; } ObjDesc->Package.Count = PackageLength; @@ -713,12 +788,12 @@ AcpiDsBuildInternalPackageObj ( /* Count the number of items in the package list */ PackageListLength = 0; - Arg = Op->Value.Arg; - Arg = Arg->Next; + Arg = Op->Common.Value.Arg; + Arg = Arg->Common.Next; while (Arg) { PackageListLength++; - Arg = Arg->Next; + Arg = Arg->Common.Next; } /* @@ -736,7 +811,7 @@ AcpiDsBuildInternalPackageObj ( * that the list is always null terminated. */ ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE ( - (ObjDesc->Package.Count + 1) * sizeof (void *)); + ((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *)); if (!ObjDesc->Package.Elements) { @@ -748,15 +823,15 @@ AcpiDsBuildInternalPackageObj ( * Now init the elements of the package */ i = 0; - Arg = Op->Value.Arg; - Arg = Arg->Next; + Arg = Op->Common.Value.Arg; + Arg = Arg->Common.Next; while (Arg) { - if (Arg->Opcode == AML_INT_RETURN_VALUE_OP) + if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) { /* Object (package or buffer) is already built */ - ObjDesc->Package.Elements[i] = (ACPI_OPERAND_OBJECT *) Arg->Node; + ObjDesc->Package.Elements[i] = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); } else { @@ -765,11 +840,11 @@ AcpiDsBuildInternalPackageObj ( } i++; - Arg = Arg->Next; + Arg = Arg->Common.Next; } ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; - Op->Node = (ACPI_NAMESPACE_NODE *) ObjDesc; + Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc; return_ACPI_STATUS (Status); } @@ -778,12 +853,13 @@ AcpiDsBuildInternalPackageObj ( * * FUNCTION: AcpiDsCreateNode * - * PARAMETERS: Op - Parser object to be translated - * ObjDescPtr - Where the ACPI internal object is returned + * PARAMETERS: WalkState - Current walk state + * Node - NS Node to be initialized + * Op - Parser object to be translated * * RETURN: Status * - * DESCRIPTION: + * DESCRIPTION: Create the object to be associated with a namespace node * ****************************************************************************/ @@ -810,7 +886,7 @@ AcpiDsCreateNode ( return_ACPI_STATUS (AE_OK); } - if (!Op->Value.Arg) + if (!Op->Common.Value.Arg) { /* No arguments, there is nothing to do */ @@ -819,7 +895,7 @@ AcpiDsCreateNode ( /* Build an internal object for the argument(s) */ - Status = AcpiDsBuildInternalObject (WalkState, Op->Value.Arg, &ObjDesc); + Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -827,7 +903,7 @@ AcpiDsCreateNode ( /* Re-type the object according to it's argument */ - Node->Type = ObjDesc->Common.Type; + Node->Type = ACPI_GET_OBJECT_TYPE (ObjDesc); /* Attach obj to node */ diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index 7166753..8cf27ae 100644 --- a/sys/contrib/dev/acpica/dsopcode.c +++ b/sys/contrib/dev/acpica/dsopcode.c @@ -2,7 +2,7 @@ * * Module Name: dsopcode - Dispatcher Op Region support and handling of * "control" opcodes - * $Revision: 74 $ + * $Revision: 80 $ * *****************************************************************************/ @@ -124,7 +124,6 @@ #include "acinterp.h" #include "acnamesp.h" #include "acevents.h" -#include "actables.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsopcode") @@ -135,7 +134,8 @@ * FUNCTION: AcpiDsExecuteArguments * * PARAMETERS: Node - Parent NS node - * ExtraDesc - Has AML pointer and length + * AmlLength - Length of executable AML + * AmlStart - Pointer to the AML * * RETURN: Status. * @@ -170,7 +170,7 @@ AcpiDsExecuteArguments ( /* Save the Node for use in AcpiPsParseAml */ - Op->Node = ScopeNode; + Op->Common.Node = ScopeNode; /* Create and initialize a new parser state */ @@ -201,9 +201,9 @@ AcpiDsExecuteArguments ( /* Get and init the Op created above */ - Arg = Op->Value.Arg; - Op->Node = Node; - Arg->Node = Node; + Arg = Op->Common.Value.Arg; + Op->Common.Node = Node; + Arg->Common.Node = Node; AcpiPsDeleteParseTree (Op); /* Evaluate the address and length arguments for the Buffer Field */ @@ -214,7 +214,7 @@ AcpiDsExecuteArguments ( return_ACPI_STATUS (AE_NO_MEMORY); } - Op->Node = ScopeNode; + Op->Common.Node = ScopeNode; /* Create and initialize a new parser state */ @@ -275,7 +275,7 @@ AcpiDsGetBufferFieldArguments ( ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] BufferField JIT Init\n", - (char *) &Node->Name)); + Node->Name.Ascii)); /* Execute the AML code for the TermArg arguments */ @@ -426,7 +426,7 @@ AcpiDsGetRegionArguments ( ACPI_DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]")); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[%4.4s] OpRegion Init at AML %p\n", - (char *) &Node->Name, ExtraDesc->Extra.AmlStart)); + Node->Name.Ascii, ExtraDesc->Extra.AmlStart)); Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node), @@ -443,7 +443,7 @@ AcpiDsGetRegionArguments ( * * RETURN: Status * - * DESCRIPTION: + * DESCRIPTION: Front end to EvInitializeRegion * ****************************************************************************/ @@ -466,268 +466,283 @@ AcpiDsInitializeRegion ( /***************************************************************************** * - * FUNCTION: AcpiDsEvalBufferFieldOperands + * FUNCTION: AcpiDsInitBufferField * - * PARAMETERS: Op - A valid BufferField Op object + * PARAMETERS: AmlOpcode - CreateXxxField + * ObjDesc - BufferField object + * BufferDesc - Host Buffer + * OffsetDesc - Offset into buffer + * Length - Length of field (CREATE_FIELD_OP only) + * Result - Where to store the result * * RETURN: Status * - * DESCRIPTION: Get BufferField Buffer and Index - * Called from AcpiDsExecEndOp during BufferField parse tree walk + * DESCRIPTION: Perform actual initialization of a buffer field * ****************************************************************************/ ACPI_STATUS -AcpiDsEvalBufferFieldOperands ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) +AcpiDsInitBufferField ( + UINT16 AmlOpcode, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT *BufferDesc, + ACPI_OPERAND_OBJECT *OffsetDesc, + ACPI_OPERAND_OBJECT *LengthDesc, + ACPI_OPERAND_OBJECT *ResultDesc) { - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *NextOp; UINT32 Offset; UINT32 BitOffset; UINT32 BitCount; UINT8 FieldFlags; - ACPI_OPERAND_OBJECT *ResDesc = NULL; - ACPI_OPERAND_OBJECT *CntDesc = NULL; - ACPI_OPERAND_OBJECT *OffDesc = NULL; - ACPI_OPERAND_OBJECT *SrcDesc = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op); - - - /* - * This is where we evaluate the address and length fields of the - * CreateXxxField declaration - */ - Node = Op->Node; - - /* NextOp points to the op that holds the Buffer */ + ACPI_STATUS Status; - NextOp = Op->Value.Arg; - /* Evaluate/create the address and length operands */ + ACPI_FUNCTION_TRACE_PTR ("DsInitBufferField", ObjDesc); - Status = AcpiDsCreateOperands (WalkState, NextOp); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - ObjDesc = AcpiNsGetAttachedObject (Node); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NOT_EXIST); - } - - /* Resolve the operands */ + /* Host object must be a Buffer */ - Status = AcpiExResolveOperands (Op->Opcode, ACPI_WALK_OPERANDS, WalkState); - ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode), - WalkState->NumOperands, "after AcpiExResolveOperands"); - - if (ACPI_FAILURE (Status)) + if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", - AcpiPsGetOpcodeName (Op->Opcode), Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Target of Create Field is not a Buffer object - %s\n", + AcpiUtGetObjectTypeName (BufferDesc))); + Status = AE_AML_OPERAND_TYPE; goto Cleanup; } - /* Get the operands */ - - if (AML_CREATE_FIELD_OP == Op->Opcode) - { - ResDesc = WalkState->Operands[3]; - CntDesc = WalkState->Operands[2]; - } - else - { - ResDesc = WalkState->Operands[2]; - } - - OffDesc = WalkState->Operands[1]; - SrcDesc = WalkState->Operands[0]; - Offset = (UINT32) OffDesc->Integer.Value; - /* - * If ResDesc is a Name, it will be a direct name pointer after - * AcpiExResolveOperands() + * The last parameter to all of these opcodes (ResultDesc) started + * out as a NameString, and should therefore now be a NS node + * after resolution in AcpiExResolveOperands(). */ - if (ACPI_GET_DESCRIPTOR_TYPE (ResDesc) != ACPI_DESC_TYPE_NAMED) + if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination must be a NS Node\n", - AcpiPsGetOpcodeName (Op->Opcode))); + AcpiPsGetOpcodeName (AmlOpcode))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } + Offset = (UINT32) OffsetDesc->Integer.Value; + /* * Setup the Bit offsets and counts, according to the opcode */ - switch (Op->Opcode) + switch (AmlOpcode) { case AML_CREATE_FIELD_OP: /* Offset is in bits, count is in bits */ - BitOffset = Offset; - BitCount = (UINT32) CntDesc->Integer.Value; - FieldFlags = AML_FIELD_ACCESS_BYTE; + BitOffset = Offset; + BitCount = (UINT32) LengthDesc->Integer.Value; + FieldFlags = AML_FIELD_ACCESS_BYTE; break; case AML_CREATE_BIT_FIELD_OP: /* Offset is in bits, Field is one bit */ - BitOffset = Offset; - BitCount = 1; - FieldFlags = AML_FIELD_ACCESS_BYTE; + BitOffset = Offset; + BitCount = 1; + FieldFlags = AML_FIELD_ACCESS_BYTE; break; case AML_CREATE_BYTE_FIELD_OP: /* Offset is in bytes, field is one byte */ - BitOffset = 8 * Offset; - BitCount = 8; - FieldFlags = AML_FIELD_ACCESS_BYTE; + BitOffset = 8 * Offset; + BitCount = 8; + FieldFlags = AML_FIELD_ACCESS_BYTE; break; case AML_CREATE_WORD_FIELD_OP: /* Offset is in bytes, field is one word */ - BitOffset = 8 * Offset; - BitCount = 16; - FieldFlags = AML_FIELD_ACCESS_WORD; + BitOffset = 8 * Offset; + BitCount = 16; + FieldFlags = AML_FIELD_ACCESS_WORD; break; case AML_CREATE_DWORD_FIELD_OP: /* Offset is in bytes, field is one dword */ - BitOffset = 8 * Offset; - BitCount = 32; - FieldFlags = AML_FIELD_ACCESS_DWORD; + BitOffset = 8 * Offset; + BitCount = 32; + FieldFlags = AML_FIELD_ACCESS_DWORD; break; case AML_CREATE_QWORD_FIELD_OP: /* Offset is in bytes, field is one qword */ - BitOffset = 8 * Offset; - BitCount = 64; - FieldFlags = AML_FIELD_ACCESS_QWORD; + BitOffset = 8 * Offset; + BitCount = 64; + FieldFlags = AML_FIELD_ACCESS_QWORD; break; default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Internal error - unknown field creation opcode %02x\n", - Op->Opcode)); + "Unknown field creation opcode %02x\n", + AmlOpcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } + + /* Entire field must fit within the current length of the buffer */ + + if ((BitOffset + BitCount) > + (8 * (UINT32) BufferDesc->Buffer.Length)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Field size %d exceeds Buffer size %d (bits)\n", + BitOffset + BitCount, 8 * (UINT32) BufferDesc->Buffer.Length)); + Status = AE_AML_BUFFER_LIMIT; + goto Cleanup; + } + /* - * Setup field according to the object type + * Initialize areas of the field object that are common to all fields + * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) */ - switch (SrcDesc->Common.Type) + Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0, + BitOffset, BitCount); + if (ACPI_FAILURE (Status)) { + goto Cleanup; + } - /* SourceBuff := TermArg=>Buffer */ - - case ACPI_TYPE_BUFFER: + ObjDesc->BufferField.BufferObj = BufferDesc; - if ((BitOffset + BitCount) > - (8 * (UINT32) SrcDesc->Buffer.Length)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Field size %d exceeds Buffer size %d (bits)\n", - BitOffset + BitCount, 8 * (UINT32) SrcDesc->Buffer.Length)); - Status = AE_AML_BUFFER_LIMIT; - goto Cleanup; - } + /* Reference count for BufferDesc inherits ObjDesc count */ - /* - * Initialize areas of the field object that are common to all fields - * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE) - */ - Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0, - BitOffset, BitCount); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + BufferDesc->Common.ReferenceCount = (UINT16) (BufferDesc->Common.ReferenceCount + + ObjDesc->Common.ReferenceCount); - ObjDesc->BufferField.BufferObj = SrcDesc; - /* Reference count for SrcDesc inherits ObjDesc count */ +Cleanup: - SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount + - ObjDesc->Common.ReferenceCount); - break; + /* Always delete the operands */ + AcpiUtRemoveReference (OffsetDesc); + AcpiUtRemoveReference (BufferDesc); - /* Improper object type */ + if (AmlOpcode == AML_CREATE_FIELD_OP) + { + AcpiUtRemoveReference (LengthDesc); + } - default: + /* On failure, delete the result descriptor */ - if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* This line MUST be a single line until AcpiSrc can handle it (block deletion) */ - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Tried to create field in invalid object type %X\n", - SrcDesc->Common.Type)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Tried to create field in improper object type - %s\n", - AcpiUtGetTypeName (SrcDesc->Common.Type))); - } + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference (ResultDesc); /* Result descriptor */ + } + else + { + /* Now the address and length are valid for this BufferField */ - Status = AE_AML_OPERAND_TYPE; - goto Cleanup; + ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID; } + return_ACPI_STATUS (Status); +} - if (AML_CREATE_FIELD_OP == Op->Opcode) - { - /* Delete object descriptor unique to CreateField */ - AcpiUtRemoveReference (CntDesc); - CntDesc = NULL; - } +/***************************************************************************** + * + * FUNCTION: AcpiDsEvalBufferFieldOperands + * + * PARAMETERS: WalkState - Current walk + * Op - A valid BufferField Op object + * + * RETURN: Status + * + * DESCRIPTION: Get BufferField Buffer and Index + * Called from AcpiDsExecEndOp during BufferField parse tree walk + * + ****************************************************************************/ +ACPI_STATUS +AcpiDsEvalBufferFieldOperands ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *Node; + ACPI_PARSE_OBJECT *NextOp; -Cleanup: - /* Always delete the operands */ + ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op); - AcpiUtRemoveReference (OffDesc); - AcpiUtRemoveReference (SrcDesc); - if (AML_CREATE_FIELD_OP == Op->Opcode) + /* + * This is where we evaluate the address and length fields of the + * CreateXxxField declaration + */ + Node = Op->Common.Node; + + /* NextOp points to the op that holds the Buffer */ + + NextOp = Op->Common.Value.Arg; + + /* Evaluate/create the address and length operands */ + + Status = AcpiDsCreateOperands (WalkState, NextOp); + if (ACPI_FAILURE (Status)) { - AcpiUtRemoveReference (CntDesc); + return_ACPI_STATUS (Status); } - /* On failure, delete the result descriptor */ + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } + + /* Resolve the operands */ + + Status = AcpiExResolveOperands (Op->Common.AmlOpcode, + ACPI_WALK_OPERANDS, WalkState); + + ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), + WalkState->NumOperands, "after AcpiExResolveOperands"); if (ACPI_FAILURE (Status)) { - AcpiUtRemoveReference (ResDesc); /* Result descriptor */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n", + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status)); + + return_ACPI_STATUS (Status); + } + + /* Initialize the Buffer Field */ + + if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) + { + /* NOTE: Slightly different operands for this opcode */ + + Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, + WalkState->Operands[0], WalkState->Operands[1], + WalkState->Operands[2], WalkState->Operands[3]); } else { - /* Now the address and length are valid for this BufferField */ + /* All other, CreateXxxField opcodes */ - ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID; + Status = AcpiDsInitBufferField (Op->Common.AmlOpcode, ObjDesc, + WalkState->Operands[0], WalkState->Operands[1], + NULL, WalkState->Operands[2]); } return_ACPI_STATUS (Status); @@ -738,7 +753,8 @@ Cleanup: * * FUNCTION: AcpiDsEvalRegionOperands * - * PARAMETERS: Op - A valid region Op object + * PARAMETERS: WalkState - Current walk + * Op - A valid region Op object * * RETURN: Status * @@ -765,15 +781,15 @@ AcpiDsEvalRegionOperands ( /* * This is where we evaluate the address and length fields of the OpRegion declaration */ - Node = Op->Node; + Node = Op->Common.Node; /* NextOp points to the op that holds the SpaceID */ - NextOp = Op->Value.Arg; + NextOp = Op->Common.Value.Arg; /* NextOp points to address op */ - NextOp = NextOp->Next; + NextOp = NextOp->Common.Next; /* Evaluate/create the address and length operands */ @@ -785,14 +801,14 @@ AcpiDsEvalRegionOperands ( /* Resolve the length and address operands to numbers */ - Status = AcpiExResolveOperands (Op->Opcode, ACPI_WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE, - AcpiPsGetOpcodeName (Op->Opcode), + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), 1, "after AcpiExResolveOperands"); ObjDesc = AcpiNsGetAttachedObject (Node); @@ -837,7 +853,9 @@ AcpiDsEvalRegionOperands ( * * FUNCTION: AcpiDsEvalDataObjectOperands * - * PARAMETERS: Op - A valid DataObject Op object + * PARAMETERS: WalkState - Current walk + * Op - A valid DataObject Op object + * ObjDesc - DataObject * * RETURN: Status * @@ -863,7 +881,7 @@ AcpiDsEvalDataObjectOperands ( /* The first operand (for all of these data objects) is the length */ - Status = AcpiDsCreateOperand (WalkState, Op->Value.Arg, 1); + Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -884,13 +902,18 @@ AcpiDsEvalDataObjectOperands ( /* Cleanup for length operand */ - AcpiDsObjStackPop (1, WalkState); + Status = AcpiDsObjStackPop (1, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + AcpiUtRemoveReference (ArgDesc); /* * Create the actual data object */ - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_BUFFER_OP: @@ -914,10 +937,10 @@ AcpiDsEvalDataObjectOperands ( * in this case, the return object will be stored in the parse tree * for the package. */ - if ((!Op->Parent) || - ((Op->Parent->Opcode != AML_PACKAGE_OP) && - (Op->Parent->Opcode != AML_VAR_PACKAGE_OP) && - (Op->Parent->Opcode != AML_NAME_OP))) + if ((!Op->Common.Parent) || + ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) && + (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) && + (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP))) { WalkState->ResultObj = ObjDesc; } @@ -955,9 +978,9 @@ AcpiDsExecBeginControlOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op, - Op->Opcode, WalkState)); + Op->Common.AmlOpcode, WalkState)); - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_IF_OP: case AML_WHILE_OP: @@ -979,7 +1002,7 @@ AcpiDsExecBeginControlOp ( */ ControlState->Control.AmlPredicateStart = WalkState->ParserState.Aml - 1; ControlState->Control.PackageEnd = WalkState->ParserState.PkgEnd; - ControlState->Control.Opcode = Op->Opcode; + ControlState->Control.Opcode = Op->Common.AmlOpcode; /* Push the control state on this walk's control stack */ @@ -1037,7 +1060,7 @@ AcpiDsExecEndControlOp ( ACPI_FUNCTION_NAME ("DsExecEndControlOp"); - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_IF_OP: @@ -1089,18 +1112,18 @@ AcpiDsExecEndControlOp ( case AML_RETURN_OP: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Value.Arg)); + "[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Common.Value.Arg)); /* * One optional operand -- the return value * It can be either an immediate operand or a result that * has been bubbled up the tree */ - if (Op->Value.Arg) + if (Op->Common.Value.Arg) { /* Return statement has an immediate operand */ - Status = AcpiDsCreateOperands (WalkState, Op->Value.Arg); + Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg); if (ACPI_FAILURE (Status)) { return (Status); @@ -1136,8 +1159,8 @@ AcpiDsExecEndControlOp ( * * Allow references created by the Index operator to return unchanged. */ - if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_INTERNAL) && - ((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) && + if ((ACPI_GET_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc[0]) == ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_OBJECT_TYPE (WalkState->Results->Results.ObjDesc [0]) == INTERNAL_TYPE_REFERENCE) && ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP)) { Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); @@ -1184,7 +1207,7 @@ AcpiDsExecEndControlOp ( /* Call up to the OS service layer to handle this */ - AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode"); + Status = AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT, "Executed AML Breakpoint opcode"); /* If and when it returns, all done. */ @@ -1217,7 +1240,7 @@ AcpiDsExecEndControlOp ( /* Return status depending on opcode */ - if (Op->Opcode == AML_BREAK_OP) + if (Op->Common.AmlOpcode == AML_BREAK_OP) { Status = AE_CTRL_BREAK; } @@ -1231,7 +1254,7 @@ AcpiDsExecEndControlOp ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n", - Op->Opcode, Op)); + Op->Common.AmlOpcode, Op)); Status = AE_AML_BAD_OPCODE; break; diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c index fa7b43f..386551b 100644 --- a/sys/contrib/dev/acpica/dsutils.c +++ b/sys/contrib/dev/acpica/dsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsutils - Dispatcher utilities - * $Revision: 89 $ + * $Revision: 93 $ * ******************************************************************************/ @@ -167,7 +167,7 @@ AcpiDsIsResultUsed ( * method is parsed separately) However, a method that is * invoked from another method has a parent. */ - if (!Op->Parent) + if (!Op->Common.Parent) { return_VALUE (FALSE); } @@ -175,7 +175,7 @@ AcpiDsIsResultUsed ( /* * Get info on the parent. The root Op is AML_SCOPE */ - ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); + ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); if (ParentInfo->Class == AML_CLASS_UNKNOWN) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", Op)); @@ -192,7 +192,7 @@ AcpiDsIsResultUsed ( { case AML_CLASS_CONTROL: - switch (Op->Parent->Opcode) + switch (Op->Common.Parent->Common.AmlOpcode) { case AML_RETURN_OP: @@ -212,6 +212,11 @@ AcpiDsIsResultUsed ( { goto ResultUsed; } + break; + + default: + /* Ignore other control opcodes */ + break; } /* The general control opcode returns no result */ @@ -230,12 +235,12 @@ AcpiDsIsResultUsed ( case AML_CLASS_NAMED_OBJECT: - if ((Op->Parent->Opcode == AML_REGION_OP) || - (Op->Parent->Opcode == AML_DATA_REGION_OP) || - (Op->Parent->Opcode == AML_PACKAGE_OP) || - (Op->Parent->Opcode == AML_VAR_PACKAGE_OP) || - (Op->Parent->Opcode == AML_BUFFER_OP) || - (Op->Parent->Opcode == AML_INT_EVAL_SUBTREE_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_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_BUFFER_OP) || + (Op->Common.Parent->Common.AmlOpcode == AML_INT_EVAL_SUBTREE_OP)) { /* * These opcodes allow TermArg(s) as operands and therefore @@ -259,16 +264,16 @@ AcpiDsIsResultUsed ( ResultUsed: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", - AcpiPsGetOpcodeName (Op->Opcode), - AcpiPsGetOpcodeName (Op->Parent->Opcode), Op)); + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), + AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); return_VALUE (TRUE); ResultNotUsed: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", - AcpiPsGetOpcodeName (Op->Opcode), - AcpiPsGetOpcodeName (Op->Parent->Opcode), Op)); + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), + AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op)); return_VALUE (FALSE); @@ -356,6 +361,7 @@ AcpiDsCreateOperand ( UINT32 ArgIndex) { ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status2; NATIVE_CHAR *NameString; UINT32 NameLength; ACPI_OPERAND_OBJECT *ObjDesc; @@ -371,14 +377,14 @@ AcpiDsCreateOperand ( /* A valid name must be looked up in the namespace */ - if ((Arg->Opcode == AML_INT_NAMEPATH_OP) && - (Arg->Value.String)) + if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && + (Arg->Common.Value.String)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg)); /* Get the entire name string from the AML stream */ - Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Value.Buffer, + Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Common.Value.Buffer, &NameString, &NameLength); if (ACPI_FAILURE (Status)) @@ -397,12 +403,12 @@ AcpiDsCreateOperand ( * IMODE_EXECUTE) in order to support the creation of * namespace objects during the execution of control methods. */ - ParentOp = Arg->Parent; - OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Opcode); + ParentOp = Arg->Common.Parent; + OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode); if ((OpInfo->Flags & AML_NSNODE) && - (ParentOp->Opcode != AML_INT_METHODCALL_OP) && - (ParentOp->Opcode != AML_REGION_OP) && - (ParentOp->Opcode != AML_INT_NAMEPATH_OP)) + (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && + (ParentOp->Common.AmlOpcode != AML_REGION_OP) && + (ParentOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) { /* Enter name into namespace if not found */ @@ -420,14 +426,14 @@ AcpiDsCreateOperand ( ACPI_TYPE_ANY, InterpreterMode, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, - (ACPI_NAMESPACE_NODE **) &ObjDesc); + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc)); /* * The only case where we pass through (ignore) a NOT_FOUND * error is for the CondRefOf opcode. */ if (Status == AE_NOT_FOUND) { - if (ParentOp->Opcode == AML_COND_REF_OF_OP) + if (ParentOp->Common.AmlOpcode == AML_COND_REF_OF_OP) { /* * For the Conditional Reference op, it's OK if @@ -435,7 +441,7 @@ AcpiDsCreateOperand ( * indicate this to the interpreter, set the * object to the root */ - ObjDesc = (ACPI_OPERAND_OBJECT *) AcpiGbl_RootNode; + ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode); Status = AE_OK; } @@ -448,10 +454,13 @@ AcpiDsCreateOperand ( Status = AE_AML_NAME_NOT_FOUND; Name = NULL; - AcpiNsExternalizeName (ACPI_UINT32_MAX, NameString, NULL, &Name); - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Object name [%s] was not found in namespace\n", Name)); - ACPI_MEM_FREE (Name); + Status2 = AcpiNsExternalizeName (ACPI_UINT32_MAX, NameString, NULL, &Name); + if (ACPI_SUCCESS (Status2)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Object name [%s] was not found in namespace\n", Name)); + ACPI_MEM_FREE (Name); + } } } @@ -481,13 +490,13 @@ AcpiDsCreateOperand ( { /* Check for null name case */ - if (Arg->Opcode == AML_INT_NAMEPATH_OP) + if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { /* * If the name is null, this means that this is an * optional result parameter that was not specified - * in the original ASL. Create an Reference for a - * placeholder + * in the original ASL. Create a Zero Constant for a + * placeholder. (Store to a constant is a Noop.) */ Opcode = AML_ZERO_OP; /* Has no arguments! */ @@ -496,7 +505,7 @@ AcpiDsCreateOperand ( else { - Opcode = Arg->Opcode; + Opcode = Arg->Common.AmlOpcode; } /* Get the object type of the argument */ @@ -531,7 +540,6 @@ AcpiDsCreateOperand ( return_ACPI_STATUS (Status); } } - else { /* Create an ACPI_INTERNAL_OBJECT for the argument */ @@ -551,7 +559,7 @@ AcpiDsCreateOperand ( AcpiUtDeleteObjectDesc (ObjDesc); return_ACPI_STATUS (Status); } - } + } /* Put the operand object on the object stack */ @@ -611,7 +619,7 @@ AcpiDsCreateOperands ( /* Move on to next argument, if any */ - Arg = Arg->Next; + Arg = Arg->Common.Next; ArgCount++; } @@ -624,7 +632,7 @@ Cleanup: * pop everything off of the operand stack and delete those * objects */ - AcpiDsObjStackPopAndDelete (ArgCount, WalkState); + (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n", (ArgCount + 1), AcpiFormatException (Status))); diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c index c5967bd..f8582e3 100644 --- a/sys/contrib/dev/acpica/dswexec.c +++ b/sys/contrib/dev/acpica/dswexec.c @@ -2,7 +2,7 @@ * * Module Name: dswexec - Dispatcher method execution callbacks; * dispatch to interpreter. - * $Revision: 90 $ + * $Revision: 94 $ * *****************************************************************************/ @@ -132,7 +132,7 @@ /* * Dispatch table for opcode classes */ -ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = { +static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = { AcpiExOpcode_1A_0T_0R, AcpiExOpcode_1A_0T_1R, AcpiExOpcode_1A_1T_0R, @@ -212,11 +212,11 @@ AcpiDsGetPredicateValue ( * Result of predicate evaluation currently must * be a number */ - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad predicate (not a number) ObjDesc=%p State=%p Type=%X\n", - ObjDesc, WalkState, ObjDesc->Common.Type)); + ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -224,7 +224,7 @@ AcpiDsGetPredicateValue ( /* Truncate the predicate to 32-bits if necessary */ - AcpiExTruncateFor32bitTable (ObjDesc, WalkState); + AcpiExTruncateFor32bitTable (ObjDesc); /* * Save the result of the predicate evaluation on @@ -304,14 +304,19 @@ AcpiDsExecBeginOp ( Op = *OutOp; WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - WalkState->Opcode = Op->Opcode; + WalkState->Opcode = Op->Common.AmlOpcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op)); - AcpiDsScopeStackPop (WalkState); + + Status = AcpiDsScopeStackPop (WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } } @@ -349,7 +354,7 @@ AcpiDsExecBeginOp ( /* We want to send namepaths to the load code */ - if (Op->Opcode == AML_INT_NAMEPATH_OP) + if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { OpcodeClass = AML_CLASS_NAMED_OBJECT; } @@ -385,7 +390,7 @@ AcpiDsExecBeginOp ( Status = AcpiDsLoad2BeginOp (WalkState, NULL); } - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { Status = AcpiDsResultStackPush (WalkState); } @@ -451,11 +456,11 @@ AcpiDsExecEndOp ( if (OpClass == AML_CLASS_UNKNOWN) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Common.AmlOpcode)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - FirstArg = Op->Value.Arg; + FirstArg = Op->Common.Value.Arg; /* Init the walk state */ @@ -555,8 +560,12 @@ AcpiDsExecEndOp ( /* 1 Operand, 0 ExternalResult, 0 InternalResult */ Status = AcpiDsExecEndControlOp (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } - AcpiDsResultStackPop (WalkState); + Status = AcpiDsResultStackPop (WalkState); break; @@ -574,7 +583,7 @@ AcpiDsExecEndOp ( /* NextOp points to first argument op */ - NextOp = NextOp->Next; + NextOp = NextOp->Common.Next; /* * Get the method's arguments and put them on the operand stack @@ -629,7 +638,7 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing CreateObject (Buffer/Package) Op=%p\n", Op)); - switch (Op->Parent->Opcode) + switch (Op->Common.Parent->Common.AmlOpcode) { case AML_NAME_OP: @@ -637,20 +646,22 @@ AcpiDsExecEndOp ( * Put the Node on the object stack (Contains the ACPI Name of * this object) */ - WalkState->Operands[0] = (void *) Op->Parent->Node; + WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node; WalkState->NumOperands = 1; - Status = AcpiDsCreateNode (WalkState, Op->Parent->Node, Op->Parent); + Status = AcpiDsCreateNode (WalkState, Op->Common.Parent->Common.Node, Op->Common.Parent); if (ACPI_FAILURE (Status)) { break; } /* Fall through */ + /*lint -fallthrough */ case AML_INT_EVAL_SUBTREE_OP: - Status = AcpiDsEvalDataObjectOperands (WalkState, Op, AcpiNsGetAttachedObject (Op->Parent->Node)); + Status = AcpiDsEvalDataObjectOperands (WalkState, Op, + AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node)); break; default: @@ -682,7 +693,7 @@ AcpiDsExecEndOp ( break; } - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Executing OpRegion Address/Length Op=%p\n", Op)); @@ -717,7 +728,7 @@ AcpiDsExecEndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n", - OpClass, OpType, Op->Opcode, Op)); + OpClass, OpType, Op->Common.AmlOpcode, Op)); Status = AE_NOT_IMPLEMENTED; break; @@ -728,7 +739,7 @@ AcpiDsExecEndOp ( * ACPI 2.0 support for 64-bit integers: Truncate numeric * result value if we are executing from a 32-bit ACPI table */ - AcpiExTruncateFor32bitTable (WalkState->ResultObj, WalkState); + AcpiExTruncateFor32bitTable (WalkState->ResultObj); /* * Check if we just completed the evaluation of a diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c index 4b44111..5881a0b 100644 --- a/sys/contrib/dev/acpica/dswload.c +++ b/sys/contrib/dev/acpica/dswload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 62 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -208,16 +208,16 @@ AcpiDsLoad1BeginOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); - if (Op && (Op->Opcode == AML_INT_NAMEDFIELD_OP)) + if (Op && (Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState)); } /* We are only interested in opcodes that have an associated name */ - if (WalkState->Op) + if (Op) { - if (!(WalkState->OpInfo->Flags & AML_NAMED)) + if (!(WalkState->OpInfo->Flags & AML_NAMED)) { *OutOp = Op; return (AE_OK); @@ -225,7 +225,7 @@ AcpiDsLoad1BeginOp ( /* Check if this object has already been installed in the namespace */ - if (Op->Node) + if (Op->Common.Node) { *OutOp = Op; return (AE_OK); @@ -239,7 +239,7 @@ AcpiDsLoad1BeginOp ( ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); + "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); /* * Enter the named type into the internal namespace. We enter the name @@ -267,13 +267,13 @@ AcpiDsLoad1BeginOp ( /* Initialize */ - ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name.Integer; + Op->Named.Name = Node->Name.Integer; /* * Put the Node in the "op" object that the parser uses, so we * can get it again quickly when this scope is closed */ - Op->Node = Node; + Op->Common.Node = Node; AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op); *OutOp = Op; @@ -302,6 +302,7 @@ AcpiDsLoad1EndOp ( { ACPI_PARSE_OBJECT *Op; ACPI_OBJECT_TYPE ObjectType; + ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_NAME ("DsLoad1EndOp"); @@ -327,27 +328,30 @@ AcpiDsLoad1EndOp ( WalkState->Opcode == AML_BANK_FIELD_OP || WalkState->Opcode == AML_INDEX_FIELD_OP) { - AcpiDsInitFieldObjects (Op, WalkState); + Status = AcpiDsInitFieldObjects (Op, WalkState); } - return (AE_OK); + return (Status); } - if (Op->Opcode == AML_REGION_OP) + if (Op->Common.AmlOpcode == AML_REGION_OP) { - /*Status = */AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - (ACPI_ADR_SPACE_TYPE) ((Op->Value.Arg)->Value.Integer), WalkState); + Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length, + (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } - if (Op->Opcode == AML_NAME_OP) + if (Op->Common.AmlOpcode == AML_NAME_OP) { /* For Name opcode, get the object type from the argument */ - if (Op->Value.Arg) + if (Op->Common.Value.Arg) { - ObjectType = (AcpiPsGetOpcodeInfo ((Op->Value.Arg)->Opcode))->ObjectType; - Op->Node->Type = (UINT8) ObjectType; + ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType; + Op->Common.Node->Type = (UINT8) ObjectType; } } @@ -358,10 +362,10 @@ AcpiDsLoad1EndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", AcpiUtGetTypeName (ObjectType), Op)); - AcpiDsScopeStackPop (WalkState); + Status = AcpiDsScopeStackPop (WalkState); } - return (AE_OK); + return (Status); } @@ -389,7 +393,6 @@ AcpiDsLoad2BeginOp ( ACPI_STATUS Status; ACPI_OBJECT_TYPE ObjectType; NATIVE_CHAR *BufferPtr; - void *Original = NULL; ACPI_FUNCTION_NAME ("DsLoad2BeginOp"); @@ -415,7 +418,7 @@ AcpiDsLoad2BeginOp ( { /* For Namepath op, get the path string */ - BufferPtr = Op->Value.String; + BufferPtr = Op->Common.Value.String; if (!BufferPtr) { /* No name, just exit */ @@ -427,7 +430,7 @@ AcpiDsLoad2BeginOp ( { /* Get name from the op */ - BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name; + BufferPtr = (NATIVE_CHAR *) &Op->Named.Name; } } else @@ -442,7 +445,7 @@ AcpiDsLoad2BeginOp ( ObjectType = WalkState->OpInfo->ObjectType; ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "State=%p Op=%p Type=%x\n", WalkState, Op, ObjectType)); + "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType)); if (WalkState->Opcode == AML_FIELD_OP || @@ -463,10 +466,13 @@ AcpiDsLoad2BeginOp ( } else { - if (Op && Op->Node) + /* All other opcodes */ + + if (Op && Op->Common.Node) { - Original = Op->Node; - Node = Op->Node; + /* This op/node was previously entered into the namespace */ + + Node = Op->Common.Node; if (AcpiNsOpensScope (ObjectType)) { @@ -503,26 +509,21 @@ AcpiDsLoad2BeginOp ( /* Initialize the new op */ - ((ACPI_PARSE2_OBJECT *)Op)->Name = Node->Name.Integer; - *OutOp = Op; + if (Node) + { + Op->Named.Name = Node->Name.Integer; + } + if (OutOp) + { + *OutOp = Op; + } } /* * Put the Node in the "op" object that the parser uses, so we * can get it again quickly when this scope is closed */ - Op->Node = Node; - - if (Original) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "old %p new %p\n", Original, Node)); - - if (Original != Node) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Lookup match error: old %p new %p\n", Original, Node)); - } - } + Op->Common.Node = Node; } return (Status); @@ -570,12 +571,12 @@ AcpiDsLoad2EndOp ( return (AE_OK); } - if (Op->Opcode == AML_SCOPE_OP) + if (Op->Common.AmlOpcode == AML_SCOPE_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Ending scope Op=%p State=%p\n", Op, WalkState)); - if (((ACPI_PARSE2_OBJECT *)Op)->Name == ACPI_UINT16_MAX) + if (Op->Named.Name == ACPI_UINT16_MAX) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unnamed scope! Op=%p State=%p\n", Op, WalkState)); @@ -590,7 +591,7 @@ AcpiDsLoad2EndOp ( * Get the Node/name from the earlier lookup * (It was saved in the *op structure) */ - Node = Op->Node; + Node = Op->Common.Node; /* * Put the Node on the object stack (Contains the ACPI Name of @@ -605,7 +606,12 @@ AcpiDsLoad2EndOp ( { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n", AcpiUtGetTypeName (ObjectType), Op)); - AcpiDsScopeStackPop (WalkState); + + Status = AcpiDsScopeStackPop (WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } /* @@ -638,11 +644,11 @@ AcpiDsLoad2EndOp ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", - AcpiPsGetOpcodeName (Op->Opcode), WalkState, Op, Node)); + AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node)); /* Decode the opcode */ - Arg = Op->Value.Arg; + Arg = Op->Common.Value.Arg; switch (WalkState->OpInfo->Type) { @@ -658,22 +664,26 @@ AcpiDsLoad2EndOp ( case AML_TYPE_NAMED_FIELD: - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_INDEX_FIELD_OP: - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node, + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node, WalkState); break; case AML_BANK_FIELD_OP: - Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); + Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState); break; case AML_FIELD_OP: - Status = AcpiDsCreateField (Op, Arg->Node, WalkState); + Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState); + break; + + default: + /* All NAMED_FIELD opcodes must be handled above */ break; } break; @@ -687,7 +697,7 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_PROCESSOR_OP: @@ -739,7 +749,7 @@ AcpiDsLoad2EndOp ( case AML_TYPE_NAMED_COMPLEX: - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_METHOD_OP: /* @@ -757,9 +767,8 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - WalkState); + Status = AcpiExCreateMethod (Op->Named.Data, + Op->Named.Length, WalkState); } break; @@ -793,6 +802,11 @@ AcpiDsLoad2EndOp ( Status = AcpiDsCreateNode (WalkState, Node, Op); break; + + + default: + /* All NAMED_COMPLEX opcodes must be handled above */ + break; } break; @@ -812,7 +826,7 @@ AcpiDsLoad2EndOp ( /* * Lookup the method name and save the Node */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(NewNode)); @@ -831,7 +845,7 @@ AcpiDsLoad2EndOp ( * for now, we will put it in the "op" object that the parser uses, so we * can get it again at the end of this scope */ - Op->Node = NewNode; + Op->Common.Node = NewNode; } break; diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c index faa1f6e..f38d721 100644 --- a/sys/contrib/dev/acpica/dswstate.c +++ b/sys/contrib/dev/acpica/dswstate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines - * $Revision: 59 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -118,11 +118,9 @@ #define __DSWSTATE_C__ #include "acpi.h" -#include "amlcode.h" #include "acparser.h" #include "acdispat.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dswstate") @@ -182,7 +180,7 @@ AcpiDsResultInsert ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL", + Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL", WalkState, State->Results.NumResults, WalkState->CurrentResult)); return (AE_OK); @@ -223,14 +221,13 @@ AcpiDsResultRemove ( return (AE_NOT_EXIST); } - if (Index >= OBJ_NUM_OPERANDS) + if (Index >= OBJ_MAX_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index out of range: %X State=%p Num=%X\n", Index, WalkState, State->Results.NumResults)); } - /* Check for a valid result object */ if (!State->Results.ObjDesc [Index]) @@ -250,7 +247,7 @@ AcpiDsResultRemove ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL", + *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", Index, WalkState, State->Results.NumResults)); return (AE_OK); @@ -310,7 +307,7 @@ AcpiDsResultPop ( State->Results.ObjDesc [Index -1] = NULL; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL", + *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", Index -1, WalkState, State->Results.NumResults)); return (AE_OK); @@ -340,7 +337,7 @@ AcpiDsResultPopFromBottom ( ACPI_OPERAND_OBJECT **Object, ACPI_WALK_STATE *WalkState) { - UINT32 Index; + NATIVE_UINT Index; ACPI_GENERIC_STATE *State; @@ -355,7 +352,6 @@ AcpiDsResultPopFromBottom ( return (AE_NOT_EXIST); } - if (!State->Results.NumResults) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState)); @@ -380,12 +376,12 @@ AcpiDsResultPopFromBottom ( if (!*Object) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n", - WalkState, State->Results.NumResults, Index)); + WalkState, State->Results.NumResults, (UINT32) Index)); return (AE_AML_NO_RETURN_VALUE); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n", - *Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL", + *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL", State, WalkState)); @@ -439,12 +435,11 @@ AcpiDsResultPush ( return (AE_BAD_PARAMETER); } - State->Results.ObjDesc [State->Results.NumResults] = Object; State->Results.NumResults++; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL", + Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL", WalkState, State->Results.NumResults, WalkState->CurrentResult)); return (AE_OK); @@ -607,7 +602,7 @@ AcpiDsObjStackPush ( WalkState->NumOperands++; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - Object, AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type), + Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object), WalkState, WalkState->NumOperands)); return (AE_OK); @@ -669,7 +664,7 @@ AcpiDsObjStackPopObject ( WalkState->Operands [WalkState->NumOperands] = NULL; ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n", - *Object, AcpiUtGetTypeName ((*Object)->Common.Type), + *Object, AcpiUtGetObjectTypeName (*Object), WalkState, WalkState->NumOperands)); return (AE_OK); @@ -818,7 +813,6 @@ AcpiDsObjStackGetValue ( return_PTR (NULL); } - return_PTR (WalkState->Operands[(NATIVE_UINT)(WalkState->NumOperands - 1) - Index]); } @@ -853,7 +847,6 @@ AcpiDsGetCurrentWalkState ( ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "DsGetCurrentWalkState, =%p\n", Thread->WalkStateList)); - return (Thread->WalkStateList); } @@ -1049,7 +1042,6 @@ AcpiDsInitAmlWalk ( WalkState->MethodNode = MethodNode; WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode); - /* Push start scope on scope stack and make it current */ Status = AcpiDsScopeStackPush (MethodNode, ACPI_TYPE_METHOD, WalkState); @@ -1060,14 +1052,17 @@ AcpiDsInitAmlWalk ( /* Init the method arguments */ - AcpiDsMethodDataInitArgs (Params, MTH_NUM_ARGS, WalkState); + Status = AcpiDsMethodDataInitArgs (Params, MTH_NUM_ARGS, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } - else { /* Setup the current scope */ - ParserState->StartNode = ParserState->StartOp->Node; + ParserState->StartNode = ParserState->StartOp->Common.Node; if (ParserState->StartNode) { /* Push start scope on scope stack and make it current */ @@ -1081,9 +1076,8 @@ AcpiDsInitAmlWalk ( } } - AcpiDsInitCallbacks (WalkState, PassNumber); - - return_ACPI_STATUS (AE_OK); + Status = AcpiDsInitCallbacks (WalkState, PassNumber); + return_ACPI_STATUS (Status); } #endif @@ -1121,7 +1115,6 @@ AcpiDsDeleteWalkState ( return; } - if (WalkState->ParserState.Scope) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState)); diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c index 0ff96e2..e4a22b3 100644 --- a/sys/contrib/dev/acpica/evevent.c +++ b/sys/contrib/dev/acpica/evevent.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evevent - Fixed and General Purpose Even handling and dispatch - * $Revision: 78 $ + * $Revision: 88 $ * *****************************************************************************/ @@ -115,7 +115,6 @@ *****************************************************************************/ #include "acpi.h" -#include "achware.h" #include "acevents.h" #include "acnamesp.h" @@ -256,6 +255,7 @@ AcpiEvFixedEventInitialize ( void) { NATIVE_UINT i; + ACPI_STATUS Status; /* @@ -271,8 +271,12 @@ AcpiEvFixedEventInitialize ( if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF) { - AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[i].EnableRegisterId, + Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } } @@ -299,7 +303,7 @@ AcpiEvFixedEventDetect ( UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT32 GpeStatus; UINT32 GpeEnable; - NATIVE_UINT i; + NATIVE_UINT_MAX32 i; ACPI_FUNCTION_NAME ("EvFixedEventDetect"); @@ -307,10 +311,10 @@ AcpiEvFixedEventDetect ( /* * Read the fixed feature status and enable registers, as all the cases - * depend on their values. + * depend on their values. Ignore errors here. */ - GpeStatus = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS); - GpeEnable = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE); + (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &GpeStatus); + (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &GpeEnable); ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, "Fixed AcpiEvent Block: Enable %08X Status %08X\n", @@ -360,7 +364,7 @@ AcpiEvFixedEventDispatch ( /* Clear the status bit */ - AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1, ACPI_MTX_DO_NOT_LOCK); /* @@ -369,7 +373,7 @@ AcpiEvFixedEventDispatch ( */ if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler) { - AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0, ACPI_MTX_DO_NOT_LOCK); ACPI_REPORT_ERROR ( @@ -401,13 +405,14 @@ AcpiEvFixedEventDispatch ( ACPI_STATUS AcpiEvGpeInitialize (void) { - NATIVE_UINT i; - NATIVE_UINT j; - NATIVE_UINT GpeBlock; + NATIVE_UINT_MAX32 i; + NATIVE_UINT_MAX32 j; + UINT32 GpeBlock; UINT32 GpeRegister; UINT32 GpeNumberIndex; UINT32 GpeNumber; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("EvGpeInitialize"); @@ -478,8 +483,9 @@ AcpiEvGpeInitialize (void) /* * Allocate the GPE number-to-index translation table */ - AcpiGbl_GpeNumberToIndex = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_INDEX_INFO) * - (AcpiGbl_GpeNumberMax + 1)); + AcpiGbl_GpeNumberToIndex = ACPI_MEM_CALLOCATE ( + sizeof (ACPI_GPE_INDEX_INFO) * + ((ACPI_SIZE) AcpiGbl_GpeNumberMax + 1)); if (!AcpiGbl_GpeNumberToIndex) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -490,12 +496,13 @@ AcpiEvGpeInitialize (void) /* Set the Gpe index table to GPE_INVALID */ ACPI_MEMSET (AcpiGbl_GpeNumberToIndex, (int) ACPI_GPE_INVALID, - sizeof (ACPI_GPE_INDEX_INFO) * (AcpiGbl_GpeNumberMax + 1)); + sizeof (ACPI_GPE_INDEX_INFO) * ((ACPI_SIZE) AcpiGbl_GpeNumberMax + 1)); /* * Allocate the GPE register information block */ - AcpiGbl_GpeRegisterInfo = ACPI_MEM_CALLOCATE (AcpiGbl_GpeRegisterCount * + AcpiGbl_GpeRegisterInfo = ACPI_MEM_CALLOCATE ( + (ACPI_SIZE) AcpiGbl_GpeRegisterCount * sizeof (ACPI_GPE_REGISTER_INFO)); if (!AcpiGbl_GpeRegisterInfo) { @@ -508,8 +515,9 @@ AcpiEvGpeInitialize (void) * Allocate the GPE dispatch handler block. There are eight distinct GPEs * per register. Initialization to zeros is sufficient. */ - AcpiGbl_GpeNumberInfo = ACPI_MEM_CALLOCATE (ACPI_MUL_8 (AcpiGbl_GpeRegisterCount) * - sizeof (ACPI_GPE_NUMBER_INFO)); + AcpiGbl_GpeNumberInfo = ACPI_MEM_CALLOCATE ( + (ACPI_SIZE) ACPI_MUL_8 (AcpiGbl_GpeRegisterCount) * + sizeof (ACPI_GPE_NUMBER_INFO)); if (!AcpiGbl_GpeNumberInfo) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the GpeNumberInfo table\n")); @@ -534,14 +542,17 @@ AcpiEvGpeInitialize (void) /* Init the Register info for this entire GPE register (8 GPEs) */ - GpeRegisterInfo->BaseGpeNumber = (UINT8) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber + (ACPI_MUL_8 (i))); + GpeRegisterInfo->BaseGpeNumber = (UINT8) (AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber + + (ACPI_MUL_8 (i))); ACPI_STORE_ADDRESS (GpeRegisterInfo->StatusAddress.Address, - (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address) + i)); + (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address) + + i)); ACPI_STORE_ADDRESS (GpeRegisterInfo->EnableAddress.Address, - (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address) + i + - AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount)); + (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address) + + i + + AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount)); GpeRegisterInfo->StatusAddress.AddressSpaceId = AcpiGbl_GpeBlockInfo[GpeBlock].AddressSpaceId; GpeRegisterInfo->EnableAddress.AddressSpaceId = AcpiGbl_GpeBlockInfo[GpeBlock].AddressSpaceId; @@ -567,19 +578,28 @@ AcpiEvGpeInitialize (void) * by writing a '0'. */ - AcpiHwLowLevelWrite (8, 0x00, &GpeRegisterInfo->EnableAddress, 0); - AcpiHwLowLevelWrite (8, 0xFF, &GpeRegisterInfo->StatusAddress, 0); + Status = AcpiHwLowLevelWrite (8, 0x00, &GpeRegisterInfo->EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiHwLowLevelWrite (8, 0xFF, &GpeRegisterInfo->StatusAddress, 0); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } GpeRegister++; } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d: %X registers at %8.8X%8.8X\n", - GpeBlock, AcpiGbl_GpeBlockInfo[0].RegisterCount, - ACPI_HIDWORD (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address), - ACPI_LODWORD (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address))); + (INT32) GpeBlock, AcpiGbl_GpeBlockInfo[0].RegisterCount, + ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address)), + ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress->Address)))); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "GPE Block%d Range GPE #%2.2X to GPE #%2.2X\n", - GpeBlock, + (INT32) GpeBlock, AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber, AcpiGbl_GpeBlockInfo[GpeBlock].BlockBaseNumber + ((AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount * 8) -1))); @@ -632,6 +652,7 @@ AcpiEvSaveMethodInfo ( UINT32 GpeNumberIndex; NATIVE_CHAR Name[ACPI_NAME_SIZE + 1]; UINT8 Type; + ACPI_STATUS Status; ACPI_FUNCTION_NAME ("EvSaveMethodInfo"); @@ -640,7 +661,7 @@ AcpiEvSaveMethodInfo ( /* Extract the name from the object and convert to a string */ ACPI_MOVE_UNALIGNED32_TO_32 (Name, - &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name); + &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer); Name[ACPI_NAME_SIZE] = 0; /* @@ -698,7 +719,11 @@ AcpiEvSaveMethodInfo ( /* * Enable the GPE (SCIs should be disabled at this point) */ - AcpiHwEnableGpe (GpeNumber); + Status = AcpiHwEnableGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + return (Status); + } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Registered GPE method %s as GPE number %X\n", Name, GpeNumber)); @@ -768,6 +793,8 @@ AcpiEvGpeDetect (void) UINT8 EnabledStatusByte; UINT8 BitMask; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + UINT32 InValue; + ACPI_STATUS Status; ACPI_FUNCTION_NAME ("EvGpeDetect"); @@ -782,16 +809,24 @@ AcpiEvGpeDetect (void) { GpeRegisterInfo = &AcpiGbl_GpeRegisterInfo[i]; - GpeRegisterInfo->Status = (UINT8) AcpiHwLowLevelRead (8, - &GpeRegisterInfo->StatusAddress, 0); + Status = AcpiHwLowLevelRead (8, &InValue, &GpeRegisterInfo->StatusAddress, 0); + GpeRegisterInfo->Status = (UINT8) InValue; + if (ACPI_FAILURE (Status)) + { + return (ACPI_INTERRUPT_NOT_HANDLED); + } - GpeRegisterInfo->Enable = (UINT8) AcpiHwLowLevelRead (8, - &GpeRegisterInfo->EnableAddress, 0); + Status = AcpiHwLowLevelRead (8, &InValue, &GpeRegisterInfo->EnableAddress, 0); + GpeRegisterInfo->Enable = (UINT8) InValue; + if (ACPI_FAILURE (Status)) + { + return (ACPI_INTERRUPT_NOT_HANDLED); + } ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "GPE block at %8.8X%8.8X - Enable %08X Status %08X\n", - ACPI_HIDWORD (GpeRegisterInfo->EnableAddress.Address), - ACPI_LODWORD (GpeRegisterInfo->EnableAddress.Address), + "GPE block at %8.8X%8.8X - Values: Enable %02X Status %02X\n", + ACPI_HIDWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), + ACPI_LODWORD (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)), GpeRegisterInfo->Enable, GpeRegisterInfo->Status)); @@ -851,6 +886,7 @@ AcpiEvAsynchExecuteGpeMethod ( UINT32 GpeNumber = (UINT32) ACPI_TO_INTEGER (Context); UINT32 GpeNumberIndex; ACPI_GPE_NUMBER_INFO GpeInfo; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod"); @@ -866,13 +902,15 @@ AcpiEvAsynchExecuteGpeMethod ( * Take a snapshot of the GPE info for this level - we copy the * info to prevent a race condition with RemoveHandler. */ - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_EVENTS))) + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) { return_VOID; } GpeInfo = AcpiGbl_GpeNumberInfo [GpeNumberIndex]; - if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_EVENTS))) + Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); + if (ACPI_FAILURE (Status)) { return_VOID; } @@ -883,7 +921,12 @@ AcpiEvAsynchExecuteGpeMethod ( * Invoke the GPE Method (_Lxx, _Exx): * (Evaluate the _Lxx/_Exx control method that corresponds to this GPE.) */ - AcpiNsEvaluateByHandle (GpeInfo.MethodHandle, NULL, NULL); + Status = AcpiNsEvaluateByHandle (GpeInfo.MethodHandle, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("%s while evaluated GPE%X method\n", + AcpiFormatException (Status), GpeNumber)); + } } if (GpeInfo.Type & ACPI_EVENT_LEVEL_TRIGGERED) @@ -892,13 +935,17 @@ AcpiEvAsynchExecuteGpeMethod ( * GPE is level-triggered, we clear the GPE status bit after handling * the event. */ - AcpiHwClearGpe (GpeNumber); + Status = AcpiHwClearGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } } /* * Enable the GPE. */ - AcpiHwEnableGpe (GpeNumber); + (void) AcpiHwEnableGpe (GpeNumber); return_VOID; } @@ -923,6 +970,7 @@ AcpiEvGpeDispatch ( { UINT32 GpeNumberIndex; ACPI_GPE_NUMBER_INFO *GpeInfo; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("EvGpeDispatch"); @@ -947,7 +995,12 @@ AcpiEvGpeDispatch ( */ if (GpeInfo->Type & ACPI_EVENT_EDGE_TRIGGERED) { - AcpiHwClearGpe (GpeNumber); + Status = AcpiHwClearGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%X]\n", GpeNumber)); + return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + } } /* @@ -969,7 +1022,12 @@ AcpiEvGpeDispatch ( * Disable GPE, so it doesn't keep firing before the method has a * chance to run. */ - AcpiHwDisableGpe (GpeNumber); + Status = AcpiHwDisableGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%X]\n", GpeNumber)); + return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + } /* * Execute the method associated with the GPE. @@ -991,7 +1049,12 @@ AcpiEvGpeDispatch ( * Disable the GPE. The GPE will remain disabled until the ACPI * Core Subsystem is restarted, or the handler is reinstalled. */ - AcpiHwDisableGpe (GpeNumber); + Status = AcpiHwDisableGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to disable GPE[%X]\n", GpeNumber)); + return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + } } /* @@ -999,7 +1062,12 @@ AcpiEvGpeDispatch ( */ if (GpeInfo->Type & ACPI_EVENT_LEVEL_TRIGGERED) { - AcpiHwClearGpe (GpeNumber); + Status = AcpiHwClearGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%X]\n", GpeNumber)); + return_VALUE (ACPI_INTERRUPT_NOT_HANDLED); + } } return_VALUE (ACPI_INTERRUPT_HANDLED); diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c index aae63b2..86f91a5 100644 --- a/sys/contrib/dev/acpica/evmisc.c +++ b/sys/contrib/dev/acpica/evmisc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evmisc - Miscellaneous event manager support functions - * $Revision: 48 $ + * $Revision: 53 $ * *****************************************************************************/ @@ -118,7 +118,6 @@ #include "acevents.h" #include "acnamesp.h" #include "acinterp.h" -#include "achware.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evmisc") @@ -273,7 +272,7 @@ AcpiEvQueueNotifyRequest ( } /* - * Get the notify object attached to the device Node + * Get the notify object attached to the NS Node */ ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) @@ -283,29 +282,23 @@ AcpiEvQueueNotifyRequest ( switch (Node->Type) { case ACPI_TYPE_DEVICE: - - if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) - { - HandlerObj = ObjDesc->Device.SysHandler; - } - else - { - HandlerObj = ObjDesc->Device.DrvHandler; - } - break; - - case ACPI_TYPE_THERMAL: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_POWER: if (NotifyValue <= ACPI_MAX_SYS_NOTIFY) { - HandlerObj = ObjDesc->ThermalZone.SysHandler; + HandlerObj = ObjDesc->CommonNotify.SysHandler; } else { - HandlerObj = ObjDesc->ThermalZone.DrvHandler; + HandlerObj = ObjDesc->CommonNotify.DrvHandler; } break; + + default: + /* All other types are not supported */ + return (AE_TYPE); } } @@ -434,6 +427,8 @@ static void ACPI_SYSTEM_XFACE AcpiEvGlobalLockThread ( void *Context) { + ACPI_STATUS Status; + /* Signal threads that are waiting for the lock */ @@ -441,8 +436,12 @@ AcpiEvGlobalLockThread ( { /* Send sufficient units to the semaphore */ - AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, + Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, AcpiGbl_GlobalLockThreadCount); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n")); + } } } @@ -464,6 +463,7 @@ AcpiEvGlobalLockHandler ( void *Context) { BOOLEAN Acquired = FALSE; + ACPI_STATUS Status; /* @@ -480,8 +480,15 @@ AcpiEvGlobalLockHandler ( /* Run the Global Lock thread which will signal all waiting threads */ - AcpiOsQueueForExecution (OSD_PRIORITY_HIGH, AcpiEvGlobalLockThread, - Context); + Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH, + AcpiEvGlobalLockThread, Context); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n", + AcpiFormatException (Status))); + + return (ACPI_INTERRUPT_NOT_HANDLED); + } } return (ACPI_INTERRUPT_HANDLED); @@ -604,10 +611,11 @@ AcpiEvAcquireGlobalLock ( * ******************************************************************************/ -void +ACPI_STATUS AcpiEvReleaseGlobalLock (void) { BOOLEAN Pending = FALSE; + ACPI_STATUS Status = AE_OK; ACPI_FUNCTION_TRACE ("EvReleaseGlobalLock"); @@ -616,7 +624,7 @@ AcpiEvReleaseGlobalLock (void) if (!AcpiGbl_GlobalLockThreadCount) { ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n")); - return_VOID; + return_ACPI_STATUS (AE_NOT_ACQUIRED); } /* One fewer thread has the global lock */ @@ -626,7 +634,7 @@ AcpiEvReleaseGlobalLock (void) { /* There are still some threads holding the lock, cannot release */ - return_VOID; + return_ACPI_STATUS (AE_OK); } /* @@ -642,10 +650,10 @@ AcpiEvReleaseGlobalLock (void) */ if (Pending) { - AcpiHwBitRegisterWrite (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); + Status = AcpiSetRegister (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK); } - return_VOID; + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c index 32410e9..9a73be0 100644 --- a/sys/contrib/dev/acpica/evregion.c +++ b/sys/contrib/dev/acpica/evregion.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch - * $Revision: 128 $ + * $Revision: 134 $ * *****************************************************************************/ @@ -121,15 +121,15 @@ #include "acevents.h" #include "acnamesp.h" #include "acinterp.h" -#include "amlcode.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evregion") + /******************************************************************************* * - * FUNCTION: AcpiEvInstallDefaultAddressSpaceHandlers + * FUNCTION: AcpiEvInitAddressSpaces * * PARAMETERS: * @@ -140,13 +140,13 @@ ******************************************************************************/ ACPI_STATUS -AcpiEvInstallDefaultAddressSpaceHandlers ( +AcpiEvInitAddressSpaces ( void) { ACPI_STATUS Status; - ACPI_FUNCTION_TRACE ("EvInstallDefaultAddressSpaceHandlers"); + ACPI_FUNCTION_TRACE ("EvInitAddressSpaces"); /* @@ -267,7 +267,7 @@ AcpiEvExecuteRegMethod ( /* * Set up the parameter objects */ - Params[0]->Integer.Value = RegionObj->Region.SpaceId; + Params[0]->Integer.Value = RegionObj->Region.SpaceId; Params[1]->Integer.Value = Function; Params[2] = NULL; @@ -310,9 +310,10 @@ AcpiEvAddressSpaceDispatch ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, - ACPI_INTEGER *Value) + void *Value) { ACPI_STATUS Status; + ACPI_STATUS Status2; ACPI_ADR_SPACE_HANDLER Handler; ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; @@ -372,7 +373,11 @@ AcpiEvAddressSpaceDispatch ( /* Re-enter the interpreter */ - AcpiExEnterInterpreter (); + Status2 = AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status2)) + { + return_ACPI_STATUS (Status2); + } /* * Init routine may fail @@ -434,7 +439,11 @@ AcpiEvAddressSpaceDispatch ( * We just returned from a non-default handler, we must re-enter the * interpreter */ - AcpiExEnterInterpreter (); + Status2 = AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status2)) + { + return_ACPI_STATUS (Status2); + } } return_ACPI_STATUS (Status); @@ -442,7 +451,7 @@ AcpiEvAddressSpaceDispatch ( /******************************************************************************* * - * FUNCTION: AcpiEvDisassociateRegionFromHandler + * FUNCTION: AcpiEvDetachRegion * * PARAMETERS: RegionObj - Region Object * AcpiNsIsLocked - Namespace Region Already Locked? @@ -455,7 +464,7 @@ AcpiEvAddressSpaceDispatch ( ******************************************************************************/ void -AcpiEvDisassociateRegionFromHandler( +AcpiEvDetachRegion( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked) { @@ -468,13 +477,13 @@ AcpiEvDisassociateRegionFromHandler( ACPI_STATUS Status; - ACPI_FUNCTION_TRACE ("EvDisassociateRegionFromHandler"); + ACPI_FUNCTION_TRACE ("EvDetachRegion"); RegionObj2 = AcpiNsGetSecondaryObject (RegionObj); if (!RegionObj2) { - return; + return_VOID; } RegionContext = RegionObj2->Extra.RegionContext; @@ -525,7 +534,13 @@ AcpiEvDisassociateRegionFromHandler( /* * Now stop region accesses by executing the _REG method */ - AcpiEvExecuteRegMethod (RegionObj, 0); + Status = AcpiEvExecuteRegMethod (RegionObj, 0); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n", + AcpiFormatException (Status), + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + } if (AcpiNsIsLocked) { @@ -591,7 +606,7 @@ AcpiEvDisassociateRegionFromHandler( /******************************************************************************* * - * FUNCTION: AcpiEvAssociateRegionAndHandler + * FUNCTION: AcpiEvAttachRegion * * PARAMETERS: HandlerObj - Handler Object * RegionObj - Region Object @@ -605,15 +620,16 @@ AcpiEvDisassociateRegionFromHandler( ******************************************************************************/ ACPI_STATUS -AcpiEvAssociateRegionAndHandler ( +AcpiEvAttachRegion ( ACPI_OPERAND_OBJECT *HandlerObj, ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsIsLocked) { - ACPI_STATUS Status; + ACPI_STATUS Status; + ACPI_STATUS Status2; - ACPI_FUNCTION_TRACE ("EvAssociateRegionAndHandler"); + ACPI_FUNCTION_TRACE ("EvAttachRegion"); ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, @@ -638,14 +654,22 @@ AcpiEvAssociateRegionAndHandler ( */ if (AcpiNsIsLocked) { - AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + Status2 = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status2)) + { + return_ACPI_STATUS (Status2); + } } Status = AcpiEvExecuteRegMethod (RegionObj, 1); if (AcpiNsIsLocked) { - (void) AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + Status2 = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status2)) + { + return_ACPI_STATUS (Status2); + } } return_ACPI_STATUS (Status); @@ -730,7 +754,7 @@ AcpiEvAddrHandlerHelper ( /* * Devices are handled different than regions */ - if (ObjDesc->Common.Type == ACPI_TYPE_DEVICE) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_DEVICE) { /* * See if this guy has any handlers @@ -793,12 +817,12 @@ AcpiEvAddrHandlerHelper ( * * First disconnect region for any previous handler (if any) */ - AcpiEvDisassociateRegionFromHandler (ObjDesc, FALSE); + AcpiEvDetachRegion (ObjDesc, FALSE); /* * Then connect the region to the new handler */ - Status = AcpiEvAssociateRegionAndHandler (HandlerObj, ObjDesc, FALSE); + Status = AcpiEvAttachRegion (HandlerObj, ObjDesc, FALSE); return (Status); } diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c index d5d0f48..76890f4 100644 --- a/sys/contrib/dev/acpica/evrgnini.c +++ b/sys/contrib/dev/acpica/evrgnini.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evrgnini- ACPI AddressSpace (OpRegion) init - * $Revision: 57 $ + * $Revision: 62 $ * *****************************************************************************/ @@ -120,8 +120,6 @@ #include "acpi.h" #include "acevents.h" #include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evrgnini") @@ -131,8 +129,8 @@ * * FUNCTION: AcpiEvSystemMemoryRegionSetup * - * PARAMETERS: RegionObj - region we are interested in - * Function - start or stop + * PARAMETERS: RegionObj - Region we are interested in + * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * @@ -152,6 +150,7 @@ AcpiEvSystemMemoryRegionSetup ( ACPI_OPERAND_OBJECT *RegionDesc = (ACPI_OPERAND_OBJECT *) Handle; ACPI_MEM_SPACE_CONTEXT *LocalRegionContext; + ACPI_FUNCTION_TRACE ("EvSystemMemoryRegionSetup"); @@ -165,8 +164,7 @@ AcpiEvSystemMemoryRegionSetup ( return_ACPI_STATUS (AE_OK); } - - /* Activate. Create a new context */ + /* Create a new context */ LocalRegionContext = ACPI_MEM_CALLOCATE (sizeof (ACPI_MEM_SPACE_CONTEXT)); if (!(LocalRegionContext)) @@ -188,8 +186,8 @@ AcpiEvSystemMemoryRegionSetup ( * * FUNCTION: AcpiEvIoSpaceRegionSetup * - * PARAMETERS: RegionObj - region we are interested in - * Function - start or stop + * PARAMETERS: RegionObj - Region we are interested in + * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * @@ -226,8 +224,8 @@ AcpiEvIoSpaceRegionSetup ( * * FUNCTION: AcpiEvPciConfigRegionSetup * - * PARAMETERS: RegionObj - region we are interested in - * Function - start or stop + * PARAMETERS: RegionObj - Region we are interested in + * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * @@ -262,8 +260,8 @@ AcpiEvPciConfigRegionSetup ( if (!HandlerObj) { /* - * No installed handler. This shouldn't happen because the dispatch - * routine checks before we get here, but we check again just in case. + * No installed handler. This shouldn't happen because the dispatch + * routine checks before we get here, but we check again just in case. */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Attempting to init a region %p, with no handler\n", RegionObj)); @@ -281,7 +279,6 @@ AcpiEvPciConfigRegionSetup ( return_ACPI_STATUS (Status); } - /* Create a new context */ PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID)); @@ -291,43 +288,42 @@ AcpiEvPciConfigRegionSetup ( } /* - * For PCI Config space access, we have to pass the segment, bus, - * device and function numbers. This routine must acquire those. + * For PCI Config space access, we have to pass the segment, bus, + * device and function numbers. This routine must acquire those. */ /* - * First get device and function numbers from the _ADR object - * in the parent's scope. + * First get device and function numbers from the _ADR object + * in the parent's scope. */ Node = AcpiNsGetParentNode (RegionObj->Region.Node); - - /* AcpiEvaluate the _ADR object */ + /* Evaluate the _ADR object */ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &Temp); /* - * The default is zero, since the allocation above zeroed the data, just - * do nothing on failures. + * The default is zero, and since the allocation above zeroed + * the data, just do nothing on failure. */ if (ACPI_SUCCESS (Status)) { - PciId->Device = ACPI_HIWORD (Temp); - PciId->Function = ACPI_LOWORD (Temp); + PciId->Device = ACPI_HIWORD (ACPI_LODWORD (Temp)); + PciId->Function = ACPI_LOWORD (ACPI_LODWORD (Temp)); } /* - * Get the _SEG and _BBN values from the device upon which the handler - * is installed. + * Get the _SEG and _BBN values from the device upon which the handler + * is installed. * - * We need to get the _SEG and _BBN objects relative to the PCI BUS device. - * This is the device the handler has been registered to handle. + * We need to get the _SEG and _BBN objects relative to the PCI BUS device. + * This is the device the handler has been registered to handle. */ /* - * If the AddrHandler.Node is still pointing to the root, we need - * to scan upward for a PCI Root bridge and re-associate the OpRegion - * handlers with that device. + * If the AddrHandler.Node is still pointing to the root, we need + * to scan upward for a PCI Root bridge and re-associate the OpRegion + * handlers with that device. */ if (HandlerObj->AddrHandler.Node == AcpiGbl_RootNode) { @@ -339,12 +335,21 @@ AcpiEvPciConfigRegionSetup ( Status = AcpiUtExecute_HID (Node, &ObjectHID); if (ACPI_SUCCESS (Status)) { + /* Got a valid _HID, check if this is a PCI root */ + if (!(ACPI_STRNCMP (ObjectHID.Buffer, PCI_ROOT_HID_STRING, sizeof (PCI_ROOT_HID_STRING)))) { - AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) Node, + /* Install a handler for this PCI root bridge */ + + Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) Node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not install PciConfig handler for %4.4s, %s\n", + Node->Name.Ascii, AcpiFormatException (Status))); + } break; } } @@ -384,8 +389,8 @@ AcpiEvPciConfigRegionSetup ( * * FUNCTION: AcpiEvPciBarRegionSetup * - * PARAMETERS: RegionObj - region we are interested in - * Function - start or stop + * PARAMETERS: RegionObj - Region we are interested in + * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * @@ -404,7 +409,6 @@ AcpiEvPciBarRegionSetup ( void *HandlerContext, void **RegionContext) { - ACPI_FUNCTION_TRACE ("EvPciBarRegionSetup"); @@ -416,8 +420,8 @@ AcpiEvPciBarRegionSetup ( * * FUNCTION: AcpiEvCmosRegionSetup * - * PARAMETERS: RegionObj - region we are interested in - * Function - start or stop + * PARAMETERS: RegionObj - Region we are interested in + * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * @@ -436,7 +440,6 @@ AcpiEvCmosRegionSetup ( void *HandlerContext, void **RegionContext) { - ACPI_FUNCTION_TRACE ("EvCmosRegionSetup"); @@ -448,8 +451,8 @@ AcpiEvCmosRegionSetup ( * * FUNCTION: AcpiEvDefaultRegionSetup * - * PARAMETERS: RegionObj - region we are interested in - * Function - start or stop + * PARAMETERS: RegionObj - Region we are interested in + * Function - Start or stop * HandlerContext - Address space handler context * RegionContext - Region specific context * @@ -486,7 +489,8 @@ AcpiEvDefaultRegionSetup ( * * FUNCTION: AcpiEvInitializeRegion * - * PARAMETERS: RegionObj - Region we are initializing + * PARAMETERS: RegionObj - Region we are initializing + * AcpiNsLocked - Is namespace locked? * * RETURN: Status * @@ -536,9 +540,8 @@ AcpiEvInitializeRegion ( { return_ACPI_STATUS (AE_NOT_EXIST); } - Node = AcpiNsGetParentNode (RegionObj->Region.Node); - + Node = AcpiNsGetParentNode (RegionObj->Region.Node); SpaceId = RegionObj->Region.SpaceId; RegionObj->Region.AddrHandler = NULL; @@ -547,35 +550,35 @@ AcpiEvInitializeRegion ( RegionObj->Common.Flags |= AOPOBJ_OBJECT_INITIALIZED; /* - * Find any "_REG" associated with this region definition + * Find any "_REG" method associated with this region definition */ Status = AcpiNsSearchNode (*RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode); if (ACPI_SUCCESS (Status)) { /* - * The _REG method is optional and there can be only one per region - * definition. This will be executed when the handler is attached - * or removed + * The _REG method is optional and there can be only one per region + * definition. This will be executed when the handler is attached + * or removed */ RegionObj2->Extra.Method_REG = MethodNode; } /* - * The following loop depends upon the root Node having no parent - * ie: AcpiGbl_RootNode->ParentEntry being set to NULL + * The following loop depends upon the root Node having no parent + * ie: AcpiGbl_RootNode->ParentEntry being set to NULL */ while (Node) { /* - * Check to see if a handler exists + * Check to see if a handler exists */ HandlerObj = NULL; ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { /* - * can only be a handler if the object exists + * Can only be a handler if the object exists */ switch (Node->Type) { @@ -593,44 +596,45 @@ AcpiEvInitializeRegion ( HandlerObj = ObjDesc->ThermalZone.AddrHandler; break; + + default: + /* Ignore other objects */ + break; } while (HandlerObj) { - /* - * This guy has at least one address handler - * see if it has the type we want - */ + /* Is this handler of the correct type? */ + if (HandlerObj->AddrHandler.SpaceId == SpaceId) { + /* Found correct handler */ + ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "Found handler %p for region %p in obj %p\n", HandlerObj, RegionObj, ObjDesc)); - /* - * Found it! Now update the region and the handler - */ - AcpiEvAssociateRegionAndHandler (HandlerObj, RegionObj, - AcpiNsLocked); + Status = AcpiEvAttachRegion (HandlerObj, RegionObj, + AcpiNsLocked); return_ACPI_STATUS (AE_OK); } - HandlerObj = HandlerObj->AddrHandler.Next; + /* Try next handler in the list */ - } /* while handlerobj */ + HandlerObj = HandlerObj->AddrHandler.Next; + } } /* - * This one does not have the handler we need - * Pop up one level + * This node does not have the handler we need; + * Pop up one level */ Node = AcpiNsGetParentNode (Node); - - } /* while Node != ROOT */ + } /* - * If we get here, there is no handler for this region + * If we get here, there is no handler for this region */ ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION, "No handler for RegionType %s(%X) (RegionObj %p)\n", diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c index 2cb887c..573ca07 100644 --- a/sys/contrib/dev/acpica/evsci.c +++ b/sys/contrib/dev/acpica/evsci.c @@ -2,7 +2,7 @@ * * Module Name: evsci - System Control Interrupt configuration and * legacy to ACPI mode state transition functions - * $Revision: 83 $ + * $Revision: 86 $ * ******************************************************************************/ @@ -117,8 +117,6 @@ *****************************************************************************/ #include "acpi.h" -#include "acnamesp.h" -#include "achware.h" #include "acevents.h" @@ -145,6 +143,8 @@ AcpiEvSciHandler ( void *Context) { UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED; + UINT32 Value; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE("EvSciHandler"); @@ -154,7 +154,13 @@ AcpiEvSciHandler ( * Make sure that ACPI is enabled by checking SCI_EN. Note that we are * required to treat the SCI interrupt as sharable, level, active low. */ - if (!AcpiHwBitRegisterRead (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_DO_NOT_LOCK)) + Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_DO_NOT_LOCK); + if (ACPI_FAILURE (Status)) + { + return (ACPI_INTERRUPT_NOT_HANDLED); + } + + if (!Value) { /* ACPI is not enabled; this interrupt cannot be for us */ @@ -228,15 +234,18 @@ AcpiEvInstallSciHandler (void) ACPI_STATUS AcpiEvRemoveSciHandler (void) { + ACPI_STATUS Status; + + ACPI_FUNCTION_TRACE ("EvRemoveSciHandler"); /* Just let the OS remove the handler and disable the level */ - AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt, + Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt, AcpiEvSciHandler); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c index 7a6a84f..4444070 100644 --- a/sys/contrib/dev/acpica/evxface.c +++ b/sys/contrib/dev/acpica/evxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxface - External interfaces for ACPI events - * $Revision: 126 $ + * $Revision: 129 $ * *****************************************************************************/ @@ -118,10 +118,8 @@ #define __EVXFACE_C__ #include "acpi.h" -#include "achware.h" #include "acnamesp.h" #include "acevents.h" -#include "amlcode.h" #include "acinterp.h" #define _COMPONENT ACPI_EVENTS @@ -178,7 +176,6 @@ AcpiInstallFixedEventHandler ( goto Cleanup; } - /* Install the handler before enabling the event */ AcpiGbl_FixedEventHandlers[Event].Handler = Handler; @@ -655,8 +652,13 @@ AcpiInstallGpeHandler ( /* Clear the GPE (of stale events), the enable it */ - AcpiHwClearGpe (GpeNumber); - AcpiHwEnableGpe (GpeNumber); + Status = AcpiHwClearGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + Status = AcpiHwEnableGpe (GpeNumber); Cleanup: @@ -707,7 +709,11 @@ AcpiRemoveGpeHandler ( /* Disable the GPE before removing the handler */ - AcpiHwDisableGpe (GpeNumber); + Status = AcpiHwDisableGpe (GpeNumber); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) @@ -719,7 +725,7 @@ AcpiRemoveGpeHandler ( if (AcpiGbl_GpeNumberInfo[GpeNumberIndex].Handler != Handler) { - AcpiHwEnableGpe (GpeNumber); + (void) AcpiHwEnableGpe (GpeNumber); Status = AE_BAD_PARAMETER; goto Cleanup; } @@ -797,14 +803,16 @@ ACPI_STATUS AcpiReleaseGlobalLock ( UINT32 Handle) { + ACPI_STATUS Status; + if (Handle != AcpiGbl_GlobalLockHandle) { return (AE_NOT_ACQUIRED); } - AcpiEvReleaseGlobalLock (); - return (AE_OK); + Status = AcpiEvReleaseGlobalLock (); + return (Status); } diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c index 533219d..919e5da 100644 --- a/sys/contrib/dev/acpica/evxfevnt.c +++ b/sys/contrib/dev/acpica/evxfevnt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: evxfevnt - External Interfaces, ACPI event disable/enable - * $Revision: 51 $ + * $Revision: 55 $ * *****************************************************************************/ @@ -118,11 +118,7 @@ #define __EVXFEVNT_C__ #include "acpi.h" -#include "achware.h" -#include "acnamesp.h" #include "acevents.h" -#include "amlcode.h" -#include "acinterp.h" #define _COMPONENT ACPI_EVENTS ACPI_MODULE_NAME ("evxfevnt") @@ -217,7 +213,7 @@ AcpiDisable (void) /* Unload the SCI interrupt handler */ - AcpiEvRemoveSciHandler (); + Status = AcpiEvRemoveSciHandler (); return_ACPI_STATUS (Status); } @@ -243,6 +239,7 @@ AcpiEnableEvent ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; + UINT32 Value; ACPI_FUNCTION_TRACE ("AcpiEnableEvent"); @@ -256,7 +253,7 @@ AcpiEnableEvent ( /* Decode the Fixed Event */ - if (Event > ACPI_NUM_FIXED_EVENTS) + if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -265,13 +262,23 @@ AcpiEnableEvent ( * Enable the requested fixed event (by writing a one to the * enable register bit) */ - AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - 1, ACPI_MTX_LOCK); + Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + 1, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Make sure that the hardware responded */ - if (1 != AcpiHwBitRegisterRead (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_MTX_LOCK)) + Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + &Value, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + if (Value != 1) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not enable %s event\n", AcpiUtGetEventName (Event))); @@ -291,7 +298,11 @@ AcpiEnableEvent ( /* Enable the requested GPE number */ - AcpiHwEnableGpe (Event); + Status = AcpiHwEnableGpe (Event); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } if (Flags & ACPI_EVENT_WAKE_ENABLE) { @@ -330,6 +341,7 @@ AcpiDisableEvent ( UINT32 Flags) { ACPI_STATUS Status = AE_OK; + UINT32 Value; ACPI_FUNCTION_TRACE ("AcpiDisableEvent"); @@ -343,7 +355,7 @@ AcpiDisableEvent ( /* Decode the Fixed Event */ - if (Event > ACPI_NUM_FIXED_EVENTS) + if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -352,11 +364,21 @@ AcpiDisableEvent ( * Disable the requested fixed event (by writing a zero to the * enable register bit) */ - AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - 0, ACPI_MTX_LOCK); + Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + 0, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, + &Value, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - if (0 != AcpiHwBitRegisterRead (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, - ACPI_MTX_LOCK)) + if (Value != 0) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable %s events\n", AcpiUtGetEventName (Event))); @@ -385,7 +407,7 @@ AcpiDisableEvent ( } else { - AcpiHwDisableGpe (Event); + Status = AcpiHwDisableGpe (Event); } break; @@ -430,7 +452,7 @@ AcpiClearEvent ( /* Decode the Fixed Event */ - if (Event > ACPI_NUM_FIXED_EVENTS) + if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -439,7 +461,7 @@ AcpiClearEvent ( * Clear the requested fixed event (By writing a one to the * status register bit) */ - AcpiHwBitRegisterWrite (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1, ACPI_MTX_LOCK); break; @@ -453,7 +475,7 @@ AcpiClearEvent ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiHwClearGpe (Event); + Status = AcpiHwClearGpe (Event); break; @@ -508,15 +530,15 @@ AcpiGetEventStatus ( /* Decode the Fixed Event */ - if (Event > ACPI_NUM_FIXED_EVENTS) + if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Get the status of the requested fixed event */ - *EventStatus = AcpiHwBitRegisterRead (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, - ACPI_MTX_LOCK); + Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, + EventStatus, ACPI_MTX_LOCK); break; @@ -531,7 +553,7 @@ AcpiGetEventStatus ( /* Obtain status on the requested GPE number */ - AcpiHwGetGpeStatus (Event, EventStatus); + Status = AcpiHwGetGpeStatus (Event, EventStatus); break; diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c index 9db190e..41721d6 100644 --- a/sys/contrib/dev/acpica/evxfregn.c +++ b/sys/contrib/dev/acpica/evxfregn.c @@ -2,7 +2,7 @@ * * Module Name: evxfregn - External Interfaces, ACPI Operation Regions and * Address Spaces. - * $Revision: 48 $ + * $Revision: 50 $ * *****************************************************************************/ @@ -118,10 +118,8 @@ #define __EVXFREGN_C__ #include "acpi.h" -#include "achware.h" #include "acnamesp.h" #include "acevents.h" -#include "amlcode.h" #include "acinterp.h" #define _COMPONENT ACPI_EVENTS @@ -471,7 +469,7 @@ AcpiRemoveAddressSpaceHandler ( * The region is just inaccessible as indicated to * the _REG method */ - AcpiEvDisassociateRegionFromHandler(RegionObj, TRUE); + AcpiEvDetachRegion (RegionObj, TRUE); /* * Walk the list, since we took the first region and it diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index c8ddd6b..aaa631d 100644 --- a/sys/contrib/dev/acpica/exconfig.c +++ b/sys/contrib/dev/acpica/exconfig.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 60 $ + * $Revision: 66 $ * *****************************************************************************/ @@ -118,13 +118,11 @@ #define __EXCONFIG_C__ #include "acpi.h" -#include "acparser.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" #include "acevents.h" #include "actables.h" -#include "acdispat.h" #define _COMPONENT ACPI_EXECUTER @@ -171,11 +169,11 @@ AcpiExAddTable ( /* Install the new table into the local data structures */ TableInfo.Pointer = Table; - TableInfo.Length = Table->Length; + TableInfo.Length = (ACPI_SIZE) Table->Length; TableInfo.Allocation = ACPI_MEM_ALLOCATED; TableInfo.BasePointer = Table; - Status = AcpiTbInstallTable (NULL, &TableInfo); + Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -188,7 +186,7 @@ AcpiExAddTable ( { /* Uninstall table on error */ - AcpiTbUninstallTable (TableInfo.InstalledDesc); + (void) AcpiTbUninstallTable (TableInfo.InstalledDesc); goto Cleanup; } @@ -334,11 +332,11 @@ AcpiExLoadTableOp ( { /* Store the parameter data into the optional parameter object */ - Status = AcpiExStore (Operand[5], (ACPI_OPERAND_OBJECT *) ParameterNode, + Status = AcpiExStore (Operand[5], ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState); if (ACPI_FAILURE (Status)) { - AcpiExUnloadTable (DdbHandle); + (void) AcpiExUnloadTable (DdbHandle); } } @@ -375,7 +373,6 @@ AcpiExLoadOp ( ACPI_TABLE_HEADER TableHeader; UINT32 i; - ACPI_FUNCTION_TRACE ("ExLoadOp"); @@ -386,7 +383,7 @@ AcpiExLoadOp ( case ACPI_TYPE_REGION: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", - ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type))); + ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); /* Get the table header */ @@ -395,7 +392,7 @@ AcpiExLoadOp ( { Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, (ACPI_PHYSICAL_ADDRESS) i, 8, - (ACPI_INTEGER *) ((UINT8 *) &TableHeader + i)); + ((UINT8 *) &TableHeader) + i); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -421,7 +418,7 @@ AcpiExLoadOp ( { Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, (ACPI_PHYSICAL_ADDRESS) i, 8, - (ACPI_INTEGER *) (TableDataPtr + i)); + ((UINT8 *) TableDataPtr + i)); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -436,7 +433,7 @@ AcpiExLoadOp ( case INTERNAL_TYPE_INDEX_FIELD: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n", - ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type))); + ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); /* * The length of the field must be at least as large as the table. @@ -449,7 +446,7 @@ AcpiExLoadOp ( goto Cleanup; } - TablePtr = (ACPI_TABLE_HEADER *) BufferDesc->Buffer.Pointer; + TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer); break; @@ -468,7 +465,7 @@ AcpiExLoadOp ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Table has invalid signature [%4.4s], must be SSDT or PSDT\n", - (char *) &TablePtr->Signature)); + TablePtr->Signature)); Status = AE_BAD_SIGNATURE; goto Cleanup; } @@ -486,7 +483,7 @@ AcpiExLoadOp ( Status = AcpiExStore (DdbHandle, Target, WalkState); if (ACPI_FAILURE (Status)) { - AcpiExUnloadTable (DdbHandle); + (void) AcpiExUnloadTable (DdbHandle); } return_ACPI_STATUS (Status); @@ -537,9 +534,8 @@ AcpiExUnloadTable ( * validated here. */ if ((!DdbHandle) || - (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_INTERNAL) || - (((ACPI_OPERAND_OBJECT *)DdbHandle)->Common.Type != - INTERNAL_TYPE_REFERENCE)) + (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) || + (ACPI_GET_OBJECT_TYPE (DdbHandle) != INTERNAL_TYPE_REFERENCE)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -552,15 +548,11 @@ AcpiExUnloadTable ( * Delete the entire namespace under this table Node * (Offset contains the TableId) */ - Status = AcpiNsDeleteNamespaceByOwner (TableInfo->TableId); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + AcpiNsDeleteNamespaceByOwner (TableInfo->TableId); /* Delete the table itself */ - AcpiTbUninstallTable (TableInfo->InstalledDesc); + (void) AcpiTbUninstallTable (TableInfo->InstalledDesc); /* Delete the table descriptor (DdbHandle) */ diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c index 9b38e90..c3c8f98 100644 --- a/sys/contrib/dev/acpica/exconvrt.c +++ b/sys/contrib/dev/acpica/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 32 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -118,12 +118,8 @@ #define __EXCONVRT_C__ #include "acpi.h" -#include "acparser.h" -#include "acnamesp.h" #include "acinterp.h" -#include "acevents.h" #include "amlcode.h" -#include "acdispat.h" #define _COMPONENT ACPI_EXECUTER @@ -153,27 +149,27 @@ AcpiExConvertToInteger ( UINT32 i; ACPI_OPERAND_OBJECT *RetDesc; UINT32 Count; - char *Pointer; + UINT8 *Pointer; ACPI_INTEGER Result; - UINT32 IntegerSize = sizeof (ACPI_INTEGER); + ACPI_STATUS Status; ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc); - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: *ResultDesc = ObjDesc; return_ACPI_STATUS (AE_OK); case ACPI_TYPE_STRING: - Pointer = ObjDesc->String.Pointer; + Pointer = (UINT8 *) ObjDesc->String.Pointer; Count = ObjDesc->String.Length; break; case ACPI_TYPE_BUFFER: - Pointer = (char *) ObjDesc->Buffer.Pointer; + Pointer = ObjDesc->Buffer.Pointer; Count = ObjDesc->Buffer.Length; break; @@ -182,26 +178,6 @@ AcpiExConvertToInteger ( } /* - * Create a new integer - */ - RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!RetDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ - - if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) - { - /* - * We are running a method that exists in a 32-bit ACPI table. - * Truncate the value to 32 bits by zeroing out the upper 32-bit field - */ - IntegerSize = sizeof (UINT32); - } - - /* * Convert the buffer/string to an integer. Note that both buffers and * strings are treated as raw data - we don't convert ascii to hex for * strings. @@ -214,25 +190,27 @@ AcpiExConvertToInteger ( /* Transfer no more than an integer's worth of data */ - if (Count > IntegerSize) + if (Count > AcpiGbl_IntegerByteWidth) { - Count = IntegerSize; + Count = AcpiGbl_IntegerByteWidth; } /* * String conversion is different than Buffer conversion */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_STRING: - /* TBD: Need to use 64-bit ACPI_STRTOUL */ - /* * Convert string to an integer * String must be hexadecimal as per the ACPI specification */ - Result = ACPI_STRTOUL (Pointer, NULL, 16); + Status = AcpiUtStrtoul64 ((char *) Pointer, 16, &Result); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } break; @@ -252,6 +230,20 @@ AcpiExConvertToInteger ( Result |= (((ACPI_INTEGER) Pointer[i]) << (i * 8)); } break; + + + default: + /* No other types can get here */ + break; + } + + /* + * Create a new integer + */ + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!RetDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); } /* Save the Result, delete original descriptor, store new descriptor */ @@ -293,19 +285,18 @@ AcpiExConvertToBuffer ( { ACPI_OPERAND_OBJECT *RetDesc; UINT32 i; - UINT32 IntegerSize = sizeof (ACPI_INTEGER); UINT8 *NewBuf; ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc); - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: /* - * Create a new Buffer + * Create a new Buffer object */ RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!RetDesc) @@ -313,21 +304,9 @@ AcpiExConvertToBuffer ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ - - if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) - { - /* - * We are running a method that exists in a 32-bit ACPI table. - * Use only 32 bits of the Integer for conversion. - */ - IntegerSize = sizeof (UINT32); - } - /* Need enough space for one integer */ - RetDesc->Buffer.Length = IntegerSize; - NewBuf = ACPI_MEM_CALLOCATE (IntegerSize); + NewBuf = ACPI_MEM_CALLOCATE (AcpiGbl_IntegerByteWidth); if (!NewBuf) { ACPI_REPORT_ERROR @@ -338,11 +317,16 @@ AcpiExConvertToBuffer ( /* Copy the integer to the buffer */ - for (i = 0; i < IntegerSize; i++) + for (i = 0; i < AcpiGbl_IntegerByteWidth; i++) { NewBuf[i] = (UINT8) (ObjDesc->Integer.Value >> (i * 8)); } + + /* Complete buffer object initialization */ + + RetDesc->Buffer.Flags |= AOPOBJ_DATA_VALID; RetDesc->Buffer.Pointer = NewBuf; + RetDesc->Buffer.Length = AcpiGbl_IntegerByteWidth; /* Return the new buffer descriptor */ @@ -392,7 +376,7 @@ AcpiExConvertToAscii ( UINT32 i; UINT32 j; UINT32 k = 0; - UINT8 HexDigit; + char HexDigit; ACPI_INTEGER Digit; UINT32 Remainder; UINT32 Length = sizeof (ACPI_INTEGER); @@ -414,7 +398,7 @@ AcpiExConvertToAscii ( Digit = Integer; for (j = 1; j < i; j++) { - AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder); + (void) AcpiUtShortDivide (&Digit, 10, &Digit, &Remainder); } /* Create the decimal digit */ @@ -447,7 +431,7 @@ AcpiExConvertToAscii ( if (!LeadingZero) { - String[k] = HexDigit; + String[k] = (UINT8) HexDigit; k++; } } @@ -500,7 +484,6 @@ AcpiExConvertToString ( UINT32 i; UINT32 Index; UINT32 StringLength; - UINT32 IntegerSize = sizeof (ACPI_INTEGER); UINT8 *NewBuf; UINT8 *Pointer; @@ -508,22 +491,11 @@ AcpiExConvertToString ( ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc); - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: - /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ - - if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) - { - /* - * We are running a method that exists in a 32-bit ACPI table. - * Use only 32 bits of the Integer - */ - IntegerSize = sizeof (UINT32); - } - - StringLength = IntegerSize * 2; + StringLength = AcpiGbl_IntegerByteWidth * 2; if (Base == 10) { StringLength = ACPI_MAX_DECIMAL_DIGITS; @@ -540,7 +512,7 @@ AcpiExConvertToString ( /* Need enough space for one ASCII integer plus null terminator */ - NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1); + NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) StringLength + 1); if (!NewBuf) { ACPI_REPORT_ERROR @@ -549,7 +521,6 @@ AcpiExConvertToString ( return_ACPI_STATUS (AE_NO_MEMORY); } - /* Convert */ i = AcpiExConvertToAscii (ObjDesc->Integer.Value, Base, NewBuf); @@ -615,7 +586,7 @@ AcpiExConvertToString ( StringLength = MaxLength; } - NewBuf = ACPI_MEM_CALLOCATE (StringLength + 1); + NewBuf = ACPI_MEM_CALLOCATE ((ACPI_SIZE) StringLength + 1); if (!NewBuf) { ACPI_REPORT_ERROR @@ -631,7 +602,7 @@ AcpiExConvertToString ( Index = 0; for (i = 0, Index = 0; i < ObjDesc->Buffer.Length; i++) { - Index = AcpiExConvertToAscii (Pointer[i], Base, &NewBuf[Index]); + Index = AcpiExConvertToAscii ((ACPI_INTEGER) Pointer[i], Base, &NewBuf[Index]); NewBuf[Index] = ' '; Index++; @@ -643,7 +614,6 @@ AcpiExConvertToString ( RetDesc->Buffer.Pointer = NewBuf; RetDesc->String.Length = ACPI_STRLEN ((char *) NewBuf); - /* Return the new buffer descriptor */ if (*ResultDesc == ObjDesc) @@ -734,11 +704,11 @@ AcpiExConvertToTargetType ( default: /* No conversion allowed for these types */ - if (DestinationType != SourceDesc->Common.Type) + if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Target does not allow conversion of type %s to %s\n", - AcpiUtGetTypeName ((SourceDesc)->Common.Type), + AcpiUtGetObjectTypeName (SourceDesc), AcpiUtGetTypeName (DestinationType))); Status = AE_TYPE; } @@ -780,6 +750,11 @@ AcpiExConvertToTargetType ( */ Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc, WalkState); break; + + + default: + Status = AE_AML_INTERNAL; + break; } break; @@ -800,7 +775,6 @@ AcpiExConvertToTargetType ( Status = AE_AML_INTERNAL; } - /* * Source-to-Target conversion semantics: * diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c index e14b28d..6483351 100644 --- a/sys/contrib/dev/acpica/excreate.c +++ b/sys/contrib/dev/acpica/excreate.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 89 $ + * $Revision: 92 $ * *****************************************************************************/ @@ -118,12 +118,10 @@ #define __EXCREATE_C__ #include "acpi.h" -#include "acparser.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" #include "acevents.h" -#include "acdispat.h" #include "actables.h" @@ -135,8 +133,7 @@ * * FUNCTION: AcpiExCreateAlias * - * PARAMETERS: WalkState - Current state, contains List of - * operands for the opcode + * PARAMETERS: WalkState - Current state, contains operands * * RETURN: Status * @@ -331,7 +328,7 @@ AcpiExCreateRegion ( /* Get the Node from the object stack */ - Node = WalkState->Op->Node; + Node = WalkState->Op->Common.Node; /* * If the region object is already attached to this node, @@ -423,7 +420,7 @@ AcpiExCreateTableRegion ( /* Get the Node from the object stack */ - Node = WalkState->Op->Node; + Node = WalkState->Op->Common.Node; /* * If the region object is already attached to this node, @@ -501,9 +498,7 @@ Cleanup: * * FUNCTION: AcpiExCreateProcessor * - * PARAMETERS: Op - Op containing the Processor definition and - * args - * ProcessorNode - Parent Node for the processor object + * PARAMETERS: WalkState - Current state * * RETURN: Status * @@ -557,9 +552,7 @@ AcpiExCreateProcessor ( * * FUNCTION: AcpiExCreatePowerResource * - * PARAMETERS: Op - Op containing the PowerResource definition - * and args - * PowerNode - Parent Node for the power object + * PARAMETERS: WalkState - Current state * * RETURN: Status * @@ -613,8 +606,7 @@ AcpiExCreatePowerResource ( * * PARAMETERS: AmlStart - First byte of the method's AML * AmlLength - AML byte count for this method - * MethodFlags - AML method flag byte - * Method - Method Node + * WalkState - Current state * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c index 2155c04..768d6d3 100644 --- a/sys/contrib/dev/acpica/exdump.c +++ b/sys/contrib/dev/acpica/exdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 147 $ + * $Revision: 155 $ * *****************************************************************************/ @@ -120,7 +120,6 @@ #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "actables.h" #include "acparser.h" #define _COMPONENT ACPI_EXECUTER @@ -135,100 +134,6 @@ /***************************************************************************** * - * FUNCTION: AcpiExShowHexValue - * - * PARAMETERS: ByteCount - Number of bytes to print (1, 2, or 4) - * *AmlStart - Address in AML stream of bytes to print - * InterpreterMode - Current running mode (load1/Load2/Exec) - * LeadSpace - # of spaces to print ahead of value - * 0 => none ahead but one behind - * - * DESCRIPTION: Print ByteCount byte(s) starting at AmlStart as a single - * value, in hex. If ByteCount > 1 or the value printed is > 9, also - * print in decimal. - * - ****************************************************************************/ - -void -AcpiExShowHexValue ( - UINT32 ByteCount, - UINT8 *AmlStart, - UINT32 LeadSpace) -{ - UINT32 Value; /* Value retrieved from AML stream */ - UINT32 ShowDecimalValue; - UINT32 Length; /* Length of printed field */ - UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */ - - - ACPI_FUNCTION_TRACE ("ExShowHexValue"); - - - if (!((ACPI_LV_LOAD & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) - { - return; - } - - if (!AmlStart) - { - ACPI_REPORT_ERROR (("ExShowHexValue: null pointer\n")); - return; - } - - /* - * AML numbers are always stored little-endian, - * even if the processor is big-endian. - */ - for (CurrentAmlPtr = AmlStart + ByteCount, - Value = 0; - CurrentAmlPtr > AmlStart; ) - { - Value = (Value << 8) + (UINT32)* --CurrentAmlPtr; - } - - Length = LeadSpace * ByteCount + 2; - if (ByteCount > 1) - { - Length += (ByteCount - 1); - } - - ShowDecimalValue = (ByteCount > 1 || Value > 9); - if (ShowDecimalValue) - { - Length += 3 + AcpiExDigitsNeeded (Value, 10); - } - - for (Length = LeadSpace; Length; --Length ) - { - AcpiOsPrintf (" "); - } - - while (ByteCount--) - { - AcpiOsPrintf ("%02x", *AmlStart++); - if (ByteCount) - { - AcpiOsPrintf (" "); - } - } - - if (ShowDecimalValue) - { - AcpiOsPrintf (" [%d]", Value); - } - - if (0 == LeadSpace) - { - AcpiOsPrintf (" "); - } - - AcpiOsPrintf ("\n"); - return_VOID; -} - - -/***************************************************************************** - * * FUNCTION: AcpiExDumpOperand * * PARAMETERS: *ObjDesc - Pointer to entry to be dumped @@ -239,13 +144,16 @@ AcpiExShowHexValue ( * ****************************************************************************/ -ACPI_STATUS +void AcpiExDumpOperand ( ACPI_OPERAND_OBJECT *ObjDesc) { UINT8 *Buf = NULL; UINT32 Length; UINT32 i; + ACPI_OPERAND_OBJECT **Element; + UINT16 ElementIndex; + ACPI_FUNCTION_NAME ("ExDumpOperand") @@ -253,7 +161,7 @@ AcpiExDumpOperand ( if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer))) { - return (AE_OK); + return; } if (!ObjDesc) @@ -264,57 +172,33 @@ AcpiExDumpOperand ( * code that dumps the stack expects something to be there! */ AcpiOsPrintf ("Null stack entry ptr\n"); - return (AE_OK); + return; } if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p NS Node: ", ObjDesc)); ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC); - return (AE_OK); + return; } - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is not a local object\n", ObjDesc)); ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)); - return (AE_OK); + return; } /* ObjDesc is a valid object */ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc)); - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case INTERNAL_TYPE_REFERENCE: switch (ObjDesc->Reference.Opcode) { - case AML_ZERO_OP: - - AcpiOsPrintf ("Reference: Zero\n"); - break; - - - case AML_ONE_OP: - - AcpiOsPrintf ("Reference: One\n"); - break; - - - case AML_ONES_OP: - - AcpiOsPrintf ("Reference: Ones\n"); - break; - - - case AML_REVISION_OP: - - AcpiOsPrintf ("Reference: Revision\n"); - break; - - case AML_DEBUG_OP: AcpiOsPrintf ("Reference: Debug\n"); @@ -341,7 +225,7 @@ AcpiExDumpOperand ( AcpiOsPrintf ("Reference: Arg%d", ObjDesc->Reference.Offset); - if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { /* Value is a Number */ @@ -359,7 +243,7 @@ AcpiExDumpOperand ( AcpiOsPrintf ("Reference: Local%d", ObjDesc->Reference.Offset); - if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { /* Value is a Number */ @@ -375,14 +259,14 @@ AcpiExDumpOperand ( case AML_INT_NAMEPATH_OP: AcpiOsPrintf ("Reference.Node->Name %X\n", - ObjDesc->Reference.Node->Name); + ObjDesc->Reference.Node->Name.Integer); break; default: /* unknown opcode */ - AcpiOsPrintf ("Unknown opcode=%X\n", + AcpiOsPrintf ("Unknown Reference opcode=%X\n", ObjDesc->Reference.Opcode); break; @@ -457,9 +341,6 @@ AcpiExDumpOperand ( ObjDesc->Package.Elements && AcpiDbgLevel > 1) { - ACPI_OPERAND_OBJECT**Element; - UINT16 ElementIndex; - for (ElementIndex = 0, Element = ObjDesc->Package.Elements; ElementIndex < ObjDesc->Package.Count; ++ElementIndex, ++Element) @@ -467,9 +348,7 @@ AcpiExDumpOperand ( AcpiExDumpOperand (*Element); } } - AcpiOsPrintf ("\n"); - break; @@ -507,7 +386,6 @@ AcpiExDumpOperand ( AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); } - AcpiOsPrintf ("\"\n"); break; @@ -547,13 +425,10 @@ AcpiExDumpOperand ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n")); } - - else if (ACPI_TYPE_BUFFER != - ObjDesc->BufferField.BufferObj->Common.Type) + else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != ACPI_TYPE_BUFFER) { AcpiOsPrintf ("*not a Buffer* \n"); } - else { ACPI_DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj); @@ -608,13 +483,13 @@ AcpiExDumpOperand ( default: - /* unknown ObjDesc->Common.Type value */ + /* Unknown Type */ - AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type); + AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); break; } - return (AE_OK); + return; } @@ -658,7 +533,6 @@ AcpiExDumpOperands ( Note = "?"; } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", Ident, NumLevels)); @@ -668,16 +542,12 @@ AcpiExDumpOperands ( NumLevels = 1; } - /* Dump the stack starting at the top, working down */ + /* Dump the operand stack starting at the top */ for (i = 0; NumLevels > 0; i--, NumLevels--) { ObjDesc = &Operands[i]; - - if (ACPI_FAILURE (AcpiExDumpOperand (*ObjDesc))) - { - break; - } + AcpiExDumpOperand (*ObjDesc); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, @@ -729,7 +599,8 @@ AcpiExOutAddress ( char *Title, ACPI_PHYSICAL_ADDRESS Value) { -#ifdef _IA16 + +#if ACPI_MACHINE_WIDTH == 16 AcpiOsPrintf ("%20s : %p\n", Title, Value); #else AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title, @@ -766,8 +637,7 @@ AcpiExDumpNode ( } } - - AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char *) &Node->Name); + AcpiOsPrintf ("%20s : %4.4s\n", "Name", Node->Name.Ascii); AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); AcpiExOutInteger ("Flags", Node->Flags); AcpiExOutInteger ("Owner Id", Node->OwnerId); @@ -809,7 +679,7 @@ AcpiExDumpObjectDescriptor ( } } - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { AcpiOsPrintf ("ExDumpObjectDescriptor: %p is not a valid ACPI object\n", ObjDesc); return; @@ -817,17 +687,17 @@ AcpiExDumpObjectDescriptor ( /* Common Fields */ - AcpiExOutString ("Type", AcpiUtGetTypeName (ObjDesc->Common.Type)); + AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc)); AcpiExOutInteger ("Reference Count", ObjDesc->Common.ReferenceCount); AcpiExOutInteger ("Flags", ObjDesc->Common.Flags); /* Object-specific Fields */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: - AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", + AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value", ACPI_HIDWORD (ObjDesc->Integer.Value), ACPI_LODWORD (ObjDesc->Integer.Value)); break; @@ -863,7 +733,7 @@ AcpiExDumpObjectDescriptor ( AcpiOsPrintf ("[%.3d] %p", i, ObjDesc->Package.Elements[i]); if (ObjDesc->Package.Elements[i]) { - AcpiOsPrintf (" %s", AcpiUtGetTypeName ((ObjDesc->Package.Elements[i])->Common.Type)); + AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[i])); } AcpiOsPrintf ("\n"); } @@ -929,7 +799,7 @@ AcpiExDumpObjectDescriptor ( AcpiExOutInteger ("Processor ID", ObjDesc->Processor.ProcId); AcpiExOutInteger ("Length", ObjDesc->Processor.Length); - AcpiExOutInteger ("Address", ObjDesc->Processor.Address); + AcpiExOutAddress ("Address", (ACPI_PHYSICAL_ADDRESS) ObjDesc->Processor.Address); AcpiExOutPointer ("SysHandler", ObjDesc->Processor.SysHandler); AcpiExOutPointer ("DrvHandler", ObjDesc->Processor.DrvHandler); AcpiExOutPointer ("AddrHandler", ObjDesc->Processor.AddrHandler); @@ -959,7 +829,7 @@ AcpiExDumpObjectDescriptor ( AcpiExOutInteger ("EndBufValidBits", ObjDesc->CommonField.EndBufferValidBits); AcpiExOutPointer ("ParentNode", ObjDesc->CommonField.Node); - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_BUFFER_FIELD: AcpiExOutPointer ("BufferObj", ObjDesc->BufferField.BufferObj); @@ -980,6 +850,10 @@ AcpiExDumpObjectDescriptor ( AcpiExOutPointer ("Index", ObjDesc->IndexField.IndexObj); AcpiExOutPointer ("Data", ObjDesc->IndexField.DataObj); break; + + default: + /* All object types covered above */ + break; } break; @@ -1023,15 +897,10 @@ AcpiExDumpObjectDescriptor ( case INTERNAL_TYPE_DEF_ANY: case INTERNAL_TYPE_EXTRA: case INTERNAL_TYPE_DATA: - - AcpiOsPrintf ("ExDumpObjectDescriptor: Display not implemented for object type %X\n", - ObjDesc->Common.Type); - break; - - default: - AcpiOsPrintf ("ExDumpObjectDescriptor: Unknown object type %X\n", ObjDesc->Common.Type); + AcpiOsPrintf ("ExDumpObjectDescriptor: Display not implemented for object type %s\n", + AcpiUtGetObjectTypeName (ObjDesc)); break; } diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c index 2321a5a..7820a8a 100644 --- a/sys/contrib/dev/acpica/exfield.c +++ b/sys/contrib/dev/acpica/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 108 $ + * $Revision: 112 $ * *****************************************************************************/ @@ -120,10 +120,6 @@ #include "acpi.h" #include "acdispat.h" #include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "achware.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -154,7 +150,6 @@ AcpiExReadDataFromField ( ACPI_STATUS Status; ACPI_OPERAND_OBJECT *BufferDesc; UINT32 Length; - UINT32 IntegerSize; void *Buffer; BOOLEAN Locked; @@ -169,7 +164,7 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, @@ -196,20 +191,7 @@ AcpiExReadDataFromField ( * Note: Field.length is in bits. */ Length = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength); - - /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ - - IntegerSize = sizeof (ACPI_INTEGER); - if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) - { - /* - * We are running a method that exists in a 32-bit ACPI table. - * Integer size is 4. - */ - IntegerSize = sizeof (UINT32); - } - - if (Length > IntegerSize) + if (Length > AcpiGbl_IntegerByteWidth) { /* Field is too large for an Integer, create a Buffer instead */ @@ -228,6 +210,8 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_NO_MEMORY); } + /* Complete the buffer object initialization */ + BufferDesc->Common.Flags = AOPOBJ_DATA_VALID; BufferDesc->Buffer.Length = Length; Buffer = BufferDesc->Buffer.Pointer; @@ -242,14 +226,14 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_NO_MEMORY); } - Length = IntegerSize; + Length = AcpiGbl_IntegerByteWidth; BufferDesc->Integer.Value = 0; Buffer = &BufferDesc->Integer.Value; } ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Obj=%p Type=%X Buf=%p Len=%X\n", - ObjDesc, ObjDesc->Common.Type, Buffer, Length)); + ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite: BitLen=%X BitOff=%X ByteOff=%X\n", ObjDesc->CommonField.BitLength, @@ -316,7 +300,7 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, @@ -335,7 +319,7 @@ AcpiExWriteDataToField ( /* * Get a pointer to the data to be written */ - switch (SourceDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) { case ACPI_TYPE_INTEGER: Buffer = &SourceDesc->Integer.Value; @@ -387,7 +371,7 @@ AcpiExWriteDataToField ( ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Obj=%p Type=%X Buf=%p Len=%X\n", - ObjDesc, ObjDesc->Common.Type, Buffer, Length)); + ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead: BitLen=%X BitOff=%X ByteOff=%X\n", ObjDesc->CommonField.BitLength, diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c index 410fb88..d145adb 100644 --- a/sys/contrib/dev/acpica/exmisc.c +++ b/sys/contrib/dev/acpica/exmisc.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 100 $ + * $Revision: 106 $ * *****************************************************************************/ @@ -119,7 +119,6 @@ #define __EXMISC_C__ #include "acpi.h" -#include "acparser.h" #include "acinterp.h" #include "amlcode.h" #include "acdispat.h" @@ -157,9 +156,9 @@ AcpiExGetObjectReference ( switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) { - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: - if (ObjDesc->Common.Type != INTERNAL_TYPE_REFERENCE) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != INTERNAL_TYPE_REFERENCE) { *ReturnDesc = NULL; Status = AE_TYPE; @@ -177,7 +176,7 @@ AcpiExGetObjectReference ( Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode, ObjDesc->Reference.Offset, WalkState, - (ACPI_NAMESPACE_NODE **) ReturnDesc); + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, ReturnDesc)); break; default: @@ -284,15 +283,15 @@ AcpiExConcatTemplate ( ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, Length1); ACPI_MEMCPY (NewBuf + Length1, ObjDesc2->Buffer.Pointer, Length2); - /* - * Point the return object to the new buffer - */ + /* Complete the buffer object initialization */ + + ReturnDesc->Common.Flags = AOPOBJ_DATA_VALID; ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf; - ReturnDesc->Buffer.Length = Length1 + Length2; + ReturnDesc->Buffer.Length = (UINT32) (Length1 + Length2); /* Compute the new checksum */ - NewBuf[ReturnDesc->Buffer.Length - 1] = + NewBuf[ReturnDesc->Buffer.Length - 1] = (NATIVE_CHAR) AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer, (ReturnDesc->Buffer.Length - 1)); @@ -336,7 +335,6 @@ AcpiExDoConcatenate ( ACPI_INTEGER ThisInteger; ACPI_OPERAND_OBJECT *ReturnDesc; NATIVE_CHAR *NewBuf; - UINT32 IntegerSize = sizeof (ACPI_INTEGER); ACPI_FUNCTION_ENTRY (); @@ -344,27 +342,16 @@ AcpiExDoConcatenate ( /* * There are three cases to handle: - * 1) Two Integers concatenated to produce a buffer - * 2) Two Strings concatenated to produce a string - * 3) Two Buffers concatenated to produce a buffer + * + * 1) Two Integers concatenated to produce a new Buffer + * 2) Two Strings concatenated to produce a new String + * 3) Two Buffers concatenated to produce a new Buffer */ - switch (ObjDesc1->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc1)) { case ACPI_TYPE_INTEGER: - /* Handle both ACPI 1.0 and ACPI 2.0 Integer widths */ - - if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) - { - /* - * We are running a method that exists in a 32-bit ACPI table. - * Truncate the value to 32 bits by zeroing out the upper - * 32-bit field - */ - IntegerSize = sizeof (UINT32); - } - - /* Result of two integers is a buffer */ + /* Result of two Integers is a Buffer */ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!ReturnDesc) @@ -372,9 +359,9 @@ AcpiExDoConcatenate ( return (AE_NO_MEMORY); } - /* Need enough space for two integers */ + /* Need enough buffer space for two integers */ - ReturnDesc->Buffer.Length = IntegerSize * 2; + ReturnDesc->Buffer.Length = AcpiGbl_IntegerByteWidth * 2; NewBuf = ACPI_MEM_CALLOCATE (ReturnDesc->Buffer.Length); if (!NewBuf) { @@ -384,31 +371,35 @@ AcpiExDoConcatenate ( goto Cleanup; } - ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf; - /* Convert the first integer */ ThisInteger = ObjDesc1->Integer.Value; - for (i = 0; i < IntegerSize; i++) + for (i = 0; i < AcpiGbl_IntegerByteWidth; i++) { - NewBuf[i] = (UINT8) ThisInteger; + NewBuf[i] = (NATIVE_CHAR) ThisInteger; ThisInteger >>= 8; } /* Convert the second integer */ ThisInteger = ObjDesc2->Integer.Value; - for (; i < (IntegerSize * 2); i++) + for (; i < (ACPI_MUL_2 (AcpiGbl_IntegerByteWidth)); i++) { - NewBuf[i] = (UINT8) ThisInteger; + NewBuf[i] = (NATIVE_CHAR) ThisInteger; ThisInteger >>= 8; } + /* Complete the buffer object initialization */ + + ReturnDesc->Common.Flags = AOPOBJ_DATA_VALID; + ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf; break; case ACPI_TYPE_STRING: + /* Result of two Strings is a String */ + ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); if (!ReturnDesc) { @@ -417,8 +408,8 @@ AcpiExDoConcatenate ( /* Operand0 is string */ - NewBuf = ACPI_MEM_ALLOCATE (ObjDesc1->String.Length + - ObjDesc2->String.Length + 1); + NewBuf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) ObjDesc1->String.Length + + (ACPI_SIZE) ObjDesc2->String.Length + 1); if (!NewBuf) { ACPI_REPORT_ERROR @@ -427,11 +418,13 @@ AcpiExDoConcatenate ( goto Cleanup; } + /* Concatenate the strings */ + ACPI_STRCPY (NewBuf, ObjDesc1->String.Pointer); ACPI_STRCPY (NewBuf + ObjDesc1->String.Length, ObjDesc2->String.Pointer); - /* Point the return object to the new string */ + /* Complete the String object initialization */ ReturnDesc->String.Pointer = NewBuf; ReturnDesc->String.Length = ObjDesc1->String.Length + @@ -441,7 +434,7 @@ AcpiExDoConcatenate ( case ACPI_TYPE_BUFFER: - /* Operand0 is a buffer */ + /* Result of two Buffers is a Buffer */ ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!ReturnDesc) @@ -449,8 +442,8 @@ AcpiExDoConcatenate ( return (AE_NO_MEMORY); } - NewBuf = ACPI_MEM_ALLOCATE (ObjDesc1->Buffer.Length + - ObjDesc2->Buffer.Length); + NewBuf = ACPI_MEM_ALLOCATE ((ACPI_SIZE) ObjDesc1->Buffer.Length + + (ACPI_SIZE) ObjDesc2->Buffer.Length); if (!NewBuf) { ACPI_REPORT_ERROR @@ -459,22 +452,26 @@ AcpiExDoConcatenate ( goto Cleanup; } + /* Concatenate the buffers */ + ACPI_MEMCPY (NewBuf, ObjDesc1->Buffer.Pointer, ObjDesc1->Buffer.Length); ACPI_MEMCPY (NewBuf + ObjDesc1->Buffer.Length, ObjDesc2->Buffer.Pointer, ObjDesc2->Buffer.Length); - /* - * Point the return object to the new buffer - */ + /* Complete the buffer object initialization */ + ReturnDesc->Common.Flags = AOPOBJ_DATA_VALID; ReturnDesc->Buffer.Pointer = (UINT8 *) NewBuf; - ReturnDesc->Buffer.Length = ObjDesc1->Buffer.Length + - ObjDesc2->Buffer.Length; + ReturnDesc->Buffer.Length = ObjDesc1->Buffer.Length + + ObjDesc2->Buffer.Length; break; default: + + /* Invalid object type, should not happen here */ + Status = AE_AML_INTERNAL; ReturnDesc = NULL; } @@ -647,6 +644,9 @@ AcpiExDoLogicalOp ( return (TRUE); } break; + + default: + break; } return (FALSE); diff --git a/sys/contrib/dev/acpica/exmutex.c b/sys/contrib/dev/acpica/exmutex.c index ae1ab35..51d6be3 100644 --- a/sys/contrib/dev/acpica/exmutex.c +++ b/sys/contrib/dev/acpica/exmutex.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 10 $ + * $Revision: 13 $ * *****************************************************************************/ @@ -119,9 +119,6 @@ #include "acpi.h" #include "acinterp.h" -#include "acnamesp.h" -#include "achware.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exmutex") @@ -375,12 +372,13 @@ AcpiExReleaseMutex ( * ******************************************************************************/ -ACPI_STATUS +void AcpiExReleaseAllMutexes ( ACPI_THREAD_STATE *Thread) { ACPI_OPERAND_OBJECT *Next = Thread->AcquiredMutexList; ACPI_OPERAND_OBJECT *This; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -400,14 +398,16 @@ AcpiExReleaseAllMutexes ( /* Release the mutex */ - AcpiExSystemReleaseMutex (This); + Status = AcpiExSystemReleaseMutex (This); + if (ACPI_FAILURE (Status)) + { + continue; + } /* Mark mutex unowned */ This->Mutex.OwnerThread = NULL; } - - return (AE_OK); } diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c index 43ab104..5ac03cc 100644 --- a/sys/contrib/dev/acpica/exnames.c +++ b/sys/contrib/dev/acpica/exnames.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 90 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -120,7 +120,6 @@ #include "acpi.h" #include "acinterp.h" #include "amlcode.h" -#include "acnamesp.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exnames") @@ -248,10 +247,10 @@ AcpiExNameSegment ( UINT8 **InAmlAddress, NATIVE_CHAR *NameString) { - UINT8 *AmlAddress = *InAmlAddress; + char *AmlAddress = (void *) *InAmlAddress; ACPI_STATUS Status = AE_OK; UINT32 Index; - NATIVE_CHAR CharBuf[5]; + char CharBuf[5]; ACPI_FUNCTION_TRACE ("ExNameSegment"); @@ -271,18 +270,18 @@ AcpiExNameSegment ( ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n")); - for (Index = 4; - (Index > 0) && (AcpiUtValidAcpiCharacter (*AmlAddress)); - Index--) + for (Index = 0; + (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress)); + Index++) { - CharBuf[4 - Index] = *AmlAddress++; - ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[4 - Index])); + CharBuf[Index] = *AmlAddress++; + ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[Index])); } /* Valid name segment */ - if (0 == Index) + if (Index == 4) { /* Found 4 valid characters */ @@ -300,7 +299,7 @@ AcpiExNameSegment ( "No Name string - %s \n", CharBuf)); } } - else if (4 == Index) + else if (Index == 0) { /* * First character was not a valid name character, @@ -320,7 +319,7 @@ AcpiExNameSegment ( *AmlAddress, AmlAddress)); } - *InAmlAddress = AmlAddress; + *InAmlAddress = (UINT8 *) AmlAddress; return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exoparg1.c b/sys/contrib/dev/acpica/exoparg1.c index 5c49fa7..6e9e7f7 100644 --- a/sys/contrib/dev/acpica/exoparg1.c +++ b/sys/contrib/dev/acpica/exoparg1.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 135 $ + * $Revision: 139 $ * *****************************************************************************/ @@ -306,7 +306,8 @@ AcpiExOpcode_1A_1T_1R ( ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode)); - /* Create a return object of type Integer for most opcodes */ + + /* Examine the AML opcode */ switch (WalkState->Opcode) { @@ -317,6 +318,8 @@ AcpiExOpcode_1A_1T_1R ( case AML_TO_BCD_OP: case AML_COND_REF_OF_OP: + /* Create a return object of type Integer for these opcodes */ + ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!ReturnDesc) { @@ -324,163 +327,164 @@ AcpiExOpcode_1A_1T_1R ( goto Cleanup; } - break; - } + switch (WalkState->Opcode) + { + case AML_BIT_NOT_OP: /* Not (Operand, Result) */ - /* Examine the AML opcode */ + ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value; + break; - switch (WalkState->Opcode) - { - case AML_BIT_NOT_OP: /* Not (Operand, Result) */ + case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */ - ReturnDesc->Integer.Value = ~Operand[0]->Integer.Value; - break; + ReturnDesc->Integer.Value = Operand[0]->Integer.Value; + /* + * Acpi specification describes Integer type as a little + * endian unsigned value, so this boundary condition is valid. + */ + for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) + { + ReturnDesc->Integer.Value >>= 1; + } - case AML_FIND_SET_LEFT_BIT_OP: /* FindSetLeftBit (Operand, Result) */ + ReturnDesc->Integer.Value = Temp32; + break; - ReturnDesc->Integer.Value = Operand[0]->Integer.Value; - /* - * Acpi specification describes Integer type as a little - * endian unsigned value, so this boundary condition is valid. - */ - for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) - { - ReturnDesc->Integer.Value >>= 1; - } + case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */ - ReturnDesc->Integer.Value = Temp32; - break; + ReturnDesc->Integer.Value = Operand[0]->Integer.Value; + /* + * The Acpi specification describes Integer type as a little + * endian unsigned value, so this boundary condition is valid. + */ + for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) + { + ReturnDesc->Integer.Value <<= 1; + } - case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */ + /* Since the bit position is one-based, subtract from 33 (65) */ - ReturnDesc->Integer.Value = Operand[0]->Integer.Value; + ReturnDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32; + break; - /* - * The Acpi specification describes Integer type as a little - * endian unsigned value, so this boundary condition is valid. - */ - for (Temp32 = 0; ReturnDesc->Integer.Value && Temp32 < ACPI_INTEGER_BIT_SIZE; ++Temp32) - { - ReturnDesc->Integer.Value <<= 1; - } - /* Since the bit position is one-based, subtract from 33 (65) */ + case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */ - ReturnDesc->Integer.Value = Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32; - break; + /* + * The 64-bit ACPI integer can hold 16 4-bit BCD integers + */ + ReturnDesc->Integer.Value = 0; + for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) + { + /* Get one BCD digit */ + Digit = (ACPI_INTEGER) ((Operand[0]->Integer.Value >> (i * 4)) & 0xF); - case AML_FROM_BCD_OP: /* FromBcd (BCDValue, Result) */ + /* Check the range of the digit */ - /* - * The 64-bit ACPI integer can hold 16 4-bit BCD integers - */ - ReturnDesc->Integer.Value = 0; - for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) - { - /* Get one BCD digit */ + if (Digit > 9) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n", + (UINT32) Digit)); + Status = AE_AML_NUMERIC_OVERFLOW; + goto Cleanup; + } + + if (Digit > 0) + { + /* Sum into the result with the appropriate power of 10 */ + + for (j = 0; j < i; j++) + { + Digit *= 10; + } + + ReturnDesc->Integer.Value += Digit; + } + } + break; - Digit = (ACPI_INTEGER) ((Operand[0]->Integer.Value >> (i * 4)) & 0xF); - /* Check the range of the digit */ + case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */ - if (Digit > 9) + if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD digit too large: %d\n", - (UINT32) Digit)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n", + ACPI_HIDWORD(Operand[0]->Integer.Value), + ACPI_LODWORD(Operand[0]->Integer.Value))); Status = AE_AML_NUMERIC_OVERFLOW; goto Cleanup; } - if (Digit > 0) + ReturnDesc->Integer.Value = 0; + for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) { - /* Sum into the result with the appropriate power of 10 */ + /* Divide by nth factor of 10 */ + Temp32 = 0; + Digit = Operand[0]->Integer.Value; for (j = 0; j < i; j++) { - Digit *= 10; + (void) AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32); } - ReturnDesc->Integer.Value += Digit; - } - } - break; - + /* Create the BCD digit from the remainder above */ - case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */ + if (Digit > 0) + { + ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4)); + } + } + break; - if (Operand[0]->Integer.Value > ACPI_MAX_BCD_VALUE) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "BCD overflow: %8.8X%8.8X\n", - ACPI_HIDWORD(Operand[0]->Integer.Value), - ACPI_LODWORD(Operand[0]->Integer.Value))); - Status = AE_AML_NUMERIC_OVERFLOW; - goto Cleanup; - } - ReturnDesc->Integer.Value = 0; - for (i = 0; i < ACPI_MAX_BCD_DIGITS; i++) - { - /* Divide by nth factor of 10 */ + case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */ - Temp32 = 0; - Digit = Operand[0]->Integer.Value; - for (j = 0; j < i; j++) + /* + * This op is a little strange because the internal return value is + * different than the return value stored in the result descriptor + * (There are really two return values) + */ + if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode) { - AcpiUtShortDivide (&Digit, 10, &Digit, &Temp32); + /* + * This means that the object does not exist in the namespace, + * return FALSE + */ + ReturnDesc->Integer.Value = 0; + + /* + * Must delete the result descriptor since there is no reference + * being returned + */ + AcpiUtRemoveReference (Operand[1]); + goto Cleanup; } - /* Create the BCD digit from the remainder above */ + /* Get the object reference and store it */ - if (Digit > 0) + Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState); + if (ACPI_FAILURE (Status)) { - ReturnDesc->Integer.Value += ((ACPI_INTEGER) Temp32 << (i * 4)); + goto Cleanup; } - } - break; + Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState); - case AML_COND_REF_OF_OP: /* CondRefOf (SourceObject, Result) */ - - /* - * This op is a little strange because the internal return value is - * different than the return value stored in the result descriptor - * (There are really two return values) - */ - if ((ACPI_NAMESPACE_NODE *) Operand[0] == AcpiGbl_RootNode) - { - /* - * This means that the object does not exist in the namespace, - * return FALSE - */ - ReturnDesc->Integer.Value = 0; + /* The object exists in the namespace, return TRUE */ - /* - * Must delete the result descriptor since there is no reference - * being returned - */ - AcpiUtRemoveReference (Operand[1]); + ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; goto Cleanup; - } - /* Get the object reference and store it */ - Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; + default: + /* No other opcodes get here */ + break; } - - Status = AcpiExStore (ReturnDesc2, Operand[1], WalkState); - - /* The object exists in the namespace, return TRUE */ - - ReturnDesc->Integer.Value = ACPI_INTEGER_MAX; - goto Cleanup; + break; case AML_STORE_OP: /* Store (Source, Target) */ @@ -633,7 +637,7 @@ AcpiExOpcode_1A_0T_1R ( * can be either a NS Node or an internal object. */ ReturnDesc = Operand[0]; - if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_OPERAND) { /* Internal reference object - prevent deletion */ @@ -674,7 +678,7 @@ AcpiExOpcode_1A_0T_1R ( case AML_TYPE_OP: /* ObjectType (SourceObject) */ - if (INTERNAL_TYPE_REFERENCE == Operand[0]->Common.Type) + if (ACPI_GET_OBJECT_TYPE (Operand[0]) == INTERNAL_TYPE_REFERENCE) { /* * Not a Name -- an indirect name pointer would have @@ -682,17 +686,6 @@ AcpiExOpcode_1A_0T_1R ( */ switch (Operand[0]->Reference.Opcode) { - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: - case AML_REVISION_OP: - - /* Constants are of type Integer */ - - Type = ACPI_TYPE_INTEGER; - break; - - case AML_DEBUG_OP: /* The Debug Object is of type "DebugObject" */ @@ -713,7 +706,7 @@ AcpiExOpcode_1A_0T_1R ( * of the individual package element that is referenced by * the index. */ - Type = (*(Operand[0]->Reference.Where))->Common.Type; + Type = ACPI_GET_OBJECT_TYPE (*(Operand[0]->Reference.Where)); } break; @@ -728,7 +721,7 @@ AcpiExOpcode_1A_0T_1R ( default: - ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Internal error - Unknown Reference subtype %X\n", + ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R/TypeOp: Unknown Reference subtype %X\n", Operand[0]->Reference.Opcode)); Status = AE_AML_INTERNAL; goto Cleanup; @@ -750,6 +743,11 @@ AcpiExOpcode_1A_0T_1R ( case INTERNAL_TYPE_INDEX_FIELD: Type = ACPI_TYPE_FIELD_UNIT; + break; + + default: + /* No change to Type required */ + break; } } @@ -786,7 +784,7 @@ AcpiExOpcode_1A_0T_1R ( * point (even if the original operand was an object reference, it * will be resolved and typechecked during operand resolution.) */ - switch (TempDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (TempDesc)) { case ACPI_TYPE_BUFFER: Value = TempDesc->Buffer.Length; @@ -802,7 +800,7 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "SizeOf, Not Buf/Str/Pkg - found type %s\n", - AcpiUtGetTypeName (TempDesc->Common.Type))); + AcpiUtGetObjectTypeName (TempDesc))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -854,8 +852,12 @@ AcpiExOpcode_1A_0T_1R ( /* Set Operand[0] to the value of the local/arg */ - AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode, - Operand[0]->Reference.Offset, WalkState, &TempDesc); + Status = AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode, + Operand[0]->Reference.Offset, WalkState, &TempDesc); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } /* * Delete our reference to the input object and @@ -882,14 +884,16 @@ AcpiExOpcode_1A_0T_1R ( * 2) Dereference the node to an actual object. Could be a Field, so we nee * to resolve the node to a value. */ - Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer, WalkState->ScopeInfo->Scope.Node, - ACPI_NS_SEARCH_PARENT, (ACPI_NAMESPACE_NODE **) &ReturnDesc); + Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer, + WalkState->ScopeInfo->Scope.Node, ACPI_NS_SEARCH_PARENT, + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ReturnDesc)); if (ACPI_FAILURE (Status)) { goto Cleanup; } - Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) &ReturnDesc, WalkState); + Status = AcpiExResolveNodeToValue ( + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ReturnDesc), WalkState); goto Cleanup; diff --git a/sys/contrib/dev/acpica/exoparg2.c b/sys/contrib/dev/acpica/exoparg2.c index 26fc569..c0d9fc3 100644 --- a/sys/contrib/dev/acpica/exoparg2.c +++ b/sys/contrib/dev/acpica/exoparg2.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * $Revision: 105 $ + * $Revision: 108 $ * *****************************************************************************/ @@ -119,11 +119,9 @@ #include "acpi.h" #include "acparser.h" -#include "acnamesp.h" #include "acinterp.h" #include "acevents.h" #include "amlcode.h" -#include "acdispat.h" #define _COMPONENT ACPI_EXECUTER @@ -405,7 +403,7 @@ AcpiExOpcode_2A_1T_1R ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism above. */ - switch (Operand[0]->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (Operand[0])) { case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (Operand[1], &Operand[1], WalkState); @@ -466,7 +464,7 @@ AcpiExOpcode_2A_1T_1R ( /* * At this point, the Source operand is either a Package or a Buffer */ - if (Operand[0]->Common.Type == ACPI_TYPE_PACKAGE) + if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_PACKAGE) { /* Object to be indexed is a Package */ @@ -477,11 +475,11 @@ AcpiExOpcode_2A_1T_1R ( goto Cleanup; } - if ((Operand[2]->Common.Type == INTERNAL_TYPE_REFERENCE) && - (Operand[2]->Reference.Opcode == AML_ZERO_OP)) + if ((ACPI_GET_OBJECT_TYPE (Operand[2]) == ACPI_TYPE_INTEGER) && + (Operand[2]->Common.Flags & AOPOBJ_AML_CONSTANT)) { /* - * There is no actual result descriptor (the ZeroOp Result + * There is no actual result descriptor (the ZeroOp/Constant Result * descriptor is a placeholder), so just delete the placeholder and * return a reference to the package element */ @@ -496,7 +494,7 @@ AcpiExOpcode_2A_1T_1R ( */ TempDesc = Operand[0]->Package.Elements [Index]; ReturnDesc->Reference.Opcode = AML_INDEX_OP; - ReturnDesc->Reference.TargetType = TempDesc->Common.Type; + ReturnDesc->Reference.TargetType = ACPI_GET_OBJECT_TYPE (TempDesc); ReturnDesc->Reference.Object = TempDesc; Status = AcpiExStore (ReturnDesc, Operand[2], WalkState); diff --git a/sys/contrib/dev/acpica/exoparg3.c b/sys/contrib/dev/acpica/exoparg3.c index 4646fd9..f2aa714 100644 --- a/sys/contrib/dev/acpica/exoparg3.c +++ b/sys/contrib/dev/acpica/exoparg3.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 9 $ + * $Revision: 14 $ * *****************************************************************************/ @@ -181,7 +181,7 @@ AcpiExOpcode_3A_0T_0R ( case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + "FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", (UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value, (UINT32) Operand[2]->Integer.Value)); @@ -197,7 +197,7 @@ AcpiExOpcode_3A_0T_0R ( /* * Always signal the OS! */ - AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal); + Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal); /* Might return while OS is shutting down, just continue */ @@ -240,8 +240,8 @@ AcpiExOpcode_3A_1T_1R ( ACPI_OPERAND_OBJECT *ReturnDesc = NULL; char *Buffer; ACPI_STATUS Status = AE_OK; - UINT32 Index; - UINT32 Length; + NATIVE_UINT Index; + ACPI_SIZE Length; ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode)); @@ -255,7 +255,7 @@ AcpiExOpcode_3A_1T_1R ( * Create the return object. The Source operand is guaranteed to be * either a String or a Buffer, so just use its type. */ - ReturnDesc = AcpiUtCreateInternalObject (Operand[0]->Common.Type); + ReturnDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (Operand[0])); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -264,8 +264,8 @@ AcpiExOpcode_3A_1T_1R ( /* Get the Integer values from the objects */ - Index = (UINT32) Operand[1]->Integer.Value; - Length = (UINT32) Operand[2]->Integer.Value; + Index = (NATIVE_UINT) Operand[1]->Integer.Value; + Length = (ACPI_SIZE) Operand[2]->Integer.Value; /* * If the index is beyond the length of the String/Buffer, or if the @@ -279,12 +279,12 @@ AcpiExOpcode_3A_1T_1R ( if ((Index + Length) > Operand[0]->String.Length) { - Length = Operand[0]->String.Length - Index; + Length = (ACPI_SIZE) Operand[0]->String.Length - Index; } /* Allocate a new buffer for the String/Buffer */ - Buffer = ACPI_MEM_CALLOCATE (Length + 1); + Buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1); if (!Buffer) { Status = AE_NO_MEMORY; @@ -299,7 +299,7 @@ AcpiExOpcode_3A_1T_1R ( /* Set the length of the new String/Buffer */ ReturnDesc->String.Pointer = Buffer; - ReturnDesc->String.Length = Length; + ReturnDesc->String.Length = (UINT32) Length; } break; diff --git a/sys/contrib/dev/acpica/exoparg6.c b/sys/contrib/dev/acpica/exoparg6.c index b6c0b59..894bee2 100644 --- a/sys/contrib/dev/acpica/exoparg6.c +++ b/sys/contrib/dev/acpica/exoparg6.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * $Revision: 10 $ + * $Revision: 11 $ * *****************************************************************************/ @@ -316,7 +316,7 @@ AcpiExOpcode_6A_0T_1R ( * Treat any NULL or non-numeric elements as non-matching. */ if (!ThisElement || - ThisElement->Common.Type != ACPI_TYPE_INTEGER) + ACPI_GET_OBJECT_TYPE (ThisElement) != ACPI_TYPE_INTEGER) { continue; } diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c index 268cf20..f0aa081 100644 --- a/sys/contrib/dev/acpica/exprep.c +++ b/sys/contrib/dev/acpica/exprep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 115 $ + * $Revision: 118 $ * *****************************************************************************/ @@ -121,7 +121,6 @@ #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "acparser.h" #define _COMPONENT ACPI_EXECUTER @@ -149,16 +148,15 @@ AcpiExDecodeFieldAccess ( UINT32 *ReturnByteAlignment) { UINT32 Access; - UINT32 Length; UINT8 ByteAlignment; UINT8 BitLength; +/* UINT32 Length; */ ACPI_FUNCTION_NAME ("ExDecodeFieldAccess"); Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK); - Length = ObjDesc->CommonField.BitLength; switch (Access) { @@ -179,6 +177,8 @@ AcpiExDecodeFieldAccess ( /* Use the length to set the access type */ + Length = ObjDesc->CommonField.BitLength; + if (Length <= 8) { BitLength = 8; @@ -233,12 +233,12 @@ AcpiExDecodeFieldAccess ( /* Invalid field access type */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Unknown field access type %x\n", + "Unknown field access type %X\n", Access)); return (0); } - if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) { /* * BufferField access can be on any byte boundary, so the @@ -518,6 +518,10 @@ AcpiExPrepFieldValue ( ObjDesc->IndexField.IndexObj, ObjDesc->IndexField.DataObj)); break; + + default: + /* No other types should get here */ + break; } /* @@ -528,7 +532,7 @@ AcpiExPrepFieldValue ( AcpiNsGetType (Info->FieldNode)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "set NamedObj %p (%4.4s) val = %p\n", - Info->FieldNode, (char *) &(Info->FieldNode->Name), ObjDesc)); + Info->FieldNode, Info->FieldNode->Name.Ascii, ObjDesc)); /* Remove local reference to the object */ diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c index ef4685e..4339f10 100644 --- a/sys/contrib/dev/acpica/exregion.c +++ b/sys/contrib/dev/acpica/exregion.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 74 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -120,10 +120,6 @@ #include "acpi.h" #include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "achware.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -161,8 +157,10 @@ AcpiExSystemMemorySpaceHandler ( void *LogicalAddrPtr = NULL; ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; UINT32 Length; - UINT32 WindowSize; - + ACPI_SIZE WindowSize; +#ifndef _HW_ALIGNMENT_SUPPORT + UINT32 Remainder; +#endif ACPI_FUNCTION_TRACE ("ExSystemMemorySpaceHandler"); @@ -193,6 +191,19 @@ AcpiExSystemMemorySpaceHandler ( return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } + +#ifndef _HW_ALIGNMENT_SUPPORT + /* + * Hardware does not support non-aligned data transfers, we must verify + * the request. + */ + (void) AcpiUtShortDivide ((ACPI_INTEGER *) &Address, Length, NULL, &Remainder); + if (Remainder != 0) + { + return_ACPI_STATUS (AE_AML_ALIGNMENT); + } +#endif + /* * Does the request fit into the cached memory mapping? * Is 1) Address below the current mapping? OR @@ -218,7 +229,7 @@ AcpiExSystemMemorySpaceHandler ( * Don't attempt to map memory beyond the end of the region, and * constrain the maximum mapping size to something reasonable. */ - WindowSize = (UINT32) ((MemInfo->Address + MemInfo->Length) - Address); + WindowSize = (ACPI_SIZE) ((MemInfo->Address + MemInfo->Length) - Address); if (WindowSize > SYSMEM_REGION_WINDOW_SIZE) { WindowSize = SYSMEM_REGION_WINDOW_SIZE; @@ -230,6 +241,8 @@ AcpiExSystemMemorySpaceHandler ( (void **) &MemInfo->MappedLogicalAddress); if (ACPI_FAILURE (Status)) { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n", + ACPI_HIDWORD (Address), ACPI_LODWORD (Address), (UINT32) WindowSize)); MemInfo->MappedLength = 0; return_ACPI_STATUS (Status); } @@ -251,8 +264,14 @@ AcpiExSystemMemorySpaceHandler ( "SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth, ACPI_HIDWORD (Address), ACPI_LODWORD (Address))); - /* Perform the memory read or write */ - + /* + * Perform the memory read or write + * + * Note: For machines that do not support non-aligned transfers, the target + * address was checked for alignment above. We do not attempt to break the + * transfer up into smaller (byte-size) chunks because the AML specifically + * asked for a transfer width that the hardware may require. + */ switch (Function) { case ACPI_READ: @@ -261,19 +280,24 @@ AcpiExSystemMemorySpaceHandler ( switch (BitWidth) { case 8: - *Value = (UINT32)* (UINT8 *) LogicalAddrPtr; + *Value = (ACPI_INTEGER) *((UINT8 *) LogicalAddrPtr); break; case 16: - ACPI_MOVE_UNALIGNED16_TO_16 (Value, LogicalAddrPtr); + *Value = (ACPI_INTEGER) *((UINT16 *) LogicalAddrPtr); break; case 32: - ACPI_MOVE_UNALIGNED32_TO_32 (Value, LogicalAddrPtr); + *Value = (ACPI_INTEGER) *((UINT32 *) LogicalAddrPtr); break; +#if ACPI_MACHINE_WIDTH != 16 case 64: - ACPI_MOVE_UNALIGNED64_TO_64 (Value, LogicalAddrPtr); + *Value = (ACPI_INTEGER) *((UINT64 *) LogicalAddrPtr); + break; +#endif + default: + /* BitWidth was already validated */ break; } break; @@ -287,15 +311,21 @@ AcpiExSystemMemorySpaceHandler ( break; case 16: - ACPI_MOVE_UNALIGNED16_TO_16 (LogicalAddrPtr, Value); + *(UINT16 *) LogicalAddrPtr = (UINT16) *Value; break; case 32: - ACPI_MOVE_UNALIGNED32_TO_32 (LogicalAddrPtr, Value); + *(UINT32 *) LogicalAddrPtr = (UINT32) *Value; break; +#if ACPI_MACHINE_WIDTH != 16 case 64: - ACPI_MOVE_UNALIGNED64_TO_64 (LogicalAddrPtr, Value); + *(UINT64 *) LogicalAddrPtr = (UINT64) *Value; + break; +#endif + + default: + /* BitWidth was already validated */ break; } break; @@ -418,7 +448,7 @@ AcpiExPciConfigSpaceHandler ( * */ PciId = (ACPI_PCI_ID *) RegionContext; - PciRegister = (UINT16) (ACPI_SIZE) Address; + PciRegister = (UINT16) (UINT32) Address; ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "PciConfig %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n", @@ -574,6 +604,7 @@ AcpiExDataTableSpaceHandler ( break; case ACPI_WRITE: + default: return_ACPI_STATUS (AE_SUPPORT); } diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c index bd671dc..874fbd9 100644 --- a/sys/contrib/dev/acpica/exresnte.c +++ b/sys/contrib/dev/acpica/exresnte.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 52 $ + * $Revision: 56 $ * *****************************************************************************/ @@ -119,12 +119,9 @@ #include "acpi.h" #include "amlcode.h" -#include "acparser.h" #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "actables.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -168,7 +165,6 @@ AcpiExResolveNodeToValue ( ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_NAMESPACE_NODE *Node; ACPI_OBJECT_TYPE EntryType; - ACPI_INTEGER TempVal; ACPI_FUNCTION_TRACE ("ExResolveNodeToValue"); @@ -211,10 +207,10 @@ AcpiExResolveNodeToValue ( { case ACPI_TYPE_PACKAGE: - if (ACPI_TYPE_PACKAGE != SourceDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n", - AcpiUtGetTypeName (SourceDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -231,10 +227,10 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_BUFFER: - if (ACPI_TYPE_BUFFER != SourceDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n", - AcpiUtGetTypeName (SourceDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -251,10 +247,10 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_STRING: - if (ACPI_TYPE_STRING != SourceDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n", - AcpiUtGetTypeName (SourceDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -267,10 +263,10 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_INTEGER: - if (ACPI_TYPE_INTEGER != SourceDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n", - AcpiUtGetTypeName (SourceDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -320,64 +316,14 @@ AcpiExResolveNodeToValue ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ - /* - * The only named references allowed are named constants - * e.g. -- Name (\OSFL, Ones) - */ case INTERNAL_TYPE_REFERENCE: - switch (SourceDesc->Reference.Opcode) - { - - case AML_ZERO_OP: - - TempVal = 0; - break; - - case AML_ONE_OP: - - TempVal = 1; - break; - - case AML_ONES_OP: - - TempVal = ACPI_INTEGER_MAX; - break; - - case AML_REVISION_OP: - - TempVal = ACPI_CA_SUPPORT_LEVEL; - break; - - default: + /* No named references are allowed here */ - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n", - SourceDesc->Reference.Opcode)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported reference opcode %X\n", + SourceDesc->Reference.Opcode)); - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } - - /* Create object for result */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ObjDesc->Integer.Value = TempVal; - - /* - * Truncate value if we are executing from a 32-bit ACPI table - * AND actually executing AML code. If we are resolving - * an object in the namespace via an external call to the - * subsystem, we will have a null WalkState - */ - if (WalkState) - { - AcpiExTruncateFor32bitTable (ObjDesc, WalkState); - } - break; + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Default case is for unknown types */ diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index d869654..249e2cb 100644 --- a/sys/contrib/dev/acpica/exresolv.c +++ b/sys/contrib/dev/acpica/exresolv.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 109 $ + * $Revision: 114 $ * *****************************************************************************/ @@ -119,12 +119,8 @@ #include "acpi.h" #include "amlcode.h" -#include "acparser.h" #include "acdispat.h" #include "acinterp.h" -#include "acnamesp.h" -#include "actables.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -168,7 +164,7 @@ AcpiExResolveToValue ( * 1) A valid ACPI_OPERAND_OBJECT, or * 2) A ACPI_NAMESPACE_NODE (NamedObj) */ - if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_OPERAND) { Status = AcpiExResolveObjectToValue (StackPtr, WalkState); if (ACPI_FAILURE (Status)) @@ -183,7 +179,8 @@ AcpiExResolveToValue ( */ if (ACPI_GET_DESCRIPTOR_TYPE (*StackPtr) == ACPI_DESC_TYPE_NAMED) { - Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) StackPtr, + Status = AcpiExResolveNodeToValue ( + ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, StackPtr), WalkState); if (ACPI_FAILURE (Status)) { @@ -230,7 +227,7 @@ AcpiExResolveObjectToValue ( /* This is an ACPI_OPERAND_OBJECT */ - switch (StackDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (StackDesc)) { case INTERNAL_TYPE_REFERENCE: @@ -281,54 +278,6 @@ AcpiExResolveObjectToValue ( StackDesc->Reference.Offset, ObjDesc)); break; - /* - * For constants, we must change the reference/constant object - * to a real integer object - */ - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: - case AML_REVISION_OP: - - /* Create a new integer object */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - switch (Opcode) - { - case AML_ZERO_OP: - ObjDesc->Integer.Value = 0; - break; - - case AML_ONE_OP: - ObjDesc->Integer.Value = 1; - break; - - case AML_ONES_OP: - ObjDesc->Integer.Value = ACPI_INTEGER_MAX; - - /* Truncate value if we are executing from a 32-bit ACPI table */ - - AcpiExTruncateFor32bitTable (ObjDesc, WalkState); - break; - - case AML_REVISION_OP: - ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL; - break; - } - - /* - * Remove a reference from the original reference object - * and put the new object in its place - */ - AcpiUtRemoveReference (StackDesc); - *StackPtr = ObjDesc; - break; - case AML_INDEX_OP: @@ -341,6 +290,7 @@ AcpiExResolveObjectToValue ( case ACPI_TYPE_PACKAGE: + ObjDesc = *StackDesc->Reference.Where; if (ObjDesc) { @@ -366,7 +316,9 @@ AcpiExResolveObjectToValue ( } break; + default: + /* Invalid reference object */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -386,14 +338,12 @@ AcpiExResolveObjectToValue ( default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference object subtype %02X in %p\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X in %p\n", Opcode, StackDesc)); Status = AE_AML_INTERNAL; break; - - } /* switch (Opcode) */ - - break; /* case INTERNAL_TYPE_REFERENCE */ + } + break; case ACPI_TYPE_BUFFER: @@ -417,7 +367,7 @@ AcpiExResolveObjectToValue ( case INTERNAL_TYPE_INDEX_FIELD: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n", - StackDesc, StackDesc->Common.Type)); + StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc))); Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); *StackPtr = (void *) ObjDesc; diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c index dcd91ec..ead95de 100644 --- a/sys/contrib/dev/acpica/exresop.c +++ b/sys/contrib/dev/acpica/exresop.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 48 $ + * $Revision: 53 $ * *****************************************************************************/ @@ -120,11 +120,8 @@ #include "acpi.h" #include "amlcode.h" #include "acparser.h" -#include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "actables.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -161,6 +158,20 @@ AcpiExCheckObjectType ( return (AE_OK); } + if (TypeNeeded == INTERNAL_TYPE_REFERENCE) + { + /* + * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference + * objects and thus allow them to be targets. (As per the ACPI + * specification, a store to a constant is a noop.) + */ + if ((ThisType == ACPI_TYPE_INTEGER) && + (((ACPI_OPERAND_OBJECT *) Object)->Common.Flags & AOPOBJ_AML_CONSTANT)) + { + return (AE_OK); + } + } + if (TypeNeeded != ThisType) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -182,18 +193,17 @@ AcpiExCheckObjectType ( * PARAMETERS: Opcode - Opcode being interpreted * StackPtr - Pointer to the operand stack to be * resolved - * WalkState - Current stateu + * WalkState - Current state * * RETURN: Status * * DESCRIPTION: Convert multiple input operands to the types required by the * target operator. * - * Each nibble (actually 5 bits) in ArgTypes represents one required - * operand and indicates the required Type: - * - * The corresponding operand will be converted to the required type if - * possible, otherwise we abort with an exception. + * Each 5-bit group in ArgTypes represents one required + * operand and indicates the required Type. The corresponding operand + * will be converted to the required type if possible, otherwise we + * abort with an exception. * ******************************************************************************/ @@ -267,11 +277,11 @@ AcpiExResolveOperands ( break; - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: /* ACPI internal object */ - ObjectType = ObjDesc->Common.Type; + ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc); /* Check for bad ACPI_OBJECT_TYPE */ @@ -296,15 +306,11 @@ AcpiExResolveOperands ( switch (ObjDesc->Reference.Opcode) { - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: case AML_DEBUG_OP: case AML_NAME_OP: case AML_INDEX_OP: case AML_ARG_OP: case AML_LOCAL_OP: - case AML_REVISION_OP: ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Reference Opcode: %s\n", OpInfo->Name))); @@ -312,7 +318,7 @@ AcpiExResolveOperands ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Reference Opcode: Unknown [%02x]\n", + "Unknown Reference Opcode %X\n", ObjDesc->Reference.Opcode)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -347,7 +353,7 @@ AcpiExResolveOperands ( { case ARGI_REF_OR_STRING: /* Can be a String or Reference */ - if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_INTERNAL) && + if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) && (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING)) { /* @@ -358,6 +364,7 @@ AcpiExResolveOperands ( } /* Else not a string - fall through to the normal Reference case below */ + /*lint -fallthrough */ case ARGI_REFERENCE: /* References: */ case ARGI_INTEGER_REF: @@ -403,12 +410,16 @@ AcpiExResolveOperands ( * -- All others must be resolved below. */ if ((Opcode == AML_STORE_OP) && - ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE) && + (ACPI_GET_OBJECT_TYPE (*StackPtr) == INTERNAL_TYPE_REFERENCE) && ((*StackPtr)->Reference.Opcode == AML_INDEX_OP)) { goto NextOperand; } break; + + default: + /* All cases covered above */ + break; } @@ -489,7 +500,7 @@ AcpiExResolveOperands ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + AcpiUtGetObjectTypeName (*StackPtr), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -512,7 +523,7 @@ AcpiExResolveOperands ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + AcpiUtGetObjectTypeName (*StackPtr), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -535,7 +546,7 @@ AcpiExResolveOperands ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + AcpiUtGetObjectTypeName (*StackPtr), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -549,7 +560,7 @@ AcpiExResolveOperands ( /* Need an operand of type INTEGER, STRING or BUFFER */ - switch ((*StackPtr)->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (*StackPtr)) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: @@ -561,7 +572,7 @@ AcpiExResolveOperands ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + AcpiUtGetObjectTypeName (*StackPtr), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -576,7 +587,7 @@ AcpiExResolveOperands ( * The only reference allowed here is a direct reference to * a namespace node. */ - if ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE) + if (ACPI_GET_OBJECT_TYPE (*StackPtr) == INTERNAL_TYPE_REFERENCE) { if (!(*StackPtr)->Reference.Node) { @@ -611,7 +622,7 @@ AcpiExResolveOperands ( /* Need a buffer, string, package */ - switch ((*StackPtr)->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (*StackPtr)) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -623,7 +634,7 @@ AcpiExResolveOperands ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed [Buf/Str/Pkg], found [%s] %p\n", - AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + AcpiUtGetObjectTypeName (*StackPtr), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -634,7 +645,7 @@ AcpiExResolveOperands ( /* Need a buffer or package or (ACPI 2.0) String */ - switch ((*StackPtr)->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (*StackPtr)) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -646,7 +657,7 @@ AcpiExResolveOperands ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed [Buf/Str/Pkg], found [%s] %p\n", - AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + AcpiUtGetObjectTypeName (*StackPtr), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -669,7 +680,7 @@ AcpiExResolveOperands ( * required object type (Simple cases only). */ Status = AcpiExCheckObjectType (TypeNeeded, - (*StackPtr)->Common.Type, *StackPtr); + ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index 6894fd4..2395ef4 100644 --- a/sys/contrib/dev/acpica/exstore.c +++ b/sys/contrib/dev/acpica/exstore.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 163 $ + * $Revision: 167 $ * *****************************************************************************/ @@ -118,12 +118,10 @@ #define __EXSTORE_C__ #include "acpi.h" -#include "acparser.h" #include "acdispat.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "actables.h" #define _COMPONENT ACPI_EXECUTER @@ -185,19 +183,35 @@ AcpiExStore ( return_ACPI_STATUS (Status); } - /* Destination object must be an object of type Reference */ + /* Destination object must be a Reference or a Constant object */ + + switch (ACPI_GET_OBJECT_TYPE (DestDesc)) + { + case INTERNAL_TYPE_REFERENCE: + break; + + case ACPI_TYPE_INTEGER: + + /* Allow stores to Constants -- a Noop as per ACPI spec */ + + if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT) + { + return_ACPI_STATUS (AE_OK); + } + + /*lint: -fallthrough */ + + default: - if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE) - { /* Destination is not an Reference */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Destination is not a ReferenceObj [%p]\n", DestDesc)); + "Destination is not a Reference or Constant object [%p]\n", DestDesc)); ACPI_DUMP_STACK_ENTRY (SourceDesc); ACPI_DUMP_STACK_ENTRY (DestDesc); ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore", - 2, "Target is not a ReferenceObj"); + 2, "Target is not a Reference or Constant object"); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -209,7 +223,6 @@ AcpiExStore ( * 2) Store to an indexed area of a Buffer or Package * 3) Store to a Method Local or Arg * 4) Store to the debug object - * 5) Store to a constant -- a noop */ switch (RefDesc->Reference.Opcode) { @@ -249,9 +262,9 @@ AcpiExStore ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Write to Debug Object: ****:\n\n")); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ", - AcpiUtGetTypeName (SourceDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc))); - switch (SourceDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) { case ACPI_TYPE_INTEGER: @@ -284,7 +297,7 @@ AcpiExStore ( default: ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Type %s %p\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), SourceDesc)); + AcpiUtGetObjectTypeName (SourceDesc), SourceDesc)); break; } @@ -292,28 +305,15 @@ AcpiExStore ( break; - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: - case AML_REVISION_OP: - - /* - * Storing to a constant is a no-op according to the ACPI - * Specification. (Delete the reference descriptor, however.) - */ - break; - - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference subtype %02x\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Reference opcode %X\n", RefDesc->Reference.Opcode)); ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR); Status = AE_AML_INTERNAL; break; - - } /* switch (RefDesc->Reference.Opcode) */ + } return_ACPI_STATUS (Status); } @@ -405,7 +405,7 @@ AcpiExStoreObjectToIndex ( * Make sure the target is a Buffer */ ObjDesc = IndexDesc->Reference.Object; - if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -414,7 +414,7 @@ AcpiExStoreObjectToIndex ( * The assignment of the individual elements will be slightly * different for each source type. */ - switch (SourceDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) { case ACPI_TYPE_INTEGER: @@ -430,7 +430,7 @@ AcpiExStoreObjectToIndex ( case ACPI_TYPE_STRING: - Value = SourceDesc->String.Pointer[0]; + Value = (UINT8) SourceDesc->String.Pointer[0]; break; default: @@ -439,7 +439,7 @@ AcpiExStoreObjectToIndex ( ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Source must be Integer/Buffer/String type, not %s\n", - AcpiUtGetTypeName (SourceDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -507,7 +507,7 @@ AcpiExStoreObjectToNode ( TargetDesc = AcpiNsGetAttachedObject (Node); ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", - SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc, AcpiUtGetObjectTypeName (SourceDesc), Node, AcpiUtGetTypeName (TargetType))); /* @@ -564,8 +564,8 @@ AcpiExStoreObjectToNode ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Store %s into %s via Convert/Attach\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), - AcpiUtGetTypeName (NewDesc->Common.Type))); + AcpiUtGetObjectTypeName (SourceDesc), + AcpiUtGetObjectTypeName (NewDesc))); } break; @@ -574,11 +574,11 @@ AcpiExStoreObjectToNode ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %s (%p) directly into node (%p), no implicit conversion\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), SourceDesc, Node)); + AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, Node)); /* No conversions for all other types. Just attach the source object */ - Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type); + Status = AcpiNsAttachObject (Node, SourceDesc, ACPI_GET_OBJECT_TYPE (SourceDesc)); break; } diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c index d322f84..422734d 100644 --- a/sys/contrib/dev/acpica/exstoren.c +++ b/sys/contrib/dev/acpica/exstoren.c @@ -3,7 +3,7 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 47 $ + * $Revision: 50 $ * *****************************************************************************/ @@ -119,12 +119,7 @@ #define __EXSTOREN_C__ #include "acpi.h" -#include "acparser.h" -#include "acdispat.h" #include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "actables.h" #define _COMPONENT ACPI_EXECUTER @@ -182,7 +177,7 @@ AcpiExResolveObject ( * are all essentially the same. This case handles the * "interchangeable" types Integer, String, and Buffer. */ - if (SourceDesc->Common.Type == INTERNAL_TYPE_REFERENCE) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) == INTERNAL_TYPE_REFERENCE) { /* Resolve a reference object first */ @@ -196,16 +191,16 @@ AcpiExResolveObject ( /* * Must have a Integer, Buffer, or String */ - if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) && - (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) && - (SourceDesc->Common.Type != ACPI_TYPE_STRING)) + if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) && + (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) && + (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)) { /* * Conversion successful but still not a valid type */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Cannot assign type %s to %s (must be type Int/Str/Buf)\n", - AcpiUtGetTypeName (SourceDesc->Common.Type), + AcpiUtGetObjectTypeName (SourceDesc), AcpiUtGetTypeName (TargetType))); Status = AE_AML_OPERAND_TYPE; } @@ -297,7 +292,7 @@ AcpiExStoreObjectToObject ( return_ACPI_STATUS (Status); } - if (SourceDesc->Common.Type != DestDesc->Common.Type) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc)) { /* * The source type does not match the type of the destination. @@ -308,7 +303,7 @@ AcpiExStoreObjectToObject ( * Otherwise, ActualSrcDesc is a temporary object to hold the * converted object. */ - Status = AcpiExConvertToTargetType (DestDesc->Common.Type, SourceDesc, + Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc), SourceDesc, &ActualSrcDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -320,7 +315,7 @@ AcpiExStoreObjectToObject ( * We now have two objects of identical types, and we can perform a * copy of the *value* of the source object. */ - switch (DestDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (DestDesc)) { case ACPI_TYPE_INTEGER: @@ -328,7 +323,7 @@ AcpiExStoreObjectToObject ( /* Truncate value if we are executing from a 32-bit ACPI table */ - AcpiExTruncateFor32bitTable (DestDesc, WalkState); + AcpiExTruncateFor32bitTable (DestDesc); break; case ACPI_TYPE_STRING: @@ -351,7 +346,7 @@ AcpiExStoreObjectToObject ( * All other types come here. */ ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n", - AcpiUtGetTypeName (DestDesc->Common.Type))); + AcpiUtGetObjectTypeName (DestDesc))); Status = AE_NOT_IMPLEMENTED; break; diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c index 4e873f5..ab8181d 100644 --- a/sys/contrib/dev/acpica/exstorob.c +++ b/sys/contrib/dev/acpica/exstorob.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exstorob - AML Interpreter object store support, store to object - * $Revision: 42 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -118,12 +118,7 @@ #define __EXSTOROB_C__ #include "acpi.h" -#include "acparser.h" -#include "acdispat.h" #include "acinterp.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "actables.h" #define _COMPONENT ACPI_EXECUTER @@ -265,7 +260,7 @@ AcpiExStoreStringToString ( ACPI_MEM_FREE (TargetDesc->String.Pointer); } - TargetDesc->String.Pointer = ACPI_MEM_ALLOCATE (Length + 1); + TargetDesc->String.Pointer = ACPI_MEM_ALLOCATE ((ACPI_SIZE) Length + 1); if (!TargetDesc->String.Pointer) { return (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c index 740a91a..ce23c15 100644 --- a/sys/contrib/dev/acpica/exutils.c +++ b/sys/contrib/dev/acpica/exutils.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 93 $ + * $Revision: 100 $ * *****************************************************************************/ @@ -134,12 +134,9 @@ #define DEFINE_AML_GLOBALS #include "acpi.h" -#include "acparser.h" #include "acinterp.h" #include "amlcode.h" -#include "acnamesp.h" #include "acevents.h" -#include "acparser.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exutils") @@ -167,7 +164,7 @@ AcpiExEnterInterpreter (void) Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Fatal - Could not acquire interpreter lock\n")); + ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n")); } return_ACPI_STATUS (Status); @@ -204,6 +201,10 @@ AcpiExExitInterpreter (void) Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE); + if (ACPI_FAILURE (Status)) + { + ACPI_REPORT_ERROR (("Could not release interpreter mutex\n")); + } return_VOID; } @@ -242,8 +243,6 @@ AcpiExValidateObjectType ( * FUNCTION: AcpiExTruncateFor32bitTable * * PARAMETERS: ObjDesc - Object to be truncated - * WalkState - Current walk state - * (A method must be executing) * * RETURN: none * @@ -254,8 +253,7 @@ AcpiExValidateObjectType ( void AcpiExTruncateFor32bitTable ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_WALK_STATE *WalkState) + ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_FUNCTION_ENTRY (); @@ -266,13 +264,12 @@ AcpiExTruncateFor32bitTable ( * a control method */ if ((!ObjDesc) || - (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) || - (!WalkState->MethodNode)) + (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)) { return; } - if (WalkState->MethodNode->Flags & ANOBJ_DATA_WIDTH_32) + if (AcpiGbl_IntegerByteWidth == 4) { /* * We are running a method that exists in a 32-bit ACPI table. @@ -344,10 +341,12 @@ AcpiExAcquireGlobalLock ( * ******************************************************************************/ -ACPI_STATUS +void AcpiExReleaseGlobalLock ( BOOLEAN LockedByMe) { + ACPI_STATUS Status; + ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock"); @@ -358,10 +357,14 @@ AcpiExReleaseGlobalLock ( { /* OK, now release the lock */ - AcpiEvReleaseGlobalLock (); - } + Status = AcpiEvReleaseGlobalLock (); + if (ACPI_FAILURE (Status)) + { + /* Report the error, but there isn't much else we can do */ - return_ACPI_STATUS (AE_OK); + ACPI_REPORT_ERROR (("Could not release ACPI Global Lock\n")); + } + } } @@ -381,25 +384,25 @@ AcpiExDigitsNeeded ( ACPI_INTEGER Value, UINT32 Base) { - UINT32 NumDigits = 0; + UINT32 NumDigits; + ACPI_INTEGER CurrentValue; + ACPI_INTEGER Quotient; ACPI_FUNCTION_TRACE ("ExDigitsNeeded"); - if (Base < 1) - { - ACPI_REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n")); - } - else + /* + * ACPI_INTEGER is unsigned, so we don't worry about a '-' + */ + CurrentValue = Value; + NumDigits = 0; + + while (CurrentValue) { - /* - * ACPI_INTEGER is unsigned, which is why we don't worry about a '-' - */ - for (NumDigits = 1; - (AcpiUtShortDivide (&Value, Base, &Value, NULL)); - ++NumDigits) - { ; } + (void) AcpiUtShortDivide (&CurrentValue, Base, &Quotient, NULL); + NumDigits++; + CurrentValue = Quotient; } return_VALUE (NumDigits); @@ -408,47 +411,6 @@ AcpiExDigitsNeeded ( /******************************************************************************* * - * FUNCTION: ntohl - * - * PARAMETERS: Value - Value to be converted - * - * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) - * - ******************************************************************************/ - -static UINT32 -_ntohl ( - UINT32 Value) -{ - union - { - UINT32 Value; - UINT8 Bytes[4]; - } Out; - - union - { - UINT32 Value; - UINT8 Bytes[4]; - } In; - - - ACPI_FUNCTION_ENTRY (); - - - In.Value = Value; - - Out.Bytes[0] = In.Bytes[3]; - Out.Bytes[1] = In.Bytes[2]; - Out.Bytes[2] = In.Bytes[1]; - Out.Bytes[3] = In.Bytes[0]; - - return (Out.Value); -} - - -/******************************************************************************* - * * FUNCTION: AcpiExEisaIdToString * * PARAMETERS: NumericId - EISA ID to be converted @@ -458,31 +420,29 @@ _ntohl ( * ******************************************************************************/ -ACPI_STATUS +void AcpiExEisaIdToString ( UINT32 NumericId, NATIVE_CHAR *OutString) { - UINT32 id; + UINT32 EisaId; ACPI_FUNCTION_ENTRY (); - /* swap to big-endian to get contiguous bits */ + /* Swap ID to big-endian to get contiguous bits */ - id = _ntohl (NumericId); + EisaId = AcpiUtDwordByteSwap (NumericId); - OutString[0] = (char) ('@' + ((id >> 26) & 0x1f)); - OutString[1] = (char) ('@' + ((id >> 21) & 0x1f)); - OutString[2] = (char) ('@' + ((id >> 16) & 0x1f)); - OutString[3] = AcpiUtHexToAsciiChar (id, 12); - OutString[4] = AcpiUtHexToAsciiChar (id, 8); - OutString[5] = AcpiUtHexToAsciiChar (id, 4); - OutString[6] = AcpiUtHexToAsciiChar (id, 0); + OutString[0] = (char) ('@' + ((EisaId >> 26) & 0x1f)); + OutString[1] = (char) ('@' + ((EisaId >> 21) & 0x1f)); + OutString[2] = (char) ('@' + ((EisaId >> 16) & 0x1f)); + OutString[3] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 12); + OutString[4] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 8); + OutString[5] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 4); + OutString[6] = AcpiUtHexToAsciiChar ((ACPI_INTEGER) EisaId, 0); OutString[7] = 0; - - return (AE_OK); } @@ -497,7 +457,7 @@ AcpiExEisaIdToString ( * ******************************************************************************/ -ACPI_STATUS +void AcpiExUnsignedIntegerToString ( ACPI_INTEGER Value, NATIVE_CHAR *OutString) @@ -505,6 +465,7 @@ AcpiExUnsignedIntegerToString ( UINT32 Count; UINT32 DigitsNeeded; UINT32 Remainder; + ACPI_INTEGER Quotient; ACPI_FUNCTION_ENTRY (); @@ -515,11 +476,10 @@ AcpiExUnsignedIntegerToString ( for (Count = DigitsNeeded; Count > 0; Count--) { - AcpiUtShortDivide (&Value, 10, &Value, &Remainder); - OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder); + (void) AcpiUtShortDivide (&Value, 10, &Quotient, &Remainder); + OutString[Count-1] = (NATIVE_CHAR) ('0' + Remainder);\ + Value = Quotient; } - - return (AE_OK); } diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c index e73367f..8391e55 100644 --- a/sys/contrib/dev/acpica/hwacpi.c +++ b/sys/contrib/dev/acpica/hwacpi.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface - * $Revision: 53 $ + * $Revision: 58 $ * *****************************************************************************/ @@ -118,7 +118,6 @@ #define __HWACPI_C__ #include "acpi.h" -#include "achware.h" #define _COMPONENT ACPI_HARDWARE @@ -185,38 +184,60 @@ AcpiHwSetMode ( UINT32 Mode) { - ACPI_STATUS Status = AE_NO_HARDWARE_RESPONSE; + ACPI_STATUS Status; + UINT32 Retry; ACPI_FUNCTION_TRACE ("HwSetMode"); - - if (Mode == ACPI_SYS_MODE_ACPI) + switch (Mode) { + case ACPI_SYS_MODE_ACPI: + /* BIOS should have disabled ALL fixed and GP events */ - AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable, 8); + Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, + (ACPI_INTEGER) AcpiGbl_FADT->AcpiEnable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n")); - } - else if (Mode == ACPI_SYS_MODE_LEGACY) - { + break; + + case ACPI_SYS_MODE_LEGACY: + /* * BIOS should clear all fixed status bits and restore fixed event * enable bits to default */ - AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable, 8); + Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, + (ACPI_INTEGER) AcpiGbl_FADT->AcpiDisable, 8); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable Legacy (non-ACPI) mode\n")); - } + break; - /* Give the platform some time to react */ + default: + return_ACPI_STATUS (AE_BAD_PARAMETER); + } - AcpiOsStall (20000); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - if (AcpiHwGetMode () == Mode) + /* + * Some hardware takes a LONG time to switch modes. Give them 3 sec to + * do so, but allow faster systems to proceed more quickly. + */ + Retry = 3000; + while (Retry) { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode)); - Status = AE_OK; + Status = AE_NO_HARDWARE_RESPONSE; + + if (AcpiHwGetMode() == Mode) { + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode)); + Status = AE_OK; + break; + } + AcpiOsStall(1000); + Retry--; } return_ACPI_STATUS (Status); @@ -239,11 +260,19 @@ AcpiHwSetMode ( UINT32 AcpiHwGetMode (void) { + ACPI_STATUS Status; + UINT32 Value; + ACPI_FUNCTION_TRACE ("HwGetMode"); + Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK); + if (ACPI_FAILURE (Status)) + { + return_VALUE (ACPI_SYS_MODE_LEGACY); + } - if (AcpiHwBitRegisterRead (ACPI_BITREG_SCI_ENABLE, ACPI_MTX_LOCK)) + if (Value) { return_VALUE (ACPI_SYS_MODE_ACPI); } diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c index 09981c3..c5cc7f7 100644 --- a/sys/contrib/dev/acpica/hwgpe.c +++ b/sys/contrib/dev/acpica/hwgpe.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: hwgpe - Low level GPE enable/disable/clear functions - * $Revision: 40 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -116,8 +116,6 @@ *****************************************************************************/ #include "acpi.h" -#include "achware.h" -#include "acnamesp.h" #include "acevents.h" #define _COMPONENT ACPI_HARDWARE @@ -136,7 +134,7 @@ * ******************************************************************************/ -UINT32 +UINT8 AcpiHwGetGpeBitMask ( UINT32 GpeNumber) { @@ -156,13 +154,14 @@ AcpiHwGetGpeBitMask ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwEnableGpe ( UINT32 GpeNumber) { UINT32 InByte; UINT32 RegisterIndex; - UINT32 BitMask; + UINT8 BitMask; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -180,10 +179,17 @@ AcpiHwEnableGpe ( * Read the current value of the register, set the appropriate bit * to enable the GPE, and write out the new register. */ - InByte = AcpiHwLowLevelRead (8, - &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); - AcpiHwLowLevelWrite (8, (InByte | BitMask), - &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); + Status = AcpiHwLowLevelRead (8, &InByte, + &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiHwLowLevelWrite (8, (InByte | BitMask), + &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); + + return (Status); } @@ -205,7 +211,7 @@ AcpiHwEnableGpeForWakeup ( UINT32 GpeNumber) { UINT32 RegisterIndex; - UINT32 BitMask; + UINT8 BitMask; ACPI_FUNCTION_ENTRY (); @@ -238,13 +244,14 @@ AcpiHwEnableGpeForWakeup ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwDisableGpe ( UINT32 GpeNumber) { UINT32 InByte; UINT32 RegisterIndex; - UINT32 BitMask; + UINT8 BitMask; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -262,12 +269,22 @@ AcpiHwDisableGpe ( * Read the current value of the register, clear the appropriate bit, * and write out the new register value to disable the GPE. */ - InByte = AcpiHwLowLevelRead (8, - &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); - AcpiHwLowLevelWrite (8, (InByte & ~BitMask), - &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); + Status = AcpiHwLowLevelRead (8, &InByte, + &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiHwLowLevelWrite (8, (InByte & ~BitMask), + &AcpiGbl_GpeRegisterInfo[RegisterIndex].EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } AcpiHwDisableGpeForWakeup(GpeNumber); + return (AE_OK); } @@ -289,7 +306,7 @@ AcpiHwDisableGpeForWakeup ( UINT32 GpeNumber) { UINT32 RegisterIndex; - UINT32 BitMask; + UINT8 BitMask; ACPI_FUNCTION_ENTRY (); @@ -322,12 +339,13 @@ AcpiHwDisableGpeForWakeup ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwClearGpe ( UINT32 GpeNumber) { UINT32 RegisterIndex; - UINT32 BitMask; + UINT8 BitMask; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -345,8 +363,10 @@ AcpiHwClearGpe ( * Write a one to the appropriate bit in the status register to * clear this GPE. */ - AcpiHwLowLevelWrite (8, BitMask, - &AcpiGbl_GpeRegisterInfo[RegisterIndex].StatusAddress, 0); + Status = AcpiHwLowLevelWrite (8, BitMask, + &AcpiGbl_GpeRegisterInfo[RegisterIndex].StatusAddress, 0); + + return (Status); } @@ -362,15 +382,16 @@ AcpiHwClearGpe ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwGetGpeStatus ( UINT32 GpeNumber, ACPI_EVENT_STATUS *EventStatus) { UINT32 InByte = 0; UINT32 RegisterIndex = 0; - UINT32 BitMask = 0; + UINT8 BitMask = 0; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -378,7 +399,7 @@ AcpiHwGetGpeStatus ( if (!EventStatus) { - return; + return (AE_BAD_PARAMETER); } (*EventStatus) = 0; @@ -394,7 +415,12 @@ AcpiHwGetGpeStatus ( /* GPE Enabled? */ - InByte = AcpiHwLowLevelRead (8, &GpeRegisterInfo->EnableAddress, 0); + Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (BitMask & InByte) { (*EventStatus) |= ACPI_EVENT_FLAG_ENABLED; @@ -409,11 +435,17 @@ AcpiHwGetGpeStatus ( /* GPE active (set)? */ - InByte = AcpiHwLowLevelRead (8, &GpeRegisterInfo->StatusAddress, 0); + Status = AcpiHwLowLevelRead (8, &InByte, &GpeRegisterInfo->StatusAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (BitMask & InByte) { (*EventStatus) |= ACPI_EVENT_FLAG_SET; } + return (AE_OK); } @@ -433,12 +465,14 @@ AcpiHwGetGpeStatus ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwDisableNonWakeupGpes ( void) { UINT32 i; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + UINT32 InValue; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -452,15 +486,26 @@ AcpiHwDisableNonWakeupGpes ( * Read the enabled status of all GPEs. We * will be using it to restore all the GPEs later. */ - GpeRegisterInfo->Enable = (UINT8) AcpiHwLowLevelRead (8, + Status = AcpiHwLowLevelRead (8, &InValue, &GpeRegisterInfo->EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + GpeRegisterInfo->Enable = (UINT8) InValue; /* * Disable all GPEs except wakeup GPEs. */ - AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable, + Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->WakeEnable, &GpeRegisterInfo->EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } + return (AE_OK); } @@ -476,12 +521,13 @@ AcpiHwDisableNonWakeupGpes ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwEnableNonWakeupGpes ( void) { UINT32 i; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_STATUS Status; ACPI_FUNCTION_ENTRY (); @@ -495,7 +541,12 @@ AcpiHwEnableNonWakeupGpes ( * We previously stored the enabled status of all GPEs. * Blast them back in. */ - AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable, & - GpeRegisterInfo->EnableAddress, 0); + Status = AcpiHwLowLevelWrite (8, GpeRegisterInfo->Enable, + &GpeRegisterInfo->EnableAddress, 0); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } + return (AE_OK); } diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c index 97146d4..fb2b8e4 100644 --- a/sys/contrib/dev/acpica/hwregs.c +++ b/sys/contrib/dev/acpica/hwregs.c @@ -3,7 +3,7 @@ * * Module Name: hwregs - Read/write access functions for the various ACPI * control and status registers. - * $Revision: 121 $ + * $Revision: 133 $ * ******************************************************************************/ @@ -119,7 +119,6 @@ #define __HWREGS_C__ #include "acpi.h" -#include "achware.h" #include "acnamesp.h" #define _COMPONENT ACPI_HARDWARE @@ -138,10 +137,10 @@ * ******************************************************************************/ -void +ACPI_STATUS AcpiHwClearAcpiStatus (void) { - NATIVE_UINT i; + NATIVE_UINT_MAX32 i; NATIVE_UINT GpeBlock; ACPI_STATUS Status; @@ -157,18 +156,26 @@ AcpiHwClearAcpiStatus (void) Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); if (ACPI_FAILURE (Status)) { - return_VOID; + return_ACPI_STATUS (Status); } - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, - ACPI_BITMASK_ALL_FIXED_STATUS); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, + ACPI_BITMASK_ALL_FIXED_STATUS); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } /* Clear the fixed events */ if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address)) { - AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS, - &AcpiGbl_FADT->XPm1bEvtBlk, 0); + Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS, + &AcpiGbl_FADT->XPm1bEvtBlk, 0); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } } /* Clear the GPE Bits */ @@ -177,19 +184,24 @@ AcpiHwClearAcpiStatus (void) { for (i = 0; i < AcpiGbl_GpeBlockInfo[GpeBlock].RegisterCount; i++) { - AcpiHwLowLevelWrite (8, 0xFF, - AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress, i); + Status = AcpiHwLowLevelWrite (8, 0xFF, + AcpiGbl_GpeBlockInfo[GpeBlock].BlockAddress, i); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } } } +UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); - return_VOID; + return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiHwGetSleepTypeData + * FUNCTION: AcpiGetSleepTypeData * * PARAMETERS: SleepState - Numeric sleep state * *SleepTypeA - Where SLP_TYPa is returned @@ -203,7 +215,7 @@ AcpiHwClearAcpiStatus (void) ******************************************************************************/ ACPI_STATUS -AcpiHwGetSleepTypeData ( +AcpiGetSleepTypeData ( UINT8 SleepState, UINT8 *SleepTypeA, UINT8 *SleepTypeB) @@ -212,11 +224,11 @@ AcpiHwGetSleepTypeData ( ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_FUNCTION_TRACE ("HwGetSleepTypeData"); + ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData"); /* - * Validate parameters + * Validate parameters */ if ((SleepState > ACPI_S_STATES_MAX) || !SleepTypeA || !SleepTypeB) @@ -225,7 +237,7 @@ AcpiHwGetSleepTypeData ( } /* - * AcpiEvaluate the namespace object containing the values for this state + * Evaluate the namespace object containing the values for this state */ Status = AcpiNsEvaluateByName ((NATIVE_CHAR *) AcpiGbl_DbSleepStates[SleepState], NULL, &ObjDesc); @@ -234,42 +246,44 @@ AcpiHwGetSleepTypeData ( return_ACPI_STATUS (Status); } + /* Must have a return object */ + if (!ObjDesc) { ACPI_REPORT_ERROR (("Missing Sleep State object\n")); - return_ACPI_STATUS (AE_NOT_EXIST); + Status = AE_NOT_EXIST; } - /* - * We got something, now ensure it is correct. The object must - * be a package and must have at least 2 numeric values as the - * two elements - */ + /* It must be of type Package */ - /* Even though AcpiEvaluateObject resolves package references, - * NsEvaluate doesn't. So, we do it here. - */ - Status = AcpiUtResolvePackageReferences(ObjDesc); - - if (ObjDesc->Package.Count < 2) + else if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_PACKAGE) { - /* Must have at least two elements */ + ACPI_REPORT_ERROR (("Sleep State object not a Package\n")); + Status = AE_AML_OPERAND_TYPE; + } + + /* The package must have at least two elements */ + else if (ObjDesc->Package.Count < 2) + { ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n")); Status = AE_AML_NO_OPERAND; } - else if (((ObjDesc->Package.Elements[0])->Common.Type != ACPI_TYPE_INTEGER) || - ((ObjDesc->Package.Elements[1])->Common.Type != ACPI_TYPE_INTEGER)) - { - /* Must have two */ - ACPI_REPORT_ERROR (("Sleep State package elements are not both of type Number\n")); + /* The first two elements must both be of type Integer */ + + else if ((ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[0]) != ACPI_TYPE_INTEGER) || + (ACPI_GET_OBJECT_TYPE (ObjDesc->Package.Elements[1]) != ACPI_TYPE_INTEGER)) + { + ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n", + AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[0]), + AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[1]))); Status = AE_AML_OPERAND_TYPE; } else { /* - * Valid _Sx_ package size, type, and value + * Valid _Sx_ package size, type, and value */ *SleepTypeA = (UINT8) (ObjDesc->Package.Elements[0])->Integer.Value; *SleepTypeB = (UINT8) (ObjDesc->Package.Elements[1])->Integer.Value; @@ -277,8 +291,8 @@ AcpiHwGetSleepTypeData ( if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %X\n", - ObjDesc, ObjDesc->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad Sleep object %p type %s\n", + ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); } AcpiUtRemoveReference (ObjDesc); @@ -290,8 +304,8 @@ AcpiHwGetSleepTypeData ( * * FUNCTION: AcpiHwGetRegisterBitMask * - * PARAMETERS: RegisterId - index of ACPI Register to access - * + * PARAMETERS: RegisterId - Index of ACPI Register to access + * * RETURN: The bit mask to be used when accessing the register * * DESCRIPTION: Map RegisterId into a register bit mask. @@ -317,10 +331,10 @@ AcpiHwGetBitRegisterInfo ( /******************************************************************************* * - * FUNCTION: AcpiHwBitRegisterRead + * FUNCTION: AcpiGetRegister * - * PARAMETERS: RegisterId - index of ACPI Register to access - * UseLock - Lock the hardware + * PARAMETERS: RegisterId - Index of ACPI Register to access + * UseLock - Lock the hardware * * RETURN: Value is read from specified Register. Value returned is * normalized to bit0 (is shifted all the way right) @@ -329,26 +343,20 @@ AcpiHwGetBitRegisterInfo ( * ******************************************************************************/ -UINT32 -AcpiHwBitRegisterRead ( +ACPI_STATUS +AcpiGetRegister ( UINT32 RegisterId, + UINT32 *ReturnValue, UINT32 Flags) { UINT32 RegisterValue = 0; ACPI_BIT_REGISTER_INFO *BitRegInfo; + ACPI_STATUS Status; - ACPI_FUNCTION_TRACE ("HwBitRegisterRead"); + ACPI_FUNCTION_TRACE ("AcpiGetRegister"); - if (Flags & ACPI_MTX_LOCK) - { - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE))) - { - return_VALUE (0); - } - } - /* Get the info structure corresponding to the requested ACPI Register */ BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); @@ -357,70 +365,94 @@ AcpiHwBitRegisterRead ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, BitRegInfo->ParentRegister); + if (Flags & ACPI_MTX_LOCK) + { + Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + + Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, + BitRegInfo->ParentRegister, &RegisterValue); if (Flags & ACPI_MTX_LOCK) { (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); } - /* Normalize the value that was read */ + if (ACPI_SUCCESS (Status)) + { + /* Normalize the value that was read */ - RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition); + RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) + >> BitRegInfo->BitPosition); + + *ReturnValue = RegisterValue; + + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %X\n", RegisterValue)); + } - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI RegisterRead: got %X\n", RegisterValue)); - return_VALUE (RegisterValue); + return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiHwBitRegisterWrite + * FUNCTION: AcpiSetRegister * * PARAMETERS: RegisterId - ID of ACPI BitRegister to access * Value - (only used on write) value to write to the * Register, NOT pre-normalized to the bit pos. * Flags - Lock the hardware or not * - * RETURN: Value written to from specified Register. This value - * is shifted all the way right. + * RETURN: None * * DESCRIPTION: ACPI Bit Register write function. * ******************************************************************************/ -UINT32 -AcpiHwBitRegisterWrite ( +ACPI_STATUS +AcpiSetRegister ( UINT32 RegisterId, UINT32 Value, UINT32 Flags) { UINT32 RegisterValue = 0; ACPI_BIT_REGISTER_INFO *BitRegInfo; + ACPI_STATUS Status; - ACPI_FUNCTION_TRACE_U32 ("HwBitRegisterWrite", RegisterId); + ACPI_FUNCTION_TRACE_U32 ("AcpiSetRegister", RegisterId); - if (Flags & ACPI_MTX_LOCK) - { - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE))) - { - return_VALUE (0); - } - } - /* Get the info structure corresponding to the requested ACPI Register */ BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId); if (!BitRegInfo) { + ACPI_REPORT_ERROR (("Bad ACPI HW RegisterId: %X\n", RegisterId)); return_ACPI_STATUS (AE_BAD_PARAMETER); } + if (Flags & ACPI_MTX_LOCK) + { + Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } + /* Always do a register read first so we can insert the new bits */ - RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, BitRegInfo->ParentRegister); + Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, + BitRegInfo->ParentRegister, &RegisterValue); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } /* * Decode the Register ID @@ -439,11 +471,12 @@ AcpiHwBitRegisterWrite ( * information is the single bit we're interested in, all others should * be written as 0 so they will be left unchanged */ - Value = ACPI_REGISTER_PREPARE_BITS (Value, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); + Value = ACPI_REGISTER_PREPARE_BITS (Value, + BitRegInfo->BitPosition, BitRegInfo->AccessBitMask); if (Value) { - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, - (UINT16) Value); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_STATUS, (UINT16) Value); RegisterValue = 0; } break; @@ -451,9 +484,11 @@ AcpiHwBitRegisterWrite ( case ACPI_REGISTER_PM1_ENABLE: - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value); + ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, + BitRegInfo->AccessBitMask, Value); - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue); + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue); break; @@ -466,29 +501,37 @@ AcpiHwBitRegisterWrite ( */ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", RegisterValue)); - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value); + ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, + BitRegInfo->AccessBitMask, Value); - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId, + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId, (UINT16) RegisterValue); break; case ACPI_REGISTER_PM2_CONTROL: - RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL); + Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, + ACPI_REGISTER_PM2_CONTROL, &RegisterValue); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n", - RegisterValue, ACPI_HIDWORD (AcpiGbl_FADT->XPm2CntBlk.Address), - ACPI_LODWORD (AcpiGbl_FADT->XPm2CntBlk.Address))); + RegisterValue, + ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)), + ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); - ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, BitRegInfo->AccessBitMask, Value); + ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition, + BitRegInfo->AccessBitMask, Value); - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %8.8X%8.8X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n", RegisterValue, - ACPI_HIDWORD (AcpiGbl_FADT->XPm2CntBlk.Address), - ACPI_LODWORD (AcpiGbl_FADT->XPm2CntBlk.Address))); + ACPI_HIDWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)), + ACPI_LODWORD (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address)))); - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, + Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue)); break; @@ -497,6 +540,9 @@ AcpiHwBitRegisterWrite ( break; } + +UnlockAndExit: + if (Flags & ACPI_MTX_LOCK) { (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); @@ -504,10 +550,10 @@ AcpiHwBitRegisterWrite ( /* Normalize the value that was read */ - RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition); + ACPI_DEBUG_EXEC (RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition)); - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI RegisterWrite actual %X\n", RegisterValue)); - return_VALUE (RegisterValue); + ACPI_DEBUG_PRINT ((ACPI_DB_IO, "ACPI Register Write actual %X\n", RegisterValue)); + return_ACPI_STATUS (Status); } @@ -525,13 +571,16 @@ AcpiHwBitRegisterWrite ( * ******************************************************************************/ -UINT32 +ACPI_STATUS AcpiHwRegisterRead ( BOOLEAN UseLock, - UINT32 RegisterId) + UINT32 RegisterId, + UINT32 *ReturnValue) { - UINT32 Value = 0; + UINT32 Value1 = 0; + UINT32 Value2 = 0; UINT32 BankOffset; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("HwRegisterRead"); @@ -539,9 +588,10 @@ AcpiHwRegisterRead ( if (ACPI_MTX_LOCK == UseLock) { - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE))) + Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); + if (ACPI_FAILURE (Status)) { - return_VALUE (0); + return_ACPI_STATUS (Status); } } @@ -549,53 +599,78 @@ AcpiHwRegisterRead ( { case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aEvtBlk, 0); - Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bEvtBlk, 0); + Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk, 0); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk, 0); + Value1 |= Value2; break; case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/ BankOffset = ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen); - Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset); - Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset); + Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset); + Value1 |= Value2; break; case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - Value = AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1aCntBlk, 0); - Value |= AcpiHwLowLevelRead (16, &AcpiGbl_FADT->XPm1bCntBlk, 0); + Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk, 0); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk, 0); + Value1 |= Value2; break; case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - Value = AcpiHwLowLevelRead (8, &AcpiGbl_FADT->XPm2CntBlk, 0); + Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk, 0); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - Value = AcpiHwLowLevelRead (32, &AcpiGbl_FADT->XPmTmrBlk, 0); + Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk, 0); break; case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ - AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value, 8); + Status = AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value1, 8); break; default: - /* Value will be returned as 0 */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", RegisterId)); + Status = AE_BAD_PARAMETER; break; } +UnlockAndExit: if (ACPI_MTX_LOCK == UseLock) { (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); } - return_VALUE (Value); + if (ACPI_SUCCESS (Status)) + { + *ReturnValue = Value1; + } + + return_ACPI_STATUS (Status); } @@ -613,13 +688,14 @@ AcpiHwRegisterRead ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwRegisterWrite ( BOOLEAN UseLock, UINT32 RegisterId, UINT32 Value) { UINT32 BankOffset; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE ("HwRegisterWrite"); @@ -627,9 +703,10 @@ AcpiHwRegisterWrite ( if (ACPI_MTX_LOCK == UseLock) { - if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_HARDWARE))) + Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); + if (ACPI_FAILURE (Status)) { - return_VOID; + return_ACPI_STATUS (Status); } } @@ -637,47 +714,62 @@ AcpiHwRegisterWrite ( { case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */ - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, 0); - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, 0); + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, 0); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, 0); break; case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/ BankOffset = ACPI_DIV_2 (AcpiGbl_FADT->Pm1EvtLen); - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset); - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset); + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk, BankOffset); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk, BankOffset); break; case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */ - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0); - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0); + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0); + if (ACPI_FAILURE (Status)) + { + goto UnlockAndExit; + } + + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0); break; case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */ - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0); + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk, 0); break; case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */ - AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0); + Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk, 0); break; case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk, 0); + Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk, 0); break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk, 0); + Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk, 0); break; @@ -685,21 +777,22 @@ AcpiHwRegisterWrite ( /* SMI_CMD is currently always in IO space */ - AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8); + Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (ACPI_INTEGER) Value, 8); break; default: - Value = 0; + Status = AE_BAD_PARAMETER; break; } +UnlockAndExit: if (ACPI_MTX_LOCK == UseLock) { (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); } - return_VOID; + return_ACPI_STATUS (Status); } @@ -717,31 +810,34 @@ AcpiHwRegisterWrite ( * ******************************************************************************/ -UINT32 +ACPI_STATUS AcpiHwLowLevelRead ( UINT32 Width, + UINT32 *Value, ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset) { - UINT32 Value = 0; ACPI_PHYSICAL_ADDRESS MemAddress; ACPI_IO_ADDRESS IoAddress; ACPI_PCI_ID PciId; UINT16 PciRegister; + ACPI_STATUS Status; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_NAME ("HwLowLevelRead"); /* * Must have a valid pointer to a GAS structure, and - * a non-zero address within + * a non-zero address within. However, don't return an error + * because the PM1A/B code must not fail if B isn't present. */ if ((!Reg) || (!ACPI_VALID_ADDRESS (Reg->Address))) { - return 0; + return (AE_OK); } + *Value = 0; /* * Three address spaces supported: @@ -751,17 +847,19 @@ AcpiHwLowLevelRead ( { case ACPI_ADR_SPACE_SYSTEM_MEMORY: - MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); + MemAddress = (ACPI_GET_ADDRESS (Reg->Address) + + (ACPI_PHYSICAL_ADDRESS) Offset); - AcpiOsReadMemory (MemAddress, &Value, Width); + Status = AcpiOsReadMemory (MemAddress, Value, Width); break; case ACPI_ADR_SPACE_SYSTEM_IO: - IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); + IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + + (ACPI_PHYSICAL_ADDRESS) Offset); - AcpiOsReadPort (IoAddress, &Value, Width); + Status = AcpiOsReadPort (IoAddress, Value, Width); break; @@ -771,13 +869,20 @@ AcpiHwLowLevelRead ( PciId.Bus = 0; PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address)); PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address)); - PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset); + PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + + Offset); - AcpiOsReadPciConfiguration (&PciId, PciRegister, &Value, Width); + Status = AcpiOsReadPciConfiguration (&PciId, PciRegister, Value, Width); + break; + + + default: + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", Reg->AddressSpaceId)); + Status = AE_BAD_PARAMETER; break; } - return Value; + return (Status); } @@ -797,7 +902,7 @@ AcpiHwLowLevelRead ( * ******************************************************************************/ -void +ACPI_STATUS AcpiHwLowLevelWrite ( UINT32 Width, UINT32 Value, @@ -808,21 +913,22 @@ AcpiHwLowLevelWrite ( ACPI_IO_ADDRESS IoAddress; ACPI_PCI_ID PciId; UINT16 PciRegister; + ACPI_STATUS Status; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_NAME ("HwLowLevelWrite"); /* * Must have a valid pointer to a GAS structure, and - * a non-zero address within + * a non-zero address within. However, don't return an error + * because the PM1A/B code must not fail if B isn't present. */ if ((!Reg) || (!ACPI_VALID_ADDRESS (Reg->Address))) { - return; + return (AE_OK); } - /* * Three address spaces supported: * Memory, Io, or PCI config. @@ -831,17 +937,19 @@ AcpiHwLowLevelWrite ( { case ACPI_ADR_SPACE_SYSTEM_MEMORY: - MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); + MemAddress = (ACPI_GET_ADDRESS (Reg->Address) + + (ACPI_PHYSICAL_ADDRESS) Offset); - AcpiOsWriteMemory (MemAddress, Value, Width); + Status = AcpiOsWriteMemory (MemAddress, (ACPI_INTEGER) Value, Width); break; case ACPI_ADR_SPACE_SYSTEM_IO: - IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); + IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + + (ACPI_PHYSICAL_ADDRESS) Offset); - AcpiOsWritePort (IoAddress, Value, Width); + Status = AcpiOsWritePort (IoAddress, (ACPI_INTEGER) Value, Width); break; @@ -851,9 +959,18 @@ AcpiHwLowLevelWrite ( PciId.Bus = 0; PciId.Device = ACPI_PCI_DEVICE (ACPI_GET_ADDRESS (Reg->Address)); PciId.Function = ACPI_PCI_FUNCTION (ACPI_GET_ADDRESS (Reg->Address)); - PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset); + PciRegister = (UINT16) (ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + + Offset); + + Status = AcpiOsWritePciConfiguration (&PciId, PciRegister, (ACPI_INTEGER) Value, Width); + break; - AcpiOsWritePciConfiguration (&PciId, PciRegister, Value, Width); + + default: + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported address space: %X\n", Reg->AddressSpaceId)); + Status = AE_BAD_PARAMETER; break; } + + return (Status); } diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c index cda38ff..d7fe8e1 100644 --- a/sys/contrib/dev/acpica/hwtimer.c +++ b/sys/contrib/dev/acpica/hwtimer.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwtimer.c - ACPI Power Management Timer Interface - * $Revision: 20 $ + * $Revision: 21 $ * *****************************************************************************/ @@ -116,7 +116,6 @@ *****************************************************************************/ #include "acpi.h" -#include "achware.h" #define _COMPONENT ACPI_HARDWARE ACPI_MODULE_NAME ("hwtimer") @@ -175,6 +174,9 @@ ACPI_STATUS AcpiGetTimer ( UINT32 *Ticks) { + ACPI_STATUS Status; + + ACPI_FUNCTION_TRACE ("AcpiGetTimer"); @@ -183,9 +185,9 @@ AcpiGetTimer ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - *Ticks = AcpiHwLowLevelRead (32, &AcpiGbl_FADT->XPmTmrBlk, 0); + Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT->XPmTmrBlk, 0); - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index 588617a..3e05553 100644 --- a/sys/contrib/dev/acpica/nsaccess.c +++ b/sys/contrib/dev/acpica/nsaccess.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsaccess - Top-level functions for accessing ACPI namespace - * $Revision: 153 $ + * $Revision: 156 $ * ******************************************************************************/ @@ -118,7 +118,6 @@ #include "acpi.h" #include "amlcode.h" -#include "acinterp.h" #include "acnamesp.h" #include "acdispat.h" @@ -283,7 +282,7 @@ AcpiNsRootInitialize (void) /* Store pointer to value descriptor in the Node */ - AcpiNsAttachObject (NewNode, ObjDesc, ObjDesc->Common.Type); + Status = AcpiNsAttachObject (NewNode, ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc)); /* Remove local reference to the object */ @@ -409,9 +408,10 @@ AcpiNsLookup ( NumSegments = 0; ThisNode = AcpiGbl_RootNode; + Pathname = ""; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Null Pathname (Zero segments), Flags=%x\n", Flags)); + "Null Pathname (Zero segments), Flags=%X\n", Flags)); } else { @@ -428,7 +428,7 @@ AcpiNsLookup ( * Parent Prefixes (in which case the name's scope is relative * to the current scope). */ - if (*Pathname == AML_ROOT_PREFIX) + if (*Pathname == (UINT8) AML_ROOT_PREFIX) { /* Pathname is fully qualified, start from the root */ @@ -454,7 +454,7 @@ AcpiNsLookup ( * the parent node for each prefix instance. */ ThisNode = PrefixNode; - while (*Pathname == AML_PARENT_PREFIX) + while (*Pathname == (UINT8) AML_PARENT_PREFIX) { /* * Point past this prefix to the name segment @@ -499,7 +499,7 @@ AcpiNsLookup ( NumSegments = 0; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, - "Prefix-only Pathname (Zero name segments), Flags=%x\n", Flags)); + "Prefix-only Pathname (Zero name segments), Flags=%X\n", Flags)); break; case AML_DUAL_NAME_PREFIX: diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c index 3db018c..cab91bd 100644 --- a/sys/contrib/dev/acpica/nsalloc.c +++ b/sys/contrib/dev/acpica/nsalloc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsalloc - Namespace allocation and deletion utilities - * $Revision: 72 $ + * $Revision: 74 $ * ******************************************************************************/ @@ -119,7 +119,6 @@ #include "acpi.h" #include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_NAMESPACE @@ -310,7 +309,7 @@ AcpiNsInstallNode ( * real definition is found later. */ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] is a forward reference\n", - (char *) &Node->Name)); + Node->Name.Ascii)); } /* @@ -337,7 +336,7 @@ AcpiNsInstallNode ( } ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%4.4s added to %p at %p\n", - (char *) &Node->Name, ParentNode, Node)); + Node->Name.Ascii, ParentNode, Node)); /* * Increment the reference count(s) of all parents up to @@ -449,7 +448,7 @@ AcpiNsDeleteChildren ( * ******************************************************************************/ -ACPI_STATUS +void AcpiNsDeleteNamespaceSubtree ( ACPI_NAMESPACE_NODE *ParentNode) { @@ -462,7 +461,7 @@ AcpiNsDeleteNamespaceSubtree ( if (!ParentNode) { - return_ACPI_STATUS (AE_OK); + return_VOID; } /* @@ -518,7 +517,7 @@ AcpiNsDeleteNamespaceSubtree ( } } - return_ACPI_STATUS (AE_OK); + return_VOID; } @@ -592,7 +591,7 @@ AcpiNsRemoveReference ( * ******************************************************************************/ -ACPI_STATUS +void AcpiNsDeleteNamespaceByOwner ( UINT16 OwnerId) { @@ -679,7 +678,7 @@ AcpiNsDeleteNamespaceByOwner ( } } - return_ACPI_STATUS (AE_OK); + return_VOID; } diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index 0f6e915..f2c7453 100644 --- a/sys/contrib/dev/acpica/nsdump.c +++ b/sys/contrib/dev/acpica/nsdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsdump - table dumping routines for debug - * $Revision: 129 $ + * $Revision: 136 $ * *****************************************************************************/ @@ -118,9 +118,7 @@ #define __NSDUMP_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" -#include "actables.h" #include "acparser.h" @@ -309,12 +307,12 @@ AcpiNsDumpOneObject ( { if (AcpiNsExistDownstreamSibling (ThisNode + 1)) { - DownstreamSiblingMask |= (1 << (Level - 1)); + DownstreamSiblingMask |= ((UINT32) 1 << (Level - 1)); AcpiOsPrintf ("+"); } else { - DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1)); + DownstreamSiblingMask &= ACPI_UINT32_MAX ^ ((UINT32) 1 << (Level - 1)); AcpiOsPrintf ("+"); } @@ -342,14 +340,14 @@ AcpiNsDumpOneObject ( if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) { - ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); + ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name.Integer)); } /* * Now we can print out the pertinent information */ AcpiOsPrintf (" %4.4s %-12s %p", - (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode); + ThisNode->Name.Ascii, AcpiUtGetTypeName (Type), ThisNode); DbgLevel = AcpiDbgLevel; AcpiDbgLevel = 0; @@ -372,7 +370,7 @@ AcpiNsDumpOneObject ( { case ACPI_TYPE_PROCESSOR: - AcpiOsPrintf (" ID %d Addr %.4X Len %.4X\n", + AcpiOsPrintf (" ID %hd Addr %.4X Len %.4X\n", ObjDesc->Processor.ProcId, ObjDesc->Processor.Address, ObjDesc->Processor.Length); @@ -387,7 +385,7 @@ AcpiNsDumpOneObject ( case ACPI_TYPE_METHOD: - AcpiOsPrintf (" Args %d Len %.4X Aml %p \n", + AcpiOsPrintf (" Args %hd Len %.4X Aml %p \n", ObjDesc->Method.ParamCount, ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); @@ -430,7 +428,7 @@ AcpiNsDumpOneObject ( AcpiOsPrintf (" ="); for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) { - AcpiOsPrintf (" %.2X", ObjDesc->Buffer.Pointer[i]); + AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); } } AcpiOsPrintf ("\n"); @@ -488,7 +486,7 @@ AcpiNsDumpOneObject ( ObjDesc->BufferField.BufferObj->Buffer.Node) { AcpiOsPrintf (" Buf [%4.4s]", - (char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name); + ObjDesc->BufferField.BufferObj->Buffer.Node->Name.Ascii); } break; @@ -496,23 +494,23 @@ AcpiNsDumpOneObject ( case INTERNAL_TYPE_REGION_FIELD: AcpiOsPrintf (" Rgn [%4.4s]", - (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name); + ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii); break; case INTERNAL_TYPE_BANK_FIELD: AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]", - (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name, - (char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name); + ObjDesc->CommonField.RegionObj->Region.Node->Name.Ascii, + ObjDesc->BankField.BankObj->CommonField.Node->Name.Ascii); break; case INTERNAL_TYPE_INDEX_FIELD: AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]", - (char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name, - (char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name); + ObjDesc->IndexField.IndexObj->CommonField.Node->Name.Ascii, + ObjDesc->IndexField.DataObj->CommonField.Node->Name.Ascii); break; @@ -530,14 +528,16 @@ AcpiNsDumpOneObject ( case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: case INTERNAL_TYPE_INDEX_FIELD: - AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2d\n", + AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2hd\n", (ObjDesc->CommonField.BaseByteOffset * 8) + ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BitLength, ObjDesc->CommonField.AccessByteWidth); break; + + default: + break; } - break; @@ -631,9 +631,9 @@ AcpiNsDumpOneObject ( break; - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: - ObjType = ObjDesc->Common.Type; + ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); if (ObjType > INTERNAL_TYPE_MAX) { @@ -642,8 +642,8 @@ AcpiNsDumpOneObject ( } else { - AcpiOsPrintf ("(Ptr to ACPI Object type %2.2X [%s])\n", - ObjType, AcpiUtGetTypeName (ObjType)); + AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n", + AcpiUtGetTypeName (ObjType), ObjType); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } break; @@ -660,7 +660,7 @@ AcpiNsDumpOneObject ( /* If value is NOT an internal object, we are done */ - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { goto Cleanup; } @@ -671,11 +671,11 @@ AcpiNsDumpOneObject ( switch (ObjType) { case ACPI_TYPE_STRING: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->String.Pointer; + ObjDesc = (void *) ObjDesc->String.Pointer; break; case ACPI_TYPE_BUFFER: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Buffer.Pointer; + ObjDesc = (void *) ObjDesc->Buffer.Pointer; break; case ACPI_TYPE_BUFFER_FIELD: @@ -683,26 +683,26 @@ AcpiNsDumpOneObject ( break; case ACPI_TYPE_PACKAGE: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Package.Elements; + ObjDesc = (void *) ObjDesc->Package.Elements; break; case ACPI_TYPE_METHOD: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Method.AmlStart; + ObjDesc = (void *) ObjDesc->Method.AmlStart; break; case INTERNAL_TYPE_REGION_FIELD: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Field.RegionObj; + ObjDesc = (void *) ObjDesc->Field.RegionObj; break; case INTERNAL_TYPE_BANK_FIELD: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BankField.RegionObj; + ObjDesc = (void *) ObjDesc->BankField.RegionObj; break; case INTERNAL_TYPE_INDEX_FIELD: - ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj; + ObjDesc = (void *) ObjDesc->IndexField.IndexObj; break; - default: + default: goto Cleanup; } @@ -750,8 +750,9 @@ AcpiNsDumpObjects ( Info.DisplayType = DisplayType; - AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, - (void *) &Info, NULL); + (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, + ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, + (void *) &Info, NULL); } @@ -794,7 +795,7 @@ AcpiNsDumpOneDevice ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " ")); } - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %x\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", Info.HardwareId, ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address), Info.CurrentStatus)); @@ -818,6 +819,7 @@ void AcpiNsDumpRootDevices (void) { ACPI_HANDLE SysBusHandle; + ACPI_STATUS Status; ACPI_FUNCTION_NAME ("NsDumpRootDevices"); @@ -830,11 +832,17 @@ AcpiNsDumpRootDevices (void) return; } - AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle); + Status = AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle); + if (ACPI_FAILURE (Status)) + { + return; + } ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n")); - AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, - AcpiNsDumpOneDevice, NULL, NULL); + + Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, + ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, + AcpiNsDumpOneDevice, NULL, NULL); } #endif @@ -914,7 +922,7 @@ AcpiNsDumpEntry ( Info.OwnerId = ACPI_UINT32_MAX; Info.DisplayType = ACPI_DISPLAY_SUMMARY; - AcpiNsDumpOneObject (Handle, 1, &Info, NULL); + (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); } #endif diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c index a584e77..51b50da 100644 --- a/sys/contrib/dev/acpica/nseval.c +++ b/sys/contrib/dev/acpica/nseval.c @@ -2,7 +2,7 @@ * * Module Name: nseval - Object evaluation interfaces -- includes control * method lookup and execution. - * $Revision: 112 $ + * $Revision: 116 $ * ******************************************************************************/ @@ -119,7 +119,6 @@ #define __NSEVAL_C__ #include "acpi.h" -#include "amlcode.h" #include "acparser.h" #include "acinterp.h" #include "acnamesp.h" @@ -134,12 +133,12 @@ * FUNCTION: AcpiNsEvaluateRelative * * PARAMETERS: Handle - The relative containing object - * *Pathname - Name of method to execute, If NULL, the + * Pathname - Name of method to execute, If NULL, the * handle is the object to execute - * **Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * *ReturnObject - Where to put method's return value (if + * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. * * RETURN: Status @@ -240,9 +239,9 @@ Cleanup: * FUNCTION: AcpiNsEvaluateByName * * PARAMETERS: Pathname - Fully qualified pathname to the object - * *ReturnObject - Where to put method's return value (if + * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. - * **Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. * @@ -329,10 +328,10 @@ Cleanup: * FUNCTION: AcpiNsEvaluateByHandle * * PARAMETERS: Handle - Method Node to execute - * **Params - List of parameters to pass to the method, + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * *ReturnObject - Where to put method's return value (if + * ReturnObject - Where to put method's return value (if * any). If NULL, no value is returned. * * RETURN: Status @@ -393,7 +392,6 @@ AcpiNsEvaluateByHandle ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* * Two major cases here: * 1) The object is an actual control method -- execute it. @@ -411,7 +409,6 @@ AcpiNsEvaluateByHandle ( Status = AcpiNsExecuteControlMethod (Node, Params, &LocalReturnObject); } - else { /* @@ -421,7 +418,6 @@ AcpiNsEvaluateByHandle ( Status = AcpiNsGetObjectValue (Node, &LocalReturnObject); } - /* * Check if there is a return value on the stack that must * be dealt with @@ -443,13 +439,9 @@ AcpiNsEvaluateByHandle ( *ReturnObject = LocalReturnObject; } + /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */ - /* Map AE_RETURN_VALUE to AE_OK, we are done with it */ - - if (Status == AE_CTRL_RETURN_VALUE) - { - Status = AE_OK; - } + Status = AE_OK; } /* @@ -464,11 +456,11 @@ AcpiNsEvaluateByHandle ( * * FUNCTION: AcpiNsExecuteControlMethod * - * PARAMETERS: MethodNode - The object/method - * **Params - List of parameters to pass to the method, + * PARAMETERS: MethodNode - The method to execute + * Params - List of parameters to pass to the method, * terminated by NULL. Params itself may be * NULL if no parameters are being passed. - * **ReturnObjDesc - List of result objects to be returned + * ReturnObjDesc - List of result objects to be returned * from the method. * * RETURN: Status @@ -506,7 +498,7 @@ AcpiNsExecuteControlMethod ( ACPI_DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing", ACPI_LV_INFO, _COMPONENT); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %x\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n", ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1)); /* @@ -543,7 +535,8 @@ AcpiNsExecuteControlMethod ( * * FUNCTION: AcpiNsGetObjectValue * - * PARAMETERS: Node - The object + * PARAMETERS: Node - The object + * ReturnObjDesc - Where the objects value is returned * * RETURN: Status * @@ -559,7 +552,7 @@ AcpiNsGetObjectValue ( ACPI_OPERAND_OBJECT **ReturnObjDesc) { ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_NAMESPACE_NODE *ResolvedNode = Node; ACPI_FUNCTION_TRACE ("NsGetObjectValue"); @@ -570,7 +563,6 @@ AcpiNsGetObjectValue ( * Node may be a field that must be read, etc.) -- we can't just grab * the object out of the node. */ - ObjDesc = (ACPI_OPERAND_OBJECT *) Node; /* * Use ResolveNodeToValue() to get the associated value. This call @@ -599,18 +591,18 @@ AcpiNsGetObjectValue ( Status = AcpiExEnterInterpreter (); if (ACPI_SUCCESS (Status)) { - Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) &ObjDesc, NULL); + Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); /* * If AcpiExResolveNodeToValue() succeeded, the return value was - * placed in ObjDesc. + * placed in ResolvedNode. */ AcpiExExitInterpreter (); if (ACPI_SUCCESS (Status)) { Status = AE_CTRL_RETURN_VALUE; - *ReturnObjDesc = ObjDesc; - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", *ReturnObjDesc)); + *ReturnObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ResolvedNode); + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning obj %p\n", ResolvedNode)); } } diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c index b9a8d33..9a46ea6 100644 --- a/sys/contrib/dev/acpica/nsinit.c +++ b/sys/contrib/dev/acpica/nsinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsinit - namespace initialization - * $Revision: 43 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -165,19 +165,20 @@ AcpiNsInitializeObjects ( &Info, NULL); if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n", + AcpiFormatException (Status))); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "\n Initialized %d/%d Regions %d/%d Fields %d/%d Buffers %d/%d Packages (%d nodes)\n", + "\nInitialized %hd/%hd Regions %hd/%hd Fields %hd/%hd Buffers %hd/%hd Packages (%hd nodes)\n", Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit, Info.FieldCount, Info.BufferInit, Info.BufferCount, Info.PackageInit, Info.PackageCount, Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%d Control Methods found\n", Info.MethodCount)); + "%hd Control Methods found\n", Info.MethodCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%d Op Regions found\n", Info.OpRegionCount)); + "%hd Op Regions found\n", Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } @@ -225,11 +226,12 @@ AcpiNsInitializeDevices ( if (ACPI_FAILURE (Status)) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n", + AcpiFormatException (Status))); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, - "\n%d Devices found containing: %d _STA, %d _INI methods\n", + "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n", Info.DeviceCount, Info.Num_STA, Info.Num_INI)); return_ACPI_STATUS (Status); @@ -359,6 +361,10 @@ AcpiNsInitOneObject ( Info->PackageInit++; Status = AcpiDsGetPackageArguments (ObjDesc); break; + + default: + /* No other types can get here */ + break; } if (ACPI_FAILURE (Status)) @@ -366,7 +372,7 @@ AcpiNsInitOneObject ( ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n")); ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not execute arguments for [%4.4s] (%s), %s\n", - (char *) &Node->Name, AcpiUtGetTypeName (Type), AcpiFormatException (Status))); + Node->Name.Ascii, AcpiUtGetTypeName (Type), AcpiFormatException (Status))); } if (!(AcpiDbgLevel & ACPI_LV_INIT)) @@ -465,27 +471,26 @@ AcpiNsInitOneDevice ( */ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ObjHandle, "_INI [Method]")); Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL); - if (AE_NOT_FOUND == Status) + if (ACPI_FAILURE (Status)) { - /* No _INI means device requires no initialization */ + /* No _INI (AE_NOT_FOUND) means device requires no initialization */ - Status = AE_OK; - } + if (Status != AE_NOT_FOUND) + { + /* Ignore error and move on to next device */ - else if (ACPI_FAILURE (Status)) - { - /* Ignore error and move on to next device */ + #ifdef ACPI_DEBUG + NATIVE_CHAR *ScopeName = AcpiNsGetExternalPathname (ObjHandle); -#ifdef ACPI_DEBUG - NATIVE_CHAR *ScopeName = AcpiNsGetExternalPathname (ObjHandle); + ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", + ScopeName, AcpiFormatException (Status))); - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n", - ScopeName, AcpiFormatException (Status))); + ACPI_MEM_FREE (ScopeName); + #endif + } - ACPI_MEM_FREE (ScopeName); -#endif + Status = AE_OK; } - else { /* Count of successful INIs */ @@ -493,5 +498,13 @@ AcpiNsInitOneDevice ( Info->Num_INI++; } - return_ACPI_STATUS (AE_OK); + if (AcpiGbl_InitHandler) + { + /* External initialization handler is present, call it */ + + Status = AcpiGbl_InitHandler (ObjHandle, ACPI_INIT_DEVICE_INI); + } + + + return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c index 00aceb0..352c21d 100644 --- a/sys/contrib/dev/acpica/nsload.c +++ b/sys/contrib/dev/acpica/nsload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nsload - namespace loading/expanding/contracting procedures - * $Revision: 53 $ + * $Revision: 55 $ * *****************************************************************************/ @@ -117,12 +117,10 @@ #define __NSLOAD_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" #include "amlcode.h" #include "acparser.h" #include "acdispat.h" -#include "acdebug.h" #define _COMPONENT ACPI_NAMESPACE @@ -172,8 +170,8 @@ AcpiNsLoadNamespace ( /* Ignore exceptions from these */ - AcpiNsLoadTableByType (ACPI_TABLE_SSDT); - AcpiNsLoadTableByType (ACPI_TABLE_PSDT); + (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT); + (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT); ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "ACPI Namespace successfully loaded at root %p\n", @@ -217,7 +215,7 @@ AcpiNsOneCompleteParse ( return_ACPI_STATUS (AE_NO_MEMORY); } - ((ACPI_PARSE2_OBJECT *) ParseRoot)->Name = ACPI_ROOT_NAME; + ParseRoot->Named.Name = ACPI_ROOT_NAME; /* Create and initialize a new walk state */ @@ -615,7 +613,11 @@ AcpiNsDeleteSubtree ( AcpiNsDeleteChildren (ChildHandle); ChildHandle = ParentHandle; - AcpiGetParent (ParentHandle, &ParentHandle); + Status = AcpiGetParent (ParentHandle, &ParentHandle); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } } diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c index 19059c7..8e53912 100644 --- a/sys/contrib/dev/acpica/nsnames.c +++ b/sys/contrib/dev/acpica/nsnames.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nsnames - Name manipulation and search - * $Revision: 74 $ + * $Revision: 77 $ * ******************************************************************************/ @@ -118,7 +118,6 @@ #include "acpi.h" #include "amlcode.h" -#include "acinterp.h" #include "acnamesp.h" @@ -147,7 +146,7 @@ AcpiNsBuildExternalPath ( ACPI_SIZE Size, NATIVE_CHAR *NameBuffer) { - UINT32 Index; + ACPI_SIZE Index; ACPI_NAMESPACE_NODE *ParentNode; @@ -192,7 +191,7 @@ AcpiNsBuildExternalPath ( { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not construct pathname; index=%X, size=%X, Path=%s\n", - Index, Size, &NameBuffer[Size])); + (UINT32) Index, (UINT32) Size, &NameBuffer[Size])); } return; @@ -335,7 +334,7 @@ AcpiNsHandleToPathname ( AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, RequiredSize)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n", (char *) Buffer->Pointer, (UINT32) RequiredSize)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c index 94ece02..acc5aba 100644 --- a/sys/contrib/dev/acpica/nsobject.c +++ b/sys/contrib/dev/acpica/nsobject.c @@ -2,7 +2,7 @@ * * Module Name: nsobject - Utilities for objects attached to namespace * table entries - * $Revision: 80 $ + * $Revision: 83 $ * ******************************************************************************/ @@ -119,10 +119,7 @@ #define __NSOBJECT_C__ #include "acpi.h" -#include "amlcode.h" #include "acnamesp.h" -#include "acinterp.h" -#include "actables.h" #define _COMPONENT ACPI_NAMESPACE @@ -243,13 +240,7 @@ AcpiNsAttachObject ( } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Installing %p into Node %p [%4.4s]\n", - ObjDesc, Node, (char *) &Node->Name)); - - /* - * Must increment the new value's reference count - * (if it is an internal object) - */ - AcpiUtAddReference (ObjDesc); + ObjDesc, Node, Node->Name.Ascii)); /* Detach an existing attached object if present */ @@ -258,20 +249,28 @@ AcpiNsAttachObject ( AcpiNsDetachObject (Node); } - - /* - * Handle objects with multiple descriptors - walk - * to the end of the descriptor list - */ - LastObjDesc = ObjDesc; - while (LastObjDesc->Common.NextObject) + if (ObjDesc) { - LastObjDesc = LastObjDesc->Common.NextObject; - } + /* + * Must increment the new value's reference count + * (if it is an internal object) + */ + AcpiUtAddReference (ObjDesc); + + /* + * Handle objects with multiple descriptors - walk + * to the end of the descriptor list + */ + LastObjDesc = ObjDesc; + while (LastObjDesc->Common.NextObject) + { + LastObjDesc = LastObjDesc->Common.NextObject; + } - /* Install the object at the front of the object list */ + /* Install the object at the front of the object list */ - LastObjDesc->Common.NextObject = Node->Object; + LastObjDesc->Common.NextObject = Node->Object; + } Node->Type = (UINT8) ObjectType; Node->Object = ObjDesc; @@ -305,8 +304,9 @@ AcpiNsDetachObject ( ObjDesc = Node->Object; - if (!ObjDesc || - (ObjDesc->Common.Type == INTERNAL_TYPE_DATA)) + + if (!ObjDesc || + (ACPI_GET_OBJECT_TYPE (ObjDesc) == INTERNAL_TYPE_DATA)) { return_VOID; } @@ -314,11 +314,11 @@ AcpiNsDetachObject ( /* Clear the entry in all cases */ Node->Object = NULL; - if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) { Node->Object = ObjDesc->Common.NextObject; if (Node->Object && - (Node->Object->Common.Type != INTERNAL_TYPE_DATA)) + (ACPI_GET_OBJECT_TYPE (Node->Object) != INTERNAL_TYPE_DATA)) { Node->Object = Node->Object->Common.NextObject; } @@ -329,7 +329,7 @@ AcpiNsDetachObject ( Node->Type = ACPI_TYPE_ANY; ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Node %p [%4.4s] Object %p\n", - Node, (char *) &Node->Name, ObjDesc)); + Node, Node->Name.Ascii, ObjDesc)); /* Remove one reference on the object (and all subobjects) */ @@ -363,9 +363,9 @@ AcpiNsGetAttachedObject ( } if (!Node->Object || - ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_INTERNAL) && - (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) || - (Node->Object->Common.Type == INTERNAL_TYPE_DATA)) + ((ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_DESCRIPTOR_TYPE (Node->Object) != ACPI_DESC_TYPE_NAMED)) || + (ACPI_GET_OBJECT_TYPE (Node->Object) == INTERNAL_TYPE_DATA)) { return_PTR (NULL); } @@ -392,10 +392,10 @@ AcpiNsGetSecondaryObject ( ACPI_FUNCTION_TRACE_PTR ("NsGetSecondaryObject", ObjDesc); - if ((!ObjDesc) || - (ObjDesc->Common.Type == INTERNAL_TYPE_DATA) || - (!ObjDesc->Common.NextObject) || - (ObjDesc->Common.NextObject->Common.Type == INTERNAL_TYPE_DATA)) + if ((!ObjDesc) || + (ACPI_GET_OBJECT_TYPE (ObjDesc) == INTERNAL_TYPE_DATA) || + (!ObjDesc->Common.NextObject) || + (ACPI_GET_OBJECT_TYPE (ObjDesc->Common.NextObject) == INTERNAL_TYPE_DATA)) { return_PTR (NULL); } @@ -432,7 +432,7 @@ AcpiNsAttachData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == INTERNAL_TYPE_DATA) && (ObjDesc->Data.Handler == Handler)) { return (AE_ALREADY_EXISTS); @@ -495,7 +495,7 @@ AcpiNsDetachData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == INTERNAL_TYPE_DATA) && (ObjDesc->Data.Handler == Handler)) { if (PrevObjDesc) @@ -543,7 +543,7 @@ AcpiNsGetAttachedData ( ObjDesc = Node->Object; while (ObjDesc) { - if ((ObjDesc->Common.Type == INTERNAL_TYPE_DATA) && + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == INTERNAL_TYPE_DATA) && (ObjDesc->Data.Handler == Handler)) { *Data = ObjDesc->Data.Pointer; diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c index 52f59b5..7b8ad59 100644 --- a/sys/contrib/dev/acpica/nssearch.c +++ b/sys/contrib/dev/acpica/nssearch.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: nssearch - Namespace search - * $Revision: 84 $ + * $Revision: 86 $ * ******************************************************************************/ @@ -117,8 +117,6 @@ #define __NSSEARCH_C__ #include "acpi.h" -#include "amlcode.h" -#include "acinterp.h" #include "acnamesp.h" @@ -308,7 +306,8 @@ AcpiNsSearchParentTree ( if (AcpiNsLocal (Type)) { - ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] type [%s] must be local to this scope (no parent search)\n", + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, + "[%4.4s] type [%s] must be local to this scope (no parent search)\n", (char *) &TargetName, AcpiUtGetTypeName (Type))); } diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c index 5385470..017d917 100644 --- a/sys/contrib/dev/acpica/nsutils.c +++ b/sys/contrib/dev/acpica/nsutils.c @@ -2,7 +2,7 @@ * * Module Name: nsutils - Utilities for accessing ACPI namespace, accessing * parents and siblings and Scope manipulation - * $Revision: 105 $ + * $Revision: 110 $ * *****************************************************************************/ @@ -119,7 +119,6 @@ #include "acpi.h" #include "acnamesp.h" -#include "acinterp.h" #include "amlcode.h" #include "actables.h" @@ -240,7 +239,7 @@ AcpiNsLocal ( * ******************************************************************************/ -ACPI_STATUS +void AcpiNsGetInternalNameLength ( ACPI_NAMESTRING_INFO *Info) { @@ -304,8 +303,6 @@ AcpiNsGetInternalNameLength ( 4 + Info->NumCarats; Info->NextExternalChar = NextExternalChar; - - return (AE_OK); } @@ -330,7 +327,7 @@ AcpiNsBuildInternalName ( NATIVE_CHAR *InternalName = Info->InternalName; NATIVE_CHAR *ExternalName = Info->NextExternalChar; NATIVE_CHAR *Result = NULL; - UINT32 i; + NATIVE_UINT i; ACPI_FUNCTION_TRACE ("NsBuildInternalName"); @@ -407,7 +404,7 @@ AcpiNsBuildInternalName ( { /* Convert the character to uppercase and save it */ - Result[i] = (char) ACPI_TOUPPER (*ExternalName); + Result[i] = (char) ACPI_TOUPPER ((int) *ExternalName); ExternalName++; } } @@ -530,12 +527,12 @@ AcpiNsExternalizeName ( UINT32 *ConvertedNameLength, char **ConvertedName) { - UINT32 PrefixLength = 0; - UINT32 NamesIndex = 0; - UINT32 NumSegments = 0; - UINT32 i = 0; - UINT32 j = 0; - UINT32 RequiredLength; + NATIVE_UINT_MIN32 PrefixLength = 0; + NATIVE_UINT_MIN32 NamesIndex = 0; + NATIVE_UINT_MIN32 NumSegments = 0; + NATIVE_UINT_MIN32 i = 0; + NATIVE_UINT_MIN32 j = 0; + NATIVE_UINT_MIN32 RequiredLength; ACPI_FUNCTION_TRACE ("NsExternalizeName"); @@ -572,6 +569,9 @@ AcpiNsExternalizeName ( } break; + + default: + break; } /* @@ -668,7 +668,7 @@ AcpiNsExternalizeName ( if (ConvertedNameLength) { - *ConvertedNameLength = RequiredLength; + *ConvertedNameLength = (UINT32) RequiredLength; } return_ACPI_STATUS (AE_OK); @@ -963,17 +963,17 @@ AcpiNsFindParentName ( if (ParentNode) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Parent of %p [%4.4s] is %p [%4.4s]\n", - ChildNode, (char *) &ChildNode->Name, - ParentNode, (char *) &ParentNode->Name)); + ChildNode, ChildNode->Name.Ascii, + ParentNode, ParentNode->Name.Ascii)); if (ParentNode->Name.Integer) { - return_VALUE (ParentNode->Name.Integer); + return_VALUE ((ACPI_NAME) ParentNode->Name.Integer); } } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "unable to find parent of %p (%4.4s)\n", - ChildNode, (char *) &ChildNode->Name)); + ChildNode, ChildNode->Name.Ascii)); } return_VALUE (ACPI_UNKNOWN_NAME); diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/nswalk.c index 06741d0..5e9014a 100644 --- a/sys/contrib/dev/acpica/nswalk.c +++ b/sys/contrib/dev/acpica/nswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: nswalk - Functions for walking the ACPI namespace - * $Revision: 32 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -118,7 +118,6 @@ #define __NSWALK_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c index 0071e11..b318233 100644 --- a/sys/contrib/dev/acpica/nsxfname.c +++ b/sys/contrib/dev/acpica/nsxfname.c @@ -2,7 +2,7 @@ * * Module Name: nsxfname - Public interfaces to the ACPI subsystem * ACPI Namespace oriented interfaces - * $Revision: 90 $ + * $Revision: 91 $ * *****************************************************************************/ @@ -118,12 +118,7 @@ #define __NSXFNAME_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" -#include "amlcode.h" -#include "acparser.h" -#include "acdispat.h" -#include "acevents.h" #define _COMPONENT ACPI_NAMESPACE @@ -290,7 +285,7 @@ AcpiGetName ( /* Just copy the ACPI name from the Node and zero terminate it */ - ACPI_STRNCPY (Buffer->Pointer, (NATIVE_CHAR *) &Node->Name, + ACPI_STRNCPY (Buffer->Pointer, Node->Name.Ascii, ACPI_NAME_SIZE); ((NATIVE_CHAR *) Buffer->Pointer) [ACPI_NAME_SIZE] = 0; Status = AE_OK; diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c index ea1941e..bd3e26d 100644 --- a/sys/contrib/dev/acpica/nsxfobj.c +++ b/sys/contrib/dev/acpica/nsxfobj.c @@ -2,7 +2,7 @@ * * Module Name: nsxfobj - Public interfaces to the ACPI subsystem * ACPI Object oriented interfaces - * $Revision: 108 $ + * $Revision: 112 $ * ******************************************************************************/ @@ -119,9 +119,7 @@ #define __NSXFOBJ_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" -#include "acdispat.h" #define _COMPONENT ACPI_NAMESPACE @@ -130,6 +128,106 @@ /******************************************************************************* * + * FUNCTION: AcpiEvaluateObjectTyped + * + * PARAMETERS: Handle - Object handle (optional) + * *Pathname - Object pathname (optional) + * **ExternalParams - List of parameters to pass to method, + * terminated by NULL. May be NULL + * if no parameters are being passed. + * *ReturnBuffer - Where to put method's return value (if + * any). If NULL, no value is returned. + * ReturnType - Expected type of return object + * + * RETURN: Status + * + * DESCRIPTION: Find and evaluate the given object, passing the given + * parameters if necessary. One of "Handle" or "Pathname" must + * be valid (non-null) + * + ******************************************************************************/ + +ACPI_STATUS +AcpiEvaluateObjectTyped ( + ACPI_HANDLE Handle, + ACPI_STRING Pathname, + ACPI_OBJECT_LIST *ExternalParams, + ACPI_BUFFER *ReturnBuffer, + ACPI_OBJECT_TYPE ReturnType) +{ + ACPI_STATUS Status; + BOOLEAN MustFree = FALSE; + + + ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped"); + + + /* Return buffer must be valid */ + + if (!ReturnBuffer) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER) + { + MustFree = TRUE; + } + + /* Evaluate the object */ + + Status = AcpiEvaluateObject (Handle, Pathname, ExternalParams, ReturnBuffer); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Type ANY means "don't care" */ + + if (ReturnType == ACPI_TYPE_ANY) + { + return_ACPI_STATUS (AE_OK); + } + + if (ReturnBuffer->Length == 0) + { + /* Error because caller specifically asked for a return value */ + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "No return value\n")); + + return_ACPI_STATUS (AE_NULL_OBJECT); + } + + /* Examine the object type returned from EvaluateObject */ + + if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType) + { + return_ACPI_STATUS (AE_OK); + } + + /* Return object type does not match requested type */ + + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Incorrect return type [%s] requested [%s]\n", + AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), + AcpiUtGetTypeName (ReturnType))); + + if (MustFree) + { + /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ + + AcpiOsFree (ReturnBuffer->Pointer); + ReturnBuffer->Pointer = NULL; + } + + ReturnBuffer->Length = 0; + return_ACPI_STATUS (AE_TYPE); +} + + +/******************************************************************************* + * * FUNCTION: AcpiEvaluateObject * * PARAMETERS: Handle - Object handle (optional) @@ -176,7 +274,7 @@ AcpiEvaluateObject ( * Allocate a new parameter block for the internal objects * Add 1 to count to allow for null terminated internal list */ - InternalParams = ACPI_MEM_CALLOCATE ((ExternalParams->Count + 1) * + InternalParams = ACPI_MEM_CALLOCATE (((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *)); if (!InternalParams) { @@ -309,7 +407,7 @@ AcpiEvaluateObject ( */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Needed buffer size %X, %s\n", - BufferSpaceNeeded, AcpiFormatException (Status))); + (UINT32) BufferSpaceNeeded, AcpiFormatException (Status))); } else { @@ -747,8 +845,8 @@ AcpiNsGetDeviceCallback ( } } - Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); - return (AE_OK); + Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); + return (Status); } diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c index 72b77b4..ed0fc76 100644 --- a/sys/contrib/dev/acpica/psargs.c +++ b/sys/contrib/dev/acpica/psargs.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psargs - Parse AML opcode arguments - * $Revision: 58 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -186,6 +186,10 @@ AcpiPsGetNextPackageLength ( (EncodedLength & 0x0F)); ParserState->Aml += 3; break; + + default: + /* Can't get here, only 2 bits / 4 cases */ + break; } return_VALUE (Length); @@ -241,9 +245,8 @@ NATIVE_CHAR * AcpiPsGetNextNamestring ( ACPI_PARSE_STATE *ParserState) { - UINT8 *Start = ParserState->Aml; - UINT8 *End = ParserState->Aml; - UINT32 Length; + UINT8 *Start = ParserState->Aml; + UINT8 *End = ParserState->Aml; ACPI_FUNCTION_TRACE ("PsGetNextNamestring"); @@ -273,35 +276,29 @@ AcpiPsGetNextNamestring ( End++; break; - case AML_DUAL_NAME_PREFIX: - /* two name segments */ + /* Two name segments */ End += 9; break; - case AML_MULTI_NAME_PREFIX_OP: - /* multiple name segments */ + /* Multiple name segments, 4 chars each */ - Length = (UINT32) ACPI_GET8 (End + 1) * 4; - End += 2 + Length; + End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * 4); break; - default: - /* single name segment */ - /* assert (AcpiPsIsLead (GET8 (End))); */ + /* Single name segment */ End += 4; break; } ParserState->Aml = (UINT8*) End; - return_PTR ((NATIVE_CHAR *) Start); } @@ -352,7 +349,7 @@ AcpiPsGetNextNamepath ( /* Null name case, create a null namepath object */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - Arg->Value.Name = Path; + Arg->Common.Value.Name = Path; return_VOID; } @@ -371,7 +368,7 @@ AcpiPsGetNextNamepath ( if (Op) { - if (Op->Opcode == AML_METHOD_OP) + if (Op->Common.AmlOpcode == AML_METHOD_OP) { /* * The name refers to a control method, so this namepath is a @@ -380,7 +377,7 @@ AcpiPsGetNextNamepath ( * object into a METHODCALL object. */ Count = AcpiPsGetArg (Op, 0); - if (Count && Count->Opcode == AML_BYTE_OP) + if (Count && Count->Common.AmlOpcode == AML_BYTE_OP) { NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (NameOp) @@ -389,14 +386,14 @@ AcpiPsGetNextNamepath ( AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); - NameOp->Value.Name = Path; + NameOp->Common.Value.Name = Path; /* Point METHODCALL/NAME to the METHOD Node */ - NameOp->Node = (ACPI_NAMESPACE_NODE *) Op; + NameOp->Common.Node = (ACPI_NAMESPACE_NODE *) Op; AcpiPsAppendArg (Arg, NameOp); - *ArgCount = (UINT32) Count->Value.Integer & + *ArgCount = (UINT32) Count->Common.Value.Integer & METHOD_FLAGS_ARG_COUNT; } } @@ -418,7 +415,7 @@ AcpiPsGetNextNamepath ( * pathname */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - Arg->Value.Name = Path; + Arg->Common.Value.Name = Path; return_VOID; @@ -452,71 +449,67 @@ AcpiPsGetNextNamepath ( /* Null name case, create a null namepath object */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - Arg->Value.Name = Path; + Arg->Common.Value.Name = Path; return_VOID; } + /* + * Lookup the name in the internal namespace + */ + ScopeInfo.Scope.Node = NULL; + Node = ParserState->StartNode; + if (Node) + { + ScopeInfo.Scope.Node = Node; + } - if (MethodCall) + /* + * Lookup object. We don't want to add anything new to the namespace + * here, however. So we use MODE_EXECUTE. Allow searching of the + * parent tree, but don't open a new scope -- we just want to lookup the + * object (MUST BE mode EXECUTE to perform upsearch) + */ + Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, + &Node); + if (ACPI_SUCCESS (Status)) { - /* - * Lookup the name in the internal namespace - */ - ScopeInfo.Scope.Node = NULL; - Node = ParserState->StartNode; - if (Node) + if (Node->Type == ACPI_TYPE_METHOD) { - ScopeInfo.Scope.Node = Node; - } + MethodNode = Node; + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n", + MethodNode, Path)); - /* - * Lookup object. We don't want to add anything new to the namespace - * here, however. So we use MODE_EXECUTE. Allow searching of the - * parent tree, but don't open a new scope -- we just want to lookup the - * object (MUST BE mode EXECUTE to perform upsearch) - */ - Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, - &Node); - if (ACPI_SUCCESS (Status)) - { - if (Node->Type == ACPI_TYPE_METHOD) + NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); + if (NameOp) { - MethodNode = Node; - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "method - %p Path=%p\n", - MethodNode, Path)); - - NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); - if (NameOp) - { - /* Change arg into a METHOD CALL and attach name to it */ - - AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); + /* Change arg into a METHOD CALL and attach name to it */ - NameOp->Value.Name = Path; + AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); - /* Point METHODCALL/NAME to the METHOD Node */ + NameOp->Common.Value.Name = Path; - NameOp->Node = MethodNode; - AcpiPsAppendArg (Arg, NameOp); + /* Point METHODCALL/NAME to the METHOD Node */ - if (!AcpiNsGetAttachedObject (MethodNode)) - { - return_VOID; - } + NameOp->Common.Node = MethodNode; + AcpiPsAppendArg (Arg, NameOp); - *ArgCount = (AcpiNsGetAttachedObject (MethodNode))->Method.ParamCount; + if (!AcpiNsGetAttachedObject (MethodNode)) + { + return_VOID; } - return_VOID; + *ArgCount = (AcpiNsGetAttachedObject (MethodNode))->Method.ParamCount; } - /* - * Else this is normal named object reference. - * Just init the NAMEPATH object with the pathname. - * (See code below) - */ + return_VOID; } + + /* + * Else this is normal named object reference. + * Just init the NAMEPATH object with the pathname. + * (See code below) + */ } /* @@ -525,7 +518,7 @@ AcpiPsGetNextNamepath ( * pathname. */ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - Arg->Value.Name = Path; + Arg->Common.Value.Name = Path; return_VOID; @@ -559,11 +552,10 @@ AcpiPsGetNextSimpleArg ( switch (ArgType) { - case ARGP_BYTEDATA: AcpiPsInitOp (Arg, AML_BYTE_OP); - Arg->Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml); + Arg->Common.Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml); ParserState->Aml++; break; @@ -574,7 +566,7 @@ AcpiPsGetNextSimpleArg ( /* Get 2 bytes from the AML stream */ - ACPI_MOVE_UNALIGNED16_TO_32 (&Arg->Value.Integer, ParserState->Aml); + ACPI_MOVE_UNALIGNED16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml); ParserState->Aml += 2; break; @@ -585,7 +577,7 @@ AcpiPsGetNextSimpleArg ( /* Get 4 bytes from the AML stream */ - ACPI_MOVE_UNALIGNED32_TO_32 (&Arg->Value.Integer, ParserState->Aml); + ACPI_MOVE_UNALIGNED32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml); ParserState->Aml += 4; break; @@ -596,7 +588,7 @@ AcpiPsGetNextSimpleArg ( /* Get 8 bytes from the AML stream */ - ACPI_MOVE_UNALIGNED64_TO_64 (&Arg->Value.Integer, ParserState->Aml); + ACPI_MOVE_UNALIGNED64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml); ParserState->Aml += 8; break; @@ -604,7 +596,7 @@ AcpiPsGetNextSimpleArg ( case ARGP_CHARLIST: AcpiPsInitOp (Arg, AML_STRING_OP); - Arg->Value.String = (char *) ParserState->Aml; + Arg->Common.Value.String = (char *) ParserState->Aml; while (ACPI_GET8 (ParserState->Aml) != '\0') { @@ -618,7 +610,12 @@ AcpiPsGetNextSimpleArg ( case ARGP_NAMESTRING: AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); - Arg->Value.Name = AcpiPsGetNextNamestring (ParserState); + Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState); + break; + + + default: + ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType)); break; } @@ -642,8 +639,8 @@ ACPI_PARSE_OBJECT * AcpiPsGetNextField ( ACPI_PARSE_STATE *ParserState) { - UINT32 AmlOffset = ParserState->Aml - - ParserState->AmlStart; + UINT32 AmlOffset = ACPI_PTR_DIFF (ParserState->Aml, + ParserState->AmlStart); ACPI_PARSE_OBJECT *Field; UINT16 Opcode; UINT32 Name; @@ -656,20 +653,17 @@ AcpiPsGetNextField ( switch (ACPI_GET8 (ParserState->Aml)) { - default: Opcode = AML_INT_NAMEDFIELD_OP; break; - case 0x00: Opcode = AML_INT_RESERVEDFIELD_OP; ParserState->Aml++; break; - case 0x01: Opcode = AML_INT_ACCESSFIELD_OP; @@ -681,48 +675,54 @@ AcpiPsGetNextField ( /* Allocate a new field op */ Field = AcpiPsAllocOp (Opcode); - if (Field) + if (!Field) { - Field->AmlOffset = AmlOffset; + return_PTR (NULL); + } - /* Decode the field type */ + Field->Common.AmlOffset = AmlOffset; - switch (Opcode) - { - case AML_INT_NAMEDFIELD_OP: + /* Decode the field type */ - /* Get the 4-character name */ + switch (Opcode) + { + case AML_INT_NAMEDFIELD_OP: - ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml); - AcpiPsSetName (Field, Name); - ParserState->Aml += 4; + /* Get the 4-character name */ - /* Get the length which is encoded as a package length */ + ACPI_MOVE_UNALIGNED32_TO_32 (&Name, ParserState->Aml); + AcpiPsSetName (Field, Name); + ParserState->Aml += 4; - Field->Value.Size = AcpiPsGetNextPackageLength (ParserState); - break; + /* Get the length which is encoded as a package length */ + Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState); + break; - case AML_INT_RESERVEDFIELD_OP: - /* Get the length which is encoded as a package length */ + case AML_INT_RESERVEDFIELD_OP: - Field->Value.Size = AcpiPsGetNextPackageLength (ParserState); - break; + /* Get the length which is encoded as a package length */ + Field->Common.Value.Size = AcpiPsGetNextPackageLength (ParserState); + break; - case AML_INT_ACCESSFIELD_OP: - /* - * Get AccessType and AccessAttrib and merge into the field Op - * AccessType is first operand, AccessAttribute is second - */ - Field->Value.Integer32 = (ACPI_GET8 (ParserState->Aml) << 8); - ParserState->Aml++; - Field->Value.Integer32 |= ACPI_GET8 (ParserState->Aml); - ParserState->Aml++; - break; - } + case AML_INT_ACCESSFIELD_OP: + + /* + * Get AccessType and AccessAttrib and merge into the field Op + * AccessType is first operand, AccessAttribute is second + */ + Field->Common.Value.Integer32 = (ACPI_GET8 (ParserState->Aml) << 8); + ParserState->Aml++; + Field->Common.Value.Integer32 |= ACPI_GET8 (ParserState->Aml); + ParserState->Aml++; + break; + + default: + /* Opcode was set in previous switch */ + break; } return_PTR (Field); @@ -803,7 +803,7 @@ AcpiPsGetNextArg ( if (Prev) { - Prev->Next = Field; + Prev->Common.Next = Field; } else @@ -832,8 +832,8 @@ AcpiPsGetNextArg ( { /* fill in bytelist data */ - Arg->Value.Size = (ParserState->PkgEnd - ParserState->Aml); - ((ACPI_PARSE2_OBJECT *) Arg)->Data = ParserState->Aml; + Arg->Common.Value.Size = ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml); + Arg->Named.Data = ParserState->Aml; } /* skip to End of byte data */ @@ -891,6 +891,10 @@ AcpiPsGetNextArg ( *ArgCount = ACPI_VAR_ARGS; } break; + + default: + ACPI_REPORT_ERROR (("Invalid ArgType: %X\n", ArgType)); + break; } return_PTR (Arg); diff --git a/sys/contrib/dev/acpica/psfind.c b/sys/contrib/dev/acpica/psfind.c index eb91d53..17345ff 100644 --- a/sys/contrib/dev/acpica/psfind.c +++ b/sys/contrib/dev/acpica/psfind.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Module Name: psfind - Parse tree search routine - * $Revision: 37 $ + * $Revision: 40 $ * *****************************************************************************/ @@ -149,7 +149,7 @@ AcpiPsGetParent ( while (Parent) { - switch (Parent->Opcode) + switch (Parent->Common.AmlOpcode) { case AML_SCOPE_OP: case AML_PACKAGE_OP: @@ -158,10 +158,13 @@ AcpiPsGetParent ( case AML_POWER_RES_OP: case AML_THERMAL_ZONE_OP: - return (Parent->Parent); + return (Parent->Common.Parent); + + default: + break; } - Parent = Parent->Parent; + Parent = Parent->Common.Parent; } return (Parent); @@ -200,13 +203,13 @@ AcpiPsFindName ( while (Op) { - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); /* Check AML_CREATE first (since some opcodes have AML_FIELD set also )*/ if (OpInfo->Flags & AML_CREATE) { - if (Op->Opcode == AML_CREATE_FIELD_OP) + if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) { Field = AcpiPsGetArg (Op, 3); } @@ -218,8 +221,8 @@ AcpiPsFindName ( } if ((Field) && - (Field->Value.String) && - (!ACPI_STRNCMP (Field->Value.String, (char *) &Name, ACPI_NAME_SIZE))) + (Field->Common.Value.String) && + (!ACPI_STRNCMP (Field->Common.Value.String, (char *) &Name, ACPI_NAME_SIZE))) { return (Op); } @@ -231,26 +234,26 @@ AcpiPsFindName ( Field = AcpiPsGetChild (Op); while (Field) { - OpInfo = AcpiPsGetOpcodeInfo (Field->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Field->Common.AmlOpcode); if ((OpInfo->Flags & AML_NAMED) && AcpiPsGetName (Field) == Name && - (!Opcode || Field->Opcode == Opcode)) + (!Opcode || Field->Common.AmlOpcode == Opcode)) { return (Field); } - Field = Field->Next; + Field = Field->Common.Next; } } else if ((OpInfo->Flags & AML_NAMED) && (AcpiPsGetName (Op) == Name) && - (!Opcode || Op->Opcode == Opcode || Opcode == AML_SCOPE_OP)) + (!Opcode || Op->Common.AmlOpcode == Opcode || Opcode == AML_SCOPE_OP)) { break; } - Op = Op->Next; + Op = Op->Common.Next; } return (Op); @@ -308,9 +311,9 @@ AcpiPsFind ( /* Could just use a global for "root scope" here */ - while (Scope->Parent) + while (Scope->Common.Parent) { - Scope = Scope->Parent; + Scope = Scope->Common.Parent; } break; @@ -324,6 +327,10 @@ AcpiPsFind ( Scope = AcpiPsGetParent (Scope); } break; + + default: + /* Should not get here */ + break; } Unprefixed = FALSE; @@ -369,7 +376,7 @@ AcpiPsFind ( } ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Search scope %p Segs=%d Opcode=%4.4X Create=%d\n", + "Search scope %p Segs=%d Opcode=%4.4hX Create=%d\n", Scope, SegCount, Opcode, Create)); /* match each name segment */ @@ -393,8 +400,8 @@ AcpiPsFind ( if (Op) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Found! Op=%p Opcode=%4.4X\n", - (char *) &Name, Op, Op->Opcode)); + "[%4.4s] Found! Op=%p Opcode=%4.4hX\n", + (char *) &Name, Op, Op->Common.AmlOpcode)); } if (!Op) @@ -418,7 +425,7 @@ AcpiPsFind ( AcpiPsAppendArg (Scope, Op); ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Not found, created Op=%p Opcode=%4.4X\n", + "[%4.4s] Not found, created Op=%p Opcode=%4.4hX\n", (char *) &Name, Op, Opcode)); } } @@ -427,15 +434,15 @@ AcpiPsFind ( { /* Search higher scopes for unprefixed name */ - while (!Op && Scope->Parent) + while (!Op && Scope->Common.Parent) { - Scope = Scope->Parent; + Scope = Scope->Common.Parent; Op = AcpiPsFindName (Scope, Name, Opcode); if (Op) { ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4X\n", - (char *) &Name, Op, Op->Opcode)); + "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4hX\n", + (char *) &Name, Op, Op->Common.AmlOpcode)); } else { diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c index 068ad9a..3b90a5a 100644 --- a/sys/contrib/dev/acpica/psopcode.c +++ b/sys/contrib/dev/acpica/psopcode.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser/Interpreter opcode information table - * $Revision: 66 $ + * $Revision: 70 $ * *****************************************************************************/ @@ -136,9 +136,9 @@ #define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */ #define MAX_EXTENDED_OPCODE 0x88 -#define NUM_EXTENDED_OPCODE MAX_EXTENDED_OPCODE + 1 +#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1) #define MAX_INTERNAL_OPCODE -#define NUM_INTERNAL_OPCODE MAX_INTERNAL_OPCODE + 1 +#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1) /******************************************************************************* @@ -539,22 +539,22 @@ */ -static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = +const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = { /*! [Begin] no source code translation */ /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */ -/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), -/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 00 */ ACPI_OP ("Zero", ARGP_ZERO_OP, ARGI_ZERO_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), +/* 01 */ ACPI_OP ("One", ARGP_ONE_OP, ARGI_ONE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* 02 */ ACPI_OP ("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP, INTERNAL_TYPE_ALIAS, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 03 */ ACPI_OP ("Name", ARGP_NAME_OP, ARGI_NAME_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), -/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 04 */ ACPI_OP ("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), +/* 05 */ ACPI_OP ("WordConst", ARGP_WORD_OP, ARGI_WORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), +/* 06 */ ACPI_OP ("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), +/* 07 */ ACPI_OP ("String", ARGP_STRING_OP, ARGI_STRING_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), /* 08 */ ACPI_OP ("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP, INTERNAL_TYPE_SCOPE, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_NO_OBJ, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), -/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), -/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), +/* 09 */ ACPI_OP ("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP, ACPI_TYPE_BUFFER, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), +/* 0A */ ACPI_OP ("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER | AML_CONSTANT), /* 0B */ ACPI_OP ("Method", ARGP_METHOD_OP, ARGI_METHOD_OP, ACPI_TYPE_METHOD, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), /* 0C */ ACPI_OP ("Local0", ARGP_LOCAL0, ARGI_LOCAL0, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), /* 0D */ ACPI_OP ("Local1", ARGP_LOCAL1, ARGI_LOCAL1, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LOCAL_VARIABLE, 0), @@ -573,39 +573,39 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = /* 1A */ ACPI_OP ("Arg6", ARGP_ARG6, ARGI_ARG6, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_METHOD_ARGUMENT, 0), /* 1B */ ACPI_OP ("Store", ARGP_STORE_OP, ARGI_STORE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), /* 1C */ ACPI_OP ("RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R), -/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH), -/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 1D */ ACPI_OP ("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 1E */ ACPI_OP ("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 1F */ ACPI_OP ("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 20 */ ACPI_OP ("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), +/* 21 */ ACPI_OP ("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), +/* 22 */ ACPI_OP ("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 23 */ ACPI_OP ("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_2T_1R, AML_FLAGS_EXEC_2A_2T_1R | AML_CONSTANT), +/* 24 */ ACPI_OP ("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 25 */ ACPI_OP ("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 26 */ ACPI_OP ("And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 27 */ ACPI_OP ("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 28 */ ACPI_OP ("Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 29 */ ACPI_OP ("NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 2A */ ACPI_OP ("XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_MATH | AML_CONSTANT), +/* 2B */ ACPI_OP ("Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 2C */ ACPI_OP ("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), /* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), /* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R), /* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), +/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT), /* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), /* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R), -/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), -/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL), +/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT), +/* 3B */ ACPI_OP ("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 3C */ ACPI_OP ("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), +/* 3D */ ACPI_OP ("LLess", ARGP_LLESS_OP, ARGI_LLESS_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL | AML_CONSTANT), /* 3E */ ACPI_OP ("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), /* 3F */ ACPI_OP ("Else", ARGP_ELSE_OP, ARGI_ELSE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), /* 40 */ ACPI_OP ("While", ARGP_WHILE_OP, ARGI_WHILE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), @@ -613,7 +613,7 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = /* 42 */ ACPI_OP ("Return", ARGP_RETURN_OP, ARGI_RETURN_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, AML_HAS_ARGS), /* 43 */ ACPI_OP ("Break", ARGP_BREAK_OP, ARGI_BREAK_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 44 */ ACPI_OP ("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), -/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 45 */ ACPI_OP ("Ones", ARGP_ONES_OP, ARGI_ONES_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, AML_CONSTANT), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ @@ -629,10 +629,10 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = /* 4F */ ACPI_OP ("Wait", ARGP_WAIT_OP, ARGI_WAIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R), /* 50 */ ACPI_OP ("Reset", ARGP_RESET_OP, ARGI_RESET_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), /* 51 */ ACPI_OP ("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), +/* 52 */ ACPI_OP ("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 53 */ ACPI_OP ("ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), /* 54 */ ACPI_OP ("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R), -/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), +/* 55 */ ACPI_OP ("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), /* 56 */ ACPI_OP ("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_CONSTANT, 0), /* 57 */ ACPI_OP ("Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), /* 58 */ ACPI_OP ("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_COMPLEX, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED | AML_DEFER), @@ -646,9 +646,9 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = /* Internal opcodes that map to invalid AML opcodes */ -/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), -/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS), +/* 60 */ ACPI_OP ("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), +/* 61 */ ACPI_OP ("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), +/* 62 */ ACPI_OP ("LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP, ACPI_TYPE_ANY, AML_CLASS_INTERNAL, AML_TYPE_BOGUS, AML_HAS_ARGS | AML_CONSTANT), /* 63 */ ACPI_OP ("[NamePath]", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP, INTERNAL_TYPE_REFERENCE, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_NSOBJECT | AML_NSNODE ), /* 64 */ ACPI_OP ("[MethodCall]", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP, ACPI_TYPE_METHOD, AML_CLASS_METHOD_CALL, AML_TYPE_METHOD_CALL, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE), /* 65 */ ACPI_OP ("[ByteList]", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP, ACPI_TYPE_ANY, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), @@ -664,18 +664,18 @@ static const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[] = /* ACPI 2.0 opcodes */ -/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, 0), +/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT), /* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER), -/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), -/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), +/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE), -/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R), +/* 73 */ ACPI_OP ("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 74 */ ACPI_OP ("ToDecimalString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 75 */ ACPI_OP ("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 76 */ ACPI_OP ("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT), +/* 77 */ ACPI_OP ("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT), /* 78 */ ACPI_OP ("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R), -/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R), +/* 79 */ ACPI_OP ("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_3A_1T_1R, AML_FLAGS_EXEC_3A_1T_1R | AML_CONSTANT), /* 7A */ ACPI_OP ("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP, ACPI_TYPE_ANY, AML_CLASS_CONTROL, AML_TYPE_CONTROL, 0), /* 7B */ ACPI_OP ("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R), /* 7C */ ACPI_OP ("DataTableRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP, ACPI_TYPE_REGION, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), @@ -795,6 +795,7 @@ AcpiPsGetOpcodeInfo ( } /* Else fall through to error case below */ + /*lint -fallthrough */ default: @@ -843,4 +844,3 @@ AcpiPsGetOpcodeName ( #endif } - diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/pstree.c index 6ab0142..2117e6c 100644 --- a/sys/contrib/dev/acpica/pstree.c +++ b/sys/contrib/dev/acpica/pstree.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pstree - Parser op tree manipulation/traversal/search - * $Revision: 37 $ + * $Revision: 39 $ * *****************************************************************************/ @@ -152,7 +152,7 @@ AcpiPsGetArg ( /* Get the info structure for this opcode */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (OpInfo->Class == AML_CLASS_UNKNOWN) { /* Invalid opcode or ASCII character */ @@ -171,11 +171,11 @@ AcpiPsGetArg ( /* Get the requested argument object */ - Arg = Op->Value.Arg; + Arg = Op->Common.Value.Arg; while (Arg && Argn) { Argn--; - Arg = Arg->Next; + Arg = Arg->Common.Next; } return (Arg); @@ -214,12 +214,13 @@ AcpiPsAppendArg ( /* Get the info structure for this opcode */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); if (OpInfo->Class == AML_CLASS_UNKNOWN) { /* Invalid opcode */ - ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n", Op->Opcode)); + ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n", + Op->Common.AmlOpcode)); return; } @@ -235,23 +236,23 @@ AcpiPsAppendArg ( /* Append the argument to the linked argument list */ - if (Op->Value.Arg) + if (Op->Common.Value.Arg) { /* Append to existing argument list */ - PrevArg = Op->Value.Arg; - while (PrevArg->Next) + PrevArg = Op->Common.Value.Arg; + while (PrevArg->Common.Next) { - PrevArg = PrevArg->Next; + PrevArg = PrevArg->Common.Next; } - PrevArg->Next = Arg; + PrevArg->Common.Next = Arg; } else { /* No argument list, this will be the first argument */ - Op->Value.Arg = Arg; + Op->Common.Value.Arg = Arg; } @@ -259,8 +260,8 @@ AcpiPsAppendArg ( while (Arg) { - Arg->Parent = Op; - Arg = Arg->Next; + Arg->Common.Parent = Op; + Arg = Arg->Common.Next; } } @@ -287,7 +288,7 @@ AcpiPsGetChild ( ACPI_FUNCTION_ENTRY (); - switch (Op->Opcode) + switch (Op->Common.AmlOpcode) { case AML_SCOPE_OP: case AML_ELSE_OP: @@ -323,6 +324,10 @@ AcpiPsGetChild ( Child = AcpiPsGetArg (Op, 3); break; + + default: + /* All others have no children */ + break; } return (Child); @@ -371,7 +376,7 @@ AcpiPsGetDepthNext ( /* look for a sibling */ - Next = Op->Next; + Next = Op->Common.Next; if (Next) { return (Next); @@ -379,14 +384,14 @@ AcpiPsGetDepthNext ( /* look for a sibling of parent */ - Parent = Op->Parent; + Parent = Op->Common.Parent; while (Parent) { Arg = AcpiPsGetArg (Parent, 0); while (Arg && (Arg != Origin) && (Arg != Op)) { - Arg = Arg->Next; + Arg = Arg->Common.Next; } if (Arg == Origin) @@ -396,14 +401,15 @@ AcpiPsGetDepthNext ( return (NULL); } - if (Parent->Next) + if (Parent->Common.Next) { /* found sibling of parent */ - return (Parent->Next); + + return (Parent->Common.Next); } Op = Parent; - Parent = Parent->Parent; + Parent = Parent->Common.Parent; } return (Next); diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c index e15cfa0..76ac4aa 100644 --- a/sys/contrib/dev/acpica/psutils.c +++ b/sys/contrib/dev/acpica/psutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psutils - Parser miscellaneous utilities (Parser only) - * $Revision: 50 $ + * $Revision: 51 $ * *****************************************************************************/ @@ -145,11 +145,11 @@ AcpiPsInitOp ( ACPI_FUNCTION_ENTRY (); - Op->DataType = ACPI_DESC_TYPE_PARSER; - Op->Opcode = Opcode; + Op->Common.DataType = ACPI_DESC_TYPE_PARSER; + Op->Common.AmlOpcode = Opcode; - ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (Op->OpName, - (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->OpName))); + ACPI_DEBUG_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName, + (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName))); } @@ -186,26 +186,26 @@ AcpiPsAllocOp ( if (OpInfo->Flags & AML_DEFER) { - Size = sizeof (ACPI_PARSE2_OBJECT); + Size = sizeof (ACPI_PARSE_OBJ_NAMED); Flags = ACPI_PARSEOP_DEFERRED; } else if (OpInfo->Flags & AML_NAMED) { - Size = sizeof (ACPI_PARSE2_OBJECT); + Size = sizeof (ACPI_PARSE_OBJ_NAMED); Flags = ACPI_PARSEOP_NAMED; } else if (Opcode == AML_INT_BYTELIST_OP) { - Size = sizeof (ACPI_PARSE2_OBJECT); + Size = sizeof (ACPI_PARSE_OBJ_NAMED); Flags = ACPI_PARSEOP_BYTELIST; } else { - Size = sizeof (ACPI_PARSE_OBJECT); + Size = sizeof (ACPI_PARSE_OBJ_COMMON); Flags = ACPI_PARSEOP_GENERIC; } - if (Size == sizeof (ACPI_PARSE_OBJECT)) + if (Size == sizeof (ACPI_PARSE_OBJ_COMMON)) { /* * The generic op is by far the most common (16 to 1) @@ -222,7 +222,7 @@ AcpiPsAllocOp ( if (Op) { AcpiPsInitOp (Op, Opcode); - Op->Flags = Flags; + Op->Common.Flags = Flags; } return (Op); @@ -249,12 +249,12 @@ AcpiPsFreeOp ( ACPI_FUNCTION_NAME ("PsFreeOp"); - if (Op->Opcode == AML_INT_RETURN_VALUE_OP) + if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) { ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Free retval op: %p\n", Op)); } - if (Op->Flags == ACPI_PARSEOP_GENERIC) + if (Op->Common.Flags == ACPI_PARSEOP_GENERIC) { AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE, Op); } @@ -332,14 +332,14 @@ AcpiPsGetName ( /* The "generic" object has no name associated with it */ - if (Op->Flags & ACPI_PARSEOP_GENERIC) + if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) { return (0); } /* Only the "Extended" parse objects have a name */ - return (((ACPI_PARSE2_OBJECT *) Op)->Name); + return (Op->Named.Name); } @@ -354,11 +354,11 @@ AcpiPsSetName ( /* The "generic" object has no name associated with it */ - if (Op->Flags & ACPI_PARSEOP_GENERIC) + if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) { return; } - ((ACPI_PARSE2_OBJECT *) Op)->Name = name; + Op->Named.Name = name; } diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c index 47d957d..835b910 100644 --- a/sys/contrib/dev/acpica/pswalk.c +++ b/sys/contrib/dev/acpica/pswalk.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: pswalk - Parser routines to walk parsed op tree(s) - * $Revision: 63 $ + * $Revision: 67 $ * *****************************************************************************/ @@ -116,11 +116,8 @@ #include "acpi.h" -#include "amlcode.h" #include "acparser.h" #include "acdispat.h" -#include "acnamesp.h" -#include "acinterp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("pswalk") @@ -177,12 +174,12 @@ AcpiPsGetNextWalkOp ( * No more children, this Op is complete. Save Next and Parent * in case the Op object gets deleted by the callback routine */ - Next = Op->Next; - Parent = Op->Parent; + Next = Op->Common.Next; + Parent = Op->Common.Parent; WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); - WalkState->Opcode = Op->Opcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + WalkState->Opcode = Op->Common.AmlOpcode; Status = AscendingCallback (WalkState); @@ -239,12 +236,12 @@ AcpiPsGetNextWalkOp ( { /* We are moving up the tree, therefore this parent Op is complete */ - GrandParent = Parent->Parent; - Next = Parent->Next; + GrandParent = Parent->Common.Parent; + Next = Parent->Common.Next; WalkState->Op = Parent; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Opcode); - WalkState->Opcode = Parent->Opcode; + WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Common.AmlOpcode); + WalkState->Opcode = Parent->Common.AmlOpcode; Status = AscendingCallback (WalkState); @@ -337,6 +334,7 @@ AcpiPsDeleteParseTree ( { ACPI_WALK_STATE *WalkState; ACPI_THREAD_STATE *Thread; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot); @@ -355,7 +353,6 @@ AcpiPsDeleteParseTree ( return_VOID; } - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, Thread); if (!WalkState) { @@ -377,13 +374,17 @@ AcpiPsDeleteParseTree ( while (WalkState->NextOp) { - AcpiPsGetNextWalkOp (WalkState, WalkState->NextOp, + Status = AcpiPsGetNextWalkOp (WalkState, WalkState->NextOp, AcpiPsDeleteCompletedOp); + if (ACPI_FAILURE (Status)) + { + break; + } } /* We are done with this walk */ - AcpiUtDeleteGenericState ((ACPI_GENERIC_STATE *) Thread); + AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread)); AcpiDsDeleteWalkState (WalkState); return_VOID; diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c index 48a8168..a17da12 100644 --- a/sys/contrib/dev/acpica/psxface.c +++ b/sys/contrib/dev/acpica/psxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psxface - Parser external interfaces - * $Revision: 61 $ + * $Revision: 64 $ * *****************************************************************************/ @@ -240,7 +240,6 @@ AcpiPsxExecute ( Status = AcpiPsParseAml (WalkState); AcpiPsDeleteParseTree (Op); - /* * 2) Execute the method. Performs second pass parse simultaneously */ @@ -259,12 +258,11 @@ AcpiPsxExecute ( /* Init new op with the method name and pointer back to the NS node */ AcpiPsSetName (Op, MethodNode->Name.Integer); - Op->Node = MethodNode; + Op->Common.Node = MethodNode; /* Create and initialize a new walk state */ - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - NULL, NULL, NULL); + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); if (!WalkState) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -290,7 +288,9 @@ AcpiPsxExecute ( for (i = 0; Params[i]; i++) { - AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT); + /* Ignore errors, just do them all */ + + (void) AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT); } } diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c index 5a6fbd3..3dd4439 100644 --- a/sys/contrib/dev/acpica/rsaddr.c +++ b/sys/contrib/dev/acpica/rsaddr.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsaddr - Address resource descriptors (16/32/64) - * $Revision: 24 $ + * $Revision: 26 $ * ******************************************************************************/ @@ -152,8 +152,8 @@ AcpiRsAddress16Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - NATIVE_CHAR *TempPtr; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; + UINT8 *TempPtr; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16); UINT32 Index; UINT16 Temp16; @@ -298,7 +298,7 @@ AcpiRsAddress16Resource ( OutputStruct->Data.Address16.ResourceSource.StringPtr = (NATIVE_CHAR *)((UINT8 * )OutputStruct + StructSize); - TempPtr = OutputStruct->Data.Address16.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.Address16.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -338,7 +338,7 @@ AcpiRsAddress16Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -493,8 +493,7 @@ AcpiRsAddress16Stream ( * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) - + 1); + Buffer += (ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1); } /* @@ -542,10 +541,10 @@ AcpiRsAddress32Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer; - ACPI_RESOURCE *OutputStruct; + ACPI_RESOURCE *OutputStruct= (void *) *OutputBuffer; UINT16 Temp16; UINT8 Temp8; - NATIVE_CHAR *TempPtr; + UINT8 *TempPtr; ACPI_SIZE StructSize; UINT32 Index; @@ -554,8 +553,6 @@ AcpiRsAddress32Resource ( Buffer = ByteStreamBuffer; - OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32); /* @@ -697,7 +694,7 @@ AcpiRsAddress32Resource ( OutputStruct->Data.Address32.ResourceSource.StringPtr = (NATIVE_CHAR *)((UINT8 *)OutputStruct + StructSize); - TempPtr = OutputStruct->Data.Address32.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.Address32.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -735,7 +732,7 @@ AcpiRsAddress32Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -787,7 +784,7 @@ AcpiRsAddress32Stream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *) Buffer; + LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; /* @@ -937,10 +934,10 @@ AcpiRsAddress64Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer; - ACPI_RESOURCE *OutputStruct; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16; UINT8 Temp8; - NATIVE_CHAR *TempPtr; + UINT8 *TempPtr; ACPI_SIZE StructSize; UINT32 Index; @@ -949,8 +946,6 @@ AcpiRsAddress64Resource ( Buffer = ByteStreamBuffer; - OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64); /* @@ -1095,7 +1090,7 @@ AcpiRsAddress64Resource ( OutputStruct->Data.Address64.ResourceSource.StringPtr = (NATIVE_CHAR *)((UINT8 *)OutputStruct + StructSize); - TempPtr = OutputStruct->Data.Address64.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.Address64.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -1134,7 +1129,7 @@ AcpiRsAddress64Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -1187,7 +1182,7 @@ AcpiRsAddress64Stream ( * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *)Buffer; + LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; /* diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c index 806d041..b5b2563 100644 --- a/sys/contrib/dev/acpica/rscalc.c +++ b/sys/contrib/dev/acpica/rscalc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rscalc - Calculate stream and list lengths - * $Revision: 39 $ + * $Revision: 43 $ * ******************************************************************************/ @@ -127,7 +127,7 @@ /******************************************************************************* * - * FUNCTION: AcpiRsCalculateByteStreamLength + * FUNCTION: AcpiRsGetByteStreamLength * * PARAMETERS: LinkedList - Pointer to the resource linked list * SizeNeeded - UINT32 pointer of the size buffer needed @@ -142,7 +142,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiRsCalculateByteStreamLength ( +AcpiRsGetByteStreamLength ( ACPI_RESOURCE *LinkedList, ACPI_SIZE *SizeNeeded) { @@ -152,7 +152,7 @@ AcpiRsCalculateByteStreamLength ( BOOLEAN Done = FALSE; - ACPI_FUNCTION_TRACE ("RsCalculateByteStreamLength"); + ACPI_FUNCTION_TRACE ("RsGetByteStreamLength"); while (!Done) @@ -276,10 +276,10 @@ AcpiRsCalculateByteStreamLength ( */ SegmentSize = 16; - if (NULL != LinkedList->Data.Address16.ResourceSource.StringPtr) + if (LinkedList->Data.Address16.ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.Address16.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.Address16.ResourceSource.StringLength; + SegmentSize++; } break; @@ -293,10 +293,10 @@ AcpiRsCalculateByteStreamLength ( */ SegmentSize = 26; - if (NULL != LinkedList->Data.Address32.ResourceSource.StringPtr) + if (LinkedList->Data.Address32.ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.Address32.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.Address32.ResourceSource.StringLength; + SegmentSize++; } break; @@ -310,10 +310,10 @@ AcpiRsCalculateByteStreamLength ( */ SegmentSize = 46; - if (NULL != LinkedList->Data.Address64.ResourceSource.StringPtr) + if (LinkedList->Data.Address64.ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.Address64.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.Address64.ResourceSource.StringLength; + SegmentSize++; } break; @@ -328,12 +328,12 @@ AcpiRsCalculateByteStreamLength ( * Resource Source + 1 for the null. */ SegmentSize = 9 + - ((LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); + (((ACPI_SIZE) LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); - if (NULL != ExIrq->ResourceSource.StringPtr) + if (ExIrq && ExIrq->ResourceSource.StringPtr) { - SegmentSize += (1 + - LinkedList->Data.ExtendedIrq.ResourceSource.StringLength); + SegmentSize += LinkedList->Data.ExtendedIrq.ResourceSource.StringLength; + SegmentSize++; } break; @@ -368,7 +368,7 @@ AcpiRsCalculateByteStreamLength ( /******************************************************************************* * - * FUNCTION: AcpiRsCalculateListLength + * FUNCTION: AcpiRsGetListLength * * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream * ByteStreamBufferLength - Size of ByteStreamBuffer @@ -385,7 +385,7 @@ AcpiRsCalculateByteStreamLength ( ******************************************************************************/ ACPI_STATUS -AcpiRsCalculateListLength ( +AcpiRsGetListLength ( UINT8 *ByteStreamBuffer, UINT32 ByteStreamBufferLength, ACPI_SIZE *SizeNeeded) @@ -404,7 +404,7 @@ AcpiRsCalculateListLength ( UINT8 AdditionalBytes; - ACPI_FUNCTION_TRACE ("RsCalculateListLength"); + ACPI_FUNCTION_TRACE ("RsGetListLength"); while (BytesParsed < ByteStreamBufferLength) @@ -823,7 +823,7 @@ AcpiRsCalculateListLength ( /******************************************************************************* * - * FUNCTION: AcpiRsCalculatePciRoutingTableLength + * FUNCTION: AcpiRsGetPciRoutingTableLength * * PARAMETERS: PackageObject - Pointer to the package object * BufferSizeNeeded - UINT32 pointer of the size buffer @@ -839,12 +839,12 @@ AcpiRsCalculateListLength ( ******************************************************************************/ ACPI_STATUS -AcpiRsCalculatePciRoutingTableLength ( +AcpiRsGetPciRoutingTableLength ( ACPI_OPERAND_OBJECT *PackageObject, ACPI_SIZE *BufferSizeNeeded) { UINT32 NumberOfElements; - UINT32 TempSizeNeeded = 0; + ACPI_SIZE TempSizeNeeded = 0; ACPI_OPERAND_OBJECT **TopObjectList; UINT32 Index; ACPI_OPERAND_OBJECT *PackageElement; @@ -853,7 +853,7 @@ AcpiRsCalculatePciRoutingTableLength ( UINT32 TableIndex; - ACPI_FUNCTION_TRACE ("RsCalculatePciRoutingTableLength"); + ACPI_FUNCTION_TRACE ("RsGetPciRoutingTableLength"); NumberOfElements = PackageObject->Package.Count; @@ -890,8 +890,8 @@ AcpiRsCalculatePciRoutingTableLength ( for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++) { - if ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) || - ((INTERNAL_TYPE_REFERENCE == (*SubObjectList)->Common.Type) && + if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*SubObjectList)) || + ((INTERNAL_TYPE_REFERENCE == ACPI_GET_OBJECT_TYPE (*SubObjectList)) && ((*SubObjectList)->Reference.Opcode == AML_INT_NAMEPATH_OP))) { NameFound = TRUE; @@ -910,9 +910,9 @@ AcpiRsCalculatePciRoutingTableLength ( /* * Was a String type found? */ - if (TRUE == NameFound) + if (NameFound) { - if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) + if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_STRING) { /* * The length String.Length field includes the diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c index 5c4be20..956cdf4 100644 --- a/sys/contrib/dev/acpica/rsdump.c +++ b/sys/contrib/dev/acpica/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsdump - Functions to display the resource structures. - * $Revision: 29 $ + * $Revision: 32 $ * ******************************************************************************/ @@ -124,7 +124,7 @@ ACPI_MODULE_NAME ("rsdump") -#ifdef ACPI_DEBUG +#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) /******************************************************************************* * @@ -269,9 +269,9 @@ AcpiRsDumpDma ( void AcpiRsDumpStartDependFns ( - ACPI_RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data; + ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data; ACPI_FUNCTION_ENTRY (); @@ -1093,7 +1093,7 @@ AcpiRsDumpResourceList ( { while (!Done) { - AcpiOsPrintf ("Resource structure %x.\n", Count++); + AcpiOsPrintf ("Resource structure %X.\n", Count++); switch (Resource->Id) { @@ -1200,7 +1200,7 @@ AcpiRsDumpIrqList ( if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer) { - PrtElement = (ACPI_PCI_ROUTING_TABLE *) Buffer; + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); while (!Done) { @@ -1219,7 +1219,7 @@ AcpiRsDumpIrqList ( Buffer += PrtElement->Length; - PrtElement = (ACPI_PCI_ROUTING_TABLE *) Buffer; + PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer); if(0 == PrtElement->Length) { diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c index 0efa40e9..330aa58 100644 --- a/sys/contrib/dev/acpica/rsio.c +++ b/sys/contrib/dev/acpica/rsio.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsio - IO and DMA resource descriptors - * $Revision: 17 $ + * $Revision: 20 $ * ******************************************************************************/ @@ -152,7 +152,7 @@ AcpiRsIoResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO); @@ -211,7 +211,7 @@ AcpiRsIoResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -250,7 +250,7 @@ AcpiRsFixedIoResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO); @@ -285,7 +285,7 @@ AcpiRsFixedIoResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -469,7 +469,7 @@ AcpiRsDmaResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT8 Temp8 = 0; UINT8 Index; UINT8 i; @@ -501,13 +501,19 @@ AcpiRsDmaResource ( i++; } } + if (i == 0) + { + /* Zero channels is invalid! */ + + return_ACPI_STATUS (AE_BAD_DATA); + } OutputStruct->Data.Dma.NumberOfChannels = i; /* * Calculate the structure size based upon the number of interrupts */ - StructSize += (OutputStruct->Data.Dma.NumberOfChannels - 1) * 4; + StructSize += ((ACPI_SIZE) OutputStruct->Data.Dma.NumberOfChannels - 1) * 4; /* * Point to Byte 2 @@ -538,7 +544,7 @@ AcpiRsDmaResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c index 46087ac..79afd1e 100644 --- a/sys/contrib/dev/acpica/rsirq.c +++ b/sys/contrib/dev/acpica/rsirq.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsirq - IRQ resource descriptors - * $Revision: 24 $ + * $Revision: 28 $ * ******************************************************************************/ @@ -152,7 +152,7 @@ AcpiRsIrqResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; UINT8 Index; @@ -183,18 +183,25 @@ AcpiRsIrqResource ( for (i = 0, Index = 0; Index < 16; Index++) { - if((Temp16 >> Index) & 0x01) + if ((Temp16 >> Index) & 0x01) { OutputStruct->Data.Irq.Interrupts[i] = Index; i++; } } + + if (i == 0) + { + /* Zero interrupts is invalid! */ + + return_ACPI_STATUS (AE_BAD_DATA); + } OutputStruct->Data.Irq.NumberOfInterrupts = i; /* * Calculate the structure size based upon the number of interrupts */ - StructSize += (OutputStruct->Data.Irq.NumberOfInterrupts - 1) * 4; + StructSize += ((ACPI_SIZE) OutputStruct->Data.Irq.NumberOfInterrupts - 1) * 4; /* * Point to Byte 3 if it is used @@ -249,7 +256,7 @@ AcpiRsIrqResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -385,10 +392,10 @@ AcpiRsExtendedIrqResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - NATIVE_CHAR *TempPtr; + UINT8 *TempPtr; UINT8 Index; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ); @@ -458,8 +465,8 @@ AcpiRsExtendedIrqResource ( */ for (Index = 0; Index < Temp8; Index++) { - OutputStruct->Data.ExtendedIrq.Interrupts[Index] = - (UINT32)*Buffer; + ACPI_MOVE_UNALIGNED32_TO_32 ( + &OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer); /* Point to the next IRQ */ @@ -474,7 +481,7 @@ AcpiRsExtendedIrqResource ( * stream that are default. */ if (*BytesConsumed > - (UINT32)(OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + 5) + ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + 5) { /* Dereference the Index */ @@ -491,7 +498,7 @@ AcpiRsExtendedIrqResource ( OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = (NATIVE_CHAR *)(OutputStruct + StructSize); - TempPtr = OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; + TempPtr = (UINT8 *) OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; /* Copy the string into the buffer */ @@ -529,7 +536,7 @@ AcpiRsExtendedIrqResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -580,7 +587,7 @@ AcpiRsExtendedIrqStream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *)Buffer; + LengthField = ACPI_CAST_PTR (UINT16, Buffer); Buffer += 2; /* diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/rslist.c index 809544b..9f4a7a0 100644 --- a/sys/contrib/dev/acpica/rslist.c +++ b/sys/contrib/dev/acpica/rslist.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rslist - Linked list utilities - * $Revision: 26 $ + * $Revision: 30 $ * ******************************************************************************/ @@ -163,6 +163,11 @@ AcpiRsGetResourceType ( * Large Resource Type -- All bits are valid */ return (ResourceStartByte); + + + default: + /* No other types of resource descriptor */ + break; } return (0xFF); @@ -192,7 +197,7 @@ AcpiRsByteStreamToList ( UINT8 *OutputBuffer) { ACPI_STATUS Status; - UINT32 BytesParsed = 0; + ACPI_SIZE BytesParsed = 0; UINT8 ResourceType = 0; ACPI_SIZE BytesConsumed = 0; UINT8 *Buffer = OutputBuffer; @@ -204,7 +209,7 @@ AcpiRsByteStreamToList ( while (BytesParsed < ByteStreamBufferLength && - FALSE == EndTagProcessed) + !EndTagProcessed) { /* * The next byte in the stream is the resource type @@ -360,9 +365,9 @@ AcpiRsByteStreamToList ( default: /* - * Invalid/Unknowns resource type + * Invalid/Unknown resource type */ - Status = AE_AML_ERROR; + Status = AE_AML_INVALID_RESOURCE_TYPE; break; } @@ -384,7 +389,7 @@ AcpiRsByteStreamToList ( /* * Set the Buffer to the next structure */ - Resource = (ACPI_RESOURCE *)Buffer; + Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer); Resource->Length = ACPI_ALIGN_RESOURCE_SIZE(Resource->Length); Buffer += ACPI_ALIGN_RESOURCE_SIZE(StructureSize); @@ -393,9 +398,9 @@ AcpiRsByteStreamToList ( /* * Check the reason for exiting the while loop */ - if (TRUE != EndTagProcessed) + if (!EndTagProcessed) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } return_ACPI_STATUS (AE_OK); @@ -409,7 +414,7 @@ AcpiRsByteStreamToList ( * PARAMETERS: LinkedList - Pointer to the resource linked list * ByteSteamSizeNeeded - Calculated size of the byte stream * needed from calling - * AcpiRsCalculateByteStreamLength() + * AcpiRsGetByteStreamLength() * The size of the OutputBuffer is * guaranteed to be >= * ByteStreamSizeNeeded @@ -426,7 +431,7 @@ AcpiRsByteStreamToList ( ACPI_STATUS AcpiRsListToByteStream ( ACPI_RESOURCE *LinkedList, - UINT32 ByteStreamSizeNeeded, + ACPI_SIZE ByteStreamSizeNeeded, UINT8 *OutputBuffer) { ACPI_STATUS Status; diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/rsmemory.c index 2da4523..eafd17f 100644 --- a/sys/contrib/dev/acpica/rsmemory.c +++ b/sys/contrib/dev/acpica/rsmemory.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmem24 - Memory resource descriptors - * $Revision: 17 $ + * $Revision: 20 $ * ******************************************************************************/ @@ -152,7 +152,7 @@ AcpiRsMemory24Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24); @@ -168,7 +168,7 @@ AcpiRsMemory24Resource ( ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_MEM24; /* @@ -208,7 +208,7 @@ AcpiRsMemory24Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -329,7 +329,7 @@ AcpiRsMemory32RangeResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32); @@ -345,7 +345,7 @@ AcpiRsMemory32RangeResource ( ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_MEM32; @@ -395,7 +395,7 @@ AcpiRsMemory32RangeResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -434,7 +434,7 @@ AcpiRsFixedMemory32Resource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32); @@ -450,7 +450,7 @@ AcpiRsFixedMemory32Resource ( ACPI_MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32; @@ -477,7 +477,7 @@ AcpiRsFixedMemory32Resource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c index adc3b4e..e2d7d02 100644 --- a/sys/contrib/dev/acpica/rsmisc.c +++ b/sys/contrib/dev/acpica/rsmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsmisc - Miscellaneous resource descriptors - * $Revision: 20 $ + * $Revision: 24 $ * ******************************************************************************/ @@ -151,7 +151,7 @@ AcpiRsEndTagResource ( UINT8 **OutputBuffer, ACPI_SIZE *StructureSize) { - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH; @@ -262,7 +262,7 @@ AcpiRsVendorResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; UINT8 Index; @@ -290,7 +290,7 @@ AcpiRsVendorResource ( /* Calculate bytes consumed */ - *BytesConsumed = Temp16 + 3; + *BytesConsumed = (ACPI_SIZE) Temp16 + 3; /* Point to the first vendor byte */ @@ -305,7 +305,7 @@ AcpiRsVendorResource ( /* Calculate bytes consumed */ - *BytesConsumed = Temp16 + 1; + *BytesConsumed = (ACPI_SIZE) Temp16 + 1; /* Point to the first vendor byte */ @@ -331,7 +331,7 @@ AcpiRsVendorResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -394,7 +394,7 @@ AcpiRsVendorStream ( * Small Item, Set the descriptor field */ Temp8 = 0x70; - Temp8 |= LinkedList->Data.VendorSpecific.Length; + Temp8 |= (UINT8) LinkedList->Data.VendorSpecific.Length; *Buffer = Temp8; Buffer += 1; @@ -448,7 +448,7 @@ AcpiRsStartDependFnsResource ( ACPI_SIZE *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; UINT8 Temp8 = 0; ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF); @@ -480,7 +480,7 @@ AcpiRsStartDependFnsResource ( if (3 == OutputStruct->Data.StartDpf.CompatibilityPriority) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); } /* @@ -490,7 +490,7 @@ AcpiRsStartDependFnsResource ( if (3 == OutputStruct->Data.StartDpf.PerformanceRobustness) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE); } } else @@ -505,7 +505,7 @@ AcpiRsStartDependFnsResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure @@ -543,7 +543,7 @@ AcpiRsEndDependFnsResource ( UINT8 **OutputBuffer, ACPI_SIZE *StructureSize) { - ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer; ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH; @@ -563,7 +563,7 @@ AcpiRsEndDependFnsResource ( /* * Set the Length parameter */ - OutputStruct->Length = StructSize; + OutputStruct->Length = (UINT32) StructSize; /* * Return the final size of the structure diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c index 1b92806..26274f9 100644 --- a/sys/contrib/dev/acpica/rsutils.c +++ b/sys/contrib/dev/acpica/rsutils.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsutils - Utilities for the resource manager - * $Revision: 29 $ + * $Revision: 33 $ * ******************************************************************************/ @@ -149,7 +149,7 @@ AcpiRsGetPrtMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer) { - ACPI_OPERAND_OBJECT *RetObj; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -161,13 +161,13 @@ AcpiRsGetPrtMethodData ( /* * Execute the method, no parameters */ - Status = AcpiNsEvaluateRelative (Handle, "_PRT", NULL, &RetObj); + Status = AcpiNsEvaluateRelative (Handle, "_PRT", NULL, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if (!RetObj) + if (!ObjDesc) { /* Return object is required */ @@ -176,14 +176,14 @@ AcpiRsGetPrtMethodData ( } /* - * The return object will be a package, so check the parameters. If the + * The return object must be a package, so check the parameters. If the * return object is not a package, then the underlying AML code is corrupt * or improperly written. */ - if (ACPI_TYPE_PACKAGE != RetObj->Common.Type) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_PACKAGE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRT did not return a Package, returned %s\n", - AcpiUtGetTypeName (RetObj->Common.Type))); + AcpiUtGetObjectTypeName (ObjDesc))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -192,13 +192,13 @@ AcpiRsGetPrtMethodData ( * Create a resource linked list from the byte stream buffer that comes * back from the _CRS method execution. */ - Status = AcpiRsCreatePciRoutingTable (RetObj, RetBuffer); + Status = AcpiRsCreatePciRoutingTable (ObjDesc, RetBuffer); /* On exit, we must delete the object returned by EvaluateObject */ Cleanup: - AcpiUtRemoveReference (RetObj); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -226,7 +226,7 @@ AcpiRsGetCrsMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer) { - ACPI_OPERAND_OBJECT *RetObj; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -238,13 +238,13 @@ AcpiRsGetCrsMethodData ( /* * Execute the method, no parameters */ - Status = AcpiNsEvaluateRelative (Handle, "_CRS", NULL, &RetObj); + Status = AcpiNsEvaluateRelative (Handle, "_CRS", NULL, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if (!RetObj) + if (!ObjDesc) { /* Return object is required */ @@ -258,10 +258,10 @@ AcpiRsGetCrsMethodData ( * then the underlying AML code is corrupt or improperly * written. */ - if (ACPI_TYPE_BUFFER != RetObj->Common.Type) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CRS did not return a Buffer, returned %s\n", - AcpiUtGetTypeName (RetObj->Common.Type))); + AcpiUtGetObjectTypeName (ObjDesc))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -271,13 +271,13 @@ AcpiRsGetCrsMethodData ( * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreateResourceList (RetObj, RetBuffer); + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); /* On exit, we must delete the object returned by evaluateObject */ Cleanup: - AcpiUtRemoveReference (RetObj); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -305,7 +305,7 @@ AcpiRsGetPrsMethodData ( ACPI_HANDLE Handle, ACPI_BUFFER *RetBuffer) { - ACPI_OPERAND_OBJECT *RetObj; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; @@ -317,13 +317,13 @@ AcpiRsGetPrsMethodData ( /* * Execute the method, no parameters */ - Status = AcpiNsEvaluateRelative (Handle, "_PRS", NULL, &RetObj); + Status = AcpiNsEvaluateRelative (Handle, "_PRS", NULL, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - if (!RetObj) + if (!ObjDesc) { /* Return object is required */ @@ -337,10 +337,10 @@ AcpiRsGetPrsMethodData ( * then the underlying AML code is corrupt or improperly * written.. */ - if (ACPI_TYPE_BUFFER != RetObj->Common.Type) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_PRS did not return a Buffer, returned %s\n", - AcpiUtGetTypeName (RetObj->Common.Type))); + AcpiUtGetObjectTypeName (ObjDesc))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } @@ -350,13 +350,13 @@ AcpiRsGetPrsMethodData ( * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreateResourceList (RetObj, RetBuffer); + Status = AcpiRsCreateResourceList (ObjDesc, RetBuffer); /* On exit, we must delete the object returned by evaluateObject */ Cleanup: - AcpiUtRemoveReference (RetObj); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -421,8 +421,9 @@ AcpiRsSetSrsMethodData ( /* * Set up the parameter object */ - Params[0]->Buffer.Length = Buffer.Length; + Params[0]->Buffer.Length = (UINT32) Buffer.Length; Params[0]->Buffer.Pointer = Buffer.Pointer; + Params[0]->Common.Flags = AOPOBJ_DATA_VALID; Params[1] = NULL; /* diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c index 5105e9a..11e6d51 100644 --- a/sys/contrib/dev/acpica/rsxface.c +++ b/sys/contrib/dev/acpica/rsxface.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: rsxface - Public interfaces to the resource manager - * $Revision: 18 $ + * $Revision: 19 $ * ******************************************************************************/ @@ -118,8 +118,6 @@ #define __RSXFACE_C__ #include "acpi.h" -#include "acinterp.h" -#include "acnamesp.h" #include "acresrc.h" #define _COMPONENT ACPI_RESOURCES diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c index e6eb3f0..bc63b87 100644 --- a/sys/contrib/dev/acpica/tbconvrt.c +++ b/sys/contrib/dev/acpica/tbconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbconvrt - ACPI Table conversion utilities - * $Revision: 36 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -147,7 +147,7 @@ AcpiTbGetTableCount ( ACPI_FUNCTION_ENTRY (); -#ifndef _IA64 +#if ACPI_MACHINE_WIDTH != 64 if (RSDP->Revision < 2) { @@ -186,7 +186,7 @@ AcpiTbConvertToXsdt ( ACPI_TABLE_DESC *TableInfo, UINT32 *NumberOfTables) { - UINT32 TableSize; + ACPI_SIZE TableSize; UINT32 i; XSDT_DESCRIPTOR *NewTable; @@ -200,7 +200,7 @@ AcpiTbConvertToXsdt ( /* Compute size of the converted XSDT */ - TableSize = (*NumberOfTables * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER); + TableSize = ((ACPI_SIZE) *NumberOfTables * sizeof (UINT64)) + sizeof (ACPI_TABLE_HEADER); /* Allocate an XSDT */ @@ -213,7 +213,7 @@ AcpiTbConvertToXsdt ( /* Copy the header and set the length */ ACPI_MEMCPY (NewTable, TableInfo->Pointer, sizeof (ACPI_TABLE_HEADER)); - NewTable->Header.Length = TableSize; + NewTable->Header.Length = (UINT32) TableSize; /* Copy the table pointers */ @@ -246,6 +246,176 @@ AcpiTbConvertToXsdt ( } + +/******************************************************************************* + * + * FUNCTION: AcpiTbConvertFadt1 + * + * PARAMETERS: LocalFadt - Pointer to new FADT + * OriginalFadt - Pointer to old FADT + * + * RETURN: Populates LocalFadt + * + * DESCRIPTION: Convert an ACPI 1.0 FADT to common internal format + * + ******************************************************************************/ + +static void +AcpiTbConvertFadt1 ( + FADT_DESCRIPTOR_REV2 *LocalFadt, + FADT_DESCRIPTOR_REV1 *OriginalFadt) +{ + + + /* ACPI 1.0 FACS */ + /* The BIOS stored FADT should agree with Revision 1.0 */ + + /* + * Copy the table header and the common part of the tables. + * + * The 2.0 table is an extension of the 1.0 table, so the entire 1.0 + * table can be copied first, then expand some fields to 64 bits. + */ + ACPI_MEMCPY (LocalFadt, OriginalFadt, sizeof (FADT_DESCRIPTOR_REV1)); + + /* Convert table pointers to 64-bit fields */ + + ACPI_STORE_ADDRESS (LocalFadt->XFirmwareCtrl, LocalFadt->V1_FirmwareCtrl); + ACPI_STORE_ADDRESS (LocalFadt->XDsdt, LocalFadt->V1_Dsdt); + + /* + * System Interrupt Model isn't used in ACPI 2.0 (LocalFadt->Reserved1 = 0;) + */ + + /* + * This field is set by the OEM to convey the preferred power management + * profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't + * know what kind of 32-bit system this is, we will use "unspecified". + */ + LocalFadt->Prefer_PM_Profile = PM_UNSPECIFIED; + + /* + * Processor Performance State Control. This is the value OSPM writes to + * the SMI_CMD register to assume processor performance state control + * responsibility. There isn't any equivalence in 1.0, leave it zeroed. + */ + LocalFadt->PstateCnt = 0; + + /* + * Support for the _CST object and C States change notification. + * This data item hasn't any 1.0 equivalence so leave it zero. + */ + LocalFadt->CstCnt = 0; + + /* + * Since there isn't any equivalence in 1.0 and since it highly likely + * that a 1.0 system has legacy support. + */ + LocalFadt->IapcBootArch = BAF_LEGACY_DEVICES; + + /* + * Convert the V1.0 block addresses to V2.0 GAS structures + */ + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aEvtBlk, LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1aEvtBlk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bEvtBlk, LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1bEvtBlk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aCntBlk, LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1aCntBlk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bCntBlk, LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1bCntBlk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm2CntBlk, LocalFadt->Pm2CntLen, LocalFadt->V1_Pm2CntBlk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPmTmrBlk, LocalFadt->PmTmLen, LocalFadt->V1_PmTmrBlk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe0Blk, LocalFadt->Gpe0BlkLen, LocalFadt->V1_Gpe0Blk); + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe1Blk, LocalFadt->Gpe1BlkLen, LocalFadt->V1_Gpe1Blk); + +} + + +/******************************************************************************* + * + * FUNCTION: AcpiTbConvertFadt2 + * + * PARAMETERS: LocalFadt - Pointer to new FADT + * OriginalFadt - Pointer to old FADT + * + * RETURN: Populates LocalFadt + * + * DESCRIPTION: Convert an ACPI 2.0 FADT to common internal format. + * Handles optional "X" fields. + * + ******************************************************************************/ + +static void +AcpiTbConvertFadt2 ( + FADT_DESCRIPTOR_REV2 *LocalFadt, + FADT_DESCRIPTOR_REV2 *OriginalFadt) +{ + + /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ + + ACPI_MEMCPY (LocalFadt, OriginalFadt, sizeof (FADT_DESCRIPTOR_REV2)); + + /* + * "X" fields are optional extensions to the original V1.0 fields, so + * we must selectively expand V1.0 fields if the corresponding X field + * is zero. + */ + if (!(ACPI_GET_ADDRESS (LocalFadt->XFirmwareCtrl))) + { + ACPI_STORE_ADDRESS (LocalFadt->XFirmwareCtrl, LocalFadt->V1_FirmwareCtrl); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XDsdt))) + { + ACPI_STORE_ADDRESS (LocalFadt->XDsdt, LocalFadt->V1_Dsdt); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aEvtBlk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aEvtBlk, + LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1aEvtBlk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bEvtBlk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bEvtBlk, + LocalFadt->Pm1EvtLen, LocalFadt->V1_Pm1bEvtBlk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1aCntBlk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1aCntBlk, + LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1aCntBlk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XPm1bCntBlk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm1bCntBlk, + LocalFadt->Pm1CntLen, LocalFadt->V1_Pm1bCntBlk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XPm2CntBlk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPm2CntBlk, + LocalFadt->Pm2CntLen, LocalFadt->V1_Pm2CntBlk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XPmTmrBlk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XPmTmrBlk, + LocalFadt->PmTmLen, LocalFadt->V1_PmTmrBlk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe0Blk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe0Blk, + LocalFadt->Gpe0BlkLen, LocalFadt->V1_Gpe0Blk); + } + + if (!(ACPI_GET_ADDRESS (LocalFadt->XGpe1Blk.Address))) + { + ASL_BUILD_GAS_FROM_V1_ENTRY (LocalFadt->XGpe1Blk, + LocalFadt->Gpe1BlkLen, LocalFadt->V1_Gpe1Blk); + } +} + /******************************************************************************* * * FUNCTION: AcpiTbConvertTableFadt @@ -267,8 +437,7 @@ AcpiTbConvertToXsdt ( ACPI_STATUS AcpiTbConvertTableFadt (void) { - FADT_DESCRIPTOR_REV1 *FADT1; - FADT_DESCRIPTOR_REV2 *FADT2; + FADT_DESCRIPTOR_REV2 *LocalFadt; ACPI_TABLE_DESC *TableDesc; @@ -279,100 +448,51 @@ AcpiTbConvertTableFadt (void) * AcpiGbl_FADT is valid * Allocate and zero the 2.0 FADT buffer */ - FADT2 = ACPI_MEM_CALLOCATE (sizeof (FADT_DESCRIPTOR_REV2)); - if (FADT2 == NULL) + LocalFadt = ACPI_MEM_CALLOCATE (sizeof (FADT_DESCRIPTOR_REV2)); + if (LocalFadt == NULL) { return_ACPI_STATUS (AE_NO_MEMORY); } - + /* - * The ACPI FADT revision number is FADT2_REVISION_ID=3 - * So, if the current table revision is less than 3 it is type 1.0 + * FADT length and version validation. The table must be at least as + * long as the version 1.0 FADT */ + if (AcpiGbl_FADT->Header.Length < sizeof (FADT_DESCRIPTOR_REV1)) + { + ACPI_REPORT_ERROR (("Invalid FADT table length: 0x%X\n", AcpiGbl_FADT->Header.Length)); + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } + if (AcpiGbl_FADT->Header.Revision >= FADT2_REVISION_ID) { - /* We have an ACPI 2.0 FADT but we must copy it to our local buffer */ + if (AcpiGbl_FADT->Header.Length < sizeof (FADT_DESCRIPTOR_REV2)) + { + /* Length is too short to be a V2.0 table */ + + ACPI_REPORT_WARNING (("Inconsistent FADT length (0x%X) and revision (0x%X), using FADT V1.0 portion of table\n", + AcpiGbl_FADT->Header.Length, AcpiGbl_FADT->Header.Revision)); - *FADT2 = *((FADT_DESCRIPTOR_REV2*) AcpiGbl_FADT); + AcpiTbConvertFadt1 (LocalFadt, (void *) AcpiGbl_FADT); + } + else + { + /* Valid V2.0 table */ + + AcpiTbConvertFadt2 (LocalFadt, AcpiGbl_FADT); + } } else { - /* ACPI 1.0 FACS */ - - /* The BIOS stored FADT should agree with Revision 1.0 */ - - FADT1 = (FADT_DESCRIPTOR_REV1*) AcpiGbl_FADT; - - /* - * Copy the table header and the common part of the tables. - * - * The 2.0 table is an extension of the 1.0 table, so the entire 1.0 - * table can be copied first, then expand some fields to 64 bits. - */ - ACPI_MEMCPY (FADT2, FADT1, sizeof (FADT_DESCRIPTOR_REV1)); - - /* Convert table pointers to 64-bit fields */ - - ACPI_STORE_ADDRESS (FADT2->XFirmwareCtrl, FADT1->FirmwareCtrl); - ACPI_STORE_ADDRESS (FADT2->XDsdt, FADT1->Dsdt); - - /* - * System Interrupt Model isn't used in ACPI 2.0 (FADT2->Reserved1 = 0;) - */ - - /* - * This field is set by the OEM to convey the preferred power management - * profile to OSPM. It doesn't have any 1.0 equivalence. Since we don't - * know what kind of 32-bit system this is, we will use "unspecified". - */ - FADT2->Prefer_PM_Profile = PM_UNSPECIFIED; - - /* - * Processor Performance State Control. This is the value OSPM writes to - * the SMI_CMD register to assume processor performance state control - * responsibility. There isn't any equivalence in 1.0, leave it zeroed. - */ - FADT2->PstateCnt = 0; - - /* - * Support for the _CST object and C States change notification. - * This data item hasn't any 1.0 equivalence so leave it zero. - */ - FADT2->CstCnt = 0; - - /* - * Since there isn't any equivalence in 1.0 and since it highly likely - * that a 1.0 system has legacy support. - */ - FADT2->IapcBootArch = BAF_LEGACY_DEVICES; - - /* - * Convert the V1.0 block addresses to V2.0 GAS structures - * in this order: - * - * PM 1A Events - * PM 1B Events - * PM 1A Control - * PM 1B Control - * PM 2 Control - * PM Timer Control - * GPE Block 0 - * GPE Block 1 - */ - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1aEvtBlk, FADT1->Pm1EvtLen, FADT1->Pm1aEvtBlk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1bEvtBlk, FADT1->Pm1EvtLen, FADT1->Pm1bEvtBlk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1aCntBlk, FADT1->Pm1CntLen, FADT1->Pm1aCntBlk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm1bCntBlk, FADT1->Pm1CntLen, FADT1->Pm1bCntBlk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPm2CntBlk, FADT1->Pm2CntLen, FADT1->Pm2CntBlk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XPmTmrBlk, FADT1->PmTmLen, FADT1->PmTmrBlk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XGpe0Blk, FADT1->Gpe0BlkLen, FADT1->Gpe0Blk); - ASL_BUILD_GAS_FROM_V1_ENTRY (FADT2->XGpe1Blk, FADT1->Gpe1BlkLen, FADT1->Gpe1Blk); + /* Valid V1.0 table */ + + AcpiTbConvertFadt1 (LocalFadt, (void *) AcpiGbl_FADT); } /* - * Global FADT pointer will point to the common V2.0 FADT + * Global FADT pointer will point to the new common V2.0 FADT */ - AcpiGbl_FADT = FADT2; + AcpiGbl_FADT = LocalFadt; AcpiGbl_FADT->Header.Length = sizeof (FADT_DESCRIPTOR); /* Free the original table */ @@ -382,10 +502,10 @@ AcpiTbConvertTableFadt (void) /* Install the new table */ - TableDesc->Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_FADT; - TableDesc->BasePointer = AcpiGbl_FADT; - TableDesc->Allocation = ACPI_MEM_ALLOCATED; - TableDesc->Length = sizeof (FADT_DESCRIPTOR_REV2); + TableDesc->Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_FADT; + TableDesc->BasePointer = AcpiGbl_FADT; + TableDesc->Allocation = ACPI_MEM_ALLOCATED; + TableDesc->Length = sizeof (FADT_DESCRIPTOR_REV2); /* Dump the entire FADT */ @@ -415,37 +535,46 @@ ACPI_STATUS AcpiTbBuildCommonFacs ( ACPI_TABLE_DESC *TableInfo) { - FACS_DESCRIPTOR_REV1 *FACS1; - FACS_DESCRIPTOR_REV2 *FACS2; - ACPI_FUNCTION_TRACE ("TbBuildCommonFacs"); - /* Copy fields to the new FACS */ + /* Absolute minimum length is 24, but the ACPI spec says 64 */ - if (AcpiGbl_RSDP->Revision < 2) + if (AcpiGbl_FACS->Length < 24) { - /* ACPI 1.0 FACS */ + ACPI_REPORT_ERROR (("Invalid FACS table length: 0x%X\n", AcpiGbl_FACS->Length)); + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } - FACS1 = (FACS_DESCRIPTOR_REV1 *) AcpiGbl_FACS; + if (AcpiGbl_FACS->Length < 64) + { + ACPI_REPORT_WARNING (("FACS is shorter than the ACPI specification allows: 0x%X, using anyway\n", + AcpiGbl_FACS->Length)); + } - AcpiGbl_CommonFACS.GlobalLock = &(FACS1->GlobalLock); - AcpiGbl_CommonFACS.FirmwareWakingVector = (UINT64 *) &FACS1->FirmwareWakingVector; + /* Copy fields to the new FACS */ + + AcpiGbl_CommonFACS.GlobalLock = &(AcpiGbl_FACS->GlobalLock); + + if ((AcpiGbl_RSDP->Revision < 2) || + (AcpiGbl_FACS->Length < 32) || + (!(ACPI_GET_ADDRESS (AcpiGbl_FACS->XFirmwareWakingVector)))) + { + /* ACPI 1.0 FACS or short table or optional X_ field is zero */ + + AcpiGbl_CommonFACS.FirmwareWakingVector = ACPI_CAST_PTR (UINT64, &(AcpiGbl_FACS->FirmwareWakingVector)); AcpiGbl_CommonFACS.VectorWidth = 32; } else { - /* ACPI 2.0 FACS */ - - FACS2 = (FACS_DESCRIPTOR_REV2 *) AcpiGbl_FACS; + /* ACPI 2.0 FACS with valid X_ field */ - AcpiGbl_CommonFACS.GlobalLock = &(FACS2->GlobalLock); - AcpiGbl_CommonFACS.FirmwareWakingVector = &FACS2->XFirmwareWakingVector; + AcpiGbl_CommonFACS.FirmwareWakingVector = &AcpiGbl_FACS->XFirmwareWakingVector; AcpiGbl_CommonFACS.VectorWidth = 64; } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c index 819c6ce..24a0915 100644 --- a/sys/contrib/dev/acpica/tbinstal.c +++ b/sys/contrib/dev/acpica/tbinstal.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbinstal - ACPI table installation and removal - * $Revision: 57 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -180,8 +180,7 @@ AcpiTbMatchSignature ( * * FUNCTION: AcpiTbInstallTable * - * PARAMETERS: TablePtr - Input buffer pointer, optional - * TableInfo - Return value from AcpiTbGetTable + * PARAMETERS: TableInfo - Return value from AcpiTbGetTable * * RETURN: Status * @@ -193,7 +192,6 @@ AcpiTbMatchSignature ( ACPI_STATUS AcpiTbInstallTable ( - ACPI_TABLE_HEADER *TablePtr, ACPI_TABLE_DESC *TableInfo) { ACPI_STATUS Status; @@ -205,7 +203,7 @@ AcpiTbInstallTable ( * Check the table signature and make sure it is recognized * Also checks the header checksum */ - Status = AcpiTbRecognizeTable (TablePtr, TableInfo); + Status = AcpiTbRecognizeTable (TableInfo); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -235,8 +233,7 @@ AcpiTbInstallTable ( * * FUNCTION: AcpiTbRecognizeTable * - * PARAMETERS: TablePtr - Input buffer pointer, optional - * TableInfo - Return value from AcpiTbGetTable + * PARAMETERS: TableInfo - Return value from AcpiTbGetTable * * RETURN: Status * @@ -254,7 +251,6 @@ AcpiTbInstallTable ( ACPI_STATUS AcpiTbRecognizeTable ( - ACPI_TABLE_HEADER *TablePtr, ACPI_TABLE_DESC *TableInfo) { ACPI_TABLE_HEADER *TableHeader; @@ -294,7 +290,7 @@ AcpiTbRecognizeTable ( /* Return the table type and length via the info struct */ - TableInfo->Length = TableHeader->Length; + TableInfo->Length = (ACPI_SIZE) TableHeader->Length; /* * Validate checksum for _most_ tables, @@ -303,13 +299,15 @@ AcpiTbRecognizeTable ( if (TableInfo->Type != ACPI_TABLE_FACS) { Status = AcpiTbVerifyTableChecksum (TableHeader); - if (ACPI_FAILURE (Status) && - (!ACPI_CHECKSUM_ABORT)) + +#if (!ACPI_CHECKSUM_ABORT) + if (ACPI_FAILURE (Status)) { /* Ignore the error if configuration says so */ Status = AE_OK; } +#endif } return_ACPI_STATUS (Status); @@ -615,6 +613,9 @@ AcpiTbDeleteSingleTable ( AcpiOsUnmapMemory (TableDesc->BasePointer, TableDesc->Length); break; + + default: + break; } } } @@ -626,7 +627,7 @@ AcpiTbDeleteSingleTable ( * * PARAMETERS: TableInfo - A table info struct * - * RETURN: None. + * RETURN: Pointer to the next table in the list (of same type) * * DESCRIPTION: Free the memory associated with an internal ACPI table that * is either installed or has never been installed. @@ -641,7 +642,7 @@ AcpiTbUninstallTable ( ACPI_TABLE_DESC *NextDesc; - ACPI_FUNCTION_TRACE_PTR ("TbDeleteSingleTable", TableDesc); + ACPI_FUNCTION_TRACE_PTR ("AcpiTbUninstallTable", TableDesc); if (!TableDesc) diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c index 4b66ac9..8ccbd2b 100644 --- a/sys/contrib/dev/acpica/tbutils.c +++ b/sys/contrib/dev/acpica/tbutils.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbutils - Table manipulation utilities - * $Revision: 51 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -118,7 +118,6 @@ #include "acpi.h" #include "actables.h" -#include "acinterp.h" #define _COMPONENT ACPI_TABLES @@ -187,7 +186,7 @@ AcpiTbHandleToObject ( * name * 3) Table must be readable for length specified in the header * 4) Table checksum must be valid (with the exception of the FACS - * which has no checksum for some odd reason) + * which has no checksum because it contains variable fields) * ******************************************************************************/ @@ -212,7 +211,7 @@ AcpiTbValidateTableHeader ( /* Ensure that the signature is 4 ASCII characters */ - ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, &TableHeader->Signature); + ACPI_MOVE_UNALIGNED32_TO_32 (&Signature, TableHeader->Signature); if (!AcpiUtValidAcpiName (Signature)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -260,11 +259,11 @@ AcpiTbValidateTableHeader ( ACPI_STATUS AcpiTbMapAcpiTable ( ACPI_PHYSICAL_ADDRESS PhysicalAddress, - UINT32 *Size, + ACPI_SIZE *Size, ACPI_TABLE_HEADER **LogicalAddress) { ACPI_TABLE_HEADER *Table; - UINT32 TableSize = *Size; + ACPI_SIZE TableSize = *Size; ACPI_STATUS Status = AE_OK; @@ -286,24 +285,29 @@ AcpiTbMapAcpiTable ( /* Extract the full table length before we delete the mapping */ - TableSize = Table->Length; + TableSize = (ACPI_SIZE) Table->Length; +#if 0 +/* We don't want to validate the header here. */ /* * Validate the header and delete the mapping. * We will create a mapping for the full table below. */ Status = AcpiTbValidateTableHeader (Table); +#endif /* Always unmap the memory for the header */ AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER)); +#if 0 /* Exit if header invalid */ if (ACPI_FAILURE (Status)) { return (Status); } +#endif } /* Map the physical memory for the correct length */ @@ -358,7 +362,7 @@ AcpiTbVerifyTableChecksum ( if (Checksum) { ACPI_REPORT_WARNING (("Invalid checksum (%X) in table %4.4s\n", - Checksum, (char *) &TableHeader->Signature)); + Checksum, TableHeader->Signature)); Status = AE_BAD_CHECKSUM; } diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c index 1162ff8..d040a94 100644 --- a/sys/contrib/dev/acpica/tbxface.c +++ b/sys/contrib/dev/acpica/tbxface.c @@ -2,7 +2,7 @@ * * Module Name: tbxface - Public interfaces to the ACPI subsystem * ACPI table oriented interfaces - * $Revision: 52 $ + * $Revision: 57 $ * *****************************************************************************/ @@ -119,7 +119,6 @@ #include "acpi.h" #include "acnamesp.h" -#include "acinterp.h" #include "actables.h" @@ -186,7 +185,7 @@ AcpiLoadTables (void) /* Now get the rest of the tables */ - Status = AcpiTbGetAllTables (NumberOfTables, NULL); + Status = AcpiTbGetAllTables (NumberOfTables); if (ACPI_FAILURE (Status)) { ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n", @@ -264,7 +263,7 @@ AcpiLoadTable ( /* Install the new table into the local data structures */ - Status = AcpiTbInstallTable (NULL, &TableInfo); + Status = AcpiTbInstallTable (&TableInfo); if (ACPI_FAILURE (Status)) { /* Free table allocated by AcpiTbGetTable */ @@ -298,7 +297,7 @@ AcpiLoadTable ( { /* Uninstall table and free the buffer */ - AcpiTbUninstallTable (TableInfo.InstalledDesc); + (void) AcpiTbUninstallTable (TableInfo.InstalledDesc); } return_ACPI_STATUS (Status); @@ -466,7 +465,7 @@ AcpiGetTable ( { ACPI_TABLE_HEADER *TblPtr; ACPI_STATUS Status; - UINT32 TableLength; + ACPI_SIZE TableLength; ACPI_FUNCTION_TRACE ("AcpiGetTable"); @@ -523,7 +522,7 @@ AcpiGetTable ( } else { - TableLength = TblPtr->Length; + TableLength = (ACPI_SIZE) TblPtr->Length; } /* Validate/Allocate/Clear caller buffer */ diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c index 0017ddc..1234c22 100644 --- a/sys/contrib/dev/acpica/tbxfroot.c +++ b/sys/contrib/dev/acpica/tbxfroot.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbxfroot - Find the root ACPI table (RSDT) - * $Revision: 61 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -218,8 +218,8 @@ AcpiGetFirmwareTable ( ACPI_TABLE_HEADER *RsdtPtr = NULL; ACPI_TABLE_HEADER *TablePtr; ACPI_STATUS Status; - UINT32 RsdtSize = 0; - UINT32 TableSize; + ACPI_SIZE RsdtSize = 0; + ACPI_SIZE TableSize; UINT32 TableCount; UINT32 i; UINT32 j; @@ -290,16 +290,16 @@ AcpiGetFirmwareTable ( } } - 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 and validate it */ AcpiTbGetRsdtAddress (&Address); + 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))); + Status = AcpiTbGetTablePointer (&Address, Flags, &RsdtSize, &RsdtPtr); if (ACPI_FAILURE (Status)) { @@ -385,7 +385,7 @@ Cleanup: /* TBD: Move to a new file */ -#ifndef _IA16 +#if ACPI_MACHINE_WIDTH != 16 /******************************************************************************* * @@ -536,7 +536,7 @@ AcpiTbFindRsdp ( /* Found it, return the physical address */ PhysAddr = LO_RSDP_WINDOW_BASE; - PhysAddr += (MemRover - TablePtr); + PhysAddr += ACPI_PTR_DIFF (MemRover,TablePtr); TableInfo->PhysicalAddress = PhysAddr; return_ACPI_STATUS (AE_OK); @@ -560,7 +560,7 @@ AcpiTbFindRsdp ( /* Found it, return the physical address */ PhysAddr = HI_RSDP_WINDOW_BASE; - PhysAddr += (MemRover - TablePtr); + PhysAddr += ACPI_PTR_DIFF (MemRover, TablePtr); TableInfo->PhysicalAddress = PhysAddr; return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index dbbd024..6e4c5ac 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utalloc - local cache and memory allocation routines - * $Revision: 121 $ + * $Revision: 127 $ * *****************************************************************************/ @@ -117,10 +117,6 @@ #define __UTALLOC_C__ #include "acpi.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acglobal.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utalloc") @@ -172,11 +168,11 @@ AcpiUtReleaseToCache ( /* Mark the object as cached */ ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize); - ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_CACHED_OBJECT); + ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED); /* Put the object at the head of the cache list */ - * (char **) (((char *) Object) + CacheInfo->LinkOffset) = CacheInfo->ListHead; + * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))) = CacheInfo->ListHead; CacheInfo->ListHead = Object; CacheInfo->CacheDepth++; @@ -225,7 +221,7 @@ AcpiUtAcquireFromCache ( /* There is an object available, use it */ Object = CacheInfo->ListHead; - CacheInfo->ListHead = * (char **) (((char *) Object) + CacheInfo->LinkOffset); + CacheInfo->ListHead = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))); ACPI_MEM_TRACKING (CacheInfo->CacheHits++); CacheInfo->CacheDepth--; @@ -292,7 +288,7 @@ AcpiUtDeleteGenericCache ( { /* Delete one cached state object */ - Next = * (char **) (((char *) CacheInfo->ListHead) + CacheInfo->LinkOffset); + Next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) CacheInfo->ListHead)[CacheInfo->LinkOffset]))); ACPI_MEM_FREE (CacheInfo->ListHead); CacheInfo->ListHead = Next; @@ -472,7 +468,7 @@ AcpiUtAllocate ( /* Report allocation error */ _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtAllocate: Could not allocate size %X\n", Size)); + ("UtAllocate: Could not allocate size %X\n", (UINT32) Size)); return_PTR (NULL); } @@ -524,7 +520,7 @@ AcpiUtCallocate ( /* Report allocation error */ _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtCallocate: Could not allocate size %X\n", Size)); + ("UtCallocate: Could not allocate size %X\n", (UINT32) Size)); return_PTR (NULL); } @@ -629,7 +625,7 @@ AcpiUtCallocateAndTrack ( /* Report allocation error */ _ACPI_REPORT_ERROR (Module, Line, Component, - ("UtCallocate: Could not allocate size %X\n", Size)); + ("UtCallocate: Could not allocate size %X\n", (UINT32) Size)); return (NULL); } @@ -671,6 +667,7 @@ AcpiUtFreeAndTrack ( UINT32 Line) { ACPI_DEBUG_MEM_BLOCK *DebugBlock; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE_PTR ("UtFree", Allocation); @@ -684,14 +681,20 @@ AcpiUtFreeAndTrack ( return_VOID; } - DebugBlock = (ACPI_DEBUG_MEM_BLOCK *) - (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)); + DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK, + (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER))); AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++; AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size; - AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock, - Component, Module, Line); + Status = AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock, + Component, Module, Line); + if (ACPI_FAILURE (Status)) + { + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n", + AcpiFormatException (Status))); + } + AcpiOsFree (DebugBlock); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation)); @@ -994,6 +997,7 @@ AcpiUtDumpAllocations ( NATIVE_CHAR *Module) { ACPI_DEBUG_MEM_BLOCK *Element; + ACPI_DESCRIPTOR *Descriptor; UINT32 NumOutstanding = 0; @@ -1016,30 +1020,31 @@ AcpiUtDumpAllocations ( { /* Ignore allocated objects that are in a cache */ - if (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type != ACPI_CACHED_OBJECT) + Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace); + if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED) { AcpiOsPrintf ("%p Len %04X %9.9s-%d ", - &Element->UserSpace, Element->Size, Element->Module, + Descriptor, Element->Size, Element->Module, Element->Line); /* Most of the elements will be internal objects. */ - switch (ACPI_GET_DESCRIPTOR_TYPE (&Element->UserSpace)) + switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor)) { - case ACPI_DESC_TYPE_INTERNAL: - AcpiOsPrintf ("ObjType %12.12s R%d", - AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.Type), - ((ACPI_OPERAND_OBJECT *)(&Element->UserSpace))->Common.ReferenceCount); + case ACPI_DESC_TYPE_OPERAND: + AcpiOsPrintf ("ObjType %12.12s R%hd", + AcpiUtGetTypeName (Descriptor->Object.Common.Type), + Descriptor->Object.Common.ReferenceCount); break; case ACPI_DESC_TYPE_PARSER: - AcpiOsPrintf ("ParseObj Opcode %04X", - ((ACPI_PARSE_OBJECT *)(&Element->UserSpace))->Opcode); + AcpiOsPrintf ("ParseObj AmlOpcode %04hX", + Descriptor->Op.Asl.AmlOpcode); break; case ACPI_DESC_TYPE_NAMED: AcpiOsPrintf ("Node %4.4s", - (char *) &((ACPI_NAMESPACE_NODE *)(&Element->UserSpace))->Name); + Descriptor->Node.Name.Ascii); break; case ACPI_DESC_TYPE_STATE: @@ -1081,6 +1086,10 @@ AcpiUtDumpAllocations ( case ACPI_DESC_TYPE_STATE_THREAD: AcpiOsPrintf ("THREAD StateObj"); break; + + default: + /* All types should appear above */ + break; } AcpiOsPrintf ( "\n"); @@ -1097,7 +1106,7 @@ AcpiUtDumpAllocations ( if (!NumOutstanding) { ACPI_DEBUG_PRINT ((ACPI_DB_OK, - "No outstanding allocations.\n")); + "No outstanding allocations.\n")); } else { diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utclib.c index 01245ea..c94a70b 100644 --- a/sys/contrib/dev/acpica/utclib.c +++ b/sys/contrib/dev/acpica/utclib.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: cmclib - Local implementation of C library functions - * $Revision: 43 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -118,11 +118,6 @@ #define __CMCLIB_C__ #include "acpi.h" -#include "acevents.h" -#include "achware.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" /* * These implementations of standard C Library routines can optionally be @@ -130,7 +125,7 @@ * than an inline or assembly implementation */ -#define _COMPONENT MISCELLANEOUS +#define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("cmclib") @@ -295,7 +290,7 @@ AcpiUtStrcmp ( * ******************************************************************************/ -UINT32 +int AcpiUtStrncmp ( const NATIVE_CHAR *String1, const NATIVE_CHAR *String2, @@ -472,19 +467,7 @@ AcpiUtMemset ( #define NEGATIVE 1 #define POSITIVE 0 - -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space */ -#define _ACPI_UP 0x01 /* 'A'-'Z' */ -#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ - -static const UINT8 _acpi_ctype[257] = { +const UINT8 _acpi_ctype[257] = { _ACPI_CN, /* 0x0 0. */ _ACPI_CN, /* 0x1 1. */ _ACPI_CN, /* 0x2 2. */ @@ -643,9 +626,9 @@ static const UINT8 _acpi_ctype[257] = { * ******************************************************************************/ -UINT32 +int AcpiUtToUpper ( - UINT32 c) + int c) { return (IS_LOWER(c) ? ((c)-0x20) : (c)); @@ -664,9 +647,9 @@ AcpiUtToUpper ( * ******************************************************************************/ -UINT32 +int AcpiUtToLower ( - UINT32 c) + int c) { return (IS_UPPER(c) ? ((c)+0x20) : (c)); @@ -832,11 +815,11 @@ AcpiUtStrtoul ( { if (IS_DIGIT (*String)) { - index = *String - '0'; + index = (UINT32) ((UINT8) *String - '0'); } else { - index = AcpiUtToUpper (*String); + index = (UINT32) AcpiUtToUpper (*String); if (IS_UPPER (index)) { index = index - 'A' + 10; diff --git a/sys/contrib/dev/acpica/utcopy.c b/sys/contrib/dev/acpica/utcopy.c index e215f67..3b67bfb 100644 --- a/sys/contrib/dev/acpica/utcopy.c +++ b/sys/contrib/dev/acpica/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utcopy - Internal to external object translation utilities - * $Revision: 95 $ + * $Revision: 101 $ * *****************************************************************************/ @@ -117,7 +117,6 @@ #define __UTCOPY_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" #include "amlcode.h" @@ -150,7 +149,6 @@ AcpiUtCopyIsimpleToEsimple ( UINT8 *DataSpace, ACPI_SIZE *BufferSpaceUsed) { - ACPI_BUFFER Buffer; ACPI_STATUS Status = AE_OK; @@ -161,7 +159,7 @@ AcpiUtCopyIsimpleToEsimple ( /* * Check for NULL object case (could be an uninitialized - * package element + * package element) */ if (!InternalObject) { @@ -176,20 +174,20 @@ AcpiUtCopyIsimpleToEsimple ( * In general, the external object will be the same type as * the internal object */ - ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); /* However, only a limited number of external types are supported */ - switch (InternalObject->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (InternalObject)) { case ACPI_TYPE_STRING: ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; ExternalObject->String.Length = InternalObject->String.Length; - *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length + 1); + *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ((ACPI_SIZE) InternalObject->String.Length + 1); ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer, - InternalObject->String.Length + 1); + (ACPI_SIZE) InternalObject->String.Length + 1); break; @@ -217,45 +215,9 @@ AcpiUtCopyIsimpleToEsimple ( */ switch (InternalObject->Reference.Opcode) { - case AML_ZERO_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = 0; - break; - - case AML_ONE_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = 1; - break; - - case AML_ONES_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = ACPI_INTEGER_MAX; - break; - - case AML_REVISION_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = ACPI_CA_SUPPORT_LEVEL; - break; - case AML_INT_NAMEPATH_OP: - /* - * This is a named reference, get the string. We already know that - * we have room for it, use max length - */ - ExternalObject->Type = ACPI_TYPE_STRING; - ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; - - Buffer.Length = MAX_STRING_LENGTH; - Buffer.Pointer = DataSpace; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) InternalObject->Reference.Node, - &Buffer); - - /* Converted (external) string length is returned from above */ - - ExternalObject->String.Length = Buffer.Length; - *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (Buffer.Length); - break; + /* For namepath, return the object handle ("reference") */ default: /* @@ -271,9 +233,9 @@ AcpiUtCopyIsimpleToEsimple ( case ACPI_TYPE_PROCESSOR: - ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId; + ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId; ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address; - ExternalObject->Processor.PblkLength = InternalObject->Processor.Length; + ExternalObject->Processor.PblkLength = InternalObject->Processor.Length; break; @@ -354,7 +316,7 @@ AcpiUtCopyIelementToEelement ( */ TargetObject->Type = ACPI_TYPE_PACKAGE; TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Package.Elements = (ACPI_OBJECT *) Info->FreeSpace; + TargetObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace); /* * Pass the new package object back to the package walk routine @@ -366,7 +328,7 @@ AcpiUtCopyIelementToEelement ( * update the buffer length counter */ ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD ( - TargetObject->Package.Count * sizeof (ACPI_OBJECT)); + (ACPI_SIZE) TargetObject->Package.Count * sizeof (ACPI_OBJECT)); break; @@ -416,7 +378,7 @@ AcpiUtCopyIpackageToEpackage ( /* * First package at head of the buffer */ - ExternalObject = (ACPI_OBJECT *) Buffer; + ExternalObject = ACPI_CAST_PTR (ACPI_OBJECT, Buffer); /* * Free space begins right after the first package @@ -426,9 +388,9 @@ AcpiUtCopyIpackageToEpackage ( Info.NumPackages = 1; Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = (ACPI_OBJECT *) Info.FreeSpace; + ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace); /* * Build an array of ACPI_OBJECTS in the buffer @@ -470,7 +432,7 @@ AcpiUtCopyIobjectToEobject ( ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject"); - if (InternalObject->Common.Type == ACPI_TYPE_PACKAGE) + if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE) { /* * Package object: Copy all subobjects (including @@ -558,7 +520,7 @@ AcpiUtCopyEsimpleToIsimple ( case ACPI_TYPE_STRING: - InternalObject->String.Pointer = ACPI_MEM_CALLOCATE (ExternalObject->String.Length + 1); + InternalObject->String.Pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) ExternalObject->String.Length + 1); if (!InternalObject->String.Pointer) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -592,6 +554,10 @@ AcpiUtCopyEsimpleToIsimple ( InternalObject->Integer.Value = ExternalObject->Integer.Value; break; + + default: + /* Other types can't get here */ + break; } *RetInternalObject = InternalObject; @@ -651,7 +617,7 @@ AcpiUtCopyEpackageToIpackage ( FreeSpace = Buffer + sizeof(ACPI_OBJECT); - ExternalObject->Type = InternalObject->Common.Type; + ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject); ExternalObject->Package.Count = InternalObject->Package.Count; ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace; @@ -756,7 +722,7 @@ AcpiUtCopySimpleObject ( /* Handle the objects with extra data */ - switch (DestDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (DestDesc)) { case ACPI_TYPE_BUFFER: @@ -764,6 +730,7 @@ AcpiUtCopySimpleObject ( DestDesc->Common.Flags = SourceDesc->Common.Flags; /* Fall through to common string/buffer case */ + /*lint -fallthrough */ case ACPI_TYPE_STRING: @@ -786,6 +753,10 @@ AcpiUtCopySimpleObject ( SourceDesc->String.Length); } break; + + default: + /* Nothing to do for other simple objects */ + break; } return (AE_OK); @@ -831,7 +802,7 @@ AcpiUtCopyIelementToIelement ( /* * This is a simple object, just copy it */ - TargetObject = AcpiUtCreateInternalObject (SourceObject->Common.Type); + TargetObject = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (SourceObject)); if (!TargetObject) { return (AE_NO_MEMORY); @@ -908,16 +879,16 @@ AcpiUtCopyIpackageToIpackage ( ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage"); - DestObj->Common.Type = SourceObj->Common.Type; + DestObj->Common.Type = ACPI_GET_OBJECT_TYPE (SourceObj); DestObj->Common.Flags = SourceObj->Common.Flags; DestObj->Package.Count = SourceObj->Package.Count; - /* * Create the object array and walk the source package tree */ - DestObj->Package.Elements = ACPI_MEM_CALLOCATE ((SourceObj->Package.Count + 1) * - sizeof (void *)); + DestObj->Package.Elements = ACPI_MEM_CALLOCATE ( + ((ACPI_SIZE) SourceObj->Package.Count + 1) * + sizeof (void *)); if (!DestObj->Package.Elements) { ACPI_REPORT_ERROR ( @@ -970,7 +941,7 @@ AcpiUtCopyIobjectToIobject ( /* Create the top level object */ - *DestDesc = AcpiUtCreateInternalObject (SourceDesc->Common.Type); + *DestDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (SourceDesc)); if (!*DestDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -978,7 +949,7 @@ AcpiUtCopyIobjectToIobject ( /* Copy the object and possible subobjects */ - if (SourceDesc->Common.Type == ACPI_TYPE_PACKAGE) + if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_PACKAGE) { Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc, WalkState); diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index 76dcd25..2280075 100644 --- a/sys/contrib/dev/acpica/utdebug.c +++ b/sys/contrib/dev/acpica/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utdebug - Debug print routines - * $Revision: 97 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -122,13 +122,12 @@ ACPI_MODULE_NAME ("utdebug") -UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; -char *AcpiGbl_FnEntryStr = "----Entry"; -char *AcpiGbl_FnExitStr = "----Exit-"; - - #ifdef ACPI_DEBUG +static UINT32 AcpiGbl_PrevThreadId = 0xFFFFFFFF; +static char *AcpiGbl_FnEntryStr = "----Entry"; +static char *AcpiGbl_FnExitStr = "----Exit-"; + /***************************************************************************** * @@ -227,7 +226,6 @@ AcpiUtDebugPrint ( return; } - /* * Thread tracking and context switch notification */ @@ -248,15 +246,14 @@ AcpiUtDebugPrint ( * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ - AcpiOsPrintf ("%8s-%04d ", DbgInfo->ModuleName, LineNumber); + AcpiOsPrintf ("%8s-%04ld ", DbgInfo->ModuleName, LineNumber); if (ACPI_LV_THREADS & AcpiDbgLevel) { - AcpiOsPrintf ("[%04X] ", ThreadId, AcpiGbl_NestingLevel, DbgInfo->ProcName); + AcpiOsPrintf ("[%04lX] ", ThreadId, AcpiGbl_NestingLevel, DbgInfo->ProcName); } - AcpiOsPrintf ("[%02d] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName); - + AcpiOsPrintf ("[%02ld] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName); va_start (args, Format); AcpiOsVprintf (Format, args); @@ -301,7 +298,6 @@ AcpiUtDebugPrintRaw ( } va_start (args, Format); - AcpiOsVprintf (Format, args); } @@ -596,8 +592,8 @@ AcpiUtDumpBuffer ( UINT32 Display, UINT32 ComponentId) { - UINT32 i = 0; - UINT32 j; + NATIVE_UINT i = 0; + NATIVE_UINT j; UINT32 Temp32; UINT8 BufChar; @@ -626,7 +622,6 @@ AcpiUtDumpBuffer ( AcpiOsPrintf ("%05X ", i); - /* Print 16 hex chars */ for (j = 0; j < 16;) @@ -683,12 +678,10 @@ AcpiUtDumpBuffer ( } } - /* * Print the ASCII equivalent characters * But watch out for the bad unprintable ones... */ - for (j = 0; j < 16; j++) { if (i + j >= Count) diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c index 3eb0dcb..08c5ff1 100644 --- a/sys/contrib/dev/acpica/utdelete.c +++ b/sys/contrib/dev/acpica/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utdelete - object deletion and reference count utilities - * $Revision: 88 $ + * $Revision: 91 $ * ******************************************************************************/ @@ -119,8 +119,6 @@ #include "acpi.h" #include "acinterp.h" #include "acnamesp.h" -#include "actables.h" -#include "acparser.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utdelete") @@ -160,7 +158,7 @@ AcpiUtDeleteInternalObj ( * Must delete or free any pointers within the object that are not * actual ACPI objects (for example, a raw buffer pointer). */ - switch (Object->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (Object)) { case ACPI_TYPE_STRING: @@ -209,7 +207,7 @@ AcpiUtDeleteInternalObj ( Object, Object->Mutex.Semaphore)); AcpiExUnlinkMutex (Object); - AcpiOsDeleteSemaphore (Object->Mutex.Semaphore); + (void) AcpiOsDeleteSemaphore (Object->Mutex.Semaphore); break; @@ -218,7 +216,7 @@ AcpiUtDeleteInternalObj ( ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n", Object, Object->Event.Semaphore)); - AcpiOsDeleteSemaphore (Object->Event.Semaphore); + (void) AcpiOsDeleteSemaphore (Object->Event.Semaphore); Object->Event.Semaphore = NULL; break; @@ -231,7 +229,7 @@ AcpiUtDeleteInternalObj ( if (Object->Method.Semaphore) { - AcpiOsDeleteSemaphore (Object->Method.Semaphore); + (void) AcpiOsDeleteSemaphore (Object->Method.Semaphore); Object->Method.Semaphore = NULL; } break; @@ -292,7 +290,7 @@ AcpiUtDeleteInternalObj ( /* Now the object can be safely deleted */ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", - Object, AcpiUtGetTypeName (Object->Common.Type))); + Object, AcpiUtGetObjectTypeName (Object))); AcpiUtDeleteObjectDesc (Object); return_VOID; @@ -305,14 +303,14 @@ AcpiUtDeleteInternalObj ( * * PARAMETERS: *ObjList - Pointer to the list to be deleted * - * RETURN: Status - the status of the call + * RETURN: None * * DESCRIPTION: This function deletes an internal object list, including both * simple objects and package objects * ******************************************************************************/ -ACPI_STATUS +void AcpiUtDeleteInternalObjectList ( ACPI_OPERAND_OBJECT **ObjList) { @@ -332,7 +330,7 @@ AcpiUtDeleteInternalObjectList ( /* Free the combined parameter pointer list and object array */ ACPI_MEM_FREE (ObjList); - return_ACPI_STATUS (AE_OK); + return_VOID; } @@ -402,7 +400,7 @@ AcpiUtUpdateRefCount ( Object, NewCount)); } - if (Object->Common.Type == ACPI_TYPE_METHOD) + if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD) { ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); @@ -516,7 +514,7 @@ AcpiUtUpdateObjectReference ( * All sub-objects must have their reference count incremented also. * Different object types have different subobjects. */ - switch (Object->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (Object)) { case ACPI_TYPE_DEVICE: @@ -524,7 +522,7 @@ AcpiUtUpdateObjectReference ( Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } AcpiUtUpdateRefCount (Object->Device.SysHandler, Action); @@ -564,7 +562,7 @@ AcpiUtUpdateObjectReference ( Object->Package.Elements[i], Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } } break; @@ -574,10 +572,9 @@ AcpiUtUpdateObjectReference ( Status = AcpiUtCreateUpdateStateAndPush ( Object->BufferField.BufferObj, Action, &StateList); - if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; @@ -588,7 +585,7 @@ AcpiUtUpdateObjectReference ( Object->Field.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; @@ -599,14 +596,14 @@ AcpiUtUpdateObjectReference ( Object->BankField.BankObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } Status = AcpiUtCreateUpdateStateAndPush ( Object->BankField.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; @@ -617,20 +614,21 @@ AcpiUtUpdateObjectReference ( Object->IndexField.IndexObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } Status = AcpiUtCreateUpdateStateAndPush ( Object->IndexField.DataObj, Action, &StateList); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto ErrorExit; } break; case ACPI_TYPE_REGION: case INTERNAL_TYPE_REFERENCE: + default: /* No subobjects */ break; @@ -649,6 +647,14 @@ AcpiUtUpdateObjectReference ( } return_ACPI_STATUS (AE_OK); + + +ErrorExit: + + ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", + AcpiFormatException (Status))); + + return_ACPI_STATUS (Status); } @@ -684,7 +690,7 @@ AcpiUtAddReference ( /* * We have a valid ACPI internal object, now increment the reference count */ - AcpiUtUpdateObjectReference (Object, REF_INCREMENT); + (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT); return_VOID; } @@ -736,7 +742,7 @@ AcpiUtRemoveReference ( * if the reference count becomes 0. (Must also decrement the ref count * of all subobjects!) */ - AcpiUtUpdateObjectReference (Object, REF_DECREMENT); + (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT); return_VOID; } diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c index 55560dde..eb5fbab 100644 --- a/sys/contrib/dev/acpica/uteval.c +++ b/sys/contrib/dev/acpica/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: uteval - Object evaluation - * $Revision: 38 $ + * $Revision: 40 $ * *****************************************************************************/ @@ -163,12 +163,12 @@ AcpiUtEvaluateNumericObject ( if (Status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s on %4.4s was not found\n", - ObjectName, (char *) &DeviceNode->Name)); + ObjectName, DeviceNode->Name.Ascii)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s on %4.4s failed with status %s\n", - ObjectName, (char *) &DeviceNode->Name, + ObjectName, DeviceNode->Name.Ascii, AcpiFormatException (Status))); } @@ -187,12 +187,12 @@ AcpiUtEvaluateNumericObject ( /* Is the return object of the correct type? */ - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER) { Status = AE_TYPE; ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Type returned from %s was not a number: %X \n", - ObjectName, ObjDesc->Common.Type)); + "Type returned from %s was not an Integer: %X \n", + ObjectName, ACPI_GET_OBJECT_TYPE (ObjDesc))); } else { @@ -248,12 +248,12 @@ AcpiUtExecute_HID ( if (Status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_HID on %4.4s was not found\n", - (char *) &DeviceNode->Name)); + DeviceNode->Name.Ascii)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_HID on %4.4s failed %s\n", - (char *) &DeviceNode->Name, AcpiFormatException (Status))); + DeviceNode->Name.Ascii, AcpiFormatException (Status))); } return_ACPI_STATUS (Status); @@ -271,17 +271,18 @@ AcpiUtExecute_HID ( * A _HID can return either a Number (32 bit compressed EISA ID) or * a string */ - if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER) && + (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING)) { Status = AE_TYPE; ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Type returned from _HID not a number or string: %s(%X) \n", - AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); + AcpiUtGetObjectTypeName (ObjDesc), + ACPI_GET_OBJECT_TYPE (ObjDesc))); } else { - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { /* Convert the Numeric HID to string */ @@ -339,12 +340,12 @@ AcpiUtExecute_CID ( if (Status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_CID on %4.4s was not found\n", - (char *)&DeviceNode->Name)); + DeviceNode->Name.Ascii)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_CID on %4.4s failed %s\n", - (char *)&DeviceNode->Name, AcpiFormatException (Status))); + DeviceNode->Name.Ascii, AcpiFormatException (Status))); } return_ACPI_STATUS (Status); @@ -363,7 +364,7 @@ AcpiUtExecute_CID ( * IDs. Each compatible ID can be a Number (32 bit compressed EISA ID) or * string (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss"). */ - switch (ObjDesc->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { case ACPI_TYPE_INTEGER: @@ -389,7 +390,8 @@ AcpiUtExecute_CID ( Status = AE_TYPE; ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Type returned from _CID not a number, string, or package: %s(%X) \n", - AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); + AcpiUtGetObjectTypeName (ObjDesc), + ACPI_GET_OBJECT_TYPE (ObjDesc))); break; } @@ -438,13 +440,13 @@ AcpiUtExecute_UID ( if (Status == AE_NOT_FOUND) { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_UID on %4.4s was not found\n", - (char *) &DeviceNode->Name)); + DeviceNode->Name.Ascii)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_UID on %4.4s failed %s\n", - (char *) &DeviceNode->Name, AcpiFormatException (Status))); + DeviceNode->Name.Ascii, AcpiFormatException (Status))); } return (Status); @@ -462,17 +464,17 @@ AcpiUtExecute_UID ( * A _UID can return either a Number (32 bit compressed EISA ID) or * a string */ - if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) + if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER) && + (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING)) { Status = AE_TYPE; ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Type returned from _UID was not a number or string: %X \n", - ObjDesc->Common.Type)); + ACPI_GET_OBJECT_TYPE (ObjDesc))); } else { - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { /* Convert the Numeric UID to string */ @@ -531,7 +533,7 @@ AcpiUtExecute_STA ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "_STA on %4.4s was not found, assuming present.\n", - (char *) &DeviceNode->Name)); + DeviceNode->Name.Ascii)); *Flags = 0x0F; Status = AE_OK; @@ -540,7 +542,7 @@ AcpiUtExecute_STA ( else if (ACPI_FAILURE (Status)) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "_STA on %4.4s failed %s\n", - (char *) &DeviceNode->Name, + DeviceNode->Name.Ascii, AcpiFormatException (Status))); } @@ -556,12 +558,12 @@ AcpiUtExecute_STA ( /* Is the return object of the correct type? */ - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER) { Status = AE_TYPE; ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Type returned from _STA was not a number: %X \n", - ObjDesc->Common.Type)); + ACPI_GET_OBJECT_TYPE (ObjDesc))); } else { diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c index c1dd2ee..617fbc6 100644 --- a/sys/contrib/dev/acpica/utinit.c +++ b/sys/contrib/dev/acpica/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utinit - Common ACPI subsystem initialization - * $Revision: 109 $ + * $Revision: 112 $ * *****************************************************************************/ @@ -118,7 +118,6 @@ #define __UTINIT_C__ #include "acpi.h" -#include "achware.h" #include "acnamesp.h" #include "acevents.h" @@ -149,7 +148,7 @@ AcpiUtFadtRegisterError ( { ACPI_REPORT_WARNING ( - ("Invalid FADT value %s=%lX at offset %lX FADT=%p\n", + ("Invalid FADT value %s=%X at offset %X FADT=%p\n", RegisterName, Value, Offset, AcpiGbl_FADT)); } @@ -283,7 +282,7 @@ AcpiUtTerminate (void) * ******************************************************************************/ -ACPI_STATUS +void AcpiUtSubsystemShutdown (void) { @@ -294,7 +293,7 @@ AcpiUtSubsystemShutdown (void) if (AcpiGbl_Shutdown) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n")); - return_ACPI_STATUS (AE_OK); + return_VOID; } /* Subsystem appears active, go ahead and shut it down */ @@ -316,7 +315,7 @@ AcpiUtSubsystemShutdown (void) /* Purge the local caches */ - AcpiPurgeCachedObjects (); + (void) AcpiPurgeCachedObjects (); /* Debug only - display leftover memory allocation, if any */ @@ -324,7 +323,7 @@ AcpiUtSubsystemShutdown (void) AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL); #endif - return_ACPI_STATUS (AE_OK); + return_VOID; } diff --git a/sys/contrib/dev/acpica/utmath.c b/sys/contrib/dev/acpica/utmath.c index 91eb436..cd77944 100644 --- a/sys/contrib/dev/acpica/utmath.c +++ b/sys/contrib/dev/acpica/utmath.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmath - Integer math support routines - * $Revision: 10 $ + * $Revision: 11 $ * ******************************************************************************/ @@ -293,7 +293,7 @@ AcpiUtDivide ( */ Partial1 = Quotient.Part.Lo * Divisor.Part.Hi; Partial2.Full = (ACPI_INTEGER) Quotient.Part.Lo * Divisor.Part.Lo; - Partial3.Full = Partial2.Part.Hi + Partial1; + Partial3.Full = (ACPI_INTEGER) Partial2.Part.Hi + Partial1; Remainder.Part.Hi = Partial3.Part.Lo; Remainder.Part.Lo = Partial2.Part.Lo; @@ -318,8 +318,8 @@ AcpiUtDivide ( } Remainder.Full = Remainder.Full - Dividend.Full; - Remainder.Part.Hi = -((INT32) Remainder.Part.Hi); - Remainder.Part.Lo = -((INT32) Remainder.Part.Lo); + Remainder.Part.Hi = (UINT32) -((INT32) Remainder.Part.Hi); + Remainder.Part.Lo = (UINT32) -((INT32) Remainder.Part.Lo); if (Remainder.Part.Lo) { diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c index 18c2901..e2a3eff 100644 --- a/sys/contrib/dev/acpica/utmisc.c +++ b/sys/contrib/dev/acpica/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: utmisc - common utility procedures - * $Revision: 67 $ + * $Revision: 78 $ * ******************************************************************************/ @@ -118,18 +118,90 @@ #define __UTMISC_C__ #include "acpi.h" -#include "acevents.h" -#include "achware.h" #include "acnamesp.h" -#include "acinterp.h" #include "amlcode.h" -#include "acdebug.h" +#include "acinterp.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utmisc") +/******************************************************************************* + * + * FUNCTION: AcpiUtDwordByteSwap + * + * PARAMETERS: Value - Value to be converted + * + * DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes) + * + ******************************************************************************/ + +UINT32 +AcpiUtDwordByteSwap ( + UINT32 Value) +{ + union + { + UINT32 Value; + UINT8 Bytes[4]; + } Out; + + union + { + UINT32 Value; + UINT8 Bytes[4]; + } In; + + + ACPI_FUNCTION_ENTRY (); + + + In.Value = Value; + + Out.Bytes[0] = In.Bytes[3]; + Out.Bytes[1] = In.Bytes[2]; + Out.Bytes[2] = In.Bytes[1]; + Out.Bytes[3] = In.Bytes[0]; + + return (Out.Value); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtSetIntegerWidth + * + * PARAMETERS: Revision From DSDT header + * + * RETURN: None + * + * DESCRIPTION: Set the global integer bit width based upon the revision + * of the DSDT. For Revision 1 and 0, Integers are 32 bits. + * For Revision 2 and above, Integers are 64 bits. Yes, this + * makes a difference. + * + ******************************************************************************/ + +void +AcpiUtSetIntegerWidth ( + UINT8 Revision) +{ + + if (Revision <= 1) + { + AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerByteWidth = 4; + } + else + { + AcpiGbl_IntegerBitWidth = 64; + AcpiGbl_IntegerByteWidth = 8; + } +} + + + #ifdef ACPI_DEBUG /******************************************************************************* * @@ -243,6 +315,169 @@ AcpiUtValidAcpiCharacter ( /******************************************************************************* * + * FUNCTION: AcpiUtStrtoul64 + * + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte is returned + * Base - Radix of the string + * + * RETURN: Converted value + * + * DESCRIPTION: Convert a string into an unsigned value. + * + ******************************************************************************/ +#define NEGATIVE 1 +#define POSITIVE 0 + +ACPI_STATUS +AcpiUtStrtoul64 ( + NATIVE_CHAR *String, + UINT32 Base, + ACPI_INTEGER *RetInteger) +{ + UINT32 Index; + ACPI_INTEGER ReturnValue = 0; + ACPI_STATUS Status = AE_OK; + ACPI_INTEGER Dividend; + ACPI_INTEGER Quotient; + + + *RetInteger = 0; + + switch (Base) + { + case 0: + case 8: + case 10: + case 16: + break; + + default: + /* + * The specified Base parameter is not in the domain of + * this function: + */ + return (AE_BAD_PARAMETER); + } + + /* + * skip over any white space in the buffer: + */ + while (ACPI_IS_SPACE (*String) || *String == '\t') + { + ++String; + } + + /* + * If the input parameter Base is zero, then we need to + * determine if it is octal, decimal, or hexadecimal: + */ + if (Base == 0) + { + if (*String == '0') + { + if (ACPI_TOLOWER (*(++String)) == 'x') + { + Base = 16; + ++String; + } + else + { + Base = 8; + } + } + else + { + Base = 10; + } + } + + /* + * For octal and hexadecimal bases, skip over the leading + * 0 or 0x, if they are present. + */ + if (Base == 8 && *String == '0') + { + String++; + } + + if (Base == 16 && + *String == '0' && + ACPI_TOLOWER (*(++String)) == 'x') + { + String++; + } + + /* Main loop: convert the string to an unsigned long */ + + while (*String) + { + if (ACPI_IS_DIGIT (*String)) + { + Index = ((UINT8) *String) - '0'; + } + else + { + Index = (UINT8) ACPI_TOUPPER (*String); + if (ACPI_IS_UPPER ((char) Index)) + { + Index = Index - 'A' + 10; + } + else + { + goto ErrorExit; + } + } + + if (Index >= Base) + { + goto ErrorExit; + } + + /* Check to see if value is out of range: */ + + Dividend = ACPI_INTEGER_MAX - (ACPI_INTEGER) Index; + (void) AcpiUtShortDivide (&Dividend, Base, &Quotient, NULL); + if (ReturnValue > Quotient) + { + goto ErrorExit; + } + + ReturnValue *= Base; + ReturnValue += Index; + ++String; + } + + *RetInteger = ReturnValue; + return (Status); + + +ErrorExit: + switch (Base) + { + case 8: + Status = AE_BAD_OCTAL_CONSTANT; + break; + + case 10: + Status = AE_BAD_DECIMAL_CONSTANT; + break; + + case 16: + Status = AE_BAD_HEX_CONSTANT; + break; + + default: + /* Base validated above */ + break; + } + + return (Status); +} + + +/******************************************************************************* + * * FUNCTION: AcpiUtStrupr * * PARAMETERS: SrcString - The source string to convert to @@ -341,7 +576,7 @@ AcpiUtMutexTerminate ( */ for (i = 0; i < NUM_MTX; i++) { - AcpiUtDeleteMutex (i); + (void) AcpiUtDeleteMutex (i); } return_VOID; @@ -1015,116 +1250,6 @@ AcpiUtDeleteGenericStateCache ( /******************************************************************************* * - * FUNCTION: AcpiUtResolveReference - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: Resolve a reference object to an actual value - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtResolveReference ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; - - - switch (ObjectType) - { - case ACPI_COPY_TYPE_SIMPLE: - - /* - * Simple object - check for a reference - */ - if (SourceObject->Common.Type == INTERNAL_TYPE_REFERENCE) - { - switch (SourceObject->Reference.Opcode) - { - case AML_ZERO_OP: - - SourceObject->Common.Type = ACPI_TYPE_INTEGER; - SourceObject->Integer.Value = 0; - break; - - case AML_ONE_OP: - - SourceObject->Common.Type = ACPI_TYPE_INTEGER; - SourceObject->Integer.Value = 1; - break; - - case AML_ONES_OP: - - SourceObject->Common.Type = ACPI_TYPE_INTEGER; - SourceObject->Integer.Value = ACPI_INTEGER_MAX; - break; - } - } - break; - - - case ACPI_COPY_TYPE_PACKAGE: - - /* Package object - nothing much to do here, let the walk handle it */ - - Info->NumPackages++; - State->Pkg.ThisTargetObj = NULL; - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiUtResolvePackageReferences - * - * PARAMETERS: ObjDesc - The Package object on which to resolve refs - * - * RETURN: Status - * - * DESCRIPTION: Walk through a package and turn internal references into values - * - ******************************************************************************/ - -ACPI_STATUS -AcpiUtResolvePackageReferences ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - ACPI_PKG_INFO Info; - ACPI_STATUS Status; - - - ACPI_FUNCTION_TRACE ("UtResolvePackageReferences"); - - - if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE) - { - /* The object must be a package */ - - ACPI_REPORT_ERROR (("Expecting a Package object\n")); - return_ACPI_STATUS (AE_TYPE); - } - - Info.Length = 0; - Info.ObjectSpace = 0; - Info.NumPackages = 1; - - Status = AcpiUtWalkPackageTree (ObjDesc, NULL, - AcpiUtResolveReference, &Info); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiUtWalkPackageTree * * PARAMETERS: ObjDesc - The Package object on which to resolve refs @@ -1173,8 +1298,8 @@ AcpiUtWalkPackageTree ( * case below. */ if ((!ThisSourceObj) || - (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_INTERNAL) || - (ThisSourceObj->Common.Type != ACPI_TYPE_PACKAGE)) + (ACPI_GET_DESCRIPTOR_TYPE (ThisSourceObj) != ACPI_DESC_TYPE_OPERAND) || + (ACPI_GET_OBJECT_TYPE (ThisSourceObj) != ACPI_TYPE_PACKAGE)) { Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, State, Context); diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index 6cdfa54..e751395 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utobject - ACPI object create/delete/size/cache routines - * $Revision: 68 $ + * $Revision: 76 $ * *****************************************************************************/ @@ -117,9 +117,7 @@ #define __UTOBJECT_C__ #include "acpi.h" -#include "acinterp.h" #include "acnamesp.h" -#include "actables.h" #include "amlcode.h" @@ -131,10 +129,9 @@ * * FUNCTION: AcpiUtCreateInternalObjectDbg * - * PARAMETERS: Address - Address of the memory to deallocate - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller + * PARAMETERS: ModuleName - Source file name of caller + * LineNumber - Line number of caller + * ComponentId - Component type of caller * Type - ACPI Type of the new object * * RETURN: Object - The new object. Null on failure @@ -192,6 +189,10 @@ AcpiUtCreateInternalObjectDbg ( Object->Common.NextObject = SecondObject; break; + + default: + /* All others have no secondary object */ + break; } /* Save the object type in the object descriptor */ @@ -212,7 +213,7 @@ AcpiUtCreateInternalObjectDbg ( * * FUNCTION: AcpiUtValidInternalObject * - * PARAMETERS: Operand - Object to be validated + * PARAMETERS: Object - Object to be validated * * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT * @@ -239,7 +240,7 @@ AcpiUtValidInternalObject ( switch (ACPI_GET_DESCRIPTOR_TYPE (Object)) { - case ACPI_DESC_TYPE_INTERNAL: + case ACPI_DESC_TYPE_OPERAND: /* The object appears to be a valid ACPI_OPERAND_OBJECT */ @@ -275,7 +276,6 @@ AcpiUtValidInternalObject ( * PARAMETERS: ModuleName - Caller's module name (for error output) * LineNumber - Caller's line number (for error output) * ComponentId - Caller's component ID (for error output) - * Message - Error message to use on failure * * RETURN: Pointer to newly allocated object descriptor. Null on error * @@ -305,13 +305,12 @@ AcpiUtAllocateObjectDescDbg ( return_PTR (NULL); } - /* Mark the descriptor type */ - ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL); + ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_OPERAND); ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p Size %X\n", - Object, sizeof (ACPI_OPERAND_OBJECT))); + Object, (UINT32) sizeof (ACPI_OPERAND_OBJECT))); return_PTR (Object); } @@ -321,7 +320,7 @@ AcpiUtAllocateObjectDescDbg ( * * FUNCTION: AcpiUtDeleteObjectDesc * - * PARAMETERS: Object - Acpi internal object to be deleted + * PARAMETERS: Object - An Acpi internal object to be deleted * * RETURN: None. * @@ -338,7 +337,7 @@ AcpiUtDeleteObjectDesc ( /* Object must be an ACPI_OPERAND_OBJECT */ - if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_INTERNAL) + if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Obj %p is not an ACPI object\n", Object)); @@ -357,7 +356,7 @@ AcpiUtDeleteObjectDesc ( * * PARAMETERS: None * - * RETURN: Status + * RETURN: None * * DESCRIPTION: Purge the global state object cache. Used during subsystem * termination. @@ -381,12 +380,12 @@ AcpiUtDeleteObjectCache ( * FUNCTION: AcpiUtGetSimpleObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length is returned + * *ObjLength - Where the length is returned * * RETURN: Status * * DESCRIPTION: This function is called to determine the space required to - * contain a simple object for return to an API user. + * contain a simple object for return to an external user. * * The length includes the object structure plus any additional * needed space. @@ -413,7 +412,6 @@ AcpiUtGetSimpleObjectSize ( return_ACPI_STATUS (AE_OK); } - /* Start with the length of the Acpi object */ Length = sizeof (ACPI_OBJECT); @@ -426,26 +424,23 @@ AcpiUtGetSimpleObjectSize ( return_ACPI_STATUS (Status); } - /* * The final length depends on the object type * Strings and Buffers are packed right up against the parent object and * must be accessed bytewise or there may be alignment problems on * certain processors */ - - switch (InternalObject->Common.Type) + switch (ACPI_GET_OBJECT_TYPE (InternalObject)) { - case ACPI_TYPE_STRING: - Length += InternalObject->String.Length + 1; + Length += (ACPI_SIZE) InternalObject->String.Length + 1; break; case ACPI_TYPE_BUFFER: - Length += InternalObject->Buffer.Length; + Length += (ACPI_SIZE) InternalObject->Buffer.Length; break; @@ -463,15 +458,6 @@ AcpiUtGetSimpleObjectSize ( switch (InternalObject->Reference.Opcode) { - case AML_ZERO_OP: - case AML_ONE_OP: - case AML_ONES_OP: - case AML_REVISION_OP: - - /* These Constant opcodes will be resolved to Integers */ - - break; - case AML_INT_NAMEPATH_OP: /* @@ -485,7 +471,7 @@ AcpiUtGetSimpleObjectSize ( /* * No other reference opcodes are supported. - * Notably, Locals and Args are not supported, by this may be + * Notably, Locals and Args are not supported, but this may be * required eventually. */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -500,12 +486,11 @@ AcpiUtGetSimpleObjectSize ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n", - InternalObject->Common.Type, InternalObject)); + ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject)); Status = AE_TYPE; break; } - /* * Account for the space required by the object rounded up to the next * multiple of the machine word size. This keeps each object aligned @@ -523,7 +508,7 @@ AcpiUtGetSimpleObjectSize ( * * PARAMETERS: ACPI_PKG_CALLBACK * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: Get the length of one package element. * @@ -566,6 +551,13 @@ AcpiUtGetElementLength ( Info->NumPackages++; State->Pkg.ThisTargetObj = NULL; break; + + + default: + + /* No other types allowed */ + + return (AE_BAD_PARAMETER); } return (Status); @@ -577,12 +569,12 @@ AcpiUtGetElementLength ( * FUNCTION: AcpiUtGetPackageObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length is returned + * *ObjLength - Where the length is returned * * RETURN: Status * * DESCRIPTION: This function is called to determine the space required to - * contain a package object for return to an API user. + * contain a package object for return to an external user. * * This is moderately complex since a package contains other * objects including packages. @@ -618,7 +610,7 @@ AcpiUtGetPackageObjectSize ( * Round up to the next machine word. */ Info.Length += ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) * - Info.NumPackages; + (ACPI_SIZE) Info.NumPackages; /* Return the total package length */ @@ -632,7 +624,7 @@ AcpiUtGetPackageObjectSize ( * FUNCTION: AcpiUtGetObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length will be returned + * *ObjLength - Where the length will be returned * * RETURN: Status * @@ -652,8 +644,8 @@ AcpiUtGetObjectSize( ACPI_FUNCTION_ENTRY (); - if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_INTERNAL) && - (InternalObject->Common.Type == ACPI_TYPE_PACKAGE)) + if ((ACPI_GET_DESCRIPTOR_TYPE (InternalObject) == ACPI_DESC_TYPE_OPERAND) && + (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)) { Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); } diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c index cd38e23..376fce9 100644 --- a/sys/contrib/dev/acpica/utxface.c +++ b/sys/contrib/dev/acpica/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: utxface - External interfaces for "global" ACPI functions - * $Revision: 92 $ + * $Revision: 96 $ * *****************************************************************************/ @@ -119,15 +119,10 @@ #include "acpi.h" #include "acevents.h" -#include "achware.h" #include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acdebug.h" -#include "acexcep.h" #include "acparser.h" #include "acdispat.h" - +#include "acdebug.h" #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utxface") @@ -198,7 +193,7 @@ AcpiInitializeSubsystem ( /* If configured, initialize the AML debugger */ - ACPI_DEBUGGER_EXEC (AcpiDbInitialize ()); + ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ()); return_ACPI_STATUS (Status); } @@ -236,7 +231,7 @@ AcpiEnableSubsystem ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n")); - Status = AcpiEvInstallDefaultAddressSpaceHandlers (); + Status = AcpiEvInitAddressSpaces (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -361,6 +356,9 @@ AcpiEnableSubsystem ( ACPI_STATUS AcpiTerminate (void) { + ACPI_STATUS Status; + + ACPI_FUNCTION_TRACE ("AcpiTerminate"); @@ -387,10 +385,8 @@ AcpiTerminate (void) /* Now we can shutdown the OS-dependent layer */ - AcpiOsTerminate (); - - - return_ACPI_STATUS (AE_OK); + Status = AcpiOsTerminate (); + return_ACPI_STATUS (Status); } @@ -519,6 +515,41 @@ AcpiGetSystemInfo ( /***************************************************************************** * + * FUNCTION: AcpiInstallInitializationHandler + * + * PARAMETERS: Handler - Callback procedure + * + * RETURN: Status + * + * DESCRIPTION: Install an initialization handler + * + * TBD: When a second function is added, must save the Function also. + * + ****************************************************************************/ + +ACPI_STATUS +AcpiInstallInitializationHandler ( + ACPI_INIT_HANDLER Handler, + UINT32 Function) +{ + + if (!Handler) + { + return (AE_BAD_PARAMETER); + } + + if (AcpiGbl_InitHandler) + { + return (AE_ALREADY_EXISTS); + } + + AcpiGbl_InitHandler = Handler; + return AE_OK; +} + + +/***************************************************************************** + * * FUNCTION: AcpiPurgeCachedObjects * * PARAMETERS: None |