diff options
author | msmith <msmith@FreeBSD.org> | 2001-05-29 19:52:40 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-05-29 19:52:40 +0000 |
commit | bc4d4229dc8150c1877e8673fb6be5be18487b6d (patch) | |
tree | a1bc1b7537f2d89240bd2e92ac027e82c5efeb6c /sys | |
parent | 3c0029a0e89e19ec6ede20d15284dabefb4466b0 (diff) | |
download | FreeBSD-src-bc4d4229dc8150c1877e8673fb6be5be18487b6d.zip FreeBSD-src-bc4d4229dc8150c1877e8673fb6be5be18487b6d.tar.gz |
Import the 20010518 Intel ACPI CA release. Note that Intel's directory layout
keeps changing, so to reduce repository thrash everything has been moved into
a single directory. (repo copy involved)
Diffstat (limited to 'sys')
130 files changed, 9394 insertions, 8536 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index b3c7ed6..8683e86e 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 55 $ + * $Revision: 64 $ * *****************************************************************************/ @@ -144,7 +144,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20010208 +#define ACPI_CA_VERSION 0x20010518 /* Maximum objects in the various object caches */ @@ -180,7 +180,7 @@ /* * Debugger threading model * Use single threaded if the entire subsystem is contained in an application - * Use multiple threaded when the the subsystem is running in the kernel. + * 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. @@ -239,6 +239,11 @@ #define HI_RSDP_WINDOW_SIZE 0x20000 #define RSDP_SCAN_STEP 16 +/* Maximum SpaceIds for Operation Regions */ + +#define ACPI_MAX_ADDRESS_SPACE 255 +#define ACPI_NUM_ADDRESS_SPACES 256 + #endif /* _ACCONFIG_H */ diff --git a/sys/contrib/dev/acpica/acdebug.h b/sys/contrib/dev/acpica/acdebug.h index 88a41b6..0a1c293 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: 41 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -127,7 +127,7 @@ extern int optind; extern NATIVE_CHAR *optarg; extern UINT8 *AmlPtr; -extern UINT32 AcpiAmlLength; +extern UINT32 AmlLength; extern BOOLEAN opt_tables; extern BOOLEAN opt_disasm; @@ -291,6 +291,10 @@ AcpiDbFindReferences ( NATIVE_CHAR *ObjectArg); void +AcpiDbDisplayLocks (void); + + +void AcpiDbDisplayResources ( NATIVE_CHAR *ObjectArg); @@ -394,7 +398,7 @@ AcpiDbCreateExecutionThreads ( * dbfileio - Debugger file I/O commands */ -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDbMatchArgument ( NATIVE_CHAR *UserArgument, ARGUMENT_INFO *Arguments); diff --git a/sys/contrib/dev/acpica/acdispat.h b/sys/contrib/dev/acpica/acdispat.h index 0a7b4d5..32b0d2e 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: 35 $ + * $Revision: 40 $ * *****************************************************************************/ @@ -123,12 +123,6 @@ #define NAMEOF_ARG_NTE "__A0" -/* For AcpiDsMethodDataSetValue */ - -#define MTH_TYPE_LOCAL 0 -#define MTH_TYPE_ARG 1 - - /* Common interfaces */ ACPI_STATUS @@ -155,7 +149,7 @@ AcpiDsObjStackPopObject ( /* dsopcode - support for late evaluation */ ACPI_STATUS -AcpiDsGetFieldUnitArguments ( +AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS @@ -217,7 +211,7 @@ AcpiDsCreateBankField ( ACPI_STATUS AcpiDsCreateIndexField ( ACPI_PARSE_OBJECT *Op, - ACPI_HANDLE RegionNode, + ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState); @@ -264,8 +258,15 @@ AcpiDsLoad3EndOp ( ACPI_STATUS +AcpiDsStoreObjectToLocal ( + UINT16 Opcode, + UINT32 Index, + ACPI_OPERAND_OBJECT *SrcDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS AcpiDsMethodDataGetEntry ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT ***Node); @@ -278,29 +279,22 @@ BOOLEAN AcpiDsIsMethodValue ( ACPI_OPERAND_OBJECT *ObjDesc); -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDsMethodDataGetType ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState); ACPI_STATUS AcpiDsMethodDataGetValue ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc); ACPI_STATUS -AcpiDsMethodDataSetValue ( - UINT32 Type, - UINT32 Index, - ACPI_OPERAND_OBJECT *SrcDesc, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS AcpiDsMethodDataDeleteValue ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState); @@ -311,8 +305,8 @@ AcpiDsMethodDataInitArgs ( ACPI_WALK_STATE *WalkState); ACPI_NAMESPACE_NODE * -AcpiDsMethodDataGetNte ( - UINT32 Type, +AcpiDsMethodDataGetNode ( + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState); @@ -322,7 +316,7 @@ AcpiDsMethodDataInit ( ACPI_STATUS AcpiDsMethodDataSetEntry ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState); @@ -352,7 +346,8 @@ AcpiDsTerminateControlMethod ( ACPI_STATUS AcpiDsBeginMethodExecution ( ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc); + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_NAMESPACE_NODE *CallingMethodNode); /* dsobj - Parser/Interpreter interface - object initialization and conversion */ @@ -398,7 +393,7 @@ AcpiDsCreateNode ( /* dsregn - Parser/Interpreter interface - Op Region parsing */ ACPI_STATUS -AcpiDsEvalFieldUnitOperands ( +AcpiDsEvalBufferFieldOperands ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op); @@ -440,12 +435,12 @@ ACPI_STATUS AcpiDsResolveOperands ( ACPI_WALK_STATE *WalkState); -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDsMapOpcodeToDataType ( UINT16 Opcode, UINT32 *OutFlags); -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDsMapNamedOpcodeToDataType ( UINT16 Opcode); @@ -457,7 +452,7 @@ AcpiDsMapNamedOpcodeToDataType ( ACPI_STATUS AcpiDsScopeStackPush ( ACPI_NAMESPACE_NODE *Node, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_WALK_STATE *WalkState); diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h index f49098a..126c9cd 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: 70 $ + * $Revision: 75 $ * *****************************************************************************/ @@ -252,8 +252,8 @@ */ #define STRSTR(s1,s2) strstr((s1), (s2)) -#define STRUPR(s) strupr((s)) -#define STRLEN(s) strlen((s)) +#define STRUPR(s) AcpiUtStrupr ((s)) +#define STRLEN(s) (UINT32) strlen((s)) #define STRCPY(d,s) strcpy((d), (s)) #define STRNCPY(d,s,n) strncpy((d), (s), (NATIVE_INT)(n)) #define STRNCMP(d,s,n) strncmp((d), (s), (NATIVE_INT)(n)) @@ -292,35 +292,35 @@ typedef char *va_list; * Storage alignment properties */ -#define _AUPBND (sizeof(int) - 1) -#define _ADNBND (sizeof(int) - 1) +#define _AUPBND (sizeof (NATIVE_INT) - 1) +#define _ADNBND (sizeof (NATIVE_INT) - 1) /* * Variable argument list macro definitions */ -#define _Bnd(X, bnd) (((sizeof(X)) + (bnd)) & (~(bnd))) -#define va_arg(ap, T) (*(T *)(((ap)+=((_Bnd(T, _AUPBND)))-(_Bnd(T,_ADNBND))))) -#define va_end(ap) (void)0 -#define va_start(ap, A) (void)((ap)=(((char*)&(A))+(_Bnd(A,_AUPBND)))) +#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd))) +#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND)))) +#define va_end(ap) (void) 0 +#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_Bnd (A,_AUPBND)))) #endif /* va_arg */ -#define STRSTR(s1,s2) AcpiCmStrstr ((s1), (s2)) -#define STRUPR(s) AcpiCmStrupr ((s)) -#define STRLEN(s) AcpiCmStrlen ((s)) -#define STRCPY(d,s) AcpiCmStrcpy ((d), (s)) -#define STRNCPY(d,s,n) AcpiCmStrncpy ((d), (s), (n)) -#define STRNCMP(d,s,n) AcpiCmStrncmp ((d), (s), (n)) -#define STRCMP(d,s) AcpiCmStrcmp ((d), (s)) -#define STRCAT(d,s) AcpiCmStrcat ((d), (s)) -#define STRNCAT(d,s,n) AcpiCmStrncat ((d), (s), (n)) -#define STRTOUL(d,s,n) AcpiCmStrtoul ((d), (s),(n)) -#define MEMCPY(d,s,n) AcpiCmMemcpy ((d), (s), (n)) -#define MEMSET(d,v,n) AcpiCmMemset ((d), (v), (n)) -#define TOUPPER AcpiCmToUpper -#define TOLOWER AcpiCmToLower +#define STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) +#define STRUPR(s) AcpiUtStrupr ((s)) +#define STRLEN(s) AcpiUtStrlen ((s)) +#define STRCPY(d,s) AcpiUtStrcpy ((d), (s)) +#define STRNCPY(d,s,n) AcpiUtStrncpy ((d), (s), (n)) +#define STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (n)) +#define STRCMP(d,s) AcpiUtStrcmp ((d), (s)) +#define STRCAT(d,s) AcpiUtStrcat ((d), (s)) +#define STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (n)) +#define STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s),(n)) +#define MEMCPY(d,s,n) AcpiUtMemcpy ((d), (s), (n)) +#define MEMSET(d,v,n) AcpiUtMemset ((d), (v), (n)) +#define TOUPPER AcpiUtToUpper +#define TOLOWER AcpiUtToLower #endif /* ACPI_USE_SYSTEM_CLIBRARY */ diff --git a/sys/contrib/dev/acpica/acevents.h b/sys/contrib/dev/acpica/acevents.h index 846b399..e350ebe 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: 63 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -182,11 +182,14 @@ AcpiEvGpeDetect ( * AcpiEvnotify - Device Notify handling and dispatch */ -void -AcpiEvNotifyDispatch ( - ACPI_HANDLE Device, +ACPI_STATUS +AcpiEvQueueNotifyRequest ( + ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue); +void +AcpiEvNotifyDispatch ( + void *Context); /* * AcpiEvregion - Address Space handling @@ -288,20 +291,4 @@ AcpiEvTerminate ( void); -/* Debug support */ - -#ifdef ACPI_DEBUG - -UINT32 -AcpiEvSciCount ( - UINT32 AcpiEvent); - -#define DEBUG_INCREMENT_EVENT_COUNT(a) AcpiGbl_EventCount[a]++; - -#else - -#define DEBUG_INCREMENT_EVENT_COUNT(a) -#endif - - #endif /* __ACEVENTS_H__ */ diff --git a/sys/contrib/dev/acpica/acexcep.h b/sys/contrib/dev/acpica/acexcep.h index 13dbf75..2bf4cf3 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: 41 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -159,8 +159,14 @@ #define AE_LIMIT (ACPI_STATUS) (0x0012 | AE_CODE_ENVIRONMENTAL) #define AE_TIME (ACPI_STATUS) (0x0013 | AE_CODE_ENVIRONMENTAL) #define AE_UNKNOWN_STATUS (ACPI_STATUS) (0x0014 | AE_CODE_ENVIRONMENTAL) +#define AE_ACQUIRE_DEADLOCK (ACPI_STATUS) (0x0015 | AE_CODE_ENVIRONMENTAL) +#define AE_RELEASE_DEADLOCK (ACPI_STATUS) (0x0016 | AE_CODE_ENVIRONMENTAL) +#define AE_NOT_ACQUIRED (ACPI_STATUS) (0x0017 | AE_CODE_ENVIRONMENTAL) +#define AE_ALREADY_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_HARDWARE_RESPONSE (ACPI_STATUS) (0x0019 | AE_CODE_ENVIRONMENTAL) +#define AE_NO_GLOBAL_LOCK (ACPI_STATUS) (0x001A | AE_CODE_ENVIRONMENTAL) -#define AE_CODE_ENV_MAX 0x0014 +#define AE_CODE_ENV_MAX 0x001A /* * Programmer exceptions @@ -209,8 +215,13 @@ #define AE_AML_INVALID_SPACE_ID (ACPI_STATUS) (0x0012 | AE_CODE_AML) #define AE_AML_STRING_LIMIT (ACPI_STATUS) (0x0013 | AE_CODE_AML) #define AE_AML_NO_RETURN_VALUE (ACPI_STATUS) (0x0014 | AE_CODE_AML) +#define AE_AML_METHOD_LIMIT (ACPI_STATUS) (0x0015 | AE_CODE_AML) +#define AE_AML_NOT_OWNER (ACPI_STATUS) (0x0016 | AE_CODE_AML) +#define AE_AML_MUTEX_ORDER (ACPI_STATUS) (0x0017 | AE_CODE_AML) +#define AE_AML_MUTEX_NOT_ACQUIRED (ACPI_STATUS) (0x0018 | AE_CODE_AML) +#define AE_AML_INVALID_RESOURCE_TYPE (ACPI_STATUS) (0x0019 | AE_CODE_AML) -#define AE_CODE_AML_MAX 0x0014 +#define AE_CODE_AML_MAX 0x0019 /* * Internal exceptions used for control @@ -256,6 +267,12 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Env[] = "AE_LIMIT", "AE_TIME", "AE_UNKNOWN_STATUS", + "AE_ACQUIRE_DEADLOCK", + "AE_RELEASE_DEADLOCK", + "AE_NOT_ACQUIRED", + "AE_ALREADY_ACQUIRED", + "AE_NO_HARDWARE_RESPONSE", + "AE_NO_GLOBAL_LOCK", }; static NATIVE_CHAR *AcpiGbl_ExceptionNames_Pgm[] = @@ -297,6 +314,11 @@ static NATIVE_CHAR *AcpiGbl_ExceptionNames_Aml[] = "AE_AML_INVALID_SPACE_ID", "AE_AML_STRING_LIMIT", "AE_AML_NO_RETURN_VALUE", + "AE_AML_METHOD_LIMIT", + "AE_AML_NOT_OWNER", + "AE_AML_MUTEX_ORDER", + "AE_AML_MUTEX_NOT_ACQUIRED", + "AE_AML_INVALID_RESOURCE_TYPE", }; static NATIVE_CHAR *AcpiGbl_ExceptionNames_Ctrl[] = diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h index ca6c799..894af50 100644 --- a/sys/contrib/dev/acpica/acfreebsd.h +++ b/sys/contrib/dev/acpica/acfreebsd.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acfreebsd.h - OS specific defines, etc. - * $Revision: 4 $ + * $Revision: 6 $ * *****************************************************************************/ @@ -117,18 +117,83 @@ #ifndef __ACFREEBSD_H__ #define __ACFREEBSD_H__ +/* + * XXX this is technically correct, but will cause problems with some ASL + * which only works if the string names a Microsoft operating system. + */ #define ACPI_OS_NAME "FreeBSD" +/* FreeBSD uses GCC */ + +#include "acgcc.h" + #ifdef _KERNEL #include <sys/ctype.h> #include <sys/param.h> #include <sys/systm.h> #include <sys/libkern.h> -#include <stdarg.h> +#include <machine/stdarg.h> #define asm __asm #define __cli() disable_intr() #define __sti() enable_intr() +#ifdef ACPI_DEBUG +#ifdef DEBUGGER_THREADING +#undef DEBUGGER_THREADING +#endif /* DEBUGGER_THREADING */ +#define DEBUGGER_THREADING 0 /* integrated with DDB */ +#include "opt_ddb.h" +#ifdef DDB +#define ENABLE_DEBUGGER +#endif /* DDB */ +#endif /* ACPI_DEBUG */ + +#else /* _KERNEL */ + +/* Not building kernel code, so use libc */ +#define ACPI_USE_STANDARD_HEADERS + +#define __cli() +#define __sti() + +#endif /* _KERNEL */ + +/* Always use FreeBSD code over our local versions */ +#define ACPI_USE_SYSTEM_CLIBRARY + +/* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */ +static __inline char * +strupr(char *str) +{ + char *c = str; + while(*c) { + *c = toupper(*c); + c++; + } + return(str); +} + +#ifdef _KERNEL +/* Or strstr (used in debugging mode, also move to libkern) */ +static __inline char * +strstr(char *s, char *find) +{ + char c, sc; + size_t len; + + if ((c = *find++) != 0) { + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return (NULL); + } while (sc != c); + } while (strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} +#endif /* _KERNEL */ #endif /* __ACFREEBSD_H__ */ diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h index eb2f4ce..c426663 100644 --- a/sys/contrib/dev/acpica/acgcc.h +++ b/sys/contrib/dev/acpica/acgcc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acgcc.h - GCC specific defines, etc. - * $Revision: 5 $ + * $Revision: 6 $ * *****************************************************************************/ @@ -118,7 +118,6 @@ #define __ACGCC_H__ - #ifdef __ia64__ #define _IA64 diff --git a/sys/contrib/dev/acpica/acglobal.h b/sys/contrib/dev/acpica/acglobal.h index ee2035f..2fbcbe1 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: 96 $ + * $Revision: 101 $ * *****************************************************************************/ @@ -241,19 +241,19 @@ ACPI_EXTERN UINT16 AcpiGbl_NextMethodOwnerId; ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockSet; /* TBD: [Restructure] OBSOLETE?? */ ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; +ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DrvNotify; ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SysNotify; -extern BOOLEAN AcpiGbl_Shutdown; -extern UINT32 AcpiGbl_SystemFlags; -extern UINT32 AcpiGbl_StartupFlags; -extern UINT8 AcpiGbl_DecodeTo8bit[8]; -extern NATIVE_CHAR AcpiGbl_HexToAscii[]; +extern BOOLEAN AcpiGbl_Shutdown; +extern UINT32 AcpiGbl_SystemFlags; +extern UINT32 AcpiGbl_StartupFlags; +extern UINT8 AcpiGbl_DecodeTo8bit[8]; +extern NATIVE_CHAR AcpiGbl_HexToAscii[16]; /***************************************************************************** @@ -269,15 +269,15 @@ extern NATIVE_CHAR AcpiGbl_HexToAscii[]; ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; -extern UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES]; -extern PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; +extern UINT8 AcpiGbl_NsProperties[NUM_NS_TYPES]; +extern PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; /* Used to detect memory leaks (DEBUG ONLY) */ #ifdef ACPI_DEBUG -ACPI_EXTERN ALLOCATION_INFO *AcpiGbl_HeadAllocPtr; -ACPI_EXTERN ALLOCATION_INFO *AcpiGbl_TailAllocPtr; +ACPI_EXTERN ACPI_ALLOCATION_INFO *AcpiGbl_HeadAllocPtr; +ACPI_EXTERN ACPI_ALLOCATION_INFO *AcpiGbl_TailAllocPtr; #endif @@ -291,15 +291,9 @@ ACPI_EXTERN ALLOCATION_INFO *AcpiGbl_TailAllocPtr; ACPI_EXTERN ACPI_WALK_LIST *AcpiGbl_CurrentWalkList; /* - * Handle to the last method found - used during pass1 of load - */ -ACPI_EXTERN ACPI_HANDLE AcpiGbl_LastMethod; - -/* * Table of Address Space handlers */ - -ACPI_EXTERN ACPI_ADDRESS_SPACE_INFO AcpiGbl_AddressSpaces[ACPI_NUM_ADDRESS_SPACES]; +ACPI_EXTERN ACPI_ADR_SPACE_INFO AcpiGbl_AddressSpaces[ACPI_NUM_ADDRESS_SPACES]; /* Control method single step flag */ @@ -331,7 +325,7 @@ extern UINT32 AcpiHwActiveCxState; * ****************************************************************************/ -ACPI_EXTERN ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventHandlers[NUM_FIXED_EVENTS]; +ACPI_EXTERN ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeObjHandle; ACPI_EXTERN UINT32 AcpiGbl_GpeRegisterCount; @@ -346,12 +340,12 @@ ACPI_EXTERN ACPI_GPE_LEVEL_INFO *AcpiGbl_GpeInfo; * This table is needed because the GPE numbers supported by block 1 do not * have to be contiguous with the GPE numbers supported by block 0. */ -ACPI_EXTERN UINT8 AcpiGbl_GpeValid [NUM_GPE]; +ACPI_EXTERN UINT8 AcpiGbl_GpeValid [ACPI_NUM_GPE]; /* AcpiEvent counter for debug only */ #ifdef ACPI_DEBUG -ACPI_EXTERN UINT32 AcpiGbl_EventCount[NUM_FIXED_EVENTS]; +ACPI_EXTERN UINT32 AcpiGbl_EventCount[ACPI_NUM_FIXED_EVENTS]; #endif diff --git a/sys/contrib/dev/acpica/achware.h b/sys/contrib/dev/acpica/achware.h index bcefafa..9b2f90b 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: 53 $ + * $Revision: 55 $ * *****************************************************************************/ @@ -119,7 +119,7 @@ /* PM Timer ticks per second (HZ) */ -#define PM_TIMER_FREQUENCY 3579545 +#define PM_TIMER_FREQUENCY 3579545 /* Prototypes */ @@ -173,14 +173,14 @@ AcpiHwRegisterWrite ( UINT32 AcpiHwLowLevelRead ( UINT32 Width, - ACPI_GAS *Reg, + ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset); void AcpiHwLowLevelWrite ( UINT32 Width, UINT32 Value, - ACPI_GAS *Reg, + ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset); void @@ -192,7 +192,6 @@ AcpiHwGetBitShift ( UINT32 Mask); - /* GPE support */ void diff --git a/sys/contrib/dev/acpica/acinterp.h b/sys/contrib/dev/acpica/acinterp.h index 6ebdd17..a3518fa 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: 92 $ + * $Revision: 102 $ * *****************************************************************************/ @@ -138,9 +138,8 @@ #define METHOD_DELETE_AT_COMPLETION 0x2 - ACPI_STATUS -AcpiAmlResolveOperands ( +AcpiExResolveOperands ( UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState); @@ -151,11 +150,11 @@ AcpiAmlResolveOperands ( */ ACPI_STATUS -AcpiAmlLoadTable ( +AcpiExLoadTable ( ACPI_TABLE_TYPE TableId); ACPI_STATUS -AcpiAmlExecuteMethod ( +AcpiExExecuteMethod ( ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObjDesc); @@ -166,23 +165,23 @@ AcpiAmlExecuteMethod ( */ ACPI_STATUS -AcpiAmlConvertToInteger ( +AcpiExConvertToInteger ( ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlConvertToBuffer ( +AcpiExConvertToBuffer ( ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlConvertToString ( +AcpiExConvertToString ( ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlConvertToTargetType ( - OBJECT_TYPE_INTERNAL DestinationType, +AcpiExConvertToTargetType ( + ACPI_OBJECT_TYPE8 DestinationType, ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState); @@ -192,110 +191,164 @@ AcpiAmlConvertToTargetType ( */ ACPI_STATUS -AcpiAmlReadField ( +AcpiExExtractFromField ( ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, - UINT32 BufferLength, - UINT32 ByteLength, - UINT32 DatumLength, - UINT32 BitGranularity, - UINT32 ByteGranularity); + UINT32 BufferLength); ACPI_STATUS -AcpiAmlWriteField ( +AcpiExInsertIntoField ( ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, - UINT32 BufferLength, - UINT32 ByteLength, - UINT32 DatumLength, - UINT32 BitGranularity, - UINT32 ByteGranularity); + UINT32 BufferLength); ACPI_STATUS -AcpiAmlSetupField ( +AcpiExSetupField ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *RgnDesc, - UINT32 FieldBitWidth); + UINT32 FieldByteOffset); ACPI_STATUS -AcpiAmlReadFieldData ( +AcpiExReadFieldDatum ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldByteOffset, - UINT32 FieldBitWidth, UINT32 *Value); ACPI_STATUS -AcpiAmlAccessNamedField ( +AcpiExCommonAccessField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength); + + +ACPI_STATUS +AcpiExAccessIndexField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength); + +ACPI_STATUS +AcpiExAccessBankField ( UINT32 Mode, - ACPI_HANDLE NamedField, + ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, - UINT32 Length); + UINT32 BufferLength); + +ACPI_STATUS +AcpiExAccessRegionField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength); + + +ACPI_STATUS +AcpiExAccessBufferField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength); + +ACPI_STATUS +AcpiExReadDataFromField ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_OPERAND_OBJECT **RetBufferDesc); + +ACPI_STATUS +AcpiExWriteDataToField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc); /* * ammisc - ACPI AML (p-code) execution - specific opcodes */ ACPI_STATUS -AcpiAmlExecCreateField ( +AcpiExCreateBufferField ( UINT8 *AmlPtr, UINT32 AmlLength, ACPI_NAMESPACE_NODE *Node, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecReconfiguration ( +AcpiExReconfiguration ( UINT16 Opcode, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecFatal ( +AcpiExFatal ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecIndex ( +AcpiExIndex ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); ACPI_STATUS -AcpiAmlExecMatch ( +AcpiExMatch ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); ACPI_STATUS -AcpiAmlExecCreateMutex ( +AcpiExCreateMutex ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecCreateProcessor ( +AcpiExCreateProcessor ( ACPI_PARSE_OBJECT *Op, - ACPI_HANDLE ProcessorNTE); + ACPI_NAMESPACE_NODE *ProcessorNode); ACPI_STATUS -AcpiAmlExecCreatePowerResource ( +AcpiExCreatePowerResource ( ACPI_PARSE_OBJECT *Op, - ACPI_HANDLE ProcessorNTE); + ACPI_NAMESPACE_NODE *PowerNode); ACPI_STATUS -AcpiAmlExecCreateRegion ( +AcpiExCreateRegion ( UINT8 *AmlPtr, - UINT32 AcpiAmlLength, + UINT32 AmlLength, UINT8 RegionSpace, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecCreateEvent ( +AcpiExCreateEvent ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecCreateAlias ( +AcpiExCreateAlias ( ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecCreateMethod ( +AcpiExCreateMethod ( UINT8 *AmlPtr, - UINT32 AcpiAmlLength, + UINT32 AmlLength, UINT32 MethodFlags, - ACPI_HANDLE Method); + ACPI_NAMESPACE_NODE *Method); + + +/* + * ammutex - mutex support + */ + +ACPI_STATUS +AcpiExAcquireMutex ( + ACPI_OPERAND_OBJECT *TimeDesc, + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExReleaseMutex ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_WALK_STATE *WalkState); + +ACPI_STATUS +AcpiExReleaseAllMutexes ( + ACPI_OPERAND_OBJECT *MutexList); + +void +AcpiExUnlinkMutex ( + ACPI_OPERAND_OBJECT *ObjDesc); /* @@ -303,32 +356,36 @@ AcpiAmlExecCreateMethod ( */ ACPI_STATUS -AcpiAmlPrepDefFieldValue ( +AcpiExPrepCommonFieldObject ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT8 FieldFlags, + UINT32 FieldPosition, + UINT32 FieldLength); + +ACPI_STATUS +AcpiExPrepRegionFieldValue ( ACPI_NAMESPACE_NODE *Node, ACPI_HANDLE Region, UINT8 FieldFlags, - UINT8 FieldAttribute, UINT32 FieldPosition, UINT32 FieldLength); ACPI_STATUS -AcpiAmlPrepBankFieldValue ( +AcpiExPrepBankFieldValue ( ACPI_NAMESPACE_NODE *Node, - ACPI_HANDLE Region, - ACPI_HANDLE BankReg, + ACPI_NAMESPACE_NODE *RegionNode, + ACPI_NAMESPACE_NODE *BankRegisterNode, UINT32 BankVal, UINT8 FieldFlags, - UINT8 FieldAttribute, UINT32 FieldPosition, UINT32 FieldLength); ACPI_STATUS -AcpiAmlPrepIndexFieldValue ( +AcpiExPrepIndexFieldValue ( ACPI_NAMESPACE_NODE *Node, - ACPI_HANDLE IndexReg, - ACPI_HANDLE DataReg, + ACPI_NAMESPACE_NODE *IndexReg, + ACPI_NAMESPACE_NODE *DataReg, UINT8 FieldFlags, - UINT8 FieldAttribute, UINT32 FieldPosition, UINT32 FieldLength); @@ -337,47 +394,43 @@ AcpiAmlPrepIndexFieldValue ( * amsystem - Interface to OS services */ -UINT16 -AcpiAmlSystemThreadId ( - void); - ACPI_STATUS -AcpiAmlSystemDoNotifyOp ( +AcpiExSystemDoNotifyOp ( ACPI_OPERAND_OBJECT *Value, ACPI_OPERAND_OBJECT *ObjDesc); void -AcpiAmlSystemDoSuspend( +AcpiExSystemDoSuspend( UINT32 Time); void -AcpiAmlSystemDoStall ( +AcpiExSystemDoStall ( UINT32 Time); ACPI_STATUS -AcpiAmlSystemAcquireMutex( +AcpiExSystemAcquireMutex( ACPI_OPERAND_OBJECT *Time, ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS -AcpiAmlSystemReleaseMutex( +AcpiExSystemReleaseMutex( ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS -AcpiAmlSystemSignalEvent( +AcpiExSystemSignalEvent( ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS -AcpiAmlSystemWaitEvent( +AcpiExSystemWaitEvent( ACPI_OPERAND_OBJECT *Time, ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS -AcpiAmlSystemResetEvent( +AcpiExSystemResetEvent( ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS -AcpiAmlSystemWaitSemaphore ( +AcpiExSystemWaitSemaphore ( ACPI_HANDLE Semaphore, UINT32 Timeout); @@ -387,18 +440,18 @@ AcpiAmlSystemWaitSemaphore ( */ ACPI_STATUS -AcpiAmlExecMonadic1 ( +AcpiExMonadic1 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecMonadic2 ( +AcpiExMonadic2 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); ACPI_STATUS -AcpiAmlExecMonadic2R ( +AcpiExMonadic2R ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); @@ -409,24 +462,24 @@ AcpiAmlExecMonadic2R ( */ ACPI_STATUS -AcpiAmlExecDyadic1 ( +AcpiExDyadic1 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlExecDyadic2 ( +AcpiExDyadic2 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); ACPI_STATUS -AcpiAmlExecDyadic2R ( +AcpiExDyadic2R ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); ACPI_STATUS -AcpiAmlExecDyadic2S ( +AcpiExDyadic2S ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc); @@ -437,22 +490,22 @@ AcpiAmlExecDyadic2S ( */ ACPI_STATUS -AcpiAmlResolveToValue ( +AcpiExResolveToValue ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlResolveNodeToValue ( +AcpiExResolveNodeToValue ( ACPI_NAMESPACE_NODE **StackPtr, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlResolveObjectToValue ( +AcpiExResolveObjectToValue ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlGetFieldUnitValue ( +AcpiExGetBufferFieldValue ( ACPI_OPERAND_OBJECT *FieldDesc, ACPI_OPERAND_OBJECT *ResultDesc); @@ -462,18 +515,18 @@ AcpiAmlGetFieldUnitValue ( */ void -AcpiAmlShowHexValue ( +AcpiExShowHexValue ( UINT32 ByteCount, UINT8 *AmlPtr, UINT32 LeadSpace); ACPI_STATUS -AcpiAmlDumpOperand ( +AcpiExDumpOperand ( ACPI_OPERAND_OBJECT *EntryDesc); void -AcpiAmlDumpOperands ( +AcpiExDumpOperands ( ACPI_OPERAND_OBJECT **Operands, OPERATING_MODE InterpreterMode, NATIVE_CHAR *Ident, @@ -483,13 +536,13 @@ AcpiAmlDumpOperands ( UINT32 LineNumber); void -AcpiAmlDumpObjectDescriptor ( +AcpiExDumpObjectDescriptor ( ACPI_OPERAND_OBJECT *Object, UINT32 Flags); void -AcpiAmlDumpNode ( +AcpiExDumpNode ( ACPI_NAMESPACE_NODE *Node, UINT32 Flags); @@ -499,28 +552,28 @@ AcpiAmlDumpNode ( */ NATIVE_CHAR * -AcpiAmlAllocateNameString ( +AcpiExAllocateNameString ( UINT32 PrefixCount, UINT32 NumNameSegs); UINT32 -AcpiAmlGoodChar ( +AcpiExGoodChar ( UINT32 Character); ACPI_STATUS -AcpiAmlExecNameSegment ( +AcpiExNameSegment ( UINT8 **InAmlAddress, NATIVE_CHAR *NameString); ACPI_STATUS -AcpiAmlGetNameString ( - OBJECT_TYPE_INTERNAL DataType, +AcpiExGetNameString ( + ACPI_OBJECT_TYPE8 DataType, UINT8 *InAmlAddress, NATIVE_CHAR **OutNameString, UINT32 *OutNameLength); ACPI_STATUS -AcpiAmlDoName ( +AcpiExDoName ( ACPI_OBJECT_TYPE DataType, OPERATING_MODE LoadExecMode); @@ -530,44 +583,44 @@ AcpiAmlDoName ( */ ACPI_STATUS -AcpiAmlExecStore ( +AcpiExStore ( ACPI_OPERAND_OBJECT *ValDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlStoreObjectToIndex ( +AcpiExStoreObjectToIndex ( ACPI_OPERAND_OBJECT *ValDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlStoreObjectToNode ( +AcpiExStoreObjectToNode ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlStoreObjectToObject ( +AcpiExStoreObjectToObject ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState); /* - * + * */ ACPI_STATUS -AcpiAmlResolveObject ( +AcpiExResolveObject ( ACPI_OPERAND_OBJECT **SourceDescPtr, - OBJECT_TYPE_INTERNAL TargetType, + ACPI_OBJECT_TYPE8 TargetType, ACPI_WALK_STATE *WalkState); ACPI_STATUS -AcpiAmlStoreObject ( +AcpiExStoreObject ( ACPI_OPERAND_OBJECT *SourceDesc, - OBJECT_TYPE_INTERNAL TargetType, + ACPI_OBJECT_TYPE8 TargetType, ACPI_OPERAND_OBJECT **TargetDescPtr, ACPI_WALK_STATE *WalkState); @@ -577,32 +630,32 @@ AcpiAmlStoreObject ( */ ACPI_STATUS -AcpiAmlCopyBufferToBuffer ( +AcpiExCopyBufferToBuffer ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc); ACPI_STATUS -AcpiAmlCopyStringToString ( +AcpiExCopyStringToString ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc); ACPI_STATUS -AcpiAmlCopyIntegerToIndexField ( +AcpiExCopyIntegerToIndexField ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc); ACPI_STATUS -AcpiAmlCopyIntegerToBankField ( +AcpiExCopyIntegerToBankField ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc); ACPI_STATUS -AcpiAmlCopyDataToNamedField ( +AcpiExCopyDataToNamedField ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node); ACPI_STATUS -AcpiAmlCopyIntegerToFieldUnit ( +AcpiExCopyIntegerToBufferField ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc); @@ -610,43 +663,43 @@ AcpiAmlCopyIntegerToFieldUnit ( * amutils - interpreter/scanner utilities */ -void -AcpiAmlEnterInterpreter ( +ACPI_STATUS +AcpiExEnterInterpreter ( void); void -AcpiAmlExitInterpreter ( +AcpiExExitInterpreter ( void); void -AcpiAmlTruncateFor32bitTable ( +AcpiExTruncateFor32bitTable ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState); BOOLEAN -AcpiAmlValidateObjectType ( +AcpiExValidateObjectType ( ACPI_OBJECT_TYPE Type); BOOLEAN -AcpiAmlAcquireGlobalLock ( +AcpiExAcquireGlobalLock ( UINT32 Rule); ACPI_STATUS -AcpiAmlReleaseGlobalLock ( +AcpiExReleaseGlobalLock ( BOOLEAN Locked); UINT32 -AcpiAmlDigitsNeeded ( +AcpiExDigitsNeeded ( ACPI_INTEGER Value, UINT32 Base); ACPI_STATUS -AcpiAmlEisaIdToString ( +AcpiExEisaIdToString ( UINT32 NumericId, NATIVE_CHAR *OutString); ACPI_STATUS -AcpiAmlUnsignedIntegerToString ( +AcpiExUnsignedIntegerToString ( ACPI_INTEGER Value, NATIVE_CHAR *OutString); @@ -656,7 +709,7 @@ AcpiAmlUnsignedIntegerToString ( */ ACPI_STATUS -AcpiAmlSystemMemorySpaceHandler ( +AcpiExSystemMemorySpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -665,7 +718,7 @@ AcpiAmlSystemMemorySpaceHandler ( void *RegionContext); ACPI_STATUS -AcpiAmlSystemIoSpaceHandler ( +AcpiExSystemIoSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -674,7 +727,7 @@ AcpiAmlSystemIoSpaceHandler ( void *RegionContext); ACPI_STATUS -AcpiAmlPciConfigSpaceHandler ( +AcpiExPciConfigSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -683,7 +736,7 @@ AcpiAmlPciConfigSpaceHandler ( void *RegionContext); ACPI_STATUS -AcpiAmlEmbeddedControllerSpaceHandler ( +AcpiExEmbeddedControllerSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -692,7 +745,7 @@ AcpiAmlEmbeddedControllerSpaceHandler ( void *RegionContext); ACPI_STATUS -AcpiAmlSmBusSpaceHandler ( +AcpiExSmBusSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, diff --git a/sys/contrib/dev/acpica/aclocal.h b/sys/contrib/dev/acpica/aclocal.h index e021acc..86e28bc 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: 104 $ + * $Revision: 121 $ * *****************************************************************************/ @@ -118,20 +118,20 @@ #define __ACLOCAL_H__ -#define WAIT_FOREVER ((UINT32) -1) +#define WAIT_FOREVER ((UINT32) -1) -typedef void* ACPI_MUTEX; -typedef UINT32 ACPI_MUTEX_HANDLE; +typedef void* ACPI_MUTEX; +typedef UINT32 ACPI_MUTEX_HANDLE; /* Object descriptor types */ -#define ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */ -#define ACPI_DESC_TYPE_STATE 0x22 -#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 ACPI_CACHED_OBJECT 0x11 /* ORed in when object is cached */ +#define ACPI_DESC_TYPE_STATE 0x22 +#define ACPI_DESC_TYPE_WALK 0x44 +#define ACPI_DESC_TYPE_PARSER 0x66 +#define ACPI_DESC_TYPE_INTERNAL 0x88 +#define ACPI_DESC_TYPE_NAMED 0xAA /***************************************************************************** @@ -143,26 +143,30 @@ typedef UINT32 ACPI_MUTEX_HANDLE; /* * Predefined handles for the mutex objects used within the subsystem - * All mutex objects are automatically created by AcpiCmMutexInitialize. + * All mutex objects are automatically created by AcpiUtMutexInitialize. + * + * The acquire/release ordering protocol is implied via this list. Mutexes + * with a lower value must be acquired before mutexes with a higher value. + * * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames table also! */ -#define ACPI_MTX_HARDWARE 0 -#define ACPI_MTX_MEMORY 1 -#define ACPI_MTX_CACHES 2 -#define ACPI_MTX_TABLES 3 -#define ACPI_MTX_PARSER 4 -#define ACPI_MTX_DISPATCHER 5 -#define ACPI_MTX_INTERPRETER 6 -#define ACPI_MTX_EXECUTE 7 -#define ACPI_MTX_NAMESPACE 8 -#define ACPI_MTX_EVENTS 9 -#define ACPI_MTX_OP_REGIONS 10 -#define ACPI_MTX_DEBUG_CMD_READY 11 -#define ACPI_MTX_DEBUG_CMD_COMPLETE 12 +#define ACPI_MTX_EXECUTE 0 +#define ACPI_MTX_INTERPRETER 1 +#define ACPI_MTX_PARSER 2 +#define ACPI_MTX_DISPATCHER 3 +#define ACPI_MTX_TABLES 4 +#define ACPI_MTX_OP_REGIONS 5 +#define ACPI_MTX_NAMESPACE 6 +#define ACPI_MTX_EVENTS 7 +#define ACPI_MTX_HARDWARE 8 +#define ACPI_MTX_CACHES 9 +#define ACPI_MTX_MEMORY 10 +#define ACPI_MTX_DEBUG_CMD_COMPLETE 11 +#define ACPI_MTX_DEBUG_CMD_READY 12 -#define MAX_MTX 12 -#define NUM_MTX MAX_MTX+1 +#define MAX_MTX 12 +#define NUM_MTX MAX_MTX+1 #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) @@ -172,19 +176,19 @@ typedef UINT32 ACPI_MUTEX_HANDLE; static NATIVE_CHAR *AcpiGbl_MutexNames[] = { - "ACPI_MTX_Hardware", - "ACPI_MTX_Memory", - "ACPI_MTX_Caches", - "ACPI_MTX_Tables", + "ACPI_MTX_Execute", + "ACPI_MTX_Interpreter", "ACPI_MTX_Parser", "ACPI_MTX_Dispatcher", - "ACPI_MTX_Interpreter", - "ACPI_MTX_Execute", + "ACPI_MTX_Tables", + "ACPI_MTX_OpRegions", "ACPI_MTX_Namespace", "ACPI_MTX_Events", - "ACPI_MTX_OpRegions", + "ACPI_MTX_Hardware", + "ACPI_MTX_Caches", + "ACPI_MTX_Memory", + "ACPI_MTX_DebugCmdComplete", "ACPI_MTX_DebugCmdReady", - "ACPI_MTX_DebugCmdComplete" }; #endif @@ -197,26 +201,38 @@ typedef struct AcpiMutexInfo { ACPI_MUTEX Mutex; UINT32 UseCount; - BOOLEAN Locked; + UINT32 OwnerId; } ACPI_MUTEX_INFO; +/* This owner ID means that the mutex is not in use (unlocked) */ + +#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) (-1) + /* Lock flag parameter for various interfaces */ -#define ACPI_MTX_DO_NOT_LOCK 0 -#define ACPI_MTX_LOCK 1 +#define ACPI_MTX_DO_NOT_LOCK 0 +#define ACPI_MTX_LOCK 1 -typedef UINT16 ACPI_OWNER_ID; -#define OWNER_TYPE_TABLE 0x0 -#define OWNER_TYPE_METHOD 0x1 -#define FIRST_METHOD_ID 0x0000 -#define FIRST_TABLE_ID 0x8000 +typedef UINT16 ACPI_OWNER_ID; +#define OWNER_TYPE_TABLE 0x0 +#define OWNER_TYPE_METHOD 0x1 +#define FIRST_METHOD_ID 0x0000 +#define FIRST_TABLE_ID 0x8000 /* TBD: [Restructure] get rid of the need for this! */ -#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0x8000 +#define TABLE_ID_DSDT (ACPI_OWNER_ID) 0x8000 + + +/* Field access granularities */ + +#define ACPI_FIELD_BYTE_GRANULARITY 1 +#define ACPI_FIELD_WORD_GRANULARITY 2 +#define ACPI_FIELD_DWORD_GRANULARITY 4 +#define ACPI_FIELD_QWORD_GRANULARITY 8 /***************************************************************************** * @@ -266,13 +282,13 @@ typedef struct acpi_node /* Node flags */ -#define ANOBJ_AML_ATTACHMENT 0x01 -#define ANOBJ_END_OF_PEER_LIST 0x02 -#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ -#define ANOBJ_METHOD_ARG 0x08 -#define ANOBJ_METHOD_LOCAL 0x10 -#define ANOBJ_METHOD_NO_RETVAL 0x20 -#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 +#define ANOBJ_AML_ATTACHMENT 0x01 +#define ANOBJ_END_OF_PEER_LIST 0x02 +#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */ +#define ANOBJ_METHOD_ARG 0x08 +#define ANOBJ_METHOD_LOCAL 0x10 +#define ANOBJ_METHOD_NO_RETVAL 0x20 +#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40 /* @@ -316,19 +332,36 @@ typedef struct /* * Predefined Namespace items */ -#define ACPI_MAX_ADDRESS_SPACE 255 -#define ACPI_NUM_ADDRESS_SPACES 256 - - typedef struct { NATIVE_CHAR *Name; - ACPI_OBJECT_TYPE Type; + ACPI_OBJECT_TYPE8 Type; NATIVE_CHAR *Val; } PREDEFINED_NAMES; +/* Object types used during package copies */ + + +#define ACPI_COPY_TYPE_SIMPLE 0 +#define ACPI_COPY_TYPE_PACKAGE 1 + +/* Info structure used to convert external<->internal namestrings */ + +typedef struct acpi_namestring_info +{ + NATIVE_CHAR *ExternalName; + NATIVE_CHAR *NextExternalChar; + NATIVE_CHAR *InternalName; + UINT32 Length; + UINT32 NumSegments; + UINT32 NumCarats; + BOOLEAN FullyQualified; + +} ACPI_NAMESTRING_INFO; + + /***************************************************************************** * * Event typedefs and structs @@ -338,19 +371,19 @@ typedef struct /* Status bits. */ -#define ACPI_STATUS_PMTIMER 0x0001 -#define ACPI_STATUS_GLOBAL 0x0020 -#define ACPI_STATUS_POWER_BUTTON 0x0100 -#define ACPI_STATUS_SLEEP_BUTTON 0x0200 -#define ACPI_STATUS_RTC_ALARM 0x0400 +#define ACPI_STATUS_PMTIMER 0x0001 +#define ACPI_STATUS_GLOBAL 0x0020 +#define ACPI_STATUS_POWER_BUTTON 0x0100 +#define ACPI_STATUS_SLEEP_BUTTON 0x0200 +#define ACPI_STATUS_RTC_ALARM 0x0400 /* Enable bits. */ -#define ACPI_ENABLE_PMTIMER 0x0001 -#define ACPI_ENABLE_GLOBAL 0x0020 -#define ACPI_ENABLE_POWER_BUTTON 0x0100 -#define ACPI_ENABLE_SLEEP_BUTTON 0x0200 -#define ACPI_ENABLE_RTC_ALARM 0x0400 +#define ACPI_ENABLE_PMTIMER 0x0001 +#define ACPI_ENABLE_GLOBAL 0x0020 +#define ACPI_ENABLE_POWER_BUTTON 0x0100 +#define ACPI_ENABLE_SLEEP_BUTTON 0x0200 +#define ACPI_ENABLE_RTC_ALARM 0x0400 /* @@ -359,10 +392,10 @@ typedef struct typedef struct { - ADDRESS_SPACE_HANDLER Handler; + ACPI_ADR_SPACE_HANDLER Handler; void *Context; -} ACPI_ADDRESS_SPACE_INFO; +} ACPI_ADR_SPACE_INFO; /* Values and addresses of the GPE registers (both banks) */ @@ -378,8 +411,8 @@ typedef struct } ACPI_GPE_REGISTERS; -#define ACPI_GPE_LEVEL_TRIGGERED 1 -#define ACPI_GPE_EDGE_TRIGGERED 2 +#define ACPI_GPE_LEVEL_TRIGGERED 1 +#define ACPI_GPE_EDGE_TRIGGERED 2 /* Information about each particular GPE level */ @@ -389,7 +422,7 @@ typedef struct UINT8 Type; /* Level or Edge */ ACPI_HANDLE MethodHandle; /* Method handle for direct (fast) execution */ - GPE_HANDLER Handler; /* Address of handler, if any */ + ACPI_GPE_HANDLER Handler; /* Address of handler, if any */ void *Context; /* Context to be passed to handler */ } ACPI_GPE_LEVEL_INFO; @@ -399,7 +432,7 @@ typedef struct typedef struct { - FIXED_EVENT_HANDLER Handler; /* Address of handler. */ + ACPI_EVENT_HANDLER Handler; /* Address of handler. */ void *Context; /* Context to be passed to handler */ } ACPI_FIXED_EVENT_INFO; @@ -423,16 +456,18 @@ typedef struct ****************************************************************************/ -#define CONTROL_NORMAL 0xC0 -#define CONTROL_CONDITIONAL_EXECUTING 0xC1 -#define CONTROL_PREDICATE_EXECUTING 0xC2 -#define CONTROL_PREDICATE_FALSE 0xC3 -#define CONTROL_PREDICATE_TRUE 0xC4 +#define CONTROL_NORMAL 0xC0 +#define CONTROL_CONDITIONAL_EXECUTING 0xC1 +#define CONTROL_PREDICATE_EXECUTING 0xC2 +#define CONTROL_PREDICATE_FALSE 0xC3 +#define CONTROL_PREDICATE_TRUE 0xC4 -/* Forward declaration */ +/* Forward declarations */ struct acpi_walk_state; -struct acpi_parse_obj ; +struct acpi_walk_list; +struct acpi_parse_obj; +struct acpi_obj_mutex; #define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\ @@ -492,7 +527,6 @@ typedef struct acpi_control_state /* * Scope state - current scope during namespace lookups */ - typedef struct acpi_scope_state { ACPI_STATE_COMMON @@ -527,6 +561,19 @@ typedef struct acpi_result_values } ACPI_RESULT_VALUES; +/* + * Notify info - used to pass info to the deferred notify + * handler/dispatcher. + */ +typedef struct acpi_notify_info +{ + ACPI_STATE_COMMON + ACPI_NAMESPACE_NODE *Node; + union acpi_operand_obj *HandlerObj; + +} ACPI_NOTIFY_INFO; + + /* Generic state is union of structs above */ typedef union acpi_gen_state @@ -538,6 +585,7 @@ typedef union acpi_gen_state ACPI_PSCOPE_STATE ParseScope; ACPI_PKG_STATE Pkg; ACPI_RESULT_VALUES Results; + ACPI_NOTIFY_INFO Notify; } ACPI_GENERIC_STATE; @@ -561,19 +609,18 @@ ACPI_STATUS (*ACPI_PARSE_UPWARDS) ( * ****************************************************************************/ +#define ACPI_OP_CLASS_MASK 0x1F +#define ACPI_OP_ARGS_MASK 0x20 +#define ACPI_OP_TYPE_MASK 0xC0 -#define ACPI_OP_CLASS_MASK 0x1F -#define ACPI_OP_ARGS_MASK 0x20 -#define ACPI_OP_TYPE_MASK 0xC0 - -#define ACPI_OP_TYPE_OPCODE 0x00 -#define ACPI_OP_TYPE_ASCII 0x40 -#define ACPI_OP_TYPE_PREFIX 0x80 -#define ACPI_OP_TYPE_UNKNOWN 0xC0 +#define ACPI_OP_TYPE_OPCODE 0x00 +#define ACPI_OP_TYPE_ASCII 0x40 +#define ACPI_OP_TYPE_PREFIX 0x80 +#define ACPI_OP_TYPE_UNKNOWN 0xC0 -#define ACPI_GET_OP_CLASS(a) ((a)->Flags & ACPI_OP_CLASS_MASK) -#define ACPI_GET_OP_ARGS(a) ((a)->Flags & ACPI_OP_ARGS_MASK) -#define ACPI_GET_OP_TYPE(a) ((a)->Flags & ACPI_OP_TYPE_MASK) +#define ACPI_GET_OP_CLASS(a) ((a)->Flags & ACPI_OP_CLASS_MASK) +#define ACPI_GET_OP_ARGS(a) ((a)->Flags & ACPI_OP_ARGS_MASK) +#define ACPI_GET_OP_TYPE(a) ((a)->Flags & ACPI_OP_TYPE_MASK) /* @@ -663,130 +710,6 @@ typedef struct acpi_parse_state /***************************************************************************** * - * Tree walking typedefs and structs - * - ****************************************************************************/ - - -/* - * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through - * the tree (for whatever reason), and for control method execution. - */ - -#define NEXT_OP_DOWNWARD 1 -#define NEXT_OP_UPWARD 2 - -#define WALK_NON_METHOD 0 -#define WALK_METHOD 1 -#define WALK_METHOD_RESTART 2 - -typedef struct acpi_walk_state -{ - UINT8 DataType; /* To differentiate various internal objs */\ - ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */ - BOOLEAN LastPredicate; /* Result of last predicate */ - UINT8 NextOpInfo; /* Info about NextOp */ - UINT8 NumOperands; /* Stack pointer for Operands[] array */ - UINT8 CurrentResult; /* */ - - struct acpi_walk_state *Next; /* Next WalkState in list */ - ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */ - -/* TBD: Obsolete with removal of WALK procedure ? */ - ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */ - ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */ - - - ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */ - ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */ - ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */ - ACPI_PARSE_STATE *ParserState; /* Current state of parser */ - UINT8 *AmlLastWhile; - ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */ - ACPI_PARSE_DOWNWARDS DescendingCallback; - ACPI_PARSE_UPWARDS AscendingCallback; - - union acpi_operand_obj *ReturnDesc; /* Return object, if any */ - union acpi_operand_obj *MethodDesc; /* Method descriptor if running a method */ - struct acpi_node *MethodNode; /* Method Node if running a method */ - ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */ - struct acpi_node *MethodCallNode; /* Called method Node*/ - union acpi_operand_obj *Operands[OBJ_NUM_OPERANDS]; /* Operands passed to the interpreter */ - struct acpi_node Arguments[MTH_NUM_ARGS]; /* Control method arguments */ - struct acpi_node LocalVariables[MTH_NUM_LOCALS]; /* Control method locals */ - UINT32 ParseFlags; - UINT8 WalkType; - UINT8 ReturnUsed; - UINT16 Opcode; /* Current AML opcode */ - UINT32 PrevArgTypes; - - /* Debug support */ - - UINT32 MethodBreakpoint; - - -} ACPI_WALK_STATE; - - -/* - * Walk list - head of a tree of walk states. Multiple walk states are created when there - * are nested control methods executing. - */ -typedef struct acpi_walk_list -{ - - ACPI_WALK_STATE *WalkState; - -} ACPI_WALK_LIST; - - -/* Info used by AcpiPsInitObjects */ - -typedef struct acpi_init_walk_info -{ - UINT16 MethodCount; - UINT16 OpRegionCount; - UINT16 FieldCount; - UINT16 OpRegionInit; - UINT16 FieldInit; - UINT16 ObjectCount; - ACPI_TABLE_DESC *TableDesc; - -} ACPI_INIT_WALK_INFO; - - -/* Info used by TBD */ - -typedef struct acpi_device_walk_info -{ - UINT16 DeviceCount; - UINT16 Num_STA; - UINT16 Num_INI; - ACPI_TABLE_DESC *TableDesc; - -} ACPI_DEVICE_WALK_INFO; - - -/* TBD: [Restructure] Merge with struct above */ - -typedef struct acpi_walk_info -{ - UINT32 DebugLevel; - UINT32 OwnerId; - -} ACPI_WALK_INFO; - -typedef struct acpi_get_devices_info -{ - WALK_CALLBACK UserFunction; - void *Context; - NATIVE_CHAR *Hid; - -} ACPI_GET_DEVICES_INFO; - - -/***************************************************************************** - * * Hardware and PNP * ****************************************************************************/ @@ -794,20 +717,20 @@ typedef struct acpi_get_devices_info /* PCI */ -#define PCI_ROOT_HID_STRING "PNP0A03" -#define PCI_ROOT_HID_VALUE 0x030AD041 /* EISAID("PNP0A03") */ +#define PCI_ROOT_HID_STRING "PNP0A03" +#define PCI_ROOT_HID_VALUE 0x030AD041 /* EISAID("PNP0A03") */ /* Sleep states */ -#define SLWA_DEBUG_LEVEL 4 -#define GTS_CALL 0 -#define GTS_WAKE 1 +#define SLWA_DEBUG_LEVEL 4 +#define GTS_CALL 0 +#define GTS_WAKE 1 /* Cx States */ -#define MAX_CX_STATE_LATENCY 0xFFFFFFFF -#define MAX_CX_STATES 4 +#define MAX_CX_STATE_LATENCY 0xFFFFFFFF +#define MAX_CX_STATES 4 /* @@ -816,13 +739,13 @@ typedef struct acpi_get_devices_info * values as they are used in switch statements and offset calculations. */ -#define REGISTER_BLOCK_MASK 0xFF00 /* Register Block Id */ -#define BIT_IN_REGISTER_MASK 0x00FF /* Bit Id in the Register Block Id */ -#define BYTE_IN_REGISTER_MASK 0x00FF /* Register Offset in the Register Block */ +#define REGISTER_BLOCK_MASK 0xFF00 /* Register Block Id */ +#define BIT_IN_REGISTER_MASK 0x00FF /* Bit Id in the Register Block Id */ +#define BYTE_IN_REGISTER_MASK 0x00FF /* Register Offset in the Register Block */ -#define REGISTER_BLOCK_ID(RegId) (RegId & REGISTER_BLOCK_MASK) -#define REGISTER_BIT_ID(RegId) (RegId & BIT_IN_REGISTER_MASK) -#define REGISTER_OFFSET(RegId) (RegId & BYTE_IN_REGISTER_MASK) +#define REGISTER_BLOCK_ID(RegId) (RegId & REGISTER_BLOCK_MASK) +#define REGISTER_BIT_ID(RegId) (RegId & BIT_IN_REGISTER_MASK) +#define REGISTER_OFFSET(RegId) (RegId & BYTE_IN_REGISTER_MASK) /* * Access Rule @@ -837,94 +760,94 @@ typedef struct acpi_get_devices_info /* * Register Block Id */ -#define PM1_STS 0x0100 -#define PM1_EN 0x0200 -#define PM1_CONTROL 0x0300 -#define PM1A_CONTROL 0x0400 -#define PM1B_CONTROL 0x0500 -#define PM2_CONTROL 0x0600 -#define PM_TIMER 0x0700 -#define PROCESSOR_BLOCK 0x0800 -#define GPE0_STS_BLOCK 0x0900 -#define GPE0_EN_BLOCK 0x0A00 -#define GPE1_STS_BLOCK 0x0B00 -#define GPE1_EN_BLOCK 0x0C00 -#define SMI_CMD_BLOCK 0x0D00 +#define PM1_STS 0x0100 +#define PM1_EN 0x0200 +#define PM1_CONTROL 0x0300 +#define PM1A_CONTROL 0x0400 +#define PM1B_CONTROL 0x0500 +#define PM2_CONTROL 0x0600 +#define PM_TIMER 0x0700 +#define PROCESSOR_BLOCK 0x0800 +#define GPE0_STS_BLOCK 0x0900 +#define GPE0_EN_BLOCK 0x0A00 +#define GPE1_STS_BLOCK 0x0B00 +#define GPE1_EN_BLOCK 0x0C00 +#define SMI_CMD_BLOCK 0x0D00 /* * Address space bitmasks for mmio or io spaces */ -#define SMI_CMD_ADDRESS_SPACE 0x01 -#define PM1_BLK_ADDRESS_SPACE 0x02 -#define PM2_CNT_BLK_ADDRESS_SPACE 0x04 -#define PM_TMR_BLK_ADDRESS_SPACE 0x08 -#define GPE0_BLK_ADDRESS_SPACE 0x10 -#define GPE1_BLK_ADDRESS_SPACE 0x20 +#define SMI_CMD_ADDRESS_SPACE 0x01 +#define PM1_BLK_ADDRESS_SPACE 0x02 +#define PM2_CNT_BLK_ADDRESS_SPACE 0x04 +#define PM_TMR_BLK_ADDRESS_SPACE 0x08 +#define GPE0_BLK_ADDRESS_SPACE 0x10 +#define GPE1_BLK_ADDRESS_SPACE 0x20 /* * Control bit definitions */ -#define TMR_STS (PM1_STS | 0x01) -#define BM_STS (PM1_STS | 0x02) -#define GBL_STS (PM1_STS | 0x03) -#define PWRBTN_STS (PM1_STS | 0x04) -#define SLPBTN_STS (PM1_STS | 0x05) -#define RTC_STS (PM1_STS | 0x06) -#define WAK_STS (PM1_STS | 0x07) - -#define TMR_EN (PM1_EN | 0x01) - /* no BM_EN */ -#define GBL_EN (PM1_EN | 0x03) -#define PWRBTN_EN (PM1_EN | 0x04) -#define SLPBTN_EN (PM1_EN | 0x05) -#define RTC_EN (PM1_EN | 0x06) -#define WAK_EN (PM1_EN | 0x07) - -#define SCI_EN (PM1_CONTROL | 0x01) -#define BM_RLD (PM1_CONTROL | 0x02) -#define GBL_RLS (PM1_CONTROL | 0x03) -#define SLP_TYPE_A (PM1_CONTROL | 0x04) -#define SLP_TYPE_B (PM1_CONTROL | 0x05) -#define SLP_EN (PM1_CONTROL | 0x06) - -#define ARB_DIS (PM2_CONTROL | 0x01) - -#define TMR_VAL (PM_TIMER | 0x01) - -#define GPE0_STS (GPE0_STS_BLOCK | 0x01) -#define GPE0_EN (GPE0_EN_BLOCK | 0x01) - -#define GPE1_STS (GPE1_STS_BLOCK | 0x01) -#define GPE1_EN (GPE1_EN_BLOCK | 0x01) - - -#define TMR_STS_MASK 0x0001 -#define BM_STS_MASK 0x0010 -#define GBL_STS_MASK 0x0020 -#define PWRBTN_STS_MASK 0x0100 -#define SLPBTN_STS_MASK 0x0200 -#define RTC_STS_MASK 0x0400 -#define WAK_STS_MASK 0x8000 - -#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \ - | PWRBTN_STS_MASK | SLPBTN_STS_MASK \ - | RTC_STS_MASK | WAK_STS_MASK) - -#define TMR_EN_MASK 0x0001 -#define GBL_EN_MASK 0x0020 -#define PWRBTN_EN_MASK 0x0100 -#define SLPBTN_EN_MASK 0x0200 -#define RTC_EN_MASK 0x0400 - -#define SCI_EN_MASK 0x0001 -#define BM_RLD_MASK 0x0002 -#define GBL_RLS_MASK 0x0004 -#define SLP_TYPE_X_MASK 0x1C00 -#define SLP_EN_MASK 0x2000 - -#define ARB_DIS_MASK 0x0001 -#define TMR_VAL_MASK 0xFFFFFFFF +#define TMR_STS (PM1_STS | 0x01) +#define BM_STS (PM1_STS | 0x02) +#define GBL_STS (PM1_STS | 0x03) +#define PWRBTN_STS (PM1_STS | 0x04) +#define SLPBTN_STS (PM1_STS | 0x05) +#define RTC_STS (PM1_STS | 0x06) +#define WAK_STS (PM1_STS | 0x07) + +#define TMR_EN (PM1_EN | 0x01) + /* no BM_EN */ +#define GBL_EN (PM1_EN | 0x03) +#define PWRBTN_EN (PM1_EN | 0x04) +#define SLPBTN_EN (PM1_EN | 0x05) +#define RTC_EN (PM1_EN | 0x06) +#define WAK_EN (PM1_EN | 0x07) + +#define SCI_EN (PM1_CONTROL | 0x01) +#define BM_RLD (PM1_CONTROL | 0x02) +#define GBL_RLS (PM1_CONTROL | 0x03) +#define SLP_TYPE_A (PM1_CONTROL | 0x04) +#define SLP_TYPE_B (PM1_CONTROL | 0x05) +#define SLP_EN (PM1_CONTROL | 0x06) + +#define ARB_DIS (PM2_CONTROL | 0x01) + +#define TMR_VAL (PM_TIMER | 0x01) + +#define GPE0_STS (GPE0_STS_BLOCK | 0x01) +#define GPE0_EN (GPE0_EN_BLOCK | 0x01) + +#define GPE1_STS (GPE1_STS_BLOCK | 0x01) +#define GPE1_EN (GPE1_EN_BLOCK | 0x01) + + +#define TMR_STS_MASK 0x0001 +#define BM_STS_MASK 0x0010 +#define GBL_STS_MASK 0x0020 +#define PWRBTN_STS_MASK 0x0100 +#define SLPBTN_STS_MASK 0x0200 +#define RTC_STS_MASK 0x0400 +#define WAK_STS_MASK 0x8000 + +#define ALL_FIXED_STS_BITS (TMR_STS_MASK | BM_STS_MASK | GBL_STS_MASK \ + | PWRBTN_STS_MASK | SLPBTN_STS_MASK \ + | RTC_STS_MASK | WAK_STS_MASK) + +#define TMR_EN_MASK 0x0001 +#define GBL_EN_MASK 0x0020 +#define PWRBTN_EN_MASK 0x0100 +#define SLPBTN_EN_MASK 0x0200 +#define RTC_EN_MASK 0x0400 + +#define SCI_EN_MASK 0x0001 +#define BM_RLD_MASK 0x0002 +#define GBL_RLS_MASK 0x0004 +#define SLP_TYPE_X_MASK 0x1C00 +#define SLP_EN_MASK 0x2000 + +#define ARB_DIS_MASK 0x0001 +#define TMR_VAL_MASK 0xFFFFFFFF #define GPE0_STS_MASK #define GPE0_EN_MASK @@ -933,55 +856,69 @@ typedef struct acpi_get_devices_info #define GPE1_EN_MASK -#define ACPI_READ 1 -#define ACPI_WRITE 2 +#define ACPI_READ 1 +#define ACPI_WRITE 2 + +/***************************************************************************** + * + * Resource descriptors + * + ****************************************************************************/ -/* Plug and play */ -/* Pnp and ACPI data */ +/* ResourceType values */ -#define VERSION_NO 0x01 -#define LOGICAL_DEVICE_ID 0x02 -#define COMPATIBLE_DEVICE_ID 0x03 -#define IRQ_FORMAT 0x04 -#define DMA_FORMAT 0x05 -#define START_DEPENDENT_TAG 0x06 -#define END_DEPENDENT_TAG 0x07 -#define IO_PORT_DESCRIPTOR 0x08 -#define FIXED_LOCATION_IO_DESCRIPTOR 0x09 -#define RESERVED_TYPE0 0x0A -#define RESERVED_TYPE1 0x0B -#define RESERVED_TYPE2 0x0C -#define RESERVED_TYPE3 0x0D -#define SMALL_VENDOR_DEFINED 0x0E -#define END_TAG 0x0F +#define RESOURCE_TYPE_MEMORY_RANGE 0 +#define RESOURCE_TYPE_IO_RANGE 1 +#define RESOURCE_TYPE_BUS_NUMBER_RANGE 2 -/* Pnp and ACPI data */ +/* Resource descriptor types and masks */ -#define MEMORY_RANGE_24 0x81 -#define ISA_MEMORY_RANGE 0x81 -#define LARGE_VENDOR_DEFINED 0x84 -#define EISA_MEMORY_RANGE 0x85 -#define MEMORY_RANGE_32 0x85 -#define FIXED_EISA_MEMORY_RANGE 0x86 -#define FIXED_MEMORY_RANGE_32 0x86 +#define RESOURCE_DESC_TYPE_LARGE 0x80 +#define RESOURCE_DESC_TYPE_SMALL 0x00 -/* ACPI only data */ +#define RESOURCE_DESC_TYPE_MASK 0x80 +#define RESOURCE_DESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */ -#define DWORD_ADDRESS_SPACE 0x87 -#define WORD_ADDRESS_SPACE 0x88 -#define EXTENDED_IRQ 0x89 -/* MUST HAVES */ +/* + * Small resource descriptor types + * Note: The 3 length bits (2:0) must be zero + */ +#define RESOURCE_DESC_IRQ_FORMAT 0x20 +#define RESOURCE_DESC_DMA_FORMAT 0x28 +#define RESOURCE_DESC_START_DEPENDENT 0x30 +#define RESOURCE_DESC_END_DEPENDENT 0x38 +#define RESOURCE_DESC_IO_PORT 0x40 +#define RESOURCE_DESC_FIXED_IO_PORT 0x48 +#define RESOURCE_DESC_SMALL_VENDOR 0x70 +#define RESOURCE_DESC_END_TAG 0x78 + +/* + * Large resource descriptor types + */ + +#define RESOURCE_DESC_MEMORY_24 0x81 +#define RESOURCE_DESC_GENERAL_REGISTER 0x82 +#define RESOURCE_DESC_LARGE_VENDOR 0x84 +#define RESOURCE_DESC_MEMORY_32 0x85 +#define RESOURCE_DESC_FIXED_MEMORY_32 0x86 +#define RESOURCE_DESC_DWORD_ADDRESS_SPACE 0x87 +#define RESOURCE_DESC_WORD_ADDRESS_SPACE 0x88 +#define RESOURCE_DESC_EXTENDED_XRUPT 0x89 +#define RESOURCE_DESC_QWORD_ADDRESS_SPACE 0x8A -#define DEVICE_ID_LENGTH 0x09 + +/* String version of device HIDs and UIDs */ + +#define ACPI_DEVICE_ID_LENGTH 0x09 typedef struct { - NATIVE_CHAR Buffer[DEVICE_ID_LENGTH]; + NATIVE_CHAR Buffer[ACPI_DEVICE_ID_LENGTH]; -} DEVICE_ID; +} ACPI_DEVICE_ID; /***************************************************************************** @@ -995,22 +932,22 @@ typedef struct #ifdef ACPI_DEBUG -#define MEM_MALLOC 0 -#define MEM_CALLOC 1 -#define MAX_MODULE_NAME 16 +#define MEM_MALLOC 0 +#define MEM_CALLOC 1 +#define MAX_MODULE_NAME 16 -typedef struct AllocationInfo +typedef struct AcpiAllocationInfo { - struct AllocationInfo *Previous; - struct AllocationInfo *Next; - void *Address; - UINT32 Size; - UINT32 Component; - UINT32 Line; - NATIVE_CHAR Module[MAX_MODULE_NAME]; - UINT8 AllocType; - -} ALLOCATION_INFO; + struct AcpiAllocationInfo *Previous; + struct AcpiAllocationInfo *Next; + void *Address; + UINT32 Size; + UINT32 Component; + UINT32 Line; + NATIVE_CHAR Module[MAX_MODULE_NAME]; + UINT8 AllocType; + +} ACPI_ALLOCATION_INFO; #endif diff --git a/sys/contrib/dev/acpica/acmacros.h b/sys/contrib/dev/acpica/acmacros.h index f30933f..55e6064 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: 62 $ + * $Revision: 72 $ * *****************************************************************************/ @@ -179,12 +179,18 @@ #define ACPI_STORE_ADDRESS(a,b) ((a)=(b)) #define ACPI_VALID_ADDRESS(a) (a) #endif + /* * Extract a byte of data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below */ #define GET8(addr) (*(UINT8*)(addr)) +/* Pointer arithmetic */ + + +#define POINTER_ADD(t,a,b) (t *) ((NATIVE_UINT)(a) + (NATIVE_UINT)(b)) +#define POINTER_DIFF(a,b) ((UINT32) ((NATIVE_UINT)(a) - (NATIVE_UINT)(b))) /* * Macros for moving data around to/from buffers that are possibly unaligned. @@ -199,6 +205,7 @@ #define MOVE_UNALIGNED16_TO_16(d,s) *(UINT16*)(d) = *(UINT16*)(s) #define MOVE_UNALIGNED32_TO_32(d,s) *(UINT32*)(d) = *(UINT32*)(s) #define MOVE_UNALIGNED16_TO_32(d,s) *(UINT32*)(d) = *(UINT16*)(s) +#define MOVE_UNALIGNED64_TO_64(d,s) *(UINT64*)(d) = *(UINT64*)(s) #else /* @@ -217,6 +224,15 @@ #define MOVE_UNALIGNED16_TO_32(d,s) {(*(UINT32*)(d)) = 0; MOVE_UNALIGNED16_TO_16(d,s);} +#define 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];} + #endif @@ -268,8 +284,26 @@ #define ROUND_PTR_UP_TO_4(a,b) ((b *)(((NATIVE_UINT)(a) + 3) & ~3)) #define ROUND_PTR_UP_TO_8(a,b) ((b *)(((NATIVE_UINT)(a) + 7) & ~7)) +#define ROUND_BITS_UP_TO_BYTES(a) DIV_8((a) + 7) +#define ROUND_BITS_DOWN_TO_BYTES(a) DIV_8((a)) + #define ROUND_UP_TO_1K(a) (((a) + 1023) >> 10) +/* Generic (non-power-of-two) rounding */ + +#define ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary)) + +/* + * Bitmask creation + * Bit positions start at zero. + * MASK_BITS_ABOVE creates a mask starting AT the position and above + * MASK_BITS_BELOW creates a mask starting one bit BELOW the position + */ + + +#define MASK_BITS_ABOVE(position) (~(((UINT32)(-1)) << ((UINT32) (position)))) +#define MASK_BITS_BELOW(position) (((UINT32)(-1)) << ((UINT32) (position))) + #ifdef DEBUG_ASSERT #undef DEBUG_ASSERT #endif @@ -313,6 +347,10 @@ #define IS_SINGLE_TABLE(x) (((x) & 0x01) == ACPI_TABLE_SINGLE ? 1 : 0) +/* Check if ACPI has been initialized properly */ + +#define ACPI_IS_INITIALIZATION_COMPLETE(s) {if (AcpiGbl_RootNode) s = AE_OK; else s=AE_NO_NAMESPACE;} + /* * Macro to check if a pointer is within an ACPI table. * Parameter (a) is the pointer to check. Parameter (b) must be defined @@ -367,6 +405,26 @@ /* + * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions) + * + * 1) Address space + * 2) Length in bytes -- convert to length in bits + * 3) Bit offset is zero + * 4) Reserved field is zero + * 5) Expand address to 64 bits + */ +#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) {a.AddressSpaceId = (UINT8) d;\ + a.RegisterBitWidth = (UINT8) MUL_8 (b);\ + a.RegisterBitOffset = 0;\ + a.Reserved = 0;\ + ACPI_STORE_ADDRESS (a.Address,c);} + +/* ACPI V1.0 entries -- address space is always I/O */ + +#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c) ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ACPI_ADR_SPACE_SYSTEM_IO) + + +/* * Reporting macros that are never compiled out */ @@ -409,7 +467,7 @@ /* Buffer dump macros */ -#define DUMP_BUFFER(a,b) AcpiCmDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) +#define DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT) /* * Debug macros that are conditionally compiled @@ -425,6 +483,7 @@ * as a local string ("_ProcName) so that it can be also used by the function exit macros below. */ +#define PROC_NAME(a) char * _ProcName = a; #define FUNCTION_TRACE(a) char * _ProcName = a;\ FunctionTrace(_THIS_MODULE,__LINE__,_COMPONENT,a) #define FUNCTION_TRACE_PTR(a,b) char * _ProcName = a;\ @@ -442,7 +501,7 @@ */ #define return_VOID {FunctionExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName);return;} #define return_ACPI_STATUS(s) {FunctionStatusExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,s);return(s);} -#define return_VALUE(s) {FunctionValueExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(ACPI_INTEGER)s);return(s);} +#define return_VALUE(s) {FunctionValueExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,s);return(s);} #define return_PTR(s) {FunctionPtrExit(_THIS_MODULE,__LINE__,_COMPONENT,_ProcName,(UINT8 *)s);return(s);} @@ -459,8 +518,8 @@ /* Stack and buffer dumping */ -#define DUMP_STACK_ENTRY(a) AcpiAmlDumpOperand(a) -#define DUMP_OPERANDS(a,b,c,d,e) AcpiAmlDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__) +#define DUMP_STACK_ENTRY(a) AcpiExDumpOperand(a) +#define DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__) #define DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b) @@ -495,6 +554,12 @@ DebugPrintRaw PARAM_LIST(fp);\ BREAK_ON_ERROR(lvl);} +#define DEBUG_PRINTP(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ + DebugPrintPrefix (_THIS_MODULE,__LINE__);\ + DebugPrintRaw ("%s: ",_ProcName);\ + DebugPrintRaw PARAM_LIST(fp);\ + BREAK_ON_ERROR(lvl);} + #define DEBUG_PRINT_RAW(lvl,fp) TEST_DEBUG_SWITCH(lvl) {\ DebugPrintRaw PARAM_LIST(fp);} @@ -522,6 +587,7 @@ #define DEBUG_DEFINE(a) #define DEBUG_ONLY_MEMBERS(a) +#define PROC_NAME(a) #define FUNCTION_TRACE(a) #define FUNCTION_TRACE_PTR(a,b) #define FUNCTION_TRACE_U32(a,b) @@ -536,6 +602,7 @@ #define DUMP_PATHNAME(a,b,c,d) #define DUMP_RESOURCE_LIST(a) #define DEBUG_PRINT(l,f) +#define DEBUG_PRINTP(l,f) #define DEBUG_PRINT_RAW(l,f) #define BREAK_MSG(a) @@ -589,4 +656,73 @@ #endif +/* + * Memory allocation tracking (DEBUG ONLY) + */ + +#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS + +#define AcpiUtAddElementToAllocList(a,b,c,d,e,f) +#define AcpiUtDeleteElementFromAllocList(a,b,c,d) +#define AcpiUtDumpCurrentAllocations(a,b) +#define AcpiUtDumpAllocationInfo() + +#define DECREMENT_OBJECT_METRICS(a) +#define INCREMENT_OBJECT_METRICS(a) +#define INITIALIZE_ALLOCATION_METRICS() +#define DECREMENT_NAME_TABLE_METRICS(a) +#define INCREMENT_NAME_TABLE_METRICS(a) + +#else + +#define INITIALIZE_ALLOCATION_METRICS() \ + AcpiGbl_CurrentObjectCount = 0; \ + AcpiGbl_CurrentObjectSize = 0; \ + AcpiGbl_RunningObjectCount = 0; \ + AcpiGbl_RunningObjectSize = 0; \ + AcpiGbl_MaxConcurrentObjectCount = 0; \ + AcpiGbl_MaxConcurrentObjectSize = 0; \ + AcpiGbl_CurrentAllocSize = 0; \ + AcpiGbl_CurrentAllocCount = 0; \ + AcpiGbl_RunningAllocSize = 0; \ + AcpiGbl_RunningAllocCount = 0; \ + AcpiGbl_MaxConcurrentAllocSize = 0; \ + AcpiGbl_MaxConcurrentAllocCount = 0; \ + AcpiGbl_CurrentNodeCount = 0; \ + AcpiGbl_CurrentNodeSize = 0; \ + AcpiGbl_MaxConcurrentNodeCount = 0 + + +#define DECREMENT_OBJECT_METRICS(a) \ + AcpiGbl_CurrentObjectCount--; \ + AcpiGbl_CurrentObjectSize -= a + +#define INCREMENT_OBJECT_METRICS(a) \ + AcpiGbl_CurrentObjectCount++; \ + AcpiGbl_RunningObjectCount++; \ + if (AcpiGbl_MaxConcurrentObjectCount < AcpiGbl_CurrentObjectCount) \ + { \ + AcpiGbl_MaxConcurrentObjectCount = AcpiGbl_CurrentObjectCount; \ + } \ + AcpiGbl_RunningObjectSize += a; \ + AcpiGbl_CurrentObjectSize += a; \ + if (AcpiGbl_MaxConcurrentObjectSize < AcpiGbl_CurrentObjectSize) \ + { \ + AcpiGbl_MaxConcurrentObjectSize = AcpiGbl_CurrentObjectSize; \ + } + +#define DECREMENT_NAME_TABLE_METRICS(a) \ + AcpiGbl_CurrentNodeCount--; \ + AcpiGbl_CurrentNodeSize -= (a) + +#define INCREMENT_NAME_TABLE_METRICS(a) \ + AcpiGbl_CurrentNodeCount++; \ + AcpiGbl_CurrentNodeSize+= (a); \ + if (AcpiGbl_MaxConcurrentNodeCount < AcpiGbl_CurrentNodeCount) \ + { \ + AcpiGbl_MaxConcurrentNodeCount = AcpiGbl_CurrentNodeCount; \ + } +#endif /* ACPI_DEBUG_TRACK_ALLOCATIONS */ + + #endif /* ACMACROS_H */ diff --git a/sys/contrib/dev/acpica/acnamesp.h b/sys/contrib/dev/acpica/acnamesp.h index 7302295..5554a81 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: 103 $ + * $Revision: 106 $ * *****************************************************************************/ @@ -185,18 +185,18 @@ AcpiNsInitOneObject ( ACPI_STATUS AcpiNsWalkNamespace ( - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, BOOLEAN UnlockBeforeCallback, - WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK UserFunction, void *Context, void **ReturnValue); ACPI_NAMESPACE_NODE * AcpiNsGetNextObject ( - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_NAMESPACE_NODE *Parent, ACPI_NAMESPACE_NODE *Child); @@ -241,7 +241,7 @@ ACPI_STATUS AcpiNsLookup ( ACPI_GENERIC_STATE *ScopeInfo, NATIVE_CHAR *Name, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, OPERATING_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, @@ -314,7 +314,7 @@ AcpiNsDumpRootDevices ( void AcpiNsDumpObjects ( - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, UINT32 MaxDepth, UINT32 OwnderId, ACPI_HANDLE StartHandle); @@ -374,7 +374,7 @@ AcpiNsExistDownstreamSibling ( UINT32 AcpiNsOpensScope ( - OBJECT_TYPE_INTERNAL Type); + ACPI_OBJECT_TYPE8 Type); NATIVE_CHAR * AcpiNsGetTablePathname ( @@ -395,12 +395,6 @@ AcpiNsPatternMatch ( ACPI_NAMESPACE_NODE *ObjNode, NATIVE_CHAR *SearchFor); -ACPI_STATUS -AcpiNsNameCompare ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); ACPI_STATUS AcpiNsGetNode ( @@ -421,14 +415,7 @@ ACPI_STATUS AcpiNsAttachObject ( ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, - OBJECT_TYPE_INTERNAL Type); - - -void * -AcpiNsCompareValue ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *ObjDesc); + ACPI_OBJECT_TYPE8 Type); /* @@ -441,7 +428,7 @@ AcpiNsSearchAndEnter ( ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, OPERATING_MODE InterpreterMode, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, UINT32 Flags, ACPI_NAMESPACE_NODE **RetNode); @@ -449,7 +436,7 @@ ACPI_STATUS AcpiNsSearchNode ( UINT32 EntryName, ACPI_NAMESPACE_NODE *Node, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_NAMESPACE_NODE **RetNode); void @@ -457,7 +444,7 @@ AcpiNsInstallNode ( ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *ParentNode, /* Parent */ ACPI_NAMESPACE_NODE *Node, /* New Child*/ - OBJECT_TYPE_INTERNAL Type); + ACPI_OBJECT_TYPE8 Type); /* @@ -472,17 +459,25 @@ BOOLEAN AcpiNsValidPathSeparator ( NATIVE_CHAR Sep); -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiNsGetType ( - ACPI_HANDLE ObjHandle); + ACPI_NAMESPACE_NODE *Node); void * AcpiNsGetAttachedObject ( - ACPI_HANDLE ObjHandle); + ACPI_NAMESPACE_NODE *Node); UINT32 AcpiNsLocal ( - OBJECT_TYPE_INTERNAL Type); + ACPI_OBJECT_TYPE8 Type); + +ACPI_STATUS +AcpiNsBuildInternalName ( + ACPI_NAMESTRING_INFO *Info); + +ACPI_STATUS +AcpiNsGetInternalNameLength ( + ACPI_NAMESTRING_INFO *Info); ACPI_STATUS AcpiNsInternalizeName ( diff --git a/sys/contrib/dev/acpica/acobject.h b/sys/contrib/dev/acpica/acobject.h index d873b11..104644d 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: 78 $ + * $Revision: 89 $ * *****************************************************************************/ @@ -149,7 +149,7 @@ */ -#define ACPI_OBJECT_COMMON_HEADER /* 32-bits plus 8-bit flag */\ +#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32-bits plus trailing 8-bit flag */\ UINT8 DataType; /* To differentiate various internal objs */\ UINT8 Type; /* ACPI_OBJECT_TYPE */\ UINT16 ReferenceCount; /* For object deletion management */\ @@ -164,16 +164,27 @@ /* * Common bitfield for the field objects + * "Field Datum" -- a datum from the actual field object + * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field */ -#define ACPI_COMMON_FIELD_INFO /* Three 32-bit values plus 8*/\ - UINT8 Granularity;\ - UINT16 Length; \ - UINT32 Offset; /* Byte offset within containing object */\ - UINT8 BitOffset; /* Bit offset within min read/write data unit */\ - UINT8 Access; /* AccessType */\ - UINT8 LockRule;\ - UINT8 UpdateRule;\ - UINT8 AccessAttribute; +#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\ + UINT8 AccessFlags;\ + UINT16 BitLength; /* Length of field in bits */\ + UINT32 BaseByteOffset; /* Byte offset within containing object */\ + UINT8 AccessBitWidth; /* Read/Write size in bits (from ASL AccessType)*/\ + UINT8 AccessByteWidth; /* Read/Write size in bytes */\ + UINT8 UpdateRule; /* How neighboring field bits are handled */\ + UINT8 LockRule; /* Global Lock: 1 = "Must Lock" */\ + UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\ + UINT8 DatumValidBits; /* Valid bit in first "Field datum" */\ + UINT8 EndFieldValidBits; /* Valid bits in the last "field datum" */\ + UINT8 EndBufferValidBits; /* Valid bits in the last "buffer datum" */\ + UINT32 Value; /* Value to store into the Bank or Index register */ + + +/* Access flag bits */ + +#define AFIELD_SINGLE_DATUM 0x1 /****************************************************************************** @@ -212,7 +223,7 @@ typedef struct /* STRING - has length and pointer - Null terminated, ASCII chara ACPI_OBJECT_COMMON_HEADER UINT32 Length; - NATIVE_CHAR *Pointer; /* String value in AML stream or in allocated space */ + NATIVE_CHAR *Pointer; /* String value in AML stream or in allocated space */ } ACPI_OBJECT_STRING; @@ -222,7 +233,7 @@ typedef struct /* BUFFER - has length and pointer - not null terminated */ ACPI_OBJECT_COMMON_HEADER UINT32 Length; - UINT8 *Pointer; /* points to the buffer in allocated space */ + UINT8 *Pointer; /* points to the buffer in allocated space */ } ACPI_OBJECT_BUFFER; @@ -231,27 +242,14 @@ typedef struct /* PACKAGE - has count, elements, next element */ { ACPI_OBJECT_COMMON_HEADER - UINT32 Count; /* # of elements in package */ + UINT32 Count; /* # of elements in package */ - union acpi_operand_obj **Elements; /* Array of pointers to AcpiObjects */ - union acpi_operand_obj **NextElement; /* used only while initializing */ + union acpi_operand_obj **Elements; /* Array of pointers to AcpiObjects */ + union acpi_operand_obj **NextElement; /* used only while initializing */ } ACPI_OBJECT_PACKAGE; -typedef struct /* FIELD UNIT */ -{ - ACPI_OBJECT_COMMON_HEADER - - ACPI_COMMON_FIELD_INFO - - union acpi_operand_obj *Extra; /* Pointer to executable AML (in field definition) */ - ACPI_NAMESPACE_NODE *Node; /* containing object */ - union acpi_operand_obj *Container; /* Containing object (Buffer) */ - -} ACPI_OBJECT_FIELD_UNIT; - - typedef struct /* DEVICE - has handle and notification handler/context */ { ACPI_OBJECT_COMMON_HEADER @@ -266,7 +264,6 @@ typedef struct /* DEVICE - has handle and notification handler/context */ typedef struct /* EVENT */ { ACPI_OBJECT_COMMON_HEADER - void *Semaphore; } ACPI_OBJECT_EVENT; @@ -292,12 +289,16 @@ typedef struct /* METHOD */ } ACPI_OBJECT_METHOD; -typedef struct /* MUTEX */ +typedef struct acpi_obj_mutex /* MUTEX */ { ACPI_OBJECT_COMMON_HEADER UINT16 SyncLevel; + UINT16 AcquisitionDepth; void *Semaphore; + void *Owner; + union acpi_operand_obj *Prev; /* Link for list of acquired mutexes */ + union acpi_operand_obj *Next; /* Link for list of acquired mutexes */ } ACPI_OBJECT_MUTEX; @@ -358,57 +359,78 @@ typedef struct /* THERMAL ZONE - has Handle and Handler/Context */ /* - * Internal types + * Fields. All share a common header/info field. */ - -typedef struct /* FIELD */ +typedef struct /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */ { ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO + union acpi_operand_obj *RegionObj; /* Containing Operation Region object */ + /* (REGION/BANK fields only) */ +} ACPI_OBJECT_FIELD_COMMON; - union acpi_operand_obj *Container; /* Containing object */ -} ACPI_OBJECT_FIELD; +typedef struct /* REGION FIELD */ +{ + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + union acpi_operand_obj *RegionObj; /* Containing OpRegion object */ + +} ACPI_OBJECT_REGION_FIELD; typedef struct /* BANK FIELD */ { ACPI_OBJECT_COMMON_HEADER - ACPI_COMMON_FIELD_INFO - UINT32 Value; /* Value to store into BankSelect */ - ACPI_HANDLE BankSelect; /* Bank select register */ - union acpi_operand_obj *Container; /* Containing object */ + union acpi_operand_obj *RegionObj; /* Containing OpRegion object */ + union acpi_operand_obj *BankRegisterObj; /* BankSelect Register object */ } ACPI_OBJECT_BANK_FIELD; typedef struct /* INDEX FIELD */ { + ACPI_OBJECT_COMMON_HEADER + ACPI_COMMON_FIELD_INFO + /* - * No container pointer needed since the index and data register definitions - * will define how to access the respective registers + * No "RegionObj" pointer needed since the Index and Data registers + * are each field definitions unto themselves. */ - ACPI_OBJECT_COMMON_HEADER + union acpi_operand_obj *IndexObj; /* Index register */ + union acpi_operand_obj *DataObj; /* Data register */ + + +} ACPI_OBJECT_INDEX_FIELD; + +/* The BufferField is different in that it is part of a Buffer, not an OpRegion */ + +typedef struct /* BUFFER FIELD */ +{ + ACPI_OBJECT_COMMON_HEADER ACPI_COMMON_FIELD_INFO - UINT32 Value; /* Value to store into Index register */ - ACPI_HANDLE Index; /* Index register */ - ACPI_HANDLE Data; /* Data register */ + union acpi_operand_obj *Extra; /* Pointer to executable AML (in field definition) */ + ACPI_NAMESPACE_NODE *Node; /* Parent (containing) object node */ + union acpi_operand_obj *BufferObj; /* Containing Buffer object */ + +} ACPI_OBJECT_BUFFER_FIELD; -} ACPI_OBJECT_INDEX_FIELD; +/* + * Handlers + */ typedef struct /* NOTIFY HANDLER */ { ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE *Node; /* Parent device */ - NOTIFY_HANDLER Handler; + ACPI_NOTIFY_HANDLER Handler; void *Context; } ACPI_OBJECT_NOTIFY_HANDLER; @@ -425,11 +447,11 @@ typedef struct /* ADDRESS HANDLER */ UINT8 SpaceId; UINT16 Hflags; - ADDRESS_SPACE_HANDLER Handler; + ACPI_ADR_SPACE_HANDLER Handler; ACPI_NAMESPACE_NODE *Node; /* Parent device */ void *Context; - ADDRESS_SPACE_SETUP Setup; + ACPI_ADR_SPACE_SETUP Setup; union acpi_operand_obj *RegionList; /* regions using this handler */ union acpi_operand_obj *Next; @@ -446,7 +468,7 @@ typedef struct /* Reference - Local object type */ ACPI_OBJECT_COMMON_HEADER UINT8 TargetType; /* Used for IndexOp */ - UINT16 OpCode; + UINT16 Opcode; UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */ void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */ @@ -491,7 +513,7 @@ typedef union acpi_operand_obj ACPI_OBJECT_STRING String; ACPI_OBJECT_BUFFER Buffer; ACPI_OBJECT_PACKAGE Package; - ACPI_OBJECT_FIELD_UNIT FieldUnit; + ACPI_OBJECT_BUFFER_FIELD BufferField; ACPI_OBJECT_DEVICE Device; ACPI_OBJECT_EVENT Event; ACPI_OBJECT_METHOD Method; @@ -500,7 +522,8 @@ typedef union acpi_operand_obj ACPI_OBJECT_POWER_RESOURCE PowerResource; ACPI_OBJECT_PROCESSOR Processor; ACPI_OBJECT_THERMAL_ZONE ThermalZone; - ACPI_OBJECT_FIELD Field; + ACPI_OBJECT_FIELD_COMMON CommonField; + ACPI_OBJECT_REGION_FIELD Field; ACPI_OBJECT_BANK_FIELD BankField; ACPI_OBJECT_INDEX_FIELD IndexField; ACPI_OBJECT_REFERENCE Reference; diff --git a/sys/contrib/dev/acpica/acoutput.h b/sys/contrib/dev/acpica/acoutput.h index 00f4918..f2746a8 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: 70 $ + * $Revision: 77 $ * *****************************************************************************/ @@ -125,34 +125,38 @@ /* Component IDs -- used in the global "DebugLayer" */ -#define GLOBAL 0x00000001 -#define COMMON 0x00000002 -#define PARSER 0x00000004 -#define DISPATCHER 0x00000008 -#define INTERPRETER 0x00000010 -#define NAMESPACE 0x00000020 -#define RESOURCE_MANAGER 0x00000040 -#define TABLE_MANAGER 0x00000080 -#define EVENT_HANDLING 0x00000100 -#define HARDWARE 0x00000200 -#define MISCELLANEOUS 0x00000400 -#define OS_DEPENDENT 0x00000800 +#define ACPI_UTILITIES 0x00000001 +#define ACPI_HARDWARE 0x00000002 +#define ACPI_EVENTS 0x00000004 +#define ACPI_TABLES 0x00000008 +#define ACPI_NAMESPACE 0x00000010 +#define ACPI_PARSER 0x00000020 +#define ACPI_DISPATCHER 0x00000040 +#define ACPI_EXECUTER 0x00000080 +#define ACPI_RESOURCES 0x00000100 +#define ACPI_DEVICES 0x00000200 +#define ACPI_POWER 0x00000400 -#define BUS_MANAGER 0x00001000 -#define PROCESSOR_CONTROL 0x00002000 -#define SYSTEM_CONTROL 0x00004000 -#define THERMAL_CONTROL 0x00008000 -#define POWER_CONTROL 0x00010000 +#define ACPI_BUS_MANAGER 0x00001000 +#define ACPI_POWER_CONTROL 0x00002000 +#define ACPI_EMBEDDED_CONTROLLER 0x00004000 +#define ACPI_PROCESSOR_CONTROL 0x00008000 +#define ACPI_AC_ADAPTER 0x00010000 +#define ACPI_BATTERY 0x00020000 +#define ACPI_BUTTON 0x00040000 +#define ACPI_SYSTEM 0x00080000 +#define ACPI_THERMAL_ZONE 0x00100000 -#define EMBEDDED_CONTROLLER 0x00020000 -#define BATTERY 0x00040000 +#define ACPI_DEBUGGER 0x01000000 +#define ACPI_OS_SERVICES 0x02000000 +#define ACPI_ALL_COMPONENTS 0x01FFFFFF -#define DEBUGGER 0x00100000 -#define COMPILER 0x00200000 -#define ALL_COMPONENTS 0x001FFFFF +#define ACPI_COMPONENT_DEFAULT (ACPI_ALL_COMPONENTS) -#define COMPONENT_DEFAULT (ALL_COMPONENTS) + +#define ACPI_COMPILER 0x10000000 +#define ACPI_TOOLS 0x20000000 /* Exception level -- used in the global "DebugLevel" */ @@ -168,6 +172,7 @@ /* Trace level -- also used in the global "DebugLevel" */ +#define TRACE_THREADS 0x00000080 #define TRACE_PARSE 0x00000100 #define TRACE_DISPATCH 0x00000200 #define TRACE_LOAD 0x00000400 @@ -189,7 +194,7 @@ #define TRACE_MUTEX 0x04000000 #define TRACE_INIT 0x08000000 -#define TRACE_ALL 0x0FFFFF00 +#define TRACE_ALL 0x0FFFFF80 /* Exceptionally verbose output -- also used in the global "DebugLevel" */ diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/acpi.h index 4f32887..fca0cb4 100644 --- a/sys/contrib/dev/acpica/acpi.h +++ b/sys/contrib/dev/acpica/acpi.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acpi.h - Master include file, Publics and external data. - * $Revision: 50 $ + * $Revision: 54 $ * *****************************************************************************/ @@ -122,20 +122,21 @@ * We put them here because we don't want to duplicate them * in the rest of the source code again and again. */ -#include "acconfig.h" /* Configuration constants */ -#include "acenv.h" /* Target environment specific items */ -#include "actypes.h" /* Fundamental data types */ -#include "acexcep.h" /* Local exception codes */ -#include "acmacros.h" /* C macros */ -#include "actbl.h" /* Acpi table definitions */ -#include "aclocal.h" /* Internal data types */ -#include "acoutput.h" /* Error output and Debug macros */ -#include "acpiosxf.h" /* Interfaces to the Acpi-to-OS layer*/ -#include "acpixf.h" /* Acpi core external interfaces */ -#include "acobject.h" /* Acpi internal object */ -#include "acglobal.h" /* All global variables */ -#include "achware.h" /* Hardware defines and interfaces */ -#include "accommon.h" /* Common (global) interfaces */ +#include "acconfig.h" /* Configuration constants */ +#include "platform/acenv.h" /* Target environment specific items */ +#include "actypes.h" /* Fundamental common data types */ +#include "acexcep.h" /* ACPI exception codes */ +#include "acmacros.h" /* C macros */ +#include "actbl.h" /* ACPI table definitions */ +#include "aclocal.h" /* Internal data types */ +#include "acoutput.h" /* Error output and Debug macros */ +#include "acpiosxf.h" /* Interfaces to the ACPI-to-OS layer*/ +#include "acpixf.h" /* ACPI core subsystem external interfaces */ +#include "acobject.h" /* ACPI internal object */ +#include "acstruct.h" /* Common structures */ +#include "acglobal.h" /* All global variables */ +#include "achware.h" /* Hardware defines and interfaces */ +#include "acutils.h" /* Utility interfaces */ #endif /* __ACPI_H__ */ diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h index 8603fb9..a893970 100644 --- a/sys/contrib/dev/acpica/acpiosxf.h +++ b/sys/contrib/dev/acpica/acpiosxf.h @@ -1,9 +1,9 @@ /****************************************************************************** * - * Name: acpiosxf.h - All interfaces to the OS-dependent layer. These - * interfaces must be implemented by the OS-dependent - * front-end to the ACPI subsystem. + * Name: acpiosxf.h - All interfaces to the OS Services Layer (OSL). These + * interfaces must be implemented by OSL to interface the + * ACPI components to the host operating system. * *****************************************************************************/ @@ -117,26 +117,26 @@ * *****************************************************************************/ -#ifndef __ACPIOSD_H__ -#define __ACPIOSD_H__ +#ifndef __ACPIOSXF_H__ +#define __ACPIOSXF_H__ -#include "acenv.h" +#include "platform/acenv.h" #include "actypes.h" /* Priorities for AcpiOsQueueForExecution */ -#define OSD_PRIORITY_GPE 1 -#define OSD_PRIORITY_HIGH 2 -#define OSD_PRIORITY_MED 3 -#define OSD_PRIORITY_LO 4 +#define OSD_PRIORITY_GPE 1 +#define OSD_PRIORITY_HIGH 2 +#define OSD_PRIORITY_MED 3 +#define OSD_PRIORITY_LO 4 -#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) -#define ACPI_MUTEX_SEM 1 +#define ACPI_NO_UNIT_LIMIT ((UINT32) -1) +#define ACPI_MUTEX_SEM 1 /* - * Types specific to the OS-dependent layer interfaces + * Types specific to the OS service interfaces */ typedef @@ -149,7 +149,7 @@ void (*OSD_EXECUTION_CALLBACK) ( /* - * Initialization and shutdown primitives (Optional) + * OSL Initialization and shutdown primitives */ ACPI_STATUS @@ -160,6 +160,7 @@ ACPI_STATUS AcpiOsTerminate ( void); + /* * Synchronization primitives */ @@ -185,6 +186,7 @@ AcpiOsSignalSemaphore ( ACPI_HANDLE Handle, UINT32 Units); + /* * Memory allocation and mapping */ @@ -217,6 +219,7 @@ AcpiOsGetPhysicalAddress ( void *LogicalAddress, ACPI_PHYSICAL_ADDRESS *PhysicalAddress); + /* * Interrupt handlers */ @@ -234,9 +237,13 @@ AcpiOsRemoveInterruptHandler ( /* - * Scheduling + * Threads and Scheduling */ +UINT32 +AcpiOsGetThreadId ( + void); + ACPI_STATUS AcpiOsQueueForExecution ( UINT32 Priority, @@ -252,6 +259,7 @@ void AcpiOsSleepUsec ( UINT32 Microseconds); + /* * Platform/Hardware independent I/O interfaces */ @@ -284,6 +292,7 @@ AcpiOsOut32 ( ACPI_IO_ADDRESS OutPort, UINT32 Value); + /* * Platform/Hardware independent physical memory interfaces */ @@ -398,6 +407,7 @@ AcpiOsVprintf ( const NATIVE_CHAR *Format, va_list Args); + /* * Debug input */ @@ -419,4 +429,4 @@ AcpiOsDbgAssert( NATIVE_CHAR *Message); -#endif /* __ACPIOSD_H__ */ +#endif /* __ACPIOSXF_H__ */ diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h index c33ca3f..84ec9a2 100644 --- a/sys/contrib/dev/acpica/acpixf.h +++ b/sys/contrib/dev/acpica/acpixf.h @@ -121,6 +121,7 @@ #include "actypes.h" #include "actbl.h" + /* * Global interfaces */ @@ -156,6 +157,23 @@ AcpiFormatException ( /* + * ACPI Memory manager + */ + +void * +AcpiAllocate ( + UINT32 Size); + +void * +AcpiCallocate ( + UINT32 Size); + +void +AcpiFree ( + void *Address); + + +/* * ACPI table manipulation interfaces */ @@ -197,14 +215,14 @@ AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, - WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK UserFunction, void *Context, void * *ReturnValue); ACPI_STATUS AcpiGetDevices ( NATIVE_CHAR *HID, - WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK UserFunction, void *Context, void **ReturnValue); @@ -256,52 +274,52 @@ AcpiGetParent ( /* - * AcpiEvent handler interfaces + * Event handler interfaces */ ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32 AcpiEvent, - FIXED_EVENT_HANDLER Handler, + ACPI_EVENT_HANDLER Handler, void *Context); ACPI_STATUS AcpiRemoveFixedEventHandler ( UINT32 AcpiEvent, - FIXED_EVENT_HANDLER Handler); + ACPI_EVENT_HANDLER Handler); ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, - NOTIFY_HANDLER Handler, + ACPI_NOTIFY_HANDLER Handler, void *Context); ACPI_STATUS AcpiRemoveNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, - NOTIFY_HANDLER Handler); + ACPI_NOTIFY_HANDLER Handler); ACPI_STATUS AcpiInstallAddressSpaceHandler ( ACPI_HANDLE Device, - ACPI_ADDRESS_SPACE_TYPE SpaceId, - ADDRESS_SPACE_HANDLER Handler, - ADDRESS_SPACE_SETUP Setup, + ACPI_ADR_SPACE_TYPE SpaceId, + ACPI_ADR_SPACE_HANDLER Handler, + ACPI_ADR_SPACE_SETUP Setup, void *Context); ACPI_STATUS AcpiRemoveAddressSpaceHandler ( ACPI_HANDLE Device, - ACPI_ADDRESS_SPACE_TYPE SpaceId, - ADDRESS_SPACE_HANDLER Handler); + ACPI_ADR_SPACE_TYPE SpaceId, + ACPI_ADR_SPACE_HANDLER Handler); ACPI_STATUS AcpiInstallGpeHandler ( UINT32 GpeNumber, UINT32 Type, - GPE_HANDLER Handler, + ACPI_GPE_HANDLER Handler, void *Context); ACPI_STATUS @@ -315,7 +333,7 @@ AcpiReleaseGlobalLock ( ACPI_STATUS AcpiRemoveGpeHandler ( UINT32 GpeNumber, - GPE_HANDLER Handler); + ACPI_GPE_HANDLER Handler); ACPI_STATUS AcpiEnableEvent ( diff --git a/sys/contrib/dev/acpica/acresrc.h b/sys/contrib/dev/acpica/acresrc.h index dd942a9..4700c94 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: 22 $ + * $Revision: 25 $ * *****************************************************************************/ @@ -152,7 +152,7 @@ AcpiRsCreateResourceList ( ACPI_STATUS AcpiRsCreateByteStream ( - RESOURCE *LinkedListBuffer, + ACPI_RESOURCE *LinkedListBuffer, UINT8 *OutputBuffer, UINT32 *OutputBufferLength); @@ -169,7 +169,7 @@ AcpiRsCreatePciRoutingTable ( void AcpiRsDumpResourceList ( - RESOURCE *Resource); + ACPI_RESOURCE *Resource); void AcpiRsDumpIrqList ( @@ -189,7 +189,7 @@ AcpiRsCalculateListLength ( ACPI_STATUS AcpiRsCalculateByteStreamLength ( - RESOURCE *LinkedListBuffer, + ACPI_RESOURCE *LinkedListBuffer, UINT32 *SizeNeeded); ACPI_STATUS @@ -205,7 +205,7 @@ AcpiRsByteStreamToList ( ACPI_STATUS AcpiRsListToByteStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT32 ByteStreamSizeNeeded, UINT8 **OutputBuffer); @@ -225,13 +225,13 @@ AcpiRsFixedIoResource ( ACPI_STATUS AcpiRsIoStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); ACPI_STATUS AcpiRsFixedIoStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -244,7 +244,7 @@ AcpiRsIrqResource ( ACPI_STATUS AcpiRsIrqStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -257,7 +257,7 @@ AcpiRsDmaResource ( ACPI_STATUS AcpiRsDmaStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -270,7 +270,7 @@ AcpiRsAddress16Resource ( ACPI_STATUS AcpiRsAddress16Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -283,7 +283,20 @@ AcpiRsAddress32Resource ( ACPI_STATUS AcpiRsAddress32Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + UINT32 *BytesConsumed); + +ACPI_STATUS +AcpiRsAddress64Resource ( + UINT8 *ByteStreamBuffer, + UINT32 *BytesConsumed, + UINT8 **OutputBuffer, + UINT32 *StructureSize); + +ACPI_STATUS +AcpiRsAddress64Stream ( + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -303,13 +316,13 @@ AcpiRsEndDependentFunctionsResource ( ACPI_STATUS AcpiRsStartDependentFunctionsStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); ACPI_STATUS AcpiRsEndDependentFunctionsStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -322,7 +335,7 @@ AcpiRsMemory24Resource ( ACPI_STATUS AcpiRsMemory24Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -343,13 +356,13 @@ AcpiRsFixedMemory32Resource ( ACPI_STATUS AcpiRsMemory32RangeStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); ACPI_STATUS AcpiRsFixedMemory32Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -362,7 +375,7 @@ AcpiRsExtendedIrqResource ( ACPI_STATUS AcpiRsExtendedIrqStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -375,7 +388,7 @@ AcpiRsEndTagResource ( ACPI_STATUS AcpiRsEndTagStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); @@ -388,9 +401,12 @@ AcpiRsVendorResource ( ACPI_STATUS AcpiRsVendorStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed); +UINT8 +AcpiRsGetResourceType ( + UINT8 ResourceStartByte); #endif /* __ACRESRC_H__ */ diff --git a/sys/contrib/dev/acpica/actbl.h b/sys/contrib/dev/acpica/actbl.h index bd1d718..fe81c96 100644 --- a/sys/contrib/dev/acpica/actbl.h +++ b/sys/contrib/dev/acpica/actbl.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl.h - Table data structures defined in ACPI specification - * $Revision: 45 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -231,7 +231,7 @@ typedef struct /* Processor APIC */ UINT8 ProcessorApicId; /* ACPI processor id */ UINT8 LocalApicId; /* processor's local APIC id */ UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */ - UINT32_BIT Reserved1 : 32; + UINT32_BIT Reserved1 : 31; } PROCESSOR_APIC; diff --git a/sys/contrib/dev/acpica/actbl2.h b/sys/contrib/dev/acpica/actbl2.h index 43d534c..3c17cc1 100644 --- a/sys/contrib/dev/acpica/actbl2.h +++ b/sys/contrib/dev/acpica/actbl2.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: actbl2.h - ACPI Specification Revision 2.0 Tables - * $Revision: 21 $ + * $Revision: 24 $ * *****************************************************************************/ @@ -117,159 +117,156 @@ #ifndef __ACTBL2_H__ #define __ACTBL2_H__ -/**************************************/ -/* Prefered Power Management Profiles */ -/**************************************/ -#define PM_UNSPECIFIED 0 -#define PM_DESKTOP 1 -#define PM_MOBILE 2 -#define PM_WORKSTATION 3 -#define PM_ENTERPRISE_SERVER 4 -#define PM_SOHO_SERVER 5 -#define PM_APPLIANCE_PC 6 +/* + * Prefered Power Management Profiles + */ +#define PM_UNSPECIFIED 0 +#define PM_DESKTOP 1 +#define PM_MOBILE 2 +#define PM_WORKSTATION 3 +#define PM_ENTERPRISE_SERVER 4 +#define PM_SOHO_SERVER 5 +#define PM_APPLIANCE_PC 6 -/*********************************************/ -/* ACPI Boot Arch Flags, See spec Table 5-10 */ -/*********************************************/ -#define BAF_LEGACY_DEVICES 0x0001 -#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 +/* + * ACPI Boot Arch Flags + */ +#define BAF_LEGACY_DEVICES 0x0001 +#define BAF_8042_KEYBOARD_CONTROLLER 0x0002 + +#define FADT2_REVISION_ID 3 -#define FADT2_REVISION_ID 3 #pragma pack(1) -/*************************************/ -/* ACPI Specification Rev 2.0 for */ -/* the Root System Description Table */ -/*************************************/ +/* + * ACPI Specification Rev 2.0 for the Root System Description Table + */ typedef struct { - ACPI_TABLE_HEADER header; /* Table header */ - UINT32 TableOffsetEntry [1]; /* Array of pointers to */ - /* other tables' headers */ + ACPI_TABLE_HEADER header; /* Table header */ + UINT32 TableOffsetEntry [1]; /* Array of pointers to */ + /* other tables' headers */ } RSDT_DESCRIPTOR_REV2; -/********************************************/ -/* ACPI Specification Rev 2.0 for the */ -/* Extended System Description Table (XSDT) */ -/********************************************/ +/* + * ACPI Specification Rev 2.0 for the Extended System Description Table (XSDT) + */ typedef struct { - ACPI_TABLE_HEADER Header; /* Table header */ - UINT64 TableOffsetEntry [1]; /* Array of pointers to */ - /* other tables' headers */ + ACPI_TABLE_HEADER Header; /* Table header */ + UINT64 TableOffsetEntry [1]; /* Array of pointers to */ + /* other tables' headers */ } XSDT_DESCRIPTOR_REV2; -/***************************************/ -/* ACPI Specification Rev 2.0 for */ -/* the Firmware ACPI Control Structure */ -/***************************************/ + +/* + * ACPI Specification Rev 2.0 for the Firmware ACPI Control Structure + */ typedef struct { - NATIVE_CHAR Signature[4]; /* signature "FACS" */ - UINT32 Length; /* length of structure, in bytes */ - UINT32 HardwareSignature; /* hardware configuration signature */ - UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */ - UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */ - UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */ - UINT32_BIT Reserved1 : 31; /* must be 0 */ - UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */ - UINT8 Version; /* Version of this table */ - UINT8 Reserved3 [31]; /* reserved - must be zero */ + NATIVE_CHAR Signature[4]; /* signature "FACS" */ + UINT32 Length; /* length of structure, in bytes */ + UINT32 HardwareSignature; /* hardware configuration signature */ + UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */ + UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */ + UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */ + UINT32_BIT Reserved1 : 31; /* must be 0 */ + UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */ + UINT8 Version; /* Version of this table */ + UINT8 Reserved3 [31]; /* reserved - must be zero */ } FACS_DESCRIPTOR_REV2; -/***************************************/ -/* ACPI Specification Rev 2.0 for */ -/* the Generic Address Structure (GAS) */ -/***************************************/ +/* + * ACPI Specification Rev 2.0 for the Generic Address Structure (GAS) + */ typedef struct { - UINT8 AddressSpaceId; /* Address space where struct or register exists. */ - UINT8 RegisterBitWidth; /* Size in bits of given register */ - UINT8 RegisterBitOffset; /* Bit offset within the register */ - UINT8 Reserved; /* Must be 0 */ - UINT64 Address; /* 64-bit address of struct or register */ + UINT8 AddressSpaceId; /* Address space where struct or register exists. */ + UINT8 RegisterBitWidth; /* Size in bits of given register */ + UINT8 RegisterBitOffset; /* Bit offset within the register */ + UINT8 Reserved; /* Must be 0 */ + UINT64 Address; /* 64-bit address of struct or register */ -} ACPI_GAS; +} ACPI_GENERIC_ADDRESS; -/************************************/ -/* ACPI Specification Rev 2.0 for */ -/* the Fixed ACPI Description Table */ -/************************************/ +/* + * ACPI Specification Rev 2.0 for the Fixed ACPI Description Table + */ typedef struct { - ACPI_TABLE_HEADER header; /* table header */ - UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ - UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ - UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ - UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */ - UINT16 SciInt; /* System vector of SCI interrupt */ - UINT32 SmiCmd; /* Port address of SMI command port */ - UINT8 AcpiEnable; /* value to write to smi_cmd to enable ACPI */ - UINT8 AcpiDisable; /* value to write to smi_cmd to disable ACPI */ - UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ - UINT8 PstateCnt; /* processor performance state control*/ - UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ - UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ - UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ - UINT32 V1_Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ - UINT32 V1_Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ - UINT32 V1_PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - UINT32 V1_Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ - UINT32 V1_Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ - UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ - UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ - UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ - UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ - UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ - UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ - UINT8 Gpe1Base; /* offset in gpe model where gpe1 events start */ - UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/ - UINT16 Plvl2Lat; /* worst case HW latency to enter/exit C2 state */ - UINT16 Plvl3Lat; /* worst case HW latency to enter/exit C3 state */ - UINT16 FlushSize; /* number of flush strides that need to be read */ - UINT16 FlushStride; /* Processor's memory cache line width, in bytes */ - UINT8 DutyOffset; /* Processor’s duty cycle index in processor's P_CNT reg*/ - UINT8 DutyWidth; /* Processor’s duty cycle value bit width in P_CNT register.*/ - UINT8 DayAlrm; /* index to day-of-month alarm in RTC CMOS RAM */ - UINT8 MonAlrm; /* index to month-of-year alarm in RTC CMOS RAM */ - UINT8 Century; /* index to century in RTC CMOS RAM */ - UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ - UINT8 Reserved2; /* reserved */ - UINT32_BIT WbInvd : 1; /* wbinvd instruction works properly */ - UINT32_BIT WbInvdFlush : 1; /* wbinvd flushes but does not invalidate */ - UINT32_BIT ProcC1 : 1; /* all processors support C1 state */ - UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */ - UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */ - UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */ - UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */ - UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - UINT32_BIT TmrValExt : 1; /* tmr_val is 32 bits */ - UINT32_BIT DockCap : 1; /* Supports Docking */ - UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/ - UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */ - UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/ - UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */ - /* must be executed after writing the SLP_TYPx register. */ - UINT32_BIT Reserved6 : 18; /* reserved - must be zero */ + ACPI_TABLE_HEADER header; /* table header */ + UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ + UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ + UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ + UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */ + UINT16 SciInt; /* System vector of SCI interrupt */ + UINT32 SmiCmd; /* Port address of SMI command port */ + UINT8 AcpiEnable; /* value to write to smi_cmd to enable ACPI */ + UINT8 AcpiDisable; /* value to write to smi_cmd to disable ACPI */ + UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ + UINT8 PstateCnt; /* processor performance state control*/ + UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ + UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ + UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ + UINT32 V1_Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ + UINT32 V1_Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ + UINT32 V1_PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ + UINT32 V1_Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ + UINT32 V1_Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ + UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ + UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ + UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ + UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ + UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ + UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ + UINT8 Gpe1Base; /* offset in gpe model where gpe1 events start */ + UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/ + UINT16 Plvl2Lat; /* worst case HW latency to enter/exit C2 state */ + UINT16 Plvl3Lat; /* worst case HW latency to enter/exit C3 state */ + UINT16 FlushSize; /* number of flush strides that need to be read */ + UINT16 FlushStride; /* Processor's memory cache line width, in bytes */ + UINT8 DutyOffset; /* Processor’s duty cycle index in processor's P_CNT reg*/ + UINT8 DutyWidth; /* Processor’s duty cycle value bit width in P_CNT register.*/ + UINT8 DayAlrm; /* index to day-of-month alarm in RTC CMOS RAM */ + UINT8 MonAlrm; /* index to month-of-year alarm in RTC CMOS RAM */ + UINT8 Century; /* index to century in RTC CMOS RAM */ + UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/ + UINT8 Reserved2; /* reserved */ + UINT32_BIT WbInvd : 1; /* wbinvd instruction works properly */ + UINT32_BIT WbInvdFlush : 1; /* wbinvd flushes but does not invalidate */ + UINT32_BIT ProcC1 : 1; /* all processors support C1 state */ + UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */ + UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */ + UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */ + UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */ + UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ + UINT32_BIT TmrValExt : 1; /* tmr_val is 32 bits */ + UINT32_BIT DockCap : 1; /* Supports Docking */ + UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/ + UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */ + UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/ + UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */ + /* must be executed after writing the SLP_TYPx register. */ + UINT32_BIT Reserved6 : 18; /* reserved - must be zero */ - ACPI_GAS ResetRegister; /* Reset register address in GAS format */ - UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */ - UINT8 Reserved7[3]; /* These three bytes must be zero */ - UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */ - UINT64 XDsdt; /* 64-bit physical address of DSDT */ - ACPI_GAS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */ - ACPI_GAS XPm1bEvtBlk; /* Extended Power Mgt 1b AcpiEvent Reg Blk address */ - ACPI_GAS XPm1aCntBlk; /* Extended Power Mgt 1a Control Reg Blk address */ - ACPI_GAS XPm1bCntBlk; /* Extended Power Mgt 1b Control Reg Blk address */ - ACPI_GAS XPm2CntBlk; /* Extended Power Mgt 2 Control Reg Blk address */ - ACPI_GAS XPmTmrBlk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ - ACPI_GAS XGpe0Blk; /* Extended General Purpose AcpiEvent 0 Reg Blk address */ - ACPI_GAS XGpe1Blk; /* Extended General Purpose AcpiEvent 1 Reg Blk address */ + ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */ + UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */ + UINT8 Reserved7[3]; /* These three bytes must be zero */ + UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */ + UINT64 XDsdt; /* 64-bit physical address of DSDT */ + ACPI_GENERIC_ADDRESS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1bEvtBlk; /* Extended Power Mgt 1b AcpiEvent Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1aCntBlk; /* Extended Power Mgt 1a Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm1bCntBlk; /* Extended Power Mgt 1b Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPm2CntBlk; /* Extended Power Mgt 2 Control Reg Blk address */ + ACPI_GENERIC_ADDRESS XPmTmrBlk; /* Extended Power Mgt Timer Ctrl Reg Blk address */ + ACPI_GENERIC_ADDRESS XGpe0Blk; /* Extended General Purpose AcpiEvent 0 Reg Blk address */ + ACPI_GENERIC_ADDRESS XGpe1Blk; /* Extended General Purpose AcpiEvent 1 Reg Blk address */ } FADT_DESCRIPTOR_REV2; diff --git a/sys/contrib/dev/acpica/actbl71.h b/sys/contrib/dev/acpica/actbl71.h index 4f9767a..a8d4392 100644 --- a/sys/contrib/dev/acpica/actbl71.h +++ b/sys/contrib/dev/acpica/actbl71.h @@ -3,7 +3,7 @@ * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71 * This file includes tables specific to this * specification revision. - * $Revision: 9 $ + * $Revision: 11 $ * *****************************************************************************/ @@ -119,8 +119,10 @@ #ifndef __ACTBL71_H__ #define __ACTBL71_H__ + /* 0.71 FADT AddressSpace data item bitmasks defines */ /* If the associated bit is zero then it is in memory space else in io space */ + #define SMI_CMD_ADDRESS_SPACE 0x01 #define PM1_BLK_ADDRESS_SPACE 0x02 #define PM2_CNT_BLK_ADDRESS_SPACE 0x04 @@ -129,10 +131,11 @@ #define GPE1_BLK_ADDRESS_SPACE 0x20 /* Only for clarity in declarations */ + typedef UINT64 IO_ADDRESS; -#pragma pack(1) +#pragma pack(1) typedef struct /* Root System Descriptor Pointer */ { NATIVE_CHAR Signature [8]; /* contains "RSD PTR " */ diff --git a/sys/contrib/dev/acpica/actypes.h b/sys/contrib/dev/acpica/actypes.h index 7e8db54..3d375aa 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: 165 $ + * $Revision: 178 $ * *****************************************************************************/ @@ -322,6 +322,10 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_ROOT_OBJECT (ACPI_HANDLE)(-1) + +/* + * Initialization sequence + */ #define ACPI_FULL_INITIALIZATION 0x00 #define ACPI_NO_ADDRESS_SPACE_INIT 0x01 #define ACPI_NO_HARDWARE_INIT 0x02 @@ -332,7 +336,7 @@ typedef UINT64 ACPI_INTEGER; /* - * Sleep state constants + * System states */ #define ACPI_STATE_S0 (UINT8) 0 #define ACPI_STATE_S1 (UINT8) 1 @@ -343,6 +347,19 @@ typedef UINT64 ACPI_INTEGER; /* let's pretend S4BIOS didn't exist for now. ASG */ #define ACPI_STATE_S4BIOS (UINT8) 6 #define ACPI_S_STATES_MAX ACPI_STATE_S5 +#define ACPI_S_STATE_COUNT 6 + +/* + * Device power states + */ +#define ACPI_STATE_D0 (UINT8) 0 +#define ACPI_STATE_D1 (UINT8) 1 +#define ACPI_STATE_D2 (UINT8) 2 +#define ACPI_STATE_D3 (UINT8) 3 +#define ACPI_D_STATES_MAX ACPI_STATE_D3 +#define ACPI_D_STATE_COUNT 4 + +#define ACPI_STATE_UNKNOWN (UINT8) 0xFF /* @@ -373,35 +390,7 @@ typedef UINT32 ACPI_TABLE_TYPE; */ typedef UINT32 ACPI_OBJECT_TYPE; -typedef UINT8 OBJECT_TYPE_INTERNAL; - -#define ACPI_BTYPE_ANY 0x00000000 -#define ACPI_BTYPE_INTEGER 0x00000001 -#define ACPI_BTYPE_STRING 0x00000002 -#define ACPI_BTYPE_BUFFER 0x00000004 -#define ACPI_BTYPE_PACKAGE 0x00000008 -#define ACPI_BTYPE_FIELD_UNIT 0x00000010 -#define ACPI_BTYPE_DEVICE 0x00000020 -#define ACPI_BTYPE_EVENT 0x00000040 -#define ACPI_BTYPE_METHOD 0x00000080 -#define ACPI_BTYPE_MUTEX 0x00000100 -#define ACPI_BTYPE_REGION 0x00000200 -#define ACPI_BTYPE_POWER 0x00000400 -#define ACPI_BTYPE_PROCESSOR 0x00000800 -#define ACPI_BTYPE_THERMAL 0x00001000 -#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 -#define ACPI_BTYPE_DDB_HANDLE 0x00004000 -#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 -#define ACPI_BTYPE_REFERENCE 0x00010000 -#define ACPI_BTYPE_RESOURCE 0x00020000 - -#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) - -#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) -#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) -#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) -#define ACPI_BTYPE_OBJECTS_AND_REFS 0x00017FFF /* ARG or LOCAL */ -#define ACPI_BTYPE_ALL_OBJECTS 0x00007FFF +typedef UINT8 ACPI_OBJECT_TYPE8; #define ACPI_TYPE_ANY 0 /* 0x00 */ @@ -433,7 +422,7 @@ typedef UINT8 OBJECT_TYPE_INTERNAL; */ #define INTERNAL_TYPE_BEGIN 17 -#define INTERNAL_TYPE_DEF_FIELD 17 /* 0x11 */ +#define INTERNAL_TYPE_REGION_FIELD 17 /* 0x11 */ #define INTERNAL_TYPE_BANK_FIELD 18 /* 0x12 */ #define INTERNAL_TYPE_INDEX_FIELD 19 /* 0x13 */ #define INTERNAL_TYPE_REFERENCE 20 /* 0x14 Arg#, Local#, Name, Debug; used only in descriptors */ @@ -447,12 +436,12 @@ typedef UINT8 OBJECT_TYPE_INTERNAL; /* These are pseudo-types because there are never any namespace nodes with these types */ -#define INTERNAL_TYPE_DEF_FIELD_DEFN 25 /* 0x19 Name, ByteConst, multiple FieldElement */ +#define INTERNAL_TYPE_FIELD_DEFN 25 /* 0x19 Name, ByteConst, multiple FieldElement */ #define INTERNAL_TYPE_BANK_FIELD_DEFN 26 /* 0x1A 2 Name,DWordConst,ByteConst,multi FieldElement */ #define INTERNAL_TYPE_INDEX_FIELD_DEFN 27 /* 0x1B 2 Name, ByteConst, multiple FieldElement */ -#define INTERNAL_TYPE_IF 28 /* 0x1C OpCode, multiple Code */ -#define INTERNAL_TYPE_ELSE 29 /* 0x1D multiple Code */ -#define INTERNAL_TYPE_WHILE 30 /* 0x1E OpCode, multiple Code */ +#define INTERNAL_TYPE_IF 28 /* 0x1C */ +#define INTERNAL_TYPE_ELSE 29 /* 0x1D */ +#define INTERNAL_TYPE_WHILE 30 /* 0x1E */ #define INTERNAL_TYPE_SCOPE 31 /* 0x1F Name, multiple Node */ #define INTERNAL_TYPE_DEF_ANY 32 /* 0x20 type is Any, suppress search of enclosing scopes */ #define INTERNAL_TYPE_EXTRA 33 /* 0x21 */ @@ -462,6 +451,40 @@ typedef UINT8 OBJECT_TYPE_INTERNAL; #define INTERNAL_TYPE_INVALID 34 #define ACPI_TYPE_NOT_FOUND 0xFF + +/* + * Bitmapped ACPI types + * Used internally only + */ +#define ACPI_BTYPE_ANY 0x00000000 +#define ACPI_BTYPE_INTEGER 0x00000001 +#define ACPI_BTYPE_STRING 0x00000002 +#define ACPI_BTYPE_BUFFER 0x00000004 +#define ACPI_BTYPE_PACKAGE 0x00000008 +#define ACPI_BTYPE_FIELD_UNIT 0x00000010 +#define ACPI_BTYPE_DEVICE 0x00000020 +#define ACPI_BTYPE_EVENT 0x00000040 +#define ACPI_BTYPE_METHOD 0x00000080 +#define ACPI_BTYPE_MUTEX 0x00000100 +#define ACPI_BTYPE_REGION 0x00000200 +#define ACPI_BTYPE_POWER 0x00000400 +#define ACPI_BTYPE_PROCESSOR 0x00000800 +#define ACPI_BTYPE_THERMAL 0x00001000 +#define ACPI_BTYPE_BUFFER_FIELD 0x00002000 +#define ACPI_BTYPE_DDB_HANDLE 0x00004000 +#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 +#define ACPI_BTYPE_REFERENCE 0x00010000 +#define ACPI_BTYPE_RESOURCE 0x00020000 + +#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) + +#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) +#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) +#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) +#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ +#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF + + /* * AcpiEvent Types: * ------------ @@ -489,11 +512,11 @@ typedef UINT32 ACPI_EVENT_TYPE; #define ACPI_EVENT_RTC (ACPI_EVENT_TYPE) 5 #define ACPI_EVENT_GENERAL (ACPI_EVENT_TYPE) 6 #define ACPI_EVENT_MAX 6 -#define NUM_FIXED_EVENTS (ACPI_EVENT_TYPE) 7 +#define ACPI_NUM_FIXED_EVENTS (ACPI_EVENT_TYPE) 7 #define ACPI_GPE_INVALID 0xFF #define ACPI_GPE_MAX 0xFF -#define NUM_GPE 256 +#define ACPI_NUM_GPE 256 #define ACPI_EVENT_LEVEL_TRIGGERED (ACPI_EVENT_TYPE) 1 #define ACPI_EVENT_EDGE_TRIGGERED (ACPI_EVENT_TYPE) 2 @@ -530,15 +553,15 @@ typedef UINT32 ACPI_EVENT_STATUS; /* Address Space (Operation Region) Types */ -typedef UINT8 ACPI_ADDRESS_SPACE_TYPE; +typedef UINT8 ACPI_ADR_SPACE_TYPE; -#define ADDRESS_SPACE_SYSTEM_MEMORY (ACPI_ADDRESS_SPACE_TYPE) 0 -#define ADDRESS_SPACE_SYSTEM_IO (ACPI_ADDRESS_SPACE_TYPE) 1 -#define ADDRESS_SPACE_PCI_CONFIG (ACPI_ADDRESS_SPACE_TYPE) 2 -#define ADDRESS_SPACE_EC (ACPI_ADDRESS_SPACE_TYPE) 3 -#define ADDRESS_SPACE_SMBUS (ACPI_ADDRESS_SPACE_TYPE) 4 -#define ADDRESS_SPACE_CMOS (ACPI_ADDRESS_SPACE_TYPE) 5 -#define ADDRESS_SPACE_PCI_BAR_TARGET (ACPI_ADDRESS_SPACE_TYPE) 6 +#define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0 +#define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1 +#define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2 +#define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3 +#define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4 +#define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5 +#define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6 /* @@ -586,7 +609,7 @@ typedef union AcpiObj { ACPI_OBJECT_TYPE Type; UINT32 ProcId; - UINT32 PblkAddress; + ACPI_IO_ADDRESS PblkAddress; UINT32 PblkLength; } Processor; @@ -707,29 +730,33 @@ typedef struct _AcpiInitData /* not found in the IA32 manner */ } ACPI_INIT_DATA; + /* * Various handlers and callback procedures */ typedef -UINT32 (*FIXED_EVENT_HANDLER) ( +UINT32 (*ACPI_EVENT_HANDLER) ( void *Context); typedef -void (*GPE_HANDLER) ( +void (*ACPI_GPE_HANDLER) ( void *Context); typedef -void (*NOTIFY_HANDLER) ( +void (*ACPI_NOTIFY_HANDLER) ( ACPI_HANDLE Device, UINT32 Value, void *Context); -#define ADDRESS_SPACE_READ 1 -#define ADDRESS_SPACE_WRITE 2 + +/* Address Spaces (Operation Regions */ + +#define ACPI_READ_ADR_SPACE 1 +#define ACPI_WRITE_ADR_SPACE 2 typedef -ACPI_STATUS (*ADDRESS_SPACE_HANDLER) ( +ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -737,11 +764,11 @@ ACPI_STATUS (*ADDRESS_SPACE_HANDLER) ( void *HandlerContext, void *RegionContext); -#define ACPI_DEFAULT_HANDLER ((ADDRESS_SPACE_HANDLER) NULL) +#define ACPI_DEFAULT_HANDLER ((ACPI_ADR_SPACE_HANDLER) NULL) typedef -ACPI_STATUS (*ADDRESS_SPACE_SETUP) ( +ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) ( ACPI_HANDLE RegionHandle, UINT32 Function, void *HandlerContext, @@ -751,15 +778,13 @@ ACPI_STATUS (*ADDRESS_SPACE_SETUP) ( #define ACPI_REGION_DEACTIVATE 1 typedef -ACPI_STATUS (*WALK_CALLBACK) ( +ACPI_STATUS (*ACPI_WALK_CALLBACK) ( ACPI_HANDLE ObjHandle, UINT32 NestingLevel, void *Context, void **ReturnValue); - - /* Interrupt handler return values */ #define INTERRUPT_NOT_HANDLED 0x00 @@ -804,7 +829,7 @@ typedef struct UINT32 Seg; UINT32 Bus; UINT32 DevFunc; -} PCI_HANDLER_CONTEXT; +} ACPI_PCI_SPACE_CONTEXT; typedef struct @@ -812,7 +837,7 @@ typedef struct ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress; UINT8 *MappedLogicalAddress; UINT32 MappedLength; -} MEM_HANDLER_CONTEXT; +} ACPI_MEM_SPACE_CONTEXT; /* @@ -914,7 +939,7 @@ typedef struct UINT32 NumberOfInterrupts; UINT32 Interrupts[1]; -} IRQ_RESOURCE; +} ACPI_RESOURCE_IRQ; typedef struct { @@ -924,14 +949,14 @@ typedef struct UINT32 NumberOfChannels; UINT32 Channels[1]; -} DMA_RESOURCE; +} ACPI_RESOURCE_DMA; typedef struct { UINT32 CompatibilityPriority; UINT32 PerformanceRobustness; -} START_DEPENDENT_FUNCTIONS_RESOURCE; +} ACPI_RESOURCE_START_DPF; /* * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not @@ -946,21 +971,21 @@ typedef struct UINT32 Alignment; UINT32 RangeLength; -} IO_RESOURCE; +} ACPI_RESOURCE_IO; typedef struct { UINT32 BaseAddress; UINT32 RangeLength; -} FIXED_IO_RESOURCE; +} ACPI_RESOURCE_FIXED_IO; typedef struct { UINT32 Length; UINT8 Reserved[1]; -} VENDOR_RESOURCE; +} ACPI_RESOURCE_VENDOR; typedef struct { @@ -970,7 +995,7 @@ typedef struct UINT32 Alignment; UINT32 RangeLength; -} MEMORY24_RESOURCE; +} ACPI_RESOURCE_MEM24; typedef struct { @@ -980,7 +1005,7 @@ typedef struct UINT32 Alignment; UINT32 RangeLength; -} MEMORY32_RESOURCE; +} ACPI_RESOURCE_MEM32; typedef struct { @@ -988,36 +1013,44 @@ typedef struct UINT32 RangeBaseAddress; UINT32 RangeLength; -} FIXED_MEMORY32_RESOURCE; +} ACPI_RESOURCE_FIXED_MEM32; typedef struct { UINT16 CacheAttribute; UINT16 ReadWriteAttribute; -} MEMORY_ATTRIBUTE; +} ACPI_MEMORY_ATTRIBUTE; typedef struct { UINT16 RangeAttribute; UINT16 Reserved; -} IO_ATTRIBUTE; +} ACPI_IO_ATTRIBUTE; typedef struct { UINT16 Reserved1; UINT16 Reserved2; -} BUS_ATTRIBUTE; +} ACPI_BUS_ATTRIBUTE; typedef union { - MEMORY_ATTRIBUTE Memory; - IO_ATTRIBUTE Io; - BUS_ATTRIBUTE Bus; + ACPI_MEMORY_ATTRIBUTE Memory; + ACPI_IO_ATTRIBUTE Io; + ACPI_BUS_ATTRIBUTE Bus; + +} ACPI_RESOURCE_ATTRIBUTE; + +typedef struct +{ + UINT32 Index; + UINT32 StringLength; + NATIVE_CHAR *StringPtr; -} ATTRIBUTE_DATA; +} ACPI_RESOURCE_SOURCE; typedef struct { @@ -1026,17 +1059,15 @@ typedef struct UINT32 Decode; UINT32 MinAddressFixed; UINT32 MaxAddressFixed; - ATTRIBUTE_DATA Attribute; + ACPI_RESOURCE_ATTRIBUTE Attribute; UINT32 Granularity; UINT32 MinAddressRange; UINT32 MaxAddressRange; UINT32 AddressTranslationOffset; UINT32 AddressLength; - UINT32 ResourceSourceIndex; - UINT32 ResourceSourceStringLength; - NATIVE_CHAR ResourceSource[1]; + ACPI_RESOURCE_SOURCE ResourceSource; -} ADDRESS16_RESOURCE; +} ACPI_RESOURCE_ADDRESS16; typedef struct { @@ -1045,17 +1076,32 @@ typedef struct UINT32 Decode; UINT32 MinAddressFixed; UINT32 MaxAddressFixed; - ATTRIBUTE_DATA Attribute; + ACPI_RESOURCE_ATTRIBUTE Attribute; UINT32 Granularity; UINT32 MinAddressRange; UINT32 MaxAddressRange; UINT32 AddressTranslationOffset; UINT32 AddressLength; - UINT32 ResourceSourceIndex; - UINT32 ResourceSourceStringLength; - NATIVE_CHAR ResourceSource[1]; + ACPI_RESOURCE_SOURCE ResourceSource; -} ADDRESS32_RESOURCE; +} ACPI_RESOURCE_ADDRESS32; + +typedef struct +{ + UINT32 ResourceType; + UINT32 ProducerConsumer; + UINT32 Decode; + UINT32 MinAddressFixed; + UINT32 MaxAddressFixed; + ACPI_RESOURCE_ATTRIBUTE Attribute; + UINT64 Granularity; + UINT64 MinAddressRange; + UINT64 MaxAddressRange; + UINT64 AddressTranslationOffset; + UINT64 AddressLength; + ACPI_RESOURCE_SOURCE ResourceSource; + +} ACPI_RESOURCE_ADDRESS64; typedef struct { @@ -1064,58 +1110,65 @@ typedef struct UINT32 ActiveHighLow; UINT32 SharedExclusive; UINT32 NumberOfInterrupts; + ACPI_RESOURCE_SOURCE ResourceSource; UINT32 Interrupts[1]; - UINT32 ResourceSourceIndex; - UINT32 ResourceSourceStringLength; - NATIVE_CHAR ResourceSource[1]; -} EXTENDED_IRQ_RESOURCE; +} ACPI_RESOURCE_EXT_IRQ; -typedef enum -{ - Irq, - Dma, - StartDependentFunctions, - EndDependentFunctions, - Io, - FixedIo, - VendorSpecific, - EndTag, - Memory24, - Memory32, - FixedMemory32, - Address16, - Address32, - ExtendedIrq -} RESOURCE_TYPE; + +/* ACPI_RESOURCE_TYPEs */ + +#define ACPI_RSTYPE_IRQ 0 +#define ACPI_RSTYPE_DMA 1 +#define ACPI_RSTYPE_START_DPF 2 +#define ACPI_RSTYPE_END_DPF 3 +#define ACPI_RSTYPE_IO 4 +#define ACPI_RSTYPE_FIXED_IO 5 +#define ACPI_RSTYPE_VENDOR 6 +#define ACPI_RSTYPE_END_TAG 7 +#define ACPI_RSTYPE_MEM24 8 +#define ACPI_RSTYPE_MEM32 9 +#define ACPI_RSTYPE_FIXED_MEM32 10 +#define ACPI_RSTYPE_ADDRESS16 11 +#define ACPI_RSTYPE_ADDRESS32 12 +#define ACPI_RSTYPE_ADDRESS64 13 +#define ACPI_RSTYPE_EXT_IRQ 14 + +typedef UINT32 ACPI_RESOURCE_TYPE; typedef union { - IRQ_RESOURCE Irq; - DMA_RESOURCE Dma; - START_DEPENDENT_FUNCTIONS_RESOURCE StartDependentFunctions; - IO_RESOURCE Io; - FIXED_IO_RESOURCE FixedIo; - VENDOR_RESOURCE VendorSpecific; - MEMORY24_RESOURCE Memory24; - MEMORY32_RESOURCE Memory32; - FIXED_MEMORY32_RESOURCE FixedMemory32; - ADDRESS16_RESOURCE Address16; - ADDRESS32_RESOURCE Address32; - EXTENDED_IRQ_RESOURCE ExtendedIrq; -} RESOURCE_DATA; - -typedef struct _resource_tag + ACPI_RESOURCE_IRQ Irq; + ACPI_RESOURCE_DMA Dma; + ACPI_RESOURCE_START_DPF StartDpf; + ACPI_RESOURCE_IO Io; + ACPI_RESOURCE_FIXED_IO FixedIo; + ACPI_RESOURCE_VENDOR VendorSpecific; + ACPI_RESOURCE_MEM24 Memory24; + ACPI_RESOURCE_MEM32 Memory32; + ACPI_RESOURCE_FIXED_MEM32 FixedMemory32; + ACPI_RESOURCE_ADDRESS16 Address16; + ACPI_RESOURCE_ADDRESS32 Address32; + ACPI_RESOURCE_ADDRESS64 Address64; + ACPI_RESOURCE_EXT_IRQ ExtendedIrq; + +} ACPI_RESOURCE_DATA; + +typedef struct AcpiResource { - RESOURCE_TYPE Id; + ACPI_RESOURCE_TYPE Id; UINT32 Length; - RESOURCE_DATA Data; -} RESOURCE; + ACPI_RESOURCE_DATA Data; + +} ACPI_RESOURCE; + +#define ACPI_RESOURCE_LENGTH 12 +#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ + +#define SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type)) -#define RESOURCE_LENGTH 12 -#define RESOURCE_LENGTH_NO_DATA 8 +#define NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->length) -#define NEXT_RESOURCE(Res) (RESOURCE*)((UINT8*) Res + Res->length) /* * END: Definitions for Resource Attributes diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 3872386..1e463b8 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -1,7 +1,7 @@ /****************************************************************************** * - * Name: accommon.h -- prototypes for the common (subsystem-wide) procedures - * $Revision: 90 $ + * Name: acutils.h -- prototypes for the common (subsystem-wide) procedures + * $Revision: 100 $ * *****************************************************************************/ @@ -114,9 +114,8 @@ * *****************************************************************************/ -#ifndef _ACCOMMON_H -#define _ACCOMMON_H - +#ifndef _ACUTILS_H +#define _ACUTILS_H typedef @@ -127,9 +126,8 @@ ACPI_STATUS (*ACPI_PKG_CALLBACK) ( void *Context); - ACPI_STATUS -AcpiCmWalkPackageTree ( +AcpiUtWalkPackageTree ( ACPI_OPERAND_OBJECT *SourceObject, void *TargetObject, ACPI_PKG_CALLBACK WalkCallback, @@ -148,7 +146,7 @@ typedef struct acpi_pkg_info #define REF_DECREMENT (UINT16) 1 #define REF_FORCE_DELETE (UINT16) 2 -/* AcpiCmDumpBuffer */ +/* AcpiUtDumpBuffer */ #define DB_BYTE_DISPLAY 1 #define DB_WORD_DISPLAY 2 @@ -159,203 +157,199 @@ typedef struct acpi_pkg_info /* Global initialization interfaces */ void -AcpiCmInitGlobals ( +AcpiUtInitGlobals ( void); void -AcpiCmTerminate ( +AcpiUtTerminate ( void); /* - * CmInit - miscellaneous initialization and shutdown + * UtInit - miscellaneous initialization and shutdown */ ACPI_STATUS -AcpiCmHardwareInitialize ( +AcpiUtHardwareInitialize ( void); ACPI_STATUS -AcpiCmSubsystemShutdown ( +AcpiUtSubsystemShutdown ( void); ACPI_STATUS -AcpiCmValidateFadt ( +AcpiUtValidateFadt ( void); /* - * CmGlobal - Global data structures and procedures + * UtGlobal - Global data structures and procedures */ #ifdef ACPI_DEBUG NATIVE_CHAR * -AcpiCmGetMutexName ( +AcpiUtGetMutexName ( UINT32 MutexId); NATIVE_CHAR * -AcpiCmGetTypeName ( +AcpiUtGetTypeName ( UINT32 Type); NATIVE_CHAR * -AcpiCmGetRegionName ( +AcpiUtGetRegionName ( UINT8 SpaceId); #endif BOOLEAN -AcpiCmValidObjectType ( +AcpiUtValidObjectType ( UINT32 Type); ACPI_OWNER_ID -AcpiCmAllocateOwnerId ( +AcpiUtAllocateOwnerId ( UINT32 IdType); /* - * CmClib - Local implementations of C library functions + * UtClib - Local implementations of C library functions */ #ifndef ACPI_USE_SYSTEM_CLIBRARY -NATIVE_UINT -AcpiCmStrlen ( +UINT32 +AcpiUtStrlen ( const NATIVE_CHAR *String); NATIVE_CHAR * -AcpiCmStrcpy ( +AcpiUtStrcpy ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString); NATIVE_CHAR * -AcpiCmStrncpy ( +AcpiUtStrncpy ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString, NATIVE_UINT Count); UINT32 -AcpiCmStrncmp ( +AcpiUtStrncmp ( const NATIVE_CHAR *String1, const NATIVE_CHAR *String2, NATIVE_UINT Count); UINT32 -AcpiCmStrcmp ( +AcpiUtStrcmp ( const NATIVE_CHAR *String1, const NATIVE_CHAR *String2); NATIVE_CHAR * -AcpiCmStrcat ( +AcpiUtStrcat ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString); NATIVE_CHAR * -AcpiCmStrncat ( +AcpiUtStrncat ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString, NATIVE_UINT Count); UINT32 -AcpiCmStrtoul ( +AcpiUtStrtoul ( const NATIVE_CHAR *String, NATIVE_CHAR **Terminator, - NATIVE_UINT Base); + UINT32 Base); NATIVE_CHAR * -AcpiCmStrstr ( +AcpiUtStrstr ( NATIVE_CHAR *String1, NATIVE_CHAR *String2); -NATIVE_CHAR * -AcpiCmStrupr ( - NATIVE_CHAR *SrcString); - void * -AcpiCmMemcpy ( +AcpiUtMemcpy ( void *Dest, const void *Src, NATIVE_UINT Count); void * -AcpiCmMemset ( +AcpiUtMemset ( void *Dest, NATIVE_UINT Value, NATIVE_UINT Count); UINT32 -AcpiCmToUpper ( +AcpiUtToUpper ( UINT32 c); UINT32 -AcpiCmToLower ( +AcpiUtToLower ( UINT32 c); #endif /* ACPI_USE_SYSTEM_CLIBRARY */ /* - * CmCopy - Object construction and conversion interfaces + * UtCopy - Object construction and conversion interfaces */ ACPI_STATUS -AcpiCmBuildSimpleObject( +AcpiUtBuildSimpleObject( ACPI_OPERAND_OBJECT *Obj, ACPI_OBJECT *UserObj, UINT8 *DataSpace, UINT32 *BufferSpaceUsed); ACPI_STATUS -AcpiCmBuildPackageObject ( +AcpiUtBuildPackageObject ( ACPI_OPERAND_OBJECT *Obj, UINT8 *Buffer, UINT32 *SpaceUsed); ACPI_STATUS -AcpiCmCopyIobjectToEobject ( +AcpiUtCopyIobjectToEobject ( ACPI_OPERAND_OBJECT *Obj, ACPI_BUFFER *RetBuffer); ACPI_STATUS -AcpiCmCopyEsimpleToIsimple( +AcpiUtCopyEsimpleToIsimple( ACPI_OBJECT *UserObj, ACPI_OPERAND_OBJECT *Obj); ACPI_STATUS -AcpiCmCopyEobjectToIobject ( +AcpiUtCopyEobjectToIobject ( ACPI_OBJECT *Obj, ACPI_OPERAND_OBJECT *InternalObj); ACPI_STATUS -AcpiCmCopyISimpleToIsimple ( +AcpiUtCopyISimpleToIsimple ( ACPI_OPERAND_OBJECT *SourceObj, ACPI_OPERAND_OBJECT *DestObj); ACPI_STATUS -AcpiCmCopyIpackageToIpackage ( +AcpiUtCopyIpackageToIpackage ( ACPI_OPERAND_OBJECT *SourceObj, ACPI_OPERAND_OBJECT *DestObj, ACPI_WALK_STATE *WalkState); /* - * CmCreate - Object creation + * UtCreate - Object creation */ ACPI_STATUS -AcpiCmUpdateObjectReference ( +AcpiUtUpdateObjectReference ( ACPI_OPERAND_OBJECT *Object, UINT16 Action); ACPI_OPERAND_OBJECT * -_CmCreateInternalObject ( +_UtCreateInternalObject ( NATIVE_CHAR *ModuleName, UINT32 LineNumber, UINT32 ComponentId, - OBJECT_TYPE_INTERNAL Type); + ACPI_OBJECT_TYPE8 Type); /* - * CmDebug - Debug interfaces + * UtDebug - Debug interfaces */ UINT32 @@ -464,7 +458,7 @@ _ReportWarning ( UINT32 ComponentId); void -AcpiCmDumpBuffer ( +AcpiUtDumpBuffer ( UINT8 *Buffer, UINT32 Count, UINT32 Display, @@ -472,28 +466,28 @@ AcpiCmDumpBuffer ( /* - * CmDelete - Object deletion + * UtDelete - Object deletion */ void -AcpiCmDeleteInternalObj ( +AcpiUtDeleteInternalObj ( ACPI_OPERAND_OBJECT *Object); void -AcpiCmDeleteInternalPackageObject ( +AcpiUtDeleteInternalPackageObject ( ACPI_OPERAND_OBJECT *Object); void -AcpiCmDeleteInternalSimpleObject ( +AcpiUtDeleteInternalSimpleObject ( ACPI_OPERAND_OBJECT *Object); ACPI_STATUS -AcpiCmDeleteInternalObjectList ( +AcpiUtDeleteInternalObjectList ( ACPI_OPERAND_OBJECT **ObjList); /* - * CmEval - object evaluation + * UtEval - object evaluation */ /* Method name strings */ @@ -508,197 +502,201 @@ AcpiCmDeleteInternalObjectList ( ACPI_STATUS -AcpiCmEvaluateNumericObject ( +AcpiUtEvaluateNumericObject ( NATIVE_CHAR *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, ACPI_INTEGER *Address); ACPI_STATUS -AcpiCmExecute_HID ( +AcpiUtExecute_HID ( ACPI_NAMESPACE_NODE *DeviceNode, - DEVICE_ID *Hid); + ACPI_DEVICE_ID *Hid); ACPI_STATUS -AcpiCmExecute_STA ( +AcpiUtExecute_STA ( ACPI_NAMESPACE_NODE *DeviceNode, UINT32 *StatusFlags); ACPI_STATUS -AcpiCmExecute_UID ( +AcpiUtExecute_UID ( ACPI_NAMESPACE_NODE *DeviceNode, - DEVICE_ID *Uid); + ACPI_DEVICE_ID *Uid); /* - * CmError - exception interfaces + * UtError - exception interfaces */ NATIVE_CHAR * -AcpiCmFormatException ( +AcpiUtFormatException ( ACPI_STATUS Status); /* - * CmMutex - mutual exclusion interfaces + * UtMutex - mutual exclusion interfaces */ ACPI_STATUS -AcpiCmMutexInitialize ( +AcpiUtMutexInitialize ( void); void -AcpiCmMutexTerminate ( +AcpiUtMutexTerminate ( void); ACPI_STATUS -AcpiCmCreateMutex ( +AcpiUtCreateMutex ( ACPI_MUTEX_HANDLE MutexId); ACPI_STATUS -AcpiCmDeleteMutex ( +AcpiUtDeleteMutex ( ACPI_MUTEX_HANDLE MutexId); ACPI_STATUS -AcpiCmAcquireMutex ( +AcpiUtAcquireMutex ( ACPI_MUTEX_HANDLE MutexId); ACPI_STATUS -AcpiCmReleaseMutex ( +AcpiUtReleaseMutex ( ACPI_MUTEX_HANDLE MutexId); /* - * CmObject - internal object create/delete/cache routines + * UtObject - internal object create/delete/cache routines */ void * -_CmAllocateObjectDesc ( +_UtAllocateObjectDesc ( NATIVE_CHAR *ModuleName, UINT32 LineNumber, UINT32 ComponentId); -#define AcpiCmCreateInternalObject(t) _CmCreateInternalObject(_THIS_MODULE,__LINE__,_COMPONENT,t) -#define AcpiCmAllocateObjectDesc() _CmAllocateObjectDesc(_THIS_MODULE,__LINE__,_COMPONENT) +#define AcpiUtCreateInternalObject(t) _UtCreateInternalObject(_THIS_MODULE,__LINE__,_COMPONENT,t) +#define AcpiUtAllocateObjectDesc() _UtAllocateObjectDesc(_THIS_MODULE,__LINE__,_COMPONENT) void -AcpiCmDeleteObjectDesc ( +AcpiUtDeleteObjectDesc ( ACPI_OPERAND_OBJECT *Object); BOOLEAN -AcpiCmValidInternalObject ( +AcpiUtValidInternalObject ( void *Object); /* - * CmRefCnt - Object reference count management + * UtRefCnt - Object reference count management */ void -AcpiCmAddReference ( +AcpiUtAddReference ( ACPI_OPERAND_OBJECT *Object); void -AcpiCmRemoveReference ( +AcpiUtRemoveReference ( ACPI_OPERAND_OBJECT *Object); /* - * CmSize - Object size routines + * UtSize - Object size routines */ ACPI_STATUS -AcpiCmGetSimpleObjectSize ( +AcpiUtGetSimpleObjectSize ( ACPI_OPERAND_OBJECT *Obj, UINT32 *ObjLength); ACPI_STATUS -AcpiCmGetPackageObjectSize ( +AcpiUtGetPackageObjectSize ( ACPI_OPERAND_OBJECT *Obj, UINT32 *ObjLength); ACPI_STATUS -AcpiCmGetObjectSize( +AcpiUtGetObjectSize( ACPI_OPERAND_OBJECT *Obj, UINT32 *ObjLength); /* - * CmState - Generic state creation/cache routines + * UtState - Generic state creation/cache routines */ void -AcpiCmPushGenericState ( +AcpiUtPushGenericState ( ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State); ACPI_GENERIC_STATE * -AcpiCmPopGenericState ( +AcpiUtPopGenericState ( ACPI_GENERIC_STATE **ListHead); ACPI_GENERIC_STATE * -AcpiCmCreateGenericState ( +AcpiUtCreateGenericState ( void); ACPI_GENERIC_STATE * -AcpiCmCreateUpdateState ( +AcpiUtCreateUpdateState ( ACPI_OPERAND_OBJECT *Object, UINT16 Action); ACPI_GENERIC_STATE * -AcpiCmCreatePkgState ( +AcpiUtCreatePkgState ( void *InternalObject, void *ExternalObject, UINT16 Index); ACPI_STATUS -AcpiCmCreateUpdateStateAndPush ( +AcpiUtCreateUpdateStateAndPush ( ACPI_OPERAND_OBJECT *Object, UINT16 Action, ACPI_GENERIC_STATE **StateList); ACPI_STATUS -AcpiCmCreatePkgStateAndPush ( +AcpiUtCreatePkgStateAndPush ( void *InternalObject, void *ExternalObject, UINT16 Index, ACPI_GENERIC_STATE **StateList); ACPI_GENERIC_STATE * -AcpiCmCreateControlState ( +AcpiUtCreateControlState ( void); void -AcpiCmDeleteGenericState ( +AcpiUtDeleteGenericState ( ACPI_GENERIC_STATE *State); void -AcpiCmDeleteGenericStateCache ( +AcpiUtDeleteGenericStateCache ( void); void -AcpiCmDeleteObjectCache ( +AcpiUtDeleteObjectCache ( void); /* - * Cmutils + * Ututils */ BOOLEAN -AcpiCmValidAcpiName ( +AcpiUtValidAcpiName ( UINT32 Name); BOOLEAN -AcpiCmValidAcpiCharacter ( +AcpiUtValidAcpiCharacter ( NATIVE_CHAR Character); +NATIVE_CHAR * +AcpiUtStrupr ( + NATIVE_CHAR *SrcString); + ACPI_STATUS -AcpiCmResolvePackageReferences ( +AcpiUtResolvePackageReferences ( ACPI_OPERAND_OBJECT *ObjDesc); -#ifdef ACPI_DEBUG +#ifdef ACPI_DEBUG void -AcpiCmDisplayInitPathname ( +AcpiUtDisplayInitPathname ( ACPI_HANDLE ObjHandle, char *Path); @@ -711,108 +709,46 @@ AcpiCmDisplayInitPathname ( */ void * -_CmAllocate ( +_UtAllocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line); void * -_CmCallocate ( +_UtCallocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line); void -_CmFree ( +_UtFree ( void *Address, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line); void -AcpiCmInitStaticObject ( +AcpiUtInitStaticObject ( ACPI_OPERAND_OBJECT *ObjDesc); -#define AcpiCmAllocate(a) _CmAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__) -#define AcpiCmCallocate(a) _CmCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__) -#define AcpiCmFree(a) _CmFree(a,_COMPONENT,_THIS_MODULE,__LINE__) - -#ifndef ACPI_DEBUG_TRACK_ALLOCATIONS - -#define AcpiCmAddElementToAllocList(a,b,c,d,e,f) -#define AcpiCmDeleteElementFromAllocList(a,b,c,d) -#define AcpiCmDumpCurrentAllocations(a,b) -#define AcpiCmDumpAllocationInfo() - -#define DECREMENT_OBJECT_METRICS(a) -#define INCREMENT_OBJECT_METRICS(a) -#define INITIALIZE_ALLOCATION_METRICS() -#define DECREMENT_NAME_TABLE_METRICS(a) -#define INCREMENT_NAME_TABLE_METRICS(a) - -#else - -#define INITIALIZE_ALLOCATION_METRICS() \ - AcpiGbl_CurrentObjectCount = 0; \ - AcpiGbl_CurrentObjectSize = 0; \ - AcpiGbl_RunningObjectCount = 0; \ - AcpiGbl_RunningObjectSize = 0; \ - AcpiGbl_MaxConcurrentObjectCount = 0; \ - AcpiGbl_MaxConcurrentObjectSize = 0; \ - AcpiGbl_CurrentAllocSize = 0; \ - AcpiGbl_CurrentAllocCount = 0; \ - AcpiGbl_RunningAllocSize = 0; \ - AcpiGbl_RunningAllocCount = 0; \ - AcpiGbl_MaxConcurrentAllocSize = 0; \ - AcpiGbl_MaxConcurrentAllocCount = 0; \ - AcpiGbl_CurrentNodeCount = 0; \ - AcpiGbl_CurrentNodeSize = 0; \ - AcpiGbl_MaxConcurrentNodeCount = 0 - - -#define DECREMENT_OBJECT_METRICS(a) \ - AcpiGbl_CurrentObjectCount--; \ - AcpiGbl_CurrentObjectSize -= a - -#define INCREMENT_OBJECT_METRICS(a) \ - AcpiGbl_CurrentObjectCount++; \ - AcpiGbl_RunningObjectCount++; \ - if (AcpiGbl_MaxConcurrentObjectCount < AcpiGbl_CurrentObjectCount) \ - { \ - AcpiGbl_MaxConcurrentObjectCount = AcpiGbl_CurrentObjectCount; \ - } \ - AcpiGbl_RunningObjectSize += a; \ - AcpiGbl_CurrentObjectSize += a; \ - if (AcpiGbl_MaxConcurrentObjectSize < AcpiGbl_CurrentObjectSize) \ - { \ - AcpiGbl_MaxConcurrentObjectSize = AcpiGbl_CurrentObjectSize; \ - } - -#define DECREMENT_NAME_TABLE_METRICS(a) \ - AcpiGbl_CurrentNodeCount--; \ - AcpiGbl_CurrentNodeSize -= (a) - -#define INCREMENT_NAME_TABLE_METRICS(a) \ - AcpiGbl_CurrentNodeCount++; \ - AcpiGbl_CurrentNodeSize+= (a); \ - if (AcpiGbl_MaxConcurrentNodeCount < AcpiGbl_CurrentNodeCount) \ - { \ - AcpiGbl_MaxConcurrentNodeCount = AcpiGbl_CurrentNodeCount; \ - } \ - - -void -AcpiCmDumpAllocationInfo ( + +#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS +void +AcpiUtDumpAllocationInfo ( void); void -AcpiCmDumpCurrentAllocations ( +AcpiUtDumpCurrentAllocations ( UINT32 Component, NATIVE_CHAR *Module); - #endif -#endif /* _ACCOMMON_H */ +#define AcpiUtAllocate(a) _UtAllocate(a,_COMPONENT,_THIS_MODULE,__LINE__) +#define AcpiUtCallocate(a) _UtCallocate(a, _COMPONENT,_THIS_MODULE,__LINE__) +#define AcpiUtFree(a) _UtFree(a,_COMPONENT,_THIS_MODULE,__LINE__) + + +#endif /* _ACUTILS_H */ diff --git a/sys/contrib/dev/acpica/amlcode.h b/sys/contrib/dev/acpica/amlcode.h index afca031..2dbcd49 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: 46 $ + * $Revision: 52 $ * *****************************************************************************/ @@ -189,12 +189,12 @@ #define AML_SIZE_OF_OP (UINT16) 0x87 #define AML_INDEX_OP (UINT16) 0x88 #define AML_MATCH_OP (UINT16) 0x89 -#define AML_DWORD_FIELD_OP (UINT16) 0x8a -#define AML_WORD_FIELD_OP (UINT16) 0x8b -#define AML_BYTE_FIELD_OP (UINT16) 0x8c -#define AML_BIT_FIELD_OP (UINT16) 0x8d +#define AML_CREATE_DWORD_FIELD_OP (UINT16) 0x8a +#define AML_CREATE_WORD_FIELD_OP (UINT16) 0x8b +#define AML_CREATE_BYTE_FIELD_OP (UINT16) 0x8c +#define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d #define AML_TYPE_OP (UINT16) 0x8e -#define AML_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */ +#define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */ #define AML_LAND_OP (UINT16) 0x90 #define AML_LOR_OP (UINT16) 0x91 #define AML_LNOT_OP (UINT16) 0x92 @@ -245,7 +245,7 @@ #define AML_DEBUG_OP (UINT16) 0x5b31 #define AML_FATAL_OP (UINT16) 0x5b32 #define AML_REGION_OP (UINT16) 0x5b80 -#define AML_DEF_FIELD_OP (UINT16) 0x5b81 +#define AML_FIELD_OP (UINT16) 0x5b81 #define AML_DEVICE_OP (UINT16) 0x5b82 #define AML_PROCESSOR_OP (UINT16) 0x5b83 #define AML_POWER_RES_OP (UINT16) 0x5b84 @@ -268,14 +268,14 @@ * any valid ACPI ASCII values (A-Z, 0-9, '-') */ -#define AML_NAMEPATH_OP (UINT16) 0x002d -#define AML_NAMEDFIELD_OP (UINT16) 0x0030 -#define AML_RESERVEDFIELD_OP (UINT16) 0x0031 -#define AML_ACCESSFIELD_OP (UINT16) 0x0032 -#define AML_BYTELIST_OP (UINT16) 0x0033 -#define AML_STATICSTRING_OP (UINT16) 0x0034 -#define AML_METHODCALL_OP (UINT16) 0x0035 -#define AML_RETURN_VALUE_OP (UINT16) 0x0036 +#define AML_INT_NAMEPATH_OP (UINT16) 0x002d +#define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030 +#define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031 +#define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032 +#define AML_INT_BYTELIST_OP (UINT16) 0x0033 +#define AML_INT_STATICSTRING_OP (UINT16) 0x0034 +#define AML_INT_METHODCALL_OP (UINT16) 0x0035 +#define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 #define ARG_NONE 0x0 @@ -313,7 +313,7 @@ /* "Standard" ACPI types are 1-15 (0x0F) */ -#define ARGI_INTEGER ACPI_TYPE_INTEGER /* 1 */ +#define ARGI_INTEGER ACPI_TYPE_INTEGER /* 1 */ #define ARGI_STRING ACPI_TYPE_STRING /* 2 */ #define ARGI_BUFFER ACPI_TYPE_BUFFER /* 3 */ #define ARGI_PACKAGE ACPI_TYPE_PACKAGE /* 4 */ @@ -328,8 +328,8 @@ #define ARGI_ANYOBJECT 0x11 #define ARGI_ANYTYPE 0x12 #define ARGI_COMPUTEDATA 0x13 /* Buffer, String, or Integer */ -#define ARGI_DATAOBJECT 0x14 /* Buffer, string, package or reference to a Node - Used only by SizeOf operator*/ -#define ARGI_COMPLEXOBJ 0x15 /* Buffer or package */ +#define ARGI_DATAOBJECT 0x14 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ +#define ARGI_COMPLEXOBJ 0x15 /* Buffer, String, or package (Used by INDEX op only) */ #define ARGI_INTEGER_REF 0x16 #define ARGI_OBJECT_REF 0x17 #define ARGI_DEVICE_REF 0x18 @@ -403,13 +403,14 @@ typedef enum { - REGION_MEMORY = 0, + REGION_MEMORY = 0, REGION_IO, REGION_PCI_CONFIG, REGION_EC, REGION_SMBUS, REGION_CMOS, - REGION_PCI_BAR + REGION_PCI_BAR, + REGION_FIXED_HW = 0x7F, } AML_REGION_TYPES; @@ -418,80 +419,82 @@ typedef enum typedef enum { - MATCH_MTR = 0, - MATCH_MEQ = 1, - MATCH_MLE = 2, - MATCH_MLT = 3, - MATCH_MGE = 4, - MATCH_MGT = 5 + MATCH_MTR = 0, + MATCH_MEQ = 1, + MATCH_MLE = 2, + MATCH_MLT = 3, + MATCH_MGE = 4, + MATCH_MGT = 5 } AML_MATCH_OPERATOR; -#define MAX_MATCH_OPERATOR 5 +#define MAX_MATCH_OPERATOR 5 /* Field Access Types */ -#define ACCESS_TYPE_MASK 0x0f -#define ACCESS_TYPE_SHIFT 0 +#define ACCESS_TYPE_MASK 0x0f +#define ACCESS_TYPE_SHIFT 0 typedef enum { - ACCESS_ANY_ACC = 0, - ACCESS_BYTE_ACC = 1, - ACCESS_WORD_ACC = 2, - ACCESS_DWORD_ACC = 3, - ACCESS_BLOCK_ACC = 4, - ACCESS_SMBSEND_RECV_ACC = 5, - ACCESS_SMBQUICK_ACC = 6 + ACCESS_ANY_ACC = 0, + ACCESS_BYTE_ACC = 1, + ACCESS_WORD_ACC = 2, + ACCESS_DWORD_ACC = 3, + ACCESS_QWORD_ACC = 4, /* ACPI 2.0 */ + ACCESS_BLOCK_ACC = 4, + ACCESS_SMBSEND_RECV_ACC = 5, + ACCESS_SMBQUICK_ACC = 6 } AML_ACCESS_TYPE; /* Field Lock Rules */ -#define LOCK_RULE_MASK 0x10 -#define LOCK_RULE_SHIFT 4 +#define LOCK_RULE_MASK 0x10 +#define LOCK_RULE_SHIFT 4 typedef enum { - GLOCK_NEVER_LOCK = 0, - GLOCK_ALWAYS_LOCK = 1 + GLOCK_NEVER_LOCK = 0, + GLOCK_ALWAYS_LOCK = 1 } AML_LOCK_RULE; /* Field Update Rules */ -#define UPDATE_RULE_MASK 0x060 -#define UPDATE_RULE_SHIFT 5 +#define UPDATE_RULE_MASK 0x060 +#define UPDATE_RULE_SHIFT 5 typedef enum { - UPDATE_PRESERVE = 0, - UPDATE_WRITE_AS_ONES = 1, - UPDATE_WRITE_AS_ZEROS = 2 + UPDATE_PRESERVE = 0, + UPDATE_WRITE_AS_ONES = 1, + UPDATE_WRITE_AS_ZEROS = 2 } AML_UPDATE_RULE; /* bit fields in MethodFlags byte */ -#define METHOD_FLAGS_ARG_COUNT 0x07 -#define METHOD_FLAGS_SERIALIZED 0x08 +#define METHOD_FLAGS_ARG_COUNT 0x07 +#define METHOD_FLAGS_SERIALIZED 0x08 +#define METHOD_FLAGS_SYNCH_LEVEL 0xF0 /* Array sizes. Used for range checking also */ -#define NUM_REGION_TYPES 7 -#define NUM_ACCESS_TYPES 7 -#define NUM_UPDATE_RULES 3 -#define NUM_MATCH_OPS 7 -#define NUM_OPCODES 256 -#define NUM_FIELD_NAMES 2 +#define NUM_REGION_TYPES 7 +#define NUM_ACCESS_TYPES 7 +#define NUM_UPDATE_RULES 3 +#define NUM_MATCH_OPS 7 +#define NUM_OPCODES 256 +#define NUM_FIELD_NAMES 2 -#define USER_REGION_BEGIN 0x80 +#define USER_REGION_BEGIN 0x80 /* * AML tables @@ -499,7 +502,7 @@ typedef enum #ifdef DEFINE_AML_GLOBALS -/* External declarations of the AML tables */ +/* External declarations for the AML tables */ extern UINT8 AcpiGbl_Aml [NUM_OPCODES]; extern UINT16 AcpiGbl_Pfx [NUM_OPCODES]; diff --git a/sys/contrib/dev/acpica/dbcmds.c b/sys/contrib/dev/acpica/dbcmds.c index b48e7ea..c1bded4 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: 46 $ + * $Revision: 60 $ * ******************************************************************************/ @@ -125,10 +125,11 @@ #include "acinterp.h" #include "acdebug.h" #include "actables.h" +#include "acresrc.h" #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbcmds") @@ -241,6 +242,33 @@ AcpiDbFindReferences ( /******************************************************************************* * + * FUNCTION: AcpiDbDisplayLocks + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display information about internal mutexes. + * + ******************************************************************************/ + +void +AcpiDbDisplayLocks (void) +{ + UINT32 i; + + + for (i = 0; i < MAX_MTX; i++) + { + AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), + AcpiGbl_AcpiMutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED + ? "Locked" : "Unlocked"); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDbDisplayTableInfo * * PARAMETERS: TableArg - String with name of table to be displayed @@ -309,7 +337,7 @@ AcpiDbUnloadAcpiTable ( } else { - AcpiOsPrintf ("%s, while unloading [%s]\n", AcpiCmFormatException (Status), TableArg); + AcpiOsPrintf ("%s, while unloading [%s]\n", AcpiUtFormatException (Status), TableArg); } return; @@ -595,7 +623,7 @@ AcpiDbSendNotify ( /* Send the notify */ - AcpiEvNotifyDispatch (Node, Value); + AcpiEvQueueNotifyRequest (Node, Value); break; default: @@ -660,7 +688,7 @@ AcpiDbSetMethodData ( /* Create and initialize the new object */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!ObjDesc) { AcpiOsPrintf ("Could not create an internal object\n"); @@ -684,7 +712,7 @@ AcpiDbSetMethodData ( return; } - AcpiDsMethodDataSetValue (MTH_TYPE_ARG, Index, ObjDesc, WalkState); + AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState); ObjDesc = WalkState->Arguments[Index].Object; AcpiOsPrintf ("Arg%d: ", Index); @@ -701,7 +729,7 @@ AcpiDbSetMethodData ( return; } - AcpiDsMethodDataSetValue (MTH_TYPE_LOCAL, Index, ObjDesc, WalkState); + AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState); ObjDesc = WalkState->LocalVariables[Index].Object; AcpiOsPrintf ("Local%d: ", Index); @@ -810,13 +838,11 @@ AcpiDbDisplayObjects ( NATIVE_CHAR *ObjTypeArg, NATIVE_CHAR *DisplayCountArg) { - UINT32 DisplayCount; - OBJECT_TYPE_INTERNAL Type; + ACPI_OBJECT_TYPE8 Type; /* Get the object type */ - STRUPR (ObjTypeArg); Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes); if (Type == ACPI_TYPE_NOT_FOUND) { @@ -824,20 +850,8 @@ AcpiDbDisplayObjects ( return (AE_OK); } - /* Get the display depth */ - - if (DisplayCountArg) - { - DisplayCount = STRTOUL (DisplayCountArg, NULL, 0); - } - - else - { - DisplayCount = ACPI_UINT32_MAX; - } - AcpiDbSetOutputDestination (DB_DUPLICATE_OUTPUT); - AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n", AcpiCmGetTypeName (Type)); + AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n", AcpiUtGetTypeName (Type)); AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT); @@ -871,7 +885,6 @@ AcpiDbWalkAndMatchName ( void *Context, void **ReturnValue) { - ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; NATIVE_CHAR *RequestedName = (NATIVE_CHAR *) Context; UINT32 i; @@ -879,9 +892,6 @@ AcpiDbWalkAndMatchName ( NATIVE_CHAR Buffer[96]; - ObjDesc = ((ACPI_NAMESPACE_NODE *)ObjHandle)->Object; - - /* Check for a name match */ for (i = 0; i < 4; i++) @@ -911,7 +921,7 @@ AcpiDbWalkAndMatchName ( else { AcpiOsPrintf ("%32s (%p) - %s\n", Buffer, ObjHandle, - AcpiCmGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type)); + AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type)); } return (AE_OK); @@ -1004,7 +1014,7 @@ AcpiDbSetScope ( * * RETURN: None * - * DESCRIPTION: + * DESCRIPTION: * ******************************************************************************/ @@ -1012,11 +1022,10 @@ void AcpiDbDisplayResources ( NATIVE_CHAR *ObjectArg) { +#ifndef _IA16 ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; ACPI_BUFFER ReturnObj; - PCI_ROUTING_TABLE *Prt; - UINT32 i; AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT); @@ -1030,11 +1039,15 @@ AcpiDbDisplayResources ( ReturnObj.Pointer = Buffer; ReturnObj.Length = BUFFER_SIZE; + /* _PRT */ + + AcpiOsPrintf ("Evaluating _PRT\n"); + Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiCmFormatException (Status)); - goto Cleanup; + AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiUtFormatException (Status)); + goto GoCRS; } ReturnObj.Pointer = Buffer; @@ -1043,28 +1056,73 @@ AcpiDbDisplayResources ( Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiCmFormatException (Status)); + AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiUtFormatException (Status)); + goto GoCRS; + } + + + AcpiRsDumpIrqList((UINT8 *)Buffer); + + /* _CRS */ +GoCRS: + AcpiOsPrintf ("Evaluating _CRS\n"); + + ReturnObj.Pointer = Buffer; + ReturnObj.Length = BUFFER_SIZE; + + Status = AcpiEvaluateObject (ObjDesc, "_CRS", NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiUtFormatException (Status)); + goto GoPRS; + } + + ReturnObj.Pointer = Buffer; + ReturnObj.Length = BUFFER_SIZE; + + Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiUtFormatException (Status)); + goto GoPRS; + } + + AcpiRsDumpResourceList ((ACPI_RESOURCE *) Buffer); + + /* _PRS */ +GoPRS: + AcpiOsPrintf ("Evaluating _PRS\n"); + + ReturnObj.Pointer = Buffer; + ReturnObj.Length = BUFFER_SIZE; + + Status = AcpiEvaluateObject (ObjDesc, "_PRS", NULL, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiUtFormatException (Status)); goto Cleanup; } - Prt = (PCI_ROUTING_TABLE *) Buffer; - i = 0; - while ((char *) Prt < (Buffer + ReturnObj.Length)) + ReturnObj.Pointer = Buffer; + ReturnObj.Length = BUFFER_SIZE; + + Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj); + if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Prt[%d] Src=%s: Addr=%X\n", i, Prt->Source, Prt->Address); - i++; - Prt = (PCI_ROUTING_TABLE *) (((char *) Prt) + Prt->Length); + AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiUtFormatException (Status)); + goto Cleanup; } + AcpiRsDumpResourceList ((ACPI_RESOURCE *) Buffer); + + Cleanup: AcpiDbSetOutputDestination (DB_CONSOLE_OUTPUT); return; +#endif } - - - #endif /* ENABLE_DEBUGGER */ diff --git a/sys/contrib/dev/acpica/dbdisasm.c b/sys/contrib/dev/acpica/dbdisasm.c index 8d3f7db..edeec3a 100644 --- a/sys/contrib/dev/acpica/dbdisasm.c +++ b/sys/contrib/dev/acpica/dbdisasm.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dbdisasm - parser op tree display routines - * $Revision: 37 $ + * $Revision: 40 $ * ******************************************************************************/ @@ -124,7 +124,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbdisasm") @@ -334,9 +334,13 @@ AcpiDbDisplayOp ( } if (AcpiDbBlockType (Op) == BLOCK_PAREN) + { AcpiOsPrintf ("(\n"); + } else + { AcpiOsPrintf ("{\n"); + } } /* Close a block if we are nested less than last time */ @@ -352,9 +356,13 @@ AcpiDbDisplayOp ( } if (AcpiDbBlockType (Op) == BLOCK_PAREN) + { AcpiOsPrintf (")\n"); + } else + { AcpiOsPrintf ("}\n"); + } } } @@ -377,7 +385,7 @@ AcpiDbDisplayOp ( /* Resolve a name reference */ - if ((Op->Opcode == AML_NAMEPATH_OP && Op->Value.Name) && + if ((Op->Opcode == AML_INT_NAMEPATH_OP && Op->Value.Name) && (Op->Parent) && (opt_verbose)) { @@ -706,7 +714,7 @@ AcpiDbDisplayOpcode ( break; - case AML_STATICSTRING_OP: + case AML_INT_STATICSTRING_OP: if (Op->Value.String) { @@ -721,31 +729,31 @@ AcpiDbDisplayOpcode ( break; - case AML_NAMEPATH_OP: + case AML_INT_NAMEPATH_OP: AcpiDbDisplayNamestring (Op->Value.Name); break; - case AML_NAMEDFIELD_OP: + case AML_INT_NAMEDFIELD_OP: AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Value.Integer); break; - case AML_RESERVEDFIELD_OP: + case AML_INT_RESERVEDFIELD_OP: AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Value.Integer); break; - case AML_ACCESSFIELD_OP: + case AML_INT_ACCESSFIELD_OP: AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Value.Integer); break; - case AML_BYTELIST_OP: + case AML_INT_BYTELIST_OP: if (opt_verbose) { @@ -777,7 +785,7 @@ AcpiDbDisplayOpcode ( #ifndef PARSER_ONLY - if ((Op->Opcode == AML_RETURN_VALUE_OP) && + if ((Op->Opcode == AML_INT_RETURN_VALUE_OP) && (WalkState->Results) && (WalkState->Results->Results.NumResults)) { diff --git a/sys/contrib/dev/acpica/dbdisply.c b/sys/contrib/dev/acpica/dbdisply.c index 3be6f93..81f15b7 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: 41 $ + * $Revision: 45 $ * ******************************************************************************/ @@ -129,7 +129,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbdisply") @@ -300,8 +300,8 @@ AcpiDbDecodeAndDisplayObject ( return; } - AcpiCmDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); - AcpiAmlDumpObjectDescriptor (ObjPtr, 1); + AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); + AcpiExDumpObjectDescriptor (ObjPtr, 1); } else if (VALID_DESCRIPTOR_TYPE ((ObjPtr), ACPI_DESC_TYPE_PARSER)) @@ -315,7 +315,7 @@ AcpiDbDecodeAndDisplayObject ( } - AcpiCmDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); + AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX); AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr); } @@ -329,7 +329,7 @@ AcpiDbDecodeAndDisplayObject ( /* Just dump some memory */ - AcpiCmDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); + AcpiUtDumpBuffer (ObjPtr, Size, Display, ACPI_UINT32_MAX); } return; @@ -365,8 +365,8 @@ DumpNte: return; } - AcpiCmDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); - AcpiAmlDumpNode (Node, 1); + AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX); + AcpiExDumpNode (Node, 1); if (Node->Object) { @@ -377,8 +377,8 @@ DumpNte: return; } - AcpiCmDumpBuffer (Node->Object, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); - AcpiAmlDumpObjectDescriptor (Node->Object, 1); + AcpiUtDumpBuffer (Node->Object, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX); + AcpiExDumpObjectDescriptor (Node->Object, 1); } } @@ -407,7 +407,7 @@ AcpiDbDecodeInternalObject ( return; } - AcpiOsPrintf (" %s", AcpiCmGetTypeName (ObjDesc->Common.Type)); + AcpiOsPrintf (" %s", AcpiUtGetTypeName (ObjDesc->Common.Type)); switch (ObjDesc->Common.Type) { @@ -472,7 +472,7 @@ AcpiDbDisplayInternalObject ( { AcpiOsPrintf ("<Node> Name %4.4s Type-%s", &((ACPI_NAMESPACE_NODE *)ObjDesc)->Name, - AcpiCmGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); + AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjDesc)->Type)); if (((ACPI_NAMESPACE_NODE *) ObjDesc)->Flags & ANOBJ_METHOD_ARG) { AcpiOsPrintf (" [Method Arg]"); @@ -498,7 +498,7 @@ AcpiDbDisplayInternalObject ( switch (ObjDesc->Common.Type) { case INTERNAL_TYPE_REFERENCE: - switch (ObjDesc->Reference.OpCode) + switch (ObjDesc->Reference.Opcode) { case AML_ZERO_OP: AcpiOsPrintf ("[Const] Number %.8X", 0); @@ -835,7 +835,6 @@ AcpiDbDisplayCallingTree (void) { UINT32 i; ACPI_WALK_STATE *WalkState; - ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; @@ -846,14 +845,12 @@ AcpiDbDisplayCallingTree (void) return; } - ObjDesc = WalkState->MethodDesc; Node = WalkState->MethodNode; AcpiOsPrintf ("Current Control Method Call Tree\n"); for (i = 0; WalkState; i++) { - ObjDesc = WalkState->MethodDesc; Node = WalkState->MethodNode; AcpiOsPrintf (" [%4.4s]\n", &Node->Name); diff --git a/sys/contrib/dev/acpica/dbexec.c b/sys/contrib/dev/acpica/dbexec.c index 8469092..3f6ee91 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: 21 $ + * $Revision: 25 $ * ******************************************************************************/ @@ -128,7 +128,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbexec") @@ -333,7 +333,8 @@ AcpiDbExecute ( if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Execution of %s failed with status %s\n", Info.Pathname, AcpiCmFormatException (Status)); + AcpiOsPrintf ("Execution of %s failed with status %s\n", + Info.Pathname, AcpiUtFormatException (Status)); } else @@ -342,7 +343,8 @@ AcpiDbExecute ( if (ReturnObj.Length) { - AcpiOsPrintf ("Execution of %s returned object %p\n", Info.Pathname, ReturnObj.Pointer); + AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", + Info.Pathname, ReturnObj.Pointer, ReturnObj.Length); AcpiDbDumpObject (ReturnObj.Pointer, 1); } } @@ -381,7 +383,8 @@ AcpiDbMethodThread ( { if (ReturnObj.Length) { - AcpiOsPrintf ("Execution of %s returned object %p\n", Info->Pathname, ReturnObj.Pointer); + AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n", + Info->Pathname, ReturnObj.Pointer, ReturnObj.Length); AcpiDbDumpObject (ReturnObj.Pointer, 1); } } @@ -438,7 +441,7 @@ AcpiDbCreateExecutionThreads ( Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiCmFormatException (Status)); + AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiUtFormatException (Status)); return; } diff --git a/sys/contrib/dev/acpica/dbfileio.c b/sys/contrib/dev/acpica/dbfileio.c index e547839..f3f45bf 100644 --- a/sys/contrib/dev/acpica/dbfileio.c +++ b/sys/contrib/dev/acpica/dbfileio.c @@ -2,7 +2,7 @@ * * Module Name: dbfileio - Debugger file I/O commands. These can't usually * be used when running the debugger in Ring 0 (Kernel mode) - * $Revision: 38 $ + * $Revision: 41 $ * ******************************************************************************/ @@ -125,7 +125,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbfileio") @@ -155,7 +155,7 @@ FILE *DebugFile = NULL; * ******************************************************************************/ -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDbMatchArgument ( NATIVE_CHAR *UserArgument, ARGUMENT_INFO *Arguments) @@ -172,7 +172,7 @@ AcpiDbMatchArgument ( { if (STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name) { - return ((OBJECT_TYPE_INTERNAL) i); + return ((ACPI_OBJECT_TYPE8) i); } } @@ -311,7 +311,7 @@ AcpiDbLoadTable( /* Allocate a buffer for the table */ *TableLength = TableHeader.Length; - *TablePtr = (ACPI_TABLE_HEADER *) AcpiCmAllocate ((size_t) *TableLength); + *TablePtr = (ACPI_TABLE_HEADER *) AcpiUtAllocate ((size_t) *TableLength); if (!*TablePtr) { AcpiOsPrintf ("Could not allocate memory for the table (size=%X)\n", TableHeader.Length); @@ -342,7 +342,7 @@ AcpiDbLoadTable( AcpiOsPrintf ("Error - could not read the table file\n"); - AcpiCmFree (*TablePtr); + AcpiUtFree (*TablePtr); *TablePtr = NULL; *TableLength = 0; @@ -472,9 +472,9 @@ AcpiDbLoadAcpiTable ( else { AcpiOsPrintf ("Could not install table, %s\n", - AcpiCmFormatException (Status)); + AcpiUtFormatException (Status)); } - AcpiCmFree (TablePtr); + AcpiUtFree (TablePtr); return (Status); } diff --git a/sys/contrib/dev/acpica/dbhistry.c b/sys/contrib/dev/acpica/dbhistry.c index 765c3e1..8749d4f 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: 17 $ + * $Revision: 18 $ * *****************************************************************************/ @@ -128,7 +128,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbhistry") diff --git a/sys/contrib/dev/acpica/dbinput.c b/sys/contrib/dev/acpica/dbinput.c index 812dbfe..bcc42d0 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: 56 $ + * $Revision: 61 $ * ******************************************************************************/ @@ -125,7 +125,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbinput") @@ -162,7 +162,7 @@ BOOLEAN opt_ini_methods = TRUE; * This list of commands must match the string table below it */ -enum AcpiAmlDebuggerCommands +enum AcpiExDebuggerCommands { CMD_NOT_FOUND = 0, CMD_NULL, @@ -191,6 +191,7 @@ enum AcpiAmlDebuggerCommands CMD_LIST, CMD_LOAD, CMD_LOCALS, + CMD_LOCKS, CMD_METHODS, CMD_NAMESPACE, CMD_NOTIFY, @@ -244,6 +245,7 @@ COMMAND_INFO Commands[] = {"LIST", 0}, {"LOAD", 1}, {"LOCALS", 0}, + {"LOCKS", 0}, {"METHODS", 0}, {"NAMESPACE", 0}, {"NOTIFY", 2}, @@ -318,6 +320,7 @@ AcpiDbDisplayHelp ( AcpiOsPrintf ("Help This help screen\n"); AcpiOsPrintf ("History Display command history buffer\n"); AcpiOsPrintf ("Level [<DebugLevel>] [console] Get/Set debug level for file or console\n"); + AcpiOsPrintf ("Locks Current status of internal mutexes\n"); AcpiOsPrintf ("Quit or Exit Exit this command\n"); AcpiOsPrintf ("Stats [Allocations|Memory|Misc\n"); AcpiOsPrintf (" |Objects|Tables] Display namespace and memory statistics\n"); @@ -353,7 +356,7 @@ AcpiDbDisplayHelp ( AcpiOsPrintf ("Go Allow method to run to completion\n"); AcpiOsPrintf ("Information Display info about the current method\n"); AcpiOsPrintf ("Into Step into (not over) a method call\n"); - AcpiOsPrintf ("List [# of AcpiAml Opcodes] Display method ASL statements\n"); + AcpiOsPrintf ("List [# of Aml Opcodes] Display method ASL statements\n"); AcpiOsPrintf ("Locals Display method local variables\n"); AcpiOsPrintf ("Results Display method result stack\n"); AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n"); @@ -597,7 +600,7 @@ AcpiDbCommandDispatch ( break; case CMD_ALLOCATIONS: - AcpiCmDumpCurrentAllocations ((UINT32) -1, NULL); + AcpiUtDumpCurrentAllocations ((UINT32) -1, NULL); break; case CMD_ARGS: @@ -669,7 +672,9 @@ AcpiDbCommandDispatch ( Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); if (ACPI_SUCCESS (Status)) + { Status = AE_CTRL_TRUE; + } return (Status); break; @@ -682,7 +687,9 @@ AcpiDbCommandDispatch ( Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op); if (ACPI_SUCCESS (Status)) + { Status = AE_CTRL_TRUE; + } return (Status); case CMD_INFORMATION: @@ -732,6 +739,10 @@ AcpiDbCommandDispatch ( } break; + case CMD_LOCKS: + AcpiDbDisplayLocks (); + break; + case CMD_LOCALS: AcpiDbDisplayLocals (); break; @@ -750,7 +761,7 @@ AcpiDbCommandDispatch ( break; case CMD_OBJECT: - AcpiDbDisplayObjects (Args[1], Args[2]); + AcpiDbDisplayObjects (STRUPR (Args[1]), Args[2]); break; case CMD_OPEN: @@ -795,7 +806,7 @@ AcpiDbCommandDispatch ( case CMD_TERMINATE: AcpiDbSetOutputDestination (DB_REDIRECTABLE_OUTPUT); - AcpiCmSubsystemShutdown (); + AcpiUtSubsystemShutdown (); /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */ @@ -818,7 +829,8 @@ AcpiDbCommandDispatch ( case CMD_QUIT: if (Op) { - return (AE_AML_ERROR); + AcpiOsPrintf ("Method execution terminated\n"); + return (AE_CTRL_TERMINATE); } if (!OutputToFile) @@ -828,7 +840,7 @@ AcpiDbCommandDispatch ( /* Shutdown */ - /* AcpiCmSubsystemShutdown (); */ + /* AcpiUtSubsystemShutdown (); */ AcpiDbCloseDebugFile (); AcpiGbl_DbTerminateThreads = TRUE; @@ -873,9 +885,9 @@ AcpiDbExecuteThread ( AcpiGbl_MethodExecuting = FALSE; AcpiGbl_StepToNextCall = FALSE; - AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); Status = AcpiDbCommandDispatch (LineBuf, NULL, NULL); - AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); } } @@ -962,8 +974,8 @@ AcpiDbUserCommands ( * and wait for the command to complete. */ - AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); - AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); + AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); } else diff --git a/sys/contrib/dev/acpica/dbstats.c b/sys/contrib/dev/acpica/dbstats.c index f4531ea..8d0c9bb 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: 37 $ + * $Revision: 40 $ * ******************************************************************************/ @@ -123,7 +123,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbstats") /* @@ -409,7 +409,7 @@ AcpiDbDisplayStatistics ( { #ifndef PARSER_ONLY case CMD_ALLOCATIONS: - AcpiCmDumpAllocationInfo (); + AcpiUtDumpAllocationInfo (); break; #endif @@ -430,7 +430,7 @@ AcpiDbDisplayStatistics ( for (i = 0; i < INTERNAL_TYPE_NODE_MAX; i++) { - AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiCmGetTypeName (i), + AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", AcpiUtGetTypeName (i), AcpiGbl_NodeTypeCount [i], AcpiGbl_ObjTypeCount [i]); } AcpiOsPrintf ("%16.16s % 10ld% 10ld\n", "Misc/Unknown", @@ -498,7 +498,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("Mutex usage:\n\n"); for (i = 0; i < NUM_MTX; i++) { - AcpiOsPrintf ("%-20s: % 7ld\n", AcpiCmGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount); + AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_AcpiMutexInfo[i].UseCount); } break; @@ -512,7 +512,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("String %3d\n", sizeof (ACPI_OBJECT_STRING)); AcpiOsPrintf ("Buffer %3d\n", sizeof (ACPI_OBJECT_BUFFER)); AcpiOsPrintf ("Package %3d\n", sizeof (ACPI_OBJECT_PACKAGE)); - AcpiOsPrintf ("FieldUnit %3d\n", sizeof (ACPI_OBJECT_FIELD_UNIT)); + AcpiOsPrintf ("BufferField %3d\n", sizeof (ACPI_OBJECT_BUFFER_FIELD)); AcpiOsPrintf ("Device %3d\n", sizeof (ACPI_OBJECT_DEVICE)); AcpiOsPrintf ("Event %3d\n", sizeof (ACPI_OBJECT_EVENT)); AcpiOsPrintf ("Method %3d\n", sizeof (ACPI_OBJECT_METHOD)); @@ -521,7 +521,7 @@ AcpiDbDisplayStatistics ( AcpiOsPrintf ("PowerResource %3d\n", sizeof (ACPI_OBJECT_POWER_RESOURCE)); AcpiOsPrintf ("Processor %3d\n", sizeof (ACPI_OBJECT_PROCESSOR)); AcpiOsPrintf ("ThermalZone %3d\n", sizeof (ACPI_OBJECT_THERMAL_ZONE)); - AcpiOsPrintf ("Field %3d\n", sizeof (ACPI_OBJECT_FIELD)); + AcpiOsPrintf ("RegionField %3d\n", sizeof (ACPI_OBJECT_REGION_FIELD)); AcpiOsPrintf ("BankField %3d\n", sizeof (ACPI_OBJECT_BANK_FIELD)); AcpiOsPrintf ("IndexField %3d\n", sizeof (ACPI_OBJECT_INDEX_FIELD)); AcpiOsPrintf ("Reference %3d\n", sizeof (ACPI_OBJECT_REFERENCE)); diff --git a/sys/contrib/dev/acpica/dbutils.c b/sys/contrib/dev/acpica/dbutils.c index 2c0bae7..6d1ae06 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: 35 $ + * $Revision: 37 $ * ******************************************************************************/ @@ -128,7 +128,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbutils") @@ -186,7 +186,7 @@ AcpiDbDumpBuffer ( AcpiOsPrintf ("\nLocation %X:\n", Address); AcpiDbgLevel |= TRACE_TABLES; - AcpiCmDumpBuffer ((UINT8 *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); + AcpiUtDumpBuffer ((UINT8 *) Address, 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); } @@ -249,7 +249,7 @@ AcpiDbDumpObject ( case ACPI_TYPE_BUFFER: AcpiOsPrintf ("[Buffer] Value: "); - AcpiCmDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); + AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); break; @@ -450,11 +450,11 @@ AcpiDbLocalNsLookup ( if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiCmFormatException (Status)); + AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiUtFormatException (Status)); } - AcpiCmFree (InternalPath); + AcpiUtFree (InternalPath); return (Node); } diff --git a/sys/contrib/dev/acpica/dbxface.c b/sys/contrib/dev/acpica/dbxface.c index 4116655..28c49a6 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: 34 $ + * $Revision: 37 $ * ******************************************************************************/ @@ -127,7 +127,7 @@ #ifdef ENABLE_DEBUGGER -#define _COMPONENT DEBUGGER +#define _COMPONENT ACPI_DEBUGGER MODULE_NAME ("dbxface") @@ -180,7 +180,7 @@ AcpiDbSingleStep ( * namely, opcodes that have arguments */ - if (Op->Opcode == AML_NAMEDFIELD_OP) + if (Op->Opcode == AML_INT_NAMEDFIELD_OP) { return (AE_OK); } @@ -199,7 +199,7 @@ AcpiDbSingleStep ( case OPTYPE_NAMED_OBJECT: switch (Op->Opcode) { - case AML_NAMEPATH_OP: + case AML_INT_NAMEPATH_OP: return (AE_OK); break; } @@ -288,7 +288,7 @@ AcpiDbSingleStep ( if (AcpiGbl_StepToNextCall) { - if (Op->Opcode != AML_METHODCALL_OP) + if (Op->Opcode != AML_INT_METHODCALL_OP) { /* Not a method call, just keep executing */ @@ -306,7 +306,7 @@ AcpiDbSingleStep ( * by default. */ - if (Op->Opcode == AML_METHODCALL_OP) + if (Op->Opcode == AML_INT_METHODCALL_OP) { AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */ @@ -320,7 +320,7 @@ AcpiDbSingleStep ( /* TBD: [Investigate] what are the namespace locking issues here */ - /* AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); */ + /* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */ /* Go into the command loop and await next user command */ @@ -332,8 +332,8 @@ AcpiDbSingleStep ( { /* Handshake with the front-end that gets user command lines */ - AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); } else @@ -363,7 +363,7 @@ AcpiDbSingleStep ( Status = AcpiDbCommandDispatch (LineBuf, WalkState, Op); } - /* AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); */ + /* AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); */ /* User commands complete, continue execution of the interrupted method */ @@ -409,8 +409,8 @@ AcpiDbInitialize (void) { /* These were created with one unit, grab it */ - AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); - AcpiCmAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); + AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_COMPLETE); + AcpiUtAcquireMutex (ACPI_MTX_DEBUG_CMD_READY); /* Create the debug execution thread to execute commands */ diff --git a/sys/contrib/dev/acpica/dsfield.c b/sys/contrib/dev/acpica/dsfield.c index 11f304d..2239077 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: 31 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -123,7 +123,7 @@ #include "acnamesp.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsfield") @@ -143,7 +143,8 @@ * FUNCTION: AcpiDsCreateField * * PARAMETERS: Op - Op containing the Field definition and args - * RegionNode - Object for the containing Operation Region + * RegionNode - Object for the containing Operation Region + * ` WalkState - Current method state * * RETURN: Status * @@ -161,7 +162,6 @@ AcpiDsCreateField ( ACPI_PARSE_OBJECT *Arg; ACPI_NAMESPACE_NODE *Node; UINT8 FieldFlags; - UINT8 AccessAttribute = 0; UINT32 FieldBitPosition = 0; @@ -174,10 +174,8 @@ AcpiDsCreateField ( if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name, - ACPI_TYPE_REGION, IMODE_EXECUTE, - NS_SEARCH_PARENT, WalkState, - &RegionNode); - + ACPI_TYPE_REGION, IMODE_EXECUTE, + NS_SEARCH_PARENT, WalkState, &RegionNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -196,35 +194,30 @@ AcpiDsCreateField ( { switch (Arg->Opcode) { - case AML_RESERVEDFIELD_OP: + case AML_INT_RESERVEDFIELD_OP: FieldBitPosition += Arg->Value.Size; break; - case AML_ACCESSFIELD_OP: + case AML_INT_ACCESSFIELD_OP: /* * Get a new AccessType and AccessAttribute for all * entries (until end or another AccessAs keyword) */ - - AccessAttribute = (UINT8) Arg->Value.Integer; - FieldFlags = (UINT8) - ((FieldFlags & FIELD_ACCESS_TYPE_MASK) || - ((UINT8) (Arg->Value.Integer >> 8))); + FieldFlags = (UINT8) ((FieldFlags & FIELD_ACCESS_TYPE_MASK) || + ((UINT8) (Arg->Value.Integer >> 8))); break; - case AML_NAMEDFIELD_OP: + case AML_INT_NAMEDFIELD_OP: Status = AcpiNsLookup (WalkState->ScopeInfo, (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, - INTERNAL_TYPE_DEF_FIELD, - IMODE_LOAD_PASS1, + INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &Node); - if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -235,9 +228,8 @@ AcpiDsCreateField ( * the object stack */ - Status = AcpiAmlPrepDefFieldValue (Node, RegionNode, FieldFlags, - AccessAttribute, FieldBitPosition, Arg->Value.Size); - + Status = AcpiExPrepRegionFieldValue (Node, RegionNode, FieldFlags, + FieldBitPosition, Arg->Value.Size); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -261,7 +253,8 @@ AcpiDsCreateField ( * FUNCTION: AcpiDsCreateBankField * * PARAMETERS: Op - Op containing the Field definition and args - * RegionNode - Object for the containing Operation Region + * RegionNode - Object for the containing Operation Region + * ` WalkState - Current method state * * RETURN: Status * @@ -281,7 +274,6 @@ AcpiDsCreateBankField ( ACPI_NAMESPACE_NODE *Node; UINT32 BankValue; UINT8 FieldFlags; - UINT8 AccessAttribute = 0; UINT32 FieldBitPosition = 0; @@ -294,10 +286,8 @@ AcpiDsCreateBankField ( if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.Name, - ACPI_TYPE_REGION, IMODE_EXECUTE, - NS_SEARCH_PARENT, WalkState, - &RegionNode); - + ACPI_TYPE_REGION, IMODE_EXECUTE, + NS_SEARCH_PARENT, WalkState, &RegionNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -309,11 +299,9 @@ AcpiDsCreateBankField ( Arg = Arg->Next; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, - INTERNAL_TYPE_BANK_FIELD_DEFN, - IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &RegisterNode); - + INTERNAL_TYPE_BANK_FIELD_DEFN, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, + NULL, &RegisterNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -337,35 +325,30 @@ AcpiDsCreateBankField ( { switch (Arg->Opcode) { - case AML_RESERVEDFIELD_OP: + case AML_INT_RESERVEDFIELD_OP: FieldBitPosition += Arg->Value.Size; break; - case AML_ACCESSFIELD_OP: + case AML_INT_ACCESSFIELD_OP: /* * Get a new AccessType and AccessAttribute for * all entries (until end or another AccessAs keyword) */ - - AccessAttribute = (UINT8) Arg->Value.Integer; - FieldFlags = (UINT8) - ((FieldFlags & FIELD_ACCESS_TYPE_MASK) || - ((UINT8) (Arg->Value.Integer >> 8))); + FieldFlags = (UINT8) ((FieldFlags & FIELD_ACCESS_TYPE_MASK) || + ((UINT8) (Arg->Value.Integer >> 8))); break; - case AML_NAMEDFIELD_OP: + case AML_INT_NAMEDFIELD_OP: Status = AcpiNsLookup (WalkState->ScopeInfo, (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, - INTERNAL_TYPE_DEF_FIELD, - IMODE_LOAD_PASS1, + INTERNAL_TYPE_REGION_FIELD, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, NULL, &Node); - if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -376,10 +359,9 @@ AcpiDsCreateBankField ( * the object stack */ - Status = AcpiAmlPrepBankFieldValue (Node, RegionNode, RegisterNode, - BankValue, FieldFlags, AccessAttribute, - FieldBitPosition, Arg->Value.Size); - + Status = AcpiExPrepBankFieldValue (Node, RegionNode, RegisterNode, + BankValue, FieldFlags, FieldBitPosition, + Arg->Value.Size); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -404,7 +386,8 @@ AcpiDsCreateBankField ( * FUNCTION: AcpiDsCreateIndexField * * PARAMETERS: Op - Op containing the Field definition and args - * RegionNode - Object for the containing Operation Region + * RegionNode - Object for the containing Operation Region + * ` WalkState - Current method state * * RETURN: Status * @@ -415,7 +398,7 @@ AcpiDsCreateBankField ( ACPI_STATUS AcpiDsCreateIndexField ( ACPI_PARSE_OBJECT *Op, - ACPI_HANDLE RegionNode, + ACPI_NAMESPACE_NODE *RegionNode, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; @@ -424,7 +407,6 @@ AcpiDsCreateIndexField ( ACPI_NAMESPACE_NODE *IndexRegisterNode; ACPI_NAMESPACE_NODE *DataRegisterNode; UINT8 FieldFlags; - UINT8 AccessAttribute = 0; UINT32 FieldBitPosition = 0; @@ -436,10 +418,9 @@ AcpiDsCreateIndexField ( /* First arg is the name of the Index register */ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, - ACPI_TYPE_ANY, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &IndexRegisterNode); - + ACPI_TYPE_ANY, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, + NULL, &IndexRegisterNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -450,11 +431,9 @@ AcpiDsCreateIndexField ( Arg = Arg->Next; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, - INTERNAL_TYPE_INDEX_FIELD_DEFN, - IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &DataRegisterNode); - + INTERNAL_TYPE_INDEX_FIELD_DEFN, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, + NULL, &DataRegisterNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -474,35 +453,30 @@ AcpiDsCreateIndexField ( { switch (Arg->Opcode) { - case AML_RESERVEDFIELD_OP: + case AML_INT_RESERVEDFIELD_OP: FieldBitPosition += Arg->Value.Size; break; - case AML_ACCESSFIELD_OP: + case AML_INT_ACCESSFIELD_OP: /* * Get a new AccessType and AccessAttribute for all * entries (until end or another AccessAs keyword) */ - - AccessAttribute = (UINT8) Arg->Value.Integer; - FieldFlags = (UINT8) - ((FieldFlags & FIELD_ACCESS_TYPE_MASK) || - ((UINT8) (Arg->Value.Integer >> 8))); + FieldFlags = (UINT8) ((FieldFlags & FIELD_ACCESS_TYPE_MASK) || + ((UINT8) (Arg->Value.Integer >> 8))); break; - case AML_NAMEDFIELD_OP: + case AML_INT_NAMEDFIELD_OP: Status = AcpiNsLookup (WalkState->ScopeInfo, - (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, - INTERNAL_TYPE_INDEX_FIELD, - IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - NULL, &Node); - + (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Arg)->Name, + INTERNAL_TYPE_INDEX_FIELD, IMODE_LOAD_PASS1, + NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, + NULL, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -513,10 +487,9 @@ AcpiDsCreateIndexField ( * the object stack */ - Status = AcpiAmlPrepIndexFieldValue (Node, IndexRegisterNode, DataRegisterNode, - FieldFlags, AccessAttribute, + Status = AcpiExPrepIndexFieldValue (Node, IndexRegisterNode, + DataRegisterNode, FieldFlags, FieldBitPosition, Arg->Value.Size); - if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -530,8 +503,7 @@ AcpiDsCreateIndexField ( default: - DEBUG_PRINT (ACPI_ERROR, - ("DsEnterIndexField: Invalid opcode in field list: %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Invalid opcode in field list: %X\n", Arg->Opcode)); Status = AE_AML_ERROR; break; diff --git a/sys/contrib/dev/acpica/dsmethod.c b/sys/contrib/dev/acpica/dsmethod.c index 02e1322..585b856 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: 56 $ + * $Revision: 63 $ * *****************************************************************************/ @@ -126,7 +126,7 @@ #include "acdebug.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsmethod") @@ -169,8 +169,7 @@ AcpiDsParseMethod ( return_ACPI_STATUS (AE_NULL_ENTRY); } - DEBUG_PRINT (ACPI_INFO, - ("DsParseMethod: **** Parsing [%4.4s] **** NamedObj=%p\n", + DEBUG_PRINTP (ACPI_INFO, ("**** Parsing [%4.4s] **** NamedObj=%p\n", &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle)); @@ -188,7 +187,8 @@ AcpiDsParseMethod ( if ((ObjDesc->Method.Concurrency != INFINITE_CONCURRENCY) && (!ObjDesc->Method.Semaphore)) { - Status = AcpiOsCreateSemaphore (1,ObjDesc->Method.Concurrency, + Status = AcpiOsCreateSemaphore (ObjDesc->Method.Concurrency, + ObjDesc->Method.Concurrency, &ObjDesc->Method.Semaphore); if (ACPI_FAILURE (Status)) { @@ -200,7 +200,6 @@ AcpiDsParseMethod ( * Allocate a new parser op to be the root of the parsed * method tree */ - Op = AcpiPsAllocOp (AML_METHOD_OP); if (!Op) { @@ -216,15 +215,13 @@ AcpiDsParseMethod ( /* * Parse the method, first pass * - * The first pass load is - * where newly declared named objects are + * The first pass load is where newly declared named objects are * added into the namespace. Actual evaluation of * the named objects (what would be called a "second * pass") happens during the actual execution of the * method so that operands to the named objects can * take on dynamic run-time values. */ - Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, ObjDesc->Method.PcodeLength, ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, @@ -238,11 +235,10 @@ AcpiDsParseMethod ( /* Get a new OwnerId for objects created by this method */ - OwnerId = AcpiCmAllocateOwnerId (OWNER_TYPE_METHOD); + OwnerId = AcpiUtAllocateOwnerId (OWNER_TYPE_METHOD); ObjDesc->Method.OwningId = OwnerId; - DEBUG_PRINT (ACPI_INFO, - ("DsParseMethod: **** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", + DEBUG_PRINTP (ACPI_INFO, ("**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n", &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, ObjHandle, Op)); /* Install the parsed tree in the method object */ @@ -250,7 +246,6 @@ AcpiDsParseMethod ( AcpiPsDeleteParseTree (Op); - return_ACPI_STATUS (Status); } @@ -259,8 +254,9 @@ AcpiDsParseMethod ( * * FUNCTION: AcpiDsBeginMethodExecution * - * PARAMETERS: MethodNode - Node of the method + * PARAMETERS: MethodNode - Node of the method * ObjDesc - The method object + * CallingMethodNode - Caller of this method (if non-null) * * RETURN: Status * @@ -275,7 +271,8 @@ AcpiDsParseMethod ( ACPI_STATUS AcpiDsBeginMethodExecution ( ACPI_NAMESPACE_NODE *MethodNode, - ACPI_OPERAND_OBJECT *ObjDesc) + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_NAMESPACE_NODE *CallingMethodNode) { ACPI_STATUS Status = AE_OK; @@ -288,36 +285,44 @@ AcpiDsBeginMethodExecution ( return_ACPI_STATUS (AE_NULL_ENTRY); } - ObjDesc = AcpiNsGetAttachedObject (MethodNode); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NULL_OBJECT); - } - /* * If there is a concurrency limit on this method, we need to - * obtain a unit from the method semaphore. This releases the - * interpreter if we block + * obtain a unit from the method semaphore. */ - if (ObjDesc->Method.Semaphore) { - Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Method.Semaphore, + /* + * Allow recursive method calls, up to the reentrancy/concurrency + * limit imposed by the SERIALIZED rule and the SyncLevel method + * parameter. + * + * The point of this code is to avoid permanently blocking a + * thread that is making recursive method calls. + */ + if (MethodNode == CallingMethodNode) + { + if (ObjDesc->Method.ThreadCount >= ObjDesc->Method.Concurrency) + { + return_ACPI_STATUS (AE_AML_METHOD_LIMIT); + } + } + + /* + * Get a unit from the method semaphore. This releases the + * interpreter if we block + */ + Status = AcpiExSystemWaitSemaphore (ObjDesc->Method.Semaphore, WAIT_FOREVER); } /* - * Increment the method parse tree thread count since there - * is one additional thread executing in it. If configured - * for deletion-on-exit, the parse tree will be deleted when - * the last thread completes execution of the method + * Increment the method parse tree thread count since it has been + * reentered one more time (even if it is the same thread) */ - ObjDesc->Method.ThreadCount++; - return_ACPI_STATUS (Status); } @@ -351,14 +356,12 @@ AcpiDsCallControlMethod ( FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState); - DEBUG_PRINT (TRACE_DISPATCH, - ("DsCall, execute method %p, currentstate=%p\n", + DEBUG_PRINTP (TRACE_DISPATCH, ("Execute method %p, currentstate=%p\n", ThisWalkState->PrevOp, ThisWalkState)); /* * Get the namespace entry for the control method we are about to call */ - MethodNode = ThisWalkState->MethodCallNode; if (!MethodNode) { @@ -374,13 +377,13 @@ AcpiDsCallControlMethod ( /* Init for new method, wait on concurrency semaphore */ - Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc); + Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, + ThisWalkState->MethodNode); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* Create and initialize a new parser state */ ParserState = AcpiPsCreateState (ObjDesc->Method.Pcode, @@ -433,7 +436,6 @@ AcpiDsCallControlMethod ( * stack. Operands on the previous walk state stack always * start at index 0. */ - Status = AcpiDsMethodDataInitArgs (&ThisWalkState->Operands[0], ThisWalkState->NumOperands, NextWalkState); @@ -451,7 +453,7 @@ AcpiDsCallControlMethod ( return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, + Status = AcpiPsParseAml (Op, ObjDesc->Method.Pcode, ObjDesc->Method.PcodeLength, ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, MethodNode, NULL, NULL, @@ -463,10 +465,9 @@ AcpiDsCallControlMethod ( * Delete the operands on the previous walkstate operand stack * (they were copied to new objects) */ - for (i = 0; i < ObjDesc->Method.ParamCount; i++) { - AcpiCmRemoveReference (ThisWalkState->Operands [i]); + AcpiUtRemoveReference (ThisWalkState->Operands [i]); ThisWalkState->Operands [i] = NULL; } @@ -475,8 +476,8 @@ AcpiDsCallControlMethod ( ThisWalkState->NumOperands = 0; - DEBUG_PRINT (TRACE_DISPATCH, - ("DsCall, starting nested execution, newstate=%p\n", NextWalkState)); + DEBUG_PRINTP (TRACE_DISPATCH, ("Starting nested execution, newstate=%p\n", + NextWalkState)); return_ACPI_STATUS (AE_OK); @@ -523,11 +524,10 @@ AcpiDsRestartControlMethod ( * Get the return value (if any) from the previous method. * NULL if no return value */ - Status = AcpiDsResultPush (ReturnDesc, WalkState); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ReturnDesc); + AcpiUtRemoveReference (ReturnDesc); return_ACPI_STATUS (Status); } } @@ -538,14 +538,14 @@ AcpiDsRestartControlMethod ( * Delete the return value if it will not be used by the * calling method */ - AcpiCmRemoveReference (ReturnDesc); + AcpiUtRemoveReference (ReturnDesc); } } - DEBUG_PRINT (TRACE_DISPATCH, - ("DsRestart: Method=%p Return=%p ReturnUsed?=%X ResStack=%p State=%p\n", - WalkState->MethodCallOp, ReturnDesc, WalkState->ReturnUsed, + DEBUG_PRINTP (TRACE_DISPATCH, + ("Method=%p Return=%p ReturnUsed?=%X ResStack=%p State=%p\n", + WalkState->MethodCallOp, ReturnDesc, WalkState->ReturnUsed, WalkState->Results, WalkState)); @@ -571,7 +571,6 @@ ACPI_STATUS AcpiDsTerminateControlMethod ( ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *MethodNode; @@ -596,16 +595,15 @@ AcpiDsTerminateControlMethod ( * If this is the last thread executing the method, * we have additional cleanup to perform */ - - AcpiCmAcquireMutex (ACPI_MTX_PARSER); + AcpiUtAcquireMutex (ACPI_MTX_PARSER); /* Signal completion of the execution of this method if necessary */ if (WalkState->MethodDesc->Method.Semaphore) { - Status = AcpiOsSignalSemaphore ( - WalkState->MethodDesc->Method.Semaphore, 1); + AcpiOsSignalSemaphore ( + WalkState->MethodDesc->Method.Semaphore, 1); } /* Decrement the thread count on the method parse tree */ @@ -620,11 +618,12 @@ AcpiDsTerminateControlMethod ( * The method Node is stored in the walk state */ MethodNode = WalkState->MethodNode; + /* * Delete any namespace entries created immediately underneath * the method */ - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (MethodNode->Child) { AcpiNsDeleteNamespaceSubtree (MethodNode); @@ -635,10 +634,10 @@ AcpiDsTerminateControlMethod ( * the namespace */ AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId); - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } - AcpiCmReleaseMutex (ACPI_MTX_PARSER); + AcpiUtReleaseMutex (ACPI_MTX_PARSER); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/dsmthdat.c b/sys/contrib/dev/acpica/dsmthdat.c index 0734ce6..100c3a1 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: 39 $ + * $Revision: 46 $ * ******************************************************************************/ @@ -124,7 +124,7 @@ #include "acnamesp.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsmthdat") @@ -154,7 +154,7 @@ AcpiDsMethodDataInit ( /* * WalkState fields are initialized to zero by the - * AcpiCmCallocate(). + * AcpiUtCallocate(). * * An Node is assigned to each argument and local so * that RefOf() can return a pointer to the Node. @@ -215,16 +215,14 @@ AcpiDsMethodDataDeleteAll ( /* Delete the locals */ - DEBUG_PRINT (ACPI_INFO, - ("MethodDeleteAll: Deleting local variables in %p\n", WalkState)); + DEBUG_PRINTP (ACPI_INFO, ("Deleting local variables in %p\n", WalkState)); for (Index = 0; Index < MTH_NUM_LOCALS; Index++) { Object = WalkState->LocalVariables[Index].Object; if (Object) { - DEBUG_PRINT (TRACE_EXEC, - ("MethodDeleteAll: Deleting Local%d=%p\n", Index, Object)); + DEBUG_PRINTP (TRACE_EXEC, ("Deleting Local%d=%p\n", Index, Object)); /* Remove first */ @@ -232,23 +230,21 @@ AcpiDsMethodDataDeleteAll ( /* Was given a ref when stored */ - AcpiCmRemoveReference (Object); + AcpiUtRemoveReference (Object); } } /* Delete the arguments */ - DEBUG_PRINT (ACPI_INFO, - ("MethodDeleteAll: Deleting arguments in %p\n", WalkState)); + DEBUG_PRINTP (ACPI_INFO, ("Deleting arguments in %p\n", WalkState)); for (Index = 0; Index < MTH_NUM_ARGS; Index++) { Object = WalkState->Arguments[Index].Object; if (Object) { - DEBUG_PRINT (TRACE_EXEC, - ("MethodDeleteAll: Deleting Arg%d=%p\n", Index, Object)); + DEBUG_PRINTP (TRACE_EXEC, ("Deleting Arg%d=%p\n", Index, Object)); /* Remove first */ @@ -256,7 +252,7 @@ AcpiDsMethodDataDeleteAll ( /* Was given a ref when stored */ - AcpiCmRemoveReference (Object); + AcpiUtRemoveReference (Object); } } @@ -294,8 +290,7 @@ AcpiDsMethodDataInitArgs ( if (!Params) { - DEBUG_PRINT (TRACE_EXEC, - ("DsMethodDataInitArgs: No param list passed to method\n")); + DEBUG_PRINTP (TRACE_EXEC, ("No param list passed to method\n")); return_ACPI_STATUS (AE_OK); } @@ -312,8 +307,8 @@ AcpiDsMethodDataInitArgs ( * Set the current method argument to the * Params[Pindex++] argument object descriptor */ - Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG, Mindex, - Params[Pindex], WalkState); + Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Mindex, + Params[Pindex], WalkState); if (ACPI_FAILURE (Status)) { break; @@ -328,8 +323,7 @@ AcpiDsMethodDataInitArgs ( } } - DEBUG_PRINT (TRACE_EXEC, - ("DsMethodDataInitArgs: %d args passed to method\n", Pindex)); + DEBUG_PRINTP (TRACE_EXEC, ("%d args passed to method\n", Pindex)); return_ACPI_STATUS (AE_OK); } @@ -338,7 +332,7 @@ AcpiDsMethodDataInitArgs ( * * FUNCTION: AcpiDsMethodDataGetEntry * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to get * Entry - Pointer to where a pointer to the stack * entry is returned. @@ -346,13 +340,13 @@ AcpiDsMethodDataInitArgs ( * * RETURN: Status * - * DESCRIPTION: Get the address of the stack entry given by Type:Index + * DESCRIPTION: Get the address of the object entry given by Opcode:Index * ******************************************************************************/ ACPI_STATUS AcpiDsMethodDataGetEntry ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT ***Entry) @@ -363,46 +357,42 @@ AcpiDsMethodDataGetEntry ( /* * Get the requested object. - * The stack "Type" is either a LocalVariable or an Argument + * The stack "Opcode" is either a LocalVariable or an Argument */ - switch (Type) + switch (Opcode) { - case MTH_TYPE_LOCAL: + case AML_LOCAL_OP: if (Index > MTH_MAX_LOCAL) { - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetEntry: LocalVar index %d is invalid (max %d)\n", + DEBUG_PRINTP (ACPI_ERROR, ("LocalVar index %d is invalid (max %d)\n", Index, MTH_MAX_LOCAL)); return_ACPI_STATUS (AE_BAD_PARAMETER); } - *Entry = - (ACPI_OPERAND_OBJECT **) &WalkState->LocalVariables[Index].Object; + *Entry = (ACPI_OPERAND_OBJECT **) + &WalkState->LocalVariables[Index].Object; break; - case MTH_TYPE_ARG: + case AML_ARG_OP: if (Index > MTH_MAX_ARG) { - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetEntry: Argument index %d is invalid (max %d)\n", + DEBUG_PRINTP (ACPI_ERROR, ("Arg index %d is invalid (max %d)\n", Index, MTH_MAX_ARG)); return_ACPI_STATUS (AE_BAD_PARAMETER); } - *Entry = - (ACPI_OPERAND_OBJECT **) &WalkState->Arguments[Index].Object; + *Entry = (ACPI_OPERAND_OBJECT **) + &WalkState->Arguments[Index].Object; break; default: - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetEntry: Stack type %d is invalid\n", - Type)); + DEBUG_PRINTP (ACPI_ERROR, ("Opcode %d is invalid\n", Opcode)); return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -415,20 +405,20 @@ AcpiDsMethodDataGetEntry ( * * FUNCTION: AcpiDsMethodDataSetEntry * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to get * Object - Object to be inserted into the stack entry * WalkState - Current walk state object * * RETURN: Status * - * DESCRIPTION: Insert an object onto the method stack at entry Type:Index. + * DESCRIPTION: Insert an object onto the method stack at entry Opcode:Index. * ******************************************************************************/ ACPI_STATUS AcpiDsMethodDataSetEntry ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState) @@ -441,7 +431,7 @@ AcpiDsMethodDataSetEntry ( /* Get a pointer to the stack entry to set */ - Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -449,7 +439,7 @@ AcpiDsMethodDataSetEntry ( /* Increment ref count so object can't be deleted while installed */ - AcpiCmAddReference (Object); + AcpiUtAddReference (Object); /* Install the object into the stack entry */ @@ -463,7 +453,7 @@ AcpiDsMethodDataSetEntry ( * * FUNCTION: AcpiDsMethodDataGetType * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument whose type * to get * WalkState - Current walk state object @@ -473,9 +463,9 @@ AcpiDsMethodDataSetEntry ( * ******************************************************************************/ -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDsMethodDataGetType ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState) { @@ -489,7 +479,7 @@ AcpiDsMethodDataGetType ( /* Get a pointer to the requested stack entry */ - Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); if (ACPI_FAILURE (Status)) { return_VALUE ((ACPI_TYPE_NOT_FOUND)); @@ -513,9 +503,9 @@ AcpiDsMethodDataGetType ( /******************************************************************************* * - * FUNCTION: AcpiDsMethodDataGetNte + * FUNCTION: AcpiDsMethodDataGetNode * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument whose type * to get * WalkState - Current walk state object @@ -525,26 +515,25 @@ AcpiDsMethodDataGetType ( ******************************************************************************/ ACPI_NAMESPACE_NODE * -AcpiDsMethodDataGetNte ( - UINT32 Type, +AcpiDsMethodDataGetNode ( + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState) { ACPI_NAMESPACE_NODE *Node = NULL; - FUNCTION_TRACE ("DsMethodDataGetNte"); + FUNCTION_TRACE ("DsMethodDataGetNode"); - switch (Type) + switch (Opcode) { - case MTH_TYPE_LOCAL: + case AML_LOCAL_OP: if (Index > MTH_MAX_LOCAL) { - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetEntry: LocalVar index %d is invalid (max %d)\n", + DEBUG_PRINTP (ACPI_ERROR, ("Local index %d is invalid (max %d)\n", Index, MTH_MAX_LOCAL)); return_PTR (Node); } @@ -553,12 +542,11 @@ AcpiDsMethodDataGetNte ( break; - case MTH_TYPE_ARG: + case AML_ARG_OP: if (Index > MTH_MAX_ARG) { - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetEntry: Argument index %d is invalid (max %d)\n", + DEBUG_PRINTP (ACPI_ERROR, ("Arg index %d is invalid (max %d)\n", Index, MTH_MAX_ARG)); return_PTR (Node); } @@ -568,9 +556,7 @@ AcpiDsMethodDataGetNte ( default: - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetEntry: Stack type %d is invalid\n", - Type)); + DEBUG_PRINTP (ACPI_ERROR, ("Opcode %d is invalid\n", Opcode)); break; } @@ -583,7 +569,7 @@ AcpiDsMethodDataGetNte ( * * FUNCTION: AcpiDsMethodDataGetValue * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to get * WalkState - Current walk state object * *DestDesc - Ptr to Descriptor into which selected Arg @@ -593,13 +579,13 @@ AcpiDsMethodDataGetNte ( * * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame * at the current top of the method stack. - * Used only in AcpiAmlResolveToValue(). + * Used only in AcpiExResolveToValue(). * ******************************************************************************/ ACPI_STATUS AcpiDsMethodDataGetValue ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **DestDesc) @@ -616,15 +602,14 @@ AcpiDsMethodDataGetValue ( if (!DestDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetValue: NULL object descriptor pointer\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Null object descriptor pointer\n")); return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Get a pointer to the requested method stack entry */ - Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -647,21 +632,19 @@ AcpiDsMethodDataGetValue ( * before it was initialized. Either case is an error. */ - switch (Type) + switch (Opcode) { - case MTH_TYPE_ARG: + case AML_ARG_OP: - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetValue: Uninitialized Arg[%d] at entry %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Uninitialized Arg[%d] at entry %p\n", Index, Entry)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); break; - case MTH_TYPE_LOCAL: + case AML_LOCAL_OP: - DEBUG_PRINT (ACPI_ERROR, - ("DsMethodDataGetValue: Uninitialized Local[%d] at entry %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Uninitialized Local[%d] at entry %p\n", Index, Entry)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); @@ -676,7 +659,7 @@ AcpiDsMethodDataGetValue ( */ *DestDesc = Object; - AcpiCmAddReference (Object); + AcpiUtAddReference (Object); return_ACPI_STATUS (AE_OK); } @@ -686,20 +669,20 @@ AcpiDsMethodDataGetValue ( * * FUNCTION: AcpiDsMethodDataDeleteValue * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to delete * WalkState - Current walk state object * * RETURN: Status * - * DESCRIPTION: Delete the entry at Type:Index on the method stack. Inserts + * 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 AcpiDsMethodDataDeleteValue ( - UINT32 Type, + UINT16 Opcode, UINT32 Index, ACPI_WALK_STATE *WalkState) { @@ -713,7 +696,7 @@ AcpiDsMethodDataDeleteValue ( /* Get a pointer to the requested entry */ - Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -739,7 +722,7 @@ AcpiDsMethodDataDeleteValue ( * Decrement the reference count by one to balance the * increment when the object was stored in the slot. */ - AcpiCmRemoveReference (Object); + AcpiUtRemoveReference (Object); } @@ -749,9 +732,9 @@ AcpiDsMethodDataDeleteValue ( /******************************************************************************* * - * FUNCTION: AcpiDsMethodDataSetValue + * FUNCTION: AcpiDsStoreObjectToLocal * - * PARAMETERS: Type - Either MTH_TYPE_LOCAL or MTH_TYPE_ARG + * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP * Index - Which localVar or argument to set * SrcDesc - Value to be stored * WalkState - Current walk state @@ -765,8 +748,8 @@ AcpiDsMethodDataDeleteValue ( ******************************************************************************/ ACPI_STATUS -AcpiDsMethodDataSetValue ( - UINT32 Type, +AcpiDsStoreObjectToLocal ( + UINT16 Opcode, UINT32 Index, ACPI_OPERAND_OBJECT *SrcDesc, ACPI_WALK_STATE *WalkState) @@ -776,9 +759,8 @@ AcpiDsMethodDataSetValue ( FUNCTION_TRACE ("DsMethodDataSetValue"); - DEBUG_PRINT (TRACE_EXEC, - ("DsMethodDataSetValue: Type=%d Idx=%d Obj=%p\n", - Type, Index, SrcDesc)); + DEBUG_PRINTP (TRACE_EXEC, ("Opcode=%d Idx=%d Obj=%p\n", + Opcode, Index, SrcDesc)); /* Parameter validation */ @@ -791,7 +773,7 @@ AcpiDsMethodDataSetValue ( /* Get a pointer to the requested method stack entry */ - Status = AcpiDsMethodDataGetEntry (Type, Index, WalkState, &Entry); + Status = AcpiDsMethodDataGetEntry (Opcode, Index, WalkState, &Entry); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -799,9 +781,7 @@ AcpiDsMethodDataSetValue ( if (*Entry == SrcDesc) { - DEBUG_PRINT (TRACE_EXEC, - ("DsMethodDataSetValue: Obj=%p already installed!\n", - SrcDesc)); + DEBUG_PRINTP (TRACE_EXEC, ("Obj=%p already installed!\n", SrcDesc)); goto Cleanup; } @@ -832,11 +812,11 @@ AcpiDsMethodDataSetValue ( * Weird, but true. */ - if ((Type == MTH_TYPE_ARG) && + if ((Opcode == AML_ARG_OP) && (VALID_DESCRIPTOR_TYPE (*Entry, ACPI_DESC_TYPE_NAMED))) { - DEBUG_PRINT (TRACE_EXEC, - ("DsMethodDataSetValue: Arg (%p) is an ObjRef(Node), storing in %p\n", + DEBUG_PRINTP (TRACE_EXEC, + ("Arg (%p) is an ObjRef(Node), storing in %p\n", SrcDesc, *Entry)); /* Detach an existing object from the Node */ @@ -853,21 +833,23 @@ AcpiDsMethodDataSetValue ( } +#ifdef ACPI_ENABLE_IMPLICIT_CONVERSION /* * Perform "Implicit conversion" of the new object to the type of the * existing object */ - Status = AcpiAmlConvertToTargetType ((*Entry)->Common.Type, &SrcDesc, WalkState); + Status = AcpiExConvertToTargetType ((*Entry)->Common.Type, &SrcDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; } +#endif /* * Delete the existing object * before storing the new one */ - AcpiDsMethodDataDeleteValue (Type, Index, WalkState); + AcpiDsMethodDataDeleteValue (Opcode, Index, WalkState); } @@ -877,7 +859,7 @@ AcpiDsMethodDataSetValue ( * Install the new object in the stack entry * (increments the object reference count by one) */ - Status = AcpiDsMethodDataSetEntry (Type, Index, SrcDesc, WalkState); + Status = AcpiDsMethodDataSetEntry (Opcode, Index, SrcDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; diff --git a/sys/contrib/dev/acpica/dsobject.c b/sys/contrib/dev/acpica/dsobject.c index 13bf56a..78d3e23 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: 57 $ + * $Revision: 65 $ * *****************************************************************************/ @@ -123,7 +123,7 @@ #include "acinterp.h" #include "acnamesp.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsobject") @@ -154,12 +154,15 @@ AcpiDsInitOneObject ( void *Context, void **ReturnValue) { - OBJECT_TYPE_INTERNAL Type; + ACPI_OBJECT_TYPE8 Type; ACPI_STATUS Status; ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; UINT8 TableRevision; + PROC_NAME ("DsInitOneObject"); + + Info->ObjectCount++; TableRevision = Info->TableDesc->Pointer->Revision; @@ -220,10 +223,9 @@ AcpiDsInitOneObject ( if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("DsInitOneObject: Method %p [%4.4s] parse failed! %s\n", + DEBUG_PRINTP (ACPI_ERROR, ("Method %p [%4.4s] parse failed! %s\n", ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); break; } @@ -271,8 +273,8 @@ AcpiDsInitializeObjects ( FUNCTION_TRACE ("DsInitializeObjects"); - DEBUG_PRINT (TRACE_DISPATCH, - ("DsInitializeObjects: **** Starting initialization of namespace objects ****\n")); + DEBUG_PRINTP (TRACE_DISPATCH, + ("**** Starting initialization of namespace objects ****\n")); DEBUG_PRINT_RAW (ACPI_OK, ("Parsing Methods:")); @@ -284,22 +286,20 @@ AcpiDsInitializeObjects ( /* Walk entire namespace from the supplied root */ - Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, - ACPI_UINT32_MAX, AcpiDsInitOneObject, - &Info, NULL); + Status = AcpiWalkNamespace (ACPI_TYPE_ANY, StartNode, ACPI_UINT32_MAX, + AcpiDsInitOneObject, &Info, NULL); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("DsInitializeObjects: WalkNamespace failed! %x\n", Status)); + DEBUG_PRINTP (ACPI_ERROR, ("WalkNamespace failed! %x\n", Status)); } DEBUG_PRINT_RAW (ACPI_OK, ("\n%d Control Methods found and parsed (%d nodes total)\n", Info.MethodCount, Info.ObjectCount)); - DEBUG_PRINT (TRACE_DISPATCH, - ("DsInitializeObjects: %d Control Methods found\n", Info.MethodCount)); - DEBUG_PRINT (TRACE_DISPATCH, - ("DsInitializeObjects: %d Op Regions found\n", Info.OpRegionCount)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("%d Control Methods found\n", Info.MethodCount)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("%d Op Regions found\n", Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } @@ -335,6 +335,9 @@ AcpiDsInitObjectFromOp ( ACPI_OPCODE_INFO *OpInfo; + PROC_NAME ("DsInitObjectFromOp"); + + OpInfo = AcpiPsGetOpcodeInfo (Opcode); if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) { @@ -358,10 +361,10 @@ AcpiDsInitObjectFromOp ( /* Resolve the object (could be an arg or local) */ - Status = AcpiAmlResolveToValue (&ArgDesc, WalkState); + Status = AcpiExResolveToValue (&ArgDesc, WalkState); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ArgDesc); + AcpiUtRemoveReference (ArgDesc); return (Status); } @@ -369,17 +372,17 @@ AcpiDsInitObjectFromOp ( if (ArgDesc->Common.Type != ACPI_TYPE_INTEGER) { - DEBUG_PRINT (ACPI_ERROR, - ("InitObject: Expecting number, got obj: %p type %X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Expecting number, got obj: %p type %X\n", ArgDesc, ArgDesc->Common.Type)); - AcpiCmRemoveReference (ArgDesc); + AcpiUtRemoveReference (ArgDesc); return (AE_TYPE); } /* Get the value, delete the internal object */ (*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Integer.Value; - AcpiCmRemoveReference (ArgDesc); + AcpiUtRemoveReference (ArgDesc); /* Allocate the buffer */ @@ -393,7 +396,7 @@ AcpiDsInitObjectFromOp ( else { (*ObjDesc)->Buffer.Pointer = - AcpiCmCallocate ((*ObjDesc)->Buffer.Length); + AcpiUtCallocate ((*ObjDesc)->Buffer.Length); if (!(*ObjDesc)->Buffer.Pointer) { @@ -412,10 +415,9 @@ AcpiDsInitObjectFromOp ( ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next; if (ByteList) { - if (ByteList->Opcode != AML_BYTELIST_OP) + if (ByteList->Opcode != AML_INT_BYTELIST_OP) { - DEBUG_PRINT (ACPI_ERROR, - ("InitObject: Expecting bytelist, got: %x\n", + DEBUG_PRINTP (ACPI_ERROR, ("Expecting bytelist, got: %x\n", ByteList)); return (AE_TYPE); } @@ -437,7 +439,7 @@ AcpiDsInitObjectFromOp ( * so that it is deleted. Error checking is done * within the remove reference function. */ - AcpiCmRemoveReference(*ObjDesc); + AcpiUtRemoveReference(*ObjDesc); Status = AcpiDsBuildInternalObject (WalkState, Op, ObjDesc); break; @@ -465,7 +467,7 @@ AcpiDsInitObjectFromOp ( /* Split the opcode into a base opcode + offset */ - (*ObjDesc)->Reference.OpCode = AML_LOCAL_OP; + (*ObjDesc)->Reference.Opcode = AML_LOCAL_OP; (*ObjDesc)->Reference.Offset = Opcode - AML_LOCAL_OP; break; @@ -473,20 +475,20 @@ AcpiDsInitObjectFromOp ( /* Split the opcode into a base opcode + offset */ - (*ObjDesc)->Reference.OpCode = AML_ARG_OP; + (*ObjDesc)->Reference.Opcode = AML_ARG_OP; (*ObjDesc)->Reference.Offset = Opcode - AML_ARG_OP; break; default: /* Constants, Literals, etc.. */ - if (Op->Opcode == AML_NAMEPATH_OP) + if (Op->Opcode == AML_INT_NAMEPATH_OP) { /* Node was saved in Op */ (*ObjDesc)->Reference.Node = Op->Node; } - (*ObjDesc)->Reference.OpCode = Opcode; + (*ObjDesc)->Reference.Opcode = Opcode; break; } @@ -495,8 +497,7 @@ AcpiDsInitObjectFromOp ( default: - DEBUG_PRINT (ACPI_ERROR, - ("InitObject: Unimplemented data type: %x\n", + DEBUG_PRINTP (ACPI_ERROR, ("Unimplemented data type: %x\n", (*ObjDesc)->Common.Type)); break; @@ -527,7 +528,7 @@ AcpiDsBuildInternalSimpleObj ( ACPI_OPERAND_OBJECT **ObjDescPtr) { ACPI_OPERAND_OBJECT *ObjDesc; - OBJECT_TYPE_INTERNAL Type; + ACPI_OBJECT_TYPE8 Type; ACPI_STATUS Status; UINT32 Length; char *Name; @@ -536,7 +537,7 @@ AcpiDsBuildInternalSimpleObj ( FUNCTION_TRACE ("DsBuildInternalSimpleObj"); - if (Op->Opcode == AML_NAMEPATH_OP) + if (Op->Opcode == AML_INT_NAMEPATH_OP) { /* * This is an object reference. If The name was @@ -564,7 +565,7 @@ AcpiDsBuildInternalSimpleObj ( { REPORT_WARNING (("Reference %s at AML %X not found\n", Name, Op->AmlOffset)); - AcpiCmFree (Name); + AcpiUtFree (Name); } else { @@ -597,18 +598,16 @@ AcpiDsBuildInternalSimpleObj ( /* Create and init the internal ACPI object */ - ObjDesc = AcpiCmCreateInternalObject (Type); + ObjDesc = AcpiUtCreateInternalObject (Type); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiDsInitObjectFromOp (WalkState, Op, - Op->Opcode, &ObjDesc); - + Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Opcode, &ObjDesc); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -646,7 +645,7 @@ AcpiDsBuildInternalPackageObj ( FUNCTION_TRACE ("DsBuildInternalPackageObj"); - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -664,16 +663,11 @@ AcpiDsBuildInternalPackageObj ( */ ObjDesc->Package.Elements = - AcpiCmCallocate ((ObjDesc->Package.Count + 1) * - sizeof (void *)); + AcpiUtCallocate ((ObjDesc->Package.Count + 1) * sizeof (void *)); if (!ObjDesc->Package.Elements) { - /* Package vector allocation failure */ - - REPORT_ERROR (("DsBuildInternalPackageObj: Package vector allocation failure\n")); - - AcpiCmDeleteObjectDesc (ObjDesc); + AcpiUtDeleteObjectDesc (ObjDesc); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -732,14 +726,12 @@ AcpiDsBuildInternalObject ( if (Op->Opcode == AML_PACKAGE_OP) { - Status = AcpiDsBuildInternalPackageObj (WalkState, Op, - ObjDescPtr); + Status = AcpiDsBuildInternalPackageObj (WalkState, Op, ObjDescPtr); } else { - Status = AcpiDsBuildInternalSimpleObj (WalkState, Op, - ObjDescPtr); + Status = AcpiDsBuildInternalSimpleObj (WalkState, Op, ObjDescPtr); } return (Status); @@ -782,8 +774,7 @@ AcpiDsCreateNode ( /* Build an internal object for the argument(s) */ - Status = AcpiDsBuildInternalObject (WalkState, - Op->Value.Arg, &ObjDesc); + Status = AcpiDsBuildInternalObject (WalkState, Op->Value.Arg, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -796,8 +787,7 @@ AcpiDsCreateNode ( /* Init obj */ - Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc, - (UINT8) Node->Type); + Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Node->Type); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -808,7 +798,7 @@ AcpiDsCreateNode ( Cleanup: - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/dsopcode.c b/sys/contrib/dev/acpica/dsopcode.c index 5153537..c76a942 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: 32 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -126,25 +126,25 @@ #include "acevents.h" #include "actables.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsopcode") /***************************************************************************** * - * FUNCTION: AcpiDsGetFieldUnitArguments + * FUNCTION: AcpiDsGetBufferFieldArguments * - * PARAMETERS: ObjDesc - A valid FieldUnit object + * PARAMETERS: ObjDesc - A valid BufferField object * * RETURN: Status. * - * DESCRIPTION: Get FieldUnit Buffer and Index. This implements the late + * DESCRIPTION: Get BufferField Buffer and Index. This implements the late * evaluation of these field attributes. * ****************************************************************************/ ACPI_STATUS -AcpiDsGetFieldUnitArguments ( +AcpiDsGetBufferFieldArguments ( ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_OPERAND_OBJECT *ExtraDesc; @@ -155,7 +155,7 @@ AcpiDsGetFieldUnitArguments ( ACPI_TABLE_DESC *TableDesc; - FUNCTION_TRACE_PTR ("DsGetFieldUnitArguments", ObjDesc); + FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc); if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) @@ -164,14 +164,13 @@ AcpiDsGetFieldUnitArguments ( } - /* Get the AML pointer (method object) and FieldUnit node */ + /* Get the AML pointer (method object) and BufferField node */ - ExtraDesc = ObjDesc->FieldUnit.Extra; - Node = ObjDesc->FieldUnit.Node; + ExtraDesc = ObjDesc->BufferField.Extra; + Node = ObjDesc->BufferField.Node; - DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Field]")); - DEBUG_PRINT (TRACE_EXEC, - ("DsGetFieldUnitArguments: [%4.4s] FieldUnit JIT Init\n", + DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Field]")); + DEBUG_PRINTP (TRACE_EXEC, ("[%4.4s] BufferField JIT Init\n", &Node->Name)); @@ -198,7 +197,7 @@ AcpiDsGetFieldUnitArguments ( return_ACPI_STATUS (Status); } - /* Pass1: Parse the entire FieldUnit declaration */ + /* Pass1: Parse the entire BufferField declaration */ Status = AcpiPsParseAml (Op, ExtraDesc->Extra.Pcode, ExtraDesc->Extra.PcodeLength, 0, @@ -244,8 +243,8 @@ AcpiDsGetFieldUnitArguments ( * The pseudo-method object is no longer needed since the region is * now initialized */ - AcpiCmRemoveReference (ObjDesc->FieldUnit.Extra); - ObjDesc->FieldUnit.Extra = NULL; + AcpiUtRemoveReference (ObjDesc->BufferField.Extra); + ObjDesc->BufferField.Extra = NULL; return_ACPI_STATUS (Status); } @@ -290,11 +289,11 @@ AcpiDsGetRegionArguments ( ExtraDesc = ObjDesc->Region.Extra; Node = ObjDesc->Region.Node; - DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, " [Operation Region]")); - - DEBUG_PRINT (TRACE_EXEC, - ("DsGetRegionArguments: [%4.4s] OpRegion Init at AML %p[%x]\n", - &Node->Name, ExtraDesc->Extra.Pcode, *(UINT32*) ExtraDesc->Extra.Pcode)); + DEBUG_EXEC(AcpiUtDisplayInitPathname (Node, " [Operation Region]")); + + DEBUG_PRINTP (TRACE_EXEC, ("[%4.4s] OpRegion Init at AML %p[%x]\n", + &Node->Name, ExtraDesc->Extra.Pcode, + *(UINT32*) ExtraDesc->Extra.Pcode)); /* * Allocate a new parser op to be the root of the parsed @@ -398,29 +397,45 @@ AcpiDsInitializeRegion ( /***************************************************************************** * - * FUNCTION: AcpiDsEvalFieldUnitOperands + * FUNCTION: AcpiDsEvalBufferFieldOperands * - * PARAMETERS: Op - A valid FieldUnit Op object + * PARAMETERS: Op - A valid BufferField Op object * * RETURN: Status * - * DESCRIPTION: Get FieldUnit Buffer and Index - * Called from AcpiDsExecEndOp during FieldUnit parse tree walk + * DESCRIPTION: Get BufferField Buffer and Index + * Called from AcpiDsExecEndOp during BufferField parse tree walk + * + * ACPI SPECIFICATION REFERENCES: + * Each of the Buffer Field opcodes is defined as specified in in-line + * comments below. For each one, use the following definitions. + * + * DefBitField := BitFieldOp SrcBuf BitIdx Destination + * DefByteField := ByteFieldOp SrcBuf ByteIdx Destination + * DefCreateField := CreateFieldOp SrcBuf BitIdx NumBits NameString + * DefDWordField := DWordFieldOp SrcBuf ByteIdx Destination + * DefWordField := WordFieldOp SrcBuf ByteIdx Destination + * BitIndex := TermArg=>Integer + * ByteIndex := TermArg=>Integer + * Destination := NameString + * NumBits := TermArg=>Integer + * SourceBuf := TermArg=>Buffer * ****************************************************************************/ ACPI_STATUS -AcpiDsEvalFieldUnitOperands ( +AcpiDsEvalBufferFieldOperands ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *FieldDesc; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *NextOp; UINT32 Offset; UINT32 BitOffset; - UINT16 BitCount; + UINT32 BitCount; + UINT8 FieldFlags; ACPI_OPERAND_OBJECT *ResDesc = NULL; @@ -430,16 +445,18 @@ AcpiDsEvalFieldUnitOperands ( UINT32 NumOperands = 3; - FUNCTION_TRACE_PTR ("DsEvalFieldUnitOperands", Op); + FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op); /* - * This is where we evaluate the address and length fields of the OpFieldUnit declaration + * 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 */ + NextOp = Op->Value.Arg; /* AcpiEvaluate/create the address and length operands */ @@ -450,8 +467,8 @@ AcpiDsEvalFieldUnitOperands ( return_ACPI_STATUS (Status); } - FieldDesc = AcpiNsGetAttachedObject (Node); - if (!FieldDesc) + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) { return_ACPI_STATUS (AE_NOT_EXIST); } @@ -459,9 +476,9 @@ AcpiDsEvalFieldUnitOperands ( /* Resolve the operands */ - Status = AcpiAmlResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode), - NumOperands, "after AcpiAmlResolveOperands"); + NumOperands, "after AcpiExResolveOperands"); /* Get the operands */ @@ -480,8 +497,7 @@ AcpiDsEvalFieldUnitOperands ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("ExecCreateField/%s: bad operand(s) (%X)\n", + DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) (%X)\n", AcpiPsGetOpcodeName (Op->Opcode), Status)); goto Cleanup; @@ -493,13 +509,12 @@ AcpiDsEvalFieldUnitOperands ( /* * If ResDesc is a Name, it will be a direct name pointer after - * AcpiAmlResolveOperands() + * AcpiExResolveOperands() */ if (!VALID_DESCRIPTOR_TYPE (ResDesc, ACPI_DESC_TYPE_NAMED)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecCreateField (%s): destination must be a Node\n", + DEBUG_PRINTP (ACPI_ERROR, ("(%s) destination must be a Node\n", AcpiPsGetOpcodeName (Op->Opcode))); Status = AE_AML_OPERAND_TYPE; @@ -514,65 +529,82 @@ AcpiDsEvalFieldUnitOperands ( switch (Op->Opcode) { + /* DefCreateField */ + + case AML_CREATE_FIELD_OP: + + /* Offset is in bits, count is in bits */ + + BitOffset = Offset; + BitCount = (UINT32) CntDesc->Integer.Value; + FieldFlags = ACCESS_BYTE_ACC; + break; + + /* DefCreateBitField */ - case AML_BIT_FIELD_OP: + case AML_CREATE_BIT_FIELD_OP: - /* Offset is in bits, Field is a bit */ + /* Offset is in bits, Field is one bit */ - BitOffset = Offset; - BitCount = 1; + BitOffset = Offset; + BitCount = 1; + FieldFlags = ACCESS_BYTE_ACC; break; /* DefCreateByteField */ - case AML_BYTE_FIELD_OP: + case AML_CREATE_BYTE_FIELD_OP: - /* Offset is in bytes, field is a byte */ + /* Offset is in bytes, field is one byte */ - BitOffset = 8 * Offset; - BitCount = 8; + BitOffset = 8 * Offset; + BitCount = 8; + FieldFlags = ACCESS_BYTE_ACC; break; /* DefCreateWordField */ - case AML_WORD_FIELD_OP: + case AML_CREATE_WORD_FIELD_OP: - /* Offset is in bytes, field is a word */ + /* Offset is in bytes, field is one word */ - BitOffset = 8 * Offset; - BitCount = 16; + BitOffset = 8 * Offset; + BitCount = 16; + FieldFlags = ACCESS_WORD_ACC; break; /* DefCreateDWordField */ - case AML_DWORD_FIELD_OP: + case AML_CREATE_DWORD_FIELD_OP: - /* Offset is in bytes, field is a dword */ + /* Offset is in bytes, field is one dword */ - BitOffset = 8 * Offset; - BitCount = 32; + BitOffset = 8 * Offset; + BitCount = 32; + FieldFlags = ACCESS_DWORD_ACC; break; - /* DefCreateField */ + /* DefCreateQWordField */ - case AML_CREATE_FIELD_OP: + case AML_CREATE_QWORD_FIELD_OP: - /* Offset is in bits, count is in bits */ + /* Offset is in bytes, field is one qword */ - BitOffset = Offset; - BitCount = (UINT16) CntDesc->Integer.Value; + BitOffset = 8 * Offset; + BitCount = 64; + FieldFlags = ACCESS_QWORD_ACC; break; default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecCreateField: Internal error - unknown field creation opcode %02x\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Internal error - unknown field creation opcode %02x\n", Op->Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -590,32 +622,34 @@ AcpiDsEvalFieldUnitOperands ( case ACPI_TYPE_BUFFER: - if (BitOffset + (UINT32) BitCount > + if ((BitOffset + BitCount) > (8 * (UINT32) SrcDesc->Buffer.Length)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecCreateField: Field exceeds Buffer %d > %d\n", - BitOffset + (UINT32) BitCount, - 8 * (UINT32) SrcDesc->Buffer.Length)); + DEBUG_PRINTP (ACPI_ERROR, + ("Field size %d exceeds Buffer size %d (bits)\n", + BitOffset + BitCount, 8 * (UINT32) SrcDesc->Buffer.Length)); Status = AE_AML_BUFFER_LIMIT; goto Cleanup; } - /* Construct the remainder of the field object */ + /* + * 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, + BitOffset, BitCount); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - FieldDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC; - FieldDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK; - FieldDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE; - FieldDesc->FieldUnit.Length = BitCount; - FieldDesc->FieldUnit.BitOffset = (UINT8) (BitOffset % 8); - FieldDesc->FieldUnit.Offset = DIV_8 (BitOffset); - FieldDesc->FieldUnit.Container = SrcDesc; + ObjDesc->BufferField.BufferObj = SrcDesc; - /* Reference count for SrcDesc inherits FieldDesc count */ + /* Reference count for SrcDesc inherits ObjDesc count */ SrcDesc->Common.ReferenceCount = (UINT16) (SrcDesc->Common.ReferenceCount + - FieldDesc->Common.ReferenceCount); + ObjDesc->Common.ReferenceCount); break; @@ -624,19 +658,18 @@ AcpiDsEvalFieldUnitOperands ( default: - if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || - !AcpiCmValidObjectType (SrcDesc->Common.Type)) + if ((SrcDesc->Common.Type > (UINT8) INTERNAL_TYPE_REFERENCE) || !AcpiUtValidObjectType (SrcDesc->Common.Type)) /* TBD: This line MUST be a single line until AcpiSrc can handle it (block deletion) */ { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecCreateField: Tried to create field in invalid object type %X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Tried to create field in invalid object type %X\n", SrcDesc->Common.Type)); } else { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecCreateField: Tried to create field in improper object type - %s\n", - AcpiCmGetTypeName (SrcDesc->Common.Type))); + DEBUG_PRINTP (ACPI_ERROR, + ("Tried to create field in improper object type - %s\n", + AcpiUtGetTypeName (SrcDesc->Common.Type))); } Status = AE_AML_OPERAND_TYPE; @@ -648,7 +681,7 @@ AcpiDsEvalFieldUnitOperands ( { /* Delete object descriptor unique to CreateField */ - AcpiCmRemoveReference (CntDesc); + AcpiUtRemoveReference (CntDesc); CntDesc = NULL; } @@ -657,26 +690,26 @@ Cleanup: /* Always delete the operands */ - AcpiCmRemoveReference (OffDesc); - AcpiCmRemoveReference (SrcDesc); + AcpiUtRemoveReference (OffDesc); + AcpiUtRemoveReference (SrcDesc); if (AML_CREATE_FIELD_OP == Op->Opcode) { - AcpiCmRemoveReference (CntDesc); + AcpiUtRemoveReference (CntDesc); } /* On failure, delete the result descriptor */ if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ResDesc); /* Result descriptor */ + AcpiUtRemoveReference (ResDesc); /* Result descriptor */ } else { - /* Now the address and length are valid for this opFieldUnit */ + /* Now the address and length are valid for this BufferField */ - FieldDesc->FieldUnit.Flags |= AOPOBJ_DATA_VALID; + ObjDesc->BufferField.Flags |= AOPOBJ_DATA_VALID; } return_ACPI_STATUS (Status); @@ -733,7 +766,7 @@ AcpiDsEvalRegionOperands ( /* Resolve the length and address operands to numbers */ - Status = AcpiAmlResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Op->Opcode, WALK_OPERANDS, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -741,7 +774,7 @@ AcpiDsEvalRegionOperands ( DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Op->Opcode), - 1, "after AcpiAmlResolveOperands"); + 1, "after AcpiExResolveOperands"); ObjDesc = AcpiNsGetAttachedObject (Node); @@ -757,7 +790,7 @@ AcpiDsEvalRegionOperands ( OperandDesc = WalkState->Operands[WalkState->NumOperands - 1]; ObjDesc->Region.Length = (UINT32) OperandDesc->Integer.Value; - AcpiCmRemoveReference (OperandDesc); + AcpiUtRemoveReference (OperandDesc); /* * Get the address and save it @@ -766,11 +799,10 @@ AcpiDsEvalRegionOperands ( OperandDesc = WalkState->Operands[WalkState->NumOperands - 2]; ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Integer.Value; - AcpiCmRemoveReference (OperandDesc); + AcpiUtRemoveReference (OperandDesc); - DEBUG_PRINT (TRACE_EXEC, - ("DsEvalRegionOperands: RgnObj %p Addr %X Len %X\n", + DEBUG_PRINTP (TRACE_EXEC, ("RgnObj %p Addr %X Len %X\n", ObjDesc, ObjDesc->Region.Address, ObjDesc->Region.Length)); /* Now the address and length are valid for this opregion */ @@ -804,8 +836,10 @@ AcpiDsExecBeginControlOp ( ACPI_GENERIC_STATE *ControlState; - DEBUG_PRINT (TRACE_DISPATCH, - ("BeginControlOp: Op=%p Opcode=%2.2X State=%p\n", Op, + PROC_NAME ("DsExecBeginControlOp"); + + + DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p Opcode=%2.2X State=%p\n", Op, Op->Opcode, WalkState)); switch (Op->Opcode) @@ -819,14 +853,14 @@ AcpiDsExecBeginControlOp ( * to handle nesting. */ - ControlState = AcpiCmCreateControlState (); + ControlState = AcpiUtCreateControlState (); if (!ControlState) { Status = AE_NO_MEMORY; break; } - AcpiCmPushGenericState (&WalkState->ControlState, ControlState); + AcpiUtPushGenericState (&WalkState->ControlState, ControlState); /* * Save a pointer to the predicate for multiple executions @@ -889,31 +923,30 @@ AcpiDsExecEndControlOp ( ACPI_GENERIC_STATE *ControlState; + PROC_NAME ("DsExecEndControlOp"); + + switch (Op->Opcode) { case AML_IF_OP: - DEBUG_PRINT (TRACE_DISPATCH, - ("EndControlOp: [IF_OP] Op=%p\n", Op)); + DEBUG_PRINTP (TRACE_DISPATCH, ("[IF_OP] Op=%p\n", Op)); /* * Save the result of the predicate in case there is an * ELSE to come */ - WalkState->LastPredicate = - (BOOLEAN) WalkState->ControlState->Common.Value; + WalkState->LastPredicate = + (BOOLEAN) WalkState->ControlState->Common.Value; /* * Pop the control state that was created at the start * of the IF and free it */ - ControlState = - AcpiCmPopGenericState (&WalkState->ControlState); - - AcpiCmDeleteGenericState (ControlState); - + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); + AcpiUtDeleteGenericState (ControlState); break; @@ -924,8 +957,7 @@ AcpiDsExecEndControlOp ( case AML_WHILE_OP: - DEBUG_PRINT (TRACE_DISPATCH, - ("EndControlOp: [WHILE_OP] Op=%p\n", Op)); + DEBUG_PRINTP (TRACE_DISPATCH, ("[WHILE_OP] Op=%p\n", Op)); if (WalkState->ControlState->Common.Value) { @@ -934,25 +966,21 @@ AcpiDsExecEndControlOp ( Status = AE_CTRL_PENDING; } - - DEBUG_PRINT (TRACE_DISPATCH, - ("EndControlOp: [WHILE_OP] termination! Op=%p\n", Op)); + DEBUG_PRINTP (TRACE_DISPATCH, ("[WHILE_OP] termination! Op=%p\n", Op)); /* Pop this control state and free it */ - ControlState = - AcpiCmPopGenericState (&WalkState->ControlState); + ControlState = AcpiUtPopGenericState (&WalkState->ControlState); WalkState->AmlLastWhile = ControlState->Control.AmlPredicateStart; - AcpiCmDeleteGenericState (ControlState); - + AcpiUtDeleteGenericState (ControlState); break; case AML_RETURN_OP: - DEBUG_PRINT (TRACE_DISPATCH, - ("EndControlOp: [RETURN_OP] Op=%p Arg=%p\n",Op, Op->Value.Arg)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("[RETURN_OP] Op=%p Arg=%p\n",Op, Op->Value.Arg)); /* @@ -975,8 +1003,7 @@ AcpiDsExecEndControlOp ( * an arg or local), resolve it now because it may * cease to exist at the end of the method. */ - - Status = AcpiAmlResolveToValue (&WalkState->Operands [0], WalkState); + Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); if (ACPI_FAILURE (Status)) { return (Status); @@ -1000,12 +1027,19 @@ AcpiDsExecEndControlOp ( * If value being returned is a Reference (such as * an arg or local), resolve it now because it may * cease to exist at the end of the method. + * + * Allow references created by the Index operator to return unchanged. */ - Status = AcpiAmlResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); - if (ACPI_FAILURE (Status)) + if (VALID_DESCRIPTOR_TYPE (WalkState->Results->Results.ObjDesc [0], ACPI_DESC_TYPE_INTERNAL) && + ((WalkState->Results->Results.ObjDesc [0])->Common.Type == INTERNAL_TYPE_REFERENCE) && + ((WalkState->Results->Results.ObjDesc [0])->Reference.Opcode != AML_INDEX_OP)) { - return (Status); + Status = AcpiExResolveToValue (&WalkState->Results->Results.ObjDesc [0], WalkState); + if (ACPI_FAILURE (Status)) + { + return (Status); + } } WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc [0]; @@ -1017,7 +1051,7 @@ AcpiDsExecEndControlOp ( if (WalkState->NumOperands) { - AcpiCmRemoveReference (WalkState->Operands [0]); + AcpiUtRemoveReference (WalkState->Operands [0]); } WalkState->Operands [0] = NULL; @@ -1026,8 +1060,8 @@ AcpiDsExecEndControlOp ( } - DEBUG_PRINT (TRACE_DISPATCH, - ("EndControlOp: Completed RETURN_OP State=%p, RetVal=%p\n", + DEBUG_PRINTP (TRACE_DISPATCH, + ("Completed RETURN_OP State=%p, RetVal=%p\n", WalkState, WalkState->ReturnDesc)); /* End the control method execution right now */ @@ -1054,8 +1088,8 @@ AcpiDsExecEndControlOp ( case AML_BREAK_OP: - DEBUG_PRINT (ACPI_INFO, - ("EndControlOp: Break to end of current package, Op=%p\n", Op)); + DEBUG_PRINTP (ACPI_INFO, + ("Break to end of current package, Op=%p\n", Op)); /* * As per the ACPI specification: @@ -1075,8 +1109,7 @@ AcpiDsExecEndControlOp ( default: - DEBUG_PRINT (ACPI_ERROR, - ("EndControlOp: Unknown control opcode=%X Op=%p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Unknown control opcode=%X Op=%p\n", Op->Opcode, Op)); Status = AE_AML_BAD_OPCODE; diff --git a/sys/contrib/dev/acpica/dsutils.c b/sys/contrib/dev/acpica/dsutils.c index 9e4d0da..8d89f67 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: 52 $ + * $Revision: 58 $ * ******************************************************************************/ @@ -124,7 +124,7 @@ #include "acnamesp.h" #include "acdebug.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dsutils") @@ -157,7 +157,7 @@ AcpiDsIsResultUsed ( if (!Op) { - DEBUG_PRINT (ACPI_ERROR, ("DsIsResultUsed: Null Op\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Null Op\n")); return_VALUE (TRUE); } @@ -181,10 +181,7 @@ AcpiDsIsResultUsed ( ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); if (ACPI_GET_OP_TYPE (ParentInfo) != ACPI_OP_TYPE_OPCODE) { - DEBUG_PRINT (ACPI_ERROR, - ("DsIsResultUsed: Unknown parent opcode. Op=%X\n", - Op)); - + DEBUG_PRINTP (ACPI_ERROR, ("Unknown parent opcode. Op=%X\n", Op)); return_VALUE (FALSE); } @@ -209,9 +206,8 @@ AcpiDsIsResultUsed ( /* Never delete the return value associated with a return opcode */ - DEBUG_PRINT (TRACE_DISPATCH, - ("DsIsResultUsed: Result used, [RETURN] opcode=%X Op=%X\n", - Op->Opcode, Op)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("Result used, [RETURN] opcode=%X Op=%X\n", Op->Opcode, Op)); return_VALUE (TRUE); break; @@ -226,8 +222,8 @@ AcpiDsIsResultUsed ( if ((WalkState->ControlState->Common.State == CONTROL_PREDICATE_EXECUTING) && (WalkState->ControlState->Control.PredicateOp == Op)) { - DEBUG_PRINT (TRACE_DISPATCH, - ("DsIsResultUsed: Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n", + DEBUG_PRINTP (TRACE_DISPATCH, + ("Result used as a predicate, [IF/WHILE] opcode=%X Op=%X\n", Op->Opcode, Op)); return_VALUE (TRUE); } @@ -245,23 +241,22 @@ AcpiDsIsResultUsed ( * These opcodes allow TermArg(s) as operands and therefore * method calls. The result is used. */ - if ((Op->Parent->Opcode == AML_REGION_OP) || - (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || - (Op->Parent->Opcode == AML_BIT_FIELD_OP) || - (Op->Parent->Opcode == AML_BYTE_FIELD_OP) || - (Op->Parent->Opcode == AML_WORD_FIELD_OP) || - (Op->Parent->Opcode == AML_DWORD_FIELD_OP) || - (Op->Parent->Opcode == AML_QWORD_FIELD_OP)) + if ((Op->Parent->Opcode == AML_REGION_OP) || + (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP)) { - DEBUG_PRINT (TRACE_DISPATCH, - ("DsIsResultUsed: Result used, [Region or CreateField] opcode=%X Op=%X\n", + DEBUG_PRINTP (TRACE_DISPATCH, + ("Result used, [Region or CreateField] opcode=%X Op=%X\n", Op->Opcode, Op)); return_VALUE (TRUE); } - DEBUG_PRINT (TRACE_DISPATCH, - ("DsIsResultUsed: Result not used, Parent opcode=%X Op=%X\n", - Op->Opcode, Op)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("Result not used, Parent opcode=%X Op=%X\n", Op->Opcode, Op)); return_VALUE (FALSE); break; @@ -310,9 +305,7 @@ AcpiDsDeleteResultIfNotUsed ( if (!Op) { - DEBUG_PRINT (ACPI_ERROR, - ("DsDeleteResultIfNotUsed: Null Op=%X\n", - Op)); + DEBUG_PRINTP (ACPI_ERROR, ("Null Op\n")); return_VOID; } @@ -332,7 +325,7 @@ AcpiDsDeleteResultIfNotUsed ( Status = AcpiDsResultPop (&ObjDesc, WalkState); if (ACPI_SUCCESS (Status)) { - AcpiCmRemoveReference (ResultObj); + AcpiUtRemoveReference (ResultObj); } } @@ -365,7 +358,7 @@ AcpiDsCreateOperand ( ACPI_STATUS Status = AE_OK; NATIVE_CHAR *NameString; UINT32 NameLength; - OBJECT_TYPE_INTERNAL DataType; + ACPI_OBJECT_TYPE8 DataType; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_PARSE_OBJECT *ParentOp; UINT16 Opcode; @@ -378,18 +371,15 @@ AcpiDsCreateOperand ( /* A valid name must be looked up in the namespace */ - if ((Arg->Opcode == AML_NAMEPATH_OP) && + if ((Arg->Opcode == AML_INT_NAMEPATH_OP) && (Arg->Value.String)) { - DEBUG_PRINT (TRACE_DISPATCH, - ("DsCreateOperand: Getting a name: Arg=%p\n", Arg)); + DEBUG_PRINTP (TRACE_DISPATCH, ("Getting a name: Arg=%p\n", Arg)); /* Get the entire name string from the AML stream */ - Status = AcpiAmlGetNameString (ACPI_TYPE_ANY, - Arg->Value.Buffer, - &NameString, - &NameLength); + Status = AcpiExGetNameString (ACPI_TYPE_ANY, Arg->Value.Buffer, + &NameString, &NameLength); if (ACPI_FAILURE (Status)) { @@ -410,9 +400,9 @@ AcpiDsCreateOperand ( ParentOp = Arg->Parent; if ((AcpiPsIsNodeOp (ParentOp->Opcode)) && - (ParentOp->Opcode != AML_METHODCALL_OP) && + (ParentOp->Opcode != AML_INT_METHODCALL_OP) && (ParentOp->Opcode != AML_REGION_OP) && - (ParentOp->Opcode != AML_NAMEPATH_OP)) + (ParentOp->Opcode != AML_INT_NAMEPATH_OP)) { /* Enter name into namespace if not found */ @@ -434,7 +424,7 @@ AcpiDsCreateOperand ( /* Free the namestring created above */ - AcpiCmFree (NameString); + AcpiUtFree (NameString); /* * The only case where we pass through (ignore) a NOT_FOUND @@ -487,7 +477,7 @@ AcpiDsCreateOperand ( { /* Check for null name case */ - if (Arg->Opcode == AML_NAMEPATH_OP) + if (Arg->Opcode == AML_INT_NAMEPATH_OP) { /* * If the name is null, this means that this is an @@ -497,8 +487,7 @@ AcpiDsCreateOperand ( */ Opcode = AML_ZERO_OP; /* Has no arguments! */ - DEBUG_PRINT (TRACE_DISPATCH, - ("DsCreateOperand: Null namepath: Arg=%p\n", Arg)); + DEBUG_PRINTP (TRACE_DISPATCH, ("Null namepath: Arg=%p\n", Arg)); /* * TBD: [Investigate] anything else needed for the @@ -522,8 +511,8 @@ AcpiDsCreateOperand ( if (Flags & OP_HAS_RETURN_VALUE) { - DEBUG_PRINT (TRACE_DISPATCH, - ("DsCreateOperand: Argument previously created, already stacked \n")); + DEBUG_PRINTP (TRACE_DISPATCH, + ("Argument previously created, already stacked \n")); DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (WalkState->Operands [WalkState->NumOperands - 1], WalkState)); @@ -531,7 +520,6 @@ AcpiDsCreateOperand ( * Use value that was already previously returned * by the evaluation of this argument */ - Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -539,8 +527,8 @@ AcpiDsCreateOperand ( * Only error is underflow, and this indicates * a missing or null operand! */ - DEBUG_PRINT (ACPI_ERROR, - ("DsCreateOperand: Missing or null operand, %s\n", AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("Missing or null operand, %s\n", + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -550,7 +538,7 @@ AcpiDsCreateOperand ( { /* Create an ACPI_INTERNAL_OBJECT for the argument */ - ObjDesc = AcpiCmCreateInternalObject (DataType); + ObjDesc = AcpiUtCreateInternalObject (DataType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -562,7 +550,7 @@ AcpiDsCreateOperand ( Opcode, &ObjDesc); if (ACPI_FAILURE (Status)) { - AcpiCmDeleteObjectDesc (ObjDesc); + AcpiUtDeleteObjectDesc (ObjDesc); return_ACPI_STATUS (Status); } } @@ -619,8 +607,7 @@ AcpiDsCreateOperands ( goto Cleanup; } - DEBUG_PRINT (TRACE_DISPATCH, - ("DsCreateOperands: Arg #%d (%p) done, Arg1=%p\n", + DEBUG_PRINTP (TRACE_DISPATCH, ("Arg #%d (%p) done, Arg1=%p\n", ArgCount, Arg, FirstArg)); /* Move on to next argument, if any */ @@ -641,9 +628,8 @@ Cleanup: AcpiDsObjStackPopAndDelete (ArgCount, WalkState); - DEBUG_PRINT (ACPI_ERROR, - ("DsCreateOperands: Error while creating Arg %d - %s\n", - (ArgCount + 1), AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("While creating Arg %d - %s\n", + (ArgCount + 1), AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -680,12 +666,12 @@ AcpiDsResolveOperands ( /* * TBD: [Investigate] Note from previous parser: - * RefOf problem with AcpiAmlResolveToValue() conversion. + * RefOf problem with AcpiExResolveToValue() conversion. */ for (i = 0; i < WalkState->NumOperands; i++) { - Status = AcpiAmlResolveToValue (&WalkState->Operands[i], WalkState); + Status = AcpiExResolveToValue (&WalkState->Operands[i], WalkState); if (ACPI_FAILURE (Status)) { break; @@ -711,25 +697,25 @@ AcpiDsResolveOperands ( * ******************************************************************************/ -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDsMapOpcodeToDataType ( UINT16 Opcode, UINT32 *OutFlags) { - OBJECT_TYPE_INTERNAL DataType = INTERNAL_TYPE_INVALID; + ACPI_OBJECT_TYPE8 DataType = INTERNAL_TYPE_INVALID; ACPI_OPCODE_INFO *OpInfo; UINT32 Flags = 0; + PROC_NAME ("DsMapOpcodeToDataType"); + + OpInfo = AcpiPsGetOpcodeInfo (Opcode); if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) { /* Unknown opcode */ - DEBUG_PRINT (ACPI_ERROR, - ("MapOpcode: Unknown AML opcode: %x\n", - Opcode)); - + DEBUG_PRINTP (ACPI_ERROR, ("Unknown AML opcode: %x\n", Opcode)); return (DataType); } @@ -753,14 +739,13 @@ AcpiDsMapOpcodeToDataType ( DataType = ACPI_TYPE_STRING; break; - case AML_NAMEPATH_OP: + case AML_INT_NAMEPATH_OP: DataType = INTERNAL_TYPE_REFERENCE; break; default: - DEBUG_PRINT (ACPI_ERROR, - ("MapOpcode: Unknown (type LITERAL) AML opcode: %x\n", - Opcode)); + DEBUG_PRINTP (ACPI_ERROR, + ("Unknown (type LITERAL) AML opcode: %x\n", Opcode)); break; } break; @@ -781,9 +766,8 @@ AcpiDsMapOpcodeToDataType ( break; default: - DEBUG_PRINT (ACPI_ERROR, - ("MapOpcode: Unknown (type DATA_TERM) AML opcode: %x\n", - Opcode)); + DEBUG_PRINTP (ACPI_ERROR, + ("Unknown (type DATA_TERM) AML opcode: %x\n", Opcode)); break; } break; @@ -833,9 +817,8 @@ AcpiDsMapOpcodeToDataType ( default: - DEBUG_PRINT (ACPI_ERROR, - ("MapOpcode: Unimplemented data type opcode: %x\n", - Opcode)); + DEBUG_PRINTP (ACPI_ERROR, + ("Unimplemented data type opcode: %x\n", Opcode)); break; } @@ -863,11 +846,11 @@ AcpiDsMapOpcodeToDataType ( * ******************************************************************************/ -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiDsMapNamedOpcodeToDataType ( UINT16 Opcode) { - OBJECT_TYPE_INTERNAL DataType; + ACPI_OBJECT_TYPE8 DataType; /* Decode Opcode */ @@ -898,8 +881,8 @@ AcpiDsMapNamedOpcodeToDataType ( DataType = ACPI_TYPE_PROCESSOR; break; - case AML_DEF_FIELD_OP: /* DefFieldOp */ - DataType = INTERNAL_TYPE_DEF_FIELD_DEFN; + case AML_FIELD_OP: /* FieldOp */ + DataType = INTERNAL_TYPE_FIELD_DEFN; break; case AML_INDEX_FIELD_OP: /* IndexFieldOp */ @@ -910,12 +893,12 @@ AcpiDsMapNamedOpcodeToDataType ( DataType = INTERNAL_TYPE_BANK_FIELD_DEFN; break; - case AML_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */ + case AML_INT_NAMEDFIELD_OP: /* NO CASE IN ORIGINAL */ DataType = ACPI_TYPE_ANY; break; case AML_NAME_OP: /* NameOp - special code in original */ - case AML_NAMEPATH_OP: + case AML_INT_NAMEPATH_OP: DataType = ACPI_TYPE_ANY; break; diff --git a/sys/contrib/dev/acpica/dswexec.c b/sys/contrib/dev/acpica/dswexec.c index d3c04a6..dfbe2e4 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: 55 $ + * $Revision: 61 $ * *****************************************************************************/ @@ -126,7 +126,7 @@ #include "acdebug.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dswexec") @@ -162,9 +162,9 @@ AcpiDsGetPredicateValue ( Status = AcpiDsResultPop (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("DsGetPredicateValue: Could not get result from predicate evaluation, %s\n", - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, + ("Could not get result from predicate evaluation, %s\n", + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -178,7 +178,7 @@ AcpiDsGetPredicateValue ( return_ACPI_STATUS (Status); } - Status = AcpiAmlResolveToValue (&WalkState->Operands [0], WalkState); + Status = AcpiExResolveToValue (&WalkState->Operands [0], WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -189,8 +189,7 @@ AcpiDsGetPredicateValue ( if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecEndOp: No predicate ObjDesc=%X State=%X\n", + DEBUG_PRINTP (ACPI_ERROR, ("No predicate ObjDesc=%X State=%X\n", ObjDesc, WalkState)); return_ACPI_STATUS (AE_AML_NO_OPERAND); @@ -204,8 +203,8 @@ AcpiDsGetPredicateValue ( if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecEndOp: Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Bad predicate (not a number) ObjDesc=%X State=%X Type=%X\n", ObjDesc, WalkState, ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; @@ -215,7 +214,7 @@ AcpiDsGetPredicateValue ( /* Truncate the predicate to 32-bits if necessary */ - AcpiAmlTruncateFor32bitTable (ObjDesc, WalkState); + AcpiExTruncateFor32bitTable (ObjDesc, WalkState); /* * Save the result of the predicate evaluation on @@ -241,8 +240,7 @@ AcpiDsGetPredicateValue ( Cleanup: - DEBUG_PRINT (TRACE_EXEC, - ("ExecEndOp: Completed a predicate eval=%X Op=%X\n", + DEBUG_PRINTP (TRACE_EXEC, ("Completed a predicate eval=%X Op=%X\n", WalkState->ControlState->Common.Value, Op)); /* Break to debugger to display result */ @@ -254,7 +252,7 @@ Cleanup: * we don't need it anymore) */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); WalkState->ControlState->Common.State = CONTROL_NORMAL; @@ -323,7 +321,7 @@ AcpiDsExecBeginOp ( (WalkState->ControlState->Common.State == CONTROL_CONDITIONAL_EXECUTING)) { - DEBUG_PRINT (TRACE_EXEC, ("BeginOp: Exec predicate Op=%X State=%X\n", + DEBUG_PRINTP (TRACE_EXEC, ("Exec predicate Op=%X State=%X\n", Op, WalkState)); WalkState->ControlState->Common.State = CONTROL_PREDICATE_EXECUTING; @@ -338,7 +336,7 @@ AcpiDsExecBeginOp ( /* We want to send namepaths to the load code */ - if (Op->Opcode == AML_NAMEPATH_OP) + if (Op->Opcode == AML_INT_NAMEPATH_OP) { OpInfo->Flags = OPTYPE_NAMED_OBJECT; } @@ -442,11 +440,9 @@ AcpiDsExecEndOp ( UINT16 Opcode; UINT8 Optype; ACPI_PARSE_OBJECT *NextOp; - ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *FirstArg; ACPI_OPERAND_OBJECT *ResultObj = NULL; ACPI_OPCODE_INFO *OpInfo; - UINT32 OperandIndex; FUNCTION_TRACE_PTR ("DsExecEndOp", Op); @@ -458,9 +454,7 @@ AcpiDsExecEndOp ( OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) { - DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Unknown opcode. Op=%X\n", - Op)); - + DEBUG_PRINTP (ACPI_ERROR, ("Unknown opcode %X\n", Op->Opcode)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } @@ -487,15 +481,13 @@ AcpiDsExecEndOp ( { case OPTYPE_UNDEFINED: - DEBUG_PRINT (ACPI_ERROR, ("ExecEndOp: Undefined opcode type Op=%X\n", - Op)); + DEBUG_PRINTP (ACPI_ERROR, ("Undefined opcode type Op=%X\n", Op)); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); break; case OPTYPE_BOGUS: - DEBUG_PRINT (TRACE_DISPATCH, - ("ExecEndOp: Internal opcode=%X type Op=%X\n", + DEBUG_PRINTP (TRACE_DISPATCH, ("Internal opcode=%X type Op=%X\n", Opcode, Op)); break; @@ -530,9 +522,6 @@ AcpiDsExecEndOp ( goto Cleanup; } - OperandIndex = WalkState->NumOperands - 1; - - /* Done with this result state (Now that operand stack is built) */ Status = AcpiDsResultStackPop (WalkState); @@ -547,7 +536,7 @@ AcpiDsExecEndOp ( /* 1 Operand, 0 ExternalResult, 0 InternalResult */ - Status = AcpiAmlExecMonadic1 (Opcode, WalkState); + Status = AcpiExMonadic1 (Opcode, WalkState); break; @@ -555,7 +544,7 @@ AcpiDsExecEndOp ( /* 1 Operand, 0 ExternalResult, 1 InternalResult */ - Status = AcpiAmlExecMonadic2 (Opcode, WalkState, &ResultObj); + Status = AcpiExMonadic2 (Opcode, WalkState, &ResultObj); break; @@ -563,7 +552,7 @@ AcpiDsExecEndOp ( /* 1 Operand, 1 ExternalResult, 1 InternalResult */ - Status = AcpiAmlExecMonadic2R (Opcode, WalkState, &ResultObj); + Status = AcpiExMonadic2R (Opcode, WalkState, &ResultObj); break; @@ -571,7 +560,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 0 ExternalResult, 0 InternalResult */ - Status = AcpiAmlExecDyadic1 (Opcode, WalkState); + Status = AcpiExDyadic1 (Opcode, WalkState); break; @@ -579,7 +568,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiAmlExecDyadic2 (Opcode, WalkState, &ResultObj); + Status = AcpiExDyadic2 (Opcode, WalkState, &ResultObj); break; @@ -587,7 +576,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 1 or 2 ExternalResults, 1 InternalResult */ - Status = AcpiAmlExecDyadic2R (Opcode, WalkState, &ResultObj); + Status = AcpiExDyadic2R (Opcode, WalkState, &ResultObj); break; @@ -595,7 +584,7 @@ AcpiDsExecEndOp ( /* 2 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiAmlExecDyadic2S (Opcode, WalkState, &ResultObj); + Status = AcpiExDyadic2S (Opcode, WalkState, &ResultObj); break; @@ -603,7 +592,7 @@ AcpiDsExecEndOp ( /* 3 Operands, 1 ExternalResult, 1 InternalResult */ - Status = AcpiAmlExecIndex (WalkState, &ResultObj); + Status = AcpiExIndex (WalkState, &ResultObj); break; @@ -611,7 +600,7 @@ AcpiDsExecEndOp ( /* 6 Operands, 0 ExternalResult, 1 InternalResult */ - Status = AcpiAmlExecMatch (WalkState, &ResultObj); + Status = AcpiExMatch (WalkState, &ResultObj); break; @@ -619,7 +608,7 @@ AcpiDsExecEndOp ( /* 1 or 2 operands, 0 Internal Result */ - Status = AcpiAmlExecReconfiguration (Opcode, WalkState); + Status = AcpiExReconfiguration (Opcode, WalkState); break; @@ -627,7 +616,7 @@ AcpiDsExecEndOp ( /* 3 Operands, 0 ExternalResult, 0 InternalResult */ - Status = AcpiAmlExecFatal (WalkState); + Status = AcpiExFatal (WalkState); break; } @@ -656,8 +645,7 @@ AcpiDsExecEndOp ( case OPTYPE_METHOD_CALL: - DEBUG_PRINT (TRACE_DISPATCH, - ("ExecEndOp: Method invocation, Op=%X\n", Op)); + DEBUG_PRINTP (TRACE_DISPATCH, ("Method invocation, Op=%X\n", Op)); /* * (AML_METHODCALL) Op->Value->Arg->Node contains @@ -666,7 +654,6 @@ AcpiDsExecEndOp ( /* NextOp points to the op that holds the method name */ NextOp = FirstArg; - Node = NextOp->Node; /* NextOp points to first argument op */ @@ -710,9 +697,8 @@ AcpiDsExecEndOp ( case OPTYPE_CREATE_FIELD: - DEBUG_PRINT (TRACE_EXEC, - ("ExecEndOp: Executing CreateField Buffer/Index Op=%X\n", - Op)); + DEBUG_PRINTP (TRACE_EXEC, + ("Executing CreateField Buffer/Index Op=%X\n", Op)); Status = AcpiDsLoad2EndOp (WalkState, Op); if (ACPI_FAILURE (Status)) @@ -720,7 +706,7 @@ AcpiDsExecEndOp ( break; } - Status = AcpiDsEvalFieldUnitOperands (WalkState, Op); + Status = AcpiDsEvalBufferFieldOperands (WalkState, Op); break; @@ -736,9 +722,8 @@ AcpiDsExecEndOp ( { case AML_REGION_OP: - DEBUG_PRINT (TRACE_EXEC, - ("ExecEndOp: Executing OpRegion Address/Length Op=%X\n", - Op)); + DEBUG_PRINTP (TRACE_EXEC, + ("Executing OpRegion Address/Length Op=%X\n", Op)); Status = AcpiDsEvalRegionOperands (WalkState, Op); if (ACPI_FAILURE (Status)) @@ -772,8 +757,8 @@ AcpiDsExecEndOp ( default: - DEBUG_PRINT (ACPI_ERROR, - ("ExecEndOp: Unimplemented opcode, type=%X Opcode=%X Op=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Unimplemented opcode, type=%X Opcode=%X Op=%X\n", Optype, Op->Opcode, Op)); Status = AE_NOT_IMPLEMENTED; @@ -785,7 +770,7 @@ AcpiDsExecEndOp ( * ACPI 2.0 support for 64-bit integers: * Truncate numeric result value if we are executing from a 32-bit ACPI table */ - AcpiAmlTruncateFor32bitTable (ResultObj, WalkState); + AcpiExTruncateFor32bitTable (ResultObj, WalkState); /* * 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 47d57a2..e098485 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: 26 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -125,11 +125,11 @@ #include "acevents.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dswload") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDsLoad1BeginOp * @@ -141,7 +141,7 @@ * * DESCRIPTION: Descending callback used during the loading of ACPI tables. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiDsLoad1BeginOp ( @@ -152,12 +152,12 @@ AcpiDsLoad1BeginOp ( { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - OBJECT_TYPE_INTERNAL DataType; + ACPI_OBJECT_TYPE8 DataType; NATIVE_CHAR *Path; - DEBUG_PRINT (TRACE_DISPATCH, - ("Load1BeginOp: Op=%p State=%p\n", Op, WalkState)); + PROC_NAME ("DsLoad1BeginOp"); + DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState)); /* We are only interested in opcodes that have an associated name */ @@ -184,14 +184,14 @@ AcpiDsLoad1BeginOp ( DataType = AcpiDsMapNamedOpcodeToDataType (Opcode); - DEBUG_PRINT (TRACE_DISPATCH, - ("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); if (Opcode == AML_SCOPE_OP) { - DEBUG_PRINT (TRACE_DISPATCH, - ("Load1BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); } /* @@ -199,9 +199,8 @@ AcpiDsLoad1BeginOp ( * as we go downward in the parse tree. Any necessary subobjects that involve * arguments to the opcode must be created as we go back up the parse tree later. */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, - DataType, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH, WalkState, &(Node)); + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, DataType, + IMODE_LOAD_PASS1, NS_NO_UPSEARCH, WalkState, &(Node)); if (ACPI_FAILURE (Status)) { @@ -238,7 +237,7 @@ AcpiDsLoad1BeginOp ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDsLoad1EndOp * @@ -251,18 +250,18 @@ AcpiDsLoad1BeginOp ( * DESCRIPTION: Ascending callback used during the loading of the namespace, * both control methods and everything else. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) { - OBJECT_TYPE_INTERNAL DataType; + ACPI_OBJECT_TYPE8 DataType; - DEBUG_PRINT (TRACE_DISPATCH, - ("Load1EndOp: Op=%p State=%p\n", Op, WalkState)); + PROC_NAME ("DsLoad1EndOp"); + DEBUG_PRINT (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState)); /* We are only interested in opcodes that have an associated name */ @@ -294,10 +293,9 @@ AcpiDsLoad1EndOp ( if (AcpiNsOpensScope (DataType)) { + DEBUG_PRINTP (TRACE_DISPATCH, ("(%s): Popping scope for Op %p\n", + AcpiUtGetTypeName (DataType), Op)); - DEBUG_PRINT (TRACE_DISPATCH, - ("Load1EndOp/%s: Popping scope for Op %p\n", - AcpiCmGetTypeName (DataType), Op)); AcpiDsScopeStackPop (WalkState); } @@ -306,7 +304,7 @@ AcpiDsLoad1EndOp ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDsLoad2BeginOp * @@ -318,7 +316,7 @@ AcpiDsLoad1EndOp ( * * DESCRIPTION: Descending callback used during the loading of ACPI tables. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiDsLoad2BeginOp ( @@ -329,19 +327,19 @@ AcpiDsLoad2BeginOp ( { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - OBJECT_TYPE_INTERNAL DataType; + ACPI_OBJECT_TYPE8 DataType; NATIVE_CHAR *BufferPtr; void *Original = NULL; - DEBUG_PRINT (TRACE_DISPATCH, - ("Load2BeginOp: Op=%p State=%p\n", Op, WalkState)); + PROC_NAME ("DsLoad2BeginOp"); + DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState)); /* We only care about Namespace opcodes here */ if (!AcpiPsIsNamespaceOp (Opcode) && - Opcode != AML_NAMEPATH_OP) + Opcode != AML_INT_NAMEPATH_OP) { return (AE_OK); } @@ -359,7 +357,7 @@ AcpiDsLoad2BeginOp ( /* * Get the name we are going to enter or lookup in the namespace */ - if (Opcode == AML_NAMEPATH_OP) + if (Opcode == AML_INT_NAMEPATH_OP) { /* For Namepath op, get the path string */ @@ -390,11 +388,11 @@ AcpiDsLoad2BeginOp ( DataType = AcpiDsMapNamedOpcodeToDataType (Opcode); - DEBUG_PRINT (TRACE_DISPATCH, - ("Load2BeginOp: State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("State=%p Op=%p Type=%x\n", WalkState, Op, DataType)); - if (Opcode == AML_DEF_FIELD_OP || + if (Opcode == AML_FIELD_OP || Opcode == AML_BANK_FIELD_OP || Opcode == AML_INDEX_FIELD_OP) { @@ -402,7 +400,7 @@ AcpiDsLoad2BeginOp ( Status = AE_OK; } - else if (Opcode == AML_NAMEPATH_OP) + else if (Opcode == AML_INT_NAMEPATH_OP) { /* * The NamePath is an object reference to an existing object. Don't enter the @@ -440,10 +438,8 @@ AcpiDsLoad2BeginOp ( * as we go downward in the parse tree. Any necessary subobjects that involve * arguments to the opcode must be created as we go back up the parse tree later. */ - Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, - DataType, IMODE_EXECUTE, - NS_NO_UPSEARCH, WalkState, - &(Node)); + Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, DataType, + IMODE_EXECUTE, NS_NO_UPSEARCH, WalkState, &(Node)); } if (ACPI_SUCCESS (Status)) @@ -473,23 +469,21 @@ AcpiDsLoad2BeginOp ( if (Original) { - DEBUG_PRINT (ACPI_INFO, - ("Lookup: old %p new %p\n", Original, Node)); + DEBUG_PRINTP (ACPI_INFO, ("old %p new %p\n", Original, Node)); if (Original != Node) { - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("Lookup match error: old %p new %p\n", Original, Node)); } } } - return (Status); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDsLoad2EndOp * @@ -502,7 +496,7 @@ AcpiDsLoad2BeginOp ( * DESCRIPTION: Ascending callback used during the loading of the namespace, * both control methods and everything else. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiDsLoad2EndOp ( @@ -510,13 +504,14 @@ AcpiDsLoad2EndOp ( ACPI_PARSE_OBJECT *Op) { ACPI_STATUS Status = AE_OK; - OBJECT_TYPE_INTERNAL DataType; + ACPI_OBJECT_TYPE8 DataType; ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *Arg; ACPI_NAMESPACE_NODE *NewNode; - DEBUG_PRINT (TRACE_DISPATCH, ("Load2EndOp: Op=%p State=%p\n", Op, WalkState)); + PROC_NAME ("DsLoad2EndOp"); + DEBUG_PRINTP (TRACE_DISPATCH, ("Op=%p State=%p\n", Op, WalkState)); if (!AcpiPsIsNamespaceObjectOp (Op->Opcode)) { @@ -525,14 +520,13 @@ AcpiDsLoad2EndOp ( if (Op->Opcode == AML_SCOPE_OP) { - DEBUG_PRINT (TRACE_DISPATCH, - ("Load2EndOp: ending scope Op=%p State=%p\n", Op, WalkState)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("Ending scope Op=%p State=%p\n", Op, WalkState)); if (((ACPI_PARSE2_OBJECT *)Op)->Name == -1) { - DEBUG_PRINT (ACPI_ERROR, - ("Load2EndOp: Un-named scope! Op=%p State=%p\n", Op, - WalkState)); + DEBUG_PRINTP (ACPI_ERROR, ("Unnamed scope! Op=%p State=%p\n", + Op, WalkState)); return (AE_OK); } } @@ -559,9 +553,8 @@ AcpiDsLoad2EndOp ( if (AcpiNsOpensScope (DataType)) { - DEBUG_PRINT (TRACE_DISPATCH, - ("AmlEndNamespaceScope/%s: Popping scope for Op %p\n", - AcpiCmGetTypeName (DataType), Op)); + DEBUG_PRINTP (TRACE_DISPATCH, ("(%s) Popping scope for Op %p\n", + AcpiUtGetTypeName (DataType), Op)); AcpiDsScopeStackPop (WalkState); } @@ -589,6 +582,7 @@ AcpiDsLoad2EndOp ( * AML_CREATEBYTEFIELD * AML_CREATEWORDFIELD * AML_CREATEDWORDFIELD + * AML_CREATEQWORDFIELD * AML_METHODCALL */ @@ -601,18 +595,19 @@ AcpiDsLoad2EndOp ( { case AML_CREATE_FIELD_OP: - case AML_BIT_FIELD_OP: - case AML_BYTE_FIELD_OP: - case AML_WORD_FIELD_OP: - case AML_DWORD_FIELD_OP: + case AML_CREATE_BIT_FIELD_OP: + case AML_CREATE_BYTE_FIELD_OP: + case AML_CREATE_WORD_FIELD_OP: + case AML_CREATE_DWORD_FIELD_OP: + case AML_CREATE_QWORD_FIELD_OP: /* * Create the field object, but the field buffer and index must * be evaluated later during the execution phase */ - DEBUG_PRINT (TRACE_DISPATCH, - ("LOADING-CreateXxxField: State=%p Op=%p NamedObj=%p\n", + DEBUG_PRINTP (TRACE_DISPATCH, + ("CreateXxxField: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); /* Get the NameString argument */ @@ -628,49 +623,51 @@ AcpiDsLoad2EndOp ( Arg = AcpiPsGetArg (Op, 2); } + if (!Arg) + { + Status = AE_AML_NO_OPERAND; + goto Cleanup; + } + /* * Enter the NameString into the namespace */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, - Arg->Value.String, - INTERNAL_TYPE_DEF_ANY, - IMODE_LOAD_PASS1, + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, WalkState, &(NewNode)); - - if (ACPI_SUCCESS (Status)) + if (ACPI_FAILURE (Status)) { - /* We could put the returned object (Node) on the object stack for later, but - * 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; + goto Cleanup; + } + /* We could put the returned object (Node) on the object stack for later, but + * 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; + + /* + * If there is no object attached to the node, this node was just created and + * we need to create the field object. Otherwise, this was a lookup of an + * existing node and we don't want to create the field object again. + */ + if (!NewNode->Object) + { /* - * If there is no object attached to the node, this node was just created and - * we need to create the field object. Otherwise, this was a lookup of an - * existing node and we don't want to create the field object again. + * The Field definition is not fully parsed at this time. + * (We must save the address of the AML for the buffer and index operands) */ - if (!NewNode->Object) - { - /* - * The Field definition is not fully parsed at this time. - * (We must save the address of the AML for the buffer and index operands) - */ - Status = AcpiAmlExecCreateField (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - NewNode, WalkState); - } + Status = AcpiExCreateBufferField (((ACPI_PARSE2_OBJECT *) Op)->Data, + ((ACPI_PARSE2_OBJECT *) Op)->Length, + NewNode, WalkState); } - - break; - case AML_METHODCALL_OP: + case AML_INT_METHODCALL_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); @@ -679,14 +676,14 @@ AcpiDsLoad2EndOp ( */ Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, - ACPI_TYPE_ANY, IMODE_LOAD_PASS2, - NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); + ACPI_TYPE_ANY, IMODE_LOAD_PASS2, + NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, + WalkState, &(NewNode)); if (ACPI_SUCCESS (Status)) { -/* has name already been resolved by here ??*/ + /* TBD: has name already been resolved by here ??*/ /* TBD: [Restructure] Make sure that what we found is indeed a method! */ /* We didn't search for a method on purpose, to see if the name would resolve! */ @@ -706,11 +703,11 @@ AcpiDsLoad2EndOp ( /* Nothing to do other than enter object into namespace */ - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Processor: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); - Status = AcpiAmlExecCreateProcessor (Op, (ACPI_HANDLE) Node); + Status = AcpiExCreateProcessor (Op, Node); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -726,11 +723,11 @@ AcpiDsLoad2EndOp ( /* Nothing to do other than enter object into namespace */ - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); - Status = AcpiAmlExecCreatePowerResource (Op, (ACPI_HANDLE) Node); + Status = AcpiExCreatePowerResource (Op, Node); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -746,50 +743,45 @@ AcpiDsLoad2EndOp ( /* Nothing to do other than enter object into namespace */ - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); break; - case AML_DEF_FIELD_OP: + case AML_FIELD_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Field: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); Arg = Op->Value.Arg; - Status = AcpiDsCreateField (Op, - Arg->Node, - WalkState); + Status = AcpiDsCreateField (Op, Arg->Node, WalkState); break; case AML_INDEX_FIELD_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-IndexField: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); Arg = Op->Value.Arg; - Status = AcpiDsCreateIndexField (Op, - (ACPI_HANDLE) Arg->Node, + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node, WalkState); break; case AML_BANK_FIELD_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-BankField: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); Arg = Op->Value.Arg; - Status = AcpiDsCreateBankField (Op, - Arg->Node, - WalkState); + Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); break; @@ -798,23 +790,22 @@ AcpiDsLoad2EndOp ( */ case AML_METHOD_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Method: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); if (!Node->Object) { - Status = AcpiAmlExecCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data, + Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data, ((ACPI_PARSE2_OBJECT *) Op)->Length, - Arg->Value.Integer, (ACPI_HANDLE) Node); + Arg->Value.Integer, Node); } - break; case AML_MUTEX_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Mutex: Op=%p State=%p\n", Op, WalkState)); Status = AcpiDsCreateOperands (WalkState, Arg); @@ -823,13 +814,13 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - Status = AcpiAmlExecCreateMutex (WalkState); + Status = AcpiExCreateMutex (WalkState); break; case AML_EVENT_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Event: Op=%p State=%p\n", Op, WalkState)); Status = AcpiDsCreateOperands (WalkState, Arg); @@ -838,7 +829,7 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - Status = AcpiAmlExecCreateEvent (WalkState); + Status = AcpiExCreateEvent (WalkState); break; @@ -849,19 +840,17 @@ AcpiDsLoad2EndOp ( break; } - DEBUG_PRINT (TRACE_DISPATCH, - ("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", Op, WalkState, Node)); - + DEBUG_PRINTP (TRACE_DISPATCH, + ("LOADING-Opregion: Op=%p State=%p NamedObj=%p\n", + Op, WalkState, Node)); /* * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. * (We must save the address of the AML of the address and length operands) */ - - Status = AcpiAmlExecCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - (ACPI_ADDRESS_SPACE_TYPE) Arg->Value.Integer, - WalkState); + Status = AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, + ((ACPI_PARSE2_OBJECT *) Op)->Length, + (ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState); DEBUG_PRINT (TRACE_DISPATCH, ("Completed OpRegion Init, Op=%p State=%p entry=%p\n", @@ -873,7 +862,7 @@ AcpiDsLoad2EndOp ( case AML_ALIAS_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Alias: Op=%p State=%p\n", Op, WalkState)); Status = AcpiDsCreateOperands (WalkState, Arg); @@ -882,13 +871,13 @@ AcpiDsLoad2EndOp ( goto Cleanup; } - Status = AcpiAmlExecCreateAlias (WalkState); + Status = AcpiExCreateAlias (WalkState); break; case AML_NAME_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-Name: Op=%p State=%p\n", Op, WalkState)); /* @@ -905,9 +894,9 @@ AcpiDsLoad2EndOp ( break; - case AML_NAMEPATH_OP: + case AML_INT_NAMEPATH_OP: - DEBUG_PRINT (TRACE_DISPATCH, + DEBUG_PRINTP (TRACE_DISPATCH, ("LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n", WalkState, Op, Node)); break; diff --git a/sys/contrib/dev/acpica/dswscope.c b/sys/contrib/dev/acpica/dswscope.c index 6e7d7ff..8e28cb3 100644 --- a/sys/contrib/dev/acpica/dswscope.c +++ b/sys/contrib/dev/acpica/dswscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswscope - Scope stack manipulation - * $Revision: 42 $ + * $Revision: 45 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "acdispat.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dswscope") @@ -155,7 +155,7 @@ AcpiDsScopeStackClear ( DEBUG_PRINT (TRACE_EXEC, ("Popped object type %X\n", ScopeInfo->Common.Value)); - AcpiCmDeleteGenericState (ScopeInfo); + AcpiUtDeleteGenericState (ScopeInfo); } } @@ -175,7 +175,7 @@ AcpiDsScopeStackClear ( ACPI_STATUS AcpiDsScopeStackPush ( ACPI_NAMESPACE_NODE *Node, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_WALK_STATE *WalkState) { ACPI_GENERIC_STATE *ScopeInfo; @@ -194,7 +194,7 @@ AcpiDsScopeStackPush ( /* Make sure object type is valid */ - if (!AcpiAmlValidateObjectType (Type)) + if (!AcpiExValidateObjectType (Type)) { REPORT_WARNING (("DsScopeStackPush: type code out of range\n")); } @@ -202,7 +202,7 @@ AcpiDsScopeStackPush ( /* Allocate a new scope object */ - ScopeInfo = AcpiCmCreateGenericState (); + ScopeInfo = AcpiUtCreateGenericState (); if (!ScopeInfo) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -215,7 +215,7 @@ AcpiDsScopeStackPush ( /* Push new scope object onto stack */ - AcpiCmPushGenericState (&WalkState->ScopeInfo, ScopeInfo); + AcpiUtPushGenericState (&WalkState->ScopeInfo, ScopeInfo); return_ACPI_STATUS (AE_OK); } @@ -251,7 +251,7 @@ AcpiDsScopeStackPop ( * Pop scope info object off the stack. */ - ScopeInfo = AcpiCmPopGenericState (&WalkState->ScopeInfo); + ScopeInfo = AcpiUtPopGenericState (&WalkState->ScopeInfo); if (!ScopeInfo) { return_ACPI_STATUS (AE_STACK_UNDERFLOW); @@ -260,7 +260,7 @@ AcpiDsScopeStackPop ( DEBUG_PRINT (TRACE_EXEC, ("Popped object type %X\n", ScopeInfo->Common.Value)); - AcpiCmDeleteGenericState (ScopeInfo); + AcpiUtDeleteGenericState (ScopeInfo); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/dswstate.c b/sys/contrib/dev/acpica/dswstate.c index dc0b394..561378c 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: 38 $ + * $Revision: 45 $ * *****************************************************************************/ @@ -124,11 +124,10 @@ #include "acnamesp.h" #include "acinterp.h" -#define _COMPONENT DISPATCHER +#define _COMPONENT ACPI_DISPATCHER MODULE_NAME ("dswstate") - /******************************************************************************* * * FUNCTION: AcpiDsResultInsert @@ -151,27 +150,29 @@ AcpiDsResultInsert ( ACPI_GENERIC_STATE *State; + PROC_NAME ("DsResultInsert"); + + State = WalkState->Results; if (!State) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultInsert: No result object pushed! State=%p\n", + DEBUG_PRINTP (ACPI_ERROR, ("No result object pushed! State=%p\n", WalkState)); return (AE_NOT_EXIST); } if (Index >= OBJ_NUM_OPERANDS) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultInsert: Index out of range: %X Obj=%p State=%p Num=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Index out of range: %X Obj=%p State=%p Num=%X\n", Index, Object, WalkState, State->Results.NumResults)); return (AE_BAD_PARAMETER); } if (!Object) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultInsert: Null Object! Index=%X Obj=%p State=%p Num=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Null Object! Index=%X Obj=%p State=%p Num=%X\n", Index, Object, WalkState, State->Results.NumResults)); return (AE_BAD_PARAMETER); } @@ -179,9 +180,9 @@ AcpiDsResultInsert ( State->Results.ObjDesc [Index] = Object; State->Results.NumResults++; - DEBUG_PRINT (TRACE_EXEC, - ("DsResultStackPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL", + DEBUG_PRINTP (TRACE_EXEC, + ("Obj=%p [%s] State=%p Num=%X Cur=%X\n", + Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL", WalkState, State->Results.NumResults, WalkState->CurrentResult)); return (AE_OK); @@ -211,19 +212,21 @@ AcpiDsResultRemove ( ACPI_GENERIC_STATE *State; + PROC_NAME ("DsResultRemove"); + + State = WalkState->Results; if (!State) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultRemove: No result object pushed! State=%p\n", + DEBUG_PRINTP (ACPI_ERROR, ("No result object pushed! State=%p\n", WalkState)); return (AE_NOT_EXIST); } if (Index >= OBJ_NUM_OPERANDS) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultRemove: Index out of range: %X State=%p Num=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Index out of range: %X State=%p Num=%X\n", Index, WalkState, State->Results.NumResults)); } @@ -232,8 +235,8 @@ AcpiDsResultRemove ( if (!State->Results.ObjDesc [Index]) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultStackRemove: Null operand! State=%p #Ops=%X, Index=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Null operand! State=%p #Ops=%X, Index=%X\n", WalkState, State->Results.NumResults, Index)); return (AE_AML_NO_RETURN_VALUE); } @@ -245,9 +248,9 @@ AcpiDsResultRemove ( *Object = State->Results.ObjDesc [Index]; State->Results.ObjDesc [Index] = NULL; - DEBUG_PRINT (TRACE_EXEC, - ("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL", + DEBUG_PRINTP (TRACE_EXEC, + ("Obj=%p [%s] Index=%X State=%p Num=%X\n", + *Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL", Index, WalkState, State->Results.NumResults)); return (AE_OK); @@ -277,6 +280,9 @@ AcpiDsResultPop ( ACPI_GENERIC_STATE *State; + PROC_NAME ("DsResultPop"); + + State = WalkState->Results; if (!State) { @@ -286,8 +292,7 @@ AcpiDsResultPop ( if (!State->Results.NumResults) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPop: Result stack is empty! State=%p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Result stack is empty! State=%p\n", WalkState)); return (AE_AML_NO_RETURN_VALUE); } @@ -305,9 +310,8 @@ AcpiDsResultPop ( *Object = State->Results.ObjDesc [Index -1]; State->Results.ObjDesc [Index -1] = NULL; - DEBUG_PRINT (TRACE_EXEC, - ("DsResultStackRemove: Obj=%p [%s] Index=%X State=%p Num=%X\n", - *Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL", + DEBUG_PRINTP (TRACE_EXEC, ("Obj=%p [%s] Index=%X State=%p Num=%X\n", + *Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL", Index -1, WalkState, State->Results.NumResults)); return (AE_OK); @@ -315,9 +319,7 @@ AcpiDsResultPop ( } - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPop: No result objects! State=%p\n", - WalkState)); + DEBUG_PRINTP (ACPI_ERROR, ("No result objects! State=%p\n", WalkState)); return (AE_AML_NO_RETURN_VALUE); } @@ -344,21 +346,21 @@ AcpiDsResultPopFromBottom ( ACPI_GENERIC_STATE *State; + PROC_NAME ("DsResultPopFromBottom"); + + State = WalkState->Results; if (!State) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPopFromBottom: Warning: No result object pushed! State=%p\n", - WalkState)); + DEBUG_PRINTP (ACPI_ERROR, + ("Warning: No result object pushed! State=%p\n", WalkState)); return (AE_NOT_EXIST); } if (!State->Results.NumResults) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPopFromBottom: No result objects! State=%p\n", - WalkState)); + DEBUG_PRINTP (ACPI_ERROR, ("No result objects! State=%p\n", WalkState)); return (AE_AML_NO_RETURN_VALUE); } @@ -380,15 +382,13 @@ AcpiDsResultPopFromBottom ( if (!*Object) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPopFromBottom: Null operand! State=%p #Ops=%X, Index=%X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Null operand! State=%p #Ops=%X, Index=%X\n", WalkState, State->Results.NumResults, Index)); return (AE_AML_NO_RETURN_VALUE); } - DEBUG_PRINT (TRACE_EXEC, - ("DsResultPopFromBottom: Obj=%p [%s], Results=%p State=%p\n", - *Object, (*Object) ? AcpiCmGetTypeName ((*Object)->Common.Type) : "NULL", + DEBUG_PRINTP (TRACE_EXEC, ("Obj=%p [%s], Results=%p State=%p\n", + *Object, (*Object) ? AcpiUtGetTypeName ((*Object)->Common.Type) : "NULL", State, WalkState)); @@ -417,26 +417,27 @@ AcpiDsResultPush ( ACPI_GENERIC_STATE *State; + PROC_NAME ("DsResultPush"); + + State = WalkState->Results; if (!State) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPush: No result stack frame\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No result stack frame\n")); return (AE_AML_INTERNAL); } if (State->Results.NumResults == OBJ_NUM_OPERANDS) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPush: Result stack overflow: Obj=%p State=%p Num=%X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Result stack overflow: Obj=%p State=%p Num=%X\n", Object, WalkState, State->Results.NumResults)); return (AE_STACK_OVERFLOW); } if (!Object) { - DEBUG_PRINT (ACPI_ERROR, - ("DsResultPush: Null Object! Obj=%p State=%p Num=%X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Null Object! Obj=%p State=%p Num=%X\n", Object, WalkState, State->Results.NumResults)); return (AE_BAD_PARAMETER); } @@ -445,9 +446,8 @@ AcpiDsResultPush ( State->Results.ObjDesc [State->Results.NumResults] = Object; State->Results.NumResults++; - DEBUG_PRINT (TRACE_EXEC, - ("DsResultPush: Obj=%p [%s] State=%p Num=%X Cur=%X\n", - Object, Object ? AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL", + DEBUG_PRINTP (TRACE_EXEC, ("Obj=%p [%s] State=%p Num=%X Cur=%X\n", + Object, Object ? AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type) : "NULL", WalkState, State->Results.NumResults, WalkState->CurrentResult)); return (AE_OK); @@ -474,16 +474,15 @@ AcpiDsResultStackPush ( ACPI_GENERIC_STATE *State; - State = AcpiCmCreateGenericState (); + State = AcpiUtCreateGenericState (); if (!State) { return (AE_NO_MEMORY); } - AcpiCmPushGenericState (&WalkState->Results, State); + AcpiUtPushGenericState (&WalkState->Results, State); - DEBUG_PRINT (TRACE_EXEC, - ("DsResultStackPush: Results=%p State=%p\n", + DEBUG_PRINT (TRACE_EXEC, ("DsResultStackPush: Results=%p State=%p\n", State, WalkState)); return (AE_OK); @@ -513,20 +512,19 @@ AcpiDsResultStackPop ( if (WalkState->Results == NULL) { - DEBUG_PRINT (TRACE_EXEC, - ("DsResultStackPop: Underflow - State=%p\n", + DEBUG_PRINT (TRACE_EXEC, ("DsResultStackPop: Underflow - State=%p\n", WalkState)); return (AE_AML_NO_OPERAND); } - State = AcpiCmPopGenericState (&WalkState->Results); + State = AcpiUtPopGenericState (&WalkState->Results); DEBUG_PRINT (TRACE_EXEC, ("DsResultStackPop: Result=%p RemainingResults=%X State=%p\n", State, State->Results.NumResults, WalkState)); - AcpiCmDeleteGenericState (State); + AcpiUtDeleteGenericState (State); return (AE_OK); } @@ -561,7 +559,7 @@ AcpiDsObjStackDeleteAll ( { if (WalkState->Operands[i]) { - AcpiCmRemoveReference (WalkState->Operands[i]); + AcpiUtRemoveReference (WalkState->Operands[i]); WalkState->Operands[i] = NULL; } } @@ -606,7 +604,7 @@ AcpiDsObjStackPush ( WalkState->NumOperands++; DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPush: Obj=%p [%s] State=%p #Ops=%X\n", - Object, AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type), + Object, AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) Object)->Common.Type), WalkState, WalkState->NumOperands)); return (AE_OK); @@ -641,10 +639,10 @@ AcpiDsObjStackPopObject ( DEBUG_PRINT (ACPI_ERROR, ("DsObjStackPop: Missing operand/stack empty! State=%p #Ops=%X\n", WalkState, WalkState->NumOperands)); + *Object = NULL; return (AE_AML_NO_OPERAND); } - /* Pop the stack */ WalkState->NumOperands--; @@ -656,6 +654,7 @@ AcpiDsObjStackPopObject ( DEBUG_PRINT (ACPI_ERROR, ("DsObjStackPop: Null operand! State=%p #Ops=%X\n", WalkState, WalkState->NumOperands)); + *Object = NULL; return (AE_AML_NO_OPERAND); } @@ -665,7 +664,7 @@ AcpiDsObjStackPopObject ( WalkState->Operands [WalkState->NumOperands] = NULL; DEBUG_PRINT (TRACE_EXEC, ("DsObjStackPopObject: Obj=%p [%s] State=%p #Ops=%X\n", - *Object, AcpiCmGetTypeName ((*Object)->Common.Type), + *Object, AcpiUtGetTypeName ((*Object)->Common.Type), WalkState, WalkState->NumOperands)); return (AE_OK); @@ -760,7 +759,7 @@ AcpiDsObjStackPopAndDelete ( ObjDesc = WalkState->Operands [WalkState->NumOperands]; if (ObjDesc) { - AcpiCmRemoveReference (WalkState->Operands [WalkState->NumOperands]); + AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]); WalkState->Operands [WalkState->NumOperands] = NULL; } } @@ -800,14 +799,14 @@ AcpiDsObjStackGetValue ( if (WalkState->NumOperands == 0) { - return_VALUE (NULL); + return_PTR (NULL); } /* or if the index is past the top of the stack */ if (Index > (WalkState->NumOperands - (UINT32) 1)) { - return_VALUE (NULL); + return_PTR (NULL); } @@ -835,7 +834,8 @@ AcpiDsGetCurrentWalkState ( { - DEBUG_PRINT (TRACE_PARSE, ("DsGetCurrentWalkState, =%p\n", WalkList->WalkState)); + DEBUG_PRINT (TRACE_PARSE, ("DsGetCurrentWalkState, =%p\n", + WalkList->WalkState)); if (!WalkList) { @@ -947,7 +947,7 @@ AcpiDsCreateWalkState ( FUNCTION_TRACE ("DsCreateWalkState"); - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_WalkStateCacheRequests++; /* Check the cache first */ @@ -962,23 +962,23 @@ AcpiDsCreateWalkState ( AcpiGbl_WalkStateCacheHits++; AcpiGbl_WalkStateCacheDepth--; - DEBUG_PRINT (TRACE_EXEC, ("DsCreateWalkState: State %p from cache\n", WalkState)); + DEBUG_PRINTP (TRACE_EXEC, ("State %p from cache\n", WalkState)); - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); } else { /* The cache is empty, create a new object */ - /* Avoid deadlock with AcpiCmCallocate */ + /* Avoid deadlock with AcpiUtCallocate */ - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); - WalkState = AcpiCmCallocate (sizeof (ACPI_WALK_STATE)); + WalkState = AcpiUtCallocate (sizeof (ACPI_WALK_STATE)); if (!WalkState) { - return_VALUE (NULL); + return_PTR (NULL); } } @@ -986,6 +986,7 @@ AcpiDsCreateWalkState ( WalkState->OwnerId = OwnerId; WalkState->Origin = Origin; WalkState->MethodDesc = MthDesc; + WalkState->WalkList = WalkList; /* Init the method args/local */ @@ -998,7 +999,7 @@ AcpiDsCreateWalkState ( Status = AcpiDsResultStackPush (WalkState); if (ACPI_FAILURE (Status)) { - return_VALUE (NULL); + return_PTR (NULL); } @@ -1039,8 +1040,7 @@ AcpiDsDeleteWalkState ( if (WalkState->DataType != ACPI_DESC_TYPE_WALK) { - DEBUG_PRINT (ACPI_ERROR, - ("DsDeleteWalkState: **** %p not a valid walk state\n", WalkState)); + DEBUG_PRINTP (ACPI_ERROR, ("%p is not a valid walk state\n", WalkState)); return; } @@ -1052,7 +1052,7 @@ AcpiDsDeleteWalkState ( State = WalkState->ControlState; WalkState->ControlState = State->Common.Next; - AcpiCmDeleteGenericState (State); + AcpiUtDeleteGenericState (State); } /* Always must free any linked parse states */ @@ -1062,7 +1062,7 @@ AcpiDsDeleteWalkState ( State = WalkState->ScopeInfo; WalkState->ScopeInfo = State->Common.Next; - AcpiCmDeleteGenericState (State); + AcpiUtDeleteGenericState (State); } /* Always must free any stacked result states */ @@ -1072,7 +1072,7 @@ AcpiDsDeleteWalkState ( State = WalkState->Results; WalkState->Results = State->Common.Next; - AcpiCmDeleteGenericState (State); + AcpiUtDeleteGenericState (State); } @@ -1080,14 +1080,14 @@ AcpiDsDeleteWalkState ( if (AcpiGbl_WalkStateCacheDepth >= MAX_WALK_CACHE_DEPTH) { - AcpiCmFree (WalkState); + AcpiUtFree (WalkState); } /* Otherwise put this object back into the cache */ else { - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); /* Clear the state */ @@ -1101,7 +1101,7 @@ AcpiDsDeleteWalkState ( AcpiGbl_WalkStateCacheDepth++; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); } return_VOID; @@ -1138,7 +1138,7 @@ AcpiDsDeleteWalkStateCache ( /* Delete one cached state object */ Next = AcpiGbl_WalkStateCache->Next; - AcpiCmFree (AcpiGbl_WalkStateCache); + AcpiUtFree (AcpiGbl_WalkStateCache); AcpiGbl_WalkStateCache = Next; AcpiGbl_WalkStateCacheDepth--; } diff --git a/sys/contrib/dev/acpica/evevent.c b/sys/contrib/dev/acpica/evevent.c index 2738ea8..898ecbf 100644 --- a/sys/contrib/dev/acpica/evevent.c +++ b/sys/contrib/dev/acpica/evevent.c @@ -2,7 +2,7 @@ * * Module Name: evevent - Fixed and General Purpose AcpiEvent * handling and dispatch - * $Revision: 34 $ + * $Revision: 42 $ * *****************************************************************************/ @@ -119,13 +119,12 @@ #include "achware.h" #include "acevents.h" #include "acnamesp.h" -#include "accommon.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evevent") -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvInitialize * @@ -137,7 +136,7 @@ * configured, disables SCI event sources, installs the SCI * handler * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvInitialize ( @@ -153,7 +152,7 @@ AcpiEvInitialize ( if (!AcpiGbl_DSDT) { - DEBUG_PRINT (ACPI_WARN, ("EvInitialize: No ACPI tables present!\n")); + DEBUG_PRINTP (ACPI_WARN, ("No ACPI tables present!\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -162,8 +161,7 @@ AcpiEvInitialize ( if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities()) { - DEBUG_PRINT (ACPI_WARN, - ("EvInitialize: Only legacy mode supported!\n")); + DEBUG_PRINTP (ACPI_WARN, ("ACPI Mode is not supported!\n")); return_ACPI_STATUS (AE_ERROR); } @@ -179,16 +177,14 @@ AcpiEvInitialize ( Status = AcpiEvFixedEventInitialize (); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, - ("EvInitialize: Unable to initialize fixed events.\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize fixed events.\n")); return_ACPI_STATUS (Status); } Status = AcpiEvGpeInitialize (); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, - ("EvInitialize: Unable to initialize general purpose events.\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize general purpose events.\n")); return_ACPI_STATUS (Status); } @@ -197,8 +193,7 @@ AcpiEvInitialize ( Status = AcpiEvInstallSciHandler (); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, - ("EvInitialize: Unable to install System Control Interrupt Handler\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Unable to install System Control Interrupt Handler\n")); return_ACPI_STATUS (Status); } @@ -208,8 +203,7 @@ AcpiEvInitialize ( Status = AcpiEvInitGpeControlMethods (); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, - ("EvInitialize: Unable to initialize Gpe control methods\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize Gpe control methods\n")); return_ACPI_STATUS (Status); } @@ -218,8 +212,7 @@ AcpiEvInitialize ( Status = AcpiEvInitGlobalLockHandler (); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, - ("EvInitialize: Unable to initialize Global Lock handler\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Unable to initialize Global Lock handler\n")); return_ACPI_STATUS (Status); } @@ -228,7 +221,7 @@ AcpiEvInitialize ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvFixedEventInitialize * @@ -247,7 +240,7 @@ AcpiEvFixedEventInitialize(void) /* Initialize the structure that keeps track of fixed event handlers */ - for (i = 0; i < NUM_FIXED_EVENTS; i++) + for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { AcpiGbl_FixedEventHandlers[i].Handler = NULL; AcpiGbl_FixedEventHandlers[i].Context = NULL; @@ -263,7 +256,7 @@ AcpiEvFixedEventInitialize(void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvFixedEventDetect * @@ -303,7 +296,7 @@ AcpiEvFixedEventDetect(void) IntStatus |= AcpiEvFixedEventDispatch (ACPI_EVENT_PMTIMER); } - /* global event (BIOS want's the global lock) */ + /* global event (BIOS wants the global lock) */ if ((StatusRegister & ACPI_STATUS_GLOBAL) && (EnableRegister & ACPI_ENABLE_GLOBAL)) @@ -331,7 +324,7 @@ AcpiEvFixedEventDetect(void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvFixedEventDispatch * @@ -406,7 +399,7 @@ AcpiEvFixedEventDispatch ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvGpeInitialize * @@ -462,11 +455,11 @@ AcpiEvGpeInitialize (void) * Allocate the Gpe information block */ - AcpiGbl_GpeRegisters = AcpiCmCallocate (AcpiGbl_GpeRegisterCount * + AcpiGbl_GpeRegisters = AcpiUtCallocate (AcpiGbl_GpeRegisterCount * sizeof (ACPI_GPE_REGISTERS)); if (!AcpiGbl_GpeRegisters) { - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Could not allocate the GpeRegisters block\n")); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -477,18 +470,18 @@ AcpiEvGpeInitialize (void) * Initialization to zeros is sufficient */ - AcpiGbl_GpeInfo = AcpiCmCallocate (MUL_8 (AcpiGbl_GpeRegisterCount) * + AcpiGbl_GpeInfo = AcpiUtCallocate (MUL_8 (AcpiGbl_GpeRegisterCount) * sizeof (ACPI_GPE_LEVEL_INFO)); if (!AcpiGbl_GpeInfo) { - AcpiCmFree (AcpiGbl_GpeRegisters); - DEBUG_PRINT (ACPI_ERROR, ("Could not allocate the GpeInfo block\n")); + AcpiUtFree (AcpiGbl_GpeRegisters); + DEBUG_PRINTP (ACPI_ERROR, ("Could not allocate the GpeInfo block\n")); return_ACPI_STATUS (AE_NO_MEMORY); } /* Set the Gpe validation table to GPE_INVALID */ - MEMSET (AcpiGbl_GpeValid, (int) ACPI_GPE_INVALID, NUM_GPE); + MEMSET (AcpiGbl_GpeValid, (int) ACPI_GPE_INVALID, ACPI_NUM_GPE); /* * Initialize the Gpe information and validation blocks. A goal of these @@ -558,8 +551,7 @@ AcpiEvGpeInitialize (void) RegisterIndex++; } - DEBUG_PRINT (ACPI_INFO, - ("GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n", + DEBUG_PRINTP (ACPI_INFO, ("GPE registers: %X@%p (Blk0) %X@%p (Blk1)\n", Gpe0RegisterCount, AcpiGbl_FADT->XGpe0Blk.Address, Gpe1RegisterCount, AcpiGbl_FADT->XGpe1Blk.Address)); @@ -567,7 +559,7 @@ AcpiEvGpeInitialize (void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvSaveMethodInfo * @@ -601,6 +593,9 @@ AcpiEvSaveMethodInfo ( UINT8 Type; + PROC_NAME ("EvSaveMethodInfo"); + + /* Extract the name from the object and convert to a string */ MOVE_UNALIGNED32_TO_32 (Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name); @@ -621,8 +616,8 @@ AcpiEvSaveMethodInfo ( { /* Unknown method type, just ignore it! */ - DEBUG_PRINT (ACPI_ERROR, - ("EvSaveMethodInfo: Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Unknown GPE method type: %s (name not of form _Lnn or _Enn)\n", Name)); return (AE_OK); } @@ -634,8 +629,8 @@ AcpiEvSaveMethodInfo ( { /* Conversion failed; invalid method, just ignore it */ - DEBUG_PRINT (ACPI_ERROR, - ("EvSaveMethodInfo: Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Could not extract GPE number from name: %s (name not of form _Lnn or _Enn)\n", Name)); return (AE_OK); } @@ -664,14 +659,13 @@ AcpiEvSaveMethodInfo ( AcpiHwEnableGpe (GpeNumber); - DEBUG_PRINT (ACPI_INFO, - ("EvSaveMethodInfo: Registered GPE method %s as GPE number %X\n", + DEBUG_PRINTP (ACPI_INFO, ("Registered GPE method %s as GPE number %X\n", Name, GpeNumber)); return (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvInitGpeControlMethods * @@ -712,7 +706,7 @@ AcpiEvInitGpeControlMethods (void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvGpeDetect * @@ -786,7 +780,7 @@ AcpiEvGpeDetect (void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvAsynchExecuteGpeMethod * @@ -815,9 +809,9 @@ AcpiEvAsynchExecuteGpeMethod ( /* * Take a snapshot of the GPE info for this level */ - AcpiCmAcquireMutex (ACPI_MTX_EVENTS); + AcpiUtAcquireMutex (ACPI_MTX_EVENTS); GpeInfo = AcpiGbl_GpeInfo [GpeNumber]; - AcpiCmReleaseMutex (ACPI_MTX_EVENTS); + AcpiUtReleaseMutex (ACPI_MTX_EVENTS); /* * Method Handler (_Lxx, _Exx): @@ -848,7 +842,7 @@ AcpiEvAsynchExecuteGpeMethod ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvGpeDispatch * @@ -875,14 +869,13 @@ AcpiEvGpeDispatch ( FUNCTION_TRACE ("EvGpeDispatch"); - /*DEBUG_INCREMENT_EVENT_COUNT (EVENT_GENERAL);*/ /* * Valid GPE number? */ if (AcpiGbl_GpeValid[GpeNumber] == ACPI_GPE_INVALID) { - DEBUG_PRINT (ACPI_ERROR, ("Invalid GPE bit [%X].\n", GpeNumber)); + DEBUG_PRINTP (ACPI_ERROR, ("Invalid GPE bit [%X].\n", GpeNumber)); return_VALUE (INTERRUPT_NOT_HANDLED); } @@ -926,7 +919,7 @@ AcpiEvGpeDispatch ( else if (GpeInfo.MethodHandle) { if (ACPI_FAILURE(AcpiOsQueueForExecution (OSD_PRIORITY_GPE, - AcpiEvAsynchExecuteGpeMethod, (void*)(NATIVE_UINT)GpeNumber))) + AcpiEvAsynchExecuteGpeMethod, (void*) GpeNumber))) { /* * Shoudn't occur, but if it does report an error. Note that diff --git a/sys/contrib/dev/acpica/evmisc.c b/sys/contrib/dev/acpica/evmisc.c index 516774e..afa7b2d 100644 --- a/sys/contrib/dev/acpica/evmisc.c +++ b/sys/contrib/dev/acpica/evmisc.c @@ -2,7 +2,7 @@ * * Module Name: evmisc - ACPI device notification handler dispatch * and ACPI Global Lock support - * $Revision: 22 $ + * $Revision: 31 $ * *****************************************************************************/ @@ -121,13 +121,13 @@ #include "acinterp.h" #include "achware.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evmisc") -/************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiEvNotifyDispatch + * FUNCTION: AcpiEvQueueNotifyRequest * * PARAMETERS: * @@ -136,16 +136,20 @@ * DESCRIPTION: Dispatch a device notification event to a previously * installed handler. * - *************************************************************************/ + ******************************************************************************/ -void -AcpiEvNotifyDispatch ( - ACPI_HANDLE Device, +ACPI_STATUS +AcpiEvQueueNotifyRequest ( + ACPI_NAMESPACE_NODE *Node, UINT32 NotifyValue) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OPERAND_OBJECT *HandlerObj; - NOTIFY_HANDLER Handler; + ACPI_OPERAND_OBJECT *HandlerObj = NULL; + ACPI_GENERIC_STATE *NotifyInfo; + ACPI_STATUS Status = AE_OK; + + + PROC_NAME ("EvQueueNotifyRequest"); /* @@ -155,108 +159,181 @@ AcpiEvNotifyDispatch ( * initiate soft-off or sleep operation? */ - - DEBUG_PRINT (ACPI_INFO, - ("Dispatching Notify(%X) on device %p\n", NotifyValue, Device)); + DEBUG_PRINTP (ACPI_INFO, + ("Dispatching Notify(%X) on node %p\n", NotifyValue, Node)); switch (NotifyValue) { case 0: - DEBUG_PRINT (ACPI_INFO, ("Notify value: Re-enumerate Devices\n")); + DEBUG_PRINTP (ACPI_INFO, ("Notify value: Re-enumerate Devices\n")); break; case 1: - DEBUG_PRINT (ACPI_INFO, ("Notify value: Ejection Request\n")); + DEBUG_PRINTP (ACPI_INFO, ("Notify value: Ejection Request\n")); break; case 2: - DEBUG_PRINT (ACPI_INFO, ("Notify value: Device Wake\n")); + DEBUG_PRINTP (ACPI_INFO, ("Notify value: Device Wake\n")); break; case 0x80: - DEBUG_PRINT (ACPI_INFO, ("Notify value: Status Change\n")); + DEBUG_PRINTP (ACPI_INFO, ("Notify value: Status Change\n")); break; default: - DEBUG_PRINT (ACPI_INFO, ("Unknown Notify Value: %lx \n", NotifyValue)); + DEBUG_PRINTP (ACPI_INFO, ("Unknown Notify Value: %lx \n", NotifyValue)); break; } /* - * Invoke a global notify handler if installed. - * This is done _before_ we invoke the per-device handler attached to the device. + * Get the notify object attached to the device Node */ - if (NotifyValue <= MAX_SYS_NOTIFY) + ObjDesc = AcpiNsGetAttachedObject (Node); + if (ObjDesc) { - /* Global system notification handler */ - if (AcpiGbl_SysNotify.Handler) + /* We have the notify object, Get the right handler */ + + switch (Node->Type) { - AcpiGbl_SysNotify.Handler (Device, NotifyValue, - AcpiGbl_SysNotify.Context); + case ACPI_TYPE_DEVICE: + if (NotifyValue <= MAX_SYS_NOTIFY) + { + HandlerObj = ObjDesc->Device.SysHandler; + } + else + { + HandlerObj = ObjDesc->Device.DrvHandler; + } + break; + + case ACPI_TYPE_THERMAL: + if (NotifyValue <= MAX_SYS_NOTIFY) + { + HandlerObj = ObjDesc->ThermalZone.SysHandler; + } + else + { + HandlerObj = ObjDesc->ThermalZone.DrvHandler; + } + break; } } - else + + /* If there is any handler to run, schedule the dispatcher */ + + if ((AcpiGbl_SysNotify.Handler && (NotifyValue <= MAX_SYS_NOTIFY)) || + (AcpiGbl_DrvNotify.Handler && (NotifyValue > MAX_SYS_NOTIFY)) || + HandlerObj) { - /* Global driver notification handler */ - if (AcpiGbl_DrvNotify.Handler) + NotifyInfo = AcpiUtCreateGenericState (); + if (!NotifyInfo) { - AcpiGbl_DrvNotify.Handler (Device, NotifyValue, - AcpiGbl_DrvNotify.Context); + return (AE_NO_MEMORY); } - } + NotifyInfo->Notify.Node = Node; + NotifyInfo->Notify.Value = (UINT16) NotifyValue; + NotifyInfo->Notify.HandlerObj = HandlerObj; - /* - * Get the notify object which must be attached to the device Node - */ + Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH, + AcpiEvNotifyDispatch, NotifyInfo); + if (ACPI_FAILURE (Status)) + { + AcpiUtDeleteGenericState (NotifyInfo); + } + } - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Device); - if (!ObjDesc) + if (!HandlerObj) { - /* There can be no notify handler for this device */ + /* There is no per-device notify handler for this device */ - DEBUG_PRINT (ACPI_INFO, - ("No notify handler for device %p \n", Device)); - return; + DEBUG_PRINTP (ACPI_INFO, ("No notify handler for node %p \n", Node)); } + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiEvNotifyDispatch + * + * PARAMETERS: + * + * RETURN: None. + * + * DESCRIPTION: Dispatch a device notification event to a previously + * installed handler. + * + ******************************************************************************/ + +void +AcpiEvNotifyDispatch ( + void *Context) +{ + ACPI_GENERIC_STATE *NotifyInfo = (ACPI_GENERIC_STATE *) Context; + ACPI_NOTIFY_HANDLER GlobalHandler = NULL; + void *GlobalContext = NULL; + ACPI_OPERAND_OBJECT *HandlerObj; + - /* We have the notify object, Get the right handler */ + /* + * We will invoke a global notify handler if installed. + * This is done _before_ we invoke the per-device handler attached to the device. + */ - if (NotifyValue <= MAX_SYS_NOTIFY) + if (NotifyInfo->Notify.Value <= MAX_SYS_NOTIFY) { - HandlerObj = ObjDesc->Device.SysHandler; + /* Global system notification handler */ + + if (AcpiGbl_SysNotify.Handler) + { + GlobalHandler = AcpiGbl_SysNotify.Handler; + GlobalContext = AcpiGbl_SysNotify.Context; + } } + else { - HandlerObj = ObjDesc->Device.DrvHandler; + /* Global driver notification handler */ + + if (AcpiGbl_DrvNotify.Handler) + { + GlobalHandler = AcpiGbl_DrvNotify.Handler; + GlobalContext = AcpiGbl_DrvNotify.Context; + } } - /* Validate the handler */ - if (!HandlerObj) + /* Invoke the system handler first, if present */ + + if (GlobalHandler) { - /* There is no notify handler for this device */ + GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, GlobalContext); + } - DEBUG_PRINT (ACPI_INFO, - ("No notify handler for device %p \n", Device)); - return; + /* Now invoke the per-device handler, if present */ + + HandlerObj = NotifyInfo->Notify.HandlerObj; + if (HandlerObj) + { + HandlerObj->NotifyHandler.Handler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, + HandlerObj->NotifyHandler.Context); } - /* There is a handler, invoke it */ - Handler = HandlerObj->NotifyHandler.Handler; - Handler (Device, NotifyValue, HandlerObj->NotifyHandler.Context); + /* All done with the info object */ + AcpiUtDeleteGenericState (NotifyInfo); } -/*************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvGlobalLockThread * @@ -266,7 +343,7 @@ AcpiEvNotifyDispatch ( * Global Lock. Simply signal all threads that are waiting * for the lock. * - **************************************************************************/ + ******************************************************************************/ static void AcpiEvGlobalLockThread ( @@ -285,7 +362,7 @@ AcpiEvGlobalLockThread ( } -/*************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvGlobalLockHandler * @@ -295,7 +372,7 @@ AcpiEvGlobalLockThread ( * release interrupt occurs. Grab the global lock and queue * the global lock thread for execution * - **************************************************************************/ + ******************************************************************************/ static UINT32 AcpiEvGlobalLockHandler ( @@ -329,7 +406,7 @@ AcpiEvGlobalLockHandler ( } -/*************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvInitGlobalLockHandler * @@ -337,7 +414,7 @@ AcpiEvGlobalLockHandler ( * * DESCRIPTION: Install a handler for the global lock release event * - **************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvInitGlobalLockHandler (void) @@ -348,14 +425,28 @@ AcpiEvInitGlobalLockHandler (void) FUNCTION_TRACE ("EvInitGlobalLockHandler"); + AcpiGbl_GlobalLockPresent = TRUE; Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AcpiEvGlobalLockHandler, NULL); + /* + * If the global lock does not exist on this platform, the attempt + * to enable GBL_STS will fail (the GBL_EN bit will not stick) + * Map to AE_OK, but mark global lock as not present. + * Any attempt to actually use the global lock will be flagged + * with an error. + */ + if (Status == AE_NO_HARDWARE_RESPONSE) + { + AcpiGbl_GlobalLockPresent = FALSE; + Status = AE_OK; + } + return_ACPI_STATUS (Status); } -/*************************************************************************** +/****************************************************************************** * * FUNCTION: AcpiEvAcquireGlobalLock * @@ -363,7 +454,7 @@ AcpiEvInitGlobalLockHandler (void) * * DESCRIPTION: Attempt to gain ownership of the Global Lock. * - **************************************************************************/ + *****************************************************************************/ ACPI_STATUS AcpiEvAcquireGlobalLock(void) @@ -375,6 +466,12 @@ AcpiEvAcquireGlobalLock(void) FUNCTION_TRACE ("EvAcquireGlobalLock"); + /* Make sure that we actually have a global lock */ + + if (!AcpiGbl_GlobalLockPresent) + { + return_ACPI_STATUS (AE_NO_GLOBAL_LOCK); + } /* One more thread wants the global lock */ @@ -404,10 +501,9 @@ AcpiEvAcquireGlobalLock(void) { /* We got the lock */ - DEBUG_PRINT (ACPI_INFO, ("Acquired the HW Global Lock\n")); + DEBUG_PRINTP (ACPI_INFO, ("Acquired the Global Lock\n")); AcpiGbl_GlobalLockAcquired = TRUE; - return_ACPI_STATUS (AE_OK); } @@ -417,27 +513,26 @@ AcpiEvAcquireGlobalLock(void) * wait until we get the global lock released interrupt. */ - DEBUG_PRINT (ACPI_INFO, ("Waiting for the HW Global Lock\n")); + DEBUG_PRINTP (ACPI_INFO, ("Waiting for the HW Global Lock\n")); /* * Acquire the global lock semaphore first. * Since this wait will block, we must release the interpreter */ - Status = AcpiAmlSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, + Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore, ACPI_UINT32_MAX); - return_ACPI_STATUS (Status); } -/*************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvReleaseGlobalLock * * DESCRIPTION: Releases ownership of the Global Lock. * - **************************************************************************/ + ******************************************************************************/ void AcpiEvReleaseGlobalLock (void) @@ -450,7 +545,7 @@ AcpiEvReleaseGlobalLock (void) if (!AcpiGbl_GlobalLockThreadCount) { - REPORT_WARNING(("Releasing a non-acquired Global Lock\n")); + REPORT_WARNING(("Global Lock has not be acquired, cannot release\n")); return_VOID; } diff --git a/sys/contrib/dev/acpica/evregion.c b/sys/contrib/dev/acpica/evregion.c index e9ebad9..2e2888d 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: 96 $ + * $Revision: 103 $ * *****************************************************************************/ @@ -123,11 +123,11 @@ #include "acinterp.h" #include "amlcode.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evregion") -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvInstallDefaultAddressSpaceHandlers * @@ -137,7 +137,7 @@ * * DESCRIPTION: Installs the core subsystem address space handlers. * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvInstallDefaultAddressSpaceHandlers ( @@ -165,7 +165,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( */ Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, - ADDRESS_SPACE_SYSTEM_MEMORY, + ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL); if ((ACPI_FAILURE (Status)) && (Status != AE_EXIST)) @@ -174,7 +174,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( } Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, - ADDRESS_SPACE_SYSTEM_IO, + ACPI_ADR_SPACE_SYSTEM_IO, ACPI_DEFAULT_HANDLER, NULL, NULL); if ((ACPI_FAILURE (Status)) && (Status != AE_EXIST)) @@ -183,7 +183,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( } Status = AcpiInstallAddressSpaceHandler (AcpiGbl_RootNode, - ADDRESS_SPACE_PCI_CONFIG, + ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); if ((ACPI_FAILURE (Status)) && (Status != AE_EXIST)) @@ -198,7 +198,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( /* TBD: [Restructure] Move elsewhere */ -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvExecuteRegMethod * @@ -209,7 +209,7 @@ AcpiEvInstallDefaultAddressSpaceHandlers ( * * DESCRIPTION: Execute _REG method for a region * - *************************************************************************/ + ******************************************************************************/ static ACPI_STATUS AcpiEvExecuteRegMethod ( @@ -240,8 +240,8 @@ AcpiEvExecuteRegMethod ( * Passed as a parameter */ - AcpiCmInitStaticObject (&SpaceIdDesc); - AcpiCmInitStaticObject (&FunctionDesc); + AcpiUtInitStaticObject (&SpaceIdDesc); + AcpiUtInitStaticObject (&FunctionDesc); /* * Method requires two parameters. @@ -262,13 +262,13 @@ AcpiEvExecuteRegMethod ( /* * Execute the method, no return value */ - DEBUG_EXEC(AcpiCmDisplayInitPathname (RegionObj->Region.Extra->Extra.Method_REG, " [Method]")); + DEBUG_EXEC(AcpiUtDisplayInitPathname (RegionObj->Region.Extra->Extra.Method_REG, " [Method]")); Status = AcpiNsEvaluateByHandle (RegionObj->Region.Extra->Extra.Method_REG, Params, NULL); return_ACPI_STATUS (Status); } -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvAddressSpaceDispatch * @@ -284,7 +284,7 @@ AcpiEvExecuteRegMethod ( * DESCRIPTION: Dispatch an address space or operation region access to * a previously installed handler. * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvAddressSpaceDispatch ( @@ -295,8 +295,8 @@ AcpiEvAddressSpaceDispatch ( UINT32 *Value) { ACPI_STATUS Status; - ADDRESS_SPACE_HANDLER Handler; - ADDRESS_SPACE_SETUP RegionSetup; + ACPI_ADR_SPACE_HANDLER Handler; + ACPI_ADR_SPACE_SETUP RegionSetup; ACPI_OPERAND_OBJECT *HandlerDesc; void *RegionContext = NULL; @@ -305,25 +305,25 @@ AcpiEvAddressSpaceDispatch ( /* - * Check for an installed handler + * Ensure that there is a handler associated with this region */ HandlerDesc = RegionObj->Region.AddrHandler; - if (!HandlerDesc) { - DEBUG_PRINT (TRACE_OPREGION, - ("Dispatch address access region %p, no handler\n", RegionObj)); + DEBUG_PRINTP (ACPI_ERROR, ("no handler for region(%p) [%s]\n", + RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + return_ACPI_STATUS(AE_NOT_EXIST); } /* - * It may be the case that the region has never been initialized - * Some types of regions require special init code + * It may be the case that the region has never been initialized + * Some types of regions require special init code */ if (!(RegionObj->Region.Flags & AOPOBJ_INITIALIZED)) { /* - * This region has not been initialized yet, do it + * This region has not been initialized yet, do it */ RegionSetup = HandlerDesc->AddrHandler.Setup; if (!RegionSetup) @@ -331,9 +331,8 @@ AcpiEvAddressSpaceDispatch ( /* * Bad news, no init routine and not init'd */ - DEBUG_PRINT (ACPI_ERROR, - ("EvAddressSpaceDispatch: No init routine for region %p\n", - RegionObj)); + DEBUG_PRINTP (ACPI_ERROR, ("No init routine for region(%p) [%s]\n", + RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS (AE_UNKNOWN_STATUS); } @@ -341,24 +340,23 @@ AcpiEvAddressSpaceDispatch ( * We must exit the interpreter because the region setup will potentially * execute control methods */ - AcpiAmlExitInterpreter (); + AcpiExExitInterpreter (); Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE, - HandlerDesc->AddrHandler.Context, - &RegionContext); + HandlerDesc->AddrHandler.Context, &RegionContext); /* Re-enter the interpreter */ - AcpiAmlEnterInterpreter (); + AcpiExEnterInterpreter (); /* * Init routine may fail */ if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("EvAddressSpaceDispatch: %s from region init, SpaceID %X\n", - AcpiCmFormatException (Status), RegionObj->Region.SpaceId)); + DEBUG_PRINTP (ACPI_ERROR, ("Region Init: %s [%s]\n", + AcpiUtFormatException (Status), + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); return_ACPI_STATUS(Status); } @@ -376,7 +374,7 @@ AcpiEvAddressSpaceDispatch ( */ Handler = HandlerDesc->AddrHandler.Handler; - DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), + DEBUG_PRINTP ((TRACE_OPREGION | VERBOSE_INFO), ("Addrhandler %p (%p), Address %p\n", &RegionObj->Region.AddrHandler->AddrHandler, Handler, Address)); @@ -387,7 +385,7 @@ AcpiEvAddressSpaceDispatch ( * exit the interpreter because the handler *might* block -- we don't * know what it will do, so we can't hold the lock on the intepreter. */ - AcpiAmlExitInterpreter(); + AcpiExExitInterpreter(); } /* @@ -399,9 +397,9 @@ AcpiEvAddressSpaceDispatch ( if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("EvAddressSpaceDispatch: %s from handler, SpaceID %X\n", - AcpiCmFormatException (Status), RegionObj->Region.SpaceId)); + DEBUG_PRINTP (ACPI_ERROR, ("Region handler: %s [%s]\n", + AcpiUtFormatException (Status), + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } if (!(HandlerDesc->AddrHandler.Flags & ADDR_HANDLER_DEFAULT_INSTALLED)) @@ -409,13 +407,13 @@ AcpiEvAddressSpaceDispatch ( /* We just returned from a non-default handler, we must re-enter the interpreter */ - AcpiAmlEnterInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvDisassociateRegionFromHandler * @@ -437,7 +435,7 @@ AcpiEvDisassociateRegionFromHandler( ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT **LastObjPtr; - ADDRESS_SPACE_SETUP RegionSetup; + ACPI_ADR_SPACE_SETUP RegionSetup; void *RegionContext; ACPI_STATUS Status; @@ -474,7 +472,7 @@ AcpiEvDisassociateRegionFromHandler( */ if (ObjDesc == RegionObj) { - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("Removing Region %p from address handler %p\n", RegionObj, HandlerObj)); /* @@ -485,7 +483,7 @@ AcpiEvDisassociateRegionFromHandler( if (AcpiNsIsLocked) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } /* @@ -495,7 +493,7 @@ AcpiEvDisassociateRegionFromHandler( if (AcpiNsIsLocked) { - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); } /* @@ -503,17 +501,16 @@ AcpiEvDisassociateRegionFromHandler( */ RegionSetup = HandlerObj->AddrHandler.Setup; Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE, - HandlerObj->AddrHandler.Context, - &RegionContext); + HandlerObj->AddrHandler.Context, &RegionContext); /* * Init routine may fail, Just ignore errors */ if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("EvDisassociateRegionFromHandler: %s from region init, SpaceID %X\n", - AcpiCmFormatException (Status), RegionObj->Region.SpaceId)); + DEBUG_PRINTP (ACPI_ERROR, ("%s from region init, [%s]\n", + AcpiUtFormatException (Status), + AcpiUtGetRegionName (RegionObj->Region.SpaceId))); } RegionObj->Region.Flags &= ~(AOPOBJ_INITIALIZED); @@ -546,7 +543,7 @@ AcpiEvDisassociateRegionFromHandler( /* * If we get here, the region was not in the handler's region list */ - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("Cannot remove region %p from address handler %p\n", RegionObj, HandlerObj)); @@ -554,7 +551,7 @@ AcpiEvDisassociateRegionFromHandler( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvAssociateRegionAndHandler * @@ -581,8 +578,9 @@ AcpiEvAssociateRegionAndHandler ( FUNCTION_TRACE ("EvAssociateRegionAndHandler"); - DEBUG_PRINT (TRACE_OPREGION, ("Adding Region %p to address handler %p\n", - RegionObj, HandlerObj)); + DEBUG_PRINTP (TRACE_OPREGION, + ("Adding Region %p to address handler %p [%s]\n", + RegionObj, HandlerObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId))); ACPI_ASSERT (RegionObj->Region.SpaceId == HandlerObj->AddrHandler.SpaceId); ACPI_ASSERT (RegionObj->Region.AddrHandler == 0); @@ -610,21 +608,21 @@ AcpiEvAssociateRegionAndHandler ( */ if (AcpiNsIsLocked) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } Status = AcpiEvExecuteRegMethod (RegionObj, 1); if (AcpiNsIsLocked) { - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); } return_ACPI_STATUS (Status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvAddrHandlerHelper * @@ -641,7 +639,7 @@ AcpiEvAssociateRegionAndHandler ( * This is because the existing handler is closer in proximity * to any more regions than the one we are trying to install. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvAddrHandlerHelper ( @@ -657,6 +655,9 @@ AcpiEvAddrHandlerHelper ( ACPI_STATUS Status; + PROC_NAME ("EvAddrHandlerHelper"); + + HandlerObj = (ACPI_OPERAND_OBJECT *) Context; /* Parameter validation */ @@ -688,7 +689,7 @@ AcpiEvAddrHandlerHelper ( /* Check for an existing internal object */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node); + ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { /* @@ -716,10 +717,10 @@ AcpiEvAddrHandlerHelper ( /* * It's for the same address space */ - - DEBUG_PRINT (TRACE_OPREGION, - ("Found handler for region %s in device %p(%p) handler %p\n", - AcpiCmGetRegionName (HandlerObj->AddrHandler.SpaceId), ObjDesc, TmpObj, HandlerObj)); + DEBUG_PRINTP (TRACE_OPREGION, + ("Found handler for region [%s] in device %p(%p) handler %p\n", + AcpiUtGetRegionName (HandlerObj->AddrHandler.SpaceId), + ObjDesc, TmpObj, HandlerObj)); /* * Since the object we found it on was a device, then it diff --git a/sys/contrib/dev/acpica/evrgnini.c b/sys/contrib/dev/acpica/evrgnini.c index f2ed119..105ee04 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: 33 $ + * $Revision: 40 $ * *****************************************************************************/ @@ -123,11 +123,11 @@ #include "acinterp.h" #include "amlcode.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evrgnini") -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvSystemMemoryRegionSetup * @@ -140,7 +140,7 @@ * * DESCRIPTION: Do any prep work for region handling, a nop for now * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvSystemMemoryRegionSetup ( @@ -156,7 +156,7 @@ AcpiEvSystemMemoryRegionSetup ( { if (*RegionContext) { - AcpiCmFree (*RegionContext); + AcpiUtFree (*RegionContext); *RegionContext = NULL; } return_ACPI_STATUS (AE_OK); @@ -165,7 +165,7 @@ AcpiEvSystemMemoryRegionSetup ( /* Activate. Create a new context */ - *RegionContext = AcpiCmCallocate (sizeof (MEM_HANDLER_CONTEXT)); + *RegionContext = AcpiUtCallocate (sizeof (ACPI_MEM_SPACE_CONTEXT)); if (!(*RegionContext)) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -175,7 +175,7 @@ AcpiEvSystemMemoryRegionSetup ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvIoSpaceRegionSetup * @@ -188,7 +188,7 @@ AcpiEvSystemMemoryRegionSetup ( * * DESCRIPTION: Do any prep work for region handling * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvIoSpaceRegionSetup ( @@ -199,6 +199,7 @@ AcpiEvIoSpaceRegionSetup ( { FUNCTION_TRACE ("EvIoSpaceRegionSetup"); + if (Function == ACPI_REGION_DEACTIVATE) { *RegionContext = NULL; @@ -212,7 +213,7 @@ AcpiEvIoSpaceRegionSetup ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvPciConfigRegionSetup * @@ -227,7 +228,7 @@ AcpiEvIoSpaceRegionSetup ( * * MUTEX: Assumes namespace is not locked * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvPciConfigRegionSetup ( @@ -238,32 +239,33 @@ AcpiEvPciConfigRegionSetup ( { ACPI_STATUS Status = AE_OK; ACPI_INTEGER Temp; - PCI_HANDLER_CONTEXT *PciContext = *RegionContext; + ACPI_PCI_SPACE_CONTEXT *PciContext = *RegionContext; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle; - DEVICE_ID ObjectHID; + ACPI_DEVICE_ID ObjectHID; + FUNCTION_TRACE ("EvPciConfigRegionSetup"); - HandlerObj = RegionObj->Region.AddrHandler; + HandlerObj = RegionObj->Region.AddrHandler; 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. */ - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("Attempting to init a region %X, with no handler\n", RegionObj)); - return_ACPI_STATUS(AE_NOT_EXIST); + return_ACPI_STATUS (AE_NOT_EXIST); } if (Function == ACPI_REGION_DEACTIVATE) { if (PciContext) { - AcpiCmFree (PciContext); + AcpiUtFree (PciContext); *RegionContext = NULL; } @@ -273,7 +275,7 @@ AcpiEvPciConfigRegionSetup ( /* Create a new context */ - PciContext = AcpiCmCallocate (sizeof(PCI_HANDLER_CONTEXT)); + PciContext = AcpiUtCallocate (sizeof (ACPI_PCI_SPACE_CONTEXT)); if (!PciContext) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -288,23 +290,21 @@ AcpiEvPciConfigRegionSetup ( * First get device and function numbers from the _ADR object * in the parent's scope. */ - ACPI_ASSERT(RegionObj->Region.Node); + ACPI_ASSERT (RegionObj->Region.Node); Node = AcpiNsGetParentObject (RegionObj->Region.Node); /* AcpiEvaluate the _ADR object */ - Status = AcpiCmEvaluateNumericObject (METHOD_NAME__ADR, Node, &Temp); + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &Temp); + /* * The default is zero, since the allocation above zeroed the data, just * do nothing on failures. */ if (ACPI_SUCCESS (Status)) { - /* - * Got it.. - */ PciContext->DevFunc = (UINT32) Temp; } @@ -328,22 +328,20 @@ AcpiEvPciConfigRegionSetup ( */ while (Node != AcpiGbl_RootNode) { - Status = AcpiCmExecute_HID(Node, &ObjectHID); - + Status = AcpiUtExecute_HID (Node, &ObjectHID); if (ACPI_SUCCESS (Status)) { - if (!(STRNCMP(ObjectHID.Buffer, PCI_ROOT_HID_STRING, + if (!(STRNCMP (ObjectHID.Buffer, PCI_ROOT_HID_STRING, sizeof (PCI_ROOT_HID_STRING)))) { - AcpiInstallAddressSpaceHandler(Node, - ADDRESS_SPACE_PCI_CONFIG, + AcpiInstallAddressSpaceHandler (Node, + ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL); - break; } } - Node = AcpiNsGetParentObject(Node); + Node = AcpiNsGetParentObject (Node); } } else @@ -351,21 +349,15 @@ AcpiEvPciConfigRegionSetup ( Node = HandlerObj->AddrHandler.Node; } - Status = AcpiCmEvaluateNumericObject (METHOD_NAME__SEG, Node, &Temp); + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__SEG, Node, &Temp); if (ACPI_SUCCESS (Status)) { - /* - * Got it.. - */ PciContext->Seg = (UINT32) Temp; } - Status = AcpiCmEvaluateNumericObject (METHOD_NAME__BBN, Node, &Temp); + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__BBN, Node, &Temp); if (ACPI_SUCCESS (Status)) { - /* - * Got it.. - */ PciContext->Bus = (UINT32) Temp; } @@ -375,7 +367,7 @@ AcpiEvPciConfigRegionSetup ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvDefaultRegionSetup * @@ -388,7 +380,7 @@ AcpiEvPciConfigRegionSetup ( * * DESCRIPTION: Do any prep work for region handling * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEvDefaultRegionSetup ( @@ -399,6 +391,7 @@ AcpiEvDefaultRegionSetup ( { FUNCTION_TRACE ("EvDefaultRegionSetup"); + if (Function == ACPI_REGION_DEACTIVATE) { *RegionContext = NULL; @@ -412,7 +405,7 @@ AcpiEvDefaultRegionSetup ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEvInitializeRegion * @@ -428,7 +421,7 @@ AcpiEvDefaultRegionSetup ( * * This also performs address space specific intialization. For * example, PCI regions must have an _ADR object that contains - * a PCI address in the scope of the defintion. This address is + * a PCI address in the scope of the definition. This address is * required to perform an access to PCI config space. * ******************************************************************************/ @@ -438,13 +431,13 @@ AcpiEvInitializeRegion ( ACPI_OPERAND_OBJECT *RegionObj, BOOLEAN AcpiNsLocked) { - ACPI_OPERAND_OBJECT *HandlerObj; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_ADDRESS_SPACE_TYPE SpaceId; - ACPI_NAMESPACE_NODE *Node; + ACPI_OPERAND_OBJECT *HandlerObj; + ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_ADR_SPACE_TYPE SpaceId; + ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *MethodNode; - ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG; + ACPI_NAMESPACE_NODE *MethodNode; + ACPI_NAME *RegNamePtr = (ACPI_NAME *) METHOD_NAME__REG; FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked); @@ -455,7 +448,7 @@ AcpiEvInitializeRegion ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - ACPI_ASSERT(RegionObj->Region.Node); + ACPI_ASSERT (RegionObj->Region.Node); Node = AcpiNsGetParentObject (RegionObj->Region.Node); SpaceId = RegionObj->Region.SpaceId; @@ -489,7 +482,7 @@ AcpiEvInitializeRegion ( * Check to see if a handler exists */ HandlerObj = NULL; - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node); + ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { /* @@ -521,14 +514,15 @@ AcpiEvInitializeRegion ( */ if (HandlerObj->AddrHandler.SpaceId == SpaceId) { - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_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); + AcpiEvAssociateRegionAndHandler (HandlerObj, RegionObj, + AcpiNsLocked); return_ACPI_STATUS (AE_OK); } @@ -548,9 +542,9 @@ AcpiEvInitializeRegion ( /* * If we get here, there is no handler for this region */ - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("No handler for RegionType %s(%X) (RegionObj %p)\n", - AcpiCmGetRegionName (SpaceId), SpaceId, RegionObj)); + AcpiUtGetRegionName (SpaceId), SpaceId, RegionObj)); return_ACPI_STATUS (AE_NOT_EXIST); } diff --git a/sys/contrib/dev/acpica/evsci.c b/sys/contrib/dev/acpica/evsci.c index 130156c..cc27238 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: 69 $ + * $Revision: 72 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "acevents.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evsci") @@ -278,50 +278,6 @@ AcpiEvRemoveSciHandler (void) /******************************************************************************* * - * FUNCTION: AcpiEvSciCount - * - * PARAMETERS: Event Event that generated an SCI. - * - * RETURN: Number of SCI's for requested event since last time - * SciOccured() was called for this event. - * - * DESCRIPTION: Checks to see if SCI has been generated from requested source - * since the last time this function was called. - * - ******************************************************************************/ - -#ifdef ACPI_DEBUG - -UINT32 -AcpiEvSciCount ( - UINT32 Event) -{ - UINT32 Count; - - FUNCTION_TRACE ("EvSciCount"); - - /* - * Elements correspond to counts for TMR, NOT_USED, GBL, - * PWR_BTN, SLP_BTN, RTC, and GENERAL respectively. - */ - - if (Event >= NUM_FIXED_EVENTS) - { - Count = (UINT32) -1; - } - else - { - Count = AcpiGbl_EventCount[Event]; - } - - return_VALUE (Count); -} - -#endif - - -/******************************************************************************* - * * FUNCTION: AcpiEvRestoreAcpiState * * PARAMETERS: none @@ -422,12 +378,12 @@ AcpiEvTerminate (void) if (AcpiGbl_GpeRegisters) { - AcpiCmFree (AcpiGbl_GpeRegisters); + AcpiUtFree (AcpiGbl_GpeRegisters); } if (AcpiGbl_GpeInfo) { - AcpiCmFree (AcpiGbl_GpeInfo); + AcpiUtFree (AcpiGbl_GpeInfo); } return_VOID; diff --git a/sys/contrib/dev/acpica/evxface.c b/sys/contrib/dev/acpica/evxface.c index 89f9b8a..95973d4 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: 101 $ + * $Revision: 110 $ * *****************************************************************************/ @@ -124,11 +124,11 @@ #include "amlcode.h" #include "acinterp.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evxface") -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiInstallFixedEventHandler * @@ -147,23 +147,31 @@ ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32 Event, - FIXED_EVENT_HANDLER Handler, + ACPI_EVENT_HANDLER Handler, void *Context) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; FUNCTION_TRACE ("AcpiInstallFixedEventHandler"); - /* Sanity check the parameters. */ + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Parameter validation */ - if (Event >= NUM_FIXED_EVENTS) + if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_EVENTS); + AcpiUtAcquireMutex (ACPI_MTX_EVENTS); /* Don't allow two handlers. */ @@ -179,32 +187,31 @@ AcpiInstallFixedEventHandler ( AcpiGbl_FixedEventHandlers[Event].Handler = Handler; AcpiGbl_FixedEventHandlers[Event].Context = Context; - Status = AcpiEnableEvent(Event, ACPI_EVENT_FIXED); - - if (!ACPI_SUCCESS(Status)) + Status = AcpiEnableEvent (Event, ACPI_EVENT_FIXED); + if (!ACPI_SUCCESS (Status)) { - DEBUG_PRINT (ACPI_WARN, ("Could not enable fixed event.\n")); + DEBUG_PRINTP (ACPI_WARN, ("Could not enable fixed event.\n")); /* Remove the handler */ AcpiGbl_FixedEventHandlers[Event].Handler = NULL; AcpiGbl_FixedEventHandlers[Event].Context = NULL; - - Status = AE_ERROR; - goto Cleanup; } - DEBUG_PRINT (ACPI_INFO, - ("Enabled fixed event %X, Handler=%p\n", Event, Handler)); + else + { + DEBUG_PRINTP (ACPI_INFO, + ("Enabled fixed event %X, Handler=%p\n", Event, Handler)); + } Cleanup: - AcpiCmReleaseMutex (ACPI_MTX_EVENTS); + AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiRemoveFixedEventHandler * @@ -220,7 +227,7 @@ Cleanup: ACPI_STATUS AcpiRemoveFixedEventHandler ( UINT32 Event, - FIXED_EVENT_HANDLER Handler) + ACPI_EVENT_HANDLER Handler) { ACPI_STATUS Status = AE_OK; @@ -228,42 +235,50 @@ AcpiRemoveFixedEventHandler ( FUNCTION_TRACE ("AcpiRemoveFixedEventHandler"); - /* Sanity check the parameters. */ + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Parameter validation */ - if (Event >= NUM_FIXED_EVENTS) + if (Event > ACPI_EVENT_MAX) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_EVENTS); + AcpiUtAcquireMutex (ACPI_MTX_EVENTS); /* Disable the event before removing the handler - just in case... */ Status = AcpiDisableEvent(Event, ACPI_EVENT_FIXED); + /* Always Remove the handler */ + + AcpiGbl_FixedEventHandlers[Event].Handler = NULL; + AcpiGbl_FixedEventHandlers[Event].Context = NULL; + + if (!ACPI_SUCCESS(Status)) { - DEBUG_PRINT (ACPI_WARN, + DEBUG_PRINTP (ACPI_WARN, ("Could not write to fixed event enable register.\n")); - - Status = AE_ERROR; - AcpiCmReleaseMutex (ACPI_MTX_EVENTS); - return_ACPI_STATUS (Status); } - /* Remove the handler */ - - AcpiGbl_FixedEventHandlers[Event].Handler = NULL; - AcpiGbl_FixedEventHandlers[Event].Context = NULL; - - DEBUG_PRINT (ACPI_INFO, ("Disabled fixed event %X.\n", Event)); + else + { + DEBUG_PRINTP (ACPI_INFO, ("Disabled fixed event %X.\n", Event)); + } - AcpiCmReleaseMutex (ACPI_MTX_EVENTS); + AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiInstallNotifyHandler * @@ -284,7 +299,7 @@ ACPI_STATUS AcpiInstallNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, - NOTIFY_HANDLER Handler, + ACPI_NOTIFY_HANDLER Handler, void *Context) { ACPI_OPERAND_OBJECT *ObjDesc; @@ -296,6 +311,14 @@ AcpiInstallNotifyHandler ( FUNCTION_TRACE ("AcpiInstallNotifyHandler"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if ((!Handler) || @@ -304,7 +327,7 @@ AcpiInstallNotifyHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Convert and validate the device handle */ @@ -372,7 +395,7 @@ AcpiInstallNotifyHandler ( /* Check for an existing internal object */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode); + ObjDesc = AcpiNsGetAttachedObject (DeviceNode); if (ObjDesc) { @@ -392,7 +415,7 @@ AcpiInstallNotifyHandler ( { /* Create a new object */ - ObjDesc = AcpiCmCreateInternalObject (DeviceNode->Type); + ObjDesc = AcpiUtCreateInternalObject (DeviceNode->Type); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -402,7 +425,6 @@ AcpiInstallNotifyHandler ( /* Attach new object to the Node */ Status = AcpiNsAttachObject (Device, ObjDesc, (UINT8) DeviceNode->Type); - if (ACPI_FAILURE (Status)) { goto UnlockAndExit; @@ -411,7 +433,7 @@ AcpiInstallNotifyHandler ( /* Install the handler */ - NotifyObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_NOTIFY); + NotifyObj = AcpiUtCreateInternalObject (INTERNAL_TYPE_NOTIFY); if (!NotifyObj) { Status = AE_NO_MEMORY; @@ -427,6 +449,7 @@ AcpiInstallNotifyHandler ( { ObjDesc->Device.SysHandler = NotifyObj; } + else /* ACPI_DEVICE_NOTIFY */ { ObjDesc->Device.DrvHandler = NotifyObj; @@ -434,12 +457,12 @@ AcpiInstallNotifyHandler ( } UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiRemoveNotifyHandler * @@ -458,15 +481,25 @@ ACPI_STATUS AcpiRemoveNotifyHandler ( ACPI_HANDLE Device, UINT32 HandlerType, - NOTIFY_HANDLER Handler) + ACPI_NOTIFY_HANDLER Handler) { ACPI_OPERAND_OBJECT *NotifyObj; ACPI_OPERAND_OBJECT *ObjDesc; ACPI_NAMESPACE_NODE *DeviceNode; ACPI_STATUS Status = AE_OK; + FUNCTION_TRACE ("AcpiRemoveNotifyHandler"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if ((!Handler) || @@ -475,7 +508,7 @@ AcpiRemoveNotifyHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Convert and validate the device handle */ @@ -492,7 +525,7 @@ AcpiRemoveNotifyHandler ( */ if (Device == ACPI_ROOT_OBJECT) { - DEBUG_PRINT(ACPI_INFO, ("Removing notify handler for ROOT object.\n")); + DEBUG_PRINTP (ACPI_INFO, ("Removing notify handler for ROOT object.\n")); if (((HandlerType == ACPI_SYSTEM_NOTIFY) && !AcpiGbl_SysNotify.Handler) || @@ -534,7 +567,7 @@ AcpiRemoveNotifyHandler ( /* Check for an existing internal object */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) DeviceNode); + ObjDesc = AcpiNsGetAttachedObject (DeviceNode); if (!ObjDesc) { Status = AE_NOT_EXIST; @@ -570,17 +603,17 @@ AcpiRemoveNotifyHandler ( ObjDesc->Device.DrvHandler = NULL; } - AcpiCmRemoveReference (NotifyObj); + AcpiUtRemoveReference (NotifyObj); } UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiInstallGpeHandler * @@ -601,16 +634,26 @@ ACPI_STATUS AcpiInstallGpeHandler ( UINT32 GpeNumber, UINT32 Type, - GPE_HANDLER Handler, + ACPI_GPE_HANDLER Handler, void *Context) { ACPI_STATUS Status = AE_OK; + FUNCTION_TRACE ("AcpiInstallGpeHandler"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ - if (!Handler || (GpeNumber > NUM_GPE)) + if (!Handler || (GpeNumber > ACPI_GPE_MAX)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -622,7 +665,7 @@ AcpiInstallGpeHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_EVENTS); + AcpiUtAcquireMutex (ACPI_MTX_EVENTS); /* Make sure that there isn't a handler there already */ @@ -644,12 +687,12 @@ AcpiInstallGpeHandler ( AcpiHwEnableGpe (GpeNumber); Cleanup: - AcpiCmReleaseMutex (ACPI_MTX_EVENTS); + AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiRemoveGpeHandler * @@ -665,7 +708,7 @@ Cleanup: ACPI_STATUS AcpiRemoveGpeHandler ( UINT32 GpeNumber, - GPE_HANDLER Handler) + ACPI_GPE_HANDLER Handler) { ACPI_STATUS Status = AE_OK; @@ -673,9 +716,17 @@ AcpiRemoveGpeHandler ( FUNCTION_TRACE ("AcpiRemoveGpeHandler"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ - if (!Handler || (GpeNumber > NUM_GPE)) + if (!Handler || (GpeNumber > ACPI_GPE_MAX)) { return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -691,7 +742,7 @@ AcpiRemoveGpeHandler ( AcpiHwDisableGpe (GpeNumber); - AcpiCmAcquireMutex (ACPI_MTX_EVENTS); + AcpiUtAcquireMutex (ACPI_MTX_EVENTS); /* Make sure that the installed handler is the same */ @@ -708,12 +759,12 @@ AcpiRemoveGpeHandler ( AcpiGbl_GpeInfo[GpeNumber].Context = NULL; Cleanup: - AcpiCmReleaseMutex (ACPI_MTX_EVENTS); + AcpiUtReleaseMutex (ACPI_MTX_EVENTS); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiAcquireGlobalLock * @@ -732,7 +783,19 @@ AcpiAcquireGlobalLock ( ACPI_STATUS Status; - AcpiAmlEnterInterpreter (); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + Status = AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* * TBD: [Restructure] add timeout param to internal interface, and @@ -740,13 +803,13 @@ AcpiAcquireGlobalLock ( */ Status = AcpiEvAcquireGlobalLock (); - AcpiAmlExitInterpreter (); + AcpiExExitInterpreter (); return (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiReleaseGlobalLock * @@ -762,6 +825,17 @@ ACPI_STATUS AcpiReleaseGlobalLock ( void) { + ACPI_STATUS Status; + + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + AcpiEvReleaseGlobalLock (); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/evxfevnt.c b/sys/contrib/dev/acpica/evxfevnt.c index 463985d..5d121a8 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: 28 $ + * $Revision: 33 $ * *****************************************************************************/ @@ -124,11 +124,11 @@ #include "amlcode.h" #include "acinterp.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evxfevnt") -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnable * @@ -138,7 +138,7 @@ * * DESCRIPTION: Transfers the system into ACPI mode. * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiEnable (void) @@ -153,7 +153,7 @@ AcpiEnable (void) if (!AcpiGbl_DSDT) { - DEBUG_PRINT (ACPI_WARN, ("No ACPI tables present!\n")); + DEBUG_PRINTP (ACPI_WARN, ("No ACPI tables present!\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -161,8 +161,7 @@ AcpiEnable (void) if (SYS_MODE_LEGACY == AcpiHwGetModeCapabilities()) { - DEBUG_PRINT (ACPI_WARN, - ("AcpiEnable: Only legacy mode supported!\n")); + DEBUG_PRINTP (ACPI_WARN, ("Only legacy mode supported!\n")); return_ACPI_STATUS (AE_ERROR); } @@ -171,17 +170,17 @@ AcpiEnable (void) Status = AcpiHwSetMode (SYS_MODE_ACPI); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_FATAL, ("Could not transition to ACPI mode.\n")); + DEBUG_PRINTP (ACPI_FATAL, ("Could not transition to ACPI mode.\n")); return_ACPI_STATUS (Status); } - DEBUG_PRINT (ACPI_OK, ("Transition to ACPI mode successful\n")); + DEBUG_PRINTP (ACPI_OK, ("Transition to ACPI mode successful\n")); return_ACPI_STATUS (Status); } -/************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDisable * @@ -192,7 +191,7 @@ AcpiEnable (void) * DESCRIPTION: Returns the system to original ACPI/legacy mode, and * uninstalls the SCI interrupt handler. * - *************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiDisable (void) @@ -203,12 +202,20 @@ AcpiDisable (void) FUNCTION_TRACE ("AcpiDisable"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Restore original mode */ Status = AcpiHwSetMode (AcpiGbl_OriginalMode); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, ("Unable to transition to original mode")); + DEBUG_PRINTP (ACPI_ERROR, ("Unable to transition to original mode")); return_ACPI_STATUS (Status); } @@ -221,7 +228,7 @@ AcpiDisable (void) } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiEnableEvent * @@ -246,6 +253,14 @@ AcpiEnableEvent ( FUNCTION_TRACE ("AcpiEnableEvent"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -291,8 +306,9 @@ AcpiEnableEvent ( if (1 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId)) { - DEBUG_PRINT(ACPI_ERROR, ("Fixed event bit clear when it should be set,\n")); - return_ACPI_STATUS (AE_ERROR); + DEBUG_PRINTP (ACPI_ERROR, + ("Fixed event bit clear when it should be set\n")); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } break; @@ -302,7 +318,7 @@ AcpiEnableEvent ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -325,7 +341,7 @@ AcpiEnableEvent ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiDisableEvent * @@ -350,6 +366,14 @@ AcpiDisableEvent ( FUNCTION_TRACE ("AcpiDisableEvent"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -395,8 +419,9 @@ AcpiDisableEvent ( if (0 != AcpiHwRegisterBitAccess(ACPI_READ, ACPI_MTX_LOCK, RegisterId)) { - DEBUG_PRINT(ACPI_ERROR, ("Fixed event bit set when it should be clear,\n")); - return_ACPI_STATUS (AE_ERROR); + DEBUG_PRINTP (ACPI_ERROR, + ("Fixed event bit set when it should be clear,\n")); + return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE); } break; @@ -406,7 +431,7 @@ AcpiDisableEvent ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -426,7 +451,7 @@ AcpiDisableEvent ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiClearEvent * @@ -451,6 +476,14 @@ AcpiClearEvent ( FUNCTION_TRACE ("AcpiClearEvent"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* The Type must be either Fixed AcpiEvent or GPE */ switch (Type) @@ -500,7 +533,7 @@ AcpiClearEvent ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -520,7 +553,7 @@ AcpiClearEvent ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiGetEventStatus * @@ -549,6 +582,14 @@ AcpiGetEventStatus ( FUNCTION_TRACE ("AcpiGetEventStatus"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (!EventStatus) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -601,7 +642,7 @@ AcpiGetEventStatus ( /* Ensure that we have a valid GPE number */ - if ((Event >= NUM_GPE) || + if ((Event > ACPI_GPE_MAX) || (AcpiGbl_GpeValid[Event] == ACPI_GPE_INVALID)) { return_ACPI_STATUS (AE_BAD_PARAMETER); diff --git a/sys/contrib/dev/acpica/evxfregn.c b/sys/contrib/dev/acpica/evxfregn.c index 7c05f50..dceafd6 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: 27 $ + * $Revision: 34 $ * *****************************************************************************/ @@ -124,11 +124,11 @@ #include "amlcode.h" #include "acinterp.h" -#define _COMPONENT EVENT_HANDLING +#define _COMPONENT ACPI_EVENTS MODULE_NAME ("evxfregn") -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiInstallAddressSpaceHandler * @@ -147,21 +147,30 @@ ACPI_STATUS AcpiInstallAddressSpaceHandler ( ACPI_HANDLE Device, - ACPI_ADDRESS_SPACE_TYPE SpaceId, - ADDRESS_SPACE_HANDLER Handler, - ADDRESS_SPACE_SETUP Setup, + ACPI_ADR_SPACE_TYPE SpaceId, + ACPI_ADR_SPACE_HANDLER Handler, + ACPI_ADR_SPACE_SETUP Setup, void *Context) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status = AE_OK; - OBJECT_TYPE_INTERNAL Type; + ACPI_OBJECT_TYPE8 Type; UINT16 Flags = 0; FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if ((!Device) || @@ -171,7 +180,7 @@ AcpiInstallAddressSpaceHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Convert and validate the device handle */ @@ -203,18 +212,18 @@ AcpiInstallAddressSpaceHandler ( switch (SpaceId) { - case ADDRESS_SPACE_SYSTEM_MEMORY: - Handler = AcpiAmlSystemMemorySpaceHandler; + case ACPI_ADR_SPACE_SYSTEM_MEMORY: + Handler = AcpiExSystemMemorySpaceHandler; Setup = AcpiEvSystemMemoryRegionSetup; break; - case ADDRESS_SPACE_SYSTEM_IO: - Handler = AcpiAmlSystemIoSpaceHandler; + case ACPI_ADR_SPACE_SYSTEM_IO: + Handler = AcpiExSystemIoSpaceHandler; Setup = AcpiEvIoSpaceRegionSetup; break; - case ADDRESS_SPACE_PCI_CONFIG: - Handler = AcpiAmlPciConfigSpaceHandler; + case ACPI_ADR_SPACE_PCI_CONFIG: + Handler = AcpiExPciConfigSpaceHandler; Setup = AcpiEvPciConfigRegionSetup; break; @@ -237,7 +246,7 @@ AcpiInstallAddressSpaceHandler ( * Check for an existing internal object */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node); + ObjDesc = AcpiNsGetAttachedObject (Node); if (ObjDesc) { /* @@ -269,9 +278,8 @@ AcpiInstallAddressSpaceHandler ( else { - DEBUG_PRINT (TRACE_OPREGION, - ("Creating object on Device %p while installing handler\n", - Node)); + DEBUG_PRINTP (TRACE_OPREGION, + ("Creating object on Device %p while installing handler\n", Node)); /* ObjDesc does not exist, create one */ @@ -285,7 +293,7 @@ AcpiInstallAddressSpaceHandler ( Type = Node->Type; } - ObjDesc = AcpiCmCreateInternalObject (Type); + ObjDesc = AcpiUtCreateInternalObject (Type); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -301,14 +309,14 @@ AcpiInstallAddressSpaceHandler ( Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Type); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); goto UnlockAndExit; } } - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("Installing address handler for region %s(%X) on Device %p(%p)\n", - AcpiCmGetRegionName (SpaceId), SpaceId, Node, ObjDesc)); + AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc)); /* * Now we can install the handler @@ -317,7 +325,7 @@ AcpiInstallAddressSpaceHandler ( * So, we just allocate the object for the handler and link it * into the list. */ - HandlerObj = AcpiCmCreateInternalObject (INTERNAL_TYPE_ADDRESS_HANDLER); + HandlerObj = AcpiUtCreateInternalObject (INTERNAL_TYPE_ADDRESS_HANDLER); if (!HandlerObj) { Status = AE_NO_MEMORY; @@ -361,12 +369,12 @@ AcpiInstallAddressSpaceHandler ( UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiRemoveAddressSpaceHandler * @@ -382,8 +390,8 @@ UnlockAndExit: ACPI_STATUS AcpiRemoveAddressSpaceHandler ( ACPI_HANDLE Device, - ACPI_ADDRESS_SPACE_TYPE SpaceId, - ADDRESS_SPACE_HANDLER Handler) + ACPI_ADR_SPACE_TYPE SpaceId, + ACPI_ADR_SPACE_HANDLER Handler) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *HandlerObj; @@ -396,6 +404,14 @@ AcpiRemoveAddressSpaceHandler ( FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if ((!Device) || @@ -405,7 +421,7 @@ AcpiRemoveAddressSpaceHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Convert and validate the device handle */ @@ -419,7 +435,7 @@ AcpiRemoveAddressSpaceHandler ( /* Make sure the internal object exists */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node); + ObjDesc = AcpiNsGetAttachedObject (Node); if (!ObjDesc) { /* @@ -446,9 +462,9 @@ AcpiRemoveAddressSpaceHandler ( /* * Got it, first dereference this in the Regions */ - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("Removing address handler %p(%p) for region %s on Device %p(%p)\n", - HandlerObj, Handler, AcpiCmGetRegionName (SpaceId), + HandlerObj, Handler, AcpiUtGetRegionName (SpaceId), Node, ObjDesc)); RegionObj = HandlerObj->AddrHandler.RegionList; @@ -464,7 +480,7 @@ AcpiRemoveAddressSpaceHandler ( * The region is just inaccessible as indicated to * the _REG method */ - AcpiEvDisassociateRegionFromHandler(RegionObj, FALSE); + AcpiEvDisassociateRegionFromHandler(RegionObj, TRUE); /* * Walk the list, since we took the first region and it @@ -483,8 +499,8 @@ AcpiRemoveAddressSpaceHandler ( /* * Now we can delete the handler object */ - AcpiCmRemoveReference (HandlerObj); - AcpiCmRemoveReference (HandlerObj); + AcpiUtRemoveReference (HandlerObj); + AcpiUtRemoveReference (HandlerObj); goto UnlockAndExit; } @@ -500,15 +516,15 @@ AcpiRemoveAddressSpaceHandler ( /* * The handler does not exist */ - DEBUG_PRINT (TRACE_OPREGION, + DEBUG_PRINTP (TRACE_OPREGION, ("Unable to remove address handler %p for %s(%X), DevNode %p, obj %p\n", - Handler, AcpiCmGetRegionName (SpaceId), SpaceId, Node, ObjDesc)); + Handler, AcpiUtGetRegionName (SpaceId), SpaceId, Node, ObjDesc)); Status = AE_NOT_EXIST; UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exconfig.c b/sys/contrib/dev/acpica/exconfig.c index b69170e..d5ca43d 100644 --- a/sys/contrib/dev/acpica/exconfig.c +++ b/sys/contrib/dev/acpica/exconfig.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 29 $ + * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) + * $Revision: 34 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMCONFIG_C__ +#define __EXCONFIG_C__ #include "acpi.h" #include "acparser.h" @@ -127,13 +127,13 @@ #include "acdispat.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amconfig") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exconfig") /***************************************************************************** * - * FUNCTION: AcpiAmlExecLoadTable + * FUNCTION: AcpiExLoadTableOp * * PARAMETERS: RgnDesc - Op region where the table will be obtained * DdbHandle - Where a handle to the table will be returned @@ -145,7 +145,7 @@ ****************************************************************************/ static ACPI_STATUS -AcpiAmlExecLoadTable ( +AcpiExLoadTableOp ( ACPI_OPERAND_OBJECT *RgnDesc, ACPI_HANDLE *DdbHandle) { @@ -158,7 +158,7 @@ AcpiAmlExecLoadTable ( UINT32 i; - FUNCTION_TRACE ("AmlExecLoadTable"); + FUNCTION_TRACE ("ExLoadTable"); /* TBD: [Unhandled] Object can be either a field or an opregion */ @@ -168,7 +168,7 @@ AcpiAmlExecLoadTable ( TableHeader.Length = 0; for (i = 0; i < sizeof (ACPI_TABLE_HEADER); i++) { - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE, (ACPI_PHYSICAL_ADDRESS) i, 8, (UINT32 *) ((UINT8 *) &TableHeader + i)); if (ACPI_FAILURE (Status)) @@ -179,7 +179,7 @@ AcpiAmlExecLoadTable ( /* Allocate a buffer for the entire table */ - TablePtr = AcpiCmAllocate (TableHeader.Length); + TablePtr = AcpiUtAllocate (TableHeader.Length); if (!TablePtr) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -195,8 +195,8 @@ AcpiAmlExecLoadTable ( for (i = 0; i < TableHeader.Length; i++) { - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, - (ACPI_PHYSICAL_ADDRESS)i, 8, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE, + (ACPI_PHYSICAL_ADDRESS) i, 8, (UINT32 *) (TableDataPtr + i)); if (ACPI_FAILURE (Status)) { @@ -214,7 +214,7 @@ AcpiAmlExecLoadTable ( AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].Signature, AcpiGbl_AcpiTableData[ACPI_TABLE_SSDT].SigLength))) { - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Table has invalid signature [%4.4s], must be SSDT or PSDT\n", TableHeader.Signature)); Status = AE_BAD_SIGNATURE; @@ -223,7 +223,7 @@ AcpiAmlExecLoadTable ( /* Create an object to be the table handle */ - TableDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE); + TableDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE); if (!TableDesc) { Status = AE_NO_MEMORY; @@ -263,7 +263,7 @@ AcpiAmlExecLoadTable ( /* Init the table handle */ - TableDesc->Reference.OpCode = AML_LOAD_OP; + TableDesc->Reference.Opcode = AML_LOAD_OP; TableDesc->Reference.Object = TableInfo.InstalledDesc; *DdbHandle = TableDesc; @@ -273,8 +273,8 @@ AcpiAmlExecLoadTable ( Cleanup: - AcpiCmFree (TableDesc); - AcpiCmFree (TablePtr); + AcpiUtFree (TableDesc); + AcpiUtFree (TablePtr); return_ACPI_STATUS (Status); } @@ -282,7 +282,7 @@ Cleanup: /***************************************************************************** * - * FUNCTION: AcpiAmlExecUnloadTable + * FUNCTION: AcpiExUnloadTable * * PARAMETERS: DdbHandle - Handle to a previously loaded table * @@ -293,7 +293,7 @@ Cleanup: ****************************************************************************/ static ACPI_STATUS -AcpiAmlExecUnloadTable ( +AcpiExUnloadTable ( ACPI_HANDLE DdbHandle) { ACPI_STATUS Status = AE_NOT_IMPLEMENTED; @@ -301,12 +301,12 @@ AcpiAmlExecUnloadTable ( ACPI_TABLE_DESC *TableInfo; - FUNCTION_TRACE ("AmlExecUnloadTable"); + FUNCTION_TRACE ("ExUnloadTable"); /* Validate the handle */ - /* Although the handle is partially validated in AcpiAmlExecReconfiguration(), - * when it calls AcpiAmlResolveOperands(), the handle is more completely + /* Although the handle is partially validated in AcpiExReconfiguration(), + * when it calls AcpiExResolveOperands(), the handle is more completely * validated here. */ @@ -340,7 +340,7 @@ AcpiAmlExecUnloadTable ( /* Delete the table descriptor (DdbHandle) */ - AcpiCmRemoveReference (TableDesc); + AcpiUtRemoveReference (TableDesc); return_ACPI_STATUS (Status); } @@ -348,7 +348,7 @@ AcpiAmlExecUnloadTable ( /***************************************************************************** * - * FUNCTION: AcpiAmlExecReconfiguration + * FUNCTION: AcpiExReconfiguration * * PARAMETERS: Opcode - The opcode to be executed * WalkState - Current state of the parse tree walk @@ -360,7 +360,7 @@ AcpiAmlExecUnloadTable ( ****************************************************************************/ ACPI_STATUS -AcpiAmlExecReconfiguration ( +AcpiExReconfiguration ( UINT16 Opcode, ACPI_WALK_STATE *WalkState) { @@ -369,14 +369,14 @@ AcpiAmlExecReconfiguration ( ACPI_HANDLE *DdbHandle; - FUNCTION_TRACE ("AmlExecReconfiguration"); + FUNCTION_TRACE ("ExReconfiguration"); /* Resolve the operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 2, "after AcpiAmlResolveOperands"); + 2, "after AcpiExResolveOperands"); /* Get the table handle, common for both opcodes */ @@ -393,15 +393,14 @@ AcpiAmlExecReconfiguration ( Status |= AcpiDsObjStackPopObject (&RegionDesc, WalkState); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecReconfiguration/AML_LOAD_OP: bad operand(s) (%X)\n", - Status)); + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (Load) (%s)\n", + AcpiUtFormatException (Status))); - AcpiCmRemoveReference (RegionDesc); + AcpiUtRemoveReference (RegionDesc); return_ACPI_STATUS (Status); } - Status = AcpiAmlExecLoadTable (RegionDesc, DdbHandle); + Status = AcpiExLoadTableOp (RegionDesc, DdbHandle); break; @@ -409,22 +408,19 @@ AcpiAmlExecReconfiguration ( if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecReconfiguration/AML_UNLOAD_OP: bad operand(s) (%X)\n", - Status)); + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (unload) (%s)\n", + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } - Status = AcpiAmlExecUnloadTable (DdbHandle); + Status = AcpiExUnloadTable (DdbHandle); break; default: - DEBUG_PRINT (ACPI_ERROR, ("AmlExecReconfiguration: bad opcode=%X\n", - Opcode)); - + DEBUG_PRINTP (ACPI_ERROR, ("bad opcode=%X\n", Opcode)); Status = AE_AML_BAD_OPCODE; break; } diff --git a/sys/contrib/dev/acpica/exconvrt.c b/sys/contrib/dev/acpica/exconvrt.c index 9aa444e..f7c8aea 100644 --- a/sys/contrib/dev/acpica/exconvrt.c +++ b/sys/contrib/dev/acpica/exconvrt.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amconvrt - Object conversion routines - * $Revision: 3 $ + * Module Name: exconvrt - Object conversion routines + * $Revision: 13 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __AMCONVRT_C__ +#define __EXCONVRT_C__ #include "acpi.h" #include "acparser.h" @@ -126,143 +126,13 @@ #include "acdispat.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amconvrt") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exconvrt") /******************************************************************************* * - * FUNCTION: AcpiAmlConvertToTargetType - * - * PARAMETERS: *ObjDesc - Object to be converted. - * WalkState - Current method state - * - * RETURN: Status - * - * DESCRIPTION: - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAmlConvertToTargetType ( - OBJECT_TYPE_INTERNAL DestinationType, - ACPI_OPERAND_OBJECT **ObjDesc, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - - - FUNCTION_TRACE ("AmlConvertToTargetType"); - - - /* - * If required by the target, - * perform implicit conversion on the source before we store it. - */ - - switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs)) - { - case ARGI_SIMPLE_TARGET: - case ARGI_FIXED_TARGET: - case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ - - switch (DestinationType) - { - case INTERNAL_TYPE_DEF_FIELD: - /* - * Named field can always handle conversions - */ - break; - - default: - /* No conversion allowed for these types */ - - if (DestinationType != (*ObjDesc)->Common.Type) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlConvertToTargetType: Target does not allow conversion of type %s to %s\n", - AcpiCmGetTypeName ((*ObjDesc)->Common.Type), - AcpiCmGetTypeName (DestinationType))); - Status = AE_TYPE; - } - } - break; - - - case ARGI_TARGETREF: - - switch (DestinationType) - { - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_FIELD_UNIT: - case INTERNAL_TYPE_BANK_FIELD: - case INTERNAL_TYPE_INDEX_FIELD: - /* - * These types require an Integer operand. We can convert - * a Buffer or a String to an Integer if necessary. - */ - Status = AcpiAmlConvertToInteger (ObjDesc, WalkState); - break; - - - case ACPI_TYPE_STRING: - - /* - * The operand must be a String. We can convert an - * Integer or Buffer if necessary - */ - Status = AcpiAmlConvertToString (ObjDesc, WalkState); - break; - - - case ACPI_TYPE_BUFFER: - - /* - * The operand must be a String. We can convert an - * Integer or Buffer if necessary - */ - Status = AcpiAmlConvertToBuffer (ObjDesc, WalkState); - break; - } - break; - - - case ARGI_REFERENCE: - /* - * CreateXxxxField cases - we are storing the field object into the name - */ - break; - - - default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlConvertToTargetType: Unknown Target type ID 0x%X Op %s DestType %s\n", - GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs), - WalkState->OpInfo->Name, - AcpiCmGetTypeName (DestinationType))); - - Status = AE_AML_INTERNAL; - } - - - /* - * Source-to-Target conversion semantics: - * - * If conversion to the target type cannot be performed, then simply - * overwrite the target with the new object and type. - */ - if (Status == AE_TYPE) - { - Status = AE_OK; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiAmlConvertToInteger + * FUNCTION: AcpiExConvertToInteger * * PARAMETERS: *ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String @@ -275,7 +145,7 @@ AcpiAmlConvertToTargetType ( ******************************************************************************/ ACPI_STATUS -AcpiAmlConvertToInteger ( +AcpiExConvertToInteger ( ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState) { @@ -309,7 +179,7 @@ AcpiAmlConvertToInteger ( /* * Create a new integer */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { return (AE_NO_MEMORY); @@ -389,7 +259,7 @@ AcpiAmlConvertToInteger ( if (WalkState->Opcode != AML_STORE_OP) { - AcpiCmRemoveReference (*ObjDesc); + AcpiUtRemoveReference (*ObjDesc); } *ObjDesc = RetDesc; @@ -400,7 +270,7 @@ AcpiAmlConvertToInteger ( /******************************************************************************* * - * FUNCTION: AcpiAmlConvertToBuffer + * FUNCTION: AcpiExConvertToBuffer * * PARAMETERS: *ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String @@ -413,7 +283,7 @@ AcpiAmlConvertToInteger ( ******************************************************************************/ ACPI_STATUS -AcpiAmlConvertToBuffer ( +AcpiExConvertToBuffer ( ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState) { @@ -430,7 +300,7 @@ AcpiAmlConvertToBuffer ( /* * Create a new Buffer */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!RetDesc) { return (AE_NO_MEMORY); @@ -451,12 +321,12 @@ AcpiAmlConvertToBuffer ( /* Need enough space for one integers */ RetDesc->Buffer.Length = IntegerSize; - NewBuf = AcpiCmCallocate (IntegerSize); + NewBuf = AcpiUtCallocate (IntegerSize); if (!NewBuf) { REPORT_ERROR - (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n")); - AcpiCmRemoveReference (RetDesc); + (("ExDyadic2R/ConcatOp: Buffer allocation failure\n")); + AcpiUtRemoveReference (RetDesc); return (AE_NO_MEMORY); } @@ -472,7 +342,7 @@ AcpiAmlConvertToBuffer ( if (WalkState->Opcode != AML_STORE_OP) { - AcpiCmRemoveReference (*ObjDesc); + AcpiUtRemoveReference (*ObjDesc); } *ObjDesc = RetDesc; break; @@ -497,7 +367,7 @@ AcpiAmlConvertToBuffer ( /******************************************************************************* * - * FUNCTION: AcpiAmlConvertToString + * FUNCTION: AcpiExConvertToString * * PARAMETERS: *ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String @@ -510,7 +380,7 @@ AcpiAmlConvertToBuffer ( ******************************************************************************/ ACPI_STATUS -AcpiAmlConvertToString ( +AcpiExConvertToString ( ACPI_OPERAND_OBJECT **ObjDesc, ACPI_WALK_STATE *WalkState) { @@ -529,7 +399,7 @@ AcpiAmlConvertToString ( /* * Create a new String */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); if (!RetDesc) { return (AE_NO_MEMORY); @@ -550,12 +420,12 @@ AcpiAmlConvertToString ( /* Need enough space for one ASCII integer plus null terminator */ RetDesc->String.Length = (IntegerSize * 2) + 1; - NewBuf = AcpiCmCallocate (RetDesc->String.Length); + NewBuf = AcpiUtCallocate (RetDesc->String.Length); if (!NewBuf) { REPORT_ERROR - (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n")); - AcpiCmRemoveReference (RetDesc); + (("ExConvertToString: Buffer allocation failure\n")); + AcpiUtRemoveReference (RetDesc); return (AE_NO_MEMORY); } @@ -575,7 +445,7 @@ AcpiAmlConvertToString ( if (WalkState->Opcode != AML_STORE_OP) { - AcpiCmRemoveReference (*ObjDesc); + AcpiUtRemoveReference (*ObjDesc); } *ObjDesc = RetDesc; @@ -592,7 +462,7 @@ AcpiAmlConvertToString ( /* * Create a new String */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); if (!RetDesc) { return (AE_NO_MEMORY); @@ -601,12 +471,12 @@ AcpiAmlConvertToString ( /* Need enough space for one ASCII integer plus null terminator */ RetDesc->String.Length = (*ObjDesc)->Buffer.Length * 3; - NewBuf = AcpiCmCallocate (RetDesc->String.Length + 1); + NewBuf = AcpiUtCallocate (RetDesc->String.Length + 1); if (!NewBuf) { REPORT_ERROR - (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n")); - AcpiCmRemoveReference (RetDesc); + (("ExConvertToString: Buffer allocation failure\n")); + AcpiUtRemoveReference (RetDesc); return (AE_NO_MEMORY); } @@ -632,7 +502,7 @@ AcpiAmlConvertToString ( if (WalkState->Opcode != AML_STORE_OP) { - AcpiCmRemoveReference (*ObjDesc); + AcpiUtRemoveReference (*ObjDesc); } *ObjDesc = RetDesc; break; @@ -651,3 +521,132 @@ AcpiAmlConvertToString ( } +/******************************************************************************* + * + * FUNCTION: AcpiExConvertToTargetType + * + * PARAMETERS: *ObjDesc - Object to be converted. + * WalkState - Current method state + * + * RETURN: Status + * + * DESCRIPTION: + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExConvertToTargetType ( + ACPI_OBJECT_TYPE8 DestinationType, + ACPI_OPERAND_OBJECT **ObjDesc, + ACPI_WALK_STATE *WalkState) +{ + ACPI_STATUS Status = AE_OK; + + + FUNCTION_TRACE ("ExConvertToTargetType"); + + + /* + * If required by the target, + * perform implicit conversion on the source before we store it. + */ + + switch (GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs)) + { + case ARGI_SIMPLE_TARGET: + case ARGI_FIXED_TARGET: + case ARGI_INTEGER_REF: /* Handles Increment, Decrement cases */ + + switch (DestinationType) + { + case INTERNAL_TYPE_REGION_FIELD: + /* + * Named field can always handle conversions + */ + break; + + default: + /* No conversion allowed for these types */ + + if (DestinationType != (*ObjDesc)->Common.Type) + { + DEBUG_PRINTP (ACPI_ERROR, + ("Target does not allow conversion of type %s to %s\n", + AcpiUtGetTypeName ((*ObjDesc)->Common.Type), + AcpiUtGetTypeName (DestinationType))); + Status = AE_TYPE; + } + } + break; + + + case ARGI_TARGETREF: + + switch (DestinationType) + { + case ACPI_TYPE_INTEGER: + case ACPI_TYPE_BUFFER_FIELD: + case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: + /* + * These types require an Integer operand. We can convert + * a Buffer or a String to an Integer if necessary. + */ + Status = AcpiExConvertToInteger (ObjDesc, WalkState); + break; + + + case ACPI_TYPE_STRING: + + /* + * The operand must be a String. We can convert an + * Integer or Buffer if necessary + */ + Status = AcpiExConvertToString (ObjDesc, WalkState); + break; + + + case ACPI_TYPE_BUFFER: + + /* + * The operand must be a String. We can convert an + * Integer or Buffer if necessary + */ + Status = AcpiExConvertToBuffer (ObjDesc, WalkState); + break; + } + break; + + + case ARGI_REFERENCE: + /* + * CreateXxxxField cases - we are storing the field object into the name + */ + break; + + + default: + DEBUG_PRINTP (ACPI_ERROR, + ("Unknown Target type ID 0x%X Op %s DestType %s\n", + GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs), + WalkState->OpInfo->Name, AcpiUtGetTypeName (DestinationType))); + + Status = AE_AML_INTERNAL; + } + + + /* + * Source-to-Target conversion semantics: + * + * If conversion to the target type cannot be performed, then simply + * overwrite the target with the new object and type. + */ + if (Status == AE_TYPE) + { + Status = AE_OK; + } + + return_ACPI_STATUS (Status); +} + + diff --git a/sys/contrib/dev/acpica/excreate.c b/sys/contrib/dev/acpica/excreate.c index e02df3c..57c0c88 100644 --- a/sys/contrib/dev/acpica/excreate.c +++ b/sys/contrib/dev/acpica/excreate.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amcreate - Named object creation - * $Revision: 53 $ + * Module Name: excreate - Named object creation + * $Revision: 63 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMCREATE_C__ +#define __EXCREATE_C__ #include "acpi.h" #include "acparser.h" @@ -126,13 +126,13 @@ #include "acdispat.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amcreate") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("excreate") /******************************************************************************* * - * FUNCTION: AcpiAmlExecCreateField + * FUNCTION: AcpiExCreateBufferField * * PARAMETERS: Opcode - The opcode to be executed * Operands - List of operands for the opcode @@ -159,9 +159,8 @@ * ******************************************************************************/ - ACPI_STATUS -AcpiAmlExecCreateField ( +AcpiExCreateBufferField ( UINT8 *AmlPtr, UINT32 AmlLength, ACPI_NAMESPACE_NODE *Node, @@ -172,31 +171,26 @@ AcpiAmlExecCreateField ( ACPI_OPERAND_OBJECT *TmpDesc; - FUNCTION_TRACE ("AmlExecCreateField"); + FUNCTION_TRACE ("ExCreateBufferField"); - /* Create the region descriptor */ + /* Create the descriptor */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_FIELD_UNIT); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD); if (!ObjDesc) { Status = AE_NO_MEMORY; goto Cleanup; } - /* Construct the field object */ - - ObjDesc->FieldUnit.Access = (UINT8) ACCESS_ANY_ACC; - ObjDesc->FieldUnit.LockRule = (UINT8) GLOCK_NEVER_LOCK; - ObjDesc->FieldUnit.UpdateRule = (UINT8) UPDATE_PRESERVE; /* * Allocate a method object for this field unit */ - ObjDesc->FieldUnit.Extra = AcpiCmCreateInternalObject ( - INTERNAL_TYPE_EXTRA); - if (!ObjDesc->FieldUnit.Extra) + ObjDesc->BufferField.Extra = AcpiUtCreateInternalObject ( + INTERNAL_TYPE_EXTRA); + if (!ObjDesc->BufferField.Extra) { Status = AE_NO_MEMORY; goto Cleanup; @@ -208,19 +202,19 @@ AcpiAmlExecCreateField ( * operands must be evaluated. */ - ObjDesc->FieldUnit.Extra->Extra.Pcode = AmlPtr; - ObjDesc->FieldUnit.Extra->Extra.PcodeLength = AmlLength; - ObjDesc->FieldUnit.Node = Node; + ObjDesc->BufferField.Extra->Extra.Pcode = AmlPtr; + ObjDesc->BufferField.Extra->Extra.PcodeLength = AmlLength; + ObjDesc->BufferField.Node = Node; /* * This operation is supposed to cause the destination Name to refer - * to the defined FieldUnit -- it must not store the constructed - * FieldUnit object (or its current value) in some location that the + * to the defined BufferField -- it must not store the constructed + * BufferField object (or its current value) in some location that the * Name may already be pointing to. So, if the Name currently contains - * a reference which would cause AcpiAmlExecStore() to perform an indirect + * a reference which would cause AcpiExStore() to perform an indirect * store rather than setting the value of the Name itself, clobber that - * reference before calling AcpiAmlExecStore(). + * reference before calling AcpiExStore(). */ /* Type of Name's existing value */ @@ -228,11 +222,10 @@ AcpiAmlExecCreateField ( switch (AcpiNsGetType (Node)) { - case ACPI_TYPE_FIELD_UNIT: - + case ACPI_TYPE_BUFFER_FIELD: case INTERNAL_TYPE_ALIAS: + case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: - case INTERNAL_TYPE_DEF_FIELD: case INTERNAL_TYPE_INDEX_FIELD: TmpDesc = AcpiNsGetAttachedObject (Node); @@ -244,13 +237,13 @@ AcpiAmlExecCreateField ( */ DUMP_PATHNAME (Node, - "AmlExecCreateField: Removing Current Reference", + "ExCreateBufferField: Removing Current Reference", TRACE_BFIELD, _COMPONENT); DUMP_ENTRY (Node, TRACE_BFIELD); DUMP_STACK_ENTRY (TmpDesc); - AcpiCmRemoveReference (TmpDesc); + AcpiUtRemoveReference (TmpDesc); AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Node, NULL, ACPI_TYPE_ANY); } @@ -270,7 +263,8 @@ AcpiAmlExecCreateField ( /* Store constructed field descriptor in result location */ - Status = AcpiAmlExecStore (ObjDesc, (ACPI_OPERAND_OBJECT *) Node, WalkState); + Status = AcpiExStore (ObjDesc, (ACPI_OPERAND_OBJECT *) Node, + WalkState); /* * If the field descriptor was not physically stored (or if a failure @@ -278,7 +272,7 @@ AcpiAmlExecCreateField ( */ if (ObjDesc->Common.ReferenceCount <= 1) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } @@ -293,7 +287,7 @@ Cleanup: { /* Remove deletes both objects! */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; } @@ -303,9 +297,10 @@ Cleanup: /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreateAlias + * FUNCTION: AcpiExCreateAlias * - * PARAMETERS: Operands - List of operands for the opcode + * PARAMETERS: WalkState - Current state, contains List of + * operands for the opcode * * RETURN: Status * @@ -314,7 +309,7 @@ Cleanup: ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreateAlias ( +AcpiExCreateAlias ( ACPI_WALK_STATE *WalkState) { ACPI_NAMESPACE_NODE *SourceNode; @@ -322,10 +317,10 @@ AcpiAmlExecCreateAlias ( ACPI_STATUS Status; - FUNCTION_TRACE ("AmlExecCreateAlias"); + FUNCTION_TRACE ("ExCreateAlias"); - /* Get the source/alias operands (both NTEs) */ + /* Get the source/alias operands (both namespace nodes) */ Status = AcpiDsObjStackPopObject ((ACPI_OPERAND_OBJECT **) &SourceNode, WalkState); @@ -337,12 +332,11 @@ AcpiAmlExecCreateAlias ( /* * Don't pop it, it gets removed in the calling routine */ - AliasNode = AcpiDsObjStackGetValue (0, WalkState); /* Add an additional reference to the object */ - AcpiCmAddReference (SourceNode->Object); + AcpiUtAddReference (SourceNode->Object); /* * Attach the original source Node to the new Alias Node. @@ -358,7 +352,7 @@ AcpiAmlExecCreateAlias ( * source or the alias Node */ - /* Since both operands are NTEs, we don't need to delete them */ + /* Since both operands are Nodes, we don't need to delete them */ return_ACPI_STATUS (Status); } @@ -366,7 +360,7 @@ AcpiAmlExecCreateAlias ( /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreateEvent + * FUNCTION: AcpiExCreateEvent * * PARAMETERS: None * @@ -377,19 +371,19 @@ AcpiAmlExecCreateAlias ( ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreateEvent ( +AcpiExCreateEvent ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *ObjDesc; - FUNCTION_TRACE ("AmlExecCreateEvent"); + FUNCTION_TRACE ("ExCreateEvent"); BREAKPOINT3; - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_EVENT); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -404,7 +398,7 @@ AcpiAmlExecCreateEvent ( &ObjDesc->Event.Semaphore); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); goto Cleanup; } @@ -415,7 +409,7 @@ AcpiAmlExecCreateEvent ( if (ACPI_FAILURE (Status)) { AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); goto Cleanup; } @@ -428,7 +422,7 @@ Cleanup: /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreateMutex + * FUNCTION: AcpiExCreateMutex * * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec) * Operands - List of operands for the opcode @@ -440,7 +434,7 @@ Cleanup: ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreateMutex ( +AcpiExCreateMutex ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; @@ -448,7 +442,7 @@ AcpiAmlExecCreateMutex ( ACPI_OPERAND_OBJECT *ObjDesc; - FUNCTION_TRACE_PTR ("AmlExecCreateMutex", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExCreateMutex", WALK_OPERANDS); /* Get the operand */ @@ -461,7 +455,7 @@ AcpiAmlExecCreateMutex ( /* Attempt to allocate a new object */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_MUTEX); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -473,7 +467,7 @@ AcpiAmlExecCreateMutex ( Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); goto Cleanup; } @@ -486,7 +480,7 @@ AcpiAmlExecCreateMutex ( if (ACPI_FAILURE (Status)) { AcpiOsDeleteSemaphore (ObjDesc->Mutex.Semaphore); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); goto Cleanup; } @@ -495,7 +489,7 @@ Cleanup: /* Always delete the operand */ - AcpiCmRemoveReference (SyncDesc); + AcpiUtRemoveReference (SyncDesc); return_ACPI_STATUS (Status); } @@ -503,7 +497,7 @@ Cleanup: /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreateRegion + * FUNCTION: AcpiExCreateRegion * * PARAMETERS: AmlPtr - Pointer to the region declaration AML * AmlLength - Max length of the declaration AML @@ -517,7 +511,7 @@ Cleanup: ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreateRegion ( +AcpiExCreateRegion ( UINT8 *AmlPtr, UINT32 AmlLength, UINT8 RegionSpace, @@ -528,7 +522,7 @@ AcpiAmlExecCreateRegion ( ACPI_NAMESPACE_NODE *Node; - FUNCTION_TRACE ("AmlExecCreateRegion"); + FUNCTION_TRACE ("ExCreateRegion"); /* @@ -542,8 +536,8 @@ AcpiAmlExecCreateRegion ( return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID); } - DEBUG_PRINT (TRACE_LOAD, ("AmlExecCreateRegion: Region Type - %s (%X)\n", - AcpiCmGetRegionName (RegionSpace), RegionSpace)); + DEBUG_PRINTP (TRACE_LOAD, ("Region Type - %s (%X)\n", + AcpiUtGetRegionName (RegionSpace), RegionSpace)); /* Get the Node from the object stack */ @@ -552,7 +546,7 @@ AcpiAmlExecCreateRegion ( /* Create the region descriptor */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_REGION); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -563,7 +557,7 @@ AcpiAmlExecCreateRegion ( * Allocate a method object for this region. */ - ObjDesc->Region.Extra = AcpiCmCreateInternalObject ( + ObjDesc->Region.Extra = AcpiUtCreateInternalObject ( INTERNAL_TYPE_EXTRA); if (!ObjDesc->Region.Extra) { @@ -628,7 +622,7 @@ Cleanup: { /* Remove deletes both objects! */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; } } @@ -639,11 +633,11 @@ Cleanup: /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreateProcessor + * FUNCTION: AcpiExCreateProcessor * * PARAMETERS: Op - Op containing the Processor definition and * args - * ProcessorNTE - Node for the containing Node + * ProcessorNode - Parent Node for the processor object * * RETURN: Status * @@ -652,85 +646,80 @@ Cleanup: ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreateProcessor ( +AcpiExCreateProcessor ( ACPI_PARSE_OBJECT *Op, - ACPI_HANDLE ProcessorNTE) + ACPI_NAMESPACE_NODE *ProcessorNode) { ACPI_STATUS Status; ACPI_PARSE_OBJECT *Arg; ACPI_OPERAND_OBJECT *ObjDesc; - FUNCTION_TRACE_PTR ("AmlExecCreateProcessor", Op); + FUNCTION_TRACE_PTR ("ExCreateProcessor", Op); - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_PROCESSOR); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR); if (!ObjDesc) { - Status = AE_NO_MEMORY; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_NO_MEMORY); } /* Install the new processor object in the parent Node */ - Status = AcpiNsAttachObject (ProcessorNTE, ObjDesc, + Status = AcpiNsAttachObject (ProcessorNode, ObjDesc, (UINT8) ACPI_TYPE_PROCESSOR); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS(Status); + AcpiUtDeleteObjectDesc (ObjDesc); + return_ACPI_STATUS (Status); } - Arg = Op->Value.Arg; - - /* check existence */ + /* Get first arg and verify existence */ + Arg = Op->Value.Arg; if (!Arg) { - Status = AE_AML_NO_OPERAND; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* First arg is the Processor ID */ ObjDesc->Processor.ProcId = (UINT8) Arg->Value.Integer; - /* Move to next arg and check existence */ + /* Get second arg and verify existence */ Arg = Arg->Next; if (!Arg) { - Status = AE_AML_NO_OPERAND; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* Second arg is the PBlock Address */ ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Arg->Value.Integer; - /* Move to next arg and check existence */ + /* Get third arg and verify existence */ Arg = Arg->Next; if (!Arg) { - Status = AE_AML_NO_OPERAND; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* Third arg is the PBlock Length */ ObjDesc->Processor.Length = (UINT8) Arg->Value.Integer; - return_ACPI_STATUS (AE_OK); } /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreatePowerResource + * FUNCTION: AcpiExCreatePowerResource * * PARAMETERS: Op - Op containing the PowerResource definition * and args - * PowerResNTE - Node for the containing Node + * PowerNode - Parent Node for the power object * * RETURN: Status * @@ -739,55 +728,52 @@ AcpiAmlExecCreateProcessor ( ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreatePowerResource ( +AcpiExCreatePowerResource ( ACPI_PARSE_OBJECT *Op, - ACPI_HANDLE PowerResNTE) + ACPI_NAMESPACE_NODE *PowerNode) { ACPI_STATUS Status; ACPI_PARSE_OBJECT *Arg; ACPI_OPERAND_OBJECT *ObjDesc; - FUNCTION_TRACE_PTR ("AmlExecCreatePowerResource", Op); + FUNCTION_TRACE_PTR ("ExCreatePowerResource", Op); - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_POWER); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER); if (!ObjDesc) { - Status = AE_NO_MEMORY; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_NO_MEMORY); } /* Install the new power resource object in the parent Node */ - Status = AcpiNsAttachObject (PowerResNTE, ObjDesc, + Status = AcpiNsAttachObject (PowerNode, ObjDesc, (UINT8) ACPI_TYPE_POWER); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS(Status); } - Arg = Op->Value.Arg; - /* check existence */ + /* Get first arg and verify existence */ + Arg = Op->Value.Arg; if (!Arg) { - Status = AE_AML_NO_OPERAND; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* First arg is the SystemLevel */ ObjDesc->PowerResource.SystemLevel = (UINT8) Arg->Value.Integer; - /* Move to next arg and check existence */ + /* Get second arg and check existence */ Arg = Arg->Next; if (!Arg) { - Status = AE_AML_NO_OPERAND; - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* Second arg is the PBlock Address */ @@ -800,7 +786,7 @@ AcpiAmlExecCreatePowerResource ( /***************************************************************************** * - * FUNCTION: AcpiAmlExecCreateMethod + * FUNCTION: AcpiExCreateMethod * * PARAMETERS: AmlPtr - First byte of the method's AML * AmlLength - AML byte count for this method @@ -814,22 +800,22 @@ AcpiAmlExecCreatePowerResource ( ****************************************************************************/ ACPI_STATUS -AcpiAmlExecCreateMethod ( +AcpiExCreateMethod ( UINT8 *AmlPtr, UINT32 AmlLength, UINT32 MethodFlags, - ACPI_HANDLE Method) + ACPI_NAMESPACE_NODE *Method) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; - FUNCTION_TRACE_PTR ("AmlExecCreateMethod", Method); + FUNCTION_TRACE_PTR ("ExCreateMethod", Method); /* Create a new method object */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_METHOD); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -852,15 +838,15 @@ AcpiAmlExecCreateMethod ( /* * Get the concurrency count. If required, a semaphore will be * created for this method when it is parsed. - * - * TBD: [Future] for APCI 2.0, there will be a SyncLevel value, not - * just a flag - * Concurrency = SyncLevel + 1;. */ - if (MethodFlags & METHOD_FLAGS_SERIALIZED) { - ObjDesc->Method.Concurrency = 1; + /* + * ACPI 1.0: Concurrency = 1 + * ACPI 2.0: Concurrency = (SyncLevel (in method declaration) + 1) + */ + ObjDesc->Method.Concurrency = (UINT8) + (((MethodFlags & METHOD_FLAGS_SYNCH_LEVEL) >> 4) + 1); } else @@ -873,7 +859,7 @@ AcpiAmlExecCreateMethod ( Status = AcpiNsAttachObject (Method, ObjDesc, (UINT8) ACPI_TYPE_METHOD); if (ACPI_FAILURE (Status)) { - AcpiCmDeleteObjectDesc (ObjDesc); + AcpiUtDeleteObjectDesc (ObjDesc); } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/exdump.c b/sys/contrib/dev/acpica/exdump.c index 37f67f8..55a5c0d 100644 --- a/sys/contrib/dev/acpica/exdump.c +++ b/sys/contrib/dev/acpica/exdump.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amdump - Interpreter debug output routines - * $Revision: 100 $ + * Module Name: exdump - Interpreter debug output routines + * $Revision: 114 $ * *****************************************************************************/ @@ -114,7 +114,7 @@ * *****************************************************************************/ -#define __AMDUMP_C__ +#define __EXDUMP_C__ #include "acpi.h" #include "acinterp.h" @@ -122,8 +122,8 @@ #include "acnamesp.h" #include "actables.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amdump") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exdump") /* @@ -134,7 +134,7 @@ /***************************************************************************** * - * FUNCTION: AcpiAmlShowHexValue + * FUNCTION: AcpiExShowHexValue * * PARAMETERS: ByteCount - Number of bytes to print (1, 2, or 4) * *AmlPtr - Address in AML stream of bytes to print @@ -142,14 +142,14 @@ * LeadSpace - # of spaces to print ahead of value * 0 => none ahead but one behind * - * DESCRIPTION: Print ByteCount byte(s) starting at AcpiAmlPtr as a single + * DESCRIPTION: Print ByteCount byte(s) starting at AmlPtr as a single * value, in hex. If ByteCount > 1 or the value printed is > 9, also * print in decimal. * ****************************************************************************/ void -AcpiAmlShowHexValue ( +AcpiExShowHexValue ( UINT32 ByteCount, UINT8 *AmlPtr, UINT32 LeadSpace) @@ -160,12 +160,12 @@ AcpiAmlShowHexValue ( UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */ - FUNCTION_TRACE ("AmlShowHexValue"); + FUNCTION_TRACE ("ExShowHexValue"); if (!AmlPtr) { - REPORT_ERROR (("AmlShowHexValue: null pointer\n")); + REPORT_ERROR (("ExShowHexValue: null pointer\n")); } /* @@ -188,7 +188,7 @@ AcpiAmlShowHexValue ( ShowDecimalValue = (ByteCount > 1 || Value > 9); if (ShowDecimalValue) { - Length += 3 + AcpiAmlDigitsNeeded (Value, 10); + Length += 3 + AcpiExDigitsNeeded (Value, 10); } DEBUG_PRINT (TRACE_LOAD, ("")); @@ -225,7 +225,7 @@ AcpiAmlShowHexValue ( /***************************************************************************** * - * FUNCTION: AcpiAmlDumpOperand + * FUNCTION: AcpiExDumpOperand * * PARAMETERS: *EntryDesc - Pointer to entry to be dumped * @@ -236,7 +236,7 @@ AcpiAmlShowHexValue ( ****************************************************************************/ ACPI_STATUS -AcpiAmlDumpOperand ( +AcpiExDumpOperand ( ACPI_OPERAND_OBJECT *EntryDesc) { UINT8 *Buf = NULL; @@ -244,6 +244,9 @@ AcpiAmlDumpOperand ( UINT32 i; + PROC_NAME ("ExDumpOperand") + + if (!EntryDesc) { /* @@ -251,44 +254,40 @@ AcpiAmlDumpOperand ( * since most (if not all) * code that dumps the stack expects something to be there! */ - DEBUG_PRINT (ACPI_INFO, - ("AmlDumpOperand: *** Possible error: Null stack entry ptr\n")); + DEBUG_PRINTP (ACPI_INFO, ("Null stack entry ptr\n")); return (AE_OK); } if (VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_NAMED)) { - DEBUG_PRINT (ACPI_INFO, - ("AmlDumpOperand: Node: \n")); + DEBUG_PRINTP (ACPI_INFO, ("Node: \n")); DUMP_ENTRY (EntryDesc, ACPI_INFO); return (AE_OK); } if (AcpiTbSystemTablePointer (EntryDesc)) { - DEBUG_PRINT (ACPI_INFO, - ("AmlDumpOperand: %p is a Pcode pointer\n", + DEBUG_PRINTP (ACPI_INFO, ("%p is an AML pointer\n", EntryDesc)); return (AE_OK); } if (!VALID_DESCRIPTOR_TYPE (EntryDesc, ACPI_DESC_TYPE_INTERNAL)) { - DEBUG_PRINT (ACPI_INFO, - ("AmlDumpOperand: %p Not a local object \n", EntryDesc)); + DEBUG_PRINTP (ACPI_INFO, ("%p Not a local object \n", EntryDesc)); DUMP_BUFFER (EntryDesc, sizeof (ACPI_OPERAND_OBJECT)); return (AE_OK); } /* EntryDesc is a valid object */ - DEBUG_PRINT (ACPI_INFO, ("AmlDumpOperand: %p ", EntryDesc)); + DEBUG_PRINTP (ACPI_INFO, ("%p ", EntryDesc)); switch (EntryDesc->Common.Type) { case INTERNAL_TYPE_REFERENCE: - switch (EntryDesc->Reference.OpCode) + switch (EntryDesc->Reference.Opcode) { case AML_ZERO_OP: @@ -364,7 +363,7 @@ AcpiAmlDumpOperand ( break; - case AML_NAMEPATH_OP: + case AML_INT_NAMEPATH_OP: DEBUG_PRINT_RAW (ACPI_INFO, ("Reference.Node->Name %x\n", EntryDesc->Reference.Node->Name)); break; @@ -374,7 +373,7 @@ AcpiAmlDumpOperand ( /* unknown opcode */ DEBUG_PRINT_RAW (ACPI_INFO, ("Unknown opcode=%X\n", - EntryDesc->Reference.OpCode)); + EntryDesc->Reference.Opcode)); break; } @@ -454,7 +453,7 @@ AcpiAmlDumpOperand ( ElementIndex < EntryDesc->Package.Count; ++ElementIndex, ++Element) { - AcpiAmlDumpOperand (*Element); + AcpiExDumpOperand (*Element); } } @@ -466,7 +465,7 @@ AcpiAmlDumpOperand ( case ACPI_TYPE_REGION: DEBUG_PRINT_RAW (ACPI_INFO, ("Region %s (%X)", - AcpiCmGetRegionName (EntryDesc->Region.SpaceId), + AcpiUtGetRegionName (EntryDesc->Region.SpaceId), EntryDesc->Region.SpaceId)); /* @@ -506,14 +505,14 @@ AcpiAmlDumpOperand ( break; - case INTERNAL_TYPE_DEF_FIELD: + case INTERNAL_TYPE_REGION_FIELD: DEBUG_PRINT_RAW (ACPI_INFO, - ("DefField: bits=%X acc=%X lock=%X update=%X at byte=%lX bit=%X of below:\n", - EntryDesc->Field.Length, EntryDesc->Field.Access, - EntryDesc->Field.LockRule, EntryDesc->Field.UpdateRule, - EntryDesc->Field.Offset, EntryDesc->Field.BitOffset)); - DUMP_STACK_ENTRY (EntryDesc->Field.Container); + ("RegionField: bits=%X bitaccwidth=%X lock=%X update=%X at byte=%lX bit=%X of below:\n", + EntryDesc->Field.BitLength, EntryDesc->Field.AccessBitWidth, + EntryDesc->Field.LockRule, EntryDesc->Field.UpdateRule, + EntryDesc->Field.BaseByteOffset, EntryDesc->Field.StartFieldBitOffset)); + DUMP_STACK_ENTRY (EntryDesc->Field.RegionObj); break; @@ -523,28 +522,27 @@ AcpiAmlDumpOperand ( break; - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: DEBUG_PRINT_RAW (ACPI_INFO, - ("FieldUnit: %X bits acc %X lock %X update %X at byte %lX bit %X of \n", - EntryDesc->FieldUnit.Length, EntryDesc->FieldUnit.Access, - EntryDesc->FieldUnit.LockRule, EntryDesc->FieldUnit.UpdateRule, - EntryDesc->FieldUnit.Offset, EntryDesc->FieldUnit.BitOffset)); + ("BufferField: %X bits at byte %lX bit %X of \n", + EntryDesc->BufferField.BitLength, EntryDesc->BufferField.BaseByteOffset, + EntryDesc->BufferField.StartFieldBitOffset)); - if (!EntryDesc->FieldUnit.Container) + if (!EntryDesc->BufferField.BufferObj) { DEBUG_PRINT (ACPI_INFO, ("*NULL* \n")); } else if (ACPI_TYPE_BUFFER != - EntryDesc->FieldUnit.Container->Common.Type) + EntryDesc->BufferField.BufferObj->Common.Type) { DEBUG_PRINT_RAW (ACPI_INFO, ("*not a Buffer* \n")); } else { - DUMP_STACK_ENTRY (EntryDesc->FieldUnit.Container); + DUMP_STACK_ENTRY (EntryDesc->BufferField.BufferObj); } break; @@ -622,7 +620,7 @@ AcpiAmlDumpOperand ( /***************************************************************************** * - * FUNCTION: AcpiAmlDumpOperands + * FUNCTION: AcpiExDumpOperands * * PARAMETERS: InterpreterMode - Load or Exec * *Ident - Identification @@ -634,7 +632,7 @@ AcpiAmlDumpOperand ( ****************************************************************************/ void -AcpiAmlDumpOperands ( +AcpiExDumpOperands ( ACPI_OPERAND_OBJECT **Operands, OPERATING_MODE InterpreterMode, NATIVE_CHAR *Ident, @@ -659,13 +657,15 @@ AcpiAmlDumpOperands ( DEBUG_PRINT (ACPI_INFO, - ("************* AcpiAmlDumpOperands Mode=%X ******************\n", + ("************* AcpiExDumpOperands Mode=%X ******************\n", InterpreterMode)); DEBUG_PRINT (ACPI_INFO, ("From %12s(%d) %s: %s\n", ModuleName, LineNumber, Ident, Note)); if (NumLevels == 0) + { NumLevels = 1; + } /* Dump the stack starting at the top, working down */ @@ -673,7 +673,7 @@ AcpiAmlDumpOperands ( { EntryDesc = &Operands[i]; - if (ACPI_FAILURE (AcpiAmlDumpOperand (*EntryDesc))) + if (ACPI_FAILURE (AcpiExDumpOperand (*EntryDesc))) { break; } @@ -685,7 +685,7 @@ AcpiAmlDumpOperands ( /***************************************************************************** * - * FUNCTION: AcpiAmlDumpNode + * FUNCTION: AcpiExDumpNode * * PARAMETERS: *Node - Descriptor to dump * Flags - Force display @@ -695,7 +695,7 @@ AcpiAmlDumpOperands ( ****************************************************************************/ void -AcpiAmlDumpNode ( +AcpiExDumpNode ( ACPI_NAMESPACE_NODE *Node, UINT32 Flags) { @@ -710,7 +710,7 @@ AcpiAmlDumpNode ( AcpiOsPrintf ("%20s : %4.4s\n", "Name", &Node->Name); - AcpiOsPrintf ("%20s : %s\n", "Type", AcpiCmGetTypeName (Node->Type)); + AcpiOsPrintf ("%20s : %s\n", "Type", AcpiUtGetTypeName (Node->Type)); AcpiOsPrintf ("%20s : %X\n", "Flags", Node->Flags); AcpiOsPrintf ("%20s : %X\n", "Owner Id", Node->OwnerId); AcpiOsPrintf ("%20s : %X\n", "Reference Count", Node->ReferenceCount); @@ -723,7 +723,7 @@ AcpiAmlDumpNode ( /***************************************************************************** * - * FUNCTION: AcpiAmlDumpObjectDescriptor + * FUNCTION: AcpiExDumpObjectDescriptor * * PARAMETERS: *Object - Descriptor to dump * Flags - Force display @@ -733,11 +733,11 @@ AcpiAmlDumpNode ( ****************************************************************************/ void -AcpiAmlDumpObjectDescriptor ( +AcpiExDumpObjectDescriptor ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Flags) { - FUNCTION_TRACE ("AmlDumpObjectDescriptor"); + FUNCTION_TRACE ("ExDumpObjectDescriptor"); if (!Flags) @@ -795,16 +795,13 @@ AcpiAmlDumpObjectDescriptor ( break; - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: - AcpiOsPrintf ("%20s : %s\n", "Type", "FieldUnit"); - AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->FieldUnit.Access); - AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->FieldUnit.LockRule); - AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->FieldUnit.UpdateRule); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->FieldUnit.Length); - AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->FieldUnit.BitOffset); - AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->FieldUnit.Offset); - AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->FieldUnit.Container); + AcpiOsPrintf ("%20s : %s\n", "Type", "BufferField"); + AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BufferField.BitLength); + AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BufferField.StartFieldBitOffset); + AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset",ObjDesc->BufferField.BaseByteOffset); + AcpiOsPrintf ("%20s : %p\n", "BufferObj", ObjDesc->BufferField.BufferObj); break; @@ -838,6 +835,8 @@ AcpiAmlDumpObjectDescriptor ( AcpiOsPrintf ("%20s : %s\n", "Type", "Mutex"); AcpiOsPrintf ("%20s : %X\n", "SyncLevel", ObjDesc->Mutex.SyncLevel); + AcpiOsPrintf ("%20s : %p\n", "Owner", ObjDesc->Mutex.Owner); + AcpiOsPrintf ("%20s : %X\n", "AcquisitionDepth", ObjDesc->Mutex.AcquisitionDepth); AcpiOsPrintf ("%20s : %p\n", "Semaphore", ObjDesc->Mutex.Semaphore); break; @@ -884,32 +883,43 @@ AcpiAmlDumpObjectDescriptor ( AcpiOsPrintf ("%20s : %p\n", "AddrHandler", ObjDesc->ThermalZone.AddrHandler); break; + + case INTERNAL_TYPE_REGION_FIELD: + + AcpiOsPrintf ("%20s : %p\n", "AccessBitWidth", ObjDesc->Field.AccessBitWidth); + AcpiOsPrintf ("%20s : %p\n", "BitLength", ObjDesc->Field.BitLength); + AcpiOsPrintf ("%20s : %p\n", "BaseByteOffset",ObjDesc->Field.BaseByteOffset); + AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.StartFieldBitOffset); + AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->Field.RegionObj); + break; + + case INTERNAL_TYPE_BANK_FIELD: AcpiOsPrintf ("%20s : %s\n", "Type", "BankField"); - AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->BankField.Access); + AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->BankField.AccessBitWidth); AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->BankField.LockRule); AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->BankField.UpdateRule); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->BankField.Length); - AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.BitOffset); - AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->BankField.Offset); + AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->BankField.BitLength); + AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->BankField.StartFieldBitOffset); + AcpiOsPrintf ("%20s : %X\n", "BaseByteOffset", ObjDesc->BankField.BaseByteOffset); AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->BankField.Value); - AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->BankField.Container); - AcpiOsPrintf ("%20s : %X\n", "BankSelect", ObjDesc->BankField.BankSelect); + AcpiOsPrintf ("%20s : %p\n", "RegionObj", ObjDesc->BankField.RegionObj); + AcpiOsPrintf ("%20s : %X\n", "BankRegisterObj", ObjDesc->BankField.BankRegisterObj); break; case INTERNAL_TYPE_INDEX_FIELD: AcpiOsPrintf ("%20s : %s\n", "Type", "IndexField"); - AcpiOsPrintf ("%20s : %X\n", "Access", ObjDesc->IndexField.Access); + AcpiOsPrintf ("%20s : %X\n", "AccessBitWidth", ObjDesc->IndexField.AccessBitWidth); AcpiOsPrintf ("%20s : %X\n", "LockRule", ObjDesc->IndexField.LockRule); AcpiOsPrintf ("%20s : %X\n", "UpdateRule", ObjDesc->IndexField.UpdateRule); - AcpiOsPrintf ("%20s : %X\n", "Length", ObjDesc->IndexField.Length); - AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.BitOffset); + AcpiOsPrintf ("%20s : %X\n", "BitLength", ObjDesc->IndexField.BitLength); + AcpiOsPrintf ("%20s : %X\n", "BitOffset", ObjDesc->IndexField.StartFieldBitOffset); AcpiOsPrintf ("%20s : %X\n", "Value", ObjDesc->IndexField.Value); - AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.Index); - AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.Data); + AcpiOsPrintf ("%20s : %X\n", "Index", ObjDesc->IndexField.IndexObj); + AcpiOsPrintf ("%20s : %X\n", "Data", ObjDesc->IndexField.DataObj); break; @@ -917,7 +927,7 @@ AcpiAmlDumpObjectDescriptor ( AcpiOsPrintf ("%20s : %s\n", "Type", "Reference"); AcpiOsPrintf ("%20s : %X\n", "TargetType", ObjDesc->Reference.TargetType); - AcpiOsPrintf ("%20s : %X\n", "OpCode", ObjDesc->Reference.OpCode); + AcpiOsPrintf ("%20s : %X\n", "Opcode", ObjDesc->Reference.Opcode); AcpiOsPrintf ("%20s : %X\n", "Offset", ObjDesc->Reference.Offset); AcpiOsPrintf ("%20s : %p\n", "ObjDesc", ObjDesc->Reference.Object); AcpiOsPrintf ("%20s : %p\n", "Node", ObjDesc->Reference.Node); @@ -946,18 +956,8 @@ AcpiAmlDumpObjectDescriptor ( break; - case INTERNAL_TYPE_DEF_FIELD: - - AcpiOsPrintf ("%20s : %p\n", "Granularity", ObjDesc->Field.Granularity); - AcpiOsPrintf ("%20s : %p\n", "Length", ObjDesc->Field.Length); - AcpiOsPrintf ("%20s : %p\n", "Offset", ObjDesc->Field.Offset); - AcpiOsPrintf ("%20s : %p\n", "BitOffset", ObjDesc->Field.BitOffset); - AcpiOsPrintf ("%20s : %p\n", "Container", ObjDesc->Field.Container); - break; - - case INTERNAL_TYPE_ALIAS: - case INTERNAL_TYPE_DEF_FIELD_DEFN: + case INTERNAL_TYPE_FIELD_DEFN: case INTERNAL_TYPE_BANK_FIELD_DEFN: case INTERNAL_TYPE_INDEX_FIELD_DEFN: case INTERNAL_TYPE_IF: diff --git a/sys/contrib/dev/acpica/exdyadic.c b/sys/contrib/dev/acpica/exdyadic.c index c80d929..46050da 100644 --- a/sys/contrib/dev/acpica/exdyadic.c +++ b/sys/contrib/dev/acpica/exdyadic.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amdyadic - ACPI AML (p-code) execution for dyadic operators - * $Revision: 71 $ + * Module Name: exdyadic - ACPI AML (p-code) execution for dyadic operators + * $Revision: 77 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __AMDYADIC_C__ +#define __EXDYADIC_C__ #include "acpi.h" #include "acparser.h" @@ -126,13 +126,13 @@ #include "acdispat.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amdyadic") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exdyadic") /******************************************************************************* * - * FUNCTION: AcpiAmlDoConcatenate + * FUNCTION: AcpiExDoConcatenate * * PARAMETERS: *ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String @@ -144,7 +144,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlDoConcatenate ( +AcpiExDoConcatenate ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *ObjDesc2, ACPI_OPERAND_OBJECT **ActualRetDesc, @@ -182,7 +182,7 @@ AcpiAmlDoConcatenate ( /* Result of two integers is a buffer */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!RetDesc) { return (AE_NO_MEMORY); @@ -191,11 +191,11 @@ AcpiAmlDoConcatenate ( /* Need enough space for two integers */ RetDesc->Buffer.Length = IntegerSize * 2; - NewBuf = AcpiCmCallocate (RetDesc->Buffer.Length); + NewBuf = AcpiUtCallocate (RetDesc->Buffer.Length); if (!NewBuf) { REPORT_ERROR - (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n")); + (("ExDoConcatenate: Buffer allocation failure\n")); Status = AE_NO_MEMORY; goto Cleanup; } @@ -225,7 +225,7 @@ AcpiAmlDoConcatenate ( case ACPI_TYPE_STRING: - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); if (!RetDesc) { return (AE_NO_MEMORY); @@ -233,12 +233,12 @@ AcpiAmlDoConcatenate ( /* Operand1 is string */ - NewBuf = AcpiCmAllocate (ObjDesc->String.Length + + NewBuf = AcpiUtAllocate (ObjDesc->String.Length + ObjDesc2->String.Length + 1); if (!NewBuf) { REPORT_ERROR - (("AmlExecDyadic2R/ConcatOp: String allocation failure\n")); + (("ExDoConcatenate: String allocation failure\n")); Status = AE_NO_MEMORY; goto Cleanup; } @@ -259,18 +259,18 @@ AcpiAmlDoConcatenate ( /* Operand1 is a buffer */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_BUFFER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); if (!RetDesc) { return (AE_NO_MEMORY); } - NewBuf = AcpiCmAllocate (ObjDesc->Buffer.Length + + NewBuf = AcpiUtAllocate (ObjDesc->Buffer.Length + ObjDesc2->Buffer.Length); if (!NewBuf) { REPORT_ERROR - (("AmlExecDyadic2R/ConcatOp: Buffer allocation failure\n")); + (("ExDoConcatenate: Buffer allocation failure\n")); Status = AE_NO_MEMORY; goto Cleanup; } @@ -301,14 +301,14 @@ AcpiAmlDoConcatenate ( Cleanup: - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); return (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlExecDyadic1 + * FUNCTION: AcpiExDyadic1 * * PARAMETERS: Opcode - The opcode to be executed * @@ -322,7 +322,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecDyadic1 ( +AcpiExDyadic1 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState) { @@ -332,14 +332,14 @@ AcpiAmlExecDyadic1 ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_PTR ("AmlExecDyadic1", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExDyadic1", WALK_OPERANDS); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 2, "after AcpiAmlResolveOperands"); + 2, "after AcpiExResolveOperands"); /* Get the operands */ @@ -349,9 +349,8 @@ AcpiAmlExecDyadic1 ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("ExecDyadic1/%s: bad operand(s) (Status=%X)\n", - AcpiPsGetOpcodeName (Opcode), Status)); + DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); goto Cleanup; } @@ -381,29 +380,30 @@ AcpiAmlExecDyadic1 ( case ACPI_TYPE_THERMAL: /* - * Requires that Device and ThermalZone be compatible - * mappings + * Dispatch the notify to the appropriate handler + * NOTE: the request is queued for execution after this method + * completes. The notify handlers are NOT invoked synchronously + * from this thread -- because handlers may in turn run other + * control methods. */ - /* Dispatch the notify to the appropriate handler */ - - AcpiEvNotifyDispatch (Node, (UINT32) ValDesc->Integer.Value); + Status = AcpiEvQueueNotifyRequest (Node, + (UINT32) ValDesc->Integer.Value); break; default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecDyadic1/NotifyOp: unexpected notify object type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Unexpected notify object type %X\n", ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; + break; } } break; default: - REPORT_ERROR (("AcpiAmlExecDyadic1: Unknown dyadic opcode %X\n", - Opcode)); + REPORT_ERROR (("AcpiExDyadic1: Unknown dyadic opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; } @@ -412,8 +412,8 @@ Cleanup: /* Always delete both operands */ - AcpiCmRemoveReference (ValDesc); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ValDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); @@ -422,7 +422,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecDyadic2R + * FUNCTION: AcpiExDyadic2R * * PARAMETERS: Opcode - The opcode to be executed * @@ -436,7 +436,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecDyadic2R ( +AcpiExDyadic2R ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) @@ -451,14 +451,14 @@ AcpiAmlExecDyadic2R ( UINT32 NumOperands = 3; - FUNCTION_TRACE_U32 ("AmlExecDyadic2R", Opcode); + FUNCTION_TRACE_U32 ("ExDyadic2R", Opcode); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - NumOperands, "after AcpiAmlResolveOperands"); + NumOperands, "after AcpiExResolveOperands"); /* Get all operands */ @@ -473,9 +473,8 @@ AcpiAmlExecDyadic2R ( Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecDyadic2R/%s: bad operand(s) (Status=%X)\n", - AcpiPsGetOpcodeName (Opcode), Status)); + DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) (%s)\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); goto Cleanup; } @@ -497,7 +496,7 @@ AcpiAmlExecDyadic2R ( case AML_SHIFT_RIGHT_OP: case AML_SUBTRACT_OP: - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -576,13 +575,13 @@ AcpiAmlExecDyadic2R ( if (!ObjDesc2->Integer.Value) { REPORT_ERROR - (("AmlExecDyadic2R/DivideOp: Divide by zero\n")); + (("ExDyadic2R/DivideOp: Divide by zero\n")); Status = AE_AML_DIVIDE_BY_ZERO; goto Cleanup; } - RetDesc2 = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc2 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc2) { Status = AE_NO_MEMORY; @@ -653,15 +652,15 @@ AcpiAmlExecDyadic2R ( switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: - Status = AcpiAmlConvertToInteger (&ObjDesc2, WalkState); + Status = AcpiExConvertToInteger (&ObjDesc2, WalkState); break; case ACPI_TYPE_STRING: - Status = AcpiAmlConvertToString (&ObjDesc2, WalkState); + Status = AcpiExConvertToString (&ObjDesc2, WalkState); break; case ACPI_TYPE_BUFFER: - Status = AcpiAmlConvertToBuffer (&ObjDesc2, WalkState); + Status = AcpiExConvertToBuffer (&ObjDesc2, WalkState); break; default: @@ -679,7 +678,7 @@ AcpiAmlExecDyadic2R ( * (Both are Integer, String, or Buffer), and we can now perform the * concatenation. */ - Status = AcpiAmlDoConcatenate (ObjDesc, ObjDesc2, &RetDesc, WalkState); + Status = AcpiExDoConcatenate (ObjDesc, ObjDesc2, &RetDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -689,7 +688,7 @@ AcpiAmlExecDyadic2R ( default: - REPORT_ERROR (("AcpiAmlExecDyadic2R: Unknown dyadic opcode %X\n", + REPORT_ERROR (("AcpiExDyadic2R: Unknown dyadic opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -702,7 +701,7 @@ AcpiAmlExecDyadic2R ( * descriptor (ResDesc). */ - Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState); + Status = AcpiExStore (RetDesc, ResDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -710,14 +709,14 @@ AcpiAmlExecDyadic2R ( if (AML_DIVIDE_OP == Opcode) { - Status = AcpiAmlExecStore (RetDesc2, ResDesc2, WalkState); + Status = AcpiExStore (RetDesc2, ResDesc2, WalkState); /* * Since the remainder is not returned, remove a reference to * the object we created earlier */ - AcpiCmRemoveReference (RetDesc2); + AcpiUtRemoveReference (RetDesc2); } @@ -725,8 +724,8 @@ Cleanup: /* Always delete the operands */ - AcpiCmRemoveReference (ObjDesc); - AcpiCmRemoveReference (ObjDesc2); + AcpiUtRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc2); /* Delete return object on error */ @@ -735,14 +734,14 @@ Cleanup: { /* On failure, delete the result ops */ - AcpiCmRemoveReference (ResDesc); - AcpiCmRemoveReference (ResDesc2); + AcpiUtRemoveReference (ResDesc); + AcpiUtRemoveReference (ResDesc2); if (RetDesc) { /* And delete the internal return object */ - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } } @@ -756,7 +755,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecDyadic2S + * FUNCTION: AcpiExDyadic2S * * PARAMETERS: Opcode - The opcode to be executed * @@ -769,7 +768,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecDyadic2S ( +AcpiExDyadic2S ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) @@ -780,14 +779,14 @@ AcpiAmlExecDyadic2S ( ACPI_STATUS Status; - FUNCTION_TRACE_PTR ("AmlExecDyadic2S", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExDyadic2S", WALK_OPERANDS); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 2, "after AcpiAmlResolveOperands"); + 2, "after AcpiExResolveOperands"); /* Get all operands */ @@ -797,9 +796,8 @@ AcpiAmlExecDyadic2S ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("ExecDyadic2S/%s: bad operand(s) (Status=%X)\n", - AcpiPsGetOpcodeName (Opcode), Status)); + DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); goto Cleanup; } @@ -807,7 +805,7 @@ AcpiAmlExecDyadic2S ( /* Create the internal return object */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -828,7 +826,7 @@ AcpiAmlExecDyadic2S ( case AML_ACQUIRE_OP: - Status = AcpiAmlSystemAcquireMutex (TimeDesc, ObjDesc); + Status = AcpiExAcquireMutex (TimeDesc, ObjDesc, WalkState); break; @@ -836,13 +834,13 @@ AcpiAmlExecDyadic2S ( case AML_WAIT_OP: - Status = AcpiAmlSystemWaitEvent (TimeDesc, ObjDesc); + Status = AcpiExSystemWaitEvent (TimeDesc, ObjDesc); break; default: - REPORT_ERROR (("AcpiAmlExecDyadic2S: Unknown dyadic synchronization opcode %X\n", Opcode)); + REPORT_ERROR (("AcpiExDyadic2S: Unknown dyadic synchronization opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } @@ -864,15 +862,15 @@ Cleanup: /* Delete params */ - AcpiCmRemoveReference (TimeDesc); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (TimeDesc); + AcpiUtRemoveReference (ObjDesc); /* Delete return object on error */ if (ACPI_FAILURE (Status) && (RetDesc)) { - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } @@ -886,7 +884,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecDyadic2 + * FUNCTION: AcpiExDyadic2 * * PARAMETERS: Opcode - The opcode to be executed * @@ -901,7 +899,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecDyadic2 ( +AcpiExDyadic2 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) @@ -913,14 +911,14 @@ AcpiAmlExecDyadic2 ( BOOLEAN Lboolean; - FUNCTION_TRACE_PTR ("AmlExecDyadic2", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExDyadic2", WALK_OPERANDS); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 2, "after AcpiAmlResolveOperands"); + 2, "after AcpiExResolveOperands"); /* Get all operands */ @@ -930,9 +928,8 @@ AcpiAmlExecDyadic2 ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("ExecDyadic2/%s: bad operand(s) (Status=%X)\n", - AcpiPsGetOpcodeName (Opcode), Status)); + DEBUG_PRINTP (ACPI_ERROR, ("(%s) bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); goto Cleanup; } @@ -940,7 +937,7 @@ AcpiAmlExecDyadic2 ( /* Create the internal return object */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -1002,7 +999,7 @@ AcpiAmlExecDyadic2 ( default: - REPORT_ERROR (("AcpiAmlExecDyadic2: Unknown dyadic opcode %X\n", Opcode)); + REPORT_ERROR (("AcpiExDyadic2: Unknown dyadic opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; break; @@ -1025,8 +1022,8 @@ Cleanup: /* Always delete operands */ - AcpiCmRemoveReference (ObjDesc); - AcpiCmRemoveReference (ObjDesc2); + AcpiUtRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc2); /* Delete return object on error */ @@ -1034,7 +1031,7 @@ Cleanup: if (ACPI_FAILURE (Status) && (RetDesc)) { - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } diff --git a/sys/contrib/dev/acpica/exfield.c b/sys/contrib/dev/acpica/exfield.c index 62c77a7..f0f7c3d 100644 --- a/sys/contrib/dev/acpica/exfield.c +++ b/sys/contrib/dev/acpica/exfield.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 77 $ + * Module Name: exfield - ACPI AML (p-code) execution - field manipulation + * $Revision: 90 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __AMFIELD_C__ +#define __EXFIELD_C__ #include "acpi.h" #include "acdispat.h" @@ -126,146 +126,144 @@ #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amfield") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exfield") /******************************************************************************* * - * FUNCTION: AcpiAmlSetupField + * FUNCTION: AcpiExReadDataFromField * - * PARAMETERS: *ObjDesc - Field to be read or written - * *RgnDesc - Region containing field - * FieldBitWidth - Field Width in bits (8, 16, or 32) - * - * RETURN: Status - * - * DESCRIPTION: Common processing for AcpiAmlReadField and AcpiAmlWriteField + * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE + * *FieldNode - Parent node for field to be accessed + * *Buffer - Value(s) to be read or written + * BufferLength - Number of bytes to transfer * - * ACPI SPECIFICATION REFERENCES: - * Each of the Type1Opcodes is defined as specified in in-line - * comments below. For each one, use the following definitions. + * RETURN: Status3 * - * DefBitField := BitFieldOp SrcBuf BitIdx Destination - * DefByteField := ByteFieldOp SrcBuf ByteIdx Destination - * DefCreateField := CreateFieldOp SrcBuf BitIdx NumBits NameString - * DefDWordField := DWordFieldOp SrcBuf ByteIdx Destination - * DefWordField := WordFieldOp SrcBuf ByteIdx Destination - * BitIndex := TermArg=>Integer - * ByteIndex := TermArg=>Integer - * Destination := NameString - * NumBits := TermArg=>Integer - * SourceBuf := TermArg=>Buffer + * DESCRIPTION: Read or write a named field * ******************************************************************************/ ACPI_STATUS -AcpiAmlSetupField ( +AcpiExReadDataFromField ( ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *RgnDesc, - UINT32 FieldBitWidth) + ACPI_OPERAND_OBJECT **RetBufferDesc) { - ACPI_STATUS Status = AE_OK; - UINT32 FieldByteWidth; + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *BufferDesc; + UINT32 Length; + void *Buffer; - FUNCTION_TRACE ("AmlSetupField"); + FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc); /* Parameter validation */ - if (!ObjDesc || !RgnDesc) + if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlSetupField: Internal error - null handle\n")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } - if (ACPI_TYPE_REGION != RgnDesc->Common.Type) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlSetupField: Needed Region, found type %x %s\n", - RgnDesc->Common.Type, AcpiCmGetTypeName (RgnDesc->Common.Type))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - /* - * TBD: [Future] Acpi 2.0 supports Qword fields + * Allocate a buffer for the contents of the field. * - * Init and validate Field width - * Possible values are 1, 2, 4 + * If the field is larger than the size of an ACPI_INTEGER, create + * a BUFFER to hold it. Otherwise, use an INTEGER. This allows + * the use of arithmetic operators on the returned value if the + * field size is equal or smaller than an Integer. + * + * Note: Field.length is in bits. */ - FieldByteWidth = DIV_8 (FieldBitWidth); + Length = ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength); - if ((FieldBitWidth != 8) && - (FieldBitWidth != 16) && - (FieldBitWidth != 32)) + if (Length > sizeof (ACPI_INTEGER)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlSetupField: Internal error - bad width %d\n", FieldBitWidth)); - return_ACPI_STATUS (AE_AML_OPERAND_VALUE); - } + /* Field is too large for an Integer, create a Buffer instead */ + BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER); + if (!BufferDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } - /* - * If the Region Address and Length have not been previously evaluated, - * evaluate them and save the results. - */ - if (!(RgnDesc->Region.Flags & AOPOBJ_DATA_VALID)) - { + /* Create the actual read buffer */ - Status = AcpiDsGetRegionArguments (RgnDesc); - if (ACPI_FAILURE (Status)) + BufferDesc->Buffer.Pointer = AcpiUtCallocate (Length); + if (!BufferDesc->Buffer.Pointer) { - return_ACPI_STATUS (Status); + AcpiUtRemoveReference (BufferDesc); + return_ACPI_STATUS (AE_NO_MEMORY); } - } + BufferDesc->Buffer.Length = Length; + Buffer = BufferDesc->Buffer.Pointer; + } - if ((ObjDesc->Common.Type == ACPI_TYPE_FIELD_UNIT) && - (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))) + else { - /* - * Field Buffer and Index have not been previously evaluated, - */ - DEBUG_PRINT (ACPI_ERROR, ("Uninitialized field!\n")); - return_ACPI_STATUS (AE_AML_INTERNAL); + /* Field will fit within an Integer (normal case) */ + + BufferDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); + if (!BufferDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Length = sizeof (BufferDesc->Integer.Value); + Buffer = &BufferDesc->Integer.Value; } - if (RgnDesc->Region.Length < - (ObjDesc->Field.Offset & ~((UINT32) FieldByteWidth - 1)) + - FieldByteWidth) + + /* Read from the appropriate field */ + + switch (ObjDesc->Common.Type) { - /* - * Offset rounded up to next multiple of field width - * exceeds region length, indicate an error - */ + case ACPI_TYPE_BUFFER_FIELD: + Status = AcpiExAccessBufferField (ACPI_READ, ObjDesc, Buffer, Length); + break; + + case INTERNAL_TYPE_REGION_FIELD: + Status = AcpiExAccessRegionField (ACPI_READ, ObjDesc, Buffer, Length); + break; - DUMP_STACK_ENTRY (RgnDesc); - DUMP_STACK_ENTRY (ObjDesc); + case INTERNAL_TYPE_BANK_FIELD: + Status = AcpiExAccessBankField (ACPI_READ, ObjDesc, Buffer, Length); + break; - DEBUG_PRINT (ACPI_ERROR, - ("AmlSetupField: Operation at %08lX width %d bits exceeds len %08lX field=%p region=%p\n", - ObjDesc->Field.Offset, FieldBitWidth, RgnDesc->Region.Length, - ObjDesc, RgnDesc)); + case INTERNAL_TYPE_INDEX_FIELD: + Status = AcpiExAccessIndexField (ACPI_READ, ObjDesc, Buffer, Length); + break; - return_ACPI_STATUS (AE_AML_REGION_LIMIT); + default: + Status = AE_AML_INTERNAL; } - return_ACPI_STATUS (AE_OK); + + if (ACPI_FAILURE (Status)) + { + AcpiUtRemoveReference (BufferDesc); + } + + else if (RetBufferDesc) + { + *RetBufferDesc = BufferDesc; + } + + return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlAccessNamedField + * FUNCTION: AcpiExWriteDataToField * * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE - * NamedField - Handle for field to be accessed + * *FieldNode - Parent node for field to be accessed * *Buffer - Value(s) to be read or written - * BufferLength - Number of bytes to transfer + * BufferLength - Number of bytes to transfer * * RETURN: Status * @@ -273,175 +271,369 @@ AcpiAmlSetupField ( * ******************************************************************************/ + ACPI_STATUS -AcpiAmlAccessNamedField ( - UINT32 Mode, - ACPI_HANDLE NamedField, - void *Buffer, - UINT32 BufferLength) +AcpiExWriteDataToField ( + ACPI_OPERAND_OBJECT *SourceDesc, + ACPI_OPERAND_OBJECT *ObjDesc) { - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - ACPI_STATUS Status = AE_OK; - BOOLEAN Locked = FALSE; - UINT32 BitGranularity = 0; - UINT32 ByteGranularity; - UINT32 DatumLength; - UINT32 ActualByteLength; - UINT32 ByteFieldLength; + ACPI_STATUS Status; + UINT32 Length; + void *Buffer; - FUNCTION_TRACE_PTR ("AmlAccessNamedField", NamedField); + FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc); /* Parameter validation */ - if ((!NamedField) || (ACPI_READ == Mode && !Buffer)) + if (!SourceDesc || !ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("AcpiAmlAccessNamedField: Internal error - null parameter\n")); - return_ACPI_STATUS (AE_AML_INTERNAL); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } - /* Get the attached field object */ - ObjDesc = AcpiNsGetAttachedObject (NamedField); - if (!ObjDesc) + /* + * Get a pointer to the data to be written + */ + switch (SourceDesc->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlAccessNamedField: Internal error - null value pointer\n")); - return_ACPI_STATUS (AE_AML_INTERNAL); + case ACPI_TYPE_INTEGER: + Buffer = &SourceDesc->Integer.Value; + Length = sizeof (SourceDesc->Integer.Value); + break; + + case ACPI_TYPE_BUFFER: + Buffer = SourceDesc->Buffer.Pointer; + Length = SourceDesc->Buffer.Length; + break; + + case ACPI_TYPE_STRING: + Buffer = SourceDesc->String.Pointer; + Length = SourceDesc->String.Length; + break; + + default: + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* Check the type */ - if (INTERNAL_TYPE_DEF_FIELD != AcpiNsGetType (NamedField)) + /* + * Decode the type of field to be written + */ + switch (ObjDesc->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlAccessNamedField: Name %4.4s type %x is not a defined field\n", - &(((ACPI_NAMESPACE_NODE *) NamedField)->Name), - AcpiNsGetType (NamedField))); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + case ACPI_TYPE_BUFFER_FIELD: + Status = AcpiExAccessBufferField (ACPI_WRITE, ObjDesc, Buffer, Length); + break; + + case INTERNAL_TYPE_REGION_FIELD: + Status = AcpiExAccessRegionField (ACPI_WRITE, ObjDesc, Buffer, Length); + break; + + case INTERNAL_TYPE_BANK_FIELD: + Status = AcpiExAccessBankField (ACPI_WRITE, ObjDesc, Buffer, Length); + break; + + case INTERNAL_TYPE_INDEX_FIELD: + Status = AcpiExAccessIndexField (ACPI_WRITE, ObjDesc, Buffer, Length); + break; + + default: + return_ACPI_STATUS (AE_AML_INTERNAL); } - /* ObjDesc valid and NamedField is a defined field */ - DEBUG_PRINT (ACPI_INFO, - ("AccessNamedField: Obj=%p Type=%x Buf=%p Len=%x\n", - ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength)); - DEBUG_PRINT (ACPI_INFO, - ("AccessNamedField: Mode=%d FieldLen=%d, BitOffset=%d\n", - Mode, ObjDesc->FieldUnit.Length, ObjDesc->FieldUnit.BitOffset)); - DUMP_ENTRY (NamedField, ACPI_INFO); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExAccessBufferField + * + * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE + * *FieldNode - Parent node for field to be accessed + * *Buffer - Value(s) to be read or written + * BufferLength - Number of bytes to transfer + * + * RETURN: Status + * + * DESCRIPTION: Read or write a named field + * + ******************************************************************************/ +ACPI_STATUS +AcpiExAccessBufferField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength) +{ + ACPI_STATUS Status; + + + FUNCTION_TRACE_PTR ("AcpiExAccessBufferField", ObjDesc); - /* Double-check that the attached object is also a field */ - if (INTERNAL_TYPE_DEF_FIELD != ObjDesc->Common.Type) + /* + * If the BufferField arguments have not been previously evaluated, + * evaluate them now and save the results. + */ + if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlAccessNamedField: Internal error - Name %4.4s type %x does not match value-type %x at %p\n", - &(((ACPI_NAMESPACE_NODE *) NamedField)->Name), - AcpiNsGetType (NamedField), ObjDesc->Common.Type, ObjDesc)); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + Status = AcpiDsGetBufferFieldArguments (ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } + Status = AcpiExCommonAccessField (Mode, ObjDesc, Buffer, BufferLength); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExAccessRegionField + * + * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE + * *FieldNode - Parent node for field to be accessed + * *Buffer - Value(s) to be read or written + * BufferLength - Number of bytes to transfer + * + * RETURN: Status + * + * DESCRIPTION: Read or write a named field + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExAccessRegionField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength) +{ + ACPI_STATUS Status; + BOOLEAN Locked; + + + FUNCTION_TRACE_PTR ("ExAccessRegionField", ObjDesc); + + /* - * Granularity was decoded from the field access type - * (AnyAcc will be the same as ByteAcc) + * Get the global lock if needed */ + Locked = AcpiExAcquireGlobalLock (ObjDesc->Field.LockRule); + + Status = AcpiExCommonAccessField (Mode, ObjDesc, Buffer, BufferLength); - BitGranularity = ObjDesc->FieldUnit.Granularity; - ByteGranularity = DIV_8 (BitGranularity); /* - * Check if request is too large for the field, and silently truncate - * if necessary + * Release global lock if we acquired it earlier */ + AcpiExReleaseGlobalLock (Locked); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExAccessBankField + * + * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE + * *FieldNode - Parent node for field to be accessed + * *Buffer - Value(s) to be read or written + * BufferLength - Number of bytes to transfer + * + * RETURN: Status + * + * DESCRIPTION: Read or write a Bank Field + * + ******************************************************************************/ - /* TBD: [Errors] should an error be returned in this case? */ +ACPI_STATUS +AcpiExAccessBankField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength) +{ + ACPI_STATUS Status; + BOOLEAN Locked; - ByteFieldLength = (UINT32) DIV_8 (ObjDesc->FieldUnit.Length + 7); + FUNCTION_TRACE_PTR ("ExAccessBankField", ObjDesc); - ActualByteLength = BufferLength; - if (BufferLength > ByteFieldLength) - { - DEBUG_PRINT (ACPI_INFO, - ("AmlAccessNamedField: Byte length %X truncated to %X\n", - ActualByteLength, ByteFieldLength)); - ActualByteLength = ByteFieldLength; - } + /* + * Get the global lock if needed + */ + Locked = AcpiExAcquireGlobalLock (ObjDesc->BankField.LockRule); - /* TBD: should these round down to a power of 2? */ - if (DIV_8 (BitGranularity) > ByteFieldLength) - { - DEBUG_PRINT (ACPI_INFO, - ("AmlAccessNamedField: Bit granularity %X truncated to %X\n", - BitGranularity, MUL_8(ByteFieldLength))); + /* + * Write the BankValue to the BankRegister to select the bank. + * The BankValue for this BankField is specified in the + * BankField ASL declaration. The BankRegister is always a Field in + * an operation region. + */ - BitGranularity = MUL_8(ByteFieldLength); + Status = AcpiExCommonAccessField (ACPI_WRITE, + ObjDesc->BankField.BankRegisterObj, + &ObjDesc->BankField.Value, + sizeof (ObjDesc->BankField.Value)); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; } - if (ByteGranularity > ByteFieldLength) - { - DEBUG_PRINT (ACPI_INFO, - ("AmlAccessNamedField: Byte granularity %X truncated to %X\n", - ByteGranularity, ByteFieldLength)); + /* + * The bank was successfully selected, now read or write the actual + * data. + */ + Status = AcpiExCommonAccessField (Mode, ObjDesc, Buffer, BufferLength); + + +Cleanup: + /* + * Release global lock if we acquired it earlier + */ + AcpiExReleaseGlobalLock (Locked); + + return_ACPI_STATUS (Status); +} + - ByteGranularity = ByteFieldLength; +/******************************************************************************* + * + * FUNCTION: AcpiExAccessIndexField + * + * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE + * *FieldNode - Parent node for field to be accessed + * *Buffer - Value(s) to be read or written + * BufferLength - Number of bytes to transfer + * + * RETURN: Status + * + * DESCRIPTION: Read or write a Index Field + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExAccessIndexField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength) +{ + ACPI_STATUS Status; + BOOLEAN Locked; + + + FUNCTION_TRACE_PTR ("ExAccessIndexField", ObjDesc); + + + /* + * Get the global lock if needed + */ + Locked = AcpiExAcquireGlobalLock (ObjDesc->IndexField.LockRule); + + + /* + * Set Index value to select proper Data register + */ + Status = AcpiExCommonAccessField (ACPI_WRITE, + ObjDesc->IndexField.IndexObj, + &ObjDesc->IndexField.Value, + sizeof (ObjDesc->IndexField.Value)); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; } + /* Now read/write the data register */ - /* Convert byte count to datum count, round up if necessary */ + Status = AcpiExCommonAccessField (Mode, ObjDesc->IndexField.DataObj, + Buffer, BufferLength); - DatumLength = (ActualByteLength + (ByteGranularity-1)) / ByteGranularity; +Cleanup: + /* + * Release global lock if we acquired it earlier + */ + AcpiExReleaseGlobalLock (Locked); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExCommonAccessField + * + * PARAMETERS: Mode - ACPI_READ or ACPI_WRITE + * *FieldNode - Parent node for field to be accessed + * *Buffer - Value(s) to be read or written + * BufferLength - Size of buffer, in bytes. Must be large + * enough for all bits of the field. + * + * RETURN: Status + * + * DESCRIPTION: Read or write a named field + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExCommonAccessField ( + UINT32 Mode, + ACPI_OPERAND_OBJECT *ObjDesc, + void *Buffer, + UINT32 BufferLength) +{ + ACPI_STATUS Status; - DEBUG_PRINT (ACPI_INFO, - ("ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n", - ActualByteLength, DatumLength, BitGranularity, ByteGranularity)); + FUNCTION_TRACE_PTR ("ExCommonAccessField", ObjDesc); - /* Get the global lock if needed */ - Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule); + DEBUG_PRINTP (ACPI_INFO, ("Obj=%p Type=%X Buf=%p Len=%X\n", + ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength)); + DEBUG_PRINTP (ACPI_INFO, ("Mode=%d BitLen=%X BitOff=%X ByteOff=%X\n", + Mode, ObjDesc->CommonField.BitLength, + ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.BaseByteOffset)); - /* Perform the actual read or write of the buffer */ + + /* Perform the actual read or write of the field */ switch (Mode) { case ACPI_READ: - Status = AcpiAmlReadField (ObjDesc, Buffer, BufferLength, - ActualByteLength, DatumLength, - BitGranularity, ByteGranularity); + Status = AcpiExExtractFromField (ObjDesc, Buffer, BufferLength); break; case ACPI_WRITE: - Status = AcpiAmlWriteField (ObjDesc, Buffer, BufferLength, - ActualByteLength, DatumLength, - BitGranularity, ByteGranularity); + Status = AcpiExInsertIntoField (ObjDesc, Buffer, BufferLength); break; default: - DEBUG_PRINT (ACPI_ERROR, - ("AccessNamedField: Unknown I/O Mode: %X\n", Mode)); + DEBUG_PRINTP (ACPI_ERROR, ("Unknown I/O Mode: %X\n", Mode)); Status = AE_BAD_PARAMETER; break; } - /* Release global lock if we acquired it earlier */ - - AcpiAmlReleaseGlobalLock (Locked); - return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index 24c9a2a..96f3227 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: amfldio - Aml Field I/O - * $Revision: 39 $ + * Module Name: exfldio - Aml Field I/O + * $Revision: 57 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __AMFLDIO_C__ +#define __EXFLDIO_C__ #include "acpi.h" #include "acinterp.h" @@ -123,116 +123,324 @@ #include "acnamesp.h" #include "achware.h" #include "acevents.h" +#include "acdispat.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amfldio") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exfldio") /******************************************************************************* * - * FUNCTION: AcpiAmlReadFieldData + * FUNCTION: AcpiExSetupField * - * PARAMETERS: *ObjDesc - Field to be read - * *Value - Where to store value - * FieldBitWidth - Field Width in bits (8, 16, or 32) + * PARAMETERS: *ObjDesc - Field to be read or written + * FieldDatumByteOffset - Current offset into the field * * RETURN: Status * - * DESCRIPTION: Retrieve the value of the given field + * DESCRIPTION: Common processing for AcpiExExtractFromField and + * AcpiExInsertIntoField * ******************************************************************************/ ACPI_STATUS -AcpiAmlReadFieldData ( +AcpiExSetupField ( ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldByteOffset, - UINT32 FieldBitWidth, - UINT32 *Value) + UINT32 FieldDatumByteOffset) { - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT *RgnDesc = NULL; - ACPI_PHYSICAL_ADDRESS Address; - UINT32 LocalValue = 0; - UINT32 FieldByteWidth; + ACPI_STATUS Status = AE_OK; + ACPI_OPERAND_OBJECT *RgnDesc; - FUNCTION_TRACE ("AmlReadFieldData"); + FUNCTION_TRACE ("ExSetupField"); - /* ObjDesc is validated by callers */ + /* Parameter validation */ - if (ObjDesc) + RgnDesc = ObjDesc->CommonField.RegionObj; + if (!ObjDesc || !RgnDesc) { - RgnDesc = ObjDesc->Field.Container; + DEBUG_PRINTP (ACPI_ERROR, ("Internal error - null handle\n")); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } + if (ACPI_TYPE_REGION != RgnDesc->Common.Type) + { + DEBUG_PRINTP (ACPI_ERROR, ("Needed Region, found type %x %s\n", + RgnDesc->Common.Type, AcpiUtGetTypeName (RgnDesc->Common.Type))); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); + } - FieldByteWidth = DIV_8 (FieldBitWidth); - Status = AcpiAmlSetupField (ObjDesc, RgnDesc, FieldBitWidth); - if (ACPI_FAILURE (Status)) + + /* + * If the Region Address and Length have not been previously evaluated, + * evaluate them now and save the results. + */ + if (!(RgnDesc->Region.Flags & AOPOBJ_DATA_VALID)) { - return_ACPI_STATUS (Status); + + Status = AcpiDsGetRegionArguments (RgnDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } - /* SetupField validated RgnDesc and FieldBitWidth */ + + /* + * Validate the request. The entire request from the byte offset for a + * length of one field datum (access width) must fit within the region. + * (Region length is specified in bytes) + */ + if (RgnDesc->Region.Length < (ObjDesc->CommonField.BaseByteOffset + + FieldDatumByteOffset + + ObjDesc->CommonField.AccessByteWidth)) + { + if (RgnDesc->Region.Length < ObjDesc->CommonField.AccessByteWidth) + { + /* + * This is the case where the AccessType (AccWord, etc.) is wider + * than the region itself. For example, a region of length one + * byte, and a field with Dword access specified. + */ + DEBUG_PRINTP (ACPI_ERROR, + ("Field access width (%d bytes) too large for region size (%X)\n", + ObjDesc->CommonField.AccessByteWidth, RgnDesc->Region.Length)); + } + + /* + * Offset rounded up to next multiple of field width + * exceeds region length, indicate an error + */ + DEBUG_PRINTP (ACPI_ERROR, + ("Field base+offset+width %X+%X+%X exceeds region size (%X bytes) field=%p region=%p\n", + ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, + ObjDesc->CommonField.AccessByteWidth, + RgnDesc->Region.Length, ObjDesc, RgnDesc)); + + return_ACPI_STATUS (AE_AML_REGION_LIMIT); + } + + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExReadFieldDatum + * + * PARAMETERS: *ObjDesc - Field to be read + * *Value - Where to store value (must be 32 bits) + * + * RETURN: Status + * + * DESCRIPTION: Retrieve the value of the given field + * + ******************************************************************************/ + +ACPI_STATUS +AcpiExReadFieldDatum ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 FieldDatumByteOffset, + UINT32 *Value) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *RgnDesc; + ACPI_PHYSICAL_ADDRESS Address; + UINT32 LocalValue; + + + FUNCTION_TRACE_U32 ("ExReadFieldDatum", FieldDatumByteOffset); + if (!Value) { + LocalValue = 0; Value = &LocalValue; /* support reads without saving value */ } + /* Clear the entire return buffer first, [Very Important!] */ + + *Value = 0; + /* - * Set offset to next multiple of field width, - * add region base address and offset within the field + * BufferFields - Read from a Buffer + * Other Fields - Read from a Operation Region. */ - Address = RgnDesc->Region.Address + - (ObjDesc->Field.Offset * FieldByteWidth) + - FieldByteOffset; + switch (ObjDesc->Common.Type) + { + case ACPI_TYPE_BUFFER_FIELD: + + /* + * For BufferFields, we only need to copy the data from the + * source buffer. Length is the field width in bytes. + */ + MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer + + ObjDesc->BufferField.BaseByteOffset + FieldDatumByteOffset, + ObjDesc->CommonField.AccessByteWidth); + Status = AE_OK; + break; + + + case INTERNAL_TYPE_REGION_FIELD: + case INTERNAL_TYPE_BANK_FIELD: - DEBUG_PRINT (TRACE_OPREGION, - ("AmlReadFieldData: Region %s(%X) at %08lx width %X\n", - AcpiCmGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId, Address, - FieldBitWidth)); + /* + * For other fields, we need to go through an Operation Region + * (Only types that will get here are RegionFields and BankFields) + */ + Status = AcpiExSetupField (ObjDesc, FieldDatumByteOffset); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - /* Invoke the appropriate AddressSpace/OpRegion handler */ + /* + * The physical address of this field datum is: + * + * 1) The base of the region, plus + * 2) The base offset of the field, plus + * 3) The current offset into the field + */ + RgnDesc = ObjDesc->CommonField.RegionObj; + Address = RgnDesc->Region.Address + ObjDesc->CommonField.BaseByteOffset + + FieldDatumByteOffset; - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_READ, - Address, FieldBitWidth, Value); + DEBUG_PRINTP (TRACE_BFIELD, ("Region %s(%X) width %X base:off %X:%X at %08lX\n", + AcpiUtGetRegionName (RgnDesc->Region.SpaceId), + RgnDesc->Region.SpaceId, ObjDesc->CommonField.AccessBitWidth, + ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, + Address)); - if (Status == AE_NOT_IMPLEMENTED) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlReadFieldData: **** Region %s(%X) not implemented\n", - AcpiCmGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId)); + + /* Invoke the appropriate AddressSpace/OpRegion handler */ + + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_READ_ADR_SPACE, + Address, ObjDesc->CommonField.AccessBitWidth, Value); + if (Status == AE_NOT_IMPLEMENTED) + { + DEBUG_PRINTP (ACPI_ERROR, ("Region %s(%X) not implemented\n", + AcpiUtGetRegionName (RgnDesc->Region.SpaceId), + RgnDesc->Region.SpaceId)); + } + + else if (Status == AE_NOT_EXIST) + { + DEBUG_PRINTP (ACPI_ERROR, ("Region %s(%X) has no handler\n", + AcpiUtGetRegionName (RgnDesc->Region.SpaceId), + RgnDesc->Region.SpaceId)); + } + break; + + + default: + + DEBUG_PRINTP (ACPI_ERROR, ("%p, wrong source type - %s\n", + ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type))); + Status = AE_AML_INTERNAL; + break; } - else if (Status == AE_NOT_EXIST) + + DEBUG_PRINTP (TRACE_BFIELD, ("Returned value=%08lX \n", *Value)); + + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiExGetBufferDatum + * + * PARAMETERS: MergedDatum - Value to store + * Buffer - Receiving buffer + * ByteGranularity - 1/2/4 Granularity of the field + * (aka Datum Size) + * Offset - Datum offset into the buffer + * + * RETURN: none + * + * DESCRIPTION: Store the merged datum to the buffer according to the + * byte granularity + * + ******************************************************************************/ + +static void +AcpiExGetBufferDatum( + UINT32 *Datum, + void *Buffer, + UINT32 ByteGranularity, + UINT32 Offset) +{ + + switch (ByteGranularity) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlReadFieldData: **** Region %s(%X) has no handler\n", - AcpiCmGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId)); + case ACPI_FIELD_BYTE_GRANULARITY: + *Datum = ((UINT8 *) Buffer) [Offset]; + break; + + case ACPI_FIELD_WORD_GRANULARITY: + MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset])); + break; + + case ACPI_FIELD_DWORD_GRANULARITY: + MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset])); + break; } +} - DEBUG_PRINT (TRACE_OPREGION, - ("AmlReadField: Returned value=%08lx \n", *Value)); - return_ACPI_STATUS (Status); +/******************************************************************************* + * + * FUNCTION: AcpiExSetBufferDatum + * + * PARAMETERS: MergedDatum - Value to store + * Buffer - Receiving buffer + * ByteGranularity - 1/2/4 Granularity of the field + * (aka Datum Size) + * Offset - Datum offset into the buffer + * + * RETURN: none + * + * DESCRIPTION: Store the merged datum to the buffer according to the + * byte granularity + * + ******************************************************************************/ + +static void +AcpiExSetBufferDatum ( + UINT32 MergedDatum, + void *Buffer, + UINT32 ByteGranularity, + UINT32 Offset) +{ + + switch (ByteGranularity) + { + case ACPI_FIELD_BYTE_GRANULARITY: + ((UINT8 *) Buffer) [Offset] = (UINT8) MergedDatum; + break; + + case ACPI_FIELD_WORD_GRANULARITY: + MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum); + break; + + case ACPI_FIELD_DWORD_GRANULARITY: + MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum); + break; + } } /******************************************************************************* * - * FUNCTION: AcpiAmlReadField + * FUNCTION: AcpiExExtractFromField * * PARAMETERS: *ObjDesc - Field to be read * *Value - Where to store value - * FieldBitWidth - Field Width in bits (8, 16, or 32) * * RETURN: Status * @@ -241,218 +449,186 @@ AcpiAmlReadFieldData ( ******************************************************************************/ ACPI_STATUS -AcpiAmlReadField ( +AcpiExExtractFromField ( ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, - UINT32 BufferLength, - UINT32 ByteLength, - UINT32 DatumLength, - UINT32 BitGranularity, - UINT32 ByteGranularity) + UINT32 BufferLength) { ACPI_STATUS Status; - UINT32 ThisFieldByteOffset; - UINT32 ThisFieldDatumOffset; + UINT32 FieldDatumByteOffset; + UINT32 DatumOffset; UINT32 PreviousRawDatum; UINT32 ThisRawDatum = 0; - UINT32 ValidFieldBits; - UINT32 Mask; UINT32 MergedDatum = 0; + UINT32 ByteFieldLength; + UINT32 DatumCount; + + FUNCTION_TRACE ("ExExtractFromField"); + + + /* + * The field must fit within the caller's buffer + */ + ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength); + if (ByteFieldLength > BufferLength) + { + DEBUG_PRINTP (ACPI_INFO, ("Field size %X (bytes) too large for buffer (%X)\n", + ByteFieldLength, BufferLength)); + + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + } + + /* Convert field byte count to datum count, round up if necessary */ + + DatumCount = ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth); + + DEBUG_PRINT (ACPI_INFO, + ("ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n", + ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth, + ObjDesc->CommonField.AccessByteWidth)); - FUNCTION_TRACE ("AmlReadField"); /* * Clear the caller's buffer (the whole buffer length as given) * This is very important, especially in the cases where a byte is read, * but the buffer is really a UINT32 (4 bytes). */ - MEMSET (Buffer, 0, BufferLength); /* Read the first raw datum to prime the loop */ - ThisFieldByteOffset = 0; - ThisFieldDatumOffset= 0; + FieldDatumByteOffset = 0; + DatumOffset= 0; - Status = AcpiAmlReadFieldData (ObjDesc, ThisFieldByteOffset, BitGranularity, - &PreviousRawDatum); + Status = AcpiExReadFieldDatum (ObjDesc, FieldDatumByteOffset, &PreviousRawDatum); if (ACPI_FAILURE (Status)) { - goto Cleanup; + return_ACPI_STATUS (Status); } + /* We might actually be done if the request fits in one datum */ - if ((DatumLength == 1) && - ((ObjDesc->Field.BitOffset + ObjDesc->FieldUnit.Length) <= - (UINT16) BitGranularity)) + if ((DatumCount == 1) && + (ObjDesc->CommonField.AccessFlags & AFIELD_SINGLE_DATUM)) { - MergedDatum = PreviousRawDatum; + /* 1) Shift the valid data bits down to start at bit 0 */ + + MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); - MergedDatum = (MergedDatum >> ObjDesc->Field.BitOffset); + /* 2) Mask off any upper unused bits (bits not part of the field) */ - ValidFieldBits = ObjDesc->FieldUnit.Length % BitGranularity; - if (ValidFieldBits) + if (ObjDesc->CommonField.EndBufferValidBits) { - Mask = (((UINT32) 1 << ValidFieldBits) - (UINT32) 1); - MergedDatum &= Mask; + MergedDatum &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); } + /* Store the datum to the caller buffer */ - /* - * Place the MergedDatum into the proper format and return buffer - * field - */ - - switch (ByteGranularity) - { - case 1: - ((UINT8 *) Buffer) [ThisFieldDatumOffset] = (UINT8) MergedDatum; - break; + AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, + DatumOffset); - case 2: - MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[ThisFieldDatumOffset]), &MergedDatum); - break; + return_ACPI_STATUS (AE_OK); + } - case 4: - MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[ThisFieldDatumOffset]), &MergedDatum); - break; - } - ThisFieldByteOffset = 1; - ThisFieldDatumOffset = 1; - } + /* We need to get more raw data to complete one or more field data */ - else + while (DatumOffset < DatumCount) { - /* We need to get more raw data to complete one or more field data */ + FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; - while (ThisFieldDatumOffset < DatumLength) + /* + * If the field is aligned on a byte boundary, we don't want + * to perform a final read, since this would potentially read + * past the end of the region. + * + * TBD: [Investigate] It may make more sense to just split the aligned + * and non-aligned cases since the aligned case is so very simple, + */ + if ((ObjDesc->CommonField.StartFieldBitOffset != 0) || + ((ObjDesc->CommonField.StartFieldBitOffset == 0) && + (DatumOffset < (DatumCount -1)))) { /* - * If the field is aligned on a byte boundary, we don't want - * to perform a final read, since this would potentially read - * past the end of the region. - * - * TBD: [Investigate] It may make more sense to just split the aligned - * and non-aligned cases since the aligned case is so very simple, + * Get the next raw datum, it contains some or all bits + * of the current field datum */ - if ((ObjDesc->Field.BitOffset != 0) || - ((ObjDesc->Field.BitOffset == 0) && - (ThisFieldDatumOffset < (DatumLength -1)))) + Status = AcpiExReadFieldDatum (ObjDesc, FieldDatumByteOffset, &ThisRawDatum); + if (ACPI_FAILURE (Status)) { - /* - * Get the next raw datum, it contains some or all bits - * of the current field datum - */ - - Status = AcpiAmlReadFieldData (ObjDesc, - ThisFieldByteOffset + ByteGranularity, - BitGranularity, &ThisRawDatum); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* Before merging the data, make sure the unused bits are clear */ - - switch (ByteGranularity) - { - case 1: - ThisRawDatum &= 0x000000FF; - PreviousRawDatum &= 0x000000FF; - break; - - case 2: - ThisRawDatum &= 0x0000FFFF; - PreviousRawDatum &= 0x0000FFFF; - break; - } + return_ACPI_STATUS (Status); } + } + /* + * Create the (possibly) merged datum to be stored to the caller buffer + */ + if (ObjDesc->CommonField.StartFieldBitOffset == 0) + { + /* Field is not skewed and we can just copy the datum */ - /* - * Put together bits of the two raw data to make a complete - * field datum - */ - - - if (ObjDesc->Field.BitOffset != 0) - { - MergedDatum = - (PreviousRawDatum >> ObjDesc->Field.BitOffset) | - (ThisRawDatum << (BitGranularity - ObjDesc->Field.BitOffset)); - } - - else - { - MergedDatum = PreviousRawDatum; - } + MergedDatum = PreviousRawDatum; + } + else + { /* - * Prepare the merged datum for storing into the caller's - * buffer. It is possible to have a 32-bit buffer - * (ByteGranularity == 4), but a ObjDesc->Field.Length - * of 8 or 16, meaning that the upper bytes of merged data - * are undesired. This section fixes that. + * Put together the appropriate bits of the two raw data to make a + * single complete field datum + * + * 1) Normalize the first datum down to bit 0 */ - switch (ObjDesc->Field.Length) - { - case 8: - MergedDatum &= 0x000000FF; - break; + MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); - case 16: - MergedDatum &= 0x0000FFFF; - break; - } + /* 2) Insert the second datum "above" the first datum */ - /* - * Now store the datum in the caller's buffer, according to - * the data type - */ - switch (ByteGranularity) + MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits); + + if ((DatumOffset >= (DatumCount -1))) { - case 1: - ((UINT8 *) Buffer) [ThisFieldDatumOffset] = (UINT8) MergedDatum; - break; - - case 2: - MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer) [ThisFieldDatumOffset]), &MergedDatum); - break; - - case 4: - MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer) [ThisFieldDatumOffset]), &MergedDatum); - break; + /* + * This is the last iteration of the loop. We need to clear + * any unused bits (bits that are not part of this field) that + * came from the last raw datum before we store the final + * merged datum into the caller buffer. + */ + if (ObjDesc->CommonField.EndBufferValidBits) + { + MergedDatum &= + MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); + } } + } - /* - * Save the most recent datum since it contains bits of - * the *next* field datum - */ - - PreviousRawDatum = ThisRawDatum; - ThisFieldByteOffset += ByteGranularity; - ThisFieldDatumOffset++; + /* + * Store the merged field datum in the caller's buffer, according to + * the granularity of the field (size of each datum). + */ + AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, + DatumOffset); - } /* while */ + /* + * Save the raw datum that was just acquired since it may contain bits + * of the *next* field datum. Update offsets + */ + PreviousRawDatum = ThisRawDatum; + DatumOffset++; } -Cleanup: - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiAmlWriteFieldData + * FUNCTION: AcpiExWriteFieldDatum * * PARAMETERS: *ObjDesc - Field to be set * Value - Value to store - * FieldBitWidth - Field Width in bits (8, 16, or 32) * * RETURN: Status * @@ -461,400 +637,418 @@ Cleanup: ******************************************************************************/ static ACPI_STATUS -AcpiAmlWriteFieldData ( +AcpiExWriteFieldDatum ( ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 FieldByteOffset, - UINT32 FieldBitWidth, + UINT32 FieldDatumByteOffset, UINT32 Value) { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *RgnDesc = NULL; ACPI_PHYSICAL_ADDRESS Address; - UINT32 FieldByteWidth; - FUNCTION_TRACE ("AmlWriteFieldData"); + FUNCTION_TRACE_U32 ("ExWriteFieldDatum", FieldDatumByteOffset); - /* ObjDesc is validated by callers */ - if (ObjDesc) + /* + * BufferFields - Read from a Buffer + * Other Fields - Read from a Operation Region. + */ + switch (ObjDesc->Common.Type) { - RgnDesc = ObjDesc->Field.Container; - } + case ACPI_TYPE_BUFFER_FIELD: - FieldByteWidth = DIV_8 (FieldBitWidth); - Status = AcpiAmlSetupField (ObjDesc, RgnDesc, FieldBitWidth); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* + * For BufferFields, we only need to copy the data to the + * target buffer. Length is the field width in bytes. + */ + MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + + ObjDesc->BufferField.BaseByteOffset + FieldDatumByteOffset, + &Value, ObjDesc->CommonField.AccessByteWidth); + Status = AE_OK; + break; - /* - * Set offset to next multiple of field width, - * add region base address and offset within the field - */ - Address = RgnDesc->Region.Address + - (ObjDesc->Field.Offset * FieldByteWidth) + - FieldByteOffset; + case INTERNAL_TYPE_REGION_FIELD: + case INTERNAL_TYPE_BANK_FIELD: - DEBUG_PRINT (TRACE_OPREGION, - ("AmlWriteField: Store %lx in Region %s(%X) at %p width %X\n", - Value, AcpiCmGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId, Address, - FieldBitWidth)); + /* + * For other fields, we need to go through an Operation Region + * (Only types that will get here are RegionFields and BankFields) + */ + Status = AcpiExSetupField (ObjDesc, FieldDatumByteOffset); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - /* Invoke the appropriate AddressSpace/OpRegion handler */ + /* + * The physical address of this field datum is: + * + * 1) The base of the region, plus + * 2) The base offset of the field, plus + * 3) The current offset into the field + */ + RgnDesc = ObjDesc->CommonField.RegionObj; + Address = RgnDesc->Region.Address + + ObjDesc->CommonField.BaseByteOffset + + FieldDatumByteOffset; - Status = AcpiEvAddressSpaceDispatch (RgnDesc, ADDRESS_SPACE_WRITE, - Address, FieldBitWidth, &Value); + DEBUG_PRINTP (TRACE_BFIELD, + ("Store %X in Region %s(%X) at %p width %X\n", + Value, AcpiUtGetRegionName (RgnDesc->Region.SpaceId), + RgnDesc->Region.SpaceId, Address, ObjDesc->CommonField.AccessBitWidth)); - if (Status == AE_NOT_IMPLEMENTED) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlWriteField: **** Region type %s(%X) not implemented\n", - AcpiCmGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId)); - } + /* Invoke the appropriate AddressSpace/OpRegion handler */ - else if (Status == AE_NOT_EXIST) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlWriteField: **** Region type %s(%X) does not have a handler\n", - AcpiCmGetRegionName (RgnDesc->Region.SpaceId), - RgnDesc->Region.SpaceId)); + Status = AcpiEvAddressSpaceDispatch (RgnDesc, ACPI_WRITE_ADR_SPACE, + Address, ObjDesc->CommonField.AccessBitWidth, &Value); + + if (Status == AE_NOT_IMPLEMENTED) + { + DEBUG_PRINTP (ACPI_ERROR, + ("**** Region type %s(%X) not implemented\n", + AcpiUtGetRegionName (RgnDesc->Region.SpaceId), + RgnDesc->Region.SpaceId)); + } + + else if (Status == AE_NOT_EXIST) + { + DEBUG_PRINTP (ACPI_ERROR, + ("**** Region type %s(%X) does not have a handler\n", + AcpiUtGetRegionName (RgnDesc->Region.SpaceId), + RgnDesc->Region.SpaceId)); + } + + break; + + + default: + + DEBUG_PRINTP (ACPI_ERROR, ("%p, wrong source type - %s\n", + ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type))); + Status = AE_AML_INTERNAL; + break; } + + DEBUG_PRINTP (TRACE_BFIELD, ("Value written=%08lX \n", Value)); return_ACPI_STATUS (Status); } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiAmlWriteFieldDataWithUpdateRule + * FUNCTION: AcpiExWriteFieldDatumWithUpdateRule * * PARAMETERS: *ObjDesc - Field to be set * Value - Value to store - * FieldBitWidth - Field Width in bits (8, 16, or 32) * * RETURN: Status * * DESCRIPTION: Apply the field update rule to a field write * - ****************************************************************************/ + ******************************************************************************/ static ACPI_STATUS -AcpiAmlWriteFieldDataWithUpdateRule ( +AcpiExWriteFieldDatumWithUpdateRule ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 Mask, UINT32 FieldValue, - UINT32 ThisFieldByteOffset, - UINT32 BitGranularity) + UINT32 FieldDatumByteOffset) { ACPI_STATUS Status = AE_OK; UINT32 MergedValue; UINT32 CurrentValue; + FUNCTION_TRACE ("ExWriteFieldDatumWithUpdateRule"); + + /* Start with the new bits */ MergedValue = FieldValue; + /* If the mask is all ones, we don't need to worry about the update rule */ - /* Decode the update rule */ - - switch (ObjDesc->Field.UpdateRule) + if (Mask != ACPI_UINT32_MAX) { + /* Decode the update rule */ - case UPDATE_PRESERVE: + switch (ObjDesc->CommonField.UpdateRule) + { - /* Check if update rule needs to be applied (not if mask is all ones) */ + case UPDATE_PRESERVE: - /* The left shift drops the bits we want to ignore. */ - if ((~Mask << (sizeof(Mask)*8 - BitGranularity)) != 0) - { - /* - * Read the current contents of the byte/word/dword containing - * the field, and merge with the new field value. + /* + * Check if update rule needs to be applied (not if mask is all + * ones) The left shift drops the bits we want to ignore. */ - Status = AcpiAmlReadFieldData (ObjDesc, ThisFieldByteOffset, - BitGranularity, &CurrentValue); - MergedValue |= (CurrentValue & ~Mask); - } - break; + if ((~Mask << (sizeof (Mask) * 8 - + ObjDesc->CommonField.AccessBitWidth)) != 0) + { + /* + * Read the current contents of the byte/word/dword containing + * the field, and merge with the new field value. + */ + Status = AcpiExReadFieldDatum (ObjDesc, FieldDatumByteOffset, + &CurrentValue); + MergedValue |= (CurrentValue & ~Mask); + } + break; - case UPDATE_WRITE_AS_ONES: + case UPDATE_WRITE_AS_ONES: - /* Set positions outside the field to all ones */ + /* Set positions outside the field to all ones */ - MergedValue |= ~Mask; - break; + MergedValue |= ~Mask; + break; - case UPDATE_WRITE_AS_ZEROS: + case UPDATE_WRITE_AS_ZEROS: - /* Set positions outside the field to all zeros */ + /* Set positions outside the field to all zeros */ - MergedValue &= Mask; - break; + MergedValue &= Mask; + break; - default: - DEBUG_PRINT (ACPI_ERROR, - ("WriteFieldDataWithUpdateRule: Unknown UpdateRule setting: %x\n", - ObjDesc->Field.UpdateRule)); - Status = AE_AML_OPERAND_VALUE; + default: + DEBUG_PRINT (ACPI_ERROR, + ("WriteWithUpdateRule: Unknown UpdateRule setting: %x\n", + ObjDesc->CommonField.UpdateRule)); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); + break; + } } /* Write the merged value */ - if (ACPI_SUCCESS (Status)) - { - Status = AcpiAmlWriteFieldData (ObjDesc, ThisFieldByteOffset, - BitGranularity, MergedValue); - } + Status = AcpiExWriteFieldDatum (ObjDesc, FieldDatumByteOffset, + MergedValue); + + DEBUG_PRINTP (TRACE_BFIELD, ("Mask %X DatumOffset %X Value %X, MergedValue %X\n", + Mask, FieldDatumByteOffset, FieldValue, MergedValue)); - return (Status); + return_ACPI_STATUS (Status); } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiAmlWriteField + * FUNCTION: AcpiExInsertIntoField * * PARAMETERS: *ObjDesc - Field to be set - * Value - Value to store - * FieldBitWidth - Field Width in bits (8, 16, or 32) + * Buffer - Value to store * * RETURN: Status * * DESCRIPTION: Store the value into the given field * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiAmlWriteField ( +AcpiExInsertIntoField ( ACPI_OPERAND_OBJECT *ObjDesc, void *Buffer, - UINT32 BufferLength, - UINT32 ByteLength, - UINT32 DatumLength, - UINT32 BitGranularity, - UINT32 ByteGranularity) + UINT32 BufferLength) { ACPI_STATUS Status; - UINT32 ThisFieldByteOffset; - UINT32 ThisFieldDatumOffset; + UINT32 FieldDatumByteOffset; + UINT32 DatumOffset; UINT32 Mask; UINT32 MergedDatum; UINT32 PreviousRawDatum; UINT32 ThisRawDatum; - UINT32 FieldValue; - UINT32 ValidFieldBits; + UINT32 ByteFieldLength; + UINT32 DatumCount; - FUNCTION_TRACE ("AmlWriteField"); + FUNCTION_TRACE ("ExInsertIntoField"); /* - * Break the request into up to three parts: - * non-aligned part at start, aligned part in middle, non-aligned part - * at end --- Just like an I/O request --- + * Incoming buffer must be at least as long as the field, we do not + * allow "partial" field writes. We do not care if the buffer is + * larger than the field, this typically happens when an integer is + * written to a field that is actually smaller than an integer. */ + ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength); + if (BufferLength < ByteFieldLength) + { + DEBUG_PRINTP (ACPI_INFO, ("Buffer length %X too small for field %X\n", + BufferLength, ByteFieldLength)); - ThisFieldByteOffset = 0; - ThisFieldDatumOffset= 0; + /* TBD: Need a better error code */ - /* Get a datum */ + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + } - switch (ByteGranularity) - { - case 1: - PreviousRawDatum = ((UINT8 *) Buffer) [ThisFieldDatumOffset]; - break; + /* Convert byte count to datum count, round up if necessary */ - case 2: - MOVE_UNALIGNED16_TO_32 (&PreviousRawDatum, &(((UINT16 *) Buffer) [ThisFieldDatumOffset])); - break; + DatumCount = ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth); - case 4: - MOVE_UNALIGNED32_TO_32 (&PreviousRawDatum, &(((UINT32 *) Buffer) [ThisFieldDatumOffset])); - break; + DEBUG_PRINT (ACPI_INFO, + ("ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n", + ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth, + ObjDesc->CommonField.AccessByteWidth)); - default: - DEBUG_PRINT (ACPI_ERROR, ("AmlWriteField: Invalid granularity: %x\n", - ByteGranularity)); - Status = AE_AML_OPERAND_VALUE; - goto Cleanup; - } + /* + * Break the request into up to three parts (similar to an I/O request): + * 1) non-aligned part at start + * 2) aligned part in middle + * 3) non-aligned part at the end + */ + FieldDatumByteOffset = 0; + DatumOffset= 0; + + /* Get a single datum from the caller's buffer */ + + AcpiExGetBufferDatum (&PreviousRawDatum, Buffer, + ObjDesc->CommonField.AccessByteWidth, DatumOffset); /* + * Part1: * Write a partial field datum if field does not begin on a datum boundary + * Note: The code in this section also handles the aligned case * * Construct Mask with 1 bits where the field is, 0 bits elsewhere + * (Only the bottom 5 bits of BitLength are valid for a shift operation) * - * 1) Bits above the field + * Mask off bits that are "below" the field (if any) */ + Mask = MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); - Mask = (((UINT32)(-1)) << (UINT32)ObjDesc->Field.BitOffset); - - /* 2) Only the bottom 5 bits are valid for a shift operation. */ + /* If the field fits in one datum, may need to mask upper bits */ - if ((ObjDesc->Field.BitOffset + ObjDesc->FieldUnit.Length) < 32) + if ((ObjDesc->CommonField.AccessFlags & AFIELD_SINGLE_DATUM) && + ObjDesc->CommonField.EndFieldValidBits) { - /* Bits above the field */ + /* There are bits above the field, mask them off also */ - Mask &= (~(((UINT32)(-1)) << ((UINT32)ObjDesc->Field.BitOffset + - (UINT32)ObjDesc->FieldUnit.Length))); + Mask &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); } - /* 3) Shift and mask the value into the field position */ + /* Shift and mask the value into the field position */ + + MergedDatum = (PreviousRawDatum << ObjDesc->CommonField.StartFieldBitOffset); + MergedDatum &= Mask; - FieldValue = (PreviousRawDatum << ObjDesc->Field.BitOffset) & Mask; + /* Apply the update rule (if necessary) and write the datum to the field */ - Status = AcpiAmlWriteFieldDataWithUpdateRule (ObjDesc, Mask, FieldValue, - ThisFieldByteOffset, - BitGranularity); + Status = AcpiExWriteFieldDatumWithUpdateRule (ObjDesc, Mask, MergedDatum, + FieldDatumByteOffset); if (ACPI_FAILURE (Status)) { - goto Cleanup; + return_ACPI_STATUS (Status); } + /* If the entire field fits within one datum, we are done. */ - /* If the field fits within one datum, we are done. */ - - if ((DatumLength == 1) && - ((ObjDesc->Field.BitOffset + ObjDesc->FieldUnit.Length) <= - (UINT16) BitGranularity)) + if ((DatumCount == 1) && + (ObjDesc->CommonField.AccessFlags & AFIELD_SINGLE_DATUM)) { - goto Cleanup; + return_ACPI_STATUS (AE_OK); } /* + * Part2: + * Write the aligned data. + * * We don't need to worry about the update rule for these data, because - * all of the bits are part of the field. + * all of the bits in each datum are part of the field. * - * Can't write the last datum, however, because it might contain bits that - * are not part of the field -- the update rule must be applied. + * The last datum must be special cased because it might contain bits + * that are not part of the field -- therefore the "update rule" must be + * applied in Part3 below. */ - - while (ThisFieldDatumOffset < (DatumLength - 1)) + while (DatumOffset < DatumCount) { - ThisFieldDatumOffset++; - - /* Get the next raw datum, it contains bits of the current field datum... */ - - switch (ByteGranularity) - { - case 1: - ThisRawDatum = ((UINT8 *) Buffer) [ThisFieldDatumOffset]; - break; - - case 2: - MOVE_UNALIGNED16_TO_32 (&ThisRawDatum, &(((UINT16 *) Buffer) [ThisFieldDatumOffset])); - break; - - case 4: - MOVE_UNALIGNED32_TO_32 (&ThisRawDatum, &(((UINT32 *) Buffer) [ThisFieldDatumOffset])); - break; + DatumOffset++; + FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; - default: - DEBUG_PRINT (ACPI_ERROR, ("AmlWriteField: Invalid Byte Granularity: %x\n", - ByteGranularity)); - Status = AE_AML_OPERAND_VALUE; - goto Cleanup; - } - - /* - * Put together bits of the two raw data to make a complete field - * datum + /* + * Get the next raw buffer datum. It may contain bits of the previous + * field datum */ + AcpiExGetBufferDatum (&ThisRawDatum, Buffer, + ObjDesc->CommonField.AccessByteWidth, DatumOffset); + + /* Create the field datum based on the field alignment */ - if (ObjDesc->Field.BitOffset != 0) + if (ObjDesc->CommonField.StartFieldBitOffset != 0) { - MergedDatum = - (PreviousRawDatum >> (BitGranularity - ObjDesc->Field.BitOffset)) | - (ThisRawDatum << ObjDesc->Field.BitOffset); + /* + * Put together appropriate bits of the two raw buffer data to make + * a single complete field datum + */ + MergedDatum = + (PreviousRawDatum >> ObjDesc->CommonField.DatumValidBits) | + (ThisRawDatum << ObjDesc->CommonField.StartFieldBitOffset); } else { - MergedDatum = ThisRawDatum; - } - - /* Now write the completed datum */ - + /* Field began aligned on datum boundary */ - Status = AcpiAmlWriteFieldData (ObjDesc, - ThisFieldByteOffset + ByteGranularity, - BitGranularity, MergedDatum); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; + MergedDatum = ThisRawDatum; } /* - * Save the most recent datum since it contains bits of - * the *next* field datum + * Special handling for the last datum if the field does NOT end on + * a datum boundary. Update Rule must be applied to the bits outside + * the field. */ + if ((DatumOffset == DatumCount) && + ObjDesc->CommonField.EndFieldValidBits) + { + /* + * Part3: + * This is the last datum and the field does not end on a datum boundary. + * Build the partial datum and write with the update rule. + */ - PreviousRawDatum = ThisRawDatum; - - ThisFieldByteOffset += ByteGranularity; + /* Mask off the unused bits above (after) the end-of-field */ - } /* while */ + Mask = MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); + MergedDatum &= Mask; + /* Write the last datum with the update rule */ - /* Write a partial field datum if field does not end on a datum boundary */ + Status = AcpiExWriteFieldDatumWithUpdateRule (ObjDesc, Mask, + MergedDatum, FieldDatumByteOffset); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + } - if ((ObjDesc->FieldUnit.Length + ObjDesc->FieldUnit.BitOffset) % - BitGranularity) - { - switch (ByteGranularity) + else { - case 1: - ThisRawDatum = ((UINT8 *) Buffer) [ThisFieldDatumOffset]; - break; - - case 2: - MOVE_UNALIGNED16_TO_32 (&ThisRawDatum, &(((UINT16 *) Buffer) [ThisFieldDatumOffset])); - break; + /* Normal case -- write the completed datum */ - case 4: - MOVE_UNALIGNED32_TO_32 (&ThisRawDatum, &(((UINT32 *) Buffer) [ThisFieldDatumOffset])); - break; + Status = AcpiExWriteFieldDatum (ObjDesc, + FieldDatumByteOffset, MergedDatum); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } - /* Construct Mask with 1 bits where the field is, 0 bits elsewhere */ - - ValidFieldBits = ((ObjDesc->FieldUnit.Length % BitGranularity) + - ObjDesc->Field.BitOffset); - - Mask = (((UINT32) 1 << ValidFieldBits) - (UINT32) 1); - - /* Shift and mask the value into the field position */ - - FieldValue = (PreviousRawDatum >> - (BitGranularity - ObjDesc->Field.BitOffset)) & Mask; - - Status = AcpiAmlWriteFieldDataWithUpdateRule (ObjDesc, Mask, FieldValue, - ThisFieldByteOffset + ByteGranularity, - BitGranularity); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } + /* + * Save the most recent datum since it may contain bits of the *next* + * field datum. Update current byte offset. + */ + PreviousRawDatum = ThisRawDatum; } -Cleanup: - return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exmisc.c b/sys/contrib/dev/acpica/exmisc.c index 505d9d4..58bc815 100644 --- a/sys/contrib/dev/acpica/exmisc.c +++ b/sys/contrib/dev/acpica/exmisc.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: ammisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 73 $ + * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes + * $Revision: 77 $ * *****************************************************************************/ @@ -116,7 +116,7 @@ * *****************************************************************************/ -#define __AMMISC_C__ +#define __EXMISC_C__ #include "acpi.h" #include "acparser.h" @@ -125,13 +125,13 @@ #include "acdispat.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("ammisc") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exmisc") /******************************************************************************* * - * FUNCTION: AcpiAmlExecFatal + * FUNCTION: AcpiExFatal * * PARAMETERS: none * @@ -149,7 +149,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlExecFatal ( +AcpiExFatal ( ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *TypeDesc; @@ -158,15 +158,15 @@ AcpiAmlExecFatal ( ACPI_STATUS Status; - FUNCTION_TRACE ("AmlExecFatal"); + FUNCTION_TRACE ("ExFatal"); /* Resolve operands */ - Status = AcpiAmlResolveOperands (AML_FATAL_OP, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (AML_FATAL_OP, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (AML_FATAL_OP), - 3, "after AcpiAmlResolveOperands"); + 3, "after AcpiExResolveOperands"); /* Get operands */ @@ -177,19 +177,16 @@ AcpiAmlExecFatal ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("AcpiAmlExecFatal/AML_FATAL_OP: bad operand(s) (Status=%X)\n", + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (Status=%X)\n", Status)); - goto Cleanup; } /* DefFatal := FatalOp FatalType FatalCode FatalArg */ - - DEBUG_PRINT (ACPI_INFO, - ("FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", + DEBUG_PRINTP (ACPI_INFO, + ("Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n", TypeDesc->Integer.Value, CodeDesc->Integer.Value, ArgDesc->Integer.Value)); @@ -203,9 +200,9 @@ Cleanup: /* Free the operands */ - AcpiCmRemoveReference (ArgDesc); - AcpiCmRemoveReference (CodeDesc); - AcpiCmRemoveReference (TypeDesc); + AcpiUtRemoveReference (ArgDesc); + AcpiUtRemoveReference (CodeDesc); + AcpiUtRemoveReference (TypeDesc); /* If we get back from the OS call, we might as well keep going. */ @@ -217,7 +214,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecIndex + * FUNCTION: AcpiExIndex * * PARAMETERS: none * @@ -238,7 +235,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecIndex ( +AcpiExIndex ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) { @@ -250,16 +247,16 @@ AcpiAmlExecIndex ( ACPI_STATUS Status; - FUNCTION_TRACE ("AmlExecIndex"); + FUNCTION_TRACE ("ExIndex"); /* Resolve operands */ /* First operand can be either a package or a buffer */ - Status = AcpiAmlResolveOperands (AML_INDEX_OP, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (AML_INDEX_OP, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (AML_INDEX_OP), - 3, "after AcpiAmlResolveOperands"); + 3, "after AcpiExResolveOperands"); /* Get all operands */ @@ -270,17 +267,15 @@ AcpiAmlExecIndex ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("AcpiAmlExecIndex/AML_INDEX_OP: bad operand(s) (Status=%X)\n", + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (Status=%X)\n", Status)); - goto Cleanup; } /* Create the internal return object */ - RetDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE); + RetDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -298,14 +293,13 @@ AcpiAmlExecIndex ( if (IdxDesc->Integer.Value >= ObjDesc->Package.Count) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecIndex: Index value out of range\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Index value beyond package end\n")); Status = AE_AML_PACKAGE_LIMIT; goto Cleanup; } if ((ResDesc->Common.Type == INTERNAL_TYPE_REFERENCE) && - (ResDesc->Reference.OpCode == AML_ZERO_OP)) + (ResDesc->Reference.Opcode == AML_ZERO_OP)) { /* * There is no actual result descriptor (the ZeroOp Result @@ -313,7 +307,7 @@ AcpiAmlExecIndex ( * return a reference to the package element */ - AcpiCmRemoveReference (ResDesc); + AcpiUtRemoveReference (ResDesc); } else @@ -324,11 +318,11 @@ AcpiAmlExecIndex ( */ TmpDesc = ObjDesc->Package.Elements[IdxDesc->Integer.Value]; - RetDesc->Reference.OpCode = AML_INDEX_OP; + RetDesc->Reference.Opcode = AML_INDEX_OP; RetDesc->Reference.TargetType = TmpDesc->Common.Type; RetDesc->Reference.Object = TmpDesc; - Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState); + Status = AcpiExStore (RetDesc, ResDesc, WalkState); RetDesc->Reference.Object = NULL; } @@ -336,7 +330,7 @@ AcpiAmlExecIndex ( * The local return object must always be a reference to the package element, * not the element itself. */ - RetDesc->Reference.OpCode = AML_INDEX_OP; + RetDesc->Reference.Opcode = AML_INDEX_OP; RetDesc->Reference.TargetType = ACPI_TYPE_PACKAGE; RetDesc->Reference.Where = &ObjDesc->Package.Elements[IdxDesc->Integer.Value]; } @@ -347,18 +341,17 @@ AcpiAmlExecIndex ( if (IdxDesc->Integer.Value >= ObjDesc->Buffer.Length) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecIndex: Index value out of range\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Index value beyond end of buffer\n")); Status = AE_AML_BUFFER_LIMIT; goto Cleanup; } - RetDesc->Reference.OpCode = AML_INDEX_OP; + RetDesc->Reference.Opcode = AML_INDEX_OP; RetDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD; RetDesc->Reference.Object = ObjDesc; RetDesc->Reference.Offset = (UINT32) IdxDesc->Integer.Value; - Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState); + Status = AcpiExStore (RetDesc, ResDesc, WalkState); } @@ -366,18 +359,18 @@ Cleanup: /* Always delete operands */ - AcpiCmRemoveReference (ObjDesc); - AcpiCmRemoveReference (IdxDesc); + AcpiUtRemoveReference (ObjDesc); + AcpiUtRemoveReference (IdxDesc); /* Delete return object on error */ if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ResDesc); + AcpiUtRemoveReference (ResDesc); if (RetDesc) { - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } } @@ -391,7 +384,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecMatch + * FUNCTION: AcpiExMatch * * PARAMETERS: none * @@ -412,7 +405,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecMatch ( +AcpiExMatch ( ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) { @@ -428,15 +421,15 @@ AcpiAmlExecMatch ( UINT32 MatchValue = (UINT32) -1; - FUNCTION_TRACE ("AmlExecMatch"); + FUNCTION_TRACE ("ExMatch"); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (AML_MATCH_OP, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (AML_MATCH_OP, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (AML_MATCH_OP), - 6, "after AcpiAmlResolveOperands"); + 6, "after AcpiExResolveOperands"); /* Get all operands */ @@ -451,10 +444,8 @@ AcpiAmlExecMatch ( { /* Invalid parameters on object stack */ - DEBUG_PRINT (ACPI_ERROR, - ("ExecMatch/AML_MATCH_OP: bad operand(s) (Status=%X)\n", + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) (Status=%X)\n", Status)); - goto Cleanup; } @@ -463,8 +454,7 @@ AcpiAmlExecMatch ( if ((Op1Desc->Integer.Value > MAX_MATCH_OPERATOR) || (Op2Desc->Integer.Value > MAX_MATCH_OPERATOR)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMatch: operation encoding out of range\n")); + DEBUG_PRINTP (ACPI_ERROR, ("operation encoding out of range\n")); Status = AE_AML_OPERAND_VALUE; goto Cleanup; } @@ -472,13 +462,12 @@ AcpiAmlExecMatch ( Index = (UINT32) StartDesc->Integer.Value; if (Index >= (UINT32) PkgDesc->Package.Count) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMatch: start position value out of range\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Start position value out of range\n")); Status = AE_AML_PACKAGE_LIMIT; goto Cleanup; } - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -657,12 +646,12 @@ Cleanup: /* Free the operands */ - AcpiCmRemoveReference (StartDesc); - AcpiCmRemoveReference (V2Desc); - AcpiCmRemoveReference (Op2Desc); - AcpiCmRemoveReference (V1Desc); - AcpiCmRemoveReference (Op1Desc); - AcpiCmRemoveReference (PkgDesc); + AcpiUtRemoveReference (StartDesc); + AcpiUtRemoveReference (V2Desc); + AcpiUtRemoveReference (Op2Desc); + AcpiUtRemoveReference (V1Desc); + AcpiUtRemoveReference (Op1Desc); + AcpiUtRemoveReference (PkgDesc); /* Delete return object on error */ @@ -670,7 +659,7 @@ Cleanup: if (ACPI_FAILURE (Status) && (RetDesc)) { - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } diff --git a/sys/contrib/dev/acpica/exmonad.c b/sys/contrib/dev/acpica/exmonad.c index 394780f..d82b767 100644 --- a/sys/contrib/dev/acpica/exmonad.c +++ b/sys/contrib/dev/acpica/exmonad.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: ammonad - ACPI AML (p-code) execution for monadic operators - * $Revision: 89 $ + * Module Name: exmonad - ACPI AML (p-code) execution for monadic operators + * $Revision: 99 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMMONAD_C__ +#define __EXMONAD_C__ #include "acpi.h" #include "acparser.h" @@ -125,13 +125,13 @@ #include "acnamesp.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("ammonad") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exmonad") /******************************************************************************* * - * FUNCTION: AcpiAmlGetObjectReference + * FUNCTION: AcpiExGetObjectReference * * PARAMETERS: ObjDesc - Create a reference to this object * RetDesc - Where to store the reference @@ -144,7 +144,7 @@ ******************************************************************************/ static ACPI_STATUS -AcpiAmlGetObjectReference ( +AcpiExGetObjectReference ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **RetDesc, ACPI_WALK_STATE *WalkState) @@ -152,7 +152,7 @@ AcpiAmlGetObjectReference ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_PTR ("AmlGetObjectReference", ObjDesc); + FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc); if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_INTERNAL)) @@ -166,29 +166,21 @@ AcpiAmlGetObjectReference ( /* * Not a Name -- an indirect name pointer would have - * been converted to a direct name pointer in AcpiAmlResolveOperands + * been converted to a direct name pointer in AcpiExResolveOperands */ - switch (ObjDesc->Reference.OpCode) + switch (ObjDesc->Reference.Opcode) { case AML_LOCAL_OP: - - *RetDesc = (void *) AcpiDsMethodDataGetNte (MTH_TYPE_LOCAL, - (ObjDesc->Reference.Offset), WalkState); - break; - - case AML_ARG_OP: - *RetDesc = (void *) AcpiDsMethodDataGetNte (MTH_TYPE_ARG, - (ObjDesc->Reference.Offset), WalkState); + *RetDesc = (void *) AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode, + ObjDesc->Reference.Offset, WalkState); break; - default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlGetObjectReference: (Internal) Unknown Ref subtype %02x\n", - ObjDesc->Reference.OpCode)); + DEBUG_PRINTP (ACPI_ERROR, ("(Internal) Unknown Ref subtype %02x\n", + ObjDesc->Reference.Opcode)); *RetDesc = NULL; Status = AE_AML_INTERNAL; goto Cleanup; @@ -212,15 +204,14 @@ AcpiAmlGetObjectReference ( Cleanup: - DEBUG_PRINT (TRACE_EXEC, - ("AmlGetObjectReference: Obj=%p Ref=%p\n", ObjDesc, *RetDesc)); + DEBUG_PRINTP (TRACE_EXEC, ("Obj=%p Ref=%p\n", ObjDesc, *RetDesc)); return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlExecMonadic1 + * FUNCTION: AcpiExMonadic1 * * PARAMETERS: Opcode - The opcode to be executed * @@ -232,7 +223,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecMonadic1 ( +AcpiExMonadic1 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState) { @@ -240,24 +231,23 @@ AcpiAmlExecMonadic1 ( ACPI_STATUS Status; - FUNCTION_TRACE_PTR ("AmlExecMonadic1", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExMonadic1", WALK_OPERANDS); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 1, "after AcpiAmlResolveOperands"); + 1, "after AcpiExResolveOperands"); /* Get all operands */ Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecMonadic1/%s: bad operand(s) (Status=%s)\n", - AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException(Status))); + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException(Status))); goto Cleanup; } @@ -272,7 +262,7 @@ AcpiAmlExecMonadic1 ( case AML_RELEASE_OP: - Status = AcpiAmlSystemReleaseMutex (ObjDesc); + Status = AcpiExReleaseMutex (ObjDesc, WalkState); break; @@ -280,7 +270,7 @@ AcpiAmlExecMonadic1 ( case AML_RESET_OP: - Status = AcpiAmlSystemResetEvent (ObjDesc); + Status = AcpiExSystemResetEvent (ObjDesc); break; @@ -288,7 +278,7 @@ AcpiAmlExecMonadic1 ( case AML_SIGNAL_OP: - Status = AcpiAmlSystemSignalEvent (ObjDesc); + Status = AcpiExSystemSignalEvent (ObjDesc); break; @@ -296,7 +286,7 @@ AcpiAmlExecMonadic1 ( case AML_SLEEP_OP: - AcpiAmlSystemDoSuspend ((UINT32) ObjDesc->Integer.Value); + AcpiExSystemDoSuspend ((UINT32) ObjDesc->Integer.Value); break; @@ -304,7 +294,7 @@ AcpiAmlExecMonadic1 ( case AML_STALL_OP: - AcpiAmlSystemDoStall ((UINT32) ObjDesc->Integer.Value); + AcpiExSystemDoStall ((UINT32) ObjDesc->Integer.Value); break; @@ -312,7 +302,7 @@ AcpiAmlExecMonadic1 ( default: - REPORT_ERROR (("AcpiAmlExecMonadic1: Unknown monadic opcode %X\n", + REPORT_ERROR (("AcpiExMonadic1: Unknown monadic opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; break; @@ -324,7 +314,7 @@ Cleanup: /* Always delete the operand */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (AE_OK); } @@ -332,7 +322,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecMonadic2R + * FUNCTION: AcpiExMonadic2R * * PARAMETERS: Opcode - The opcode to be executed * @@ -344,7 +334,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecMonadic2R ( +AcpiExMonadic2R ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) @@ -360,15 +350,15 @@ AcpiAmlExecMonadic2R ( ACPI_INTEGER Digit; - FUNCTION_TRACE_PTR ("AmlExecMonadic2R", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExMonadic2R", WALK_OPERANDS); /* Resolve all operands */ - Status = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + Status = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 2, "after AcpiAmlResolveOperands"); + 2, "after AcpiExResolveOperands"); /* Get all operands */ @@ -376,9 +366,8 @@ AcpiAmlExecMonadic2R ( Status |= AcpiDsObjStackPopObject (&ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecMonadic2R/%s: bad operand(s) (Status=%s)\n", - AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException(Status))); + DEBUG_PRINTP (ACPI_ERROR, ("bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException(Status))); goto Cleanup; } @@ -395,7 +384,7 @@ AcpiAmlExecMonadic2R ( case AML_TO_BCD_OP: case AML_COND_REF_OF_OP: - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -424,7 +413,7 @@ AcpiAmlExecMonadic2R ( /* * Acpi specification describes Integer type as a little - * endian unsigned value, so this boundry condition is valid. + * endian unsigned value, so this boundary condition is valid. */ for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal) { @@ -443,7 +432,7 @@ AcpiAmlExecMonadic2R ( /* * Acpi specification describes Integer type as a little - * endian unsigned value, so this boundry condition is valid. + * endian unsigned value, so this boundary condition is valid. */ for (ResVal = 0; RetDesc->Integer.Value && ResVal < ACPI_INTEGER_BIT_SIZE; ++ResVal) { @@ -474,8 +463,7 @@ AcpiAmlExecMonadic2R ( if (Digit > 9) { - DEBUG_PRINT (ACPI_ERROR, - ("Monadic2R/FromBCDOp: BCD digit too large: \n", + DEBUG_PRINTP (ACPI_ERROR, ("BCD digit too large: \n", Digit)); Status = AE_AML_NUMERIC_OVERFLOW; goto Cleanup; @@ -503,7 +491,7 @@ AcpiAmlExecMonadic2R ( if (ObjDesc->Integer.Value > ACPI_MAX_BCD_VALUE) { - DEBUG_PRINT (ACPI_ERROR, ("Monadic2R/ToBCDOp: BCD overflow: %d\n", + DEBUG_PRINTP (ACPI_ERROR, ("BCD overflow: %d\n", ObjDesc->Integer.Value)); Status = AE_AML_NUMERIC_OVERFLOW; goto Cleanup; @@ -554,19 +542,19 @@ AcpiAmlExecMonadic2R ( * being returned */ - AcpiCmRemoveReference (ResDesc); + AcpiUtRemoveReference (ResDesc); goto Cleanup; } /* Get the object reference and store it */ - Status = AcpiAmlGetObjectReference (ObjDesc, &RetDesc2, WalkState); + Status = AcpiExGetObjectReference (ObjDesc, &RetDesc2, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; } - Status = AcpiAmlExecStore (RetDesc2, ResDesc, WalkState); + Status = AcpiExStore (RetDesc2, ResDesc, WalkState); /* The object exists in the namespace, return TRUE */ @@ -587,12 +575,12 @@ AcpiAmlExecMonadic2R ( * since the object itself may have been stored. */ - Status = AcpiAmlExecStore (ObjDesc, ResDesc, WalkState); + Status = AcpiExStore (ObjDesc, ResDesc, WalkState); if (ACPI_FAILURE (Status)) { /* On failure, just delete the ObjDesc */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } else @@ -616,8 +604,7 @@ AcpiAmlExecMonadic2R ( /* Reference, returning an Reference */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMonadic2R: DebugOp should never get here!\n")); + DEBUG_PRINTP (ACPI_ERROR, ("DebugOp should never get here!\n")); return_ACPI_STATUS (AE_OK); break; @@ -632,7 +619,7 @@ AcpiAmlExecMonadic2R ( case AML_SHIFT_LEFT_BIT_OP: case AML_SHIFT_RIGHT_BIT_OP: - DEBUG_PRINT (ACPI_ERROR, ("AmlExecMonadic2R: %s unimplemented\n", + DEBUG_PRINTP (ACPI_ERROR, ("%s is unimplemented\n", AcpiPsGetOpcodeName (Opcode))); Status = AE_SUPPORT; goto Cleanup; @@ -641,29 +628,29 @@ AcpiAmlExecMonadic2R ( default: - REPORT_ERROR (("AcpiAmlExecMonadic2R: Unknown monadic opcode %X\n", + REPORT_ERROR (("AcpiExMonadic2R: Unknown monadic opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; } - Status = AcpiAmlExecStore (RetDesc, ResDesc, WalkState); + Status = AcpiExStore (RetDesc, ResDesc, WalkState); Cleanup: /* Always delete the operand object */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); /* Delete return object(s) on error */ if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ResDesc); /* Result descriptor */ + AcpiUtRemoveReference (ResDesc); /* Result descriptor */ if (RetDesc) { - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } } @@ -677,7 +664,7 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiAmlExecMonadic2 + * FUNCTION: AcpiExMonadic2 * * PARAMETERS: Opcode - The opcode to be executed * @@ -690,7 +677,7 @@ Cleanup: ******************************************************************************/ ACPI_STATUS -AcpiAmlExecMonadic2 ( +AcpiExMonadic2 ( UINT16 Opcode, ACPI_WALK_STATE *WalkState, ACPI_OPERAND_OBJECT **ReturnDesc) @@ -704,37 +691,34 @@ AcpiAmlExecMonadic2 ( ACPI_INTEGER Value; - FUNCTION_TRACE_PTR ("AmlExecMonadic2", WALK_OPERANDS); + FUNCTION_TRACE_PTR ("ExMonadic2", WALK_OPERANDS); /* Attempt to resolve the operands */ - ResolveStatus = AcpiAmlResolveOperands (Opcode, WALK_OPERANDS, WalkState); + ResolveStatus = AcpiExResolveOperands (Opcode, WALK_OPERANDS, WalkState); DUMP_OPERANDS (WALK_OPERANDS, IMODE_EXECUTE, AcpiPsGetOpcodeName (Opcode), - 1, "after AcpiAmlResolveOperands"); + 1, "after AcpiExResolveOperands"); /* Always get all operands */ Status = AcpiDsObjStackPopObject (&ObjDesc, WalkState); - /* Now we can check the status codes */ if (ACPI_FAILURE (ResolveStatus)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecMonadic2[%s]: Could not resolve operands, %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException (ResolveStatus))); + DEBUG_PRINTP (ACPI_ERROR, ("[%s]: Could not resolve operands, %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (ResolveStatus))); goto Cleanup; } if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecMonadic2[%s]: Bad operand(s), %s\n", - AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("[%s]: Bad operand(s), %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException (Status))); goto Cleanup; } @@ -750,7 +734,7 @@ AcpiAmlExecMonadic2 ( case AML_LNOT_OP: - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -775,26 +759,26 @@ AcpiAmlExecMonadic2 ( * an Reference is expected!! 10/99 */ - if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) - { - RetDesc = ObjDesc; - } + if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) + { + RetDesc = ObjDesc; + } - else - { + else + { /* * Duplicate the Reference in a new object so that we can resolve it * without destroying the original Reference object */ - RetDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE); + RetDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE); if (!RetDesc) { - Status = AE_NO_MEMORY; - goto Cleanup; + Status = AE_NO_MEMORY; + goto Cleanup; } - RetDesc->Reference.OpCode = ObjDesc->Reference.OpCode; + RetDesc->Reference.Opcode = ObjDesc->Reference.Opcode; RetDesc->Reference.Offset = ObjDesc->Reference.Offset; RetDesc->Reference.Object = ObjDesc->Reference.Object; } @@ -805,12 +789,11 @@ AcpiAmlExecMonadic2 ( * (This deletes the original RetDesc) */ - Status = AcpiAmlResolveOperands (AML_LNOT_OP, &RetDesc, WalkState); + Status = AcpiExResolveOperands (AML_LNOT_OP, &RetDesc, WalkState); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("ExecMonadic2/%s: bad operand(s) (Status=%s)\n", - AcpiPsGetOpcodeName (Opcode), AcpiCmFormatException(Status))); + DEBUG_PRINTP (ACPI_ERROR, ("%s: bad operand(s) %s\n", + AcpiPsGetOpcodeName (Opcode), AcpiUtFormatException(Status))); goto Cleanup; } @@ -828,7 +811,7 @@ AcpiAmlExecMonadic2 ( /* Store the result back in the original descriptor */ - Status = AcpiAmlExecStore (RetDesc, ObjDesc, WalkState); + Status = AcpiExStore (RetDesc, ObjDesc, WalkState); /* Objdesc was just deleted (because it is an Reference) */ @@ -847,7 +830,7 @@ AcpiAmlExecMonadic2 ( * Not a Name -- an indirect name pointer would have * been converted to a direct name pointer in ResolveOperands */ - switch (ObjDesc->Reference.OpCode) + switch (ObjDesc->Reference.Opcode) { case AML_ZERO_OP: case AML_ONE_OP: @@ -886,23 +869,17 @@ AcpiAmlExecMonadic2 ( case AML_LOCAL_OP: - - Type = AcpiDsMethodDataGetType (MTH_TYPE_LOCAL, - (ObjDesc->Reference.Offset), WalkState); - break; - - case AML_ARG_OP: - Type = AcpiDsMethodDataGetType (MTH_TYPE_ARG, - (ObjDesc->Reference.Offset), WalkState); + Type = AcpiDsMethodDataGetType (ObjDesc->Reference.Opcode, + ObjDesc->Reference.Offset, WalkState); break; default: - REPORT_ERROR (("AcpiAmlExecMonadic2/TypeOp: Internal error - Unknown Reference subtype %X\n", - ObjDesc->Reference.OpCode)); + REPORT_ERROR (("AcpiExMonadic2/TypeOp: Internal error - Unknown Reference subtype %X\n", + ObjDesc->Reference.Opcode)); Status = AE_AML_INTERNAL; goto Cleanup; } @@ -913,12 +890,24 @@ AcpiAmlExecMonadic2 ( /* * It's not a Reference, so it must be a direct name pointer. */ - Type = AcpiNsGetType ((ACPI_HANDLE) ObjDesc); + Type = AcpiNsGetType ((ACPI_NAMESPACE_NODE *) ObjDesc); + + /* Convert internal types to external types */ + + switch (Type) + { + case INTERNAL_TYPE_REGION_FIELD: + case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: + + Type = ACPI_TYPE_FIELD_UNIT; + } + } /* Allocate a descriptor to hold the type. */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -935,7 +924,7 @@ AcpiAmlExecMonadic2 ( if (VALID_DESCRIPTOR_TYPE (ObjDesc, ACPI_DESC_TYPE_NAMED)) { - ObjDesc = AcpiNsGetAttachedObject (ObjDesc); + ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc); } if (!ObjDesc) @@ -972,8 +961,7 @@ AcpiAmlExecMonadic2 ( default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMonadic2: Not Buf/Str/Pkg - found type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Not Buf/Str/Pkg - found type %X\n", ObjDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -985,7 +973,7 @@ AcpiAmlExecMonadic2 ( * object to hold the value */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -1000,7 +988,7 @@ AcpiAmlExecMonadic2 ( case AML_REF_OF_OP: - Status = AcpiAmlGetObjectReference (ObjDesc, &RetDesc, WalkState); + Status = AcpiExGetObjectReference (ObjDesc, &RetDesc, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -1020,34 +1008,21 @@ AcpiAmlExecMonadic2 ( /* * Must resolve/dereference the local/arg reference first */ - switch (ObjDesc->Reference.OpCode) + switch (ObjDesc->Reference.Opcode) { /* Set ObjDesc to the value of the local/arg */ case AML_LOCAL_OP: - - AcpiDsMethodDataGetValue (MTH_TYPE_LOCAL, - (ObjDesc->Reference.Offset), WalkState, &TmpDesc); - - /* - * Delete our reference to the input object and - * point to the object just retrieved - */ - AcpiCmRemoveReference (ObjDesc); - ObjDesc = TmpDesc; - break; - - case AML_ARG_OP: - AcpiDsMethodDataGetValue (MTH_TYPE_ARG, - (ObjDesc->Reference.Offset), WalkState, &TmpDesc); + AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode, + ObjDesc->Reference.Offset, WalkState, &TmpDesc); /* * Delete our reference to the input object and * point to the object just retrieved */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = TmpDesc; break; @@ -1069,7 +1044,7 @@ AcpiAmlExecMonadic2 ( /* Returning a pointer to the object, add another reference! */ - AcpiCmAddReference (RetDesc); + AcpiUtAddReference (RetDesc); } else @@ -1079,19 +1054,18 @@ AcpiAmlExecMonadic2 ( * ASL operation -- check internal opcode */ - if ((ObjDesc->Reference.OpCode != AML_INDEX_OP) && - (ObjDesc->Reference.OpCode != AML_REF_OF_OP)) + if ((ObjDesc->Reference.Opcode != AML_INDEX_OP) && + (ObjDesc->Reference.Opcode != AML_REF_OF_OP)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMonadic2: DerefOf, invalid obj ref %p\n", - ObjDesc)); + DEBUG_PRINTP (ACPI_ERROR, ("Unknown opcode in ref(%p) - %X\n", + ObjDesc, ObjDesc->Reference.Opcode)); Status = AE_TYPE; goto Cleanup; } - switch (ObjDesc->Reference.OpCode) + switch (ObjDesc->Reference.Opcode) { case AML_INDEX_OP: @@ -1112,7 +1086,7 @@ AcpiAmlExecMonadic2 ( * sub-buffer of the main buffer, it is only a pointer to a * single element (byte) of the buffer! */ - RetDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + RetDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!RetDesc) { Status = AE_NO_MEMORY; @@ -1145,20 +1119,18 @@ AcpiAmlExecMonadic2 ( * severe error. */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMonadic2: DerefOf, NULL package element obj %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("NULL package element obj %p\n", ObjDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; goto Cleanup; } - AcpiCmAddReference (RetDesc); + AcpiUtAddReference (RetDesc); } else { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecMonadic2: DerefOf, Unknown TargetType %X in obj %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Unknown TargetType %X in obj %p\n", ObjDesc->Reference.TargetType, ObjDesc)); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -1173,7 +1145,7 @@ AcpiAmlExecMonadic2 ( /* Add another reference to the object! */ - AcpiCmAddReference (RetDesc); + AcpiUtAddReference (RetDesc); break; } } @@ -1183,7 +1155,7 @@ AcpiAmlExecMonadic2 ( default: - REPORT_ERROR (("AcpiAmlExecMonadic2: Unknown monadic opcode %X\n", + REPORT_ERROR (("AcpiExMonadic2: Unknown monadic opcode %X\n", Opcode)); Status = AE_AML_BAD_OPCODE; goto Cleanup; @@ -1194,7 +1166,7 @@ Cleanup: if (ObjDesc) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } /* Delete return object on error */ @@ -1202,7 +1174,7 @@ Cleanup: if (ACPI_FAILURE (Status) && (RetDesc)) { - AcpiCmRemoveReference (RetDesc); + AcpiUtRemoveReference (RetDesc); RetDesc = NULL; } diff --git a/sys/contrib/dev/acpica/exnames.c b/sys/contrib/dev/acpica/exnames.c index 9054e2e..f0ac7e9 100644 --- a/sys/contrib/dev/acpica/exnames.c +++ b/sys/contrib/dev/acpica/exnames.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amnames - interpreter/scanner name load/execute - * $Revision: 73 $ + * Module Name: exnames - interpreter/scanner name load/execute + * $Revision: 79 $ * *****************************************************************************/ @@ -115,15 +115,15 @@ * *****************************************************************************/ -#define __AMNAMES_C__ +#define __EXNAMES_C__ #include "acpi.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amnames") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exnames") /* AML Package Length encodings */ @@ -136,7 +136,7 @@ /******************************************************************************* * - * FUNCTION: AcpiAmlAllocateNameString + * FUNCTION: AcpiExAllocateNameString * * PARAMETERS: PrefixCount - Count of parent levels. Special cases: * (-1) = root, 0 = none @@ -151,7 +151,7 @@ ******************************************************************************/ NATIVE_CHAR * -AcpiAmlAllocateNameString ( +AcpiExAllocateNameString ( UINT32 PrefixCount, UINT32 NumNameSegs) { @@ -159,7 +159,7 @@ AcpiAmlAllocateNameString ( NATIVE_CHAR *NameString; UINT32 SizeNeeded; - FUNCTION_TRACE ("AmlAllocateNameString"); + FUNCTION_TRACE ("ExAllocateNameString"); /* @@ -184,10 +184,10 @@ AcpiAmlAllocateNameString ( * This buffer must be deleted by the caller! */ - NameString = AcpiCmAllocate (SizeNeeded); + NameString = AcpiUtAllocate (SizeNeeded); if (!NameString) { - REPORT_ERROR (("AmlAllocateNameString: name allocation failure\n")); + REPORT_ERROR (("ExAllocateNameString: name allocation failure\n")); return_PTR (NULL); } @@ -227,7 +227,7 @@ AcpiAmlAllocateNameString ( } /* - * Terminate string following prefixes. AcpiAmlExecNameSegment() will + * Terminate string following prefixes. AcpiExNameSegment() will * append the segment(s) */ @@ -238,7 +238,7 @@ AcpiAmlAllocateNameString ( /******************************************************************************* * - * FUNCTION: AcpiAmlExecNameSegment + * FUNCTION: AcpiExNameSegment * * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec) * @@ -249,7 +249,7 @@ AcpiAmlAllocateNameString ( ******************************************************************************/ ACPI_STATUS -AcpiAmlExecNameSegment ( +AcpiExNameSegment ( UINT8 **InAmlAddress, NATIVE_CHAR *NameString) { @@ -259,27 +259,25 @@ AcpiAmlExecNameSegment ( NATIVE_CHAR CharBuf[5]; - FUNCTION_TRACE ("AmlExecNameSegment"); + FUNCTION_TRACE ("ExNameSegment"); /* * If first character is a digit, then we know that we aren't looking at a * valid name segment */ - CharBuf[0] = *AmlAddress; if ('0' <= CharBuf[0] && CharBuf[0] <= '9') { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecNameSegment: leading digit: %c\n", CharBuf[0])); + DEBUG_PRINTP (ACPI_ERROR, ("leading digit: %c\n", CharBuf[0])); return_ACPI_STATUS (AE_CTRL_PENDING); } - DEBUG_PRINT (TRACE_LOAD, ("AmlExecNameSegment: Bytes from stream:\n")); + DEBUG_PRINTP (TRACE_LOAD, ("Bytes from stream:\n")); for (Index = 4; - (Index > 0) && (AcpiCmValidAcpiCharacter (*AmlAddress)); + (Index > 0) && (AcpiUtValidAcpiCharacter (*AmlAddress)); --Index) { CharBuf[4 - Index] = *AmlAddress++; @@ -298,14 +296,14 @@ AcpiAmlExecNameSegment ( if (NameString) { STRCAT (NameString, CharBuf); - DEBUG_PRINT (TRACE_NAMES, - ("AmlExecNameSegment: Appended to - %s \n", NameString)); + DEBUG_PRINTP (TRACE_NAMES, + ("Appended to - %s \n", NameString)); } else { - DEBUG_PRINT (TRACE_NAMES, - ("AmlExecNameSegment: No Name string - %s \n", CharBuf)); + DEBUG_PRINTP (TRACE_NAMES, + ("No Name string - %s \n", CharBuf)); } } @@ -315,8 +313,8 @@ AcpiAmlExecNameSegment ( * First character was not a valid name character, * so we are looking at something other than a name. */ - DEBUG_PRINT (ACPI_INFO, - ("AmlExecNameSegment: Leading INT8 not alpha: %02Xh (not a name)\n", + DEBUG_PRINTP (ACPI_INFO, + ("Leading character is not alpha: %02Xh (not a name)\n", CharBuf[0])); Status = AE_CTRL_PENDING; } @@ -326,23 +324,18 @@ AcpiAmlExecNameSegment ( /* Segment started with one or more valid characters, but fewer than 4 */ Status = AE_AML_BAD_NAME; - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecNameSegment: Bad INT8 %02x in name, at %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Bad character %02x in name, at %p\n", *AmlAddress, AmlAddress)); } - DEBUG_PRINT (TRACE_EXEC, ("Leave AcpiAmlExecNameSegment %s \n", - AcpiCmFormatException (Status))); - *InAmlAddress = AmlAddress; - return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlGetNameString + * FUNCTION: AcpiExGetNameString * * PARAMETERS: DataType - Data type to be associated with this name * @@ -354,8 +347,8 @@ AcpiAmlExecNameSegment ( ACPI_STATUS -AcpiAmlGetNameString ( - OBJECT_TYPE_INTERNAL DataType, +AcpiExGetNameString ( + ACPI_OBJECT_TYPE8 DataType, UINT8 *InAmlAddress, NATIVE_CHAR **OutNameString, UINT32 *OutNameLength) @@ -369,23 +362,23 @@ AcpiAmlGetNameString ( BOOLEAN HasPrefix = FALSE; - FUNCTION_TRACE_PTR ("AmlGetNameString", AmlAddress); + FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress); - if (INTERNAL_TYPE_DEF_FIELD == DataType || - INTERNAL_TYPE_BANK_FIELD == DataType || + if (INTERNAL_TYPE_REGION_FIELD == DataType || + INTERNAL_TYPE_BANK_FIELD == DataType || INTERNAL_TYPE_INDEX_FIELD == DataType) { - /* Disallow prefixes for types associated with field names */ + /* Disallow prefixes for types associated with FieldUnit names */ - NameString = AcpiAmlAllocateNameString (0, 1); + NameString = AcpiExAllocateNameString (0, 1); if (!NameString) { Status = AE_NO_MEMORY; } else { - Status = AcpiAmlExecNameSegment (&AmlAddress, NameString); + Status = AcpiExNameSegment (&AmlAddress, NameString); } } @@ -406,7 +399,7 @@ AcpiAmlGetNameString ( /* * Remember that we have a RootPrefix -- - * see comment in AcpiAmlAllocateNameString() + * see comment in AcpiExAllocateNameString() */ PrefixCount = (UINT32) -1; HasPrefix = TRUE; @@ -445,7 +438,7 @@ AcpiAmlGetNameString ( Prefix = *AmlAddress++; DEBUG_PRINT (TRACE_LOAD, ("DualNamePrefix: %x\n", Prefix)); - NameString = AcpiAmlAllocateNameString (PrefixCount, 2); + NameString = AcpiExAllocateNameString (PrefixCount, 2); if (!NameString) { Status = AE_NO_MEMORY; @@ -455,10 +448,10 @@ AcpiAmlGetNameString ( /* Indicate that we processed a prefix */ HasPrefix = TRUE; - Status = AcpiAmlExecNameSegment (&AmlAddress, NameString); + Status = AcpiExNameSegment (&AmlAddress, NameString); if (ACPI_SUCCESS (Status)) { - Status = AcpiAmlExecNameSegment (&AmlAddress, NameString); + Status = AcpiExNameSegment (&AmlAddress, NameString); } break; @@ -472,7 +465,7 @@ AcpiAmlGetNameString ( NumSegments = *AmlAddress++; - NameString = AcpiAmlAllocateNameString (PrefixCount, NumSegments); + NameString = AcpiExAllocateNameString (PrefixCount, NumSegments); if (!NameString) { Status = AE_NO_MEMORY; @@ -483,7 +476,7 @@ AcpiAmlGetNameString ( HasPrefix = TRUE; while (NumSegments && - (Status = AcpiAmlExecNameSegment (&AmlAddress, NameString)) == AE_OK) + (Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK) { --NumSegments; } @@ -497,14 +490,13 @@ AcpiAmlGetNameString ( if (-1 == PrefixCount) { - DEBUG_PRINT (TRACE_EXEC, - ("AmlDoName: NameSeg is \"\\\" followed by NULL\n")); + DEBUG_PRINTP (TRACE_EXEC, ("NameSeg is \"\\\" followed by NULL\n")); } /* Consume the NULL byte */ AmlAddress++; - NameString = AcpiAmlAllocateNameString (PrefixCount, 0); + NameString = AcpiExAllocateNameString (PrefixCount, 0); if (!NameString) { Status = AE_NO_MEMORY; @@ -518,14 +510,14 @@ AcpiAmlGetNameString ( /* Name segment string */ - NameString = AcpiAmlAllocateNameString (PrefixCount, 1); + NameString = AcpiExAllocateNameString (PrefixCount, 1); if (!NameString) { Status = AE_NO_MEMORY; break; } - Status = AcpiAmlExecNameSegment (&AmlAddress, NameString); + Status = AcpiExNameSegment (&AmlAddress, NameString); break; } /* Switch (PeekOp ()) */ @@ -537,7 +529,7 @@ AcpiAmlGetNameString ( /* Ran out of segments after processing a prefix */ REPORT_ERROR ( - ("AmlDoName: Malformed Name at %p\n", NameString)); + ("ExDoName: Malformed Name at %p\n", NameString)); Status = AE_AML_BAD_NAME; } diff --git a/sys/contrib/dev/acpica/exprep.c b/sys/contrib/dev/acpica/exprep.c index 13c7d04..951901c 100644 --- a/sys/contrib/dev/acpica/exprep.c +++ b/sys/contrib/dev/acpica/exprep.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 73 $ + * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities + * $Revision: 89 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMPREP_C__ +#define __EXPREP_C__ #include "acpi.h" #include "acinterp.h" @@ -124,15 +124,16 @@ #include "acparser.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amprep") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exprep") /******************************************************************************* * - * FUNCTION: AcpiAmlDecodeFieldAccessType + * FUNCTION: AcpiExDecodeFieldAccessType * * PARAMETERS: Access - Encoded field access bits + * Length - Field length. * * RETURN: Field granularity (8, 16, or 32) * @@ -141,7 +142,7 @@ ******************************************************************************/ static UINT32 -AcpiAmlDecodeFieldAccessType ( +AcpiExDecodeFieldAccessType ( UINT32 Access, UINT16 Length) { @@ -149,6 +150,9 @@ AcpiAmlDecodeFieldAccessType ( switch (Access) { case ACCESS_ANY_ACC: + + /* Use the length to set the access type */ + if (Length <= 8) { return (8); @@ -161,10 +165,14 @@ AcpiAmlDecodeFieldAccessType ( { return (32); } - else + else if (Length <= 64) { - return (8); + return (64); } + + /* Default is 8 (byte) */ + + return (8); break; case ACCESS_BYTE_ACC: @@ -179,11 +187,15 @@ AcpiAmlDecodeFieldAccessType ( return (32); break; + case ACCESS_QWORD_ACC: /* ACPI 2.0 */ + return (64); + break; + default: /* Invalid field access type */ DEBUG_PRINT (ACPI_ERROR, - ("AmlDecodeFieldAccessType: Unknown field access type %x\n", + ("ExDecodeFieldAccessType: Unknown field access type %x\n", Access)); return (0); } @@ -192,14 +204,14 @@ AcpiAmlDecodeFieldAccessType ( /******************************************************************************* * - * FUNCTION: AcpiAmlPrepCommonFieldObjec + * FUNCTION: AcpiExPrepCommonFieldObject * * PARAMETERS: ObjDesc - The field object - * FieldFlags - Access, LockRule, or UpdateRule. + * FieldFlags - Access, LockRule, and UpdateRule. * The format of a FieldFlag is described * in the ACPI specification - * FieldPosition - Field position - * FieldLength - Field length + * FieldBitPosition - Field start position + * FieldBitLength - Field length in number of bits * * RETURN: Status * @@ -208,54 +220,102 @@ AcpiAmlDecodeFieldAccessType ( * ******************************************************************************/ -static ACPI_STATUS -AcpiAmlPrepCommonFieldObject ( +ACPI_STATUS +AcpiExPrepCommonFieldObject ( ACPI_OPERAND_OBJECT *ObjDesc, UINT8 FieldFlags, - UINT8 FieldAttribute, - UINT32 FieldPosition, - UINT32 FieldLength) + UINT32 FieldBitPosition, + UINT32 FieldBitLength) { - UINT32 Granularity; + UINT32 AccessBitWidth; + UINT32 NearestByteAddress; - FUNCTION_TRACE ("AmlPrepCommonFieldObject"); + FUNCTION_TRACE ("ExPrepCommonFieldObject"); /* * Note: the structure being initialized is the - * ACPI_COMMON_FIELD_INFO; Therefore, we can just use the Field union to - * access this common area. No structure fields outside of the common area + * ACPI_COMMON_FIELD_INFO; No structure fields outside of the common area * are initialized by this procedure. */ - /* Decode the FieldFlags */ + /* Demultiplex the FieldFlags byte */ - ObjDesc->Field.Access = (UINT8) ((FieldFlags & ACCESS_TYPE_MASK) - >> ACCESS_TYPE_SHIFT); - ObjDesc->Field.LockRule = (UINT8) ((FieldFlags & LOCK_RULE_MASK) + ObjDesc->CommonField.LockRule = (UINT8) ((FieldFlags & LOCK_RULE_MASK) >> LOCK_RULE_SHIFT); - ObjDesc->Field.UpdateRule = (UINT8) ((FieldFlags & UPDATE_RULE_MASK) + ObjDesc->CommonField.UpdateRule = (UINT8) ((FieldFlags & UPDATE_RULE_MASK) >> UPDATE_RULE_SHIFT); - /* Other misc fields */ - ObjDesc->Field.Length = (UINT16) FieldLength; - ObjDesc->Field.AccessAttribute = FieldAttribute; + ObjDesc->CommonField.BitLength = (UINT16) FieldBitLength; /* Decode the access type so we can compute offsets */ - Granularity = AcpiAmlDecodeFieldAccessType (ObjDesc->Field.Access, ObjDesc->Field.Length); - if (!Granularity) + AccessBitWidth = AcpiExDecodeFieldAccessType ( + ((FieldFlags & ACCESS_TYPE_MASK) >> ACCESS_TYPE_SHIFT), + ObjDesc->Field.BitLength); + if (!AccessBitWidth) { return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } - /* Access granularity based fields */ + /* Setup granularity-based fields */ - ObjDesc->Field.Granularity = (UINT8) Granularity; - ObjDesc->Field.BitOffset = (UINT8) (FieldPosition % Granularity); - ObjDesc->Field.Offset = (UINT32) FieldPosition / Granularity; + ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth; /* 8, 16, 32, 64 */ + ObjDesc->CommonField.AccessByteWidth = (UINT8) DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */ + + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) + { + /* + * BufferField access can be on any byte boundary, so the + * granularity is always 8 + */ + AccessBitWidth = 8; + } + + /* + * BaseByteOffset is the address of the start of the field within the region. It is + * the byte address of the first *datum* (field-width data unit) of the field. + * (i.e., the first datum that contains at least the first *bit* of the field.) + */ + NearestByteAddress = ROUND_BITS_DOWN_TO_BYTES (FieldBitPosition); + ObjDesc->CommonField.BaseByteOffset = ROUND_DOWN (NearestByteAddress, + ObjDesc->CommonField.AccessByteWidth); + + /* + * StartFieldBitOffset is the offset of the first bit of the field within a field datum. + * This is calculated as the number of bits from the BaseByteOffset. In other words, + * the start of the field is relative to a byte address, regardless of the access type + * of the field. + */ + ObjDesc->CommonField.StartFieldBitOffset = (UINT8) (MOD_8 (FieldBitPosition)); + + /* + * DatumValidBits is the number of valid field bits in the first field datum. + */ + ObjDesc->CommonField.DatumValidBits = (UINT8) (AccessBitWidth - + ObjDesc->CommonField.StartFieldBitOffset); + + /* + * Valid bits -- the number of bits that compose a partial datum, + * 1) At the end of the field within the region (arbitrary starting bit offset) + * 2) At the end of a buffer used to contain the field (starting offset always zero) + */ + ObjDesc->CommonField.EndFieldValidBits = (UINT8) ((ObjDesc->CommonField.StartFieldBitOffset + + FieldBitLength) % AccessBitWidth); + ObjDesc->CommonField.EndBufferValidBits = (UINT8) (FieldBitLength % AccessBitWidth); /* StartBufferBitOffset always = 0 */ + + + /* + * Does the entire field fit within a single field access element + * (datum)? (without crossing a datum boundary) + */ + if ((ObjDesc->CommonField.StartFieldBitOffset + ObjDesc->CommonField.BitLength) <= + (UINT16) ObjDesc->CommonField.AccessBitWidth) + { + ObjDesc->CommonField.AccessFlags |= AFIELD_SINGLE_DATUM; + } return_ACPI_STATUS (AE_OK); @@ -264,15 +324,13 @@ AcpiAmlPrepCommonFieldObject ( /******************************************************************************* * - * FUNCTION: AcpiAmlPrepDefFieldValue + * FUNCTION: AcpiExPrepRegionFieldValue * - * PARAMETERS: Node - Owning Node - * Region - Region in which field is being defined - * FieldFlags - Access, LockRule, or UpdateRule. - * The format of a FieldFlag is described - * in the ACPI specification - * FieldPosition - Field position - * FieldLength - Field length + * PARAMETERS: Node - Owning Node + * RegionNode - Region in which field is being defined + * FieldFlags - Access, LockRule, and UpdateRule. + * FieldBitPosition - Field start position + * FieldBitLength - Field length in number of bits * * RETURN: Status * @@ -282,42 +340,40 @@ AcpiAmlPrepCommonFieldObject ( ******************************************************************************/ ACPI_STATUS -AcpiAmlPrepDefFieldValue ( +AcpiExPrepRegionFieldValue ( ACPI_NAMESPACE_NODE *Node, - ACPI_HANDLE Region, + ACPI_HANDLE RegionNode, UINT8 FieldFlags, - UINT8 FieldAttribute, - UINT32 FieldPosition, - UINT32 FieldLength) + UINT32 FieldBitPosition, + UINT32 FieldBitLength) { ACPI_OPERAND_OBJECT *ObjDesc; UINT32 Type; ACPI_STATUS Status; - FUNCTION_TRACE ("AmlPrepDefFieldValue"); + FUNCTION_TRACE ("ExPrepRegionFieldValue"); /* Parameter validation */ - if (!Region) + if (!RegionNode) { - DEBUG_PRINT (ACPI_ERROR, ("AmlPrepDefFieldValue: null Region\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Null RegionNode\n")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } - Type = AcpiNsGetType (Region); + Type = AcpiNsGetType (RegionNode); if (Type != ACPI_TYPE_REGION) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlPrepDefFieldValue: Needed Region, found type %X %s\n", - Type, AcpiCmGetTypeName (Type))); + DEBUG_PRINTP (ACPI_ERROR, ("Needed Region, found type %X %s\n", + Type, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* Allocate a new object */ - ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_DEF_FIELD); + ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REGION_FIELD); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -327,14 +383,14 @@ AcpiAmlPrepDefFieldValue ( /* ObjDesc and Region valid */ DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Node, IMODE_EXECUTE, - "AmlPrepDefFieldValue", 1, "case DefField"); - DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Region, IMODE_EXECUTE, - "AmlPrepDefFieldValue", 1, "case DefField"); + "ExPrepRegionFieldValue", 1, "case RegionField"); + DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &RegionNode, IMODE_EXECUTE, + "ExPrepRegionFieldValue", 1, "case RegionField"); /* Initialize areas of the object that are common to all fields */ - Status = AcpiAmlPrepCommonFieldObject (ObjDesc, FieldFlags, FieldAttribute, - FieldPosition, FieldLength); + Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, + FieldBitPosition, FieldBitLength); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -342,103 +398,88 @@ AcpiAmlPrepDefFieldValue ( /* Initialize areas of the object that are specific to this field type */ - ObjDesc->Field.Container = AcpiNsGetAttachedObject (Region); + ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (RegionNode); /* An additional reference for the container */ - AcpiCmAddReference (ObjDesc->Field.Container); + AcpiUtAddReference (ObjDesc->Field.RegionObj); /* Debug info */ - DEBUG_PRINT (ACPI_INFO, - ("AmlPrepDefFieldValue: bitoff=%X off=%X gran=%X\n", - ObjDesc->Field.BitOffset, ObjDesc->Field.Offset, - ObjDesc->Field.Granularity)); + DEBUG_PRINTP (ACPI_INFO, ("Bitoff=%X Off=%X Gran=%X Region %p\n", + ObjDesc->Field.StartFieldBitOffset, ObjDesc->Field.BaseByteOffset, + ObjDesc->Field.AccessBitWidth, ObjDesc->Field.RegionObj)); - DEBUG_PRINT (ACPI_INFO, - ("AmlPrepDefFieldValue: set NamedObj %p (%4.4s) val = %p\n", + DEBUG_PRINTP (ACPI_INFO, ("set NamedObj %p (%4.4s) val = %p\n", Node, &(Node->Name), ObjDesc)); - DUMP_STACK_ENTRY (ObjDesc); - DUMP_ENTRY (Region, ACPI_INFO); - DEBUG_PRINT (ACPI_INFO, ("\t%p \n", ObjDesc->Field.Container)); - if (ObjDesc->Field.Container) - { - DUMP_STACK_ENTRY (ObjDesc->Field.Container); - } - DEBUG_PRINT (ACPI_INFO, - ("============================================================\n")); /* - * Store the constructed descriptor (ObjDesc) into the NamedObj whose - * handle is on TOS, preserving the current type of that NamedObj. + * Store the constructed descriptor (ObjDesc) into the parent Node, + * preserving the current type of that NamedObj. */ - Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc, - (UINT8) AcpiNsGetType ((ACPI_HANDLE) Node)); - + Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) AcpiNsGetType (Node)); return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlPrepBankFieldValue + * FUNCTION: AcpiExPrepBankFieldValue * - * PARAMETERS: Node - Owning Node - * Region - Region in which field is being defined - * BankReg - Bank selection register + * PARAMETERS: Node - Owning Node + * RegionNode - Region in which field is being defined + * BankRegisterNode - Bank selection register node * BankVal - Value to store in selection register - * FieldFlags - Access, LockRule, or UpdateRule - * FieldPosition - Field position - * FieldLength - Field length + * FieldFlags - Access, LockRule, and UpdateRule + * FieldBitPosition - Field start position + * FieldBitLength - Field length in number of bits * * RETURN: Status * - * DESCRIPTION: Construct an ACPI_OPERAND_OBJECT of type BankField and - * connect it to the parent Node. + * DESCRIPTION: Construct an object of type BankField and attach it to the + * parent Node. * ******************************************************************************/ ACPI_STATUS -AcpiAmlPrepBankFieldValue ( +AcpiExPrepBankFieldValue ( ACPI_NAMESPACE_NODE *Node, - ACPI_HANDLE Region, - ACPI_HANDLE BankReg, + ACPI_NAMESPACE_NODE *RegionNode, + ACPI_NAMESPACE_NODE *BankRegisterNode, UINT32 BankVal, UINT8 FieldFlags, - UINT8 FieldAttribute, - UINT32 FieldPosition, - UINT32 FieldLength) + UINT32 FieldBitPosition, + UINT32 FieldBitLength) { ACPI_OPERAND_OBJECT *ObjDesc; UINT32 Type; ACPI_STATUS Status; - FUNCTION_TRACE ("AmlPrepBankFieldValue"); + FUNCTION_TRACE ("ExPrepBankFieldValue"); /* Parameter validation */ - if (!Region) + if (!RegionNode) { - DEBUG_PRINT (ACPI_ERROR, ("AmlPrepBankFieldValue: null Region\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Null RegionNode\n")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } - Type = AcpiNsGetType (Region); + Type = AcpiNsGetType (RegionNode); if (Type != ACPI_TYPE_REGION) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlPrepBankFieldValue: Needed Region, found type %X %s\n", - Type, AcpiCmGetTypeName (Type))); + DEBUG_PRINTP (ACPI_ERROR, ("Needed Region, found type %X %s\n", + Type, AcpiUtGetTypeName (Type))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* Allocate a new object */ - ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_BANK_FIELD); + ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_BANK_FIELD); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -447,14 +488,14 @@ AcpiAmlPrepBankFieldValue ( /* ObjDesc and Region valid */ DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Node, IMODE_EXECUTE, - "AmlPrepBankFieldValue", 1, "case BankField"); - DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &Region, IMODE_EXECUTE, - "AmlPrepBankFieldValue", 1, "case BankField"); + "ExPrepBankFieldValue", 1, "case BankField"); + DUMP_OPERANDS ((ACPI_OPERAND_OBJECT **) &RegionNode, IMODE_EXECUTE, + "ExPrepBankFieldValue", 1, "case BankField"); /* Initialize areas of the object that are common to all fields */ - Status = AcpiAmlPrepCommonFieldObject (ObjDesc, FieldFlags, FieldAttribute, - FieldPosition, FieldLength); + Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, + FieldBitPosition, FieldBitLength); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -462,54 +503,45 @@ AcpiAmlPrepBankFieldValue ( /* Initialize areas of the object that are specific to this field type */ - ObjDesc->BankField.Value = BankVal; - ObjDesc->BankField.Container = AcpiNsGetAttachedObject (Region); - ObjDesc->BankField.BankSelect = AcpiNsGetAttachedObject (BankReg); + ObjDesc->BankField.Value = BankVal; + ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (RegionNode); + ObjDesc->BankField.BankRegisterObj = AcpiNsGetAttachedObject (BankRegisterNode); - /* An additional reference for the container and bank select */ - /* TBD: [Restructure] is "BankSelect" ever a real internal object?? */ + /* An additional reference for the attached objects */ - AcpiCmAddReference (ObjDesc->BankField.Container); - AcpiCmAddReference (ObjDesc->BankField.BankSelect); + AcpiUtAddReference (ObjDesc->BankField.RegionObj); + AcpiUtAddReference (ObjDesc->BankField.BankRegisterObj); /* Debug info */ - DEBUG_PRINT (ACPI_INFO, - ("AmlPrepBankFieldValue: bitoff=%X off=%X gran=%X\n", - ObjDesc->BankField.BitOffset, ObjDesc->BankField.Offset, - ObjDesc->Field.Granularity)); + DEBUG_PRINTP (ACPI_INFO, ("BitOff=%X Off=%X Gran=%X Region %p BankReg %p\n", + ObjDesc->BankField.StartFieldBitOffset, ObjDesc->BankField.BaseByteOffset, + ObjDesc->Field.AccessBitWidth, ObjDesc->BankField.RegionObj, + ObjDesc->BankField.BankRegisterObj)); - DEBUG_PRINT (ACPI_INFO, - ("AmlPrepBankFieldValue: set NamedObj %p (%4.4s) val = %p\n", + DEBUG_PRINTP (ACPI_INFO, ("Set NamedObj %p (%4.4s) val=%p\n", Node, &(Node->Name), ObjDesc)); - DUMP_STACK_ENTRY (ObjDesc); - DUMP_ENTRY (Region, ACPI_INFO); - DUMP_ENTRY (BankReg, ACPI_INFO); - DEBUG_PRINT (ACPI_INFO, - ("============================================================\n")); /* - * Store the constructed descriptor (ObjDesc) into the NamedObj whose - * handle is on TOS, preserving the current type of that NamedObj. + * Store the constructed descriptor (ObjDesc) into the parent Node, + * preserving the current type of that NamedObj. */ - Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc, - (UINT8) AcpiNsGetType ((ACPI_HANDLE) Node)); - + Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) AcpiNsGetType (Node)); return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlPrepIndexFieldValue + * FUNCTION: AcpiExPrepIndexFieldValue * - * PARAMETERS: Node - Owning Node + * PARAMETERS: Node - Owning Node * IndexReg - Index register * DataReg - Data register - * FieldFlags - Access, LockRule, or UpdateRule - * FieldPosition - Field position - * FieldLength - Field length + * FieldFlags - Access, LockRule, and UpdateRule + * FieldBitPosition - Field start position + * FieldBitLength - Field length in number of bits * * RETURN: Status * @@ -519,33 +551,32 @@ AcpiAmlPrepBankFieldValue ( ******************************************************************************/ ACPI_STATUS -AcpiAmlPrepIndexFieldValue ( +AcpiExPrepIndexFieldValue ( ACPI_NAMESPACE_NODE *Node, - ACPI_HANDLE IndexReg, - ACPI_HANDLE DataReg, + ACPI_NAMESPACE_NODE *IndexReg, + ACPI_NAMESPACE_NODE *DataReg, UINT8 FieldFlags, - UINT8 FieldAttribute, - UINT32 FieldPosition, - UINT32 FieldLength) + UINT32 FieldBitPosition, + UINT32 FieldBitLength) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; - FUNCTION_TRACE ("AmlPrepIndexFieldValue"); + FUNCTION_TRACE ("ExPrepIndexFieldValue"); /* Parameter validation */ if (!IndexReg || !DataReg) { - DEBUG_PRINT (ACPI_ERROR, ("AmlPrepIndexFieldValue: null handle\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Null handle\n")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } /* Allocate a new object descriptor */ - ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_INDEX_FIELD); + ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_INDEX_FIELD); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -553,8 +584,8 @@ AcpiAmlPrepIndexFieldValue ( /* Initialize areas of the object that are common to all fields */ - Status = AcpiAmlPrepCommonFieldObject (ObjDesc, FieldFlags, FieldAttribute, - FieldPosition, FieldLength); + Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, + FieldBitPosition, FieldBitLength); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -562,35 +593,32 @@ AcpiAmlPrepIndexFieldValue ( /* Initialize areas of the object that are specific to this field type */ - ObjDesc->IndexField.Value = (UINT32) (FieldPosition / - ObjDesc->Field.Granularity); - ObjDesc->IndexField.Index = IndexReg; - ObjDesc->IndexField.Data = DataReg; + ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (DataReg); + ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (IndexReg); + ObjDesc->IndexField.Value = (UINT32) (FieldBitPosition / + ObjDesc->Field.AccessBitWidth); + + /* An additional reference for the attached objects */ + + AcpiUtAddReference (ObjDesc->IndexField.DataObj); + AcpiUtAddReference (ObjDesc->IndexField.IndexObj); /* Debug info */ - DEBUG_PRINT (ACPI_INFO, - ("AmlPrepIndexFieldValue: bitoff=%X off=%X gran=%X\n", - ObjDesc->IndexField.BitOffset, ObjDesc->IndexField.Offset, - ObjDesc->Field.Granularity)); + DEBUG_PRINTP (ACPI_INFO, ("bitoff=%X off=%X gran=%X Index %p Data %p\n", + ObjDesc->IndexField.StartFieldBitOffset, ObjDesc->IndexField.BaseByteOffset, + ObjDesc->Field.AccessBitWidth, ObjDesc->IndexField.IndexObj, + ObjDesc->IndexField.DataObj)); - DEBUG_PRINT (ACPI_INFO, - ("AmlPrepIndexFieldValue: set NamedObj %p (%4.4s) val = %p\n", + DEBUG_PRINTP (ACPI_INFO, ("set NamedObj %p (%4.4s) val = %p\n", Node, &(Node->Name), ObjDesc)); - DUMP_STACK_ENTRY (ObjDesc); - DUMP_ENTRY (IndexReg, ACPI_INFO); - DUMP_ENTRY (DataReg, ACPI_INFO); - DEBUG_PRINT (ACPI_INFO, - ("============================================================\n")); /* - * Store the constructed descriptor (ObjDesc) into the NamedObj whose - * handle is on TOS, preserving the current type of that NamedObj. + * Store the constructed descriptor (ObjDesc) into the parent Node, + * preserving the current type of that NamedObj. */ - Status = AcpiNsAttachObject ((ACPI_HANDLE) Node, ObjDesc, - (UINT8) AcpiNsGetType ((ACPI_HANDLE) Node)); - + Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) AcpiNsGetType (Node)); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exregion.c b/sys/contrib/dev/acpica/exregion.c index ca01974..74894f5 100644 --- a/sys/contrib/dev/acpica/exregion.c +++ b/sys/contrib/dev/acpica/exregion.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amregion - ACPI default OpRegion (address space) handlers - * $Revision: 44 $ + * Module Name: exregion - ACPI default OpRegion (address space) handlers + * $Revision: 48 $ * *****************************************************************************/ @@ -116,7 +116,7 @@ *****************************************************************************/ -#define __AMREGION_C__ +#define __EXREGION_C__ #include "acpi.h" #include "acinterp.h" @@ -126,13 +126,13 @@ #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amregion") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exregion") /******************************************************************************* * - * FUNCTION: AcpiAmlSystemMemorySpaceHandler + * FUNCTION: AcpiExSystemMemorySpaceHandler * * PARAMETERS: Function - Read or Write operation * Address - Where in the space to read or write @@ -149,7 +149,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemMemorySpaceHandler ( +AcpiExSystemMemorySpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -159,11 +159,11 @@ AcpiAmlSystemMemorySpaceHandler ( { ACPI_STATUS Status = AE_OK; void *LogicalAddrPtr = NULL; - MEM_HANDLER_CONTEXT *MemInfo = RegionContext; + ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext; UINT32 Length; - FUNCTION_TRACE ("AmlSystemMemorySpaceHandler"); + FUNCTION_TRACE ("ExSystemMemorySpaceHandler"); /* Validate and translate the bit width */ @@ -183,8 +183,7 @@ AcpiAmlSystemMemorySpaceHandler ( break; default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlSystemMemorySpaceHandler: Invalid SystemMemory width %d\n", + DEBUG_PRINTP (ACPI_ERROR, ("Invalid SystemMemory width %d\n", BitWidth)); return_ACPI_STATUS (AE_AML_OPERAND_VALUE); break; @@ -247,7 +246,7 @@ AcpiAmlSystemMemorySpaceHandler ( switch (Function) { - case ADDRESS_SPACE_READ: + case ACPI_READ_ADR_SPACE: DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), ("Read (%d width) Address=%p\n", BitWidth, Address)); @@ -270,7 +269,7 @@ AcpiAmlSystemMemorySpaceHandler ( break; - case ADDRESS_SPACE_WRITE: + case ACPI_WRITE_ADR_SPACE: DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), ("Write (%d width) Address=%p Value %X\n", @@ -305,7 +304,7 @@ AcpiAmlSystemMemorySpaceHandler ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemIoSpaceHandler + * FUNCTION: AcpiExSystemIoSpaceHandler * * PARAMETERS: Function - Read or Write operation * Address - Where in the space to read or write @@ -322,7 +321,7 @@ AcpiAmlSystemMemorySpaceHandler ( ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemIoSpaceHandler ( +AcpiExSystemIoSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -333,7 +332,7 @@ AcpiAmlSystemIoSpaceHandler ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("AmlSystemIoSpaceHandler"); + FUNCTION_TRACE ("ExSystemIoSpaceHandler"); /* Decode the function parameter */ @@ -341,7 +340,7 @@ AcpiAmlSystemIoSpaceHandler ( switch (Function) { - case ADDRESS_SPACE_READ: + case ACPI_READ_ADR_SPACE: DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), ("Read(%d width) Address=%p\n", BitWidth, Address)); @@ -363,8 +362,7 @@ AcpiAmlSystemIoSpaceHandler ( break; default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlSystemIoSpaceHandler: Invalid SystemIO width %d\n", + DEBUG_PRINTP (ACPI_ERROR, ("Invalid SystemIO width %d\n", BitWidth)); Status = AE_AML_OPERAND_VALUE; } @@ -372,7 +370,7 @@ AcpiAmlSystemIoSpaceHandler ( break; - case ADDRESS_SPACE_WRITE: + case ACPI_WRITE_ADR_SPACE: DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), ("Write(%d width) Address=%p Value %X\n", @@ -394,8 +392,7 @@ AcpiAmlSystemIoSpaceHandler ( break; default: - DEBUG_PRINT (ACPI_ERROR, ( - "AmlSystemIoSpaceHandler: Invalid SystemIO width %d\n", + DEBUG_PRINTP (ACPI_ERROR, ("Invalid SystemIO width %d\n", BitWidth)); Status = AE_AML_OPERAND_VALUE; } @@ -413,7 +410,7 @@ AcpiAmlSystemIoSpaceHandler ( /******************************************************************************* * - * FUNCTION: AcpiAmlPciConfigSpaceHandler + * FUNCTION: AcpiExPciConfigSpaceHandler * * PARAMETERS: Function - Read or Write operation * Address - Where in the space to read or write @@ -430,7 +427,7 @@ AcpiAmlSystemIoSpaceHandler ( ******************************************************************************/ ACPI_STATUS -AcpiAmlPciConfigSpaceHandler ( +AcpiExPciConfigSpaceHandler ( UINT32 Function, ACPI_PHYSICAL_ADDRESS Address, UINT32 BitWidth, @@ -442,10 +439,10 @@ AcpiAmlPciConfigSpaceHandler ( UINT32 PciBus; UINT32 DevFunc; UINT8 PciReg; - PCI_HANDLER_CONTEXT *PCIContext; + ACPI_PCI_SPACE_CONTEXT *PCIContext; - FUNCTION_TRACE ("AmlPciConfigSpaceHandler"); + FUNCTION_TRACE ("ExPciConfigSpaceHandler"); /* * The arguments to AcpiOs(Read|Write)PciCfg(Byte|Word|Dword) are: @@ -462,10 +459,10 @@ AcpiAmlPciConfigSpaceHandler ( * */ - PCIContext = (PCI_HANDLER_CONTEXT *) RegionContext; + PCIContext = (ACPI_PCI_SPACE_CONTEXT *) RegionContext; - PciBus = LOWORD(PCIContext->Seg) << 16; - PciBus |= LOWORD(PCIContext->Bus); + PciBus = LOWORD (PCIContext->Seg) << 16; + PciBus |= LOWORD (PCIContext->Bus); DevFunc = PCIContext->DevFunc; @@ -474,7 +471,7 @@ AcpiAmlPciConfigSpaceHandler ( switch (Function) { - case ADDRESS_SPACE_READ: + case ACPI_READ_ADR_SPACE: DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), ("R%d S(%04x) B(%04x) DF(%08x) R(%04x)\n", BitWidth, @@ -502,8 +499,7 @@ AcpiAmlPciConfigSpaceHandler ( break; default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlPciConfigSpaceHandler: Invalid PCIConfig width %d\n", + DEBUG_PRINTP (ACPI_ERROR, ("Invalid PCIConfig width %d\n", BitWidth)); Status = AE_AML_OPERAND_VALUE; @@ -512,7 +508,7 @@ AcpiAmlPciConfigSpaceHandler ( break; - case ADDRESS_SPACE_WRITE: + case ACPI_WRITE_ADR_SPACE: DEBUG_PRINT ((TRACE_OPREGION | VERBOSE_INFO), ("W%d S(%04x) B(%04x) DF(%08x) R(%04x) D(%08x)\n", BitWidth, @@ -539,8 +535,7 @@ AcpiAmlPciConfigSpaceHandler ( break; default: - DEBUG_PRINT (ACPI_ERROR, ( - "AmlPciConfigSpaceHandler: Invalid PCIConfig width %d\n", + DEBUG_PRINTP (ACPI_ERROR, ("Invalid PCIConfig width %d\n", BitWidth)); Status = AE_AML_OPERAND_VALUE; diff --git a/sys/contrib/dev/acpica/exresnte.c b/sys/contrib/dev/acpica/exresnte.c index 659d6f6..c819a13 100644 --- a/sys/contrib/dev/acpica/exresnte.c +++ b/sys/contrib/dev/acpica/exresnte.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amresnte - AML Interpreter object resolution - * $Revision: 27 $ + * Module Name: exresnte - AML Interpreter object resolution + * $Revision: 37 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMRESNTE_C__ +#define __EXRESNTE_C__ #include "acpi.h" #include "amlcode.h" @@ -127,21 +127,22 @@ #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amresnte") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exresnte") /******************************************************************************* * - * FUNCTION: AcpiAmlResolveNodeToValue + * FUNCTION: AcpiExResolveNodeToValue * * PARAMETERS: StackPtr - Pointer to a location on a stack that contains - * a pointer to an Node + * a pointer to a Node + * WalkState - Current state * * RETURN: Status * - * DESCRIPTION: Resolve a ACPI_NAMESPACE_NODE (Node, - * A.K.A. a "direct name pointer") + * DESCRIPTION: Resolve a Namespace node (AKA a "direct name pointer") to + * a valued object * * Note: for some of the data types, the pointer attached to the Node * can be either a pointer to an actual internal object or a pointer into the @@ -156,40 +157,35 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlResolveNodeToValue ( +AcpiExResolveNodeToValue ( ACPI_NAMESPACE_NODE **StackPtr, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ValDesc = NULL; + ACPI_OPERAND_OBJECT *ValDesc; ACPI_OPERAND_OBJECT *ObjDesc = NULL; ACPI_NAMESPACE_NODE *Node; UINT8 *AmlPointer = NULL; - OBJECT_TYPE_INTERNAL EntryType; - BOOLEAN Locked; + ACPI_OBJECT_TYPE8 EntryType; + ACPI_INTEGER TempVal; BOOLEAN AttachedAmlPointer = FALSE; UINT8 AmlOpcode = 0; - ACPI_INTEGER TempVal; - OBJECT_TYPE_INTERNAL ObjectType; - - FUNCTION_TRACE ("AmlResolveEntryToValue"); - Node = *StackPtr; + FUNCTION_TRACE ("ExResolveNodeToValue"); /* - * The stack pointer is a "Direct name ptr", and points to a - * a ACPI_NAMESPACE_NODE (Node). Get the pointer that is attached to - * the Node. + * The stack pointer points to a ACPI_NAMESPACE_NODE (Node). Get the + * object that is attached to the Node. */ - ValDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) Node); - EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); + Node = *StackPtr; + ValDesc = AcpiNsGetAttachedObject (Node); + EntryType = AcpiNsGetType ((ACPI_HANDLE) Node); - DEBUG_PRINT (TRACE_EXEC, - ("AmlResolveEntryToValue: Entry=%p ValDesc=%p Type=%X\n", + DEBUG_PRINTP (TRACE_EXEC, ("Entry=%p ValDesc=%p Type=%X\n", Node, ValDesc, EntryType)); /* @@ -200,12 +196,13 @@ AcpiAmlResolveNodeToValue ( if (AcpiTbSystemTablePointer (ValDesc)) { + /* CAN THIS EVERY HAPPEN NOW? TBD!!! */ + AttachedAmlPointer = TRUE; - AmlOpcode = *((UINT8 *) ValDesc); - AmlPointer = ((UINT8 *) ValDesc) + 1; + AmlOpcode = *((UINT8 *) ValDesc); + AmlPointer = ((UINT8 *) ValDesc) + 1; - DEBUG_PRINT (TRACE_EXEC, - ("AmlResolveEntryToValue: Unparsed AML: %p Len=%X\n", + DEBUG_PRINTP (TRACE_EXEC, ("Unparsed AML: %p Len=%X\n", AmlOpcode, AmlPointer)); } @@ -225,8 +222,7 @@ AcpiAmlResolveNodeToValue ( if (!ValDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: No object attached to node %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("No object attached to node %p\n", Node)); return_ACPI_STATUS (AE_AML_NO_OPERAND); } @@ -246,8 +242,7 @@ AcpiAmlResolveNodeToValue ( * This means that the package initialization is not parsed * -- should not happen */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Unparsed Packages not supported!\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Unparsed Packages not supported!\n")); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } @@ -255,8 +250,7 @@ AcpiAmlResolveNodeToValue ( if (ACPI_TYPE_PACKAGE != ValDesc->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Object not a package, type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Object not a package, type %X\n", ValDesc->Common.Type)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -264,7 +258,7 @@ AcpiAmlResolveNodeToValue ( /* Return an additional reference to the object */ ObjDesc = ValDesc; - AcpiCmAddReference (ObjDesc); + AcpiUtAddReference (ObjDesc); break; @@ -276,8 +270,7 @@ AcpiAmlResolveNodeToValue ( * This means that the buffer initialization is not parsed * -- should not happen */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Unparsed Buffers not supported!\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Unparsed Buffers not supported!\n")); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } @@ -285,8 +278,7 @@ AcpiAmlResolveNodeToValue ( if (ACPI_TYPE_BUFFER != ValDesc->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Object not a buffer, type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Object not a buffer, type %X\n", ValDesc->Common.Type)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -294,7 +286,7 @@ AcpiAmlResolveNodeToValue ( /* Return an additional reference to the object */ ObjDesc = ValDesc; - AcpiCmAddReference (ObjDesc); + AcpiUtAddReference (ObjDesc); break; @@ -304,7 +296,7 @@ AcpiAmlResolveNodeToValue ( { /* Allocate a new string object */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_STRING); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_STRING); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -320,8 +312,7 @@ AcpiAmlResolveNodeToValue ( { if (ACPI_TYPE_STRING != ValDesc->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Object not a string, type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Object not a string, type %X\n", ValDesc->Common.Type)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -329,7 +320,7 @@ AcpiAmlResolveNodeToValue ( /* Return an additional reference to the object */ ObjDesc = ValDesc; - AcpiCmAddReference (ObjDesc); + AcpiUtAddReference (ObjDesc); } break; @@ -337,7 +328,7 @@ AcpiAmlResolveNodeToValue ( case ACPI_TYPE_INTEGER: - DEBUG_PRINT (TRACE_EXEC, ("AmlResolveEntryToValue: case Number \n")); + DEBUG_PRINTP (TRACE_EXEC, ("case Integer \n")); /* * The Node has an attached internal object, make sure that it's a @@ -346,8 +337,7 @@ AcpiAmlResolveNodeToValue ( if (ACPI_TYPE_INTEGER != ValDesc->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveToValue: Object not a Number, type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Object not a Number, type %X\n", ValDesc->Common.Type)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -355,237 +345,19 @@ AcpiAmlResolveNodeToValue ( /* Return an additional reference to the object */ ObjDesc = ValDesc; - AcpiCmAddReference (ObjDesc); - break; - - - case INTERNAL_TYPE_DEF_FIELD: - - /* - * TBD: [Investigate] Is this the correct solution? - * - * This section was extended to convert to generic buffer if - * the return length is greater than 32 bits, but still allows - * for returning a type Number for smaller values because the - * caller can then apply arithmetic operators on those fields. - * - * XXX - Implementation limitation: Fields are implemented as type - * XXX - Number, but they really are supposed to be type Buffer. - * XXX - The two are interchangeable only for lengths <= 32 bits. - */ - if(ValDesc->Field.Length > 32) - { - ObjectType = ACPI_TYPE_BUFFER; - } - else - { - ObjectType = ACPI_TYPE_INTEGER; - } - - /* - * Create the destination buffer object and the buffer space. - */ - ObjDesc = AcpiCmCreateInternalObject (ObjectType); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Fill in the object specific details - */ - if (ACPI_TYPE_BUFFER == ObjectType) - { - ObjDesc->Buffer.Pointer = AcpiCmCallocate (ValDesc->Field.Length); - if (!ObjDesc->Buffer.Pointer) - { - AcpiCmRemoveReference(ObjDesc); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ObjDesc->Buffer.Length = ValDesc->Field.Length; - - Status = AcpiAmlAccessNamedField (ACPI_READ, (ACPI_HANDLE) Node, - ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length); - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - Status = AcpiAmlAccessNamedField (ACPI_READ, (ACPI_HANDLE) Node, - &TempVal, sizeof (TempVal)); - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - ObjDesc->Integer.Value = TempVal; - } - - - DEBUG_PRINT (TRACE_EXEC, - ("AmlResolveEntryToValue: DefField Entry=%p ValDesc=%p Type=%X\n", - Node, ValDesc, EntryType)); + AcpiUtAddReference (ObjDesc); break; + case ACPI_TYPE_BUFFER_FIELD: + case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: - - if (AttachedAmlPointer) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: BankField cannot be an Aml ptr\n")); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - if (INTERNAL_TYPE_BANK_FIELD != ValDesc->Common.Type) - { - DEBUG_PRINT (ACPI_ERROR, ( - "AmlResolveToValue: Object not a BankField, type %X\n", - ValDesc->Common.Type)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - - /* Get the global lock if needed */ - - ObjDesc = (ACPI_OPERAND_OBJECT *) *StackPtr; - Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule); - - /* Set Index value to select proper Data register */ - /* perform the update */ - - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - ValDesc->BankField.BankSelect, &ValDesc->BankField.Value, - sizeof (ValDesc->BankField.Value)); - - AcpiAmlReleaseGlobalLock (Locked); - - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Read Data value */ - - Status = AcpiAmlAccessNamedField (ACPI_READ, - (ACPI_HANDLE) ValDesc->BankField.Container, - &TempVal, sizeof (TempVal)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create an object for the result */ - - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ObjDesc->Integer.Value = TempVal; - break; - - case INTERNAL_TYPE_INDEX_FIELD: - if (AttachedAmlPointer) - { - DEBUG_PRINT (ACPI_ERROR, ("AmlResolveEntryToValue: Internal - IndexField cannot be an Aml ptr\n")); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - if (INTERNAL_TYPE_INDEX_FIELD != ValDesc->Common.Type) - { - DEBUG_PRINT (ACPI_ERROR, ( - "AmlResolveToValue: Object not an IndexField, type %X\n", - ValDesc->Common.Type)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - - /* Set Index value to select proper Data register */ - /* Get the global lock if needed */ - - ObjDesc = (ACPI_OPERAND_OBJECT *) *StackPtr; - Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule); - - /* Perform the update */ - - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - ValDesc->IndexField.Index, &ValDesc->IndexField.Value, - sizeof (ValDesc->IndexField.Value)); - - AcpiAmlReleaseGlobalLock (Locked); - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Read Data value */ - - Status = AcpiAmlAccessNamedField (ACPI_READ, ValDesc->IndexField.Data, - &TempVal, sizeof (TempVal)); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create an object for the result */ - - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - ObjDesc->Integer.Value = TempVal; - break; - - - case ACPI_TYPE_FIELD_UNIT: - - if (AttachedAmlPointer) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: FieldUnit cannot be an Aml ptr\n")); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - } - - if (ValDesc->Common.Type != (UINT8) EntryType) - { - DEBUG_PRINT (ACPI_ERROR, ( - "AmlResolveToValue: Object type %X not same as EntryType %X\n", - ValDesc->Common.Type, EntryType)); - - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); - break; - } - - /* Create object for result */ - - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiAmlGetFieldUnitValue (ValDesc, ObjDesc); - if (ACPI_FAILURE (Status)) - { - AcpiCmRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); - } + DEBUG_PRINTP (TRACE_EXEC, ("FieldRead Node=%p ValDesc=%p Type=%X\n", + Node, ValDesc, EntryType)); + Status = AcpiExReadDataFromField (ValDesc, &ObjDesc); break; @@ -605,7 +377,7 @@ AcpiAmlResolveNodeToValue ( /* Return an additional reference to the object */ ObjDesc = ValDesc; - AcpiCmAddReference (ObjDesc); + AcpiUtAddReference (ObjDesc); break; @@ -613,8 +385,7 @@ AcpiAmlResolveNodeToValue ( case ACPI_TYPE_ANY: - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Untyped entry %p, no attached object!\n", + DEBUG_PRINTP (ACPI_ERROR, ("Untyped entry %p, no attached object!\n", Node)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */ @@ -623,12 +394,11 @@ AcpiAmlResolveNodeToValue ( /* * The only named references allowed are named constants - * - * e.g. Name (\OSFL, Ones) + * e.g. -- Name (\OSFL, Ones) */ case INTERNAL_TYPE_REFERENCE: - switch (ValDesc->Reference.OpCode) + switch (ValDesc->Reference.Opcode) { case AML_ZERO_OP: @@ -636,31 +406,27 @@ AcpiAmlResolveNodeToValue ( TempVal = 0; break; - case AML_ONE_OP: TempVal = 1; break; - case AML_ONES_OP: TempVal = ACPI_INTEGER_MAX; break; - default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveToValue/Number: Unsupported reference opcode %X\n", - ValDesc->Reference.OpCode)); + DEBUG_PRINTP (ACPI_ERROR, ("Unsupported reference opcode %X\n", + ValDesc->Reference.Opcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); } /* Create object for result */ - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_INTEGER); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -670,7 +436,7 @@ AcpiAmlResolveNodeToValue ( /* Truncate value if we are executing from a 32-bit ACPI table */ - AcpiAmlTruncateFor32bitTable (ObjDesc, WalkState); + AcpiExTruncateFor32bitTable (ObjDesc, WalkState); break; @@ -678,8 +444,7 @@ AcpiAmlResolveNodeToValue ( default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveEntryToValue: Node %p - Unknown object type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Node %p - Unknown object type %X\n", Node, EntryType)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -690,7 +455,6 @@ AcpiAmlResolveNodeToValue ( /* Put the object descriptor on the stack */ *StackPtr = (void *) ObjDesc; - return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exresolv.c b/sys/contrib/dev/acpica/exresolv.c index 26ecd31..9dfa569 100644 --- a/sys/contrib/dev/acpica/exresolv.c +++ b/sys/contrib/dev/acpica/exresolv.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amresolv - AML Interpreter object resolution - * $Revision: 81 $ + * Module Name: exresolv - AML Interpreter object resolution + * $Revision: 95 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMRESOLV_C__ +#define __EXRESOLV_C__ #include "acpi.h" #include "amlcode.h" @@ -127,90 +127,78 @@ #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amresolv") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exresolv") /******************************************************************************* * - * FUNCTION: AcpiAmlGetFieldUnitValue + * FUNCTION: AcpiExGetBufferFieldValue * - * PARAMETERS: *FieldDesc - Pointer to a FieldUnit - * *ResultDesc - Pointer to an empty descriptor - * which will become a Number - * containing the field's value. + * PARAMETERS: *ObjDesc - Pointer to a BufferField + * *ResultDesc - Pointer to an empty descriptor which will + * become an Integer with the field's value * * RETURN: Status * - * DESCRIPTION: Retrieve the value from a FieldUnit + * DESCRIPTION: Retrieve the value from a BufferField * ******************************************************************************/ ACPI_STATUS -AcpiAmlGetFieldUnitValue ( - ACPI_OPERAND_OBJECT *FieldDesc, +AcpiExGetBufferFieldValue ( + ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT *ResultDesc) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; UINT32 Mask; - UINT8 *Location = NULL; - BOOLEAN Locked = FALSE; + UINT8 *Location; - FUNCTION_TRACE ("AmlGetFieldUnitValue"); + FUNCTION_TRACE ("ExGetBufferFieldValue"); - if (!FieldDesc) + /* + * Parameter validation + */ + if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlGetFieldUnitValue: Internal error - null field pointer\n")); - Status = AE_AML_NO_OPERAND; + DEBUG_PRINTP (ACPI_ERROR, ("Internal - null field pointer\n")); + return_ACPI_STATUS (AE_AML_NO_OPERAND); } - if (!(FieldDesc->Common.Flags & AOPOBJ_DATA_VALID)) + if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)) { - Status = AcpiDsGetFieldUnitArguments (FieldDesc); + Status = AcpiDsGetBufferFieldArguments (ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } } - if (!FieldDesc->FieldUnit.Container) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlGetFieldUnitValue: Internal error - null container pointer\n")); - Status = AE_AML_INTERNAL; - } - - else if (ACPI_TYPE_BUFFER != FieldDesc->FieldUnit.Container->Common.Type) + if (!ObjDesc->BufferField.BufferObj) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlGetFieldUnitValue: Internal error - container is not a Buffer\n")); - Status = AE_AML_OPERAND_TYPE; + DEBUG_PRINTP (ACPI_ERROR, ("Internal - null container pointer\n")); + return_ACPI_STATUS (AE_AML_INTERNAL); } - else if (!ResultDesc) + if (ACPI_TYPE_BUFFER != ObjDesc->BufferField.BufferObj->Common.Type) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlGetFieldUnitValue: Internal error - null result pointer\n")); - Status = AE_AML_INTERNAL; + DEBUG_PRINTP (ACPI_ERROR, ("Internal - container is not a Buffer\n")); + return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - if (ACPI_FAILURE (Status)) + if (!ResultDesc) { - return_ACPI_STATUS (Status); + DEBUG_PRINTP (ACPI_ERROR, ("Internal - null result pointer\n")); + return_ACPI_STATUS (AE_AML_INTERNAL); } - /* Get the global lock if needed */ - - Locked = AcpiAmlAcquireGlobalLock (FieldDesc->FieldUnit.LockRule); - /* Field location is (base of buffer) + (byte offset) */ - Location = FieldDesc->FieldUnit.Container->Buffer.Pointer - + FieldDesc->FieldUnit.Offset; + Location = ObjDesc->BufferField.BufferObj->Buffer.Pointer + + ObjDesc->BufferField.BaseByteOffset; /* * Construct Mask with as many 1 bits as the field width @@ -218,12 +206,11 @@ AcpiAmlGetFieldUnitValue ( * NOTE: Only the bottom 5 bits are valid for a shift operation, so * special care must be taken for any shift greater than 31 bits. * - * TBD: [Unhandled] Fields greater than 32-bits will not work. + * TBD: [Unhandled] Fields greater than 32 bits will not work. */ - - if (FieldDesc->FieldUnit.Length < 32) + if (ObjDesc->BufferField.BitLength < 32) { - Mask = ((UINT32) 1 << FieldDesc->FieldUnit.Length) - (UINT32) 1; + Mask = ((UINT32) 1 << ObjDesc->BufferField.BitLength) - (UINT32) 1; } else { @@ -240,33 +227,29 @@ AcpiAmlGetFieldUnitValue ( * Shift the 32-bit word containing the field, and mask off the * resulting value */ - ResultDesc->Integer.Value = - (ResultDesc->Integer.Value >> FieldDesc->FieldUnit.BitOffset) & Mask; + (ResultDesc->Integer.Value >> ObjDesc->BufferField.StartFieldBitOffset) & Mask; DEBUG_PRINT (ACPI_INFO, ("** Read from buffer %p byte %ld bit %d width %d addr %p mask %08lx val %08lx\n", - FieldDesc->FieldUnit.Container->Buffer.Pointer, - FieldDesc->FieldUnit.Offset, - FieldDesc->FieldUnit.BitOffset, - FieldDesc->FieldUnit.Length, + ObjDesc->BufferField.BufferObj->Buffer.Pointer, + ObjDesc->BufferField.BaseByteOffset, + ObjDesc->BufferField.StartFieldBitOffset, + ObjDesc->BufferField.BitLength, Location, Mask, ResultDesc->Integer.Value)); - /* Release global lock if we acquired it earlier */ - - AcpiAmlReleaseGlobalLock (Locked); - - return_ACPI_STATUS (Status); + return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiAmlResolveToValue + * FUNCTION: AcpiExResolveToValue * * PARAMETERS: **StackPtr - Points to entry on ObjStack, which can - * be either an (ACPI_OPERAND_OBJECT *) + * be either an (ACPI_OPERAND_OBJECT *) * or an ACPI_HANDLE. + * WalkState - Current method state * * RETURN: Status * @@ -275,20 +258,19 @@ AcpiAmlGetFieldUnitValue ( ******************************************************************************/ ACPI_STATUS -AcpiAmlResolveToValue ( +AcpiExResolveToValue ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; - FUNCTION_TRACE_PTR ("AmlResolveToValue", StackPtr); + FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr); if (!StackPtr || !*StackPtr) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveToValue: Internal error - null pointer\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Internal - null pointer\n")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } @@ -298,11 +280,9 @@ AcpiAmlResolveToValue ( * 1) A valid ACPI_OPERAND_OBJECT, or * 2) A ACPI_NAMESPACE_NODE (NamedObj) */ - if (VALID_DESCRIPTOR_TYPE (*StackPtr, ACPI_DESC_TYPE_INTERNAL)) { - - Status = AcpiAmlResolveObjectToValue (StackPtr, WalkState); + Status = AcpiExResolveObjectToValue (StackPtr, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -310,29 +290,32 @@ AcpiAmlResolveToValue ( } /* - * Object on the stack may have changed if AcpiAmlResolveObjectToValue() + * Object on the stack may have changed if AcpiExResolveObjectToValue() * was called (i.e., we can't use an _else_ here.) */ - if (VALID_DESCRIPTOR_TYPE (*StackPtr, ACPI_DESC_TYPE_NAMED)) { - Status = AcpiAmlResolveNodeToValue ((ACPI_NAMESPACE_NODE **) StackPtr, WalkState); + Status = AcpiExResolveNodeToValue ((ACPI_NAMESPACE_NODE **) StackPtr, + WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveToValue: Returning resolved object %p\n", *StackPtr)); - - return_ACPI_STATUS (Status); + DEBUG_PRINTP (ACPI_INFO, ("Resolved object %p\n", *StackPtr)); + return_ACPI_STATUS (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiAmlResolveObjectToValue + * FUNCTION: AcpiExResolveObjectToValue * * PARAMETERS: StackPtr - Pointer to a stack location that contains a * ptr to an internal object. + * WalkState - Current method state * * RETURN: Status * @@ -342,19 +325,18 @@ AcpiAmlResolveToValue ( ******************************************************************************/ ACPI_STATUS -AcpiAmlResolveObjectToValue ( +AcpiExResolveObjectToValue ( ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState) { - ACPI_OPERAND_OBJECT *StackDesc; ACPI_STATUS Status = AE_OK; - ACPI_HANDLE TempHandle = NULL; - ACPI_OPERAND_OBJECT *ObjDesc = NULL; - UINT32 Index = 0; + ACPI_OPERAND_OBJECT *StackDesc; + void *TempNode; + ACPI_OPERAND_OBJECT *ObjDesc; UINT16 Opcode; - FUNCTION_TRACE ("AmlResolveObjectToValue"); + FUNCTION_TRACE ("ExResolveObjectToValue"); StackDesc = *StackPtr; @@ -366,7 +348,7 @@ AcpiAmlResolveObjectToValue ( case INTERNAL_TYPE_REFERENCE: - Opcode = StackDesc->Reference.OpCode; + Opcode = StackDesc->Reference.Opcode; switch (Opcode) { @@ -375,74 +357,29 @@ AcpiAmlResolveObjectToValue ( /* * Convert indirect name ptr to a direct name ptr. - * Then, AcpiAmlResolveNodeToValue can be used to get the value + * Then, AcpiExResolveNodeToValue can be used to get the value */ - - TempHandle = StackDesc->Reference.Object; + TempNode = StackDesc->Reference.Object; /* Delete the Reference Object */ - AcpiCmRemoveReference (StackDesc); + AcpiUtRemoveReference (StackDesc); /* Put direct name pointer onto stack and exit */ - (*StackPtr) = TempHandle; - Status = AE_OK; + (*StackPtr) = TempNode; break; case AML_LOCAL_OP: - - Index = StackDesc->Reference.Offset; + case AML_ARG_OP: /* * Get the local from the method's state info * Note: this increments the local's object reference count */ - - Status = AcpiDsMethodDataGetValue (MTH_TYPE_LOCAL, Index, - WalkState, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Now we can delete the original Reference Object and - * replace it with the resolve value - */ - - AcpiCmRemoveReference (StackDesc); - *StackPtr = ObjDesc; - - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveObjectToValue: [Local%d] ValueObj is %p\n", - Index, ObjDesc)); - - if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type) - { - /* Value is a Number */ - - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveObjectToValue: [Local%d] value=%X \n", - Index, ObjDesc->Integer.Value)); - } - - break; - - - case AML_ARG_OP: - - Index = StackDesc->Reference.Offset; - - - /* - * Get the argument from the method's state info - * Note: this increments the object reference count - */ - - Status = AcpiDsMethodDataGetValue (MTH_TYPE_ARG, Index, - WalkState, &ObjDesc); + Status = AcpiDsMethodDataGetValue (Opcode, + StackDesc->Reference.Offset, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -452,23 +389,11 @@ AcpiAmlResolveObjectToValue ( * Now we can delete the original Reference Object and * replace it with the resolve value */ - - AcpiCmRemoveReference (StackDesc); + AcpiUtRemoveReference (StackDesc); *StackPtr = ObjDesc; - DEBUG_PRINT (TRACE_EXEC, - ("AmlResolveObjectToValue: [Arg%d] ValueObj is %p\n", - Index, ObjDesc)); - - if (ACPI_TYPE_INTEGER == ObjDesc->Common.Type) - { - /* Value is a Number */ - - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveObjectToValue: [Arg%d] value=%X\n", - Index, ObjDesc->Integer.Value)); - } - + DEBUG_PRINTP (ACPI_INFO, ("[Arg/Local %d] ValueObj is %p\n", + StackDesc->Reference.Offset, ObjDesc)); break; @@ -476,7 +401,6 @@ AcpiAmlResolveObjectToValue ( * TBD: [Restructure] These next three opcodes change the type of * the object, which is actually a no-no. */ - case AML_ZERO_OP: StackDesc->Common.Type = (UINT8) ACPI_TYPE_INTEGER; @@ -498,7 +422,7 @@ AcpiAmlResolveObjectToValue ( /* Truncate value if we are executing from a 32-bit ACPI table */ - AcpiAmlTruncateFor32bitTable (StackDesc, WalkState); + AcpiExTruncateFor32bitTable (StackDesc, WalkState); break; @@ -521,8 +445,8 @@ AcpiAmlResolveObjectToValue ( * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ - AcpiCmRemoveReference (StackDesc); - AcpiCmAddReference (ObjDesc); + AcpiUtRemoveReference (StackDesc); + AcpiUtAddReference (ObjDesc); *StackPtr = ObjDesc; } @@ -530,20 +454,20 @@ AcpiAmlResolveObjectToValue ( { /* * A NULL object descriptor means an unitialized element of - * the package, can't deref it + * the package, can't dereference it */ - - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveObjectToValue: Attempt to deref an Index to NULL pkg element Idx=%p\n", StackDesc)); + DEBUG_PRINTP (ACPI_ERROR, + ("Attempt to deref an Index to NULL pkg element Idx=%p\n", + StackDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; } break; default: - /* Invalid reference OBJ*/ + /* Invalid reference object */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveObjectToValue: Unknown TargetType %X in Index/Reference obj %p\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Unknown TargetType %X in Index/Reference obj %p\n", StackDesc->Reference.TargetType, StackDesc)); Status = AE_AML_INTERNAL; break; @@ -560,36 +484,28 @@ AcpiAmlResolveObjectToValue ( default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveObjectToValue: Unknown Reference object subtype %02X in %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Unknown Reference object subtype %02X in %p\n", Opcode, StackDesc)); Status = AE_AML_INTERNAL; + break; } /* switch (Opcode) */ - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; /* case INTERNAL_TYPE_REFERENCE */ - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_ANY); if (!ObjDesc) { - /* Descriptor allocation failure */ - return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiAmlGetFieldUnitValue (StackDesc, ObjDesc); + Status = AcpiExGetBufferFieldValue (StackDesc, ObjDesc); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; } @@ -599,18 +515,18 @@ AcpiAmlResolveObjectToValue ( case INTERNAL_TYPE_BANK_FIELD: - ObjDesc = AcpiCmCreateInternalObject (ACPI_TYPE_ANY); + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_ANY); if (!ObjDesc) { - /* Descriptor allocation failure */ - return_ACPI_STATUS (AE_NO_MEMORY); } - Status = AcpiAmlGetFieldUnitValue (StackDesc, ObjDesc); + /* TBD: WRONG! */ + + Status = AcpiExGetBufferFieldValue (StackDesc, ObjDesc); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; } diff --git a/sys/contrib/dev/acpica/exresop.c b/sys/contrib/dev/acpica/exresop.c index d57d2fb..fb93f70 100644 --- a/sys/contrib/dev/acpica/exresop.c +++ b/sys/contrib/dev/acpica/exresop.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amresop - AML Interpreter operand/object resolution - * $Revision: 22 $ + * Module Name: exresop - AML Interpreter operand/object resolution + * $Revision: 29 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMRESOP_C__ +#define __EXRESOP_C__ #include "acpi.h" #include "amlcode.h" @@ -127,13 +127,13 @@ #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amresop") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exresop") /******************************************************************************* * - * FUNCTION: AcpiAmlCheckObjectType + * FUNCTION: AcpiExCheckObjectType * * PARAMETERS: TypeNeeded Object type needed * ThisType Actual object type @@ -146,7 +146,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlCheckObjectType ( +AcpiExCheckObjectType ( ACPI_OBJECT_TYPE TypeNeeded, ACPI_OBJECT_TYPE ThisType, void *Object) @@ -160,25 +160,23 @@ AcpiAmlCheckObjectType ( return (AE_OK); } - if (TypeNeeded != ThisType) { DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [%s], found [%s] %p\n", - AcpiCmGetTypeName (TypeNeeded), - AcpiCmGetTypeName (ThisType), Object)); + ("ExCheckObjectType: Needed [%s], found [%s] %p\n", + AcpiUtGetTypeName (TypeNeeded), + AcpiUtGetTypeName (ThisType), Object)); return (AE_AML_OPERAND_TYPE); } - return (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiAmlResolveOperands + * FUNCTION: AcpiExResolveOperands * * PARAMETERS: Opcode Opcode being interpreted * StackPtr Top of operand stack @@ -196,7 +194,7 @@ AcpiAmlCheckObjectType ( ******************************************************************************/ ACPI_STATUS -AcpiAmlResolveOperands ( +AcpiExResolveOperands ( UINT16 Opcode, ACPI_OPERAND_OBJECT **StackPtr, ACPI_WALK_STATE *WalkState) @@ -204,14 +202,14 @@ AcpiAmlResolveOperands ( ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status = AE_OK; UINT8 ObjectType; - ACPI_HANDLE TempHandle; + void *TempNode; UINT32 ArgTypes; ACPI_OPCODE_INFO *OpInfo; UINT32 ThisArgType; ACPI_OBJECT_TYPE TypeNeeded; - FUNCTION_TRACE_U32 ("AmlResolveOperands", Opcode); + FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode); OpInfo = AcpiPsGetOpcodeInfo (Opcode); @@ -224,31 +222,30 @@ AcpiAmlResolveOperands ( ArgTypes = OpInfo->RuntimeArgs; if (ArgTypes == ARGI_INVALID_OPCODE) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveOperands: Internal error - %X is not a valid AML opcode\n", Opcode)); + DEBUG_PRINTP (ACPI_ERROR, ("Internal - %X is not a valid AML opcode\n", + Opcode)); return_ACPI_STATUS (AE_AML_INTERNAL); } - DEBUG_PRINT (TRACE_EXEC, - ("AmlResolveOperands: Opcode %X OperandTypes=%X \n", + DEBUG_PRINTP (TRACE_EXEC, ("Opcode %X OperandTypes=%X \n", Opcode, ArgTypes)); - /* - * Normal exit is with *Types == '\0' at end of string. + /* + * Normal exit is with (ArgTypes == 0) at end of argument list. * Function will return an exception from within the loop upon - * finding an entry which is not, and cannot be converted - * to, the required type; if stack underflows; or upon - * finding a NULL stack entry (which "should never happen"). + * finding an entry which is not (or cannot be converted + * to) the required type; if stack underflows; or upon + * finding a NULL stack entry (which should not happen). */ while (GET_CURRENT_ARG_TYPE (ArgTypes)) { if (!StackPtr || !*StackPtr) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveOperands: Internal error - null stack entry at %X\n", StackPtr)); + DEBUG_PRINTP (ACPI_ERROR, ("Internal - null stack entry at %X\n", + StackPtr)); return_ACPI_STATUS (AE_AML_INTERNAL); } @@ -274,10 +271,9 @@ AcpiAmlResolveOperands ( /* Check for bad ACPI_OBJECT_TYPE */ - if (!AcpiAmlValidateObjectType (ObjectType)) + if (!AcpiExValidateObjectType (ObjectType)) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveOperands: Bad operand object type [%X]\n", + DEBUG_PRINTP (ACPI_ERROR, ("Bad operand object type [%X]\n", ObjectType)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -296,7 +292,7 @@ AcpiAmlResolveOperands ( } - switch (ObjDesc->Reference.OpCode) + switch (ObjDesc->Reference.Opcode) { case AML_ZERO_OP: case AML_ONE_OP: @@ -314,7 +310,7 @@ AcpiAmlResolveOperands ( default: DEBUG_PRINT (ACPI_INFO, ("Reference Opcode: Unknown [%02x]\n", - ObjDesc->Reference.OpCode)); + ObjDesc->Reference.Opcode)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); break; @@ -365,7 +361,7 @@ AcpiAmlResolveOperands ( goto NextOperand; } - Status = AcpiAmlCheckObjectType (INTERNAL_TYPE_REFERENCE, + Status = AcpiExCheckObjectType (INTERNAL_TYPE_REFERENCE, ObjectType, ObjDesc); if (ACPI_FAILURE (Status)) { @@ -373,16 +369,16 @@ AcpiAmlResolveOperands ( } - if (AML_NAME_OP == ObjDesc->Reference.OpCode) + if (AML_NAME_OP == ObjDesc->Reference.Opcode) { /* * Convert an indirect name ptr to direct name ptr and put * it on the stack */ - TempHandle = ObjDesc->Reference.Object; - AcpiCmRemoveReference (ObjDesc); - (*StackPtr) = TempHandle; + TempNode = ObjDesc->Reference.Object; + AcpiUtRemoveReference (ObjDesc); + (*StackPtr) = TempNode; } goto NextOperand; @@ -400,7 +396,7 @@ AcpiAmlResolveOperands ( if ((Opcode == AML_STORE_OP) && ((*StackPtr)->Common.Type == INTERNAL_TYPE_REFERENCE) && - ((*StackPtr)->Reference.OpCode == AML_INDEX_OP)) + ((*StackPtr)->Reference.Opcode == AML_INDEX_OP)) { goto NextOperand; } @@ -412,7 +408,7 @@ AcpiAmlResolveOperands ( * Resolve this object to a value */ - Status = AcpiAmlResolveToValue (StackPtr, WalkState); + Status = AcpiExResolveToValue (StackPtr, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -481,14 +477,14 @@ AcpiAmlResolveOperands ( * Need an operand of type ACPI_TYPE_INTEGER, * But we can implicitly convert from a STRING or BUFFER */ - Status = AcpiAmlConvertToInteger (StackPtr, WalkState); + Status = AcpiExConvertToInteger (StackPtr, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Integer/String/Buffer], found [%s] %p\n", + AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -506,14 +502,14 @@ AcpiAmlResolveOperands ( * Need an operand of type ACPI_TYPE_BUFFER, * But we can implicitly convert from a STRING or INTEGER */ - Status = AcpiAmlConvertToBuffer (StackPtr, WalkState); + Status = AcpiExConvertToBuffer (StackPtr, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Integer/String/Buffer], found [%s] %p\n", + AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -531,14 +527,14 @@ AcpiAmlResolveOperands ( * Need an operand of type ACPI_TYPE_STRING, * But we can implicitly convert from a BUFFER or INTEGER */ - Status = AcpiAmlConvertToString (StackPtr, WalkState); + Status = AcpiExConvertToString (StackPtr, WalkState); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Integer/String/Buffer], found [%s] %p\n", + AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -558,9 +554,9 @@ AcpiAmlResolveOperands ( (ACPI_TYPE_STRING != (*StackPtr)->Common.Type) && (ACPI_TYPE_BUFFER != (*StackPtr)->Common.Type)) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Integer/String/Buffer], found [%s] %p\n", - AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Integer/String/Buffer], found [%s] %p\n", + AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -585,9 +581,9 @@ AcpiAmlResolveOperands ( ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE) && ((*StackPtr)->Common.Type != INTERNAL_TYPE_REFERENCE)) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Buf/Str/Pkg/Ref], found [%s] %p\n", - AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Buf/Str/Pkg/Ref], found [%s] %p\n", + AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -599,8 +595,8 @@ AcpiAmlResolveOperands ( { if (!(*StackPtr)->Reference.Node) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Node Reference], found [%p]\n", + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Node Reference], found [%p]\n", *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -612,14 +608,15 @@ AcpiAmlResolveOperands ( case ARGI_COMPLEXOBJ: - /* Need a buffer or package */ + /* Need a buffer or package or (ACPI 2.0) String */ if (((*StackPtr)->Common.Type != ACPI_TYPE_BUFFER) && + ((*StackPtr)->Common.Type != ACPI_TYPE_STRING) && ((*StackPtr)->Common.Type != ACPI_TYPE_PACKAGE)) { - DEBUG_PRINT (ACPI_INFO, - ("AmlResolveOperands: Needed [Buf/Pkg], found [%s] %p\n", - AcpiCmGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); + DEBUG_PRINTP (ACPI_INFO, + ("Needed [Buf/Pkg], found [%s] %p\n", + AcpiUtGetTypeName ((*StackPtr)->Common.Type), *StackPtr)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -631,8 +628,8 @@ AcpiAmlResolveOperands ( /* Unknown type */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveOperands: Internal error - Unknown ARGI type %X\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Internal - Unknown ARGI type %X\n", ThisArgType)); return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -643,7 +640,7 @@ AcpiAmlResolveOperands ( * Make sure that the original object was resolved to the * required object type (Simple cases only). */ - Status = AcpiAmlCheckObjectType (TypeNeeded, + Status = AcpiExCheckObjectType (TypeNeeded, (*StackPtr)->Common.Type, *StackPtr); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/exstore.c b/sys/contrib/dev/acpica/exstore.c index c2c29d71..91bd16c 100644 --- a/sys/contrib/dev/acpica/exstore.c +++ b/sys/contrib/dev/acpica/exstore.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amstore - AML Interpreter object store support - * $Revision: 123 $ + * Module Name: exstore - AML Interpreter object store support + * $Revision: 139 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMSTORE_C__ +#define __EXSTORE_C__ #include "acpi.h" #include "acparser.h" @@ -126,21 +126,17 @@ #include "actables.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amstore") - - - - +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exstore") /******************************************************************************* * - * FUNCTION: AcpiAmlExecStore + * FUNCTION: AcpiExStore * * PARAMETERS: *ValDesc - Value to be stored - * *DestDesc - Where to store it 0 Must be (ACPI_HANDLE) - * or an ACPI_OPERAND_OBJECT of type + * *DestDesc - Where to store it. Must be an NS node + * or an ACPI_OPERAND_OBJECT of type * Reference; if the latter the descriptor * will be either reused or deleted. * @@ -154,7 +150,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlExecStore ( +AcpiExStore ( ACPI_OPERAND_OBJECT *ValDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState) @@ -163,15 +159,14 @@ AcpiAmlExecStore ( ACPI_OPERAND_OBJECT *RefDesc = DestDesc; - FUNCTION_TRACE_PTR ("AmlExecStore", DestDesc); + FUNCTION_TRACE_PTR ("ExStore", DestDesc); /* Validate parameters */ if (!ValDesc || !DestDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecStore: Internal error - null pointer\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Internal - null pointer\n")); return_ACPI_STATUS (AE_AML_NO_OPERAND); } @@ -179,11 +174,11 @@ AcpiAmlExecStore ( if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED)) { - /* + /* * Dest is a namespace node, - * Storing an object into a Name "container" + * Storing an object into a Name "container" */ - Status = AcpiAmlStoreObjectToNode (ValDesc, + Status = AcpiExStoreObjectToNode (ValDesc, (ACPI_NAMESPACE_NODE *) DestDesc, WalkState); /* All done, that's it */ @@ -198,19 +193,19 @@ AcpiAmlExecStore ( { /* Destination is not an Reference */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecStore: Destination is not a ReferenceObj [%p]\n", DestDesc)); + DEBUG_PRINTP (ACPI_ERROR, + ("Destination is not a ReferenceObj [%p]\n", DestDesc)); DUMP_STACK_ENTRY (ValDesc); DUMP_STACK_ENTRY (DestDesc); - DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "AmlExecStore", + DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "ExStore", 2, "Target is not a ReferenceObj"); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* + /* * Examine the Reference opcode. These cases are handled: * * 1) Store to Name (Change the object associated with a name) @@ -220,14 +215,14 @@ AcpiAmlExecStore ( * 5) Store to a constant -- a noop */ - switch (RefDesc->Reference.OpCode) + switch (RefDesc->Reference.Opcode) { case AML_NAME_OP: /* Storing an object into a Name "container" */ - Status = AcpiAmlStoreObjectToNode (ValDesc, RefDesc->Reference.Object, + Status = AcpiExStoreObjectToNode (ValDesc, RefDesc->Reference.Object, WalkState); break; @@ -236,21 +231,17 @@ AcpiAmlExecStore ( /* Storing to an Index (pointer into a packager or buffer) */ - Status = AcpiAmlStoreObjectToIndex (ValDesc, RefDesc, WalkState); + Status = AcpiExStoreObjectToIndex (ValDesc, RefDesc, WalkState); break; case AML_LOCAL_OP: - - Status = AcpiDsMethodDataSetValue (MTH_TYPE_LOCAL, - (RefDesc->Reference.Offset), ValDesc, WalkState); - break; - - case AML_ARG_OP: - Status = AcpiDsMethodDataSetValue (MTH_TYPE_ARG, - (RefDesc->Reference.Offset), ValDesc, WalkState); + /* Store to a method local/arg */ + + Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode, + RefDesc->Reference.Offset, ValDesc, WalkState); break; @@ -259,18 +250,45 @@ AcpiAmlExecStore ( /* * Storing to the Debug object causes the value stored to be * displayed and otherwise has no effect -- see ACPI Specification - * - * TBD: print known object types "prettier". */ DEBUG_PRINT (ACPI_INFO, ("**** Write to Debug Object: ****: \n")); - - if (ValDesc->Common.Type == ACPI_TYPE_STRING) - { - DEBUG_PRINT (ACPI_INFO, ("%s\n", ValDesc->String.Pointer)); - } - else + + DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("[ACPI Debug] %s: ", + AcpiUtGetTypeName (ValDesc->Common.Type))); + + switch (ValDesc->Common.Type) { - DUMP_STACK_ENTRY (ValDesc); + case ACPI_TYPE_INTEGER: + + DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("0x%X (%d)\n", + (UINT32) ValDesc->Integer.Value, (UINT32) ValDesc->Integer.Value)); + break; + + + case ACPI_TYPE_BUFFER: + + DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("Length 0x%X\n", + (UINT32) ValDesc->Buffer.Length)); + break; + + + case ACPI_TYPE_STRING: + + DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("%s\n", ValDesc->String.Pointer)); + break; + + + case ACPI_TYPE_PACKAGE: + + DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("Elements - 0x%X\n", + (UINT32) ValDesc->Package.Elements)); + break; + + + default: + + DEBUG_PRINT_RAW (ACPI_DEBUG_OBJECT, ("@0x%p\n", ValDesc)); + break; } break; @@ -289,9 +307,8 @@ AcpiAmlExecStore ( default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecStore: Internal error - Unknown Reference subtype %02x\n", - RefDesc->Reference.OpCode)); + DEBUG_PRINTP (ACPI_ERROR, ("Internal - Unknown Reference subtype %02x\n", + RefDesc->Reference.Opcode)); /* TBD: [Restructure] use object dump routine !! */ @@ -300,15 +317,14 @@ AcpiAmlExecStore ( Status = AE_AML_INTERNAL; break; - } /* switch (RefDesc->Reference.OpCode) */ - + } /* switch (RefDesc->Reference.Opcode) */ /* Always delete the reference descriptor object */ if (RefDesc) { - AcpiCmRemoveReference (RefDesc); + AcpiUtRemoveReference (RefDesc); } return_ACPI_STATUS (Status); @@ -317,10 +333,10 @@ AcpiAmlExecStore ( /******************************************************************************* * - * FUNCTION: AcpiAmlStoreObjectToIndex + * FUNCTION: AcpiExStoreObjectToIndex * * PARAMETERS: *ValDesc - Value to be stored - * *Node - Named object to recieve the value + * *Node - Named object to receive the value * * RETURN: Status * @@ -329,7 +345,7 @@ AcpiAmlExecStore ( ******************************************************************************/ ACPI_STATUS -AcpiAmlStoreObjectToIndex ( +AcpiExStoreObjectToIndex ( ACPI_OPERAND_OBJECT *ValDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState) @@ -341,7 +357,7 @@ AcpiAmlStoreObjectToIndex ( UINT8 Value = 0; - FUNCTION_TRACE ("AcpiAmlStoreObjectToIndex"); + FUNCTION_TRACE ("AcpiExStoreObjectToIndex"); /* @@ -381,8 +397,8 @@ AcpiAmlStoreObjectToIndex ( * Take away the reference for being part of a package and * delete */ - AcpiCmRemoveReference (ObjDesc); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; } @@ -392,11 +408,11 @@ AcpiAmlStoreObjectToIndex ( { /* * If the ObjDesc is NULL, it means that an uninitialized package - * element has been used as a destination (this is OK), therefore, - * we must create the destination element to match the type of the + * element has been used as a destination (this is OK), therefore, + * we must create the destination element to match the type of the * source element NOTE: ValDesc can be of any type. */ - ObjDesc = AcpiCmCreateInternalObject (ValDesc->Common.Type); + ObjDesc = AcpiUtCreateInternalObject (ValDesc->Common.Type); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -407,10 +423,10 @@ AcpiAmlStoreObjectToIndex ( */ if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type) { - Status = AcpiCmCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState); + Status = AcpiUtCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } } @@ -422,7 +438,7 @@ AcpiAmlStoreObjectToIndex ( */ *(DestDesc->Reference.Where) = ObjDesc; - AcpiCmAddReference (ObjDesc); + AcpiUtAddReference (ObjDesc); } if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type) @@ -432,7 +448,7 @@ AcpiAmlStoreObjectToIndex ( * convert the contents of the source (ValDesc) and copy into * the destination (ObjDesc) */ - Status = AcpiAmlStoreObjectToObject (ValDesc, ObjDesc, + Status = AcpiExStoreObjectToObject (ValDesc, ObjDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -440,8 +456,8 @@ AcpiAmlStoreObjectToIndex ( * An error occurrered when copying the internal object * so delete the reference. */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecStore/Index: Unable to copy the internal object\n")); + DEBUG_PRINTP (ACPI_ERROR, + ("Unable to copy the internal object\n")); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } } @@ -450,6 +466,10 @@ AcpiAmlStoreObjectToIndex ( case ACPI_TYPE_BUFFER_FIELD: + + + /* TBD: can probably call the generic Buffer/Field routines */ + /* * Storing into a buffer at a location defined by an Index. * @@ -473,12 +493,12 @@ AcpiAmlStoreObjectToIndex ( switch (ValDesc->Common.Type) { - /* - * If the type is Integer, assign bytewise - * This loop to assign each of the elements is somewhat - * backward because of the Big Endian-ness of IA-64 - */ case ACPI_TYPE_INTEGER: + /* + * Type is Integer, assign bytewise + * This loop to assign each of the elements is somewhat + * backward because of the Big Endian-ness of IA-64 + */ Length = sizeof (ACPI_INTEGER); for (i = Length; i != 0; i--) { @@ -487,11 +507,12 @@ AcpiAmlStoreObjectToIndex ( } break; - /* - * If the type is Buffer, the Length is in the structure. - * Just loop through the elements and assign each one in turn. - */ + case ACPI_TYPE_BUFFER: + /* + * Type is Buffer, the Length is in the structure. + * Just loop through the elements and assign each one in turn. + */ Length = ValDesc->Buffer.Length; for (i = 0; i < Length; i++) { @@ -500,11 +521,12 @@ AcpiAmlStoreObjectToIndex ( } break; - /* - * If the type is String, the Length is in the structure. - * Just loop through the elements and assign each one in turn. - */ + case ACPI_TYPE_STRING: + /* + * Type is String, the Length is in the structure. + * Just loop through the elements and assign each one in turn. + */ Length = ValDesc->String.Length; for (i = 0; i < Length; i++) { @@ -513,12 +535,13 @@ AcpiAmlStoreObjectToIndex ( } break; - /* - * If source is not a valid type so return an error. - */ + default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecStore/Index: Source must be Number/Buffer/String type, not %X\n", + + /* Other types are invalid */ + + DEBUG_PRINTP (ACPI_ERROR, + ("Source must be Number/Buffer/String type, not %X\n", ValDesc->Common.Type)); Status = AE_AML_OPERAND_TYPE; break; @@ -527,8 +550,7 @@ AcpiAmlStoreObjectToIndex ( default: - DEBUG_PRINT (ACPI_ERROR, - ("AmlExecStoreIndex: Target is not a Package or BufferField\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Target is not a Package or BufferField\n")); Status = AE_AML_OPERAND_TYPE; break; } @@ -538,15 +560,12 @@ AcpiAmlStoreObjectToIndex ( } - - - /******************************************************************************* * - * FUNCTION: AcpiAmlStoreObjectToNode + * FUNCTION: AcpiExStoreObjectToNode * * PARAMETERS: *SourceDesc - Value to be stored - * *Node - Named object to recieve the value + * *Node - Named object to receive the value * * RETURN: Status * @@ -569,17 +588,17 @@ AcpiAmlStoreObjectToIndex ( ******************************************************************************/ ACPI_STATUS -AcpiAmlStoreObjectToNode ( +AcpiExStoreObjectToNode ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_NAMESPACE_NODE *Node, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TargetDesc; - OBJECT_TYPE_INTERNAL TargetType = ACPI_TYPE_ANY; + ACPI_OBJECT_TYPE8 TargetType = ACPI_TYPE_ANY; - FUNCTION_TRACE ("AmlStoreObjectToNode"); + FUNCTION_TRACE ("ExStoreObjectToNode"); /* * Assuming the parameters were already validated @@ -593,16 +612,16 @@ AcpiAmlStoreObjectToNode ( TargetType = AcpiNsGetType (Node); TargetDesc = AcpiNsGetAttachedObject (Node); - DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToNode: Storing %p(%s) into node %p(%s)\n", - Node, AcpiCmGetTypeName (SourceDesc->Common.Type), - SourceDesc, AcpiCmGetTypeName (TargetType))); + DEBUG_PRINTP (ACPI_INFO, ("Storing %p(%s) into node %p(%s)\n", + Node, AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc, AcpiUtGetTypeName (TargetType))); /* * Resolve the source object to an actual value - * (If it is a reference object) + * (If it is a reference object) */ - Status = AcpiAmlResolveObject (&SourceDesc, TargetType, WalkState); + Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -610,32 +629,33 @@ AcpiAmlStoreObjectToNode ( /* - * Do the actual store operation + * Do the actual store operation */ switch (TargetType) { - case INTERNAL_TYPE_DEF_FIELD: - - /* Raw data copy for target types Integer/String/Buffer */ + case ACPI_TYPE_BUFFER_FIELD: + case INTERNAL_TYPE_REGION_FIELD: + case INTERNAL_TYPE_BANK_FIELD: + case INTERNAL_TYPE_INDEX_FIELD: - Status = AcpiAmlCopyDataToNamedField (SourceDesc, Node); + /* + * For fields, copy the source data to the target field. + */ + Status = AcpiExWriteDataToField (SourceDesc, TargetDesc); break; case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: - case INTERNAL_TYPE_BANK_FIELD: - case INTERNAL_TYPE_INDEX_FIELD: - case ACPI_TYPE_FIELD_UNIT: - /* + /* * These target types are all of type Integer/String/Buffer, and * therefore support implicit conversion before the store. - * - * Copy and/or convert the source object to a new target object + * + * Copy and/or convert the source object to a new target object */ - Status = AcpiAmlStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState); + Status = AcpiExStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -647,23 +667,23 @@ AcpiAmlStoreObjectToNode ( * SourceDesc reference count is incremented by AttachObject. */ Status = AcpiNsAttachObject (Node, TargetDesc, TargetType); - DEBUG_PRINT (ACPI_INFO, - ("AmlStoreObjectToNode: Store %s into %s via Convert/Attach\n", - AcpiCmGetTypeName (TargetDesc->Common.Type), - AcpiCmGetTypeName (TargetType))); + DEBUG_PRINTP (ACPI_INFO, + ("Store %s into %s via Convert/Attach\n", + AcpiUtGetTypeName (TargetDesc->Common.Type), + AcpiUtGetTypeName (TargetType))); break; - + default: /* No conversions for all other types. Just attach the source object */ Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type); - - DEBUG_PRINT (ACPI_INFO, - ("AmlStoreObjectToNode: Store %s into %s via Attach only\n", - AcpiCmGetTypeName (SourceDesc->Common.Type), - AcpiCmGetTypeName (SourceDesc->Common.Type))); + + DEBUG_PRINTP (ACPI_INFO, + ("Store %s into %s via Attach only\n", + AcpiUtGetTypeName (SourceDesc->Common.Type), + AcpiUtGetTypeName (SourceDesc->Common.Type))); break; } @@ -672,10 +692,9 @@ AcpiAmlStoreObjectToNode ( } - /******************************************************************************* * - * FUNCTION: AcpiAmlStoreObjectToObject + * FUNCTION: AcpiExStoreObjectToObject * * PARAMETERS: *SourceDesc - Value to be stored * *DestDesc - Object to receive the value @@ -700,16 +719,16 @@ AcpiAmlStoreObjectToNode ( ******************************************************************************/ ACPI_STATUS -AcpiAmlStoreObjectToObject ( +AcpiExStoreObjectToObject ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *DestDesc, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; - OBJECT_TYPE_INTERNAL DestinationType = DestDesc->Common.Type; + ACPI_OBJECT_TYPE8 DestinationType = DestDesc->Common.Type; - FUNCTION_TRACE ("AmlStoreObjectToObject"); + FUNCTION_TRACE ("ExStoreObjectToObject"); /* @@ -717,9 +736,9 @@ AcpiAmlStoreObjectToObject ( */ ACPI_ASSERT((DestDesc) && (SourceDesc)); - DEBUG_PRINT (ACPI_INFO, ("AmlStoreObjectToObject: Storing %p(%s) to %p(%s)\n", - SourceDesc, AcpiCmGetTypeName (SourceDesc->Common.Type), - DestDesc, AcpiCmGetTypeName (DestDesc->Common.Type))); + DEBUG_PRINTP (ACPI_INFO, ("Storing %p(%s) to %p(%s)\n", + SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), + DestDesc, AcpiUtGetTypeName (DestDesc->Common.Type))); /* @@ -733,20 +752,18 @@ AcpiAmlStoreObjectToObject ( break; default: - DEBUG_PRINT (ACPI_WARN, - ("AmlStoreObjectToObject: Store into %s not implemented\n", - AcpiCmGetTypeName (DestDesc->Common.Type))); + DEBUG_PRINTP (ACPI_WARN, ("Store into %s not implemented\n", + AcpiUtGetTypeName (DestDesc->Common.Type))); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } - /* * Resolve the source object to an actual value - * (If it is a reference object) + * (If it is a reference object) */ - Status = AcpiAmlResolveObject (&SourceDesc, DestinationType, WalkState); + Status = AcpiExResolveObject (&SourceDesc, DestinationType, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -754,9 +771,9 @@ AcpiAmlStoreObjectToObject ( /* - * Copy and/or convert the source object to the destination object + * Copy and/or convert the source object to the destination object */ - Status = AcpiAmlStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState); + Status = AcpiExStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState); return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/exstoren.c b/sys/contrib/dev/acpica/exstoren.c index b6bd010..d7b72d1 100644 --- a/sys/contrib/dev/acpica/exstoren.c +++ b/sys/contrib/dev/acpica/exstoren.c @@ -1,9 +1,9 @@ /****************************************************************************** * - * Module Name: amstoren - AML Interpreter object store support, + * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 28 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -116,7 +116,7 @@ * *****************************************************************************/ -#define __AMSTOREN_C__ +#define __EXSTOREN_C__ #include "acpi.h" #include "acparser.h" @@ -127,15 +127,13 @@ #include "actables.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amstoren") - - +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exstoren") /******************************************************************************* * - * FUNCTION: AcpiAmlResolveObject + * FUNCTION: AcpiExResolveObject * * PARAMETERS: SourceDescPtr - Pointer to the source object * TargetType - Current type of the target @@ -143,22 +141,22 @@ * * RETURN: Status, resolved object in SourceDescPtr. * - * DESCRIPTION: Resolve an object. If the object is a reference, dereference + * DESCRIPTION: Resolve an object. If the object is a reference, dereference * it and return the actual object in the SourceDescPtr. * ******************************************************************************/ ACPI_STATUS -AcpiAmlResolveObject ( +AcpiExResolveObject ( ACPI_OPERAND_OBJECT **SourceDescPtr, - OBJECT_TYPE_INTERNAL TargetType, + ACPI_OBJECT_TYPE8 TargetType, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *SourceDesc = *SourceDescPtr; ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("AmlResolveObject"); + FUNCTION_TRACE ("ExResolveObject"); /* @@ -173,18 +171,21 @@ AcpiAmlResolveObject ( * These cases all require only Integers or values that * can be converted to Integers (Strings or Buffers) */ - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: + case INTERNAL_TYPE_REGION_FIELD: case INTERNAL_TYPE_BANK_FIELD: case INTERNAL_TYPE_INDEX_FIELD: /* - * Stores into a Field/Region or into a Buffer/String + * Stores into a Field/Region or into a Buffer/String * are all essentially the same. */ + case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: - case INTERNAL_TYPE_DEF_FIELD: + + + /* TBD: FIX - check for source==REF, resolve, then check type */ /* * If SourceDesc is not a valid type, try to resolve it to one. @@ -196,7 +197,7 @@ AcpiAmlResolveObject ( /* * Initially not a valid type, convert */ - Status = AcpiAmlResolveToValue (SourceDescPtr, WalkState); + Status = AcpiExResolveToValue (SourceDescPtr, WalkState); if (ACPI_SUCCESS (Status) && (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) && (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) && @@ -205,10 +206,10 @@ AcpiAmlResolveObject ( /* * Conversion successful but still not a valid type */ - DEBUG_PRINT (ACPI_ERROR, - ("AmlResolveObject: Cannot assign type %s to %s (must be type Int/Str/Buf)\n", - AcpiCmGetTypeName ((*SourceDescPtr)->Common.Type), - AcpiCmGetTypeName (TargetType))); + DEBUG_PRINTP (ACPI_ERROR, + ("Cannot assign type %s to %s (must be type Int/Str/Buf)\n", + AcpiUtGetTypeName ((*SourceDescPtr)->Common.Type), + AcpiUtGetTypeName (TargetType))); Status = AE_AML_OPERAND_TYPE; } } @@ -218,11 +219,9 @@ AcpiAmlResolveObject ( case INTERNAL_TYPE_ALIAS: /* - * Aliases are resolved by AcpiAmlPrepOperands + * Aliases are resolved by AcpiExPrepOperands */ - DEBUG_PRINT (ACPI_WARN, - ("AmlResolveObject: Store into Alias - should never happen\n")); - + DEBUG_PRINTP (ACPI_WARN, ("Store into Alias - should never happen\n")); Status = AE_AML_INTERNAL; break; @@ -241,11 +240,9 @@ AcpiAmlResolveObject ( } - - /******************************************************************************* * - * FUNCTION: AcpiAmlStoreObject + * FUNCTION: AcpiExStoreObject * * PARAMETERS: SourceDesc - Object to store * TargetType - Current type of the target @@ -254,7 +251,7 @@ AcpiAmlResolveObject ( * * RETURN: Status * - * DESCRIPTION: "Store" an object to another object. This may include + * DESCRIPTION: "Store" an object to another object. This may include * converting the source type to the target type (implicit * conversion), and a copy of the value of the source to * the target. @@ -262,17 +259,17 @@ AcpiAmlResolveObject ( ******************************************************************************/ ACPI_STATUS -AcpiAmlStoreObject ( +AcpiExStoreObject ( ACPI_OPERAND_OBJECT *SourceDesc, - OBJECT_TYPE_INTERNAL TargetType, + ACPI_OBJECT_TYPE8 TargetType, ACPI_OPERAND_OBJECT **TargetDescPtr, ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *TargetDesc = *TargetDescPtr; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("AmlStoreObject"); + FUNCTION_TRACE ("ExStoreObject"); /* @@ -282,13 +279,12 @@ AcpiAmlStoreObject ( * If no conversion performed, SourceDesc is left alone, otherwise it * is updated with a new object. */ - Status = AcpiAmlConvertToTargetType (TargetType, &SourceDesc, WalkState); + Status = AcpiExConvertToTargetType (TargetType, &SourceDesc, WalkState); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - /* * We now have two objects of identical types, and we can perform a * copy of the *value* of the source object. @@ -297,8 +293,8 @@ AcpiAmlStoreObject ( { case ACPI_TYPE_ANY: case INTERNAL_TYPE_DEF_ANY: - - /* + + /* * The target namespace node is uninitialized (has no target object), * and will take on the type of the source object */ @@ -313,37 +309,18 @@ AcpiAmlStoreObject ( /* Truncate value if we are executing from a 32-bit ACPI table */ - AcpiAmlTruncateFor32bitTable (TargetDesc, WalkState); - break; - - - case ACPI_TYPE_FIELD_UNIT: - - Status = AcpiAmlCopyIntegerToFieldUnit (SourceDesc, TargetDesc); - break; - - - case INTERNAL_TYPE_BANK_FIELD: - - Status = AcpiAmlCopyIntegerToBankField (SourceDesc, TargetDesc); + AcpiExTruncateFor32bitTable (TargetDesc, WalkState); break; - - case INTERNAL_TYPE_INDEX_FIELD: - - Status = AcpiAmlCopyIntegerToIndexField (SourceDesc, TargetDesc); - break; - - case ACPI_TYPE_STRING: - Status = AcpiAmlCopyStringToString (SourceDesc, TargetDesc); + Status = AcpiExCopyStringToString (SourceDesc, TargetDesc); break; case ACPI_TYPE_BUFFER: - Status = AcpiAmlCopyBufferToBuffer (SourceDesc, TargetDesc); + Status = AcpiExCopyBufferToBuffer (SourceDesc, TargetDesc); break; @@ -361,9 +338,8 @@ AcpiAmlStoreObject ( /* * All other types come here. */ - DEBUG_PRINT (ACPI_WARN, - ("AmlStoreObject: Store into type %s not implemented\n", - AcpiCmGetTypeName (TargetType))); + DEBUG_PRINTP (ACPI_WARN, ("Store into type %s not implemented\n", + AcpiUtGetTypeName (TargetType))); Status = AE_NOT_IMPLEMENTED; break; diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c index a4bd94d..1b27063 100644 --- a/sys/contrib/dev/acpica/exstorob.c +++ b/sys/contrib/dev/acpica/exstorob.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amstorob - AML Interpreter object store support, store to object - * $Revision: 23 $ + * Module Name: exstorob - AML Interpreter object store support, store to object + * $Revision: 32 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMSTOROB_C__ +#define __EXSTOROB_C__ #include "acpi.h" #include "acparser.h" @@ -126,14 +126,13 @@ #include "actables.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amstorob") - +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exstorob") /******************************************************************************* * - * FUNCTION: AcpiAmlCopyBufferToBuffer + * FUNCTION: AcpiExCopyBufferToBuffer * * PARAMETERS: SourceDesc - Source object to copy * TargetDesc - Destination object of the copy @@ -145,14 +144,14 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlCopyBufferToBuffer ( +AcpiExCopyBufferToBuffer ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc) { UINT32 Length; UINT8 *Buffer; - - + + /* * We know that SourceDesc is a buffer by now */ @@ -165,7 +164,7 @@ AcpiAmlCopyBufferToBuffer ( */ if (TargetDesc->Buffer.Length == 0) { - TargetDesc->Buffer.Pointer = AcpiCmAllocate (Length); + TargetDesc->Buffer.Pointer = AcpiUtAllocate (Length); if (!TargetDesc->Buffer.Pointer) { return (AE_NO_MEMORY); @@ -173,7 +172,7 @@ AcpiAmlCopyBufferToBuffer ( TargetDesc->Buffer.Length = Length; } - + /* * Buffer is a static allocation, * only place what will fit in the buffer. @@ -186,7 +185,7 @@ AcpiAmlCopyBufferToBuffer ( MEMCPY(TargetDesc->Buffer.Pointer, Buffer, Length); } - else + else { /* * Truncate the source, copy only what will fit @@ -194,7 +193,7 @@ AcpiAmlCopyBufferToBuffer ( MEMCPY(TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length); DEBUG_PRINT (ACPI_INFO, - ("AmlCopyBufferToBuffer: Truncating src buffer from %X to %X\n", + ("ExCopyBufferToBuffer: Truncating src buffer from %X to %X\n", Length, TargetDesc->Buffer.Length)); } @@ -202,11 +201,9 @@ AcpiAmlCopyBufferToBuffer ( } - - /******************************************************************************* * - * FUNCTION: AcpiAmlCopyStringToString + * FUNCTION: AcpiExCopyStringToString * * PARAMETERS: SourceDesc - Source object to copy * TargetDesc - Destination object of the copy @@ -218,7 +215,7 @@ AcpiAmlCopyBufferToBuffer ( ******************************************************************************/ ACPI_STATUS -AcpiAmlCopyStringToString ( +AcpiExCopyStringToString ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT *TargetDesc) { @@ -255,10 +252,10 @@ AcpiAmlCopyStringToString ( /* * Only free if not a pointer into the DSDT */ - AcpiCmFree(TargetDesc->String.Pointer); + AcpiUtFree(TargetDesc->String.Pointer); } - TargetDesc->String.Pointer = AcpiCmAllocate (Length + 1); + TargetDesc->String.Pointer = AcpiUtAllocate (Length + 1); if (!TargetDesc->String.Pointer) { return (AE_NO_MEMORY); @@ -273,324 +270,3 @@ AcpiAmlCopyStringToString ( } - - - -/******************************************************************************* - * - * FUNCTION: AcpiAmlCopyIntegerToIndexField - * - * PARAMETERS: SourceDesc - Source object to copy - * TargetDesc - Destination object of the copy - * - * RETURN: Status - * - * DESCRIPTION: Write an Integer to an Index Field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAmlCopyIntegerToIndexField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc) -{ - ACPI_STATUS Status; - BOOLEAN Locked; - - - /* - * Get the global lock if needed - */ - Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule); - - /* - * Set Index value to select proper Data register - * perform the update (Set index) - */ - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - TargetDesc->IndexField.Index, - &TargetDesc->IndexField.Value, - sizeof (TargetDesc->IndexField.Value)); - if (ACPI_SUCCESS (Status)) - { - /* SetIndex was successful, next set Data value */ - - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - TargetDesc->IndexField.Data, - &SourceDesc->Integer.Value, - sizeof (SourceDesc->Integer.Value)); - - DEBUG_PRINT (ACPI_INFO, - ("AmlCopyIntegerToIndexField: IndexField: set data returned %s\n", - AcpiCmFormatException (Status))); - } - - else - { - DEBUG_PRINT (ACPI_INFO, - ("AmlCopyIntegerToIndexField: IndexField: set index returned %s\n", - AcpiCmFormatException (Status))); - } - - - /* - * Release global lock if we acquired it earlier - */ - AcpiAmlReleaseGlobalLock (Locked); - - return (Status); -} - - - -/******************************************************************************* - * - * FUNCTION: AcpiAmlCopyIntegerToBankField - * - * PARAMETERS: SourceDesc - Source object to copy - * TargetDesc - Destination object of the copy - * - * RETURN: Status - * - * DESCRIPTION: Write an Integer to a Bank Field - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAmlCopyIntegerToBankField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc) -{ - ACPI_STATUS Status; - BOOLEAN Locked; - - - /* - * Get the global lock if needed - */ - Locked = AcpiAmlAcquireGlobalLock (TargetDesc->IndexField.LockRule); - - - - /* - * Set Bank value to select proper Bank - * Perform the update (Set Bank Select) - */ - - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - TargetDesc->BankField.BankSelect, - &TargetDesc->BankField.Value, - sizeof (TargetDesc->BankField.Value)); - if (ACPI_SUCCESS (Status)) - { - /* Set bank select successful, set data value */ - - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - TargetDesc->BankField.BankSelect, - &SourceDesc->BankField.Value, - sizeof (SourceDesc->BankField.Value)); - } - - else - { - DEBUG_PRINT (ACPI_INFO, - ("AmlCopyIntegerToBankField: BankField: set bakn returned %s\n", - AcpiCmFormatException (Status))); - } - - - /* - * Release global lock if we acquired it earlier - */ - AcpiAmlReleaseGlobalLock (Locked); - - return (Status); -} - - - - -/******************************************************************************* - * - * FUNCTION: AcpiAmlCopyDataToNamedField - * - * PARAMETERS: SourceDesc - Source object to copy - * Node - Destination Namespace node - * - * RETURN: Status - * - * DESCRIPTION: Copy raw data to a Named Field. No implicit conversion - * is performed on the source object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAmlCopyDataToNamedField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_NAMESPACE_NODE *Node) -{ - ACPI_STATUS Status; - BOOLEAN Locked; - UINT32 Length; - UINT8 *Buffer; - - - /* - * Named fields (CreateXxxField) - We don't perform any conversions on the - * source operand, just use the raw data - */ - switch (SourceDesc->Common.Type) - { - case ACPI_TYPE_INTEGER: - Buffer = (UINT8 *) &SourceDesc->Integer.Value; - Length = sizeof (SourceDesc->Integer.Value); - break; - - case ACPI_TYPE_BUFFER: - Buffer = (UINT8 *) SourceDesc->Buffer.Pointer; - Length = SourceDesc->Buffer.Length; - break; - - case ACPI_TYPE_STRING: - Buffer = (UINT8 *) SourceDesc->String.Pointer; - Length = SourceDesc->String.Length; - break; - - default: - return (AE_TYPE); - } - - /* - * Get the global lock if needed before the update - * TBD: not needed! - */ - Locked = AcpiAmlAcquireGlobalLock (SourceDesc->Field.LockRule); - - Status = AcpiAmlAccessNamedField (ACPI_WRITE, - Node, Buffer, Length); - - AcpiAmlReleaseGlobalLock (Locked); - - return (Status); -} - - - - -/******************************************************************************* - * - * FUNCTION: AcpiAmlCopyIntegerToFieldUnit - * - * PARAMETERS: SourceDesc - Source object to copy - * TargetDesc - Destination object of the copy - * - * RETURN: Status - * - * DESCRIPTION: Write an Integer to a Field Unit. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiAmlCopyIntegerToFieldUnit ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *TargetDesc) -{ - ACPI_STATUS Status = AE_OK; - UINT8 *Location = NULL; - UINT32 Mask; - UINT32 NewValue; - BOOLEAN Locked = FALSE; - - - - FUNCTION_TRACE ("AmlCopyIntegerToFieldUnit"); - - /* - * If the Field Buffer and Index have not been previously evaluated, - * evaluate them and save the results. - */ - if (!(TargetDesc->Common.Flags & AOPOBJ_DATA_VALID)) - { - Status = AcpiDsGetFieldUnitArguments (TargetDesc); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - if ((!TargetDesc->FieldUnit.Container || - ACPI_TYPE_BUFFER != TargetDesc->FieldUnit.Container->Common.Type)) - { - DEBUG_PRINT (ACPI_ERROR, - ("Null Container or wrong type: %p", TargetDesc->FieldUnit.Container)); - - if (TargetDesc->FieldUnit.Container) - { - DEBUG_PRINT_RAW (ACPI_ERROR, (" Type %X", - TargetDesc->FieldUnit.Container->Common.Type)); - } - DEBUG_PRINT_RAW (ACPI_ERROR, ("\n")); - - return_ACPI_STATUS (AE_AML_INTERNAL); - } - - /* - * Get the global lock if needed - */ - Locked = AcpiAmlAcquireGlobalLock (TargetDesc->FieldUnit.LockRule); - - /* - * TBD: [Unhandled] REMOVE this limitation - * Make sure the operation is within the limits of our implementation - * this is not a Spec limitation!! - */ - if (TargetDesc->FieldUnit.Length + TargetDesc->FieldUnit.BitOffset > 32) - { - DEBUG_PRINT (ACPI_ERROR, - ("AmlCopyIntegerToFieldUnit: FieldUnit: Implementation limitation - Field exceeds UINT32\n")); - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); - } - - /* Field location is (base of buffer) + (byte offset) */ - - Location = TargetDesc->FieldUnit.Container->Buffer.Pointer - + TargetDesc->FieldUnit.Offset; - - /* - * Construct Mask with 1 bits where the field is, - * 0 bits elsewhere - */ - Mask = ((UINT32) 1 << TargetDesc->FieldUnit.Length) - ((UINT32)1 - << TargetDesc->FieldUnit.BitOffset); - - DEBUG_PRINT (TRACE_EXEC, - ("** Store %lx in buffer %p byte %ld bit %X width %d addr %p mask %08lx\n", - SourceDesc->Integer.Value, - TargetDesc->FieldUnit.Container->Buffer.Pointer, - TargetDesc->FieldUnit.Offset, TargetDesc->FieldUnit.BitOffset, - TargetDesc->FieldUnit.Length,Location, Mask)); - - /* Zero out the field in the buffer */ - - MOVE_UNALIGNED32_TO_32 (&NewValue, Location); - NewValue &= ~Mask; - - /* - * Shift and mask the new value into position, - * and or it into the buffer. - */ - NewValue |= (SourceDesc->Integer.Value << TargetDesc->FieldUnit.BitOffset) & - Mask; - - /* Store back the value */ - - MOVE_UNALIGNED32_TO_32 (Location, &NewValue); - - DEBUG_PRINT (TRACE_EXEC, ("New Field value %08lx\n", NewValue)); - return_ACPI_STATUS (AE_OK); -} - - - - - diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c index e1f64ea..3aca04f 100644 --- a/sys/contrib/dev/acpica/exsystem.c +++ b/sys/contrib/dev/acpica/exsystem.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amsystem - Interface to OS services - * $Revision: 54 $ + * Module Name: exsystem - Interface to OS services + * $Revision: 62 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMSYSTEM_C__ +#define __EXSYSTEM_C__ #include "acpi.h" #include "acinterp.h" @@ -123,34 +123,13 @@ #include "achware.h" #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amsystem") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exsystem") /******************************************************************************* * - * FUNCTION: AcpiAmlSystemThreadId - * - * PARAMETERS: None - * - * RETURN: Current Thread ID (for this implementation a 1 is returned) - * - * DESCRIPTION: An invocation is identified by its Thread ID. In a single - * threaded OS the Thread ID is undefined so a 1 will be - * returned. - * - ******************************************************************************/ - -UINT16 -AcpiAmlSystemThreadId (void) -{ - return (1); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiAmlSystemWaitSemaphore + * FUNCTION: AcpiExSystemWaitSemaphore * * PARAMETERS: Semaphore - OSD semaphore to wait on * Timeout - Max time to wait @@ -164,14 +143,14 @@ AcpiAmlSystemThreadId (void) ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemWaitSemaphore ( +AcpiExSystemWaitSemaphore ( ACPI_HANDLE Semaphore, UINT32 Timeout) { ACPI_STATUS Status; - FUNCTION_TRACE ("AcpiAmlSystemWaitSemaphore"); + FUNCTION_TRACE ("AcpiExSystemWaitSemaphore"); Status = AcpiOsWaitSemaphore (Semaphore, 1, 0); if (ACPI_SUCCESS (Status)) @@ -183,17 +162,22 @@ AcpiAmlSystemWaitSemaphore ( { /* We must wait, so unlock the interpreter */ - AcpiAmlExitInterpreter (); + AcpiExExitInterpreter (); Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); + DEBUG_PRINT (TRACE_EXEC, ("*** Thread awake after blocking, %s\n", + AcpiUtFormatException (Status))); + /* Reacquire the interpreter */ - AcpiAmlEnterInterpreter (); + Status = AcpiExEnterInterpreter (); + if (ACPI_SUCCESS (Status)) + { + /* Restore the timeout exception */ - DEBUG_PRINT (TRACE_EXEC, - ("*** Thread awake and inside interpreter after blocking, %s\n", - AcpiCmFormatException (Status))); + Status = AE_TIME; + } } return_ACPI_STATUS (Status); @@ -202,7 +186,7 @@ AcpiAmlSystemWaitSemaphore ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemDoStall + * FUNCTION: AcpiExSystemDoStall * * PARAMETERS: HowLong - The amount of time to stall * @@ -213,7 +197,7 @@ AcpiAmlSystemWaitSemaphore ( ******************************************************************************/ void -AcpiAmlSystemDoStall ( +AcpiExSystemDoStall ( UINT32 HowLong) { @@ -221,13 +205,13 @@ AcpiAmlSystemDoStall ( { /* Since this thread will sleep, we must release the interpreter */ - AcpiAmlExitInterpreter (); + AcpiExExitInterpreter (); AcpiOsSleepUsec (HowLong); /* And now we must get the interpreter again */ - AcpiAmlEnterInterpreter (); + AcpiExEnterInterpreter (); } else @@ -239,7 +223,7 @@ AcpiAmlSystemDoStall ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemDoSuspend + * FUNCTION: AcpiExSystemDoSuspend * * PARAMETERS: HowLong - The amount of time to suspend * @@ -250,25 +234,25 @@ AcpiAmlSystemDoStall ( ******************************************************************************/ void -AcpiAmlSystemDoSuspend ( +AcpiExSystemDoSuspend ( UINT32 HowLong) { /* Since this thread will sleep, we must release the interpreter */ - AcpiAmlExitInterpreter (); + AcpiExExitInterpreter (); AcpiOsSleep ((UINT16) (HowLong / (UINT32) 1000), (UINT16) (HowLong % (UINT32) 1000)); /* And now we must get the interpreter again */ - AcpiAmlEnterInterpreter (); + AcpiExEnterInterpreter (); } /******************************************************************************* * - * FUNCTION: AcpiAmlSystemAcquireMutex + * FUNCTION: AcpiExSystemAcquireMutex * * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor * *ObjDesc - The object descriptor for this op @@ -282,14 +266,14 @@ AcpiAmlSystemDoSuspend ( ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemAcquireMutex ( +AcpiExSystemAcquireMutex ( ACPI_OPERAND_OBJECT *TimeDesc, ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_PTR ("AcpiAmlSystemAcquireMutex", ObjDesc); + FUNCTION_TRACE_PTR ("AcpiExSystemAcquireMutex", ObjDesc); if (!ObjDesc) { @@ -306,7 +290,7 @@ AcpiAmlSystemAcquireMutex ( return_ACPI_STATUS (Status); } - Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Mutex.Semaphore, + Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore, (UINT32) TimeDesc->Integer.Value); return_ACPI_STATUS (Status); } @@ -314,7 +298,7 @@ AcpiAmlSystemAcquireMutex ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemReleaseMutex + * FUNCTION: AcpiExSystemReleaseMutex * * PARAMETERS: *ObjDesc - The object descriptor for this op * @@ -328,13 +312,13 @@ AcpiAmlSystemAcquireMutex ( ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemReleaseMutex ( +AcpiExSystemReleaseMutex ( ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("AcpiAmlSystemReleaseMutex"); + FUNCTION_TRACE ("AcpiExSystemReleaseMutex"); if (!ObjDesc) @@ -358,7 +342,7 @@ AcpiAmlSystemReleaseMutex ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemSignalEvent + * FUNCTION: AcpiExSystemSignalEvent * * PARAMETERS: *ObjDesc - The object descriptor for this op * @@ -370,13 +354,13 @@ AcpiAmlSystemReleaseMutex ( ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemSignalEvent ( +AcpiExSystemSignalEvent ( ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("AcpiAmlSystemSignalEvent"); + FUNCTION_TRACE ("AcpiExSystemSignalEvent"); if (ObjDesc) @@ -390,7 +374,7 @@ AcpiAmlSystemSignalEvent ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemWaitEvent + * FUNCTION: AcpiExSystemWaitEvent * * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor * *ObjDesc - The object descriptor for this op @@ -404,19 +388,19 @@ AcpiAmlSystemSignalEvent ( ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemWaitEvent ( +AcpiExSystemWaitEvent ( ACPI_OPERAND_OBJECT *TimeDesc, ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("AcpiAmlSystemWaitEvent"); + FUNCTION_TRACE ("AcpiExSystemWaitEvent"); if (ObjDesc) { - Status = AcpiAmlSystemWaitSemaphore (ObjDesc->Event.Semaphore, + Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore, (UINT32) TimeDesc->Integer.Value); } @@ -427,19 +411,18 @@ AcpiAmlSystemWaitEvent ( /******************************************************************************* * - * FUNCTION: AcpiAmlSystemResetEvent + * FUNCTION: AcpiExSystemResetEvent * * PARAMETERS: *ObjDesc - The object descriptor for this op * * RETURN: Status * - * DESCRIPTION: Provides an access point to perform synchronization operations - * within the AML. + * DESCRIPTION: Reset an event to a known state. * ******************************************************************************/ ACPI_STATUS -AcpiAmlSystemResetEvent ( +AcpiExSystemResetEvent ( ACPI_OPERAND_OBJECT *ObjDesc) { ACPI_STATUS Status = AE_OK; @@ -454,8 +437,8 @@ AcpiAmlSystemResetEvent ( Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore); if (ACPI_SUCCESS (Status)) { - AcpiOsDeleteSemaphore (ObjDesc->Mutex.Semaphore); - ObjDesc->Mutex.Semaphore = TempSemaphore; + AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore); + ObjDesc->Event.Semaphore = TempSemaphore; } return (Status); diff --git a/sys/contrib/dev/acpica/exutils.c b/sys/contrib/dev/acpica/exutils.c index 7f17991..1468e84 100644 --- a/sys/contrib/dev/acpica/exutils.c +++ b/sys/contrib/dev/acpica/exutils.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amutils - interpreter/scanner utilities - * $Revision: 69 $ + * Module Name: exutils - interpreter/scanner utilities + * $Revision: 79 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ * *****************************************************************************/ -#define __AMUTILS_C__ +#define __EXUTILS_C__ #include "acpi.h" #include "acparser.h" @@ -124,36 +124,37 @@ #include "acnamesp.h" #include "acevents.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amutils") - +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exutils") /******************************************************************************* * - * FUNCTION: AcpiAmlEnterInterpreter + * FUNCTION: AcpiExEnterInterpreter * * PARAMETERS: None * * DESCRIPTION: Enter the interpreter execution region + * TBD: should be a macro * ******************************************************************************/ -void -AcpiAmlEnterInterpreter (void) +ACPI_STATUS +AcpiExEnterInterpreter (void) { - FUNCTION_TRACE ("AmlEnterInterpreter"); + ACPI_STATUS Status; + FUNCTION_TRACE ("ExEnterInterpreter"); - AcpiCmAcquireMutex (ACPI_MTX_EXECUTE); - return_VOID; + Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE); + return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiAmlExitInterpreter + * FUNCTION: AcpiExExitInterpreter * * PARAMETERS: None * @@ -169,15 +170,17 @@ AcpiAmlEnterInterpreter (void) * already executing * 7) About to invoke a user-installed opregion handler * + * TBD: should be a macro + * ******************************************************************************/ void -AcpiAmlExitInterpreter (void) +AcpiExExitInterpreter (void) { - FUNCTION_TRACE ("AmlExitInterpreter"); + FUNCTION_TRACE ("ExExitInterpreter"); - AcpiCmReleaseMutex (ACPI_MTX_EXECUTE); + AcpiUtReleaseMutex (ACPI_MTX_EXECUTE); return_VOID; } @@ -185,7 +188,7 @@ AcpiAmlExitInterpreter (void) /******************************************************************************* * - * FUNCTION: AcpiAmlValidateObjectType + * FUNCTION: AcpiExValidateObjectType * * PARAMETERS: Type Object type to validate * @@ -194,7 +197,7 @@ AcpiAmlExitInterpreter (void) ******************************************************************************/ BOOLEAN -AcpiAmlValidateObjectType ( +AcpiExValidateObjectType ( ACPI_OBJECT_TYPE Type) { @@ -210,7 +213,7 @@ AcpiAmlValidateObjectType ( /******************************************************************************* * - * FUNCTION: AcpiAmlTruncateFor32bitTable + * FUNCTION: AcpiExTruncateFor32bitTable * * PARAMETERS: ObjDesc - Object to be truncated * WalkState - Current walk state @@ -224,7 +227,7 @@ AcpiAmlValidateObjectType ( ******************************************************************************/ void -AcpiAmlTruncateFor32bitTable ( +AcpiExTruncateFor32bitTable ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_WALK_STATE *WalkState) { @@ -254,7 +257,7 @@ AcpiAmlTruncateFor32bitTable ( /******************************************************************************* * - * FUNCTION: AcpiAmlAcquireGlobalLock + * FUNCTION: AcpiExAcquireGlobalLock * * PARAMETERS: Rule - Lock rule: AlwaysLock, NeverLock * @@ -267,32 +270,32 @@ AcpiAmlTruncateFor32bitTable ( ******************************************************************************/ BOOLEAN -AcpiAmlAcquireGlobalLock ( +AcpiExAcquireGlobalLock ( UINT32 Rule) { BOOLEAN Locked = FALSE; ACPI_STATUS Status; - FUNCTION_TRACE ("AmlAcquireGlobalLock"); + FUNCTION_TRACE ("ExAcquireGlobalLock"); - /* Only attempt lock if the Rule says so */ + /* Only attempt lock if the Rule says so */ if (Rule == (UINT32) GLOCK_ALWAYS_LOCK) { - /* OK to get the lock */ + /* We should attempt to get the lock */ Status = AcpiEvAcquireGlobalLock (); - if (ACPI_FAILURE (Status)) + if (ACPI_SUCCESS (Status)) { - DEBUG_PRINT (ACPI_ERROR, ("Get Global Lock Failed!!\n")); + Locked = TRUE; } - if (ACPI_SUCCESS (Status)) + else { - AcpiGbl_GlobalLockSet = TRUE; - Locked = TRUE; + DEBUG_PRINTP (ACPI_ERROR, ("Could not acquire Global Lock, %s\n", + AcpiUtFormatException (Status))); } } @@ -302,7 +305,7 @@ AcpiAmlAcquireGlobalLock ( /******************************************************************************* * - * FUNCTION: AcpiAmlReleaseGlobalLock + * FUNCTION: AcpiExReleaseGlobalLock * * PARAMETERS: LockedByMe - Return value from corresponding call to * AcquireGlobalLock. @@ -314,31 +317,20 @@ AcpiAmlAcquireGlobalLock ( ******************************************************************************/ ACPI_STATUS -AcpiAmlReleaseGlobalLock ( +AcpiExReleaseGlobalLock ( BOOLEAN LockedByMe) { - FUNCTION_TRACE ("AmlReleaseGlobalLock"); + FUNCTION_TRACE ("ExReleaseGlobalLock"); /* Only attempt unlock if the caller locked it */ if (LockedByMe) { - /* Double check against the global flag */ - - if (AcpiGbl_GlobalLockSet) - { - /* OK, now release the lock */ - - AcpiEvReleaseGlobalLock (); - AcpiGbl_GlobalLockSet = FALSE; - } + /* OK, now release the lock */ - else - { - DEBUG_PRINT (ACPI_ERROR, ("Global lock was not set\n")); - } + AcpiEvReleaseGlobalLock (); } @@ -348,7 +340,7 @@ AcpiAmlReleaseGlobalLock ( /******************************************************************************* * - * FUNCTION: AcpiAmlDigitsNeeded + * FUNCTION: AcpiExDigitsNeeded * * PARAMETERS: val - Value to be represented * base - Base of representation @@ -358,24 +350,27 @@ AcpiAmlReleaseGlobalLock ( ******************************************************************************/ UINT32 -AcpiAmlDigitsNeeded ( +AcpiExDigitsNeeded ( ACPI_INTEGER val, UINT32 base) { UINT32 NumDigits = 0; - FUNCTION_TRACE ("AmlDigitsNeeded"); + FUNCTION_TRACE ("ExDigitsNeeded"); if (base < 1) { - REPORT_ERROR (("AmlDigitsNeeded: Internal error - Invalid base\n")); + REPORT_ERROR (("ExDigitsNeeded: Internal error - Invalid base\n")); } else { - for (NumDigits = 1 + (val < 0); (val = ACPI_DIVIDE (val,base)); ++NumDigits) + /* + * ACPI_INTEGER is unsigned, which is why we don't worry about the '-' + */ + for (NumDigits = 1; (val = ACPI_DIVIDE (val,base)); ++NumDigits) { ; } } @@ -423,7 +418,7 @@ _ntohl ( /******************************************************************************* * - * FUNCTION: AcpiAmlEisaIdToString + * FUNCTION: AcpiExEisaIdToString * * PARAMETERS: NumericId - EISA ID to be converted * OutString - Where to put the converted string (8 bytes) @@ -433,7 +428,7 @@ _ntohl ( ******************************************************************************/ ACPI_STATUS -AcpiAmlEisaIdToString ( +AcpiExEisaIdToString ( UINT32 NumericId, NATIVE_CHAR *OutString) { @@ -458,7 +453,7 @@ AcpiAmlEisaIdToString ( /******************************************************************************* * - * FUNCTION: AcpiAmlUnsignedIntegerToString + * FUNCTION: AcpiExUnsignedIntegerToString * * PARAMETERS: Value - Value to be converted * OutString - Where to put the converted string (8 bytes) @@ -468,7 +463,7 @@ AcpiAmlEisaIdToString ( ******************************************************************************/ ACPI_STATUS -AcpiAmlUnsignedIntegerToString ( +AcpiExUnsignedIntegerToString ( ACPI_INTEGER Value, NATIVE_CHAR *OutString) { @@ -476,7 +471,7 @@ AcpiAmlUnsignedIntegerToString ( UINT32 DigitsNeeded; - DigitsNeeded = AcpiAmlDigitsNeeded (Value, 10); + DigitsNeeded = AcpiExDigitsNeeded (Value, 10); OutString[DigitsNeeded] = '\0'; @@ -490,7 +485,3 @@ AcpiAmlUnsignedIntegerToString ( } - - - - diff --git a/sys/contrib/dev/acpica/exxface.c b/sys/contrib/dev/acpica/exxface.c index 960677e..d34c460 100644 --- a/sys/contrib/dev/acpica/exxface.c +++ b/sys/contrib/dev/acpica/exxface.c @@ -1,8 +1,8 @@ /****************************************************************************** * - * Module Name: amxface - External interpreter interfaces - * $Revision: 24 $ + * Module Name: exxface - External interpreter interfaces + * $Revision: 27 $ * *****************************************************************************/ @@ -115,14 +115,14 @@ * *****************************************************************************/ -#define __AMXFACE_C__ +#define __EXXFACE_C__ #include "acpi.h" #include "acinterp.h" -#define _COMPONENT INTERPRETER - MODULE_NAME ("amxface") +#define _COMPONENT ACPI_EXECUTER + MODULE_NAME ("exxface") /* @@ -147,7 +147,7 @@ /******************************************************************************* * - * FUNCTION: AcpiAmlExecuteMethod + * FUNCTION: AcpiExExecuteMethod * * PARAMETERS: Pcode - Pointer to the pcode stream * PcodeLength - Length of pcode that comprises the method @@ -162,7 +162,7 @@ ******************************************************************************/ ACPI_STATUS -AcpiAmlExecuteMethod ( +AcpiExExecuteMethod ( ACPI_NAMESPACE_NODE *MethodNode, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **ReturnObjDesc) @@ -170,7 +170,7 @@ AcpiAmlExecuteMethod ( ACPI_STATUS Status; - FUNCTION_TRACE ("AmlExecuteMethod"); + FUNCTION_TRACE ("ExExecuteMethod"); /* @@ -178,11 +178,15 @@ AcpiAmlExecuteMethod ( * level execute. */ - AcpiAmlEnterInterpreter (); + Status = AcpiExEnterInterpreter (); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } Status = AcpiPsxExecute (MethodNode, Params, ReturnObjDesc); - AcpiAmlExitInterpreter (); + AcpiExExitInterpreter (); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/hwacpi.c b/sys/contrib/dev/acpica/hwacpi.c index d8b5f10..9781d18 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: 36 $ + * $Revision: 40 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "achware.h" -#define _COMPONENT HARDWARE +#define _COMPONENT ACPI_HARDWARE MODULE_NAME ("hwacpi") @@ -154,7 +154,7 @@ AcpiHwInitialize ( { AcpiGbl_RestoreAcpiChipset = FALSE; - DEBUG_PRINT (ACPI_ERROR, ("HwInitialize: No FADT!\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No FADT!\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -165,8 +165,8 @@ AcpiHwInitialize ( { RestoreAcpiChipset = FALSE; - DEBUG_PRINT (ACPI_ERROR, - ("CmHardwareInitialize: Supported modes uninitialized!\n")); + DEBUG_PRINTP (ACPI_ERROR, + ("Supported modes uninitialized!\n")); return_ACPI_STATUS (AE_ERROR); } @@ -180,14 +180,14 @@ AcpiHwInitialize ( case (SYS_MODE_ACPI): AcpiGbl_OriginalMode = SYS_MODE_ACPI; - DEBUG_PRINT (ACPI_INFO, ("System supports ACPI mode only.\n")); + DEBUG_PRINTP (ACPI_INFO, ("System supports ACPI mode only.\n")); break; case (SYS_MODE_LEGACY): AcpiGbl_OriginalMode = SYS_MODE_LEGACY; - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("Tables loaded from buffer, hardware assumed to support LEGACY mode only.\n")); break; @@ -203,10 +203,10 @@ AcpiHwInitialize ( AcpiGbl_OriginalMode = SYS_MODE_LEGACY; } - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("System supports both ACPI and LEGACY modes.\n")); - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("System is currently in %s mode.\n", (AcpiGbl_OriginalMode == SYS_MODE_ACPI) ? "ACPI" : "LEGACY")); break; @@ -246,7 +246,7 @@ AcpiHwInitialize ( /* GPE0 specified in FADT */ AcpiGbl_Gpe0EnableRegisterSave = - AcpiCmAllocate (DIV_2 (AcpiGbl_FADT->Gpe0BlkLen)); + AcpiUtAllocate (DIV_2 (AcpiGbl_FADT->Gpe0BlkLen)); if (!AcpiGbl_Gpe0EnableRegisterSave) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -272,7 +272,7 @@ AcpiHwInitialize ( /* GPE1 defined */ AcpiGbl_Gpe1EnableRegisterSave = - AcpiCmAllocate (DIV_2 (AcpiGbl_FADT->Gpe1BlkLen)); + AcpiUtAllocate (DIV_2 (AcpiGbl_FADT->Gpe1BlkLen)); if (!AcpiGbl_Gpe1EnableRegisterSave) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -315,7 +315,7 @@ AcpiHwSetMode ( UINT32 Mode) { - ACPI_STATUS Status = AE_ERROR; + ACPI_STATUS Status = AE_NO_HARDWARE_RESPONSE; FUNCTION_TRACE ("HwSetMode"); @@ -325,7 +325,7 @@ AcpiHwSetMode ( /* BIOS should have disabled ALL fixed and GP events */ AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiEnable); - DEBUG_PRINT (ACPI_INFO, ("Attempting to enable ACPI mode\n")); + DEBUG_PRINTP (ACPI_INFO, ("Attempting to enable ACPI mode\n")); } else if (Mode == SYS_MODE_LEGACY) @@ -336,13 +336,13 @@ AcpiHwSetMode ( */ AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, AcpiGbl_FADT->AcpiDisable); - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("Attempting to enable Legacy (non-ACPI) mode\n")); } if (AcpiHwGetMode () == Mode) { - DEBUG_PRINT (ACPI_INFO, ("Mode %X successfully enabled\n", Mode)); + DEBUG_PRINTP (ACPI_INFO, ("Mode %X successfully enabled\n", Mode)); Status = AE_OK; } diff --git a/sys/contrib/dev/acpica/hwgpe.c b/sys/contrib/dev/acpica/hwgpe.c index 52851fa..7302eb9 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: 28 $ + * $Revision: 29 $ * *****************************************************************************/ @@ -120,7 +120,7 @@ #include "acnamesp.h" #include "acevents.h" -#define _COMPONENT HARDWARE +#define _COMPONENT ACPI_HARDWARE MODULE_NAME ("hwgpe") diff --git a/sys/contrib/dev/acpica/hwregs.c b/sys/contrib/dev/acpica/hwregs.c index 1c47c67..7f20418 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: 88 $ + * $Revision: 97 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "achware.h" #include "acnamesp.h" -#define _COMPONENT HARDWARE +#define _COMPONENT ACPI_HARDWARE MODULE_NAME ("hwregs") @@ -184,12 +184,12 @@ AcpiHwClearAcpiStatus (void) FUNCTION_TRACE ("HwClearAcpiStatus"); - DEBUG_PRINT (TRACE_IO, ("About to write %04X to %04X\n", - ALL_FIXED_STS_BITS, - (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))); + DEBUG_PRINTP (TRACE_IO, ("About to write %04X to %04X\n", + ALL_FIXED_STS_BITS, + (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))); - AcpiCmAcquireMutex (ACPI_MTX_HARDWARE); + AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS, ALL_FIXED_STS_BITS); @@ -197,7 +197,7 @@ AcpiHwClearAcpiStatus (void) if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address)) { AcpiOsOut16 ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address), - (UINT16) ALL_FIXED_STS_BITS); + (UINT16) ALL_FIXED_STS_BITS); } /* now clear the GPE Bits */ @@ -208,8 +208,9 @@ AcpiHwClearAcpiStatus (void) for (Index = 0; Index < GpeLength; Index++) { - AcpiOsOut8 ((ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + Index), - (UINT8) 0xff); + AcpiOsOut8 ((ACPI_IO_ADDRESS) ( + ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) + Index), + (UINT8) 0xff); } } @@ -219,12 +220,13 @@ AcpiHwClearAcpiStatus (void) for (Index = 0; Index < GpeLength; Index++) { - AcpiOsOut8 ((ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + Index), - (UINT8) 0xff); + AcpiOsOut8 ((ACPI_IO_ADDRESS) ( + ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) + Index), + (UINT8) 0xff); } } - AcpiCmReleaseMutex (ACPI_MTX_HARDWARE); + AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); return_VOID; } @@ -289,7 +291,10 @@ AcpiHwObtainSleepTypeRegisterData ( * two elements */ - Status = AcpiCmResolvePackageReferences(ObjDesc); + /* Even though AcpiEvaluateObject resolves package references, + * NsEvaluate dpesn't. So, we do it here. + */ + Status = AcpiUtResolvePackageReferences(ObjDesc); if (ObjDesc->Package.Count < 2) { @@ -323,12 +328,11 @@ AcpiHwObtainSleepTypeRegisterData ( if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("SleepTypeRegisterData: Bad Sleep object %p type %X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Bad Sleep object %p type %X\n", ObjDesc, ObjDesc->Common.Type)); } - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } @@ -361,32 +365,33 @@ AcpiHwRegisterBitAccess ( UINT32 RegisterValue = 0; UINT32 Mask = 0; UINT32 Value = 0; + va_list marker; + FUNCTION_TRACE ("HwRegisterBitAccess"); if (ReadWrite == ACPI_WRITE) { - va_list marker; - va_start (marker, RegisterId); Value = va_arg (marker, UINT32); va_end (marker); } - if (ACPI_MTX_LOCK == UseLock) { - AcpiCmAcquireMutex (ACPI_MTX_HARDWARE); + if (ACPI_MTX_LOCK == UseLock) + { + AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); } /* * Decode the Register ID - * Register id = Register block id | bit id + * Register id = Register block id | bit id * * Check bit id to fine locate Register offset. - * check Mask to determine Register offset, and then read-write. + * Check Mask to determine Register offset, and then read-write. */ - switch (REGISTER_BLOCK_ID(RegisterId)) + switch (REGISTER_BLOCK_ID (RegisterId)) { case PM1_STS: @@ -442,8 +447,8 @@ AcpiHwRegisterBitAccess ( if (Value) { - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS, (UINT16) Value); - + AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, PM1_STS, + (UINT16) Value); RegisterValue = 0; } } @@ -552,8 +557,8 @@ AcpiHwRegisterBitAccess ( * because we need to do different things. Yuck. */ - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - RegisterId, (UINT16) RegisterValue); + AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId, + (UINT16) RegisterValue); } break; @@ -574,7 +579,7 @@ AcpiHwRegisterBitAccess ( RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM2_CONTROL); DEBUG_PRINT (TRACE_IO, ("PM2 control: Read %X from %p\n", - RegisterValue, ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))); + RegisterValue, ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))); if (ReadWrite == ACPI_WRITE) { @@ -583,8 +588,7 @@ AcpiHwRegisterBitAccess ( Value &= Mask; RegisterValue |= Value; - DEBUG_PRINT (TRACE_IO, - ("About to write %04X to %p\n", RegisterValue, + DEBUG_PRINT (TRACE_IO, ("About to write %04X to %p\n", RegisterValue, AcpiGbl_FADT->XPm2CntBlk.Address)); AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, @@ -599,7 +603,7 @@ AcpiHwRegisterBitAccess ( RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, PM_TIMER); DEBUG_PRINT (TRACE_IO, ("PM_TIMER: Read %X from %p\n", - RegisterValue, ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))); + RegisterValue, ACPI_GET_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))); break; @@ -641,7 +645,7 @@ AcpiHwRegisterBitAccess ( RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, RegisterId); DEBUG_PRINT (TRACE_IO, ("GPE Enable bits: Read %X from %X\n", - RegisterValue, RegisterId)); + RegisterValue, RegisterId)); if (ReadWrite == ACPI_WRITE) { @@ -654,17 +658,19 @@ AcpiHwRegisterBitAccess ( /* Enable Register indexed by the value in Mask */ DEBUG_PRINT (TRACE_IO, ("About to write %04X to %04X\n", - RegisterValue, RegisterId)); - AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, - RegisterId, (UINT8) RegisterValue); - RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, RegisterId); + RegisterValue, RegisterId)); + AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, RegisterId, + (UINT8) RegisterValue); + RegisterValue = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, + RegisterId); } break; case SMI_CMD_BLOCK: case PROCESSOR_BLOCK: - /* not used */ + /* Not used by any callers at this time - therefore, not implemented */ + default: Mask = 0; @@ -672,7 +678,7 @@ AcpiHwRegisterBitAccess ( } if (ACPI_MTX_LOCK == UseLock) { - AcpiCmReleaseMutex (ACPI_MTX_HARDWARE); + AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); } @@ -706,11 +712,13 @@ AcpiHwRegisterRead ( UINT32 Value = 0; UINT32 BankOffset; + FUNCTION_TRACE ("AcpiHwRegisterRead"); + if (ACPI_MTX_LOCK == UseLock) { - AcpiCmAcquireMutex (ACPI_MTX_HARDWARE); + AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); } @@ -790,7 +798,7 @@ AcpiHwRegisterRead ( if (ACPI_MTX_LOCK == UseLock) { - AcpiCmReleaseMutex (ACPI_MTX_HARDWARE); + AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); } return_VALUE (Value); @@ -824,7 +832,7 @@ AcpiHwRegisterWrite ( if (ACPI_MTX_LOCK == UseLock) { - AcpiCmAcquireMutex (ACPI_MTX_HARDWARE); + AcpiUtAcquireMutex (ACPI_MTX_HARDWARE); } @@ -907,7 +915,7 @@ AcpiHwRegisterWrite ( /* For 2.0, SMI_CMD is always in IO space */ /* TBD: what about 1.0? 0.71? */ - AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, (UINT8) Value); + AcpiOsOut8 (AcpiGbl_FADT->SmiCmd, (UINT8) Value); break; @@ -919,7 +927,7 @@ AcpiHwRegisterWrite ( if (ACPI_MTX_LOCK == UseLock) { - AcpiCmReleaseMutex (ACPI_MTX_HARDWARE); + AcpiUtReleaseMutex (ACPI_MTX_HARDWARE); } return_VOID; @@ -943,7 +951,7 @@ AcpiHwRegisterWrite ( UINT32 AcpiHwLowLevelRead ( UINT32 Width, - ACPI_GAS *Reg, + ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset) { UINT32 Value = 0; @@ -971,7 +979,7 @@ AcpiHwLowLevelRead ( switch (Reg->AddressSpaceId) { - case ADDRESS_SPACE_SYSTEM_MEMORY: + case ACPI_ADR_SPACE_SYSTEM_MEMORY: MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); @@ -990,7 +998,7 @@ AcpiHwLowLevelRead ( break; - case ADDRESS_SPACE_SYSTEM_IO: + case ACPI_ADR_SPACE_SYSTEM_IO: IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); @@ -1009,7 +1017,7 @@ AcpiHwLowLevelRead ( break; - case ADDRESS_SPACE_PCI_CONFIG: + case ACPI_ADR_SPACE_PCI_CONFIG: PciDevFunc = ACPI_PCI_DEVFUN (ACPI_GET_ADDRESS (Reg->Address)); PciRegister = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset; @@ -1053,7 +1061,7 @@ void AcpiHwLowLevelWrite ( UINT32 Width, UINT32 Value, - ACPI_GAS *Reg, + ACPI_GENERIC_ADDRESS *Reg, UINT32 Offset) { ACPI_PHYSICAL_ADDRESS MemAddress; @@ -1080,7 +1088,7 @@ AcpiHwLowLevelWrite ( switch (Reg->AddressSpaceId) { - case ADDRESS_SPACE_SYSTEM_MEMORY: + case ACPI_ADR_SPACE_SYSTEM_MEMORY: MemAddress = (ACPI_PHYSICAL_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); @@ -1099,7 +1107,7 @@ AcpiHwLowLevelWrite ( break; - case ADDRESS_SPACE_SYSTEM_IO: + case ACPI_ADR_SPACE_SYSTEM_IO: IoAddress = (ACPI_IO_ADDRESS) (ACPI_GET_ADDRESS (Reg->Address) + Offset); @@ -1118,7 +1126,7 @@ AcpiHwLowLevelWrite ( break; - case ADDRESS_SPACE_PCI_CONFIG: + case ACPI_ADR_SPACE_PCI_CONFIG: PciDevFunc = ACPI_PCI_DEVFUN (ACPI_GET_ADDRESS (Reg->Address)); PciRegister = ACPI_PCI_REGISTER (ACPI_GET_ADDRESS (Reg->Address)) + Offset; diff --git a/sys/contrib/dev/acpica/hwsleep.c b/sys/contrib/dev/acpica/hwsleep.c index ba7b341..0b29ce0 100644 --- a/sys/contrib/dev/acpica/hwsleep.c +++ b/sys/contrib/dev/acpica/hwsleep.c @@ -2,7 +2,7 @@ /****************************************************************************** * * Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface - * $Revision: 7 $ + * $Revision: 11 $ * *****************************************************************************/ @@ -119,7 +119,7 @@ #include "acnamesp.h" #include "achware.h" -#define _COMPONENT HARDWARE +#define _COMPONENT ACPI_HARDWARE MODULE_NAME ("hwsleep") @@ -228,30 +228,32 @@ AcpiGetFirmwareWakingVector ( ACPI_STATUS AcpiEnterSleepState ( - UINT8 SleepState) + UINT8 SleepState) { - ACPI_STATUS Status; - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg; - UINT8 TypeA; - UINT8 TypeB; - UINT16 PM1AControl; - UINT16 PM1BControl; + ACPI_STATUS Status; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg; + UINT8 TypeA; + UINT8 TypeB; + UINT16 PM1AControl; + UINT16 PM1BControl; + FUNCTION_TRACE ("AcpiEnterSleepState"); - + + /* * _PSW methods could be run here to enable wake-on keyboard, LAN, etc. */ - Status = AcpiHwObtainSleepTypeRegisterData(SleepState, &TypeA, &TypeB); - - if (!ACPI_SUCCESS(Status)) + Status = AcpiHwObtainSleepTypeRegisterData (SleepState, &TypeA, &TypeB); + if (!ACPI_SUCCESS (Status)) { return Status; } /* run the _PTS and _GTS methods */ + MEMSET(&ArgList, 0, sizeof(ArgList)); ArgList.Count = 1; ArgList.Pointer = &Arg; @@ -262,21 +264,25 @@ AcpiEnterSleepState ( AcpiEvaluateObject(NULL, "\\_PTS", &ArgList, NULL); AcpiEvaluateObject(NULL, "\\_GTS", &ArgList, NULL); - + /* clear wake status */ + AcpiHwRegisterBitAccess(ACPI_WRITE, ACPI_MTX_LOCK, WAK_STS, 1); PM1AControl = (UINT16) AcpiHwRegisterRead(ACPI_MTX_LOCK, PM1_CONTROL); /* mask off SLP_EN and SLP_TYP fields */ + PM1AControl &= 0xC3FF; - + /* mask in SLP_EN */ + PM1AControl |= (1 << AcpiHwGetBitShift (SLP_EN_MASK)); - + PM1BControl = PM1AControl; /* mask in SLP_TYP */ + PM1AControl |= (TypeA << AcpiHwGetBitShift (SLP_TYPE_X_MASK)); PM1BControl |= (TypeB << AcpiHwGetBitShift (SLP_TYPE_X_MASK)); @@ -286,8 +292,10 @@ AcpiEnterSleepState ( AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1A_CONTROL, PM1AControl); AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1B_CONTROL, PM1BControl); - AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1_CONTROL, - (1 << AcpiHwGetBitShift (SLP_EN_MASK))); + + /* one system won't work with this, one won't work without */ + /*AcpiHwRegisterWrite(ACPI_MTX_LOCK, PM1_CONTROL, + (1 << AcpiHwGetBitShift (SLP_EN_MASK)));*/ enable(); diff --git a/sys/contrib/dev/acpica/hwtimer.c b/sys/contrib/dev/acpica/hwtimer.c index 52139ed..fbe61d4 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: 5 $ + * $Revision: 9 $ * *****************************************************************************/ @@ -118,7 +118,7 @@ #include "acpi.h" #include "achware.h" -#define _COMPONENT HARDWARE +#define _COMPONENT ACPI_HARDWARE MODULE_NAME ("hwtimer") @@ -138,8 +138,19 @@ ACPI_STATUS AcpiGetTimerResolution ( UINT32 *Resolution) { + ACPI_STATUS Status; + FUNCTION_TRACE ("AcpiGetTimerResolution"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (!Resolution) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -174,8 +185,19 @@ ACPI_STATUS AcpiGetTimer ( UINT32 *Ticks) { + ACPI_STATUS Status; + FUNCTION_TRACE ("AcpiGetTimer"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (!Ticks) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -195,20 +217,20 @@ AcpiGetTimer ( * EndTicks * TimeElapsed * - * RETURN: TimeElapsed + * RETURN: TimeElapsed * * DESCRIPTION: Computes the time elapsed (in microseconds) between two * PM Timer time stamps, taking into account the possibility of - * rollovers, the timer resolution, and timer frequency. - * - * The PM Timer's clock ticks at roughly 3.6 times per + * rollovers, the timer resolution, and timer frequency. + * + * The PM Timer's clock ticks at roughly 3.6 times per * _microsecond_, and its clock continues through Cx state * transitions (unlike many CPU timestamp counters) -- making it * a versatile and accurate timer. * - * Note that this function accomodates only a single timer + * Note that this function accomodates only a single timer * rollover. Thus for 24-bit timers, this function should only - * be used for calculating durations less than ~4.6 seconds + * be used for calculating durations less than ~4.6 seconds * (~20 hours for 32-bit timers). * ******************************************************************************/ @@ -227,12 +249,12 @@ AcpiGetTimerDuration ( FUNCTION_TRACE ("AcpiGetTimerDuration"); - if (!TimeElapsed) + if (!TimeElapsed) { return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* + /* * Compute Tick Delta: * ------------------- * Handle (max one) timer rollovers on 24- versus 32-bit timers. @@ -241,7 +263,7 @@ AcpiGetTimerDuration ( { DeltaTicks = EndTicks - StartTicks; } - else if (StartTicks > EndTicks) + else if (StartTicks > EndTicks) { /* 24-bit Timer */ if (0 == AcpiGbl_FADT->TmrValExt) @@ -249,7 +271,7 @@ AcpiGetTimerDuration ( DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF); } /* 32-bit Timer */ - else + else { DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks; } @@ -260,17 +282,17 @@ AcpiGetTimerDuration ( return_ACPI_STATUS (AE_OK); } - /* + /* * Compute Duration: * ----------------- - * Since certain compilers (gcc/Linux, argh!) don't support 64-bit - * divides in kernel-space we have to do some trickery to preserve + * Since certain compilers (gcc/Linux, argh!) don't support 64-bit + * divides in kernel-space we have to do some trickery to preserve * accuracy while using 32-bit math. * - * TODO: Change to use 64-bit math when supported. - * + * TBD: Change to use 64-bit math when supported. + * * The process is as follows: - * 1. Compute the number of seconds by dividing Delta Ticks by + * 1. Compute the number of seconds by dividing Delta Ticks by * the timer frequency. * 2. Compute the number of milliseconds in the remainder from step #1 * by multiplying by 1000 and then dividing by the timer frequency. @@ -278,7 +300,7 @@ AcpiGetTimerDuration ( * by multiplying by 1000 and then dividing by the timer frequency. * 4. Add the results from steps 1, 2, and 3 to get the total duration. * - * Example: The time elapsed for DeltaTicks = 0xFFFFFFFF should be + * Example: The time elapsed for DeltaTicks = 0xFFFFFFFF should be * 1199864031 microseconds. This is computed as follows: * Step #1: Seconds = 1199; Remainder = 3092840 * Step #2: Milliseconds = 864; Remainder = 113120 diff --git a/sys/contrib/dev/acpica/nsaccess.c b/sys/contrib/dev/acpica/nsaccess.c index 47e7785..965ee3a 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: 119 $ + * $Revision: 126 $ * ******************************************************************************/ @@ -123,7 +123,7 @@ #include "acdispat.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsaccess") @@ -153,7 +153,7 @@ AcpiNsRootInitialize (void) FUNCTION_TRACE ("NsRootInitialize"); - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* * The global root ptr is initially NULL, so a non-NULL value indicates @@ -177,21 +177,19 @@ AcpiNsRootInitialize (void) /* Enter the pre-defined names in the name table */ - DEBUG_PRINT (ACPI_INFO, - ("Entering predefined name table entries into namespace\n")); + DEBUG_PRINTP (ACPI_INFO, ("Entering predefined entries into namespace\n")); for (InitVal = AcpiGbl_PreDefinedNames; InitVal->Name; InitVal++) { - Status = AcpiNsLookup (NULL, InitVal->Name, - (OBJECT_TYPE_INTERNAL) InitVal->Type, + Status = AcpiNsLookup (NULL, InitVal->Name, InitVal->Type, IMODE_LOAD_PASS2, NS_NO_UPSEARCH, NULL, &NewNode); if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */ { - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Could not create predefined name %s, %s\n", - InitVal->Name, AcpiCmFormatException (Status))); + InitVal->Name, AcpiUtFormatException (Status))); } /* @@ -207,9 +205,7 @@ AcpiNsRootInitialize (void) * descriptor for it. */ - ObjDesc = AcpiCmCreateInternalObject ( - (OBJECT_TYPE_INTERNAL) InitVal->Type); - + ObjDesc = AcpiUtCreateInternalObject (InitVal->Type); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -234,19 +230,18 @@ AcpiNsRootInitialize (void) case ACPI_TYPE_STRING: - ObjDesc->String.Length = - (UINT16) STRLEN (InitVal->Val); + ObjDesc->String.Length = STRLEN (InitVal->Val); /* * Allocate a buffer for the string. All * String.Pointers must be allocated buffers! * (makes deletion simpler) */ - ObjDesc->String.Pointer = AcpiCmAllocate ( + ObjDesc->String.Pointer = AcpiUtAllocate ( (ObjDesc->String.Length + 1)); if (!ObjDesc->String.Pointer) { - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); Status = AE_NO_MEMORY; goto UnlockAndExit; } @@ -258,7 +253,7 @@ AcpiNsRootInitialize (void) case ACPI_TYPE_MUTEX: ObjDesc->Mutex.SyncLevel = - (UINT16) STRTOUL (InitVal->Val, NULL, 10); + (UINT16) STRTOUL (InitVal->Val, NULL, 10); if (STRCMP (InitVal->Name, "_GL_") == 0) { @@ -299,21 +294,20 @@ AcpiNsRootInitialize (void) default: REPORT_ERROR (("Unsupported initial type value %X\n", InitVal->Type)); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); ObjDesc = NULL; continue; } /* Store pointer to value descriptor in the Node */ - AcpiNsAttachObject (NewNode, ObjDesc, - ObjDesc->Common.Type); + AcpiNsAttachObject (NewNode, ObjDesc, ObjDesc->Common.Type); } } UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } @@ -345,7 +339,7 @@ ACPI_STATUS AcpiNsLookup ( ACPI_GENERIC_STATE *ScopeInfo, NATIVE_CHAR *Pathname, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, OPERATING_MODE InterpreterMode, UINT32 Flags, ACPI_WALK_STATE *WalkState, @@ -359,8 +353,8 @@ AcpiNsLookup ( UINT32 NumSegments; ACPI_NAME SimpleName; BOOLEAN NullNamePath = FALSE; - OBJECT_TYPE_INTERNAL TypeToCheckFor; - OBJECT_TYPE_INTERNAL ThisSearchType; + ACPI_OBJECT_TYPE8 TypeToCheckFor; + ACPI_OBJECT_TYPE8 ThisSearchType; UINT32 LocalFlags = Flags & ~NS_ERROR_IF_FOUND; DEBUG_EXEC (UINT32 i;) @@ -393,8 +387,8 @@ AcpiNsLookup ( if ((!ScopeInfo) || (!ScopeInfo->Scope.Node)) { - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Null scope prefix, using root node (%p)\n", AcpiGbl_RootNode)); + DEBUG_PRINTP (TRACE_NAMES, ("Null scope prefix, using root node (%p)\n", + AcpiGbl_RootNode)); PrefixNode = AcpiGbl_RootNode; } @@ -405,14 +399,14 @@ AcpiNsLookup ( /* - * This check is explicitly split provide relax the TypeToCheckFor + * This check is explicitly split to relax the TypeToCheckFor * conditions for BankFieldDefn. Originally, both BankFieldDefn and * DefFieldDefn caused TypeToCheckFor to be set to ACPI_TYPE_REGION, * but the BankFieldDefn may also check for a Field definition as well * as an OperationRegion. */ - if (INTERNAL_TYPE_DEF_FIELD_DEFN == Type) + if (INTERNAL_TYPE_FIELD_DEFN == Type) { /* DefFieldDefn defines fields in a Region */ @@ -444,8 +438,8 @@ AcpiNsLookup ( NumSegments = 0; ThisNode = AcpiGbl_RootNode; - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Null Pathname (Zero segments), Flags=%x\n", Flags)); + DEBUG_PRINTP (TRACE_NAMES, + ("Null Pathname (Zero segments), Flags=%x\n", Flags)); } else @@ -479,8 +473,7 @@ AcpiNsLookup ( Pathname++; - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Searching from root [%p]\n", + DEBUG_PRINTP (TRACE_NAMES, ("Searching from root [%p]\n", CurrentNode)); /* Direct reference to root, "\" */ @@ -498,8 +491,7 @@ AcpiNsLookup ( CurrentNode = PrefixNode; - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Searching relative to pfx scope [%p]\n", + DEBUG_PRINTP (TRACE_NAMES, ("Searching relative to pfx scope [%p]\n", PrefixNode)); /* @@ -520,7 +512,8 @@ AcpiNsLookup ( { /* Current scope has no parent scope */ - REPORT_ERROR (("Too many parent prefixes (^) - reached root\n")); + REPORT_ERROR ( + ("Too many parent prefixes (^) - reached root\n")); return_ACPI_STATUS (AE_NOT_FOUND); } @@ -542,8 +535,8 @@ AcpiNsLookup ( Pathname++; - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Dual Pathname (2 segments, Flags=%X)\n", Flags)); + DEBUG_PRINTP (TRACE_NAMES, + ("Dual Pathname (2 segments, Flags=%X)\n", Flags)); } else if (*Pathname == AML_MULTI_NAME_PREFIX_OP) @@ -554,8 +547,8 @@ AcpiNsLookup ( Pathname++; - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Multi Pathname (%d Segments, Flags=%X) \n", + DEBUG_PRINTP (TRACE_NAMES, + ("Multi Pathname (%d Segments, Flags=%X) \n", NumSegments, Flags)); } @@ -567,8 +560,8 @@ AcpiNsLookup ( */ NumSegments = 1; - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Simple Pathname (1 segment, Flags=%X)\n", Flags)); + DEBUG_PRINTP (TRACE_NAMES, + ("Simple Pathname (1 segment, Flags=%X)\n", Flags)); } #ifdef ACPI_DEBUG @@ -577,7 +570,7 @@ AcpiNsLookup ( /* Debug only: print the entire name that we are about to lookup */ - DEBUG_PRINT (TRACE_NAMES, ("NsLookup: [")); + DEBUG_PRINTP (TRACE_NAMES, ("[")); for (i = 0; i < NumSegments; i++) { @@ -626,8 +619,8 @@ AcpiNsLookup ( { /* Name not found in ACPI namespace */ - DEBUG_PRINT (TRACE_NAMES, - ("NsLookup: Name [%4.4s] not found in scope %X\n", + DEBUG_PRINTP (TRACE_NAMES, + ("Name [%4.4s] not found in scope %X\n", &SimpleName, CurrentNode)); } @@ -683,8 +676,7 @@ AcpiNsLookup ( * and the next scope has not been allocated. */ - DEBUG_PRINT (ACPI_INFO, - ("NsLookup: Load mode=%X ThisNode=%X\n", + DEBUG_PRINTP (ACPI_INFO, ("Load mode=%X ThisNode=%X\n", InterpreterMode, ThisNode)); } @@ -731,8 +723,7 @@ CheckForNewScopeAndExit: return_ACPI_STATUS (Status); } - DEBUG_PRINT (ACPI_INFO, - ("NsLookup: Set global scope to %p\n", ScopeToPush)); + DEBUG_PRINTP (ACPI_INFO, ("Set global scope to %p\n", ScopeToPush)); } } diff --git a/sys/contrib/dev/acpica/nsalloc.c b/sys/contrib/dev/acpica/nsalloc.c index 3f90752..baeb2b5 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: 45 $ + * $Revision: 50 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "acinterp.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsalloc") @@ -147,7 +147,7 @@ AcpiNsCreateNode ( FUNCTION_TRACE ("NsCreateNode"); - Node = AcpiCmCallocate (sizeof (ACPI_NAMESPACE_NODE)); + Node = AcpiUtCallocate (sizeof (ACPI_NAMESPACE_NODE)); if (!Node) { return_PTR (NULL); @@ -222,7 +222,7 @@ AcpiNsDeleteNode ( AcpiNsDetachObject (Node); } - AcpiCmFree (Node); + AcpiUtFree (Node); return_VOID; @@ -249,7 +249,7 @@ AcpiNsInstallNode ( ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *ParentNode, /* Parent */ ACPI_NAMESPACE_NODE *Node, /* New Child*/ - OBJECT_TYPE_INTERNAL Type) + ACPI_OBJECT_TYPE8 Type) { UINT16 OwnerId = TABLE_ID_DSDT; ACPI_NAMESPACE_NODE *ChildNode; @@ -305,9 +305,8 @@ AcpiNsInstallNode ( * add the region in order to define fields in it, we * have a forward reference. */ - if ((ACPI_TYPE_ANY == Type) || - (INTERNAL_TYPE_DEF_FIELD_DEFN == Type) || + (INTERNAL_TYPE_FIELD_DEFN == Type) || (INTERNAL_TYPE_BANK_FIELD_DEFN == Type)) { /* @@ -315,19 +314,15 @@ AcpiNsInstallNode ( * We will fill in the actual type when the * real definition is found later. */ - - DEBUG_PRINT (ACPI_INFO, - ("NsInstallNode: [%4.4s] is a forward reference\n", + DEBUG_PRINTP (ACPI_INFO, ("[%4.4s] is a forward reference\n", &Node->Name)); - } /* * The DefFieldDefn and BankFieldDefn cases are actually * looking up the Region in which the field will be defined */ - - if ((INTERNAL_TYPE_DEF_FIELD_DEFN == Type) || + if ((INTERNAL_TYPE_FIELD_DEFN == Type) || (INTERNAL_TYPE_BANK_FIELD_DEFN == Type)) { Type = ACPI_TYPE_REGION; @@ -339,7 +334,6 @@ AcpiNsInstallNode ( * being looked up. Save any other value of Type as the type of * the entry. */ - if ((Type != INTERNAL_TYPE_SCOPE) && (Type != INTERNAL_TYPE_DEF_ANY) && (Type != INTERNAL_TYPE_INDEX_FIELD_DEFN)) @@ -347,15 +341,13 @@ AcpiNsInstallNode ( Node->Type = (UINT8) Type; } - DEBUG_PRINT (TRACE_NAMES, - ("NsInstallNode: %4.4s added to %p at %p\n", + DEBUG_PRINTP (TRACE_NAMES, ("%4.4s added to %p at %p\n", &Node->Name, ParentNode, Node)); /* * Increment the reference count(s) of all parents up to * the root! */ - while ((Node = AcpiNsGetParentObject (Node)) != NULL) { Node->ReferenceCount++; @@ -417,8 +409,7 @@ AcpiNsDeleteChildren ( if (ChildNode->Child) { - DEBUG_PRINT (ACPI_ERROR, - ("NsDeleteChildren: Found a grandchild! P=%X C=%X\n", + DEBUG_PRINTP (ACPI_ERROR, ("Found a grandchild! P=%X C=%X\n", ParentNode, ChildNode)); } @@ -426,8 +417,7 @@ AcpiNsDeleteChildren ( DECREMENT_NAME_TABLE_METRICS (sizeof (ACPI_NAMESPACE_NODE)); - DEBUG_PRINT (ACPI_INFO, - ("AcpiNsDeleteChildren: Object %p, Remaining %X\n", + DEBUG_PRINTP (ACPI_INFO, ("Object %p, Remaining %X\n", ChildNode, AcpiGbl_CurrentNodeCount)); /* @@ -439,7 +429,7 @@ AcpiNsDeleteChildren ( AcpiNsDetachObject (ChildNode); } - AcpiCmFree (ChildNode); + AcpiUtFree (ChildNode); /* And move on to the next child in the list */ @@ -515,7 +505,7 @@ AcpiNsDeleteNamespaceSubtree ( if (ObjDesc) { AcpiNsDetachObject (ChildNode); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } @@ -672,7 +662,7 @@ AcpiNsDeleteNamespaceByOwner ( if (ObjDesc) { AcpiNsDetachObject (ChildNode); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } } diff --git a/sys/contrib/dev/acpica/nsdump.c b/sys/contrib/dev/acpica/nsdump.c index eb907a3..9d7bbc5 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: 85 $ + * $Revision: 93 $ * *****************************************************************************/ @@ -123,13 +123,13 @@ #include "actables.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsdump") #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpPathname * @@ -141,7 +141,7 @@ * DESCRIPTION: Print an object's full namespace pathname * Manages allocation/freeing of a pathname buffer * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsDumpPathname ( @@ -163,7 +163,7 @@ AcpiNsDumpPathname ( return_ACPI_STATUS (AE_OK); } - Buffer = AcpiCmAllocate (PATHNAME_MAX); + Buffer = AcpiUtAllocate (PATHNAME_MAX); if (!Buffer) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -177,13 +177,13 @@ AcpiNsDumpPathname ( AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle); } - AcpiCmFree (Buffer); + AcpiUtFree (Buffer); return_ACPI_STATUS (AE_OK); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpOneObject * @@ -194,7 +194,7 @@ AcpiNsDumpPathname ( * DESCRIPTION: Dump a single Node * This procedure is a UserFunction called by AcpiNsWalkNamespace. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsDumpOneObject ( @@ -207,8 +207,8 @@ AcpiNsDumpOneObject ( ACPI_NAMESPACE_NODE *ThisNode; UINT8 *Value; ACPI_OPERAND_OBJECT *ObjDesc = NULL; - OBJECT_TYPE_INTERNAL ObjType; - OBJECT_TYPE_INTERNAL Type; + ACPI_OBJECT_TYPE8 ObjType; + ACPI_OBJECT_TYPE8 Type; UINT32 BytesToDump; UINT32 DownstreamSiblingMask = 0; UINT32 LevelTmp; @@ -229,7 +229,7 @@ AcpiNsDumpOneObject ( if (!ObjHandle) { - DEBUG_PRINT (ACPI_INFO, ("Null object handle\n")); + DEBUG_PRINT (ACPI_INFO, ("NsDumpOneObject: Null object handle\n")); return (AE_OK); } @@ -303,7 +303,7 @@ AcpiNsDumpOneObject ( Type = INTERNAL_TYPE_DEF_ANY; /* prints as *ERROR* */ } - if (!AcpiCmValidAcpiName (ThisNode->Name)) + if (!AcpiUtValidAcpiName (ThisNode->Name)) { REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name)); } @@ -312,7 +312,7 @@ AcpiNsDumpOneObject ( * Now we can print out the pertinent information */ - DEBUG_PRINT_RAW (TRACE_TABLES, (" %4.4s %-9s ", &ThisNode->Name, AcpiCmGetTypeName (Type))); + DEBUG_PRINT_RAW (TRACE_TABLES, (" %4.4s %-9s ", &ThisNode->Name, AcpiUtGetTypeName (Type))); DEBUG_PRINT_RAW (TRACE_TABLES, ("%p S:%p O:%p", ThisNode, ThisNode->Child, ThisNode->Object)); @@ -416,7 +416,7 @@ AcpiNsDumpOneObject ( else { DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type %X [%s])\n", - ObjType, AcpiCmGetTypeName (ObjType))); + ObjType, AcpiUtGetTypeName (ObjType))); BytesToDump = sizeof (ACPI_OPERAND_OBJECT); } } @@ -450,6 +450,10 @@ AcpiNsDumpOneObject ( Value = (UINT8 *) ObjDesc->Buffer.Pointer; break; + case ACPI_TYPE_BUFFER_FIELD: + Value = (UINT8 *) ObjDesc->BufferField.BufferObj; + break; + case ACPI_TYPE_PACKAGE: Value = (UINT8 *) ObjDesc->Package.Elements; break; @@ -458,20 +462,16 @@ AcpiNsDumpOneObject ( Value = (UINT8 *) ObjDesc->Method.Pcode; break; - case ACPI_TYPE_FIELD_UNIT: - Value = (UINT8 *) ObjDesc->FieldUnit.Container; - break; - - case INTERNAL_TYPE_DEF_FIELD: - Value = (UINT8 *) ObjDesc->Field.Container; + case INTERNAL_TYPE_REGION_FIELD: + Value = (UINT8 *) ObjDesc->Field.RegionObj; break; case INTERNAL_TYPE_BANK_FIELD: - Value = (UINT8 *) ObjDesc->BankField.Container; + Value = (UINT8 *) ObjDesc->BankField.RegionObj; break; case INTERNAL_TYPE_INDEX_FIELD: - Value = (UINT8 *) ObjDesc->IndexField.Index; + Value = (UINT8 *) ObjDesc->IndexField.IndexObj; break; default: @@ -487,7 +487,7 @@ Cleanup: } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpObjects * @@ -501,11 +501,11 @@ Cleanup: * DESCRIPTION: Dump typed objects within the loaded namespace. * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. * - ***************************************************************************/ + ******************************************************************************/ void AcpiNsDumpObjects ( - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, UINT32 MaxDepth, UINT32 OwnerId, ACPI_HANDLE StartHandle) @@ -522,7 +522,7 @@ AcpiNsDumpObjects ( #ifndef _ACPI_ASL_COMPILER -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpOneDevice * @@ -533,7 +533,7 @@ AcpiNsDumpObjects ( * DESCRIPTION: Dump a single Node that represents a device * This procedure is a UserFunction called by AcpiNsWalkNamespace. * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsDumpOneDevice ( @@ -565,7 +565,7 @@ AcpiNsDumpOneDevice ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpRootDevices * @@ -573,7 +573,7 @@ AcpiNsDumpOneDevice ( * * DESCRIPTION: Dump all objects of type "device" * - ***************************************************************************/ + ******************************************************************************/ void AcpiNsDumpRootDevices (void) @@ -597,7 +597,7 @@ AcpiNsDumpRootDevices (void) #endif -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpTables * @@ -608,7 +608,7 @@ AcpiNsDumpRootDevices (void) * * DESCRIPTION: Dump the name space, or a portion of it. * - ***************************************************************************/ + ******************************************************************************/ void AcpiNsDumpTables ( @@ -627,7 +627,7 @@ AcpiNsDumpTables ( * If the name space has not been initialized, * there is nothing to dump. */ - DEBUG_PRINT (TRACE_TABLES, ("NsDumpTables: name space not initialized!\n")); + DEBUG_PRINTP (TRACE_TABLES, ("name space not initialized!\n")); return_VOID; } @@ -645,7 +645,7 @@ AcpiNsDumpTables ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDumpEntry * @@ -654,7 +654,7 @@ AcpiNsDumpTables ( * * DESCRIPTION: Dump a single Node * - ***************************************************************************/ + ******************************************************************************/ void AcpiNsDumpEntry ( @@ -671,7 +671,6 @@ AcpiNsDumpEntry ( AcpiNsDumpOneObject (Handle, 1, &Info, NULL); - DEBUG_PRINT (TRACE_EXEC, ("leave AcpiNsDumpEntry %p\n", Handle)); return_VOID; } diff --git a/sys/contrib/dev/acpica/nseval.c b/sys/contrib/dev/acpica/nseval.c index 5c34853..e4a35d6 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: 83 $ + * $Revision: 91 $ * ******************************************************************************/ @@ -125,7 +125,7 @@ #include "acnamesp.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nseval") @@ -186,12 +186,12 @@ AcpiNsEvaluateRelative ( /* Get the prefix handle and Node */ - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); PrefixNode = AcpiNsConvertHandleToEntry (Handle); if (!PrefixNode) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); Status = AE_BAD_PARAMETER; goto Cleanup; } @@ -203,13 +203,12 @@ AcpiNsEvaluateRelative ( IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, &Node); - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateRelative: Object [%s] not found [%.4X]\n", - Pathname, AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_INFO, ("Object [%s] not found [%s]\n", + Pathname, AcpiUtFormatException (Status))); goto Cleanup; } @@ -218,22 +217,17 @@ AcpiNsEvaluateRelative ( * to evaluate it. */ - DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateRelative: %s [%p] Value %p\n", + DEBUG_PRINTP (ACPI_INFO, ("%s [%p] Value %p\n", Pathname, Node, Node->Object)); Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); - DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateRelative: *** Completed eval of object %s ***\n", + DEBUG_PRINTP (ACPI_INFO, ("*** Completed eval of object %s ***\n", Pathname)); Cleanup: - /* Cleanup */ - - AcpiCmFree (InternalPath); - + AcpiUtFree (InternalPath); return_ACPI_STATUS (Status); } @@ -280,7 +274,7 @@ AcpiNsEvaluateByName ( return_ACPI_STATUS (Status); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Lookup the name in the namespace */ @@ -288,12 +282,11 @@ AcpiNsEvaluateByName ( IMODE_EXECUTE, NS_NO_UPSEARCH, NULL, &Node); - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateByName: Object at [%s] was not found, status=%.4X\n", + DEBUG_PRINTP (ACPI_INFO, ("Object at [%s] was not found, status=%.4X\n", Pathname, Status)); goto Cleanup; } @@ -303,14 +296,12 @@ AcpiNsEvaluateByName ( * to evaluate it. */ - DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateByName: %s [%p] Value %p\n", + DEBUG_PRINTP (ACPI_INFO, ("%s [%p] Value %p\n", Pathname, Node, Node->Object)); Status = AcpiNsEvaluateByHandle (Node, Params, ReturnObject); - DEBUG_PRINT (ACPI_INFO, - ("NsEvaluateByName: *** Completed eval of object %s ***\n", + DEBUG_PRINTP (ACPI_INFO, ("*** Completed eval of object %s ***\n", Pathname)); @@ -320,7 +311,7 @@ Cleanup: if (InternalPath) { - AcpiCmFree (InternalPath); + AcpiUtFree (InternalPath); } return_ACPI_STATUS (Status); @@ -383,12 +374,12 @@ AcpiNsEvaluateByHandle ( /* Get the prefix handle and Node */ - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Node = AcpiNsConvertHandleToEntry (Handle); if (!Node) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -491,41 +482,40 @@ AcpiNsExecuteControlMethod ( FUNCTION_TRACE ("NsExecuteControlMethod"); - /* - * Unlock the namespace before execution. This allows namespace access - * via the external Acpi* interfaces while a method is being executed. - * However, any namespace deletion must acquire both the namespace and - * interpreter locks to ensure that no thread is using the portion of the - * namespace that is being deleted. - */ - - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); - /* Verify that there is a method associated with this object */ - ObjDesc = AcpiNsGetAttachedObject ((ACPI_HANDLE) MethodNode); + ObjDesc = AcpiNsGetAttachedObject (MethodNode); if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("Control method is undefined (nil value)\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No attached method object\n")); + + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (AE_ERROR); } - DEBUG_PRINT (ACPI_INFO, ("Control method at Offset %x Length %lx]\n", - ObjDesc->Method.Pcode + 1, - ObjDesc->Method.PcodeLength - 1)); + DEBUG_PRINTP (ACPI_INFO, ("Control method at Offset %x Length %lx]\n", + ObjDesc->Method.Pcode + 1, ObjDesc->Method.PcodeLength - 1)); DUMP_PATHNAME (MethodNode, "NsExecuteControlMethod: Executing", - TRACE_NAMES, _COMPONENT); + TRACE_NAMES, _COMPONENT); + + DEBUG_PRINTP (TRACE_NAMES, ("At offset %8XH\n", ObjDesc->Method.Pcode + 1)); - DEBUG_PRINT (TRACE_NAMES, - ("At offset %8XH\n", ObjDesc->Method.Pcode + 1)); + + /* + * Unlock the namespace before execution. This allows namespace access + * via the external Acpi* interfaces while a method is being executed. + * However, any namespace deletion must acquire both the namespace and + * interpreter locks to ensure that no thread is using the portion of the + * namespace that is being deleted. + */ + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); /* * Execute the method via the interpreter */ - Status = AcpiAmlExecuteMethod (MethodNode, Params, ReturnObjDesc); + Status = AcpiExExecuteMethod (MethodNode, Params, ReturnObjDesc); return_ACPI_STATUS (Status); } @@ -568,7 +558,7 @@ AcpiNsGetObjectValue ( /* * Create a Reference object to contain the object */ - ObjDesc = AcpiCmCreateInternalObject (Node->Type); + ObjDesc = AcpiUtCreateInternalObject (Node->Type); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -595,6 +585,7 @@ AcpiNsGetObjectValue ( MEMCPY (ObjDesc, ValDesc, sizeof (ACPI_OPERAND_OBJECT)); ObjDesc->Common.ReferenceCount = 1; + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } @@ -606,7 +597,7 @@ AcpiNsGetObjectValue ( { /* Create an Reference object to contain the object */ - ObjDesc = AcpiCmCreateInternalObject (INTERNAL_TYPE_REFERENCE); + ObjDesc = AcpiUtCreateInternalObject (INTERNAL_TYPE_REFERENCE); if (!ObjDesc) { Status = AE_NO_MEMORY; @@ -615,32 +606,38 @@ AcpiNsGetObjectValue ( /* Construct a descriptor pointing to the name */ - ObjDesc->Reference.OpCode = (UINT8) AML_NAME_OP; + ObjDesc->Reference.Opcode = (UINT8) AML_NAME_OP; ObjDesc->Reference.Object = (void *) Node; /* - * Use AcpiAmlResolveToValue() to get the associated value. - * The call to AcpiAmlResolveToValue causes - * ObjDesc (allocated above) to always be deleted. + * Use ResolveToValue() to get the associated value. This call + * always deletes ObjDesc (allocated above). * * NOTE: we can get away with passing in NULL for a walk state * because ObjDesc is guaranteed to not be a reference to either * a method local or a method argument * - * Even though we do not technically need to use the interpreter - * for this, we must enter it because we could hit an opregion. - * The opregion access code assumes it is in the interpreter. + * Even though we do not directly invoke the interpreter + * for this, we must enter it because we could access an opregion. + * The opregion access code assumes that the interpreter + * is locked. + * + * We must release the namespace lock before entering the + * intepreter. */ - AcpiAmlEnterInterpreter(); - - Status = AcpiAmlResolveToValue (&ObjDesc, NULL); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + Status = AcpiExEnterInterpreter (); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiExResolveToValue (&ObjDesc, NULL); - AcpiAmlExitInterpreter(); + AcpiExExitInterpreter (); + } } /* - * If AcpiAmlResolveToValue() succeeded, the return value was + * If AcpiExResolveToValue() succeeded, the return value was * placed in ObjDesc. */ @@ -649,15 +646,18 @@ AcpiNsGetObjectValue ( Status = AE_CTRL_RETURN_VALUE; *ReturnObjDesc = ObjDesc; - DEBUG_PRINT (ACPI_INFO, - ("NsGetObjectValue: Returning obj %p\n", *ReturnObjDesc)); + DEBUG_PRINTP (ACPI_INFO, ("Returning obj %p\n", *ReturnObjDesc)); } + /* Namespace is unlocked */ + + return_ACPI_STATUS (Status); + UnlockAndExit: /* Unlock the namespace */ - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/nsinit.c b/sys/contrib/dev/acpica/nsinit.c index 672bbeb..3286d69 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: 15 $ + * $Revision: 25 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "acnamesp.h" #include "acdispat.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsinit") @@ -149,8 +149,8 @@ AcpiNsInitializeObjects ( FUNCTION_TRACE ("NsInitializeObjects"); - DEBUG_PRINT (TRACE_DISPATCH, - ("NsInitializeObjects: **** Starting initialization of namespace objects ****\n")); + DEBUG_PRINTP (TRACE_DISPATCH, + ("**** Starting initialization of namespace objects ****\n")); DEBUG_PRINT_RAW (ACPI_OK, ("Completing Region and Field initialization:")); @@ -168,23 +168,23 @@ AcpiNsInitializeObjects ( &Info, NULL); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("NsInitializeObjects: WalkNamespace failed! %x\n", Status)); + DEBUG_PRINTP (ACPI_ERROR, ("WalkNamespace failed! %x\n", Status)); } DEBUG_PRINT_RAW (ACPI_OK, ("\n%d/%d Regions, %d/%d Fields initialized (%d nodes total)\n", - Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit, Info.FieldCount, Info.ObjectCount)); - DEBUG_PRINT (TRACE_DISPATCH, - ("NsInitializeObjects: %d Control Methods found\n", Info.MethodCount)); - DEBUG_PRINT (TRACE_DISPATCH, - ("NsInitializeObjects: %d Op Regions found\n", Info.OpRegionCount)); + Info.OpRegionInit, Info.OpRegionCount, Info.FieldInit, + Info.FieldCount, Info.ObjectCount)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("%d Control Methods found\n", Info.MethodCount)); + DEBUG_PRINTP (TRACE_DISPATCH, + ("%d Op Regions found\n", Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsInitializeDevices * @@ -195,11 +195,10 @@ AcpiNsInitializeObjects ( * DESCRIPTION: Walk the entire namespace and initialize all ACPI devices. * This means running _INI on all present devices. * - * Also: Install PCI config space handler for all PCI root bridges. - * A PCI root bridge is found by searching for devices containing - * a HID with the value EISAID("PNP0A03") + * Note: We install PCI config space handler on region access, + * not here. * - *****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsInitializeDevices ( @@ -219,13 +218,12 @@ AcpiNsInitializeDevices ( DEBUG_PRINT_RAW (ACPI_OK, ("Executing device _INI methods:")); - Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, - FALSE, AcpiNsInitOneDevice, &Info, NULL); + Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, + ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("NsInitializeDevices: WalkNamespace failed! %x\n", Status)); + DEBUG_PRINTP (ACPI_ERROR, ("WalkNamespace failed! %x\n", Status)); } @@ -264,7 +262,7 @@ AcpiNsInitOneObject ( void *Context, void **ReturnValue) { - OBJECT_TYPE_INTERNAL Type; + ACPI_OBJECT_TYPE8 Type; ACPI_STATUS Status; ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; @@ -299,8 +297,9 @@ AcpiNsInitOneObject ( if (ACPI_FAILURE (Status)) { DEBUG_PRINT_RAW (ACPI_ERROR, ("\n")); - DEBUG_PRINT (ACPI_ERROR, ("%s while getting region arguments [%4.4s]\n", - AcpiCmFormatException (Status), &Node->Name)); + DEBUG_PRINT (ACPI_ERROR, + ("%s while getting region arguments [%4.4s]\n", + AcpiUtFormatException (Status), &Node->Name)); } if (!(AcpiDbgLevel & TRACE_INIT)) @@ -311,7 +310,7 @@ AcpiNsInitOneObject ( break; - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: Info->FieldCount++; if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) @@ -320,12 +319,13 @@ AcpiNsInitOneObject ( } Info->FieldInit++; - Status = AcpiDsGetFieldUnitArguments (ObjDesc); + Status = AcpiDsGetBufferFieldArguments (ObjDesc); if (ACPI_FAILURE (Status)) { DEBUG_PRINT_RAW (ACPI_ERROR, ("\n")); - DEBUG_PRINT (ACPI_ERROR, ("%s while getting field arguments [%4.4s]\n", - AcpiCmFormatException (Status), &Node->Name)); + DEBUG_PRINT (ACPI_ERROR, + ("%s while getting buffer field arguments [%4.4s]\n", + AcpiUtFormatException (Status), &Node->Name)); } if (!(AcpiDbgLevel & TRACE_INIT)) { @@ -347,11 +347,11 @@ AcpiNsInitOneObject ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsInitOneDevice * - * PARAMETERS: WALK_CALLBACK + * PARAMETERS: ACPI_WALK_CALLBACK * * RETURN: ACPI_STATUS * @@ -359,7 +359,7 @@ AcpiNsInitOneObject ( * to initialize each device. It determines if the device is * present, and if so, calls _INI. * - *****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsInitOneDevice ( @@ -384,23 +384,23 @@ AcpiNsInitOneDevice ( Info->DeviceCount++; - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Node = AcpiNsConvertHandleToEntry (ObjHandle); if (!Node) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); /* * Run _STA to determine if we can run _INI on the device. */ - DEBUG_EXEC(AcpiCmDisplayInitPathname (Node, "_STA [Method]")); - Status = AcpiCmExecute_STA (Node, &Flags); + DEBUG_EXEC (AcpiUtDisplayInitPathname (Node, "_STA [Method]")); + Status = AcpiUtExecute_STA (Node, &Flags); if (ACPI_FAILURE (Status)) { /* Ignore error and move on to next device */ @@ -413,20 +413,20 @@ AcpiNsInitOneDevice ( if (!(Flags & 0x01)) { /* don't look at children of a not present device */ + return_ACPI_STATUS(AE_CTRL_DEPTH); } - /* * The device is present. Run _INI. */ - - DEBUG_EXEC(AcpiCmDisplayInitPathname (ObjHandle, "_INI [Method]")); + DEBUG_EXEC (AcpiUtDisplayInitPathname (ObjHandle, "_INI [Method]")); Status = AcpiNsEvaluateRelative (ObjHandle, "_INI", NULL, NULL); if (AE_NOT_FOUND == Status) { /* No _INI means device requires no initialization */ + Status = AE_OK; } @@ -437,16 +437,16 @@ AcpiNsInitOneDevice ( #ifdef ACPI_DEBUG NATIVE_CHAR *ScopeName = AcpiNsGetTablePathname (ObjHandle); - DEBUG_PRINT (ACPI_WARN, ("%s._INI failed: %s\n", - ScopeName, AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_WARN, ("%s._INI failed: %s\n", + ScopeName, AcpiUtFormatException (Status))); - AcpiCmFree (ScopeName); + AcpiUtFree (ScopeName); #endif } else { - /* Count of successfull INIs */ + /* Count of successful INIs */ Info->Num_INI++; } diff --git a/sys/contrib/dev/acpica/nsload.c b/sys/contrib/dev/acpica/nsload.c index 2b49884..762509b 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: 35 $ + * $Revision: 41 $ * *****************************************************************************/ @@ -125,11 +125,11 @@ #include "acdebug.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsload") -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiLoadNamespace * @@ -156,7 +156,7 @@ AcpiNsLoadNamespace ( if (AcpiGbl_DSDT == NULL) { - DEBUG_PRINT (ACPI_ERROR, ("DSDT is not in memory\n")); + DEBUG_PRINTP (ACPI_ERROR, ("DSDT is not in memory\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } @@ -247,19 +247,15 @@ AcpiNsOneCompleteParse ( /* Pass 1: Parse everything except control method bodies */ - DEBUG_PRINT (TRACE_PARSE, - ("NsParseTable: *PARSE* pass %d parse\n", PassNumber)); + DEBUG_PRINTP (TRACE_PARSE, ("*PARSE* pass %d parse\n", PassNumber)); - Status = AcpiPsParseAml (ParseRoot, - TableDesc->AmlPointer, + Status = AcpiPsParseAml (ParseRoot, TableDesc->AmlPointer, TableDesc->AmlLength, ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE, - NULL, NULL, NULL, - DescendingCallback, + NULL, NULL, NULL, DescendingCallback, AscendingCallback); AcpiPsDeleteParseTree (ParseRoot); - return_ACPI_STATUS (Status); } @@ -326,7 +322,7 @@ AcpiNsParseTable ( } -/***************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsLoadTable * @@ -337,7 +333,7 @@ AcpiNsParseTable ( * * DESCRIPTION: Load one ACPI table into the namespace * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsLoadTable ( @@ -352,18 +348,16 @@ AcpiNsLoadTable ( if (!TableDesc->AmlPointer) { - DEBUG_PRINT (ACPI_ERROR, ("NsLoadTable: Null AML pointer\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Null AML pointer\n")); return_ACPI_STATUS (AE_BAD_PARAMETER); } - DEBUG_PRINT (ACPI_INFO, - ("NsLoadTable: AML block at %p\n", TableDesc->AmlPointer)); + DEBUG_PRINTP (ACPI_INFO, ("AML block at %p\n", TableDesc->AmlPointer)); if (!TableDesc->AmlLength) { - DEBUG_PRINT (ACPI_ERROR, - ("NsLoadTable: Zero-length AML block\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Zero-length AML block\n")); return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -378,12 +372,11 @@ AcpiNsLoadTable ( * because we don't know how many arguments to parse next! */ - DEBUG_PRINT (ACPI_INFO, - ("NsLoadTable: **** Loading table into namespace ****\n")); + DEBUG_PRINTP (ACPI_INFO, ("**** Loading table into namespace ****\n")); - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Status = AcpiNsParseTable (TableDesc, Node->Child); - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) { @@ -397,19 +390,19 @@ AcpiNsLoadTable ( * parse trees. */ - DEBUG_PRINT (ACPI_INFO, - ("NsLoadTable: **** Begin Table Method Parsing and Object Initialization ****\n")); + DEBUG_PRINTP (ACPI_INFO, + ("**** Begin Table Method Parsing and Object Initialization ****\n")); Status = AcpiDsInitializeObjects (TableDesc, Node); - DEBUG_PRINT (ACPI_INFO, - ("NsLoadTable: **** Completed Table Method Parsing and Object Initialization ****\n")); + DEBUG_PRINTP (ACPI_INFO, + ("**** Completed Table Method Parsing and Object Initialization ****\n")); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsLoadTableByType * @@ -421,7 +414,7 @@ AcpiNsLoadTable ( * of the given type are loaded. The mechanism allows this * routine to be called repeatedly. * - *****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsLoadTableByType ( @@ -429,14 +422,13 @@ AcpiNsLoadTableByType ( { UINT32 i; ACPI_STATUS Status = AE_OK; - ACPI_TABLE_HEADER *TablePtr; ACPI_TABLE_DESC *TableDesc; FUNCTION_TRACE ("NsLoadTableByType"); - AcpiCmAcquireMutex (ACPI_MTX_TABLES); + AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* @@ -449,7 +441,7 @@ AcpiNsLoadTableByType ( case ACPI_TABLE_DSDT: - DEBUG_PRINT (ACPI_INFO, ("NsLoadTableByType: Loading DSDT\n")); + DEBUG_PRINTP (ACPI_INFO, ("Loading DSDT\n")); TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_DSDT]; @@ -475,8 +467,7 @@ AcpiNsLoadTableByType ( case ACPI_TABLE_SSDT: - DEBUG_PRINT (ACPI_INFO, - ("NsLoadTableByType: Loading %d SSDTs\n", + DEBUG_PRINTP (ACPI_INFO, ("Loading %d SSDTs\n", AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count)); /* @@ -486,8 +477,6 @@ AcpiNsLoadTableByType ( TableDesc = &AcpiGbl_AcpiTables[ACPI_TABLE_SSDT]; for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_SSDT].Count; i++) { - TablePtr = TableDesc->Pointer; - /* * Only attempt to load table if it is not * already loaded! @@ -495,8 +484,7 @@ AcpiNsLoadTableByType ( if (!TableDesc->LoadedIntoNamespace) { - Status = AcpiNsLoadTable (TableDesc, - AcpiGbl_RootNode); + Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { break; @@ -507,14 +495,12 @@ AcpiNsLoadTableByType ( TableDesc = TableDesc->Next; } - break; case ACPI_TABLE_PSDT: - DEBUG_PRINT (ACPI_INFO, - ("NsLoadTableByType: Loading %d PSDTs\n", + DEBUG_PRINTP (ACPI_INFO, ("Loading %d PSDTs\n", AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count)); /* @@ -525,14 +511,11 @@ AcpiNsLoadTableByType ( for (i = 0; i < AcpiGbl_AcpiTables[ACPI_TABLE_PSDT].Count; i++) { - TablePtr = TableDesc->Pointer; - /* Only attempt to load table if it is not already loaded! */ if (!TableDesc->LoadedIntoNamespace) { - Status = AcpiNsLoadTable (TableDesc, - AcpiGbl_RootNode); + Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode); if (ACPI_FAILURE (Status)) { break; @@ -549,19 +532,20 @@ AcpiNsLoadTableByType ( default: Status = AE_SUPPORT; + break; } UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_TABLES); + AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsDeleteSubtree * @@ -592,9 +576,9 @@ AcpiNsDeleteSubtree ( FUNCTION_TRACE ("NsDeleteSubtree"); - ParentHandle = StartHandle; - ChildHandle = 0; - Level = 1; + ParentHandle = StartHandle; + ChildHandle = 0; + Level = 1; /* * Traverse the tree of objects until we bubble back up @@ -606,8 +590,7 @@ AcpiNsDeleteSubtree ( /* Attempt to get the next object in this scope */ Status = AcpiGetNextObject (ACPI_TYPE_ANY, ParentHandle, - ChildHandle, - &NextChildHandle); + ChildHandle, &NextChildHandle); ChildHandle = NextChildHandle; @@ -618,9 +601,8 @@ AcpiNsDeleteSubtree ( { /* Check if this object has any children */ - if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, - ChildHandle, 0, - &Dummy))) + if (ACPI_SUCCESS (AcpiGetNextObject (ACPI_TYPE_ANY, ChildHandle, + 0, &Dummy))) { /* * There is at least one child of this object, @@ -628,8 +610,8 @@ AcpiNsDeleteSubtree ( */ Level++; - ParentHandle = ChildHandle; - ChildHandle = 0; + ParentHandle = ChildHandle; + ChildHandle = 0; } } @@ -654,12 +636,11 @@ AcpiNsDeleteSubtree ( AcpiNsDeleteNode (ChildHandle); - return_ACPI_STATUS (AE_OK); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsUnloadNameSpace * @@ -671,7 +652,7 @@ AcpiNsDeleteSubtree ( * event. Deletes an entire subtree starting from (and * including) the given handle. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsUnloadNamespace ( diff --git a/sys/contrib/dev/acpica/nsnames.c b/sys/contrib/dev/acpica/nsnames.c index b7cc321..8fb0d3c 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: 54 $ + * $Revision: 59 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "acnamesp.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsnames") @@ -182,7 +182,7 @@ AcpiNsGetTablePathname ( /* Allocate a buffer to be returned to caller */ - NameBuffer = AcpiCmCallocate (Size + 1); + NameBuffer = AcpiUtCallocate (Size + 1); if (!NameBuffer) { REPORT_ERROR (("NsGetTablePathname: allocation failure\n")); @@ -209,8 +209,7 @@ AcpiNsGetTablePathname ( if (Size != 0) { - DEBUG_PRINT (ACPI_ERROR, - ("NsGetTablePathname: Bad pointer returned; size=%X\n", Size)); + DEBUG_PRINTP (ACPI_ERROR, ("Bad pointer returned; size=%X\n", Size)); } return_PTR (NameBuffer); @@ -258,7 +257,6 @@ AcpiNsGetPathnameLength ( } - /******************************************************************************* * * FUNCTION: AcpiNsHandleToPathname @@ -292,7 +290,7 @@ AcpiNsHandleToPathname ( FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle); - if (!AcpiGbl_RootNode || !TargetHandle) + if (!AcpiGbl_RootNode) { /* * If the name space has not been initialized, @@ -356,9 +354,7 @@ AcpiNsHandleToPathname ( UserBuffer[Size] = '\\'; - DEBUG_PRINT (TRACE_EXEC, - ("NsHandleToPathname: Len=%X, %s \n", - PathLength, UserBuffer)); + DEBUG_PRINTP (TRACE_EXEC, ("Len=%X, %s \n", PathLength, UserBuffer)); Exit: return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/nsobject.c b/sys/contrib/dev/acpica/nsobject.c index f0192fb..bb3ca84 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: 49 $ + * $Revision: 55 $ * ******************************************************************************/ @@ -125,7 +125,7 @@ #include "actables.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsobject") @@ -150,11 +150,11 @@ ACPI_STATUS AcpiNsAttachObject ( ACPI_NAMESPACE_NODE *Node, ACPI_OPERAND_OBJECT *Object, - OBJECT_TYPE_INTERNAL Type) + ACPI_OBJECT_TYPE8 Type) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_OPERAND_OBJECT *PreviousObjDesc; - OBJECT_TYPE_INTERNAL ObjType = ACPI_TYPE_ANY; + ACPI_OBJECT_TYPE8 ObjType = ACPI_TYPE_ANY; UINT8 Flags; UINT16 Opcode; @@ -202,8 +202,7 @@ AcpiNsAttachObject ( if (Node->Object == Object) { - DEBUG_PRINT (TRACE_EXEC, - ("NsAttachObject: Obj %p already installed in NameObj %p\n", + DEBUG_PRINTP (TRACE_EXEC, ("Obj %p already installed in NameObj %p\n", Object, Node)); return_ACPI_STATUS (AE_OK); @@ -293,7 +292,7 @@ AcpiNsAttachObject ( MOVE_UNALIGNED16_TO_16 (&Opcode, Object); - /* Check for a recognized OpCode */ + /* Check for a recognized Opcode */ switch ((UINT8) Opcode) { @@ -346,7 +345,7 @@ AcpiNsAttachObject ( default: - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("AML Opcode/Type [%x] not supported in attach\n", (UINT8) Opcode)); @@ -370,21 +369,18 @@ AcpiNsAttachObject ( if (AcpiTbSystemTablePointer (Object)) { - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("AML-stream code %02x\n", *(UINT8 *) Object)); } else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)) { - DUMP_PATHNAME (Object, - "name ", ACPI_INFO, - _COMPONENT); + DUMP_PATHNAME (Object, "name ", ACPI_INFO, _COMPONENT); } else { - DUMP_PATHNAME (Object, "object ", - ACPI_INFO, _COMPONENT); + DUMP_PATHNAME (Object, "object ", ACPI_INFO, _COMPONENT); DUMP_STACK_ENTRY (Object); } } @@ -394,8 +390,7 @@ AcpiNsAttachObject ( } - DEBUG_PRINT (TRACE_EXEC, - ("NsAttachObject: Installing obj %p into NameObj %p [%4.4s]\n", + DEBUG_PRINTP (TRACE_EXEC, ("Installing obj %p into NameObj %p [%4.4s]\n", ObjDesc, Node, &Node->Name)); @@ -404,7 +399,7 @@ AcpiNsAttachObject ( * (if it is an internal object) */ - AcpiCmAddReference (ObjDesc); + AcpiUtAddReference (ObjDesc); /* Save the existing object (if any) for deletion later */ @@ -425,11 +420,11 @@ AcpiNsAttachObject ( { /* One for the attach to the Node */ - AcpiCmRemoveReference (PreviousObjDesc); + AcpiUtRemoveReference (PreviousObjDesc); /* Now delete */ - AcpiCmRemoveReference (PreviousObjDesc); + AcpiUtRemoveReference (PreviousObjDesc); } return_ACPI_STATUS (AE_OK); @@ -471,12 +466,11 @@ AcpiNsDetachObject ( /* Found a valid value */ - DEBUG_PRINT (ACPI_INFO, - ("NsDetachObject: Object=%p Value=%p Name %4.4s\n", + DEBUG_PRINTP (ACPI_INFO, ("Object=%p Value=%p Name %4.4s\n", Node, ObjDesc, &Node->Name)); /* - * Not every value is an object allocated via AcpiCmCallocate, + * Not every value is an object allocated via AcpiUtCallocate, * - must check */ @@ -484,7 +478,7 @@ AcpiNsDetachObject ( { /* Attempt to delete the object (and all subobjects) */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } return_VOID; @@ -495,7 +489,7 @@ AcpiNsDetachObject ( * * FUNCTION: AcpiNsGetAttachedObject * - * PARAMETERS: Handle - Parent Node to be examined + * PARAMETERS: Node - Parent Node to be examined * * RETURN: Current value of the object field from the Node whose * handle is passed @@ -504,20 +498,20 @@ AcpiNsDetachObject ( void * AcpiNsGetAttachedObject ( - ACPI_HANDLE Handle) + ACPI_NAMESPACE_NODE *Node) { - FUNCTION_TRACE_PTR ("NsGetAttachedObject", Handle); + FUNCTION_TRACE_PTR ("NsGetAttachedObject", Node); - if (!Handle) + if (!Node) { /* handle invalid */ - DEBUG_PRINT (ACPI_WARN, ("NsGetAttachedObject: Null handle\n")); + DEBUG_PRINTP (ACPI_WARN, ("Null Node ptr\n")); return_PTR (NULL); } - return_PTR (((ACPI_NAMESPACE_NODE *) Handle)->Object); + return_PTR (Node->Object); } diff --git a/sys/contrib/dev/acpica/nssearch.c b/sys/contrib/dev/acpica/nssearch.c index 3ecdf4e..6b4f50f 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: 64 $ + * $Revision: 70 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "acnamesp.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nssearch") @@ -131,9 +131,9 @@ * FUNCTION: AcpiNsSearchNode * * PARAMETERS: *TargetName - Ascii ACPI name to search for - * *Node - Starting table where search will begin + * *Node - Starting table where search will begin * Type - Object type to match - * **ReturnNode - Where the matched Named obj is returned + * **ReturnNode - Where the matched Named obj is returned * * RETURN: Status * @@ -156,7 +156,7 @@ ACPI_STATUS AcpiNsSearchNode ( UINT32 TargetName, ACPI_NAMESPACE_NODE *Node, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_NAMESPACE_NODE **ReturnNode) { ACPI_NAMESPACE_NODE *NextNode; @@ -169,18 +169,14 @@ AcpiNsSearchNode ( if (TRACE_NAMES & AcpiDbgLevel) { NATIVE_CHAR *ScopeName; - + ScopeName = AcpiNsGetTablePathname (Node); if (ScopeName) { - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchNode: Searching %s [%p]\n", - ScopeName, Node)); - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchNode: For %4.4s (type %X)\n", - &TargetName, Type)); + DEBUG_PRINTP (TRACE_NAMES, ("Searching %s [%p] For %4.4s (type %X)\n", + ScopeName, Node, &TargetName, Type)); - AcpiCmFree (ScopeName); + AcpiUtFree (ScopeName); } } #endif @@ -199,29 +195,24 @@ AcpiNsSearchNode ( if (NextNode->Name == TargetName) { /* - * Found matching entry. Capture type if - * appropriate before returning the entry. + * Found matching entry. Capture the type if appropriate, before + * returning the entry. + * + * The DefFieldDefn and BankFieldDefn cases are actually looking up + * the Region in which the field will be defined */ - /* - * The DefFieldDefn and BankFieldDefn cases - * are actually looking up the Region in which - * the field will be defined - */ - - if ((INTERNAL_TYPE_DEF_FIELD_DEFN == Type) || + if ((INTERNAL_TYPE_FIELD_DEFN == Type) || (INTERNAL_TYPE_BANK_FIELD_DEFN == Type)) { Type = ACPI_TYPE_REGION; } /* - * Scope, DefAny, and IndexFieldDefn are bogus - * "types" which do not actually have anything - * to do with the type of the name being looked - * up. For any other value of Type, if the type - * stored in the entry is Any (i.e. unknown), - * save the actual type. + * Scope, DefAny, and IndexFieldDefn are bogus "types" which do not + * actually have anything to do with the type of the name being + * looked up. For any other value of Type, if the type stored in + * the entry is Any (i.e. unknown), save the actual type. */ if (Type != INTERNAL_TYPE_SCOPE && @@ -232,8 +223,8 @@ AcpiNsSearchNode ( NextNode->Type = (UINT8) Type; } - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchNode: Name %4.4s (actual type %X) found at %p\n", + DEBUG_PRINTP (TRACE_NAMES, + ("Name %4.4s (actual type %X) found at %p\n", &TargetName, NextNode->Type, NextNode)); *ReturnNode = NextNode; @@ -260,11 +251,9 @@ AcpiNsSearchNode ( /* Searched entire table, not found */ - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchNode: Name %4.4s (type %X) not found at %p\n", + DEBUG_PRINTP (TRACE_NAMES, ("Name %4.4s (type %X) not found at %p\n", &TargetName, Type, NextNode)); - return_ACPI_STATUS (AE_NOT_FOUND); } @@ -274,9 +263,9 @@ AcpiNsSearchNode ( * FUNCTION: AcpiNsSearchParentTree * * PARAMETERS: *TargetName - Ascii ACPI name to search for - * *Node - Starting table where search will begin + * *Node - Starting table where search will begin * Type - Object type to match - * **ReturnNode - Where the matched Named Obj is returned + * **ReturnNode - Where the matched Named Obj is returned * * RETURN: Status * @@ -298,7 +287,7 @@ static ACPI_STATUS AcpiNsSearchParentTree ( UINT32 TargetName, ACPI_NAMESPACE_NODE *Node, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_NAMESPACE_NODE **ReturnNode) { ACPI_STATUS Status; @@ -314,20 +303,18 @@ AcpiNsSearchParentTree ( * If there is no parent (at the root) or type is "local", we won't be * searching the parent tree. */ - if ((AcpiNsLocal (Type)) || + if ((AcpiNsLocal (Type)) || (!ParentNode)) { if (!ParentNode) { - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchParentTree: [%4.4s] has no parent\n", + DEBUG_PRINTP (TRACE_NAMES, ("[%4.4s] has no parent\n", &TargetName)); } if (AcpiNsLocal (Type)) { - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchParentTree: [%4.4s] (type %X) is local (no search)\n", + DEBUG_PRINTP (TRACE_NAMES, ("[%4.4s] type %X is local(no search)\n", &TargetName, Type)); } @@ -337,15 +324,12 @@ AcpiNsSearchParentTree ( /* Search the parent tree */ - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchParentTree: Searching parent for %4.4s\n", - &TargetName)); + DEBUG_PRINTP (TRACE_NAMES, ("Searching parent for %4.4s\n", &TargetName)); /* * Search parents until found the target or we have backed up to * the root */ - while (ParentNode) { /* Search parent scope */ @@ -380,12 +364,12 @@ AcpiNsSearchParentTree ( * * PARAMETERS: TargetName - Ascii ACPI name to search for (4 chars) * WalkState - Current state of the walk - * *Node - Starting table where search will begin + * *Node - Starting table where search will begin * InterpreterMode - Add names only in MODE_LoadPassX. * Otherwise,search only. * Type - Object type to match * Flags - Flags describing the search restrictions - * **ReturnNode - Where the Node is returned + * **ReturnNode - Where the Node is returned * * RETURN: Status * @@ -405,7 +389,7 @@ AcpiNsSearchAndEnter ( ACPI_WALK_STATE *WalkState, ACPI_NAMESPACE_NODE *Node, OPERATING_MODE InterpreterMode, - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, UINT32 Flags, ACPI_NAMESPACE_NODE **ReturnNode) { @@ -420,8 +404,7 @@ AcpiNsSearchAndEnter ( if (!Node || !TargetName || !ReturnNode) { - DEBUG_PRINT (ACPI_ERROR, - ("NsSearchAndEnter: Null param: Table %p Name %p Return %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Null param- Table %p Name %p Return %p\n", Node, TargetName, ReturnNode)); REPORT_ERROR (("NsSearchAndEnter: bad (null) parameter\n")); @@ -431,10 +414,9 @@ AcpiNsSearchAndEnter ( /* Name must consist of printable characters */ - if (!AcpiCmValidAcpiName (TargetName)) + if (!AcpiUtValidAcpiName (TargetName)) { - DEBUG_PRINT (ACPI_ERROR, - ("NsSearchAndEnter: *** Bad character in name: %08lx *** \n", + DEBUG_PRINTP (ACPI_ERROR, ("*** Bad character in name: %08lx *** \n", TargetName)); REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name\n")); @@ -445,13 +427,12 @@ AcpiNsSearchAndEnter ( /* Try to find the name in the table specified by the caller */ *ReturnNode = ENTRY_NOT_FOUND; - Status = AcpiNsSearchNode (TargetName, Node, - Type, ReturnNode); + Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode); if (Status != AE_NOT_FOUND) { /* - * If we found it AND the request specifies that a - * find is an error, return the error + * If we found it AND the request specifies that a find is an error, + * return the error */ if ((Status == AE_OK) && (Flags & NS_ERROR_IF_FOUND)) @@ -499,8 +480,7 @@ AcpiNsSearchAndEnter ( */ if (InterpreterMode == IMODE_EXECUTE) { - DEBUG_PRINT (TRACE_NAMES, - ("NsSearchAndEnter: %4.4s Not found in %p [Not adding]\n", + DEBUG_PRINTP (TRACE_NAMES, ("%4.4s Not found in %p [Not adding]\n", &TargetName, Node)); return_ACPI_STATUS (AE_NOT_FOUND); diff --git a/sys/contrib/dev/acpica/nsutils.c b/sys/contrib/dev/acpica/nsutils.c index 936843c..56dd713 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: 77 $ + * $Revision: 83 $ * *****************************************************************************/ @@ -123,11 +123,11 @@ #include "amlcode.h" #include "actables.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsutils") -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsValidRootPrefix * @@ -137,7 +137,7 @@ * * DESCRIPTION: Check if a character is a valid ACPI Root prefix * - ***************************************************************************/ + ******************************************************************************/ BOOLEAN AcpiNsValidRootPrefix ( @@ -148,7 +148,7 @@ AcpiNsValidRootPrefix ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsValidPathSeparator * @@ -158,7 +158,7 @@ AcpiNsValidRootPrefix ( * * DESCRIPTION: Check if a character is a valid ACPI path separator * - ***************************************************************************/ + ******************************************************************************/ BOOLEAN AcpiNsValidPathSeparator ( @@ -169,7 +169,7 @@ AcpiNsValidPathSeparator ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsGetType * @@ -177,26 +177,26 @@ AcpiNsValidPathSeparator ( * * RETURN: Type field from Node whose handle is passed * - ***************************************************************************/ + ******************************************************************************/ -OBJECT_TYPE_INTERNAL +ACPI_OBJECT_TYPE8 AcpiNsGetType ( - ACPI_HANDLE handle) + ACPI_NAMESPACE_NODE *Node) { FUNCTION_TRACE ("NsGetType"); - if (!handle) + if (!Node) { - REPORT_WARNING (("NsGetType: Null handle\n")); + REPORT_WARNING (("NsGetType: Null Node ptr")); return_VALUE (ACPI_TYPE_ANY); } - return_VALUE (((ACPI_NAMESPACE_NODE *) handle)->Type); + return_VALUE (Node->Type); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsLocal * @@ -205,16 +205,16 @@ AcpiNsGetType ( * RETURN: LOCAL if names must be found locally in objects of the * passed type, 0 if enclosing scopes should be searched * - ***************************************************************************/ + ******************************************************************************/ UINT32 AcpiNsLocal ( - OBJECT_TYPE_INTERNAL Type) + ACPI_OBJECT_TYPE8 Type) { FUNCTION_TRACE ("NsLocal"); - if (!AcpiCmValidObjectType (Type)) + if (!AcpiUtValidObjectType (Type)) { /* Type code out of range */ @@ -226,45 +226,33 @@ AcpiNsLocal ( } -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiNsInternalizeName + * FUNCTION: AcpiNsGetInternalNameLength * - * PARAMETERS: *ExternalName - External representation of name - * **Converted Name - Where to return the resulting - * internal represention of the name + * PARAMETERS: Info - Info struct initialized with the + * external name pointer. * * RETURN: Status * - * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0") - * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) + * DESCRIPTION: Calculate the length of the internal (AML) namestring + * corresponding to the external (ASL) namestring. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiNsInternalizeName ( - NATIVE_CHAR *ExternalName, - NATIVE_CHAR **ConvertedName) +AcpiNsGetInternalNameLength ( + ACPI_NAMESTRING_INFO *Info) { - NATIVE_CHAR *Result = NULL; - NATIVE_CHAR *InternalName; - UINT32 NumSegments = 0; - BOOLEAN FullyQualified = FALSE; + NATIVE_CHAR *NextExternalChar; UINT32 i; - UINT32 NumCarats = 0; - - - FUNCTION_TRACE ("NsInternalizeName"); - - - if ((!ExternalName) || - (*ExternalName == 0) || - (!ConvertedName)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } + NextExternalChar = Info->ExternalName; + Info->NumCarats = 0; + Info->NumSegments = 0; + Info->FullyQualified = FALSE; + /* * For the internal name, the required length is 4 bytes * per segment, plus 1 each for RootPrefix, MultiNamePrefixOp, @@ -274,11 +262,10 @@ AcpiNsInternalizeName ( * strlen() + 1 covers the first NameSeg, which has no * path separator */ - - if (AcpiNsValidRootPrefix (ExternalName[0])) + if (AcpiNsValidRootPrefix (NextExternalChar[0])) { - FullyQualified = TRUE; - ExternalName++; + Info->FullyQualified = TRUE; + NextExternalChar++; } else @@ -287,10 +274,10 @@ AcpiNsInternalizeName ( * Handle Carat prefixes */ - while (*ExternalName == '^') + while (*NextExternalChar == '^') { - NumCarats++; - ExternalName++; + Info->NumCarats++; + NextExternalChar++; } } @@ -300,32 +287,57 @@ AcpiNsInternalizeName ( * with one segment since the segment count is (# separators) * + 1, and zero separators is ok. */ - - if (*ExternalName) + if (*NextExternalChar) { - NumSegments = 1; - for (i = 0; ExternalName[i]; i++) + Info->NumSegments = 1; + for (i = 0; NextExternalChar[i]; i++) { - if (AcpiNsValidPathSeparator (ExternalName[i])) + if (AcpiNsValidPathSeparator (NextExternalChar[i])) { - NumSegments++; + Info->NumSegments++; } } } + Info->Length = (ACPI_NAME_SIZE * Info->NumSegments) + + 4 + Info->NumCarats; - /* We need a segment to store the internal version of the name */ + Info->NextExternalChar = NextExternalChar; + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsBuildInternalName + * + * PARAMETERS: Info - Info struct fully initialized + * + * RETURN: Status + * + * DESCRIPTION: Construct the internal (AML) namestring + * corresponding to the external (ASL) namestring. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiNsBuildInternalName ( + ACPI_NAMESTRING_INFO *Info) +{ + UINT32 NumSegments = Info->NumSegments; + NATIVE_CHAR *InternalName = Info->InternalName; + NATIVE_CHAR *ExternalName = Info->NextExternalChar; + NATIVE_CHAR *Result = NULL; + UINT32 i; - InternalName = AcpiCmCallocate ((ACPI_NAME_SIZE * NumSegments) + 4 + NumCarats); - if (!InternalName) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } + FUNCTION_TRACE ("AcpiNsBuildInternalName"); + /* Setup the correct prefixes, counts, and pointers */ - if (FullyQualified) + if (Info->FullyQualified) { InternalName[0] = '\\'; @@ -344,7 +356,6 @@ AcpiNsInternalizeName ( InternalName[2] = (char) NumSegments; Result = &InternalName[3]; } - } else @@ -353,11 +364,10 @@ AcpiNsInternalizeName ( * Not fully qualified. * Handle Carats first, then append the name segments */ - i = 0; - if (NumCarats) + if (Info->NumCarats) { - for (i = 0; i < NumCarats; i++) + for (i = 0; i < Info->NumCarats; i++) { InternalName[i] = '^'; } @@ -392,22 +402,18 @@ AcpiNsInternalizeName ( if (AcpiNsValidPathSeparator (*ExternalName) || (*ExternalName == 0)) { - /* - * Pad the segment with underscore(s) if - * segment is short - */ + /* Pad the segment with underscore(s) if segment is short */ Result[i] = '_'; } else { - /* Convert INT8 to uppercase and save it */ + /* Convert the character to uppercase and save it */ Result[i] = (char) TOUPPER (*ExternalName); ExternalName++; } - } /* Now we must have a path separator, or the pathname is bad */ @@ -415,7 +421,6 @@ AcpiNsInternalizeName ( if (!AcpiNsValidPathSeparator (*ExternalName) && (*ExternalName != 0)) { - AcpiCmFree (InternalName); return_ACPI_STATUS (AE_BAD_PARAMETER); } @@ -426,23 +431,18 @@ AcpiNsInternalizeName ( } - /* Return the completed name */ + /* Terminate the string */ - /* Terminate the string! */ *Result = 0; - *ConvertedName = InternalName; - - if (FullyQualified) + if (Info->FullyQualified) { - DEBUG_PRINT (TRACE_EXEC, - ("NsInternalizeName: returning [%p] (abs) \"\\%s\"\n", + DEBUG_PRINTP (TRACE_EXEC, ("returning [%p] (abs) \"\\%s\"\n", InternalName, &InternalName[0])); } else { - DEBUG_PRINT (TRACE_EXEC, - ("NsInternalizeName: returning [%p] (rel) \"%s\"\n", + DEBUG_PRINTP (TRACE_EXEC, ("returning [%p] (rel) \"%s\"\n", InternalName, &InternalName[2])); } @@ -450,20 +450,84 @@ AcpiNsInternalizeName ( } -/**************************************************************************** +/******************************************************************************* + * + * FUNCTION: AcpiNsInternalizeName + * + * PARAMETERS: *ExternalName - External representation of name + * **Converted Name - Where to return the resulting + * internal represention of the name + * + * RETURN: Status + * + * DESCRIPTION: Convert an external representation (e.g. "\_PR_.CPU0") + * to internal form (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) + * + *******************************************************************************/ + +ACPI_STATUS +AcpiNsInternalizeName ( + NATIVE_CHAR *ExternalName, + NATIVE_CHAR **ConvertedName) +{ + NATIVE_CHAR *InternalName; + ACPI_NAMESTRING_INFO Info; + ACPI_STATUS Status; + + + FUNCTION_TRACE ("NsInternalizeName"); + + + if ((!ExternalName) || + (*ExternalName == 0) || + (!ConvertedName)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + + + /* Get the length of the new internal name */ + + Info.ExternalName = ExternalName; + AcpiNsGetInternalNameLength (&Info); + + /* We need a segment to store the internal name */ + + InternalName = AcpiUtCallocate (Info.Length); + if (!InternalName) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Build the name */ + + Info.InternalName = InternalName; + Status = AcpiNsBuildInternalName (&Info); + if (ACPI_FAILURE (Status)) + { + AcpiUtFree (InternalName); + return_ACPI_STATUS (Status); + } + + *ConvertedName = InternalName; + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* * * FUNCTION: AcpiNsExternalizeName * * PARAMETERS: *InternalName - Internal representation of name * **ConvertedName - Where to return the resulting - * external representation of name + * external representation of name * * RETURN: Status * * DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30) * to its external form (e.g. "\_PR_.CPU0") * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsExternalizeName ( @@ -581,7 +645,7 @@ AcpiNsExternalizeName ( * Build ConvertedName... */ - (*ConvertedName) = AcpiCmCallocate (*ConvertedNameLength); + (*ConvertedName) = AcpiUtCallocate (*ConvertedNameLength); if (!(*ConvertedName)) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -614,7 +678,7 @@ AcpiNsExternalizeName ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsConvertHandleToEntry * @@ -624,7 +688,7 @@ AcpiNsExternalizeName ( * * DESCRIPTION: Convert a namespace handle to a real Node * - ****************************************************************************/ + ******************************************************************************/ ACPI_NAMESPACE_NODE * AcpiNsConvertHandleToEntry ( @@ -636,7 +700,6 @@ AcpiNsConvertHandleToEntry ( * TBD: [Future] Real integer handles allow for more verification * and keep all pointers within this subsystem! */ - if (!Handle) { return (NULL); @@ -659,7 +722,7 @@ AcpiNsConvertHandleToEntry ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsConvertEntryToHandle * @@ -669,7 +732,7 @@ AcpiNsConvertHandleToEntry ( * * DESCRIPTION: Convert a real Node to a namespace handle * - ****************************************************************************/ + ******************************************************************************/ ACPI_HANDLE AcpiNsConvertEntryToHandle ( @@ -682,7 +745,6 @@ AcpiNsConvertEntryToHandle ( * TBD: [Future] Real integer handles allow for more verification * and keep all pointers within this subsystem! */ - return ((ACPI_HANDLE) Node); @@ -704,7 +766,7 @@ AcpiNsConvertEntryToHandle ( } -/****************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsTerminate * @@ -730,12 +792,10 @@ AcpiNsTerminate (void) /* * 1) Free the entire namespace -- all objects, tables, and stacks - */ - /* + * * Delete all objects linked to the root * (additional table descriptors) */ - AcpiNsDeleteNamespaceSubtree (ThisNode); /* Detach any object(s) attached to the root */ @@ -744,27 +804,24 @@ AcpiNsTerminate (void) if (ObjDesc) { AcpiNsDetachObject (ThisNode); - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } AcpiNsDeleteChildren (ThisNode); - - DEBUG_PRINT (ACPI_INFO, ("NsTerminate: Namespace freed\n")); + DEBUG_PRINTP (ACPI_INFO, ("Namespace freed\n")); /* * 2) Now we can delete the ACPI tables */ - AcpiTbDeleteAcpiTables (); - - DEBUG_PRINT (ACPI_INFO, ("NsTerminate: ACPI Tables freed\n")); + DEBUG_PRINTP (ACPI_INFO, ("ACPI Tables freed\n")); return_VOID; } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsOpensScope * @@ -773,16 +830,16 @@ AcpiNsTerminate (void) * RETURN: NEWSCOPE if the passed type "opens a name scope" according * to the ACPI specification, else 0 * - ***************************************************************************/ + ******************************************************************************/ UINT32 AcpiNsOpensScope ( - OBJECT_TYPE_INTERNAL Type) + ACPI_OBJECT_TYPE8 Type) { FUNCTION_TRACE_U32 ("NsOpensScope", Type); - if (!AcpiCmValidObjectType (Type)) + if (!AcpiUtValidObjectType (Type)) { /* type code out of range */ @@ -794,7 +851,7 @@ AcpiNsOpensScope ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsGetNode * @@ -812,7 +869,7 @@ AcpiNsOpensScope ( * * MUTEX: Locks namespace * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS AcpiNsGetNode ( @@ -850,7 +907,7 @@ AcpiNsGetNode ( } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Setup lookup scope (search starting point) */ @@ -865,22 +922,21 @@ AcpiNsGetNode ( if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_INFO, ("NsGetNode: %s, %s\n", - InternalPath, AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_INFO, ("%s, %s\n", + InternalPath, AcpiUtFormatException (Status))); } - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); /* Cleanup */ - AcpiCmFree (InternalPath); - + AcpiUtFree (InternalPath); return_ACPI_STATUS (Status); } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsFindParentName * @@ -892,7 +948,7 @@ AcpiNsGetNode ( * name segment, or "????" if the parent name can't be found * (which "should not happen"). * - ***************************************************************************/ + ******************************************************************************/ ACPI_NAME AcpiNsFindParentName ( @@ -911,10 +967,8 @@ AcpiNsFindParentName ( ParentNode = AcpiNsGetParentObject (ChildNode); if (ParentNode) { - DEBUG_PRINT (TRACE_EXEC, - ("Parent of %p [%4.4s] is %p [%4.4s]\n", - ChildNode, &ChildNode->Name, ParentNode, - &ParentNode->Name)); + DEBUG_PRINTP (TRACE_EXEC, ("Parent of %p [%4.4s] is %p [%4.4s]\n", + ChildNode, &ChildNode->Name, ParentNode, &ParentNode->Name)); if (ParentNode->Name) { @@ -922,19 +976,17 @@ AcpiNsFindParentName ( } } - DEBUG_PRINT (TRACE_EXEC, - ("FindParentName: unable to find parent of %p (%4.4s)\n", + DEBUG_PRINTP (TRACE_EXEC, ("unable to find parent of %p (%4.4s)\n", ChildNode, &ChildNode->Name)); } - return_VALUE (ACPI_UNKNOWN_NAME); } #if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER) -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsExistDownstreamSibling * @@ -948,7 +1000,7 @@ AcpiNsFindParentName ( * line drawing character to use when displaying namespace * trees. * - ***************************************************************************/ + ******************************************************************************/ BOOLEAN AcpiNsExistDownstreamSibling ( @@ -971,7 +1023,7 @@ AcpiNsExistDownstreamSibling ( #endif /* ACPI_DEBUG */ -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsGetParentObject * @@ -981,7 +1033,7 @@ AcpiNsExistDownstreamSibling ( * * DESCRIPTION: Obtain the parent entry for a given entry in the namespace. * - ***************************************************************************/ + ******************************************************************************/ ACPI_NAMESPACE_NODE * @@ -1002,7 +1054,6 @@ AcpiNsGetParentObject ( * This saves putting a parent back pointer in each and * every named object! */ - while (!(Node->Flags & ANOBJ_END_OF_PEER_LIST)) { Node = Node->Peer; @@ -1013,7 +1064,7 @@ AcpiNsGetParentObject ( } -/**************************************************************************** +/******************************************************************************* * * FUNCTION: AcpiNsGetNextValidObject * @@ -1025,7 +1076,7 @@ AcpiNsGetParentObject ( * DESCRIPTION: Find the next valid object within a name table. * Useful for implementing NULL-end-of-list loops. * - ***************************************************************************/ + ******************************************************************************/ ACPI_NAMESPACE_NODE * diff --git a/sys/contrib/dev/acpica/nswalk.c b/sys/contrib/dev/acpica/nswalk.c index 2244489..72a0a20 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 APCI namespace - * $Revision: 19 $ + * $Revision: 22 $ * *****************************************************************************/ @@ -122,7 +122,7 @@ #include "acnamesp.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nswalk") @@ -147,7 +147,7 @@ ACPI_NAMESPACE_NODE * AcpiNsGetNextObject ( - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_NAMESPACE_NODE *ParentNode, ACPI_NAMESPACE_NODE *ChildNode) { @@ -238,18 +238,18 @@ AcpiNsGetNextObject ( ACPI_STATUS AcpiNsWalkNamespace ( - OBJECT_TYPE_INTERNAL Type, + ACPI_OBJECT_TYPE8 Type, ACPI_HANDLE StartNode, UINT32 MaxDepth, BOOLEAN UnlockBeforeCallback, - WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK UserFunction, void *Context, void **ReturnValue) { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *ChildNode; ACPI_NAMESPACE_NODE *ParentNode; - OBJECT_TYPE_INTERNAL ChildType; + ACPI_OBJECT_TYPE8 ChildType; UINT32 Level; @@ -309,7 +309,7 @@ AcpiNsWalkNamespace ( if (UnlockBeforeCallback) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } Status = UserFunction (ChildNode, Level, @@ -317,7 +317,7 @@ AcpiNsWalkNamespace ( if (UnlockBeforeCallback) { - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); } switch (Status) diff --git a/sys/contrib/dev/acpica/nsxfname.c b/sys/contrib/dev/acpica/nsxfname.c index 257aafd..6b46010 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: 75 $ + * $Revision: 79 $ * *****************************************************************************/ @@ -126,7 +126,7 @@ #include "acevents.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsxfname") @@ -159,6 +159,16 @@ AcpiGetHandle ( ACPI_NAMESPACE_NODE *PrefixNode = NULL; + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Parameter Validation */ + if (!RetHandle || !Pathname) { return (AE_BAD_PARAMETER); @@ -168,16 +178,16 @@ AcpiGetHandle ( if (Parent) { - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); PrefixNode = AcpiNsConvertHandleToEntry (Parent); if (!PrefixNode) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); } /* Special case for root, since we can't search for it */ @@ -229,6 +239,14 @@ AcpiGetName ( ACPI_NAMESPACE_NODE *Node; + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + /* Buffer pointer must be valid always */ if (!RetPathPtr || (NameType > ACPI_NAME_TYPE_MAX)) @@ -258,7 +276,7 @@ AcpiGetName ( * Validate handle and convert to an Node */ - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Node = AcpiNsConvertHandleToEntry (Handle); if (!Node) { @@ -285,7 +303,7 @@ AcpiGetName ( UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } @@ -310,14 +328,22 @@ AcpiGetObjectInfo ( ACPI_HANDLE Handle, ACPI_DEVICE_INFO *Info) { - DEVICE_ID Hid; - DEVICE_ID Uid; + ACPI_DEVICE_ID Hid; + ACPI_DEVICE_ID Uid; ACPI_STATUS Status; UINT32 DeviceStatus = 0; ACPI_INTEGER Address = 0; ACPI_NAMESPACE_NODE *Node; + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + /* Parameter validation */ if (!Handle || !Info) @@ -325,19 +351,19 @@ AcpiGetObjectInfo ( return (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Node = AcpiNsConvertHandleToEntry (Handle); if (!Node) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } Info->Type = Node->Type; Info->Name = Node->Name; - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); /* * If not a device, we are all done. @@ -360,7 +386,7 @@ AcpiGetObjectInfo ( /* Execute the _HID method and save the result */ - Status = AcpiCmExecute_HID (Node, &Hid); + Status = AcpiUtExecute_HID (Node, &Hid); if (ACPI_SUCCESS (Status)) { STRNCPY (Info->HardwareId, Hid.Buffer, sizeof(Info->HardwareId)); @@ -370,7 +396,7 @@ AcpiGetObjectInfo ( /* Execute the _UID method and save the result */ - Status = AcpiCmExecute_UID (Node, &Uid); + Status = AcpiUtExecute_UID (Node, &Uid); if (ACPI_SUCCESS (Status)) { STRCPY (Info->UniqueId, Uid.Buffer); @@ -383,7 +409,7 @@ AcpiGetObjectInfo ( * _STA is not always present */ - Status = AcpiCmExecute_STA (Node, &DeviceStatus); + Status = AcpiUtExecute_STA (Node, &DeviceStatus); if (ACPI_SUCCESS (Status)) { Info->CurrentStatus = DeviceStatus; @@ -395,7 +421,7 @@ AcpiGetObjectInfo ( * _ADR is not always present */ - Status = AcpiCmEvaluateNumericObject (METHOD_NAME__ADR, + Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &Address); if (ACPI_SUCCESS (Status)) diff --git a/sys/contrib/dev/acpica/nsxfobj.c b/sys/contrib/dev/acpica/nsxfobj.c index b90c31a..1ef6f75 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: 80 $ + * $Revision: 86 $ * ******************************************************************************/ @@ -124,7 +124,7 @@ #include "acdispat.h" -#define _COMPONENT NAMESPACE +#define _COMPONENT ACPI_NAMESPACE MODULE_NAME ("nsxfobj") @@ -172,6 +172,14 @@ AcpiEvaluateObject ( FUNCTION_TRACE ("AcpiEvaluateObject"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* * If there are parameters to be passed to the object * (which must be a control method), the external objects @@ -189,7 +197,7 @@ AcpiEvaluateObject ( ParamLength = (Count + 1) * sizeof (void *); ObjectLength = Count * sizeof (ACPI_OPERAND_OBJECT); - ParamPtr = AcpiCmCallocate (ParamLength + /* Parameter List part */ + ParamPtr = AcpiUtCallocate (ParamLength + /* Parameter List part */ ObjectLength); /* Actual objects */ if (!ParamPtr) { @@ -207,7 +215,7 @@ AcpiEvaluateObject ( for (i = 0; i < Count; i++) { ParamPtr[i] = &ObjectPtr[i]; - AcpiCmInitStaticObject (&ObjectPtr[i]); + AcpiUtInitStaticObject (&ObjectPtr[i]); } ParamPtr[Count] = NULL; @@ -217,12 +225,12 @@ AcpiEvaluateObject ( */ for (i = 0; i < Count; i++) { - Status = AcpiCmCopyEobjectToIobject (&ParamObjects->Pointer[i], + Status = AcpiUtCopyEobjectToIobject (&ParamObjects->Pointer[i], ParamPtr[i]); if (ACPI_FAILURE (Status)) { - AcpiCmDeleteInternalObjectList (ParamPtr); + AcpiUtDeleteInternalObjectList (ParamPtr); return_ACPI_STATUS (Status); } } @@ -255,14 +263,12 @@ AcpiEvaluateObject ( if (!Pathname) { - DEBUG_PRINT (ACPI_ERROR, - ("AcpiEvaluateObject: Both Handle and Pathname are NULL\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Both Handle and Pathname are NULL\n")); } else { - DEBUG_PRINT (ACPI_ERROR, - ("AcpiEvaluateObject: Handle is NULL and Pathname is relative\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Handle is NULL and Pathname is relative\n")); } Status = AE_BAD_PARAMETER; @@ -331,7 +337,7 @@ AcpiEvaluateObject ( * Find out how large a buffer is needed * to contain the returned object */ - Status = AcpiCmGetObjectSize (ReturnObj, + Status = AcpiUtGetObjectSize (ReturnObj, &BufferSpaceNeeded); if (ACPI_SUCCESS (Status)) { @@ -348,8 +354,8 @@ AcpiEvaluateObject ( * but return the buffer size needed */ - DEBUG_PRINT (ACPI_INFO, - ("AcpiEvaluateObject: Needed buffer size %X, received %X\n", + DEBUG_PRINTP (ACPI_INFO, + ("Needed buffer size %X, received %X\n", BufferSpaceNeeded, UserBufferLength)); ReturnBuffer->Length = BufferSpaceNeeded; @@ -361,7 +367,7 @@ AcpiEvaluateObject ( /* * We have enough space for the object, build it */ - Status = AcpiCmCopyIobjectToEobject (ReturnObj, + Status = AcpiUtCopyIobjectToEobject (ReturnObj, ReturnBuffer); ReturnBuffer->Length = BufferSpaceNeeded; } @@ -379,7 +385,7 @@ AcpiEvaluateObject ( * Delete the internal return object. (Or at least * decrement the reference count by one) */ - AcpiCmRemoveReference (ReturnObj); + AcpiUtRemoveReference (ReturnObj); } /* @@ -390,7 +396,7 @@ AcpiEvaluateObject ( { /* Free the allocated parameter block */ - AcpiCmDeleteInternalObjectList (ParamPtr); + AcpiUtDeleteInternalObjectList (ParamPtr); } return_ACPI_STATUS (Status); @@ -428,6 +434,14 @@ AcpiGetNextObject ( ACPI_NAMESPACE_NODE *ChildNode = NULL; + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + /* Parameter validation */ if (Type > ACPI_TYPE_MAX) @@ -435,7 +449,7 @@ AcpiGetNextObject ( return (AE_BAD_PARAMETER); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* If null handle, use the parent */ @@ -468,7 +482,7 @@ AcpiGetNextObject ( /* Internal function does the real work */ - Node = AcpiNsGetNextObject ((OBJECT_TYPE_INTERNAL) Type, + Node = AcpiNsGetNextObject ((ACPI_OBJECT_TYPE8) Type, ParentNode, ChildNode); if (!Node) { @@ -484,7 +498,7 @@ AcpiGetNextObject ( UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } @@ -508,7 +522,16 @@ AcpiGetType ( ACPI_OBJECT_TYPE *RetType) { ACPI_NAMESPACE_NODE *Node; + ACPI_STATUS Status; + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Parameter Validation */ @@ -527,21 +550,21 @@ AcpiGetType ( return (AE_OK); } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Convert and validate the handle */ Node = AcpiNsConvertHandleToEntry (Handle); if (!Node) { - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (AE_BAD_PARAMETER); } *RetType = Node->Type; - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (AE_OK); } @@ -569,8 +592,13 @@ AcpiGetParent ( ACPI_STATUS Status = AE_OK; - /* No trace macro, too verbose */ + /* Ensure that ACPI has been initialized */ + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return (Status); + } if (!RetHandle) { @@ -585,7 +613,7 @@ AcpiGetParent ( } - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); /* Convert and validate the handle */ @@ -612,7 +640,7 @@ AcpiGetParent ( UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } @@ -652,7 +680,7 @@ AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, ACPI_HANDLE StartObject, UINT32 MaxDepth, - WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK UserFunction, void *Context, void **ReturnValue) { @@ -662,6 +690,14 @@ AcpiWalkNamespace ( FUNCTION_TRACE ("AcpiWalkNamespace"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if ((Type > ACPI_TYPE_MAX) || @@ -678,14 +714,14 @@ AcpiWalkNamespace ( * must be allowed to make Acpi calls itself. */ - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); - Status = AcpiNsWalkNamespace ((OBJECT_TYPE_INTERNAL) Type, + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + Status = AcpiNsWalkNamespace ((ACPI_OBJECT_TYPE8) Type, StartObject, MaxDepth, NS_WALK_UNLOCK, UserFunction, Context, ReturnValue); - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } @@ -715,17 +751,15 @@ AcpiNsGetDeviceCallback ( ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; UINT32 Flags; - DEVICE_ID DeviceId; + ACPI_DEVICE_ID DeviceId; ACPI_GET_DEVICES_INFO *Info; Info = Context; - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); - + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Node = AcpiNsConvertHandleToEntry (ObjHandle); - - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); if (!Node) { @@ -735,17 +769,15 @@ AcpiNsGetDeviceCallback ( /* * Run _STA to determine if device is present */ - - Status = AcpiCmExecute_STA (Node, &Flags); + Status = AcpiUtExecute_STA (Node, &Flags); if (ACPI_FAILURE (Status)) { - return (Status); + return (AE_CTRL_DEPTH); } if (!(Flags & 0x01)) { /* don't return at the device or children of the device if not there */ - return (AE_CTRL_DEPTH); } @@ -754,8 +786,7 @@ AcpiNsGetDeviceCallback ( */ if (Info->Hid != NULL) { - Status = AcpiCmExecute_HID (Node, &DeviceId); - + Status = AcpiUtExecute_HID (Node, &DeviceId); if (Status == AE_NOT_FOUND) { return (AE_OK); @@ -763,7 +794,7 @@ AcpiNsGetDeviceCallback ( else if (ACPI_FAILURE (Status)) { - return (Status); + return (AE_CTRL_DEPTH); } if (STRNCMP (DeviceId.Buffer, Info->Hid, sizeof (DeviceId.Buffer)) != 0) @@ -773,7 +804,6 @@ AcpiNsGetDeviceCallback ( } Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue); - return (AE_OK); } @@ -806,7 +836,7 @@ AcpiNsGetDeviceCallback ( ACPI_STATUS AcpiGetDevices ( NATIVE_CHAR *HID, - WALK_CALLBACK UserFunction, + ACPI_WALK_CALLBACK UserFunction, void *Context, void **ReturnValue) { @@ -817,6 +847,14 @@ AcpiGetDevices ( FUNCTION_TRACE ("AcpiGetDevices"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if (!UserFunction) @@ -839,14 +877,14 @@ AcpiGetDevices ( * must be allowed to make Acpi calls itself. */ - AcpiCmAcquireMutex (ACPI_MTX_NAMESPACE); + AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, NS_WALK_UNLOCK, AcpiNsGetDeviceCallback, &Info, ReturnValue); - AcpiCmReleaseMutex (ACPI_MTX_NAMESPACE); + AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/psargs.c b/sys/contrib/dev/acpica/psargs.c index 1ea0986..bb26cbe 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: 43 $ + * $Revision: 47 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "amlcode.h" #include "acnamesp.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psargs") @@ -351,7 +351,7 @@ AcpiPsGetNextNamepath ( { /* Null name case, create a null namepath object */ - AcpiPsInitOp (Arg, AML_NAMEPATH_OP); + AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path; return_VOID; } @@ -384,12 +384,12 @@ AcpiPsGetNextNamepath ( Count = AcpiPsGetArg (Op, 0); if (Count && Count->Opcode == AML_BYTE_OP) { - NameOp = AcpiPsAllocOp (AML_NAMEPATH_OP); + NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (NameOp) { /* Change arg into a METHOD CALL and attach the name */ - AcpiPsInitOp (Arg, AML_METHODCALL_OP); + AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); NameOp->Value.Name = Path; @@ -421,7 +421,7 @@ AcpiPsGetNextNamepath ( * pathname */ - AcpiPsInitOp (Arg, AML_NAMEPATH_OP); + AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path; @@ -455,7 +455,7 @@ AcpiPsGetNextNamepath ( { /* Null name case, create a null namepath object */ - AcpiPsInitOp (Arg, AML_NAMEPATH_OP); + AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path; return_VOID; } @@ -488,16 +488,15 @@ AcpiPsGetNextNamepath ( if (Node->Type == ACPI_TYPE_METHOD) { MethodNode = Node; - DEBUG_PRINT (TRACE_PARSE, - ("PsGetNextNamepath: method - %p Path=%p\n", + DEBUG_PRINTP (TRACE_PARSE, ("method - %p Path=%p\n", MethodNode, Path)); - NameOp = AcpiPsAllocOp (AML_NAMEPATH_OP); + NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (NameOp) { /* Change arg into a METHOD CALL and attach name to it */ - AcpiPsInitOp (Arg, AML_METHODCALL_OP); + AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP); NameOp->Value.Name = Path; @@ -531,7 +530,7 @@ AcpiPsGetNextNamepath ( * pathname. */ - AcpiPsInitOp (Arg, AML_NAMEPATH_OP); + AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = Path; @@ -614,7 +613,7 @@ AcpiPsGetNextSimpleArg ( case ARGP_NAME: case ARGP_NAMESTRING: - AcpiPsInitOp (Arg, AML_NAMEPATH_OP); + AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP); Arg->Value.Name = AcpiPsGetNextNamestring (ParserState); break; } @@ -639,7 +638,7 @@ ACPI_PARSE_OBJECT * AcpiPsGetNextField ( ACPI_PARSE_STATE *ParserState) { - ACPI_PTRDIFF AmlOffset = ParserState->Aml - + UINT32 AmlOffset = ParserState->Aml - ParserState->AmlStart; ACPI_PARSE_OBJECT *Field; UINT16 Opcode; @@ -656,20 +655,20 @@ AcpiPsGetNextField ( default: - Opcode = AML_NAMEDFIELD_OP; + Opcode = AML_INT_NAMEDFIELD_OP; break; case 0x00: - Opcode = AML_RESERVEDFIELD_OP; + Opcode = AML_INT_RESERVEDFIELD_OP; ParserState->Aml++; break; case 0x01: - Opcode = AML_ACCESSFIELD_OP; + Opcode = AML_INT_ACCESSFIELD_OP; ParserState->Aml++; break; } @@ -686,7 +685,7 @@ AcpiPsGetNextField ( switch (Opcode) { - case AML_NAMEDFIELD_OP: + case AML_INT_NAMEDFIELD_OP: /* Get the 4-character name */ @@ -700,7 +699,7 @@ AcpiPsGetNextField ( break; - case AML_RESERVEDFIELD_OP: + case AML_INT_RESERVEDFIELD_OP: /* Get the length which is encoded as a package length */ @@ -708,7 +707,7 @@ AcpiPsGetNextField ( break; - case AML_ACCESSFIELD_OP: + case AML_INT_ACCESSFIELD_OP: /* Get AccessType and AccessAtrib and merge into the field Op */ @@ -821,7 +820,7 @@ AcpiPsGetNextArg ( { /* non-empty list */ - Arg = AcpiPsAllocOp (AML_BYTELIST_OP); + Arg = AcpiPsAllocOp (AML_INT_BYTELIST_OP); if (Arg) { /* fill in bytelist data */ @@ -847,7 +846,7 @@ AcpiPsGetNextArg ( { /* NullName or NameString */ - Arg = AcpiPsAllocOp (AML_NAMEPATH_OP); + Arg = AcpiPsAllocOp (AML_INT_NAMEPATH_OP); if (Arg) { AcpiPsGetNextNamepath (ParserState, Arg, ArgCount, 0); diff --git a/sys/contrib/dev/acpica/psfind.c b/sys/contrib/dev/acpica/psfind.c index 6686d7f..c706b0c 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: 21 $ + * $Revision: 24 $ * *****************************************************************************/ @@ -122,7 +122,7 @@ #include "acparser.h" #include "amlcode.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psfind") @@ -288,8 +288,9 @@ AcpiPsFind ( if (!Scope || !Path) { - DEBUG_PRINT (TRACE_PARSE, ("PsFind: Null path (%p) or scope (%p)!\n", Path, Scope)); - return_VALUE (NULL); + DEBUG_PRINTP (TRACE_PARSE, ("Null path (%p) or scope (%p)!\n", + Path, Scope)); + return_PTR (NULL); } @@ -355,7 +356,7 @@ AcpiPsFind ( } - DEBUG_PRINT (TRACE_PARSE, ("PsFind: Null path, returning current root scope Op=%p\n", Op)); + DEBUG_PRINTP (TRACE_PARSE, ("Null path, returning current root scope Op=%p\n", Op)); return_PTR (Op); break; @@ -374,7 +375,7 @@ AcpiPsFind ( break; } - DEBUG_PRINT (TRACE_PARSE, ("PsFind: Search scope %p Segs=%d Opcode=%4.4X Create=%d\n", + DEBUG_PRINTP (TRACE_PARSE, ("Search scope %p Segs=%d Opcode=%4.4X Create=%d\n", Scope, SegCount, Opcode, Create)); /* match each name segment */ @@ -397,7 +398,7 @@ AcpiPsFind ( Op = AcpiPsFindName (Scope, Name, NameOp); if (Op) { - DEBUG_PRINT (TRACE_PARSE, ("PsFind: [%4.4s] Found! Op=%p Opcode=%4.4X\n", &Name, Op, Op->Opcode)); + DEBUG_PRINTP (TRACE_PARSE, ("[%4.4s] Found! Op=%p Opcode=%4.4X\n", &Name, Op, Op->Opcode)); } if (!Op) @@ -420,7 +421,7 @@ AcpiPsFind ( AcpiPsSetName (Op, Name); AcpiPsAppendArg (Scope, Op); - DEBUG_PRINT (TRACE_PARSE, ("PsFind: [%4.4s] Not found, created Op=%p Opcode=%4.4X\n", &Name, Op, Opcode)); + DEBUG_PRINTP (TRACE_PARSE, ("[%4.4s] Not found, created Op=%p Opcode=%4.4X\n", &Name, Op, Opcode)); } } @@ -434,19 +435,19 @@ AcpiPsFind ( Op = AcpiPsFindName (Scope, Name, Opcode); if (Op) { - DEBUG_PRINT (TRACE_PARSE, ("PsFind: [%4.4s] Found in parent tree! Op=%p Opcode=%4.4X\n", &Name, Op, Op->Opcode)); + DEBUG_PRINTP (TRACE_PARSE, ("[%4.4s] Found in parent tree! Op=%p Opcode=%4.4X\n", &Name, Op, Op->Opcode)); } else { - DEBUG_PRINT (TRACE_PARSE, ("PsFind: [%4.4s] Not found in parent=%p\n", &Name, Scope)); + DEBUG_PRINTP (TRACE_PARSE, ("[%4.4s] Not found in parent=%p\n", &Name, Scope)); } } } else { - DEBUG_PRINT (TRACE_PARSE, ("PsFind: Segment [%4.4s] Not Found in scope %p!\n", &Name, Scope)); + DEBUG_PRINTP (TRACE_PARSE, ("Segment [%4.4s] Not Found in scope %p!\n", &Name, Scope)); } } diff --git a/sys/contrib/dev/acpica/psopcode.c b/sys/contrib/dev/acpica/psopcode.c index 88e18f6..fa4303e 100644 --- a/sys/contrib/dev/acpica/psopcode.c +++ b/sys/contrib/dev/acpica/psopcode.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psopcode - Parser opcode information table - * $Revision: 27 $ + * $Revision: 32 $ * *****************************************************************************/ @@ -120,7 +120,7 @@ #include "amlcode.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psopcode") @@ -221,12 +221,12 @@ #define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME) #define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET) #define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) -#define ARGP_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME) -#define ARGP_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) +#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME) #define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG) #define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG) @@ -269,7 +269,7 @@ #define ARGP_DEBUG_OP ARG_NONE #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) #define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG) -#define ARGP_DEF_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) +#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) #define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST) #define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST) #define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST) @@ -293,7 +293,7 @@ * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed * into a 32-bit number and stored in the master opcode table at the end of this file. * - * (Used by AcpiAmlPrepOperands procedure and the ASL Compiler) + * (Used by PrepOperands procedure and the ASL Compiler) */ #define ARGI_ZERO_OP ARG_NONE @@ -351,12 +351,12 @@ #define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_DATAOBJECT) #define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF) #define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) -#define ARGI_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_TYPE_OP ARGI_LIST1 (ARGI_ANYTYPE) -#define ARGI_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) +#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE) #define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) #define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) #define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER) @@ -399,7 +399,7 @@ #define ARGI_DEBUG_OP ARG_NONE #define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER) #define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER) -#define ARGI_DEF_FIELD_OP ARGI_INVALID_OPCODE +#define ARGI_FIELD_OP ARGI_INVALID_OPCODE #define ARGI_DEVICE_OP ARGI_INVALID_OPCODE #define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE #define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE @@ -426,143 +426,143 @@ static ACPI_OPCODE_INFO AmlOpInfo[] = { -/* Index Opcode Type Class Has Arguments? Name Parser Args Interpreter Args */ - -/* 00 */ /* AML_ZERO_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Zero", ARGP_ZERO_OP, ARGI_ZERO_OP), -/* 01 */ /* AML_ONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "One", ARGP_ONE_OP, ARGI_ONE_OP), -/* 02 */ /* AML_ALIAS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), -/* 03 */ /* AML_NAME_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Name", ARGP_NAME_OP, ARGI_NAME_OP), -/* 04 */ /* AML_BYTE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP), -/* 05 */ /* AML_WORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "WordConst", ARGP_WORD_OP, ARGI_WORD_OP), -/* 06 */ /* AML_DWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP), -/* 07 */ /* AML_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "String", ARGP_STRING_OP, ARGI_STRING_OP), -/* 08 */ /* AML_SCOPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP), -/* 09 */ /* AML_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP), -/* 0A */ /* AML_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP), -/* 0B */ /* AML_METHOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Method", ARGP_METHOD_OP, ARGI_METHOD_OP), -/* 0C */ /* AML_LOCAL0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local0", ARGP_LOCAL0, ARGI_LOCAL0), -/* 0D */ /* AML_LOCAL1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local1", ARGP_LOCAL1, ARGI_LOCAL1), -/* 0E */ /* AML_LOCAL2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local2", ARGP_LOCAL2, ARGI_LOCAL2), -/* 0F */ /* AML_LOCAL3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local3", ARGP_LOCAL3, ARGI_LOCAL3), -/* 10 */ /* AML_LOCAL4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local4", ARGP_LOCAL4, ARGI_LOCAL4), -/* 11 */ /* AML_LOCAL5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local5", ARGP_LOCAL5, ARGI_LOCAL5), -/* 12 */ /* AML_LOCAL6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local6", ARGP_LOCAL6, ARGI_LOCAL6), -/* 13 */ /* AML_LOCAL7 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local7", ARGP_LOCAL7, ARGI_LOCAL7), -/* 14 */ /* AML_ARG0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg0", ARGP_ARG0, ARGI_ARG0), -/* 15 */ /* AML_ARG1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg1", ARGP_ARG1, ARGI_ARG1), -/* 16 */ /* AML_ARG2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg2", ARGP_ARG2, ARGI_ARG2), -/* 17 */ /* AML_ARG3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg3", ARGP_ARG3, ARGI_ARG3), -/* 18 */ /* AML_ARG4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg4", ARGP_ARG4, ARGI_ARG4), -/* 19 */ /* AML_ARG5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg5", ARGP_ARG5, ARGI_ARG5), -/* 1A */ /* AML_ARG6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg6", ARGP_ARG6, ARGI_ARG6), -/* 1B */ /* AML_STORE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Store", ARGP_STORE_OP, ARGI_STORE_OP), -/* 1C */ /* AML_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP), -/* 1D */ /* AML_ADD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Add", ARGP_ADD_OP, ARGI_ADD_OP), -/* 1E */ /* AML_CONCAT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP), -/* 1F */ /* AML_SUBTRACT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), -/* 20 */ /* AML_INCREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), -/* 21 */ /* AML_DECREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), -/* 22 */ /* AML_MULTIPLY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP), -/* 23 */ /* AML_DIVIDE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP), -/* 24 */ /* AML_SHIFT_LEFT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP), -/* 25 */ /* AML_SHIFT_RIGHT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP), -/* 26 */ /* AML_BIT_AND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP), -/* 27 */ /* AML_BIT_NAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP), -/* 28 */ /* AML_BIT_OR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP), -/* 29 */ /* AML_BIT_NOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP), -/* 2A */ /* AML_BIT_XOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP), -/* 2B */ /* AML_BIT_NOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP), +/* Index Opcode Type Class Has Arguments? Name Parser Args Interpreter Args */ + +/* 00 */ /* AML_ZERO_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Zero", ARGP_ZERO_OP, ARGI_ZERO_OP), +/* 01 */ /* AML_ONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "One", ARGP_ONE_OP, ARGI_ONE_OP), +/* 02 */ /* AML_ALIAS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP), +/* 03 */ /* AML_NAME_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Name", ARGP_NAME_OP, ARGI_NAME_OP), +/* 04 */ /* AML_BYTE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP), +/* 05 */ /* AML_WORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "WordConst", ARGP_WORD_OP, ARGI_WORD_OP), +/* 06 */ /* AML_DWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP), +/* 07 */ /* AML_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "String", ARGP_STRING_OP, ARGI_STRING_OP), +/* 08 */ /* AML_SCOPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP), +/* 09 */ /* AML_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP), +/* 0A */ /* AML_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP), +/* 0B */ /* AML_METHOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Method", ARGP_METHOD_OP, ARGI_METHOD_OP), +/* 0C */ /* AML_LOCAL0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local0", ARGP_LOCAL0, ARGI_LOCAL0), +/* 0D */ /* AML_LOCAL1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local1", ARGP_LOCAL1, ARGI_LOCAL1), +/* 0E */ /* AML_LOCAL2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local2", ARGP_LOCAL2, ARGI_LOCAL2), +/* 0F */ /* AML_LOCAL3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local3", ARGP_LOCAL3, ARGI_LOCAL3), +/* 10 */ /* AML_LOCAL4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local4", ARGP_LOCAL4, ARGI_LOCAL4), +/* 11 */ /* AML_LOCAL5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local5", ARGP_LOCAL5, ARGI_LOCAL5), +/* 12 */ /* AML_LOCAL6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local6", ARGP_LOCAL6, ARGI_LOCAL6), +/* 13 */ /* AML_LOCAL7 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LOCAL_VARIABLE| AML_NO_ARGS, "Local7", ARGP_LOCAL7, ARGI_LOCAL7), +/* 14 */ /* AML_ARG0 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg0", ARGP_ARG0, ARGI_ARG0), +/* 15 */ /* AML_ARG1 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg1", ARGP_ARG1, ARGI_ARG1), +/* 16 */ /* AML_ARG2 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg2", ARGP_ARG2, ARGI_ARG2), +/* 17 */ /* AML_ARG3 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg3", ARGP_ARG3, ARGI_ARG3), +/* 18 */ /* AML_ARG4 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg4", ARGP_ARG4, ARGI_ARG4), +/* 19 */ /* AML_ARG5 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg5", ARGP_ARG5, ARGI_ARG5), +/* 1A */ /* AML_ARG6 */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_ARGUMENT| AML_NO_ARGS, "Arg6", ARGP_ARG6, ARGI_ARG6), +/* 1B */ /* AML_STORE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Store", ARGP_STORE_OP, ARGI_STORE_OP), +/* 1C */ /* AML_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "RefOf", ARGP_REF_OF_OP, ARGI_REF_OF_OP), +/* 1D */ /* AML_ADD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Add", ARGP_ADD_OP, ARGI_ADD_OP), +/* 1E */ /* AML_CONCAT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP), +/* 1F */ /* AML_SUBTRACT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP), +/* 20 */ /* AML_INCREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP), +/* 21 */ /* AML_DECREMENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP), +/* 22 */ /* AML_MULTIPLY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP), +/* 23 */ /* AML_DIVIDE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP), +/* 24 */ /* AML_SHIFT_LEFT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP), +/* 25 */ /* AML_SHIFT_RIGHT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP), +/* 26 */ /* AML_BIT_AND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "And", ARGP_BIT_AND_OP, ARGI_BIT_AND_OP), +/* 27 */ /* AML_BIT_NAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP), +/* 28 */ /* AML_BIT_OR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Or", ARGP_BIT_OR_OP, ARGI_BIT_OR_OP), +/* 29 */ /* AML_BIT_NOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "NOr", ARGP_BIT_NOR_OP, ARGI_BIT_NOR_OP), +/* 2A */ /* AML_BIT_XOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "XOr", ARGP_BIT_XOR_OP, ARGI_BIT_XOR_OP), +/* 2B */ /* AML_BIT_NOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Not", ARGP_BIT_NOT_OP, ARGI_BIT_NOT_OP), /* 2C */ /* AML_FIND_SET_LEFT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP, ARGI_FIND_SET_LEFT_BIT_OP), -/* 2D */ /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP, ARGI_FIND_SET_RIGHT_BIT_OP), -/* 2E */ /* AML_DEREF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), -/* 2F */ /* AML_NOTIFY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1| AML_HAS_ARGS, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), -/* 30 */ /* AML_SIZE_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), -/* 31 */ /* AML_INDEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX| AML_HAS_ARGS, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), -/* 32 */ /* AML_MATCH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH| AML_HAS_ARGS, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), -/* 33 */ /* AML_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateDWordField", ARGP_DWORD_FIELD_OP, ARGI_DWORD_FIELD_OP), -/* 34 */ /* AML_WORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateWordField", ARGP_WORD_FIELD_OP, ARGI_WORD_FIELD_OP), -/* 35 */ /* AML_BYTE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateByteField", ARGP_BYTE_FIELD_OP, ARGI_BYTE_FIELD_OP), -/* 36 */ /* AML_BIT_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateBitField", ARGP_BIT_FIELD_OP, ARGI_BIT_FIELD_OP), -/* 37 */ /* AML_TYPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP), -/* 38 */ /* AML_LAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LAnd", ARGP_LAND_OP, ARGI_LAND_OP), -/* 39 */ /* AML_LOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LOr", ARGP_LOR_OP, ARGI_LOR_OP), -/* 3A */ /* AML_LNOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "LNot", ARGP_LNOT_OP, ARGI_LNOT_OP), -/* 3B */ /* AML_LEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP), -/* 3C */ /* AML_LGREATER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP), -/* 3D */ /* AML_LLESS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LLess", ARGP_LLESS_OP, ARGI_LLESS_OP), -/* 3E */ /* AML_IF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "If", ARGP_IF_OP, ARGI_IF_OP), -/* 3F */ /* AML_ELSE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Else", ARGP_ELSE_OP, ARGI_ELSE_OP), -/* 40 */ /* AML_WHILE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "While", ARGP_WHILE_OP, ARGI_WHILE_OP), -/* 41 */ /* AML_NOOP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Noop", ARGP_NOOP_OP, ARGI_NOOP_OP), -/* 42 */ /* AML_RETURN_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), -/* 43 */ /* AML_BREAK_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), -/* 44 */ /* AML_BREAK_POINT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), -/* 45 */ /* AML_ONES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Ones", ARGP_ONES_OP, ARGI_ONES_OP), +/* 2D */ /* AML_FIND_SET_RIGHT_BIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP), +/* 2E */ /* AML_DEREF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP), +/* 2F */ /* AML_NOTIFY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC1| AML_HAS_ARGS, "Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP), +/* 30 */ /* AML_SIZE_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP), +/* 31 */ /* AML_INDEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_INDEX| AML_HAS_ARGS, "Index", ARGP_INDEX_OP, ARGI_INDEX_OP), +/* 32 */ /* AML_MATCH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MATCH| AML_HAS_ARGS, "Match", ARGP_MATCH_OP, ARGI_MATCH_OP), +/* 33 */ /* AML_CREATE_DWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP), +/* 34 */ /* AML_CREATE_WORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP), +/* 35 */ /* AML_CREATE_BYTE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP), +/* 36 */ /* AML_CREATE_BIT_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP), +/* 37 */ /* AML_TYPE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP), +/* 38 */ /* AML_LAND_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LAnd", ARGP_LAND_OP, ARGI_LAND_OP), +/* 39 */ /* AML_LOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LOr", ARGP_LOR_OP, ARGI_LOR_OP), +/* 3A */ /* AML_LNOT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2| AML_HAS_ARGS, "LNot", ARGP_LNOT_OP, ARGI_LNOT_OP), +/* 3B */ /* AML_LEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP), +/* 3C */ /* AML_LGREATER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP), +/* 3D */ /* AML_LLESS_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2| AML_HAS_ARGS, "LLess", ARGP_LLESS_OP, ARGI_LLESS_OP), +/* 3E */ /* AML_IF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "If", ARGP_IF_OP, ARGI_IF_OP), +/* 3F */ /* AML_ELSE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Else", ARGP_ELSE_OP, ARGI_ELSE_OP), +/* 40 */ /* AML_WHILE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "While", ARGP_WHILE_OP, ARGI_WHILE_OP), +/* 41 */ /* AML_NOOP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Noop", ARGP_NOOP_OP, ARGI_NOOP_OP), +/* 42 */ /* AML_RETURN_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_HAS_ARGS, "Return", ARGP_RETURN_OP, ARGI_RETURN_OP), +/* 43 */ /* AML_BREAK_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Break", ARGP_BREAK_OP, ARGI_BREAK_OP), +/* 44 */ /* AML_BREAK_POINT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP), +/* 45 */ /* AML_ONES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Ones", ARGP_ONES_OP, ARGI_ONES_OP), /* Prefixed opcodes (Two-byte opcodes with a prefix op) */ -/* 46 */ /* AML_MUTEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP), -/* 47 */ /* AML_EVENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_NO_ARGS, "Event", ARGP_EVENT_OP, ARGI_EVENT_OP), -/* 48 */ /* AML_COND_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP), -/* 49 */ /* AML_CREATE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP), -/* 4A */ /* AML_LOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load", ARGP_LOAD_OP, ARGI_LOAD_OP), -/* 4B */ /* AML_STALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Stall", ARGP_STALL_OP, ARGI_STALL_OP), -/* 4C */ /* AML_SLEEP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP), -/* 4D */ /* AML_ACQUIRE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2S| AML_HAS_ARGS, "Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP), -/* 4E */ /* AML_SIGNAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP), -/* 4F */ /* AML_WAIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2S| AML_HAS_ARGS, "Wait", ARGP_WAIT_OP, ARGI_WAIT_OP), -/* 50 */ /* AML_RESET_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Reset", ARGP_RESET_OP, ARGI_RESET_OP), -/* 51 */ /* AML_RELEASE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP), -/* 52 */ /* AML_FROM_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP), -/* 53 */ /* AML_TO_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP), -/* 54 */ /* AML_UNLOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP), -/* 55 */ /* AML_REVISION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), -/* 56 */ /* AML_DEBUG_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), -/* 57 */ /* AML_FATAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL| AML_HAS_ARGS, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), -/* 58 */ /* AML_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "OpRegion", ARGP_REGION_OP, ARGI_REGION_OP), -/* 59 */ /* AML_DEF_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Field", ARGP_DEF_FIELD_OP, ARGI_DEF_FIELD_OP), -/* 5A */ /* AML_DEVICE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), -/* 5B */ /* AML_PROCESSOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), -/* 5C */ /* AML_POWER_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), -/* 5D */ /* AML_THERMAL_ZONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), -/* 5E */ /* AML_INDEX_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), -/* 5F */ /* AML_BANK_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), +/* 46 */ /* AML_MUTEX_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Mutex", ARGP_MUTEX_OP, ARGI_MUTEX_OP), +/* 47 */ /* AML_EVENT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_NO_ARGS, "Event", ARGP_EVENT_OP, ARGI_EVENT_OP), +/* 48 */ /* AML_COND_REF_OF_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP), +/* 49 */ /* AML_CREATE_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP), +/* 4A */ /* AML_LOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Load", ARGP_LOAD_OP, ARGI_LOAD_OP), +/* 4B */ /* AML_STALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Stall", ARGP_STALL_OP, ARGI_STALL_OP), +/* 4C */ /* AML_SLEEP_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP), +/* 4D */ /* AML_ACQUIRE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2S| AML_HAS_ARGS, "Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP), +/* 4E */ /* AML_SIGNAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP), +/* 4F */ /* AML_WAIT_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2S| AML_HAS_ARGS, "Wait", ARGP_WAIT_OP, ARGI_WAIT_OP), +/* 50 */ /* AML_RESET_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Reset", ARGP_RESET_OP, ARGI_RESET_OP), +/* 51 */ /* AML_RELEASE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC1| AML_HAS_ARGS, "Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP), +/* 52 */ /* AML_FROM_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP), +/* 53 */ /* AML_TO_BCD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToBCD", ARGP_TO_BCD_OP, ARGI_TO_BCD_OP), +/* 54 */ /* AML_UNLOAD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RECONFIGURATION| AML_HAS_ARGS, "Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP), +/* 55 */ /* AML_REVISION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Revision", ARGP_REVISION_OP, ARGI_REVISION_OP), +/* 56 */ /* AML_DEBUG_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONSTANT| AML_NO_ARGS, "Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP), +/* 57 */ /* AML_FATAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_FATAL| AML_HAS_ARGS, "Fatal", ARGP_FATAL_OP, ARGI_FATAL_OP), +/* 58 */ /* AML_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "OpRegion", ARGP_REGION_OP, ARGI_REGION_OP), +/* 59 */ /* AML_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Field", ARGP_FIELD_OP, ARGI_FIELD_OP), +/* 5A */ /* AML_DEVICE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP), +/* 5B */ /* AML_PROCESSOR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP), +/* 5C */ /* AML_POWER_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP), +/* 5D */ /* AML_THERMAL_ZONE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "ThermalZone", ARGP_THERMAL_ZONE_OP, ARGI_THERMAL_ZONE_OP), +/* 5E */ /* AML_INDEX_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP), +/* 5F */ /* AML_BANK_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_NAMED_OBJECT| AML_HAS_ARGS, "BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP), /* Internal opcodes that map to invalid AML opcodes */ -/* 60 */ /* AML_LNOTEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP), -/* 61 */ /* AML_LLESSEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP), -/* 62 */ /* AML_LGREATEREQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP), -/* 63 */ /* AML_NAMEPATH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "NamePath", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP), -/* 64 */ /* AML_METHODCALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL| AML_HAS_ARGS, "MethodCall", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP), -/* 65 */ /* AML_BYTELIST_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "ByteList", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP), -/* 66 */ /* AML_RESERVEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "ReservedField", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP), -/* 67 */ /* AML_NAMEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "NamedField", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP), -/* 68 */ /* AML_ACCESSFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "AccessField", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP), -/* 69 */ /* AML_STATICSTRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP), -/* 6A */ /* AML_RETURN_VALUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN| AML_HAS_ARGS, "[Return Value]", ARG_NONE, ARG_NONE), -/* 6B */ /* UNKNOWN OPCODES */ OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS| AML_HAS_ARGS, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), -/* 6C */ /* ASCII CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII | OPTYPE_BOGUS| AML_HAS_ARGS, "ASCII_ONLY!", ARG_NONE, ARG_NONE), -/* 6D */ /* PREFIX CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS| AML_HAS_ARGS, "PREFIX_ONLY!", ARG_NONE, ARG_NONE), +/* 60 */ /* AML_LNOTEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP), +/* 61 */ /* AML_LLESSEQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP), +/* 62 */ /* AML_LGREATEREQUAL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_HAS_ARGS, "LGreaterEqual", ARGP_LGREATEREQUAL_OP, ARGI_LGREATEREQUAL_OP), +/* 63 */ /* AML_INT_NAMEPATH_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "NamePath", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP), +/* 64 */ /* AML_INT_METHODCALL_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_METHOD_CALL| AML_HAS_ARGS, "MethodCall", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP), +/* 65 */ /* AML_INT_BYTELIST_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "ByteList", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP), +/* 66 */ /* AML_INT_RESERVEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "ReservedField", ARGP_RESERVEDFIELD_OP, ARGI_RESERVEDFIELD_OP), +/* 67 */ /* AML_INT_NAMEDFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "NamedField", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP), +/* 68 */ /* AML_INT_ACCESSFIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "AccessField", ARGP_ACCESSFIELD_OP, ARGI_ACCESSFIELD_OP), +/* 69 */ /* AML_INT_STATICSTRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_BOGUS| AML_NO_ARGS, "StaticString", ARGP_STATICSTRING_OP, ARGI_STATICSTRING_OP), +/* 6A */ /* AML_INT_RETURN_VALUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_RETURN| AML_HAS_ARGS, "[Return Value]", ARG_NONE, ARG_NONE), +/* 6B */ /* UNKNOWN OPCODES */ OP_INFO_ENTRY (ACPI_OP_TYPE_UNKNOWN | OPTYPE_BOGUS| AML_HAS_ARGS, "UNKNOWN_OP!", ARG_NONE, ARG_NONE), +/* 6C */ /* ASCII CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_ASCII | OPTYPE_BOGUS| AML_HAS_ARGS, "ASCII_ONLY!", ARG_NONE, ARG_NONE), +/* 6D */ /* PREFIX CHARACTERS */ OP_INFO_ENTRY (ACPI_OP_TYPE_PREFIX | OPTYPE_BOGUS| AML_HAS_ARGS, "PREFIX_ONLY!", ARG_NONE, ARG_NONE), /* ACPI 2.0 (new) opcodes */ -/* 6E */ /* AML_QWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP), -/* 6F */ /* AML_VAR_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "VarPackage", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP), -/* 70 */ /* AML_CONCAT_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ConcatRes", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP), -/* 71 */ /* AML_MOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Mod", ARGP_MOD_OP, ARGI_MOD_OP), -/* 72 */ /* AML_QWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateQWordField", ARGP_QWORD_FIELD_OP, ARGI_QWORD_FIELD_OP), -/* 73 */ /* AML_TO_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP), -/* 74 */ /* AML_TO_DEC_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToDecString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP), -/* 75 */ /* AML_TO_HEX_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP), -/* 76 */ /* AML_TO_INTEGER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP), -/* 77 */ /* AML_TO_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP), -/* 78 */ /* AML_COPY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Copy", ARGP_COPY_OP, ARGI_COPY_OP), -/* 79 */ /* AML_MID_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Mid", ARGP_MID_OP, ARGI_MID_OP), -/* 7A */ /* AML_CONTINUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP), -/* 7B */ /* AML_LOAD_TABLE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP), -/* 7C */ /* AML_DATA_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "DataOpRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP), +/* 6E */ /* AML_QWORD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_LITERAL| AML_NO_ARGS, "QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP), +/* 6F */ /* AML_VAR_PACKAGE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DATA_TERM| AML_HAS_ARGS, "VarPackage", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP), +/* 70 */ /* AML_CONCAT_RES_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "ConcatRes", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP), +/* 71 */ /* AML_MOD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_DYADIC2R| AML_HAS_ARGS, "Mod", ARGP_MOD_OP, ARGI_MOD_OP), +/* 72 */ /* AML_CREATE_QWORD_FIELD_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CREATE_FIELD| AML_HAS_ARGS, "CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP), +/* 73 */ /* AML_TO_BUFFER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP), +/* 74 */ /* AML_TO_DEC_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToDecString", ARGP_TO_DEC_STR_OP, ARGI_TO_DEC_STR_OP), +/* 75 */ /* AML_TO_HEX_STR_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP), +/* 76 */ /* AML_TO_INTEGER_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP), +/* 77 */ /* AML_TO_STRING_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP), +/* 78 */ /* AML_COPY_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "CopyObject", ARGP_COPY_OP, ARGI_COPY_OP), +/* 79 */ /* AML_MID_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "Mid", ARGP_MID_OP, ARGI_MID_OP), +/* 7A */ /* AML_CONTINUE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_CONTROL| AML_NO_ARGS, "Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP), +/* 7B */ /* AML_LOAD_TABLE_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP), +/* 7C */ /* AML_DATA_REGION_OP */ OP_INFO_ENTRY (ACPI_OP_TYPE_OPCODE | OPTYPE_MONADIC2R| AML_HAS_ARGS, "DataOpRegion", ARGP_DATA_REGION_OP, ARGI_DATA_REGION_OP), }; @@ -658,6 +658,9 @@ AcpiPsGetOpcodeInfo ( UINT8 LowerOpcode; + PROC_NAME ("PsGetOpcodeInfo"); + + /* Split the 16-bit opcode into separate bytes */ UpperOpcode = (UINT8) (Opcode >> 8); @@ -698,17 +701,13 @@ AcpiPsGetOpcodeInfo ( /* This case is for the bogus opcodes LNOTEQUAL, LLESSEQUAL, LGREATEREQUAL */ /* TBD: [Investigate] remove this case? */ - DEBUG_PRINT (ACPI_ERROR, ("PsGetOpcodeInfo: Bad multi-byte opcode=%X\n", - Opcode)); - + DEBUG_PRINTP (ACPI_ERROR, ("Bad multi-byte opcode=%X\n", Opcode)); break; default: - DEBUG_PRINT (ACPI_ERROR, ("PsGetOpcodeInfo: Unknown extended opcode=%X\n", - Opcode)); - + DEBUG_PRINTP (ACPI_ERROR, ("Unknown extended opcode=%X\n", Opcode)); break; } diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index 78443bc..fc68ef4 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 74 $ + * $Revision: 85 $ * *****************************************************************************/ @@ -130,8 +130,9 @@ #include "amlcode.h" #include "acnamesp.h" #include "acdebug.h" +#include "acinterp.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psparse") @@ -203,9 +204,9 @@ AcpiPsPeekOpcode ( * * if (Opcode == AML_EXTOP * || (Opcode == AML_LNOT - * && (GET8 (AcpiAml) == AML_LEQUAL - * || GET8 (AcpiAml) == AML_LGREATER - * || GET8 (AcpiAml) == AML_LLESS))) + * && (GET8 (Aml) == AML_LEQUAL + * || GET8 (Aml) == AML_LGREATER + * || GET8 (Aml) == AML_LLESS))) * * extended Opcode, !=, <=, or >= */ @@ -228,8 +229,8 @@ AcpiPsPeekOpcode ( * * FUNCTION: AcpiPsCreateState * - * PARAMETERS: AcpiAml - AcpiAml code pointer - * AcpiAmlSize - Length of AML code + * PARAMETERS: Aml - Aml code pointer + * AmlSize - Length of AML code * * RETURN: A new parser state object * @@ -248,10 +249,10 @@ AcpiPsCreateState ( FUNCTION_TRACE ("PsCreateState"); - ParserState = AcpiCmCallocate (sizeof (ACPI_PARSE_STATE)); + ParserState = AcpiUtCallocate (sizeof (ACPI_PARSE_STATE)); if (!ParserState) { - return_VALUE (NULL); + return_PTR (NULL); } ParserState->Aml = Aml; @@ -362,7 +363,7 @@ AcpiPsCompleteThisOp ( (OpcodeClass != OPTYPE_LOCAL_VARIABLE) && (OpcodeClass != OPTYPE_METHOD_ARGUMENT) && (OpcodeClass != OPTYPE_DATA_TERM) && - (Op->Opcode != AML_NAMEPATH_OP)) + (Op->Opcode != AML_INT_NAMEPATH_OP)) { /* Make sure that we only delete this subtree */ @@ -387,15 +388,15 @@ AcpiPsCompleteThisOp ( * op must be replace by a placeholder return op */ - if ((Op->Parent->Opcode == AML_REGION_OP) || - (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || - (Op->Parent->Opcode == AML_BIT_FIELD_OP) || - (Op->Parent->Opcode == AML_BYTE_FIELD_OP) || - (Op->Parent->Opcode == AML_WORD_FIELD_OP) || - (Op->Parent->Opcode == AML_DWORD_FIELD_OP) || - (Op->Parent->Opcode == AML_QWORD_FIELD_OP)) + if ((Op->Parent->Opcode == AML_REGION_OP) || + (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_BYTE_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_WORD_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_DWORD_FIELD_OP) || + (Op->Parent->Opcode == AML_CREATE_QWORD_FIELD_OP)) { - ReplacementOp = AcpiPsAllocOp (AML_RETURN_VALUE_OP); + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { return_VALUE (FALSE); @@ -405,7 +406,7 @@ AcpiPsCompleteThisOp ( break; default: - ReplacementOp = AcpiPsAllocOp (AML_RETURN_VALUE_OP); + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { return_VALUE (FALSE); @@ -621,7 +622,7 @@ AcpiPsParseLoop ( ACPI_PARSE2_OBJECT *DeferredOp; UINT32 ArgCount; /* push for fixed or var args */ UINT32 ArgTypes = 0; - ACPI_PTRDIFF AmlOffset; + UINT32 AmlOffset; UINT16 Opcode; ACPI_PARSE_OBJECT PreOp; ACPI_PARSE_STATE *ParserState; @@ -663,14 +664,13 @@ AcpiPsParseLoop ( { if (Status == AE_AML_NO_RETURN_VALUE) { - DEBUG_PRINT (ACPI_ERROR, - ("PsParseLoop: Invoked method did not return a value, %s\n", - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, + ("Invoked method did not return a value, %s\n", + AcpiUtFormatException (Status))); } - DEBUG_PRINT (ACPI_ERROR, - ("PsParseLoop: GetPredicate Failed, %s\n", - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("GetPredicate Failed, %s\n", + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -678,7 +678,7 @@ AcpiPsParseLoop ( } AcpiPsPopScope (ParserState, &Op, &ArgTypes, &ArgCount); - DEBUG_PRINT (TRACE_PARSE, ("ParseLoop: Popped scope, Op=%p\n", Op)); + DEBUG_PRINTP (TRACE_PARSE, ("Popped scope, Op=%p\n", Op)); } else if (WalkState->PrevOp) @@ -729,7 +729,7 @@ AcpiPsParseLoop ( * string. Convert the bare name string to a namepath. */ - Opcode = AML_NAMEPATH_OP; + Opcode = AML_INT_NAMEPATH_OP; ArgTypes = ARGP_NAMESTRING; break; @@ -737,8 +737,8 @@ AcpiPsParseLoop ( /* The opcode is unrecognized. Just skip unknown opcodes */ - DEBUG_PRINT (ACPI_ERROR, - ("ParseLoop: Found unknown opcode %lX at AML offset %X, ignoring\n", + DEBUG_PRINTP (ACPI_ERROR, + ("Found unknown opcode %lX at AML offset %X, ignoring\n", Opcode, AmlOffset)); DUMP_BUFFER (ParserState->Aml, 128); @@ -835,11 +835,12 @@ AcpiPsParseLoop ( } - if ((Op->Opcode == AML_CREATE_FIELD_OP) || - (Op->Opcode == AML_BIT_FIELD_OP) || - (Op->Opcode == AML_BYTE_FIELD_OP) || - (Op->Opcode == AML_WORD_FIELD_OP) || - (Op->Opcode == AML_DWORD_FIELD_OP)) + if ((Op->Opcode == AML_CREATE_FIELD_OP) || + (Op->Opcode == AML_CREATE_BIT_FIELD_OP) || + (Op->Opcode == AML_CREATE_BYTE_FIELD_OP) || + (Op->Opcode == AML_CREATE_WORD_FIELD_OP) || + (Op->Opcode == AML_CREATE_DWORD_FIELD_OP) || + (Op->Opcode == AML_CREATE_QWORD_FIELD_OP)) { /* * Backup to beginning of CreateXXXfield declaration @@ -878,8 +879,8 @@ AcpiPsParseLoop ( if (OpInfo) { - DEBUG_PRINT (TRACE_PARSE, - ("ParseLoop: Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n", + DEBUG_PRINTP (TRACE_PARSE, + ("Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n", Op, Op->Opcode, ParserState->Aml, Op->AmlOffset)); } } @@ -907,7 +908,7 @@ AcpiPsParseLoop ( GET_CURRENT_ARG_TYPE (ArgTypes), Op); break; - case AML_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ + case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ AcpiPsGetNextNamepath (ParserState, Op, &ArgCount, 1); ArgTypes = 0; @@ -948,8 +949,8 @@ AcpiPsParseLoop ( */ DeferredOp->Data = ParserState->Aml; - DeferredOp->Length = ParserState->PkgEnd - - ParserState->Aml; + DeferredOp->Length = (UINT32) (ParserState->PkgEnd - + ParserState->Aml); /* * Skip body of method. For OpRegions, we must continue @@ -994,18 +995,18 @@ AcpiPsParseLoop ( * know the length. */ - DeferredOp->Length = ParserState->Aml - - DeferredOp->Data; + DeferredOp->Length = (UINT32) (ParserState->Aml - + DeferredOp->Data); } } } - if ((Op->Opcode == AML_CREATE_FIELD_OP) || - (Op->Opcode == AML_BIT_FIELD_OP) || - (Op->Opcode == AML_BYTE_FIELD_OP) || - (Op->Opcode == AML_WORD_FIELD_OP) || - (Op->Opcode == AML_DWORD_FIELD_OP) || - (Op->Opcode == AML_QWORD_FIELD_OP)) + if ((Op->Opcode == AML_CREATE_FIELD_OP) || + (Op->Opcode == AML_CREATE_BIT_FIELD_OP) || + (Op->Opcode == AML_CREATE_BYTE_FIELD_OP) || + (Op->Opcode == AML_CREATE_WORD_FIELD_OP) || + (Op->Opcode == AML_CREATE_DWORD_FIELD_OP) || + (Op->Opcode == AML_CREATE_QWORD_FIELD_OP)) { /* * Backup to beginning of CreateXXXfield declaration (1 for @@ -1014,7 +1015,8 @@ AcpiPsParseLoop ( * BodyLength is unknown until we parse the body */ DeferredOp = (ACPI_PARSE2_OBJECT *) Op; - DeferredOp->Length = ParserState->Aml - DeferredOp->Data; + DeferredOp->Length = (UINT32) (ParserState->Aml - + DeferredOp->Data); } /* This op complete, notify the dispatcher */ @@ -1118,7 +1120,7 @@ CloseThisOp: if (AcpiPsHasCompletedScope (ParserState)) { AcpiPsPopScope (ParserState, &Op, &ArgTypes, &ArgCount); - DEBUG_PRINT (TRACE_PARSE, ("ParseLoop: Popped scope, Op=%p\n", Op)); + DEBUG_PRINTP (TRACE_PARSE, ("Popped scope, Op=%p\n", Op)); } else @@ -1149,7 +1151,7 @@ CloseThisOp: * sequential closing braces). We want to terminate each one cleanly. */ - DEBUG_PRINT (TRACE_PARSE, ("PsParseLoop: Package complete at Op %p\n", Op)); + DEBUG_PRINTP (TRACE_PARSE, ("Package complete at Op %p\n", Op)); do { if (Op) @@ -1240,8 +1242,7 @@ AcpiPsParseAml ( FUNCTION_TRACE ("PsParseAml"); - DEBUG_PRINT (TRACE_PARSE, - ("PsParseAml: Entered with Scope=%p Aml=%p size=%lX\n", + DEBUG_PRINTP (TRACE_PARSE, ("Entered with Scope=%p Aml=%p size=%lX\n", StartScope, Aml, AmlSize)); @@ -1263,8 +1264,11 @@ AcpiPsParseAml ( /* Create and initialize a new walk list */ WalkList.WalkState = NULL; + WalkList.AcquiredMutexList.Prev = NULL; + WalkList.AcquiredMutexList.Next = NULL; - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, ParserState->StartOp, MthDesc, &WalkList); + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, ParserState->StartOp, + MthDesc, &WalkList); if (!WalkState) { Status = AE_NO_MEMORY; @@ -1330,8 +1334,7 @@ AcpiPsParseAml ( * handles nested control method invocations without recursion. */ - DEBUG_PRINT (TRACE_PARSE, ("PsParseAml: State=%p\n", - WalkState)); + DEBUG_PRINTP (TRACE_PARSE, ("State=%p\n", WalkState)); while (WalkState) { @@ -1340,9 +1343,8 @@ AcpiPsParseAml ( Status = AcpiPsParseLoop (WalkState); } - DEBUG_PRINT (TRACE_PARSE, - ("PsParseAml: Completed one call to walk loop, State=%p\n", - WalkState)); + DEBUG_PRINTP (TRACE_PARSE, + ("Completed one call to walk loop, State=%p\n", WalkState)); if (Status == AE_CTRL_TRANSFER) { @@ -1376,8 +1378,7 @@ AcpiPsParseAml ( ReturnDesc = WalkState->ReturnDesc; - DEBUG_PRINT (TRACE_PARSE, - ("PsParseAml: ReturnValue=%p, State=%p\n", + DEBUG_PRINTP (TRACE_PARSE, ("ReturnValue=%p, State=%p\n", WalkState->ReturnDesc, WalkState)); /* Reset the current scope to the beginning of scope stack */ @@ -1397,7 +1398,7 @@ AcpiPsParseAml ( /* Delete this walk state and all linked control states */ AcpiPsCleanupScope (WalkState->ParserState); - AcpiCmFree (WalkState->ParserState); + AcpiUtFree (WalkState->ParserState); AcpiDsDeleteWalkState (WalkState); /* Check if we have restarted a preempted walk */ @@ -1431,13 +1432,14 @@ AcpiPsParseAml ( { /* Caller doesn't want it, must delete it */ - AcpiCmRemoveReference (ReturnDesc); + AcpiUtRemoveReference (ReturnDesc); } } /* Normal exit */ + AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *) &WalkList.AcquiredMutexList); AcpiGbl_CurrentWalkList = PrevWalkList; return_ACPI_STATUS (Status); @@ -1448,8 +1450,9 @@ Cleanup: AcpiDsDeleteWalkState (WalkState); AcpiPsCleanupScope (ParserState); - AcpiCmFree (ParserState); + AcpiUtFree (ParserState); + AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *)&WalkList.AcquiredMutexList); AcpiGbl_CurrentWalkList = PrevWalkList; return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/psscope.c b/sys/contrib/dev/acpica/psscope.c index 5e91b74..ff1148f 100644 --- a/sys/contrib/dev/acpica/psscope.c +++ b/sys/contrib/dev/acpica/psscope.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psscope - Parser scope stack management routines - * $Revision: 24 $ + * $Revision: 27 $ * *****************************************************************************/ @@ -118,7 +118,7 @@ #include "acpi.h" #include "acparser.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psscope") @@ -189,7 +189,7 @@ AcpiPsInitScope ( FUNCTION_TRACE_PTR ("PsInitScope", RootOp); - Scope = AcpiCmCreateGenericState (); + Scope = AcpiUtCreateGenericState (); if (!Scope) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -235,7 +235,7 @@ AcpiPsPushScope ( FUNCTION_TRACE_PTR ("PsPushScope", Op); - Scope = AcpiCmCreateGenericState (); + Scope = AcpiUtCreateGenericState (); if (!Scope) { return (AE_NO_MEMORY); @@ -249,7 +249,7 @@ AcpiPsPushScope ( /* Push onto scope stack */ - AcpiCmPushGenericState (&ParserState->Scope, Scope); + AcpiUtPushGenericState (&ParserState->Scope, Scope); if (ArgCount == ACPI_VAR_ARGS) @@ -303,7 +303,7 @@ AcpiPsPopScope ( */ if (Scope->Common.Next) { - Scope = AcpiCmPopGenericState (&ParserState->Scope); + Scope = AcpiUtPopGenericState (&ParserState->Scope); /* return to parsing previous op */ @@ -315,7 +315,7 @@ AcpiPsPopScope ( /* All done with this scope state structure */ - AcpiCmDeleteGenericState (Scope); + AcpiUtDeleteGenericState (Scope); } else @@ -328,8 +328,7 @@ AcpiPsPopScope ( } - DEBUG_PRINT (TRACE_PARSE, - ("PsPopScope: Popped Op %p Args %X\n", *Op, *ArgCount)); + DEBUG_PRINTP (TRACE_PARSE, ("Popped Op %p Args %X\n", *Op, *ArgCount)); return_VOID; } @@ -366,8 +365,8 @@ AcpiPsCleanupScope ( while (ParserState->Scope) { - Scope = AcpiCmPopGenericState (&ParserState->Scope); - AcpiCmDeleteGenericState (Scope); + Scope = AcpiUtPopGenericState (&ParserState->Scope); + AcpiUtDeleteGenericState (Scope); } return_VOID; diff --git a/sys/contrib/dev/acpica/pstree.c b/sys/contrib/dev/acpica/pstree.c index 2f7cf49..c6478b4 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: 27 $ + * $Revision: 30 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "acparser.h" #include "amlcode.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("pstree") @@ -283,7 +283,7 @@ AcpiPsGetChild ( case AML_ELSE_OP: case AML_DEVICE_OP: case AML_THERMAL_ZONE_OP: - case AML_METHODCALL_OP: + case AML_INT_METHODCALL_OP: Child = AcpiPsGetArg (Op, 0); break; @@ -294,7 +294,7 @@ AcpiPsGetChild ( case AML_METHOD_OP: case AML_IF_OP: case AML_WHILE_OP: - case AML_DEF_FIELD_OP: + case AML_FIELD_OP: Child = AcpiPsGetArg (Op, 1); break; diff --git a/sys/contrib/dev/acpica/psutils.c b/sys/contrib/dev/acpica/psutils.c index e49b9a1..e22ea74 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: 32 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -119,7 +119,7 @@ #include "acparser.h" #include "amlcode.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psutils") @@ -185,6 +185,9 @@ AcpiPsAllocOp ( UINT8 Flags; + PROC_NAME ("PsAllocOp"); + + /* Allocate the minimum required size object */ if (AcpiPsIsDeferredOp (Opcode)) @@ -221,7 +224,7 @@ AcpiPsAllocOp ( * Check if there is an Op already available in the cache */ - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_ParseCacheRequests++; if (AcpiGbl_ParseCache) { @@ -235,17 +238,16 @@ AcpiPsAllocOp ( if (Op->DataType == 0xFF) { - DEBUG_PRINT (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op)); + DEBUG_PRINTP (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op)); } /* Clear the previously used Op */ MEMSET (Op, 0, sizeof (ACPI_PARSE_OBJECT)); - DEBUG_PRINT (TRACE_PARSE, - ("PsAllocOp: Op %p from Parse Cache\n", Op)); + DEBUG_PRINTP (TRACE_PARSE, ("Op %p from Parse Cache\n", Op)); } - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); } else @@ -257,7 +259,7 @@ AcpiPsAllocOp ( * Check if there is an Op already available in the cache */ - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_ExtParseCacheRequests++; if (AcpiGbl_ExtParseCache) { @@ -271,17 +273,16 @@ AcpiPsAllocOp ( if (Op->DataType == 0xFF) { - DEBUG_PRINT (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op)); + DEBUG_PRINTP (ACPI_ERROR, ("Op %p deleted while in cache!\n", Op)); } /* Clear the previously used Op */ MEMSET (Op, 0, sizeof (ACPI_PARSE2_OBJECT)); - DEBUG_PRINT (TRACE_PARSE, - ("PsAllocOp: Op %p from ExtParse Cache\n", Op)); + DEBUG_PRINTP (TRACE_PARSE, ("Op %p from ExtParse Cache\n", Op)); } - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); } @@ -289,7 +290,7 @@ AcpiPsAllocOp ( if (!Op) { - Op = AcpiCmCallocate (Size); + Op = AcpiUtCallocate (Size); } /* Initialize the Op */ @@ -320,11 +321,12 @@ void AcpiPsFreeOp ( ACPI_PARSE_OBJECT *Op) { + PROC_NAME ("PsFreeOp"); - if (Op->Opcode == AML_RETURN_VALUE_OP) + if (Op->Opcode == AML_INT_RETURN_VALUE_OP) { - DEBUG_PRINT (ACPI_INFO, ("Free retval op: %p\n", Op)); + DEBUG_PRINTP (ACPI_INFO, ("Free retval op: %p\n", Op)); } if (Op->Flags == PARSEOP_GENERIC) @@ -340,13 +342,13 @@ AcpiPsFreeOp ( MEMSET (Op, 0, sizeof (ACPI_PARSE_OBJECT)); Op->Flags = PARSEOP_IN_CACHE; - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_ParseCacheDepth++; Op->Next = AcpiGbl_ParseCache; AcpiGbl_ParseCache = Op; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); return; } } @@ -364,13 +366,13 @@ AcpiPsFreeOp ( MEMSET (Op, 0, sizeof (ACPI_PARSE2_OBJECT)); Op->Flags = PARSEOP_IN_CACHE; - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_ExtParseCacheDepth++; Op->Next = (ACPI_PARSE_OBJECT *) AcpiGbl_ExtParseCache; AcpiGbl_ExtParseCache = (ACPI_PARSE2_OBJECT *) Op; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); return; } } @@ -380,7 +382,7 @@ AcpiPsFreeOp ( * Not a GENERIC OP, or the cache is full, just free the Op */ - AcpiCmFree (Op); + AcpiUtFree (Op); } @@ -413,7 +415,7 @@ AcpiPsDeleteParseCache ( /* Delete one cached state object */ Next = AcpiGbl_ParseCache->Next; - AcpiCmFree (AcpiGbl_ParseCache); + AcpiUtFree (AcpiGbl_ParseCache); AcpiGbl_ParseCache = Next; AcpiGbl_ParseCacheDepth--; } @@ -425,7 +427,7 @@ AcpiPsDeleteParseCache ( /* Delete one cached state object */ Next = AcpiGbl_ExtParseCache->Next; - AcpiCmFree (AcpiGbl_ExtParseCache); + AcpiUtFree (AcpiGbl_ExtParseCache); AcpiGbl_ExtParseCache = (ACPI_PARSE2_OBJECT *) Next; AcpiGbl_ExtParseCacheDepth--; } @@ -476,28 +478,29 @@ AcpiPsIsNamespaceObjectOp ( UINT16 Opcode) { return ((BOOLEAN) - (Opcode == AML_SCOPE_OP || - Opcode == AML_DEVICE_OP || - Opcode == AML_THERMAL_ZONE_OP || - Opcode == AML_METHOD_OP || - Opcode == AML_POWER_RES_OP || - Opcode == AML_PROCESSOR_OP || - Opcode == AML_DEF_FIELD_OP || - Opcode == AML_INDEX_FIELD_OP || - Opcode == AML_BANK_FIELD_OP || - Opcode == AML_NAMEDFIELD_OP || - Opcode == AML_NAME_OP || - Opcode == AML_ALIAS_OP || - Opcode == AML_MUTEX_OP || - Opcode == AML_EVENT_OP || - Opcode == AML_REGION_OP || - Opcode == AML_CREATE_FIELD_OP || - Opcode == AML_BIT_FIELD_OP || - Opcode == AML_BYTE_FIELD_OP || - Opcode == AML_WORD_FIELD_OP || - Opcode == AML_DWORD_FIELD_OP || - Opcode == AML_METHODCALL_OP || - Opcode == AML_NAMEPATH_OP)); + (Opcode == AML_SCOPE_OP || + Opcode == AML_DEVICE_OP || + Opcode == AML_THERMAL_ZONE_OP || + Opcode == AML_METHOD_OP || + Opcode == AML_POWER_RES_OP || + Opcode == AML_PROCESSOR_OP || + Opcode == AML_FIELD_OP || + Opcode == AML_INDEX_FIELD_OP || + Opcode == AML_BANK_FIELD_OP || + Opcode == AML_INT_NAMEDFIELD_OP || + Opcode == AML_NAME_OP || + Opcode == AML_ALIAS_OP || + Opcode == AML_MUTEX_OP || + Opcode == AML_EVENT_OP || + Opcode == AML_REGION_OP || + Opcode == AML_CREATE_FIELD_OP || + Opcode == AML_CREATE_BIT_FIELD_OP || + Opcode == AML_CREATE_BYTE_FIELD_OP || + Opcode == AML_CREATE_WORD_FIELD_OP || + Opcode == AML_CREATE_DWORD_FIELD_OP || + Opcode == AML_CREATE_QWORD_FIELD_OP || + Opcode == AML_INT_METHODCALL_OP || + Opcode == AML_INT_NAMEPATH_OP)); } BOOLEAN @@ -511,7 +514,7 @@ AcpiPsIsNamespaceOp ( Opcode == AML_METHOD_OP || Opcode == AML_POWER_RES_OP || Opcode == AML_PROCESSOR_OP || - Opcode == AML_DEF_FIELD_OP || + Opcode == AML_FIELD_OP || Opcode == AML_INDEX_FIELD_OP || Opcode == AML_BANK_FIELD_OP || Opcode == AML_NAME_OP || @@ -519,7 +522,7 @@ AcpiPsIsNamespaceOp ( Opcode == AML_MUTEX_OP || Opcode == AML_EVENT_OP || Opcode == AML_REGION_OP || - Opcode == AML_NAMEDFIELD_OP)); + Opcode == AML_INT_NAMEDFIELD_OP)); } @@ -534,27 +537,28 @@ AcpiPsIsNodeOp ( UINT16 Opcode) { return ((BOOLEAN) - (Opcode == AML_SCOPE_OP || - Opcode == AML_DEVICE_OP || - Opcode == AML_THERMAL_ZONE_OP || - Opcode == AML_METHOD_OP || - Opcode == AML_POWER_RES_OP || - Opcode == AML_PROCESSOR_OP || - Opcode == AML_NAMEDFIELD_OP || - Opcode == AML_NAME_OP || - Opcode == AML_ALIAS_OP || - Opcode == AML_MUTEX_OP || - Opcode == AML_EVENT_OP || - Opcode == AML_REGION_OP || - - - Opcode == AML_CREATE_FIELD_OP || - Opcode == AML_BIT_FIELD_OP || - Opcode == AML_BYTE_FIELD_OP || - Opcode == AML_WORD_FIELD_OP || - Opcode == AML_DWORD_FIELD_OP || - Opcode == AML_METHODCALL_OP || - Opcode == AML_NAMEPATH_OP)); + (Opcode == AML_SCOPE_OP || + Opcode == AML_DEVICE_OP || + Opcode == AML_THERMAL_ZONE_OP || + Opcode == AML_METHOD_OP || + Opcode == AML_POWER_RES_OP || + Opcode == AML_PROCESSOR_OP || + Opcode == AML_INT_NAMEDFIELD_OP || + Opcode == AML_NAME_OP || + Opcode == AML_ALIAS_OP || + Opcode == AML_MUTEX_OP || + Opcode == AML_EVENT_OP || + Opcode == AML_REGION_OP || + + + Opcode == AML_CREATE_FIELD_OP || + Opcode == AML_CREATE_BIT_FIELD_OP || + Opcode == AML_CREATE_BYTE_FIELD_OP || + Opcode == AML_CREATE_WORD_FIELD_OP || + Opcode == AML_CREATE_DWORD_FIELD_OP || + Opcode == AML_CREATE_QWORD_FIELD_OP || + Opcode == AML_INT_METHODCALL_OP || + Opcode == AML_INT_NAMEPATH_OP)); } @@ -577,7 +581,7 @@ AcpiPsIsNamedOp ( Opcode == AML_MUTEX_OP || Opcode == AML_EVENT_OP || Opcode == AML_REGION_OP || - Opcode == AML_NAMEDFIELD_OP)); + Opcode == AML_INT_NAMEDFIELD_OP)); } @@ -586,12 +590,13 @@ AcpiPsIsDeferredOp ( UINT16 Opcode) { return ((BOOLEAN) - (Opcode == AML_METHOD_OP || - Opcode == AML_CREATE_FIELD_OP || - Opcode == AML_BIT_FIELD_OP || - Opcode == AML_BYTE_FIELD_OP || - Opcode == AML_WORD_FIELD_OP || - Opcode == AML_DWORD_FIELD_OP || + (Opcode == AML_METHOD_OP || + Opcode == AML_CREATE_FIELD_OP || + Opcode == AML_CREATE_BIT_FIELD_OP || + Opcode == AML_CREATE_BYTE_FIELD_OP || + Opcode == AML_CREATE_WORD_FIELD_OP || + Opcode == AML_CREATE_DWORD_FIELD_OP || + Opcode == AML_CREATE_QWORD_FIELD_OP || Opcode == AML_REGION_OP)); } @@ -603,7 +608,7 @@ BOOLEAN AcpiPsIsBytelistOp ( UINT16 Opcode) { - return ((BOOLEAN) (Opcode == AML_BYTELIST_OP)); + return ((BOOLEAN) (Opcode == AML_INT_BYTELIST_OP)); } @@ -616,7 +621,7 @@ AcpiPsIsFieldOp ( { return ((BOOLEAN) (Opcode == AML_CREATE_FIELD_OP - || Opcode == AML_DEF_FIELD_OP + || Opcode == AML_FIELD_OP || Opcode == AML_INDEX_FIELD_OP || Opcode == AML_BANK_FIELD_OP)); } @@ -630,11 +635,12 @@ AcpiPsIsCreateFieldOp ( UINT16 Opcode) { return ((BOOLEAN) - (Opcode == AML_CREATE_FIELD_OP || - Opcode == AML_BIT_FIELD_OP || - Opcode == AML_BYTE_FIELD_OP || - Opcode == AML_WORD_FIELD_OP || - Opcode == AML_DWORD_FIELD_OP)); + (Opcode == AML_CREATE_FIELD_OP || + Opcode == AML_CREATE_BIT_FIELD_OP || + Opcode == AML_CREATE_BYTE_FIELD_OP || + Opcode == AML_CREATE_WORD_FIELD_OP || + Opcode == AML_CREATE_DWORD_FIELD_OP || + Opcode == AML_CREATE_QWORD_FIELD_OP)); } diff --git a/sys/contrib/dev/acpica/pswalk.c b/sys/contrib/dev/acpica/pswalk.c index e3a0f70..8868ed0 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: 52 $ + * $Revision: 55 $ * *****************************************************************************/ @@ -122,7 +122,7 @@ #include "acnamesp.h" #include "acinterp.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("pswalk") @@ -349,6 +349,9 @@ AcpiPsDeleteParseTree ( /* Create and initialize a new walk list */ WalkList.WalkState = NULL; + WalkList.AcquiredMutexList.Prev = NULL; + WalkList.AcquiredMutexList.Next = NULL; + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, &WalkList); if (!WalkState) { @@ -379,6 +382,7 @@ AcpiPsDeleteParseTree ( /* We are done with this walk */ + AcpiExReleaseAllMutexes ((ACPI_OPERAND_OBJECT *) &WalkList.AcquiredMutexList); AcpiDsDeleteWalkState (WalkState); return_VOID; diff --git a/sys/contrib/dev/acpica/psxface.c b/sys/contrib/dev/acpica/psxface.c index 00248b1..acbb3e8 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: 40 $ + * $Revision: 44 $ * *****************************************************************************/ @@ -124,7 +124,7 @@ #include "acnamesp.h" -#define _COMPONENT PARSER +#define _COMPONENT ACPI_PARSER MODULE_NAME ("psxface") @@ -176,7 +176,7 @@ AcpiPsxExecute ( /* Init for new method, wait on concurrency semaphore */ - Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc); + Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc, NULL); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -191,7 +191,7 @@ AcpiPsxExecute ( for (i = 0; Params[i]; i++) { - AcpiCmAddReference (Params[i]); + AcpiUtAddReference (Params[i]); } } @@ -200,8 +200,8 @@ AcpiPsxExecute ( * named objects that it creates into the namespace */ - DEBUG_PRINT (ACPI_INFO, - ("PsxExecute: **** Begin Method Execution **** Entry=%p obj=%p\n", + DEBUG_PRINTP (ACPI_INFO, + ("**** Begin Method Execution **** Entry=%p obj=%p\n", MethodNode, ObjDesc)); /* Create and init a Root Node */ @@ -249,7 +249,7 @@ AcpiPsxExecute ( for (i = 0; Params[i]; i++) { - AcpiCmUpdateObjectReference (Params[i], REF_DECREMENT); + AcpiUtUpdateObjectReference (Params[i], REF_DECREMENT); } } @@ -262,7 +262,7 @@ AcpiPsxExecute ( if (*ReturnObjDesc) { - DEBUG_PRINT (ACPI_INFO, ("Method returned ObjDesc=%X\n", + DEBUG_PRINTP (ACPI_INFO, ("Method returned ObjDesc=%X\n", *ReturnObjDesc)); DUMP_STACK_ENTRY (*ReturnObjDesc); diff --git a/sys/contrib/dev/acpica/rsaddr.c b/sys/contrib/dev/acpica/rsaddr.c index 546ff9b..61bc590 100644 --- a/sys/contrib/dev/acpica/rsaddr.c +++ b/sys/contrib/dev/acpica/rsaddr.c @@ -1,10 +1,7 @@ /******************************************************************************* * - * Module Name: rsaddr - AcpiRsAddress16Resource - * AcpiRsAddress16Stream - * AcpiRsAddress32Resource - * AcpiRsAddress32Stream - * $Revision: 14 $ + * Module Name: rsaddr - Address resource descriptors (16/32/64) + * $Revision: 18 $ * ******************************************************************************/ @@ -122,7 +119,7 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsaddr") @@ -131,20 +128,20 @@ * FUNCTION: AcpiRsAddress16Resource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -156,12 +153,12 @@ AcpiRsAddress16Resource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + NATIVE_CHAR *TempPtr; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16); + UINT32 Index; UINT16 Temp16; UINT8 Temp8; - UINT32 Index; - UINT32 StructSize = sizeof(ADDRESS16_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; FUNCTION_TRACE ("RsAddress16Resource"); @@ -170,14 +167,10 @@ AcpiRsAddress16Resource ( * Point past the Descriptor to get the number of bytes consumed */ Buffer += 1; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); *BytesConsumed = Temp16 + 3; - - OutputStruct->Id = Address16; - - OutputStruct->Length = StructSize; + OutputStruct->Id = ACPI_RSTYPE_ADDRESS16; /* * Get the Resource Type (Byte3) @@ -188,7 +181,7 @@ AcpiRsAddress16Resource ( /* Values 0-2 are valid */ if (Temp8 > 2) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } OutputStruct->Data.Address16.ResourceType = Temp8 & 0x03; @@ -243,7 +236,7 @@ AcpiRsAddress16Resource ( else { - /* BUS_NUMBER_RANGE == Address32Data->ResourceType */ + /* BUS_NUMBER_RANGE == Address16.Data->ResourceType */ /* Nothing needs to be filled in */ } } @@ -266,25 +259,22 @@ AcpiRsAddress16Resource ( * Get MaxAddressRange (Bytes 10-11) */ Buffer += 2; - MOVE_UNALIGNED16_TO_16 - (&OutputStruct->Data.Address16.MaxAddressRange, - Buffer); + MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.MaxAddressRange, + Buffer); /* * Get AddressTranslationOffset (Bytes 12-13) */ Buffer += 2; - MOVE_UNALIGNED16_TO_16 - (&OutputStruct->Data.Address16.AddressTranslationOffset, - Buffer); + MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressTranslationOffset, + Buffer); /* * Get AddressLength (Bytes 14-15) */ Buffer += 2; - MOVE_UNALIGNED16_TO_16 - (&OutputStruct->Data.Address16.AddressLength, - Buffer); + MOVE_UNALIGNED16_TO_16 (&OutputStruct->Data.Address16.AddressLength, + Buffer); /* * Resource Source Index (if present) @@ -293,32 +283,38 @@ AcpiRsAddress16Resource ( /* * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. + * If it is present, then save it off and calculate the + * pointer to where the null terminated string goes: + * Each Interrupt takes 32-bits + the 5 bytes of the + * stream that are default. */ if (*BytesConsumed > 16) { /* Dereference the Index */ Temp8 = *Buffer; - OutputStruct->Data.Address16.ResourceSourceIndex = - (UINT32) Temp8; + OutputStruct->Data.Address16.ResourceSource.Index = (UINT32) Temp8; /* Point to the String */ Buffer += 1; + /* Point the String pointer to the end of this structure */ + + OutputStruct->Data.Address16.ResourceSource.StringPtr = + (NATIVE_CHAR *)((UINT8 * )OutputStruct + StructSize); + + TempPtr = OutputStruct->Data.Address16.ResourceSource.StringPtr; + /* Copy the string into the buffer */ Index = 0; while (0x00 != *Buffer) { - OutputStruct->Data.Address16.ResourceSource[Index] = - *Buffer; + *TempPtr = *Buffer; + TempPtr += 1; Buffer += 1; Index += 1; } @@ -326,32 +322,35 @@ AcpiRsAddress16Resource ( /* * Add the terminating null */ - OutputStruct->Data.Address16.ResourceSource[Index] = 0x00; + *TempPtr = 0x00; - OutputStruct->Data.Address16.ResourceSourceStringLength = - Index + 1; + OutputStruct->Data.Address16.ResourceSource.StringLength = Index + 1; /* - * In order for the StructSize to fall on a 32-bit boundry, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundry. + * In order for the StructSize to fall on a 32-bit boundary, + * calculate the length of the string and expand the + * StructSize to the next 32-bit boundary. */ Temp8 = (UINT8) (Index + 1); StructSize += ROUND_UP_TO_32BITS (Temp8); - OutputStruct->Length = StructSize; } + else { - OutputStruct->Data.Address16.ResourceSourceIndex = 0x00; - OutputStruct->Data.Address16.ResourceSourceStringLength = 0; - OutputStruct->Data.Address16.ResourceSource[0] = 0x00; + OutputStruct->Data.Address16.ResourceSource.Index = 0x00; + OutputStruct->Data.Address16.ResourceSource.StringLength = 0; + OutputStruct->Data.Address16.ResourceSource.StringPtr = NULL; } /* + * Set the Length parameter + */ + OutputStruct->Length = StructSize; + + /* * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -363,19 +362,19 @@ AcpiRsAddress16Resource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsAddress16Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -388,6 +387,7 @@ AcpiRsAddress16Stream ( FUNCTION_TRACE ("RsAddress16Stream"); + /* * The descriptor field is static */ @@ -449,43 +449,43 @@ AcpiRsAddress16Stream ( * Set the address space granularity */ MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.Granularity); + &LinkedList->Data.Address16.Granularity); Buffer += 2; /* * Set the address range minimum */ MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.MinAddressRange); + &LinkedList->Data.Address16.MinAddressRange); Buffer += 2; /* * Set the address range maximum */ MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.MaxAddressRange); + &LinkedList->Data.Address16.MaxAddressRange); Buffer += 2; /* * Set the address translation offset */ MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.AddressTranslationOffset); + &LinkedList->Data.Address16.AddressTranslationOffset); Buffer += 2; /* * Set the address length */ MOVE_UNALIGNED16_TO_16 (Buffer, - &LinkedList->Data.Address16.AddressLength); + &LinkedList->Data.Address16.AddressLength); Buffer += 2; /* * Resource Source Index and Resource Source are optional */ - if (0 != LinkedList->Data.Address16.ResourceSourceStringLength) + if (0 != LinkedList->Data.Address16.ResourceSource.StringLength) { - Temp8 = (UINT8) LinkedList->Data.Address16.ResourceSourceIndex; + Temp8 = (UINT8) LinkedList->Data.Address16.ResourceSource.Index; *Buffer = Temp8; Buffer += 1; @@ -495,21 +495,21 @@ AcpiRsAddress16Stream ( /* * Copy the string */ - STRCPY (TempPointer, LinkedList->Data.Address16.ResourceSource); + STRCPY (TempPointer, + LinkedList->Data.Address16.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.Address16.ResourceSource) + 1); + Buffer += (STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + + 1); } /* * Return the number of bytes consumed in this operation */ - ActualBytes = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + ActualBytes = POINTER_DIFF (Buffer, *OutputBuffer); *BytesConsumed = ActualBytes; /* @@ -518,7 +518,6 @@ AcpiRsAddress16Stream ( */ ActualBytes -= 3; MOVE_UNALIGNED16_TO_16 (LengthField, &ActualBytes); - return_ACPI_STATUS (AE_OK); } @@ -528,20 +527,20 @@ AcpiRsAddress16Stream ( * FUNCTION: AcpiRsAddress32Resource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -553,21 +552,21 @@ AcpiRsAddress32Resource ( UINT32 *StructureSize) { UINT8 *Buffer; - RESOURCE *OutputStruct; + ACPI_RESOURCE *OutputStruct; UINT16 Temp16; UINT8 Temp8; + NATIVE_CHAR *TempPtr; UINT32 StructSize; UINT32 Index; FUNCTION_TRACE ("RsAddress32Resource"); - Buffer = ByteStreamBuffer; - OutputStruct = (RESOURCE *) *OutputBuffer; + Buffer = ByteStreamBuffer; + OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; - StructSize = sizeof (ADDRESS32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32); /* * Point past the Descriptor to get the number of bytes consumed @@ -577,7 +576,7 @@ AcpiRsAddress32Resource ( *BytesConsumed = Temp16 + 3; - OutputStruct->Id = Address32; + OutputStruct->Id = ACPI_RSTYPE_ADDRESS32; /* * Get the Resource Type (Byte3) @@ -588,7 +587,7 @@ AcpiRsAddress32Resource ( /* Values 0-2 are valid */ if(Temp8 > 2) { - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); } OutputStruct->Data.Address32.ResourceType = Temp8 & 0x03; @@ -674,9 +673,8 @@ AcpiRsAddress32Resource ( * Get AddressTranslationOffset (Bytes 18-21) */ Buffer += 4; - MOVE_UNALIGNED32_TO_32 - (&OutputStruct->Data.Address32.AddressTranslationOffset, - Buffer); + MOVE_UNALIGNED32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, + Buffer); /* * Get AddressLength (Bytes 22-25) @@ -692,29 +690,37 @@ AcpiRsAddress32Resource ( /* * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. + * If it is present, then save it off and calculate the + * pointer to where the null terminated string goes: */ if (*BytesConsumed > 26) { /* Dereference the Index */ Temp8 = *Buffer; - OutputStruct->Data.Address32.ResourceSourceIndex = (UINT32)Temp8; + OutputStruct->Data.Address32.ResourceSource.Index = + (UINT32) Temp8; /* Point to the String */ Buffer += 1; + /* Point the String pointer to the end of this structure */ + + OutputStruct->Data.Address32.ResourceSource.StringPtr = + (NATIVE_CHAR *)((UINT8 *)OutputStruct + StructSize); + + TempPtr = OutputStruct->Data.Address32.ResourceSource.StringPtr; + /* Copy the string into the buffer */ Index = 0; while (0x00 != *Buffer) { - OutputStruct->Data.Address32.ResourceSource[Index] = *Buffer; + *TempPtr = *Buffer; + + TempPtr += 1; Buffer += 1; Index += 1; } @@ -722,14 +728,13 @@ AcpiRsAddress32Resource ( /* * Add the terminating null */ - OutputStruct->Data.Address32.ResourceSource[Index] = 0x00; - - OutputStruct->Data.Address32.ResourceSourceStringLength = Index + 1; + *TempPtr = 0x00; + OutputStruct->Data.Address32.ResourceSource.StringLength = Index + 1; /* - * In order for the StructSize to fall on a 32-bit boundry, + * In order for the StructSize to fall on a 32-bit boundary, * calculate the length of the string and expand the - * StructSize to the next 32-bit boundry. + * StructSize to the next 32-bit boundary. */ Temp8 = (UINT8) (Index + 1); StructSize += ROUND_UP_TO_32BITS (Temp8); @@ -737,9 +742,9 @@ AcpiRsAddress32Resource ( else { - OutputStruct->Data.Address32.ResourceSourceIndex = 0x00; - OutputStruct->Data.Address32.ResourceSourceStringLength = 0; - OutputStruct->Data.Address32.ResourceSource[0] = 0x00; + OutputStruct->Data.Address32.ResourceSource.Index = 0x00; + OutputStruct->Data.Address32.ResourceSource.StringLength = 0; + OutputStruct->Data.Address32.ResourceSource.StringPtr = NULL; } /* @@ -751,7 +756,6 @@ AcpiRsAddress32Resource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -763,19 +767,19 @@ AcpiRsAddress32Resource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsAddress32Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -787,6 +791,7 @@ AcpiRsAddress32Stream ( FUNCTION_TRACE ("RsAddress32Stream"); + Buffer = *OutputBuffer; /* @@ -799,7 +804,7 @@ AcpiRsAddress32Stream ( * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *)Buffer; + LengthField = (UINT16 *) Buffer; Buffer += 2; /* @@ -851,21 +856,21 @@ AcpiRsAddress32Stream ( * Set the address space granularity */ MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.Granularity); + &LinkedList->Data.Address32.Granularity); Buffer += 4; /* * Set the address range minimum */ MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.MinAddressRange); + &LinkedList->Data.Address32.MinAddressRange); Buffer += 4; /* * Set the address range maximum */ MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.MaxAddressRange); + &LinkedList->Data.Address32.MaxAddressRange); Buffer += 4; /* @@ -879,15 +884,15 @@ AcpiRsAddress32Stream ( * Set the address length */ MOVE_UNALIGNED32_TO_32 (Buffer, - &LinkedList->Data.Address32.AddressLength); + &LinkedList->Data.Address32.AddressLength); Buffer += 4; /* * Resource Source Index and Resource Source are optional */ - if (0 != LinkedList->Data.Address32.ResourceSourceStringLength) + if (0 != LinkedList->Data.Address32.ResourceSource.StringLength) { - Temp8 = (UINT8) LinkedList->Data.Address32.ResourceSourceIndex; + Temp8 = (UINT8) LinkedList->Data.Address32.ResourceSource.Index; *Buffer = Temp8; Buffer += 1; @@ -897,27 +902,431 @@ AcpiRsAddress32Stream ( /* * Copy the string */ - STRCPY (TempPointer, LinkedList->Data.Address32.ResourceSource); + STRCPY (TempPointer, + LinkedList->Data.Address32.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the * terminating null */ - Buffer += (STRLEN (LinkedList->Data.Address32.ResourceSource) + 1); + Buffer += (STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1); } /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); /* * Set the length field to the number of bytes consumed * minus the header size (3 bytes) */ *LengthField = (UINT16) (*BytesConsumed - 3); + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsAddress64Resource + * + * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte + * stream + * BytesConsumed - UINT32 pointer that is filled with + * the number of bytes consumed from + * the ByteStreamBuffer + * OutputBuffer - Pointer to the user's return buffer + * StructureSize - UINT32 pointer that is filled with + * the number of bytes in the filled + * in structure + * + * RETURN: Status + * + * DESCRIPTION: Take the resource byte stream and fill out the appropriate + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRsAddress64Resource ( + UINT8 *ByteStreamBuffer, + UINT32 *BytesConsumed, + UINT8 **OutputBuffer, + UINT32 *StructureSize) +{ + UINT8 *Buffer; + ACPI_RESOURCE *OutputStruct; + UINT16 Temp16; + UINT8 Temp8; + NATIVE_CHAR *TempPtr; + UINT32 StructSize; + UINT32 Index; + + + FUNCTION_TRACE ("RsAddress64Resource"); + + + Buffer = ByteStreamBuffer; + OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + + StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64); + + /* + * Point past the Descriptor to get the number of bytes consumed + */ + Buffer += 1; + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + + *BytesConsumed = Temp16 + 3; + OutputStruct->Id = ACPI_RSTYPE_ADDRESS64; + + /* + * Get the Resource Type (Byte3) + */ + Buffer += 2; + Temp8 = *Buffer; + + /* Values 0-2 are valid */ + if(Temp8 > 2) + { + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + } + + OutputStruct->Data.Address64.ResourceType = Temp8 & 0x03; + + /* + * Get the General Flags (Byte4) + */ + Buffer += 1; + Temp8 = *Buffer; + + /* + * Producer / Consumer + */ + OutputStruct->Data.Address64.ProducerConsumer = Temp8 & 0x01; + + /* + * Decode + */ + OutputStruct->Data.Address64.Decode = (Temp8 >> 1) & 0x01; + + /* + * Min Address Fixed + */ + OutputStruct->Data.Address64.MinAddressFixed = (Temp8 >> 2) & 0x01; + + /* + * Max Address Fixed + */ + OutputStruct->Data.Address64.MaxAddressFixed = (Temp8 >> 3) & 0x01; + + /* + * Get the Type Specific Flags (Byte5) + */ + Buffer += 1; + Temp8 = *Buffer; + + if (MEMORY_RANGE == OutputStruct->Data.Address64.ResourceType) + { + OutputStruct->Data.Address64.Attribute.Memory.ReadWriteAttribute = + (UINT16) (Temp8 & 0x01); + + OutputStruct->Data.Address64.Attribute.Memory.CacheAttribute = + (UINT16) ((Temp8 >> 1) & 0x0F); + } + + else + { + if (IO_RANGE == OutputStruct->Data.Address64.ResourceType) + { + OutputStruct->Data.Address64.Attribute.Io.RangeAttribute = + (UINT16) (Temp8 & 0x03); + } + + else + { + /* BUS_NUMBER_RANGE == OutputStruct->Data.Address64.ResourceType */ + /* Nothing needs to be filled in */ + } + } + + /* + * Get Granularity (Bytes 6-13) + */ + Buffer += 1; + MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.Granularity, + Buffer); + + /* + * Get MinAddressRange (Bytes 14-21) + */ + Buffer += 8; + MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, + Buffer); + + /* + * Get MaxAddressRange (Bytes 22-29) + */ + Buffer += 8; + MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, + Buffer); + + /* + * Get AddressTranslationOffset (Bytes 30-37) + */ + Buffer += 8; + MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, + Buffer); + + /* + * Get AddressLength (Bytes 38-45) + */ + Buffer += 8; + MOVE_UNALIGNED64_TO_64 (&OutputStruct->Data.Address64.AddressLength, + Buffer); + + /* + * Resource Source Index (if present) + */ + Buffer += 8; + + /* + * This will leave us pointing to the Resource Source Index + * If it is present, then save it off and calculate the + * pointer to where the null terminated string goes: + * Each Interrupt takes 32-bits + the 5 bytes of the + * stream that are default. + */ + if (*BytesConsumed > 46) + { + /* Dereference the Index */ + + Temp8 = *Buffer; + OutputStruct->Data.Address64.ResourceSource.Index = + (UINT32) Temp8; + + /* Point to the String */ + + Buffer += 1; + + /* Point the String pointer to the end of this structure */ + + OutputStruct->Data.Address64.ResourceSource.StringPtr = + (NATIVE_CHAR *)((UINT8 *)OutputStruct + StructSize); + + TempPtr = OutputStruct->Data.Address64.ResourceSource.StringPtr; + + /* Copy the string into the buffer */ + + Index = 0; + + while (0x00 != *Buffer) + { + *TempPtr = *Buffer; + + TempPtr += 1; + Buffer += 1; + Index += 1; + } + + /* + * Add the terminating null + */ + *TempPtr = 0x00; + + OutputStruct->Data.Address64.ResourceSource.StringLength = Index + 1; + + /* + * In order for the StructSize to fall on a 32-bit boundary, + * calculate the length of the string and expand the + * StructSize to the next 32-bit boundary. + */ + Temp8 = (UINT8) (Index + 1); + StructSize += ROUND_UP_TO_32BITS (Temp8); + } + + else + { + OutputStruct->Data.Address64.ResourceSource.Index = 0x00; + OutputStruct->Data.Address64.ResourceSource.StringLength = 0; + OutputStruct->Data.Address64.ResourceSource.StringPtr = NULL; + } + + /* + * Set the Length parameter + */ + OutputStruct->Length = StructSize; + + /* + * Return the final size of the structure + */ + *StructureSize = StructSize; + return_ACPI_STATUS (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsAddress64Stream + * + * PARAMETERS: LinkedList - Pointer to the resource linked list + * OutputBuffer - Pointer to the user's return buffer + * BytesConsumed - UINT32 pointer that is filled with + * the number of bytes of the + * OutputBuffer used + * + * RETURN: Status + * + * DESCRIPTION: Take the linked list resource structure and fills in the + * the appropriate bytes in a byte stream + * + ******************************************************************************/ + +ACPI_STATUS +AcpiRsAddress64Stream ( + ACPI_RESOURCE *LinkedList, + UINT8 **OutputBuffer, + UINT32 *BytesConsumed) +{ + UINT8 *Buffer; + UINT16 *LengthField; + UINT8 Temp8; + NATIVE_CHAR *TempPointer; + + + FUNCTION_TRACE ("RsAddress64Stream"); + + + Buffer = *OutputBuffer; + + /* + * The descriptor field is static + */ + *Buffer = 0x8A; + Buffer += 1; + + /* + * Set a pointer to the Length field - to be filled in later + */ + + LengthField = (UINT16 *)Buffer; + Buffer += 2; + /* + * Set the Resource Type (Memory, Io, BusNumber) + */ + Temp8 = (UINT8) (LinkedList->Data.Address64.ResourceType & 0x03); + + *Buffer = Temp8; + Buffer += 1; + + /* + * Set the general flags + */ + Temp8 = (UINT8) (LinkedList->Data.Address64.ProducerConsumer & 0x01); + Temp8 |= (LinkedList->Data.Address64.Decode & 0x01) << 1; + Temp8 |= (LinkedList->Data.Address64.MinAddressFixed & 0x01) << 2; + Temp8 |= (LinkedList->Data.Address64.MaxAddressFixed & 0x01) << 3; + + *Buffer = Temp8; + Buffer += 1; + + /* + * Set the type specific flags + */ + Temp8 = 0; + + if(MEMORY_RANGE == LinkedList->Data.Address64.ResourceType) + { + Temp8 = (UINT8) + (LinkedList->Data.Address64.Attribute.Memory.ReadWriteAttribute & + 0x01); + + Temp8 |= + (LinkedList->Data.Address64.Attribute.Memory.CacheAttribute & + 0x0F) << 1; + } + + else if (IO_RANGE == LinkedList->Data.Address64.ResourceType) + { + Temp8 = (UINT8) + (LinkedList->Data.Address64.Attribute.Io.RangeAttribute & + 0x03); + } + + *Buffer = Temp8; + Buffer += 1; + + /* + * Set the address space granularity + */ + MOVE_UNALIGNED64_TO_64 (Buffer, + &LinkedList->Data.Address64.Granularity); + Buffer += 8; + + /* + * Set the address range minimum + */ + MOVE_UNALIGNED64_TO_64 (Buffer, + &LinkedList->Data.Address64.MinAddressRange); + Buffer += 8; + + /* + * Set the address range maximum + */ + MOVE_UNALIGNED64_TO_64 (Buffer, + &LinkedList->Data.Address64.MaxAddressRange); + Buffer += 8; + + /* + * Set the address translation offset + */ + MOVE_UNALIGNED64_TO_64 (Buffer, + &LinkedList->Data.Address64.AddressTranslationOffset); + Buffer += 8; + + /* + * Set the address length + */ + MOVE_UNALIGNED64_TO_64 (Buffer, + &LinkedList->Data.Address64.AddressLength); + Buffer += 8; + + /* + * Resource Source Index and Resource Source are optional + */ + if (0 != LinkedList->Data.Address64.ResourceSource.StringLength) + { + Temp8 = (UINT8) LinkedList->Data.Address64.ResourceSource.Index; + + *Buffer = Temp8; + Buffer += 1; + + TempPointer = (NATIVE_CHAR *) Buffer; + + /* + * Copy the string + */ + STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr); + + /* + * Buffer needs to be set to the length of the sting + one for the + * terminating null + */ + Buffer += (STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1); + } + + /* + * Return the number of bytes consumed in this operation + */ + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); + + /* + * Set the length field to the number of bytes consumed + * minus the header size (3 bytes) + */ + *LengthField = (UINT16) (*BytesConsumed - 3); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rscalc.c b/sys/contrib/dev/acpica/rscalc.c index 2f03cf4..79832e3 100644 --- a/sys/contrib/dev/acpica/rscalc.c +++ b/sys/contrib/dev/acpica/rscalc.c @@ -1,8 +1,7 @@ /******************************************************************************* * - * Module Name: rscalc - AcpiRsCalculateByteStreamLength - * AcpiRsCalculateListLength - * $Revision: 21 $ + * Module Name: rscalc - Calculate stream and list lengths + * $Revision: 30 $ * ******************************************************************************/ @@ -122,7 +121,7 @@ #include "amlcode.h" #include "acnamesp.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rscalc") @@ -132,9 +131,9 @@ * * PARAMETERS: LinkedList - Pointer to the resource linked list * SizeNeeded - UINT32 pointer of the size buffer needed - * to properly return the parsed data + * to properly return the parsed data * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Takes the resource byte stream and parses it once, calculating * the size buffer needed to hold the linked list that conveys @@ -144,12 +143,12 @@ ACPI_STATUS AcpiRsCalculateByteStreamLength ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT32 *SizeNeeded) { UINT32 ByteStreamSizeNeeded = 0; UINT32 SegmentSize; - EXTENDED_IRQ_RESOURCE *ExIrq = NULL; + ACPI_RESOURCE_EXT_IRQ *ExIrq = NULL; BOOLEAN Done = FALSE; @@ -158,88 +157,72 @@ AcpiRsCalculateByteStreamLength ( while (!Done) { - /* - * Init the variable that will hold the size to add to the - * total. + * Init the variable that will hold the size to add to the total. */ SegmentSize = 0; switch (LinkedList->Id) { - case Irq: + case ACPI_RSTYPE_IRQ: /* * IRQ Resource - */ - /* * For an IRQ Resource, Byte 3, although optional, will - * always be created - it holds IRQ information. + * always be created - it holds IRQ information. */ SegmentSize = 4; break; - case Dma: + case ACPI_RSTYPE_DMA: /* * DMA Resource - */ - /* * For this resource the size is static */ SegmentSize = 3; break; - case StartDependentFunctions: + case ACPI_RSTYPE_START_DPF: /* * Start Dependent Functions Resource - */ - /* * For a StartDependentFunctions Resource, Byte 1, * although optional, will always be created. */ SegmentSize = 2; break; - case EndDependentFunctions: + case ACPI_RSTYPE_END_DPF: /* * End Dependent Functions Resource - */ - /* * For this resource the size is static */ SegmentSize = 1; break; - case Io: + case ACPI_RSTYPE_IO: /* * IO Port Resource - */ - /* * For this resource the size is static */ SegmentSize = 8; break; - case FixedIo: + case ACPI_RSTYPE_FIXED_IO: /* * Fixed IO Port Resource - */ - /* * For this resource the size is static */ SegmentSize = 4; break; - case VendorSpecific: + case ACPI_RSTYPE_VENDOR: /* * Vendor Defined Resource - */ - /* * For a Vendor Specific resource, if the Length is - * between 1 and 7 it will be created as a Small - * Resource data type, otherwise it is a Large - * Resource data type. + * between 1 and 7 it will be created as a Small + * Resource data type, otherwise it is a Large + * Resource data type. */ - if(LinkedList->Data.VendorSpecific.Length > 7) + if (LinkedList->Data.VendorSpecific.Length > 7) { SegmentSize = 3; } @@ -247,120 +230,119 @@ AcpiRsCalculateByteStreamLength ( { SegmentSize = 1; } - SegmentSize += - LinkedList->Data.VendorSpecific.Length; + SegmentSize += LinkedList->Data.VendorSpecific.Length; break; - case EndTag: + case ACPI_RSTYPE_END_TAG: /* * End Tag - */ - /* * For this resource the size is static */ SegmentSize = 2; Done = TRUE; break; - case Memory24: + case ACPI_RSTYPE_MEM24: /* * 24-Bit Memory Resource - */ - /* * For this resource the size is static */ SegmentSize = 12; break; - case Memory32: + case ACPI_RSTYPE_MEM32: /* * 32-Bit Memory Range Resource - */ - /* * For this resource the size is static */ SegmentSize = 20; break; - case FixedMemory32: + case ACPI_RSTYPE_FIXED_MEM32: /* * 32-Bit Fixed Memory Resource - */ - /* * For this resource the size is static */ SegmentSize = 12; break; - case Address16: + case ACPI_RSTYPE_ADDRESS16: /* * 16-Bit Address Resource - */ - /* * The base size of this byte stream is 16. If a - * Resource Source string is not NULL, add 1 for - * the Index + the length of the null terminated - * string Resource Source + 1 for the null. + * Resource Source string is not NULL, add 1 for + * the Index + the length of the null terminated + * string Resource Source + 1 for the null. */ SegmentSize = 16; - if(NULL != LinkedList->Data.Address16.ResourceSource) + if (NULL != LinkedList->Data.Address16.ResourceSource.StringPtr) { SegmentSize += (1 + - LinkedList->Data.Address16.ResourceSourceStringLength); + LinkedList->Data.Address16.ResourceSource.StringLength); } break; - case Address32: + case ACPI_RSTYPE_ADDRESS32: /* * 32-Bit Address Resource - */ - /* * The base size of this byte stream is 26. If a Resource - * Source string is not NULL, add 1 for the Index + the - * length of the null terminated string Resource Source + - * 1 for the null. + * Source string is not NULL, add 1 for the Index + the + * length of the null terminated string Resource Source + + * 1 for the null. */ SegmentSize = 26; - if(NULL != LinkedList->Data.Address16.ResourceSource) + if (NULL != LinkedList->Data.Address32.ResourceSource.StringPtr) { SegmentSize += (1 + - LinkedList->Data.Address16.ResourceSourceStringLength); + LinkedList->Data.Address32.ResourceSource.StringLength); } break; - case ExtendedIrq: + case ACPI_RSTYPE_ADDRESS64: /* - * Extended IRQ Resource + * 64-Bit Address Resource + * The base size of this byte stream is 46. If a Resource + * Source string is not NULL, add 1 for the Index + the + * length of the null terminated string Resource Source + + * 1 for the null. */ + SegmentSize = 46; + + if (NULL != LinkedList->Data.Address64.ResourceSource.StringPtr) + { + SegmentSize += (1 + + LinkedList->Data.Address64.ResourceSource.StringLength); + } + break; + + case ACPI_RSTYPE_EXT_IRQ: /* + * Extended IRQ Resource * The base size of this byte stream is 9. This is for an - * Interrupt table length of 1. For each additional - * interrupt, add 4. + * Interrupt table length of 1. For each additional + * interrupt, add 4. * If a Resource Source string is not NULL, add 1 for the - * Index + the length of the null terminated string - * Resource Source + 1 for the null. + * Index + the length of the null terminated string + * Resource Source + 1 for the null. */ - SegmentSize = 9; + SegmentSize = 9 + + ((LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4); - SegmentSize += - (LinkedList->Data.ExtendedIrq.NumberOfInterrupts - - 1) * 4; - - if(NULL != ExIrq->ResourceSource) + if (NULL != ExIrq->ResourceSource.StringPtr) { SegmentSize += (1 + - LinkedList->Data.ExtendedIrq.ResourceSourceStringLength); + LinkedList->Data.ExtendedIrq.ResourceSource.StringLength); } break; default: /* * If we get here, everything is out of sync, - * so exit with an error + * so exit with an error */ - return_ACPI_STATUS (AE_AML_ERROR); + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); break; } /* switch (LinkedList->Id) */ @@ -373,15 +355,14 @@ AcpiRsCalculateByteStreamLength ( /* * Point to the next object */ - LinkedList = (RESOURCE *) ((NATIVE_UINT) LinkedList + - (NATIVE_UINT) LinkedList->Length); + LinkedList = POINTER_ADD (ACPI_RESOURCE, + LinkedList, LinkedList->Length); } /* * This is the data the caller needs */ *SizeNeeded = ByteStreamSizeNeeded; - return_ACPI_STATUS (AE_OK); } @@ -393,10 +374,10 @@ AcpiRsCalculateByteStreamLength ( * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream * ByteStreamBufferLength - Size of ByteStreamBuffer * SizeNeeded - UINT32 pointer of the size buffer - * needed to properly return the - * parsed data + * needed to properly return the + * parsed data * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Takes the resource byte stream and parses it once, calculating * the size buffer needed to hold the linked list that conveys @@ -430,418 +411,400 @@ AcpiRsCalculateListLength ( while (BytesParsed < ByteStreamBufferLength) { /* - * Look at the next byte in the stream + * The next byte in the stream is the resource type */ - ResourceType = *ByteStreamBuffer; + ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer); - /* - * See if this is a small or large resource - */ - if(ResourceType & 0x80) + switch (ResourceType) { + case RESOURCE_DESC_MEMORY_24: /* - * Large Resource Type + * 24-Bit Memory Resource */ - switch (ResourceType) - { - case MEMORY_RANGE_24: - /* - * 24-Bit Memory Resource - */ - BytesConsumed = 12; + BytesConsumed = 12; - StructureSize = sizeof (MEMORY24_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; - break; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24); + break; - case LARGE_VENDOR_DEFINED: - /* - * Vendor Defined Resource - */ - Buffer = ByteStreamBuffer; - ++Buffer; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - BytesConsumed = Temp16 + 3; + case RESOURCE_DESC_LARGE_VENDOR: + /* + * Vendor Defined Resource + */ + Buffer = ByteStreamBuffer; + ++Buffer; - /* - * Ensure a 32-bit boundary for the structure - */ - Temp16 = (UINT16) ROUND_UP_TO_32BITS (Temp16); + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + BytesConsumed = Temp16 + 3; - StructureSize = sizeof (VENDOR_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + + /* + * Ensure a 32-bit boundary for the structure + */ + Temp16 = (UINT16) ROUND_UP_TO_32BITS (Temp16); + + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) + (Temp16 * sizeof (UINT8)); - break; + break; - case MEMORY_RANGE_32: - /* - * 32-Bit Memory Range Resource - */ - BytesConsumed = 20; + case RESOURCE_DESC_MEMORY_32: + /* + * 32-Bit Memory Range Resource + */ - StructureSize = sizeof (MEMORY32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; - break; + BytesConsumed = 20; - case FIXED_MEMORY_RANGE_32: - /* - * 32-Bit Fixed Memory Resource - */ - BytesConsumed = 12; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32); + break; - StructureSize = sizeof(FIXED_MEMORY32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; - break; - case DWORD_ADDRESS_SPACE: - /* - * 32-Bit Address Resource - */ - Buffer = ByteStreamBuffer; + case RESOURCE_DESC_FIXED_MEMORY_32: + /* + * 32-Bit Fixed Memory Resource + */ + BytesConsumed = 12; - ++Buffer; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32); + break; - BytesConsumed = Temp16 + 3; - /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 23, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. - */ - if (23 < Temp16) - { - Temp8 = (UINT8) (Temp16 - 24); - } - else - { - Temp8 = 0; - } + case RESOURCE_DESC_QWORD_ADDRESS_SPACE: + /* + * 64-Bit Address Resource + */ + Buffer = ByteStreamBuffer; - /* - * Ensure a 32-bit boundary for the structure - */ - Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); + ++Buffer; + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - StructureSize = sizeof (ADDRESS32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + - (Temp8 * sizeof (UINT8)); - break; + BytesConsumed = Temp16 + 3; - case WORD_ADDRESS_SPACE: - /* - * 16-Bit Address Resource - */ - Buffer = ByteStreamBuffer; + /* + * Resource Source Index and Resource Source are + * optional elements. Check the length of the + * Bytestream. If it is greater than 43, that + * means that an Index exists and is followed by + * a null termininated string. Therefore, set + * the temp variable to the length minus the minimum + * byte stream length plus the byte for the Index to + * determine the size of the NULL terminiated string. + */ + if (43 < Temp16) + { + Temp8 = (UINT8) (Temp16 - 44); + } + else + { + Temp8 = 0; + } - ++Buffer; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + /* + * Ensure a 64-bit boundary for the structure + */ + Temp8 = (UINT8) ROUND_UP_TO_64BITS (Temp8); - BytesConsumed = Temp16 + 3; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) + + (Temp8 * sizeof (UINT8)); + break; - /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 13, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. - */ - if (13 < Temp16) - { - Temp8 = (UINT8) (Temp16 - 14); - } - else - { - Temp8 = 0; - } - /* - * Ensure a 32-bit boundry for the structure - */ - Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); + case RESOURCE_DESC_DWORD_ADDRESS_SPACE: + /* + * 32-Bit Address Resource + */ + Buffer = ByteStreamBuffer; - StructureSize = sizeof (ADDRESS16_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + - (Temp8 * sizeof (UINT8)); - break; + ++Buffer; + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - case EXTENDED_IRQ: - /* - * Extended IRQ - */ - Buffer = ByteStreamBuffer; + BytesConsumed = Temp16 + 3; - ++Buffer; - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + /* + * Resource Source Index and Resource Source are + * optional elements. Check the length of the + * Bytestream. If it is greater than 23, that + * means that an Index exists and is followed by + * a null termininated string. Therefore, set + * the temp variable to the length minus the minimum + * byte stream length plus the byte for the Index to + * determine the size of the NULL terminiated string. + */ + if (23 < Temp16) + { + Temp8 = (UINT8) (Temp16 - 24); + } + else + { + Temp8 = 0; + } - BytesConsumed = Temp16 + 3; + /* + * Ensure a 32-bit boundary for the structure + */ + Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); - /* - * Point past the length field and the - * Interrupt vector flags to save off the - * Interrupt table length to the Temp8 variable. - */ - Buffer += 3; - Temp8 = *Buffer; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) + + (Temp8 * sizeof (UINT8)); + break; - /* - * To compensate for multiple interrupt numbers, - * Add 4 bytes for each additional interrupts - * greater than 1 - */ - AdditionalBytes = (UINT8) ((Temp8 - 1) * 4); - /* - * Resource Source Index and Resource Source are - * optional elements. Check the length of the - * Bytestream. If it is greater than 9, that - * means that an Index exists and is followed by - * a null termininated string. Therefore, set - * the temp variable to the length minus the minimum - * byte stream length plus the byte for the Index to - * determine the size of the NULL terminiated string. - */ - if (9 + AdditionalBytes < Temp16) - { - Temp8 = (UINT8) (Temp16 - (9 + AdditionalBytes)); - } + case RESOURCE_DESC_WORD_ADDRESS_SPACE: + /* + * 16-Bit Address Resource + */ + Buffer = ByteStreamBuffer; - else - { - Temp8 = 0; - } + ++Buffer; + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - /* - * Ensure a 32-bit boundry for the structure - */ - Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); + BytesConsumed = Temp16 + 3; - StructureSize = sizeof (EXTENDED_IRQ_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + - (AdditionalBytes * sizeof (UINT8)) + - (Temp8 * sizeof (UINT8)); + /* + * Resource Source Index and Resource Source are + * optional elements. Check the length of the + * Bytestream. If it is greater than 13, that + * means that an Index exists and is followed by + * a null termininated string. Therefore, set + * the temp variable to the length minus the minimum + * byte stream length plus the byte for the Index to + * determine the size of the NULL terminiated string. + */ + if (13 < Temp16) + { + Temp8 = (UINT8) (Temp16 - 14); + } + else + { + Temp8 = 0; + } - break; + /* + * Ensure a 32-bit boundary for the structure + */ + Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); -/* TBD: [Future] 64-bit not currently supported */ -/* - case 0x8A: - break; -*/ + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) + + (Temp8 * sizeof (UINT8)); + break; - default: - /* - * If we get here, everything is out of sync, - * so exit with an error - */ - return_ACPI_STATUS (AE_AML_ERROR); - break; - } - } - else - { + case RESOURCE_DESC_EXTENDED_XRUPT: /* - * Small Resource Type - * Only bits 7:3 are valid + * Extended IRQ */ - ResourceType >>= 3; + Buffer = ByteStreamBuffer; - switch (ResourceType) - { - case IRQ_FORMAT: - /* - * IRQ Resource - */ - /* - * Determine if it there are two or three - * trailing bytes - */ - Buffer = ByteStreamBuffer; - Temp8 = *Buffer; + ++Buffer; + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - if(Temp8 & 0x01) - { - BytesConsumed = 4; - } + BytesConsumed = Temp16 + 3; - else - { - BytesConsumed = 3; - } + /* + * Point past the length field and the + * Interrupt vector flags to save off the + * Interrupt table length to the Temp8 variable. + */ + Buffer += 3; + Temp8 = *Buffer; - /* - * Point past the descriptor - */ - ++Buffer; + /* + * To compensate for multiple interrupt numbers, add 4 bytes for + * each additional interrupts greater than 1 + */ + AdditionalBytes = (UINT8) ((Temp8 - 1) * 4); - /* - * Look at the number of bits set - */ - MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); + /* + * Resource Source Index and Resource Source are + * optional elements. Check the length of the + * Bytestream. If it is greater than 9, that + * means that an Index exists and is followed by + * a null termininated string. Therefore, set + * the temp variable to the length minus the minimum + * byte stream length plus the byte for the Index to + * determine the size of the NULL terminiated string. + */ + if (9 + AdditionalBytes < Temp16) + { + Temp8 = (UINT8) (Temp16 - (9 + AdditionalBytes)); + } - for (Index = 0; Index < 16; Index++) - { - if (Temp16 & 0x1) - { - ++NumberOfInterrupts; - } + else + { + Temp8 = 0; + } - Temp16 >>= 1; - } + /* + * Ensure a 32-bit boundary for the structure + */ + Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); - StructureSize = sizeof (IO_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + - (NumberOfInterrupts * sizeof (UINT32)); - break; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) + + (AdditionalBytes * sizeof (UINT8)) + + (Temp8 * sizeof (UINT8)); + break; - case DMA_FORMAT: + case RESOURCE_DESC_IRQ_FORMAT: + /* + * IRQ Resource. + * Determine if it there are two or three trailing bytes + */ + Buffer = ByteStreamBuffer; + Temp8 = *Buffer; - /* - * DMA Resource - */ - Buffer = ByteStreamBuffer; + if(Temp8 & 0x01) + { + BytesConsumed = 4; + } + else + { BytesConsumed = 3; + } - /* - * Point past the descriptor - */ - ++Buffer; + /* + * Point past the descriptor + */ + ++Buffer; - /* - * Look at the number of bits set - */ - Temp8 = *Buffer; + /* + * Look at the number of bits set + */ + MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); - for(Index = 0; Index < 8; Index++) + for (Index = 0; Index < 16; Index++) + { + if (Temp16 & 0x1) { - if(Temp8 & 0x1) - { - ++NumberOfChannels; - } - - Temp8 >>= 1; + ++NumberOfInterrupts; } - StructureSize = sizeof (DMA_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + - (NumberOfChannels * sizeof (UINT32)); - break; + Temp16 >>= 1; + } + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO) + + (NumberOfInterrupts * sizeof (UINT32)); + break; - case START_DEPENDENT_TAG: - /* - * Start Dependent Functions Resource - */ - /* - * Determine if it there are two or three trailing bytes - */ - Buffer = ByteStreamBuffer; - Temp8 = *Buffer; + case RESOURCE_DESC_DMA_FORMAT: + /* + * DMA Resource + */ + Buffer = ByteStreamBuffer; + BytesConsumed = 3; - if(Temp8 & 0x01) - { - BytesConsumed = 2; - } - else + /* + * Point past the descriptor + */ + ++Buffer; + + /* + * Look at the number of bits set + */ + Temp8 = *Buffer; + + for(Index = 0; Index < 8; Index++) + { + if(Temp8 & 0x1) { - BytesConsumed = 1; + ++NumberOfChannels; } + Temp8 >>= 1; + } - StructureSize = - sizeof (START_DEPENDENT_FUNCTIONS_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; - break; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) + + (NumberOfChannels * sizeof (UINT32)); + break; - case END_DEPENDENT_TAG: + case RESOURCE_DESC_START_DEPENDENT: + /* + * Start Dependent Functions Resource + * Determine if it there are two or three trailing bytes + */ + Buffer = ByteStreamBuffer; + Temp8 = *Buffer; - /* - * End Dependent Functions Resource - */ + if(Temp8 & 0x01) + { + BytesConsumed = 2; + } + else + { BytesConsumed = 1; - StructureSize = RESOURCE_LENGTH; - break; - + } - case IO_PORT_DESCRIPTOR: - /* - * IO Port Resource - */ - BytesConsumed = 8; - StructureSize = sizeof (IO_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; - break; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF); + break; - case FIXED_LOCATION_IO_DESCRIPTOR: + case RESOURCE_DESC_END_DEPENDENT: + /* + * End Dependent Functions Resource + */ + BytesConsumed = 1; + StructureSize = ACPI_RESOURCE_LENGTH; + break; - /* - * Fixed IO Port Resource - */ - BytesConsumed = 4; - StructureSize = sizeof (FIXED_IO_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; - break; + case RESOURCE_DESC_IO_PORT: + /* + * IO Port Resource + */ + BytesConsumed = 8; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO); + break; - case SMALL_VENDOR_DEFINED: - /* - * Vendor Specific Resource - */ - Buffer = ByteStreamBuffer; + case RESOURCE_DESC_FIXED_IO_PORT: + /* + * Fixed IO Port Resource + */ + BytesConsumed = 4; + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO); + break; - Temp8 = *Buffer; - Temp8 = (UINT8) (Temp8 & 0x7); - BytesConsumed = Temp8 + 1; - /* - * Ensure a 32-bit boundry for the structure - */ - Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); - StructureSize = sizeof (VENDOR_RESOURCE) + - RESOURCE_LENGTH_NO_DATA + - (Temp8 * sizeof (UINT8)); - break; + case RESOURCE_DESC_SMALL_VENDOR: + /* + * Vendor Specific Resource + */ + Buffer = ByteStreamBuffer; + Temp8 = *Buffer; + Temp8 = (UINT8) (Temp8 & 0x7); + BytesConsumed = Temp8 + 1; - case END_TAG: + /* + * Ensure a 32-bit boundary for the structure + */ + Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); + StructureSize = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) + + (Temp8 * sizeof (UINT8)); + break; - /* - * End Tag - */ - BytesConsumed = 2; - StructureSize = RESOURCE_LENGTH; - ByteStreamBufferLength = BytesParsed; - break; + case RESOURCE_DESC_END_TAG: + /* + * End Tag + */ + BytesConsumed = 2; + StructureSize = ACPI_RESOURCE_LENGTH; + ByteStreamBufferLength = BytesParsed; + break; - default: - /* - * If we get here, everything is out of sync, - * so exit with an error - */ - return_ACPI_STATUS (AE_AML_ERROR); - break; - } /* switch */ + default: + /* + * If we get here, everything is out of sync, + * so exit with an error + */ + return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE); + break; + } - } /* if(ResourceType & 0x80) */ /* * Update the return value and counter @@ -853,14 +816,13 @@ AcpiRsCalculateListLength ( * Set the byte stream to point to the next resource */ ByteStreamBuffer += BytesConsumed; - } + /* * This is the data the caller needs */ *SizeNeeded = BufferSize; - return_ACPI_STATUS (AE_OK); } @@ -871,14 +833,14 @@ AcpiRsCalculateListLength ( * * PARAMETERS: PackageObject - Pointer to the package object * BufferSizeNeeded - UINT32 pointer of the size buffer - * needed to properly return the - * parsed data + * needed to properly return the + * parsed data * - * RETURN: Status AE_OK + * RETURN: Status * * DESCRIPTION: Given a package representing a PCI routing table, this - * calculates the size of the corresponding linked list of - * descriptions. + * calculates the size of the corresponding linked list of + * descriptions. * ******************************************************************************/ @@ -909,11 +871,6 @@ AcpiRsCalculatePciRoutingTableLength ( * The minus one is to subtract the size of the UINT8 Source[1] * member because it is added below. * - * NOTE: The NumberOfElements is incremented by one to add an end - * table structure that is essentially a structure of zeros. - */ - - /* * But each PRT_ENTRY structure has a pointer to a string and * the size of that string must be found. */ @@ -941,7 +898,7 @@ AcpiRsCalculatePciRoutingTableLength ( { if ((ACPI_TYPE_STRING == (*SubObjectList)->Common.Type) || ((INTERNAL_TYPE_REFERENCE == (*SubObjectList)->Common.Type) && - ((*SubObjectList)->Reference.OpCode == AML_NAMEPATH_OP))) + ((*SubObjectList)->Reference.Opcode == AML_INT_NAMEPATH_OP))) { NameFound = TRUE; } @@ -970,9 +927,11 @@ AcpiRsCalculatePciRoutingTableLength ( */ TempSizeNeeded += (*SubObjectList)->String.Length; } + else { - TempSizeNeeded += AcpiNsGetPathnameLength ((*SubObjectList)->Reference.Node); + TempSizeNeeded += AcpiNsGetPathnameLength ( + (*SubObjectList)->Reference.Node); } } @@ -980,12 +939,11 @@ AcpiRsCalculatePciRoutingTableLength ( { /* * If no name was found, then this is a NULL, which is - * translated as a UINT32 zero. + * translated as a UINT32 zero. */ - TempSizeNeeded += sizeof(UINT32); + TempSizeNeeded += sizeof (UINT32); } - /* Round up the size since each element must be aligned */ TempSizeNeeded = ROUND_UP_TO_64BITS (TempSizeNeeded); @@ -997,7 +955,9 @@ AcpiRsCalculatePciRoutingTableLength ( } - *BufferSizeNeeded = TempSizeNeeded; - + /* + * Adding an extra element to the end of the list, essentially a NULL terminator + */ + *BufferSizeNeeded = TempSizeNeeded + sizeof (PCI_ROUTING_TABLE); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index 73d60b8..140f823 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/rscreate.c @@ -1,9 +1,7 @@ /******************************************************************************* * - * Module Name: rscreate - AcpiRsCreateResourceList - * AcpiRsCreatePciRoutingTable - * AcpiRsCreateByteStream - * $Revision: 25 $ + * Module Name: rscreate - Create resource lists/tables + * $Revision: 33 $ * ******************************************************************************/ @@ -124,7 +122,7 @@ #include "amlcode.h" #include "acnamesp.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rscreate") @@ -132,8 +130,7 @@ * * FUNCTION: AcpiRsCreateResourceList * - * PARAMETERS: - * ByteStreamBuffer - Pointer to the resource byte stream + * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream * OutputBuffer - Pointer to the user's buffer * OutputBufferLength - Pointer to the size of OutputBuffer * @@ -156,16 +153,15 @@ AcpiRsCreateResourceList ( { ACPI_STATUS Status; - UINT8 *ByteStreamStart = NULL; + UINT8 *ByteStreamStart; UINT32 ListSizeNeeded = 0; - UINT32 ByteStreamBufferLength = 0; + UINT32 ByteStreamBufferLength; FUNCTION_TRACE ("RsCreateResourceList"); - DEBUG_PRINT (VERBOSE_INFO, ("RsCreateResourceList: ByteStreamBuffer = %p\n", - ByteStreamBuffer)); + DEBUG_PRINTP (VERBOSE_INFO, ("ByteStreamBuffer = %p\n", ByteStreamBuffer)); /* * Params already validated, so we don't re-validate here @@ -178,12 +174,10 @@ AcpiRsCreateResourceList ( * Pass the ByteStreamBuffer into a module that can calculate * the buffer size needed for the linked list */ - Status = AcpiRsCalculateListLength (ByteStreamStart, - ByteStreamBufferLength, - &ListSizeNeeded); + Status = AcpiRsCalculateListLength (ByteStreamStart, ByteStreamBufferLength, + &ListSizeNeeded); - DEBUG_PRINT (VERBOSE_INFO, - ("RsCreateResourceList: Status=%X ListSizeNeeded=%X\n", + DEBUG_PRINTP (VERBOSE_INFO, ("Status=%X ListSizeNeeded=%X\n", Status, ListSizeNeeded)); /* @@ -206,9 +200,8 @@ AcpiRsCreateResourceList ( */ MEMSET (OutputBuffer, 0x00, *OutputBufferLength); - Status = AcpiRsByteStreamToList (ByteStreamStart, - ByteStreamBufferLength, - &OutputBuffer); + Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength, + &OutputBuffer); /* * Exit with the error passed back @@ -218,8 +211,7 @@ AcpiRsCreateResourceList ( return_ACPI_STATUS (Status); } - DEBUG_PRINT (VERBOSE_INFO, ("RsByteStreamToList: OutputBuffer = %p\n", - OutputBuffer)); + DEBUG_PRINTP (VERBOSE_INFO, ("OutputBuffer = %p\n", OutputBuffer)); } else @@ -230,7 +222,6 @@ AcpiRsCreateResourceList ( *OutputBufferLength = ListSizeNeeded; return_ACPI_STATUS (AE_OK); - } @@ -238,9 +229,8 @@ AcpiRsCreateResourceList ( * * FUNCTION: AcpiRsCreatePciRoutingTable * - * PARAMETERS: - * PackageObject - Pointer to an ACPI_OPERAND_OBJECT - * package + * PARAMETERS: PackageObject - Pointer to an ACPI_OPERAND_OBJECT + * package * OutputBuffer - Pointer to the user's buffer * OutputBufferLength - Size of OutputBuffer * @@ -279,12 +269,15 @@ AcpiRsCreatePciRoutingTable ( * Params already validated, so we don't re-validate here */ - Status = AcpiRsCalculatePciRoutingTableLength(PackageObject, - &BufferSizeNeeded); + Status = AcpiRsCalculatePciRoutingTableLength (PackageObject, + &BufferSizeNeeded); + + if (!ACPI_SUCCESS(Status)) + { + return_ACPI_STATUS (Status); + } - DEBUG_PRINT (VERBOSE_INFO, - ("RsCreatePciRoutingTable: BufferSizeNeeded = %X\n", - BufferSizeNeeded)); + DEBUG_PRINTP (VERBOSE_INFO, ("BufferSizeNeeded = %X\n", BufferSizeNeeded)); /* * If the data will fit into the available buffer @@ -351,9 +344,8 @@ AcpiRsCreatePciRoutingTable ( else { - DEBUG_PRINT (ACPI_ERROR, - ("CreatePciRoutingTable: Need Integer, found %s\n", - AcpiCmGetTypeName ((*SubObjectList)->Common.Type))); + DEBUG_PRINTP (ACPI_ERROR, ("Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -364,15 +356,13 @@ AcpiRsCreatePciRoutingTable ( if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) { - UserPrt->Pin = - (UINT32) (*SubObjectList)->Integer.Value; + UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value; } else { - DEBUG_PRINT (ACPI_ERROR, - ("CreatePciRoutingTable: Need Integer, found %s\n", - AcpiCmGetTypeName ((*SubObjectList)->Common.Type))); + DEBUG_PRINTP (ACPI_ERROR, ("Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -384,11 +374,11 @@ AcpiRsCreatePciRoutingTable ( switch ((*SubObjectList)->Common.Type) { case INTERNAL_TYPE_REFERENCE: - if ((*SubObjectList)->Reference.OpCode != AML_NAMEPATH_OP) + + if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP) { - DEBUG_PRINT (ACPI_ERROR, - ("CreatePciRoutingTable: Need name, found reference op %X\n", - (*SubObjectList)->Reference.OpCode)); + DEBUG_PRINTP (ACPI_ERROR, ("Need name, found reference op %X\n", + (*SubObjectList)->Reference.Opcode)); return_ACPI_STATUS (AE_BAD_DATA); } @@ -430,9 +420,9 @@ AcpiRsCreatePciRoutingTable ( default: - DEBUG_PRINT (ACPI_ERROR, - ("CreatePciRoutingTable: Need Integer, found %s\n", - AcpiCmGetTypeName ((*SubObjectList)->Common.Type))); + + DEBUG_PRINTP (ACPI_ERROR, ("Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); return_ACPI_STATUS (AE_BAD_DATA); break; } @@ -448,15 +438,13 @@ AcpiRsCreatePciRoutingTable ( if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type) { - UserPrt->SourceIndex = - (UINT32) (*SubObjectList)->Integer.Value; + UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value; } else { - DEBUG_PRINT (ACPI_ERROR, - ("CreatePciRoutingTable: Need Integer, found %s\n", - AcpiCmGetTypeName ((*SubObjectList)->Common.Type))); + DEBUG_PRINTP (ACPI_ERROR, ("Need Integer, found %s\n", + AcpiUtGetTypeName ((*SubObjectList)->Common.Type))); return_ACPI_STATUS (AE_BAD_DATA); } @@ -466,9 +454,7 @@ AcpiRsCreatePciRoutingTable ( TopObjectList++; } - DEBUG_PRINT (VERBOSE_INFO, - ("RsCreatePciRoutingTable: OutputBuffer = %p\n", - OutputBuffer)); + DEBUG_PRINTP (VERBOSE_INFO, ("OutputBuffer = %p\n", OutputBuffer)); } else @@ -482,7 +468,6 @@ AcpiRsCreatePciRoutingTable ( * Report the amount of buffer used */ *OutputBufferLength = BufferSizeNeeded; - return_ACPI_STATUS (AE_OK); } @@ -491,8 +476,7 @@ AcpiRsCreatePciRoutingTable ( * * FUNCTION: AcpiRsCreateByteStream * - * PARAMETERS: - * LinkedListBuffer - Pointer to the resource linked list + * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list * OutputBuffer - Pointer to the user's buffer * OutputBufferLength - Size of OutputBuffer * @@ -509,7 +493,7 @@ AcpiRsCreatePciRoutingTable ( ACPI_STATUS AcpiRsCreateByteStream ( - RESOURCE *LinkedListBuffer, + ACPI_RESOURCE *LinkedListBuffer, UINT8 *OutputBuffer, UINT32 *OutputBufferLength) { @@ -520,9 +504,7 @@ AcpiRsCreateByteStream ( FUNCTION_TRACE ("RsCreateByteStream"); - DEBUG_PRINT (VERBOSE_INFO, - ("RsCreateByteStream: LinkedListBuffer = %p\n", - LinkedListBuffer)); + DEBUG_PRINTP (VERBOSE_INFO, ("LinkedListBuffer = %p\n", LinkedListBuffer)); /* * Params already validated, so we don't re-validate here @@ -531,12 +513,10 @@ AcpiRsCreateByteStream ( * the buffer size needed for the byte stream. */ Status = AcpiRsCalculateByteStreamLength (LinkedListBuffer, - &ByteStreamSizeNeeded); + &ByteStreamSizeNeeded); - DEBUG_PRINT (VERBOSE_INFO, - ("RsCreateByteStream: ByteStreamSizeNeeded=%X, %s\n", - ByteStreamSizeNeeded, - AcpiCmFormatException (Status))); + DEBUG_PRINTP (VERBOSE_INFO, ("ByteStreamSizeNeeded=%X, %s\n", + ByteStreamSizeNeeded, AcpiUtFormatException (Status))); /* * Exit with the error passed back @@ -558,9 +538,8 @@ AcpiRsCreateByteStream ( */ MEMSET (OutputBuffer, 0x00, *OutputBufferLength); - Status = AcpiRsListToByteStream (LinkedListBuffer, - ByteStreamSizeNeeded, - &OutputBuffer); + Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded, + &OutputBuffer); /* * Exit with the error passed back @@ -570,10 +549,9 @@ AcpiRsCreateByteStream ( return_ACPI_STATUS (Status); } - DEBUG_PRINT (VERBOSE_INFO, - ("RsListToByteStream: OutputBuffer = %p\n", - OutputBuffer)); + DEBUG_PRINTP (VERBOSE_INFO, ("OutputBuffer = %p\n", OutputBuffer)); } + else { *OutputBufferLength = ByteStreamSizeNeeded; diff --git a/sys/contrib/dev/acpica/rsdump.c b/sys/contrib/dev/acpica/rsdump.c index 70127ee..abaf8ec 100644 --- a/sys/contrib/dev/acpica/rsdump.c +++ b/sys/contrib/dev/acpica/rsdump.c @@ -1,7 +1,7 @@ /******************************************************************************* * - * Module Name: rsdump - Functions do dump out the resource structures. - * $Revision: 16 $ + * Module Name: rsdump - Functions to display the resource structures. + * $Revision: 19 $ * ******************************************************************************/ @@ -120,7 +120,7 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsdump") @@ -130,7 +130,7 @@ * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -138,28 +138,24 @@ void AcpiRsDumpIrq ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - IRQ_RESOURCE *IrqData = (IRQ_RESOURCE*) Data; + ACPI_RESOURCE_IRQ *IrqData = (ACPI_RESOURCE_IRQ *) Data; UINT8 Index = 0; AcpiOsPrintf ("\tIRQ Resource\n"); AcpiOsPrintf ("\t\t%s Triggered\n", - LEVEL_SENSITIVE == IrqData->EdgeLevel ? - "Level" : "Edge"); + LEVEL_SENSITIVE == IrqData->EdgeLevel ? "Level" : "Edge"); AcpiOsPrintf ("\t\tActive %s\n", - ACTIVE_LOW == IrqData->ActiveHighLow ? - "Low" : "High"); + ACTIVE_LOW == IrqData->ActiveHighLow ? "Low" : "High"); AcpiOsPrintf ("\t\t%s\n", - SHARED == IrqData->SharedExclusive ? - "Shared" : "Exclusive"); + SHARED == IrqData->SharedExclusive ? "Shared" : "Exclusive"); - AcpiOsPrintf ("\t\t%X Interrupts ( ", - IrqData->NumberOfInterrupts); + AcpiOsPrintf ("\t\t%X Interrupts ( ", IrqData->NumberOfInterrupts); for (Index = 0; Index < IrqData->NumberOfInterrupts; Index++) { @@ -177,7 +173,7 @@ AcpiRsDumpIrq ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -185,9 +181,9 @@ AcpiRsDumpIrq ( void AcpiRsDumpDma ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - DMA_RESOURCE *DmaData = (DMA_RESOURCE*) Data; + ACPI_RESOURCE_DMA *DmaData = (ACPI_RESOURCE_DMA *) Data; UINT8 Index = 0; @@ -217,8 +213,8 @@ AcpiRsDumpDma ( } AcpiOsPrintf ("\t\t%sBus Master\n", - BUS_MASTER == DmaData->BusMaster ? - "" : "Not a "); + BUS_MASTER == DmaData->BusMaster ? "" : "Not a "); + switch (DmaData->Transfer) { @@ -239,8 +235,7 @@ AcpiRsDumpDma ( break; } - AcpiOsPrintf ("\t\tNumber of Channels: %X ( ", - DmaData->NumberOfChannels); + AcpiOsPrintf ("\t\tNumber of Channels: %X ( ", DmaData->NumberOfChannels); for (Index = 0; Index < DmaData->NumberOfChannels; Index++) { @@ -258,7 +253,7 @@ AcpiRsDumpDma ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -266,14 +261,14 @@ AcpiRsDumpDma ( void AcpiRsDumpStartDependentFunctions ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - START_DEPENDENT_FUNCTIONS_RESOURCE *SdfData = - (START_DEPENDENT_FUNCTIONS_RESOURCE*) Data; + ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data; AcpiOsPrintf ("\tStart Dependent Functions Resource\n"); + switch (SdfData->CompatibilityPriority) { case GOOD_CONFIGURATION: @@ -323,7 +318,7 @@ AcpiRsDumpStartDependentFunctions ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -331,9 +326,9 @@ AcpiRsDumpStartDependentFunctions ( void AcpiRsDumpIo ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - IO_RESOURCE *IoData = (IO_RESOURCE*) Data; + ACPI_RESOURCE_IO *IoData = (ACPI_RESOURCE_IO *) Data; AcpiOsPrintf ("\tIo Resource\n"); @@ -363,7 +358,7 @@ AcpiRsDumpIo ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -371,9 +366,9 @@ AcpiRsDumpIo ( void AcpiRsDumpFixedIo ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - FIXED_IO_RESOURCE *FixedIoData = (FIXED_IO_RESOURCE*) Data; + ACPI_RESOURCE_FIXED_IO *FixedIoData = (ACPI_RESOURCE_FIXED_IO *) Data; AcpiOsPrintf ("\tFixed Io Resource\n"); @@ -393,7 +388,7 @@ AcpiRsDumpFixedIo ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -401,9 +396,9 @@ AcpiRsDumpFixedIo ( void AcpiRsDumpVendorSpecific ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - VENDOR_RESOURCE *VendorData = (VENDOR_RESOURCE*) Data; + ACPI_RESOURCE_VENDOR *VendorData = (ACPI_RESOURCE_VENDOR *) Data; UINT16 Index = 0; @@ -427,7 +422,7 @@ AcpiRsDumpVendorSpecific ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -435,9 +430,9 @@ AcpiRsDumpVendorSpecific ( void AcpiRsDumpMemory24 ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - MEMORY24_RESOURCE *Memory24Data = (MEMORY24_RESOURCE*) Data; + ACPI_RESOURCE_MEM24 *Memory24Data = (ACPI_RESOURCE_MEM24 *) Data; AcpiOsPrintf ("\t24-Bit Memory Range Resource\n"); @@ -469,7 +464,7 @@ AcpiRsDumpMemory24 ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -477,9 +472,9 @@ AcpiRsDumpMemory24 ( void AcpiRsDumpMemory32 ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - MEMORY32_RESOURCE *Memory32Data = (MEMORY32_RESOURCE*) Data; + ACPI_RESOURCE_MEM32 *Memory32Data = (ACPI_RESOURCE_MEM32 *) Data; AcpiOsPrintf ("\t32-Bit Memory Range Resource\n"); @@ -519,9 +514,9 @@ AcpiRsDumpMemory32 ( void AcpiRsDumpFixedMemory32 ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - FIXED_MEMORY32_RESOURCE *FixedMemory32Data = (FIXED_MEMORY32_RESOURCE*) Data; + ACPI_RESOURCE_FIXED_MEM32 *FixedMemory32Data = (ACPI_RESOURCE_FIXED_MEM32 *) Data; AcpiOsPrintf ("\t32-Bit Fixed Location Memory Range Resource\n"); @@ -547,7 +542,7 @@ AcpiRsDumpFixedMemory32 ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -555,9 +550,9 @@ AcpiRsDumpFixedMemory32 ( void AcpiRsDumpAddress16 ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - ADDRESS16_RESOURCE *Address16Data = (ADDRESS16_RESOURCE*) Data; + ACPI_RESOURCE_ADDRESS16 *Address16Data = (ACPI_RESOURCE_ADDRESS16 *) Data; AcpiOsPrintf ("\t16-Bit Address Space Resource\n"); @@ -673,12 +668,12 @@ AcpiRsDumpAddress16 ( AcpiOsPrintf ("\t\tAddress Length: %08X\n", Address16Data->AddressLength); - if (0xFF != Address16Data->ResourceSourceIndex) + if (0xFF != Address16Data->ResourceSource.Index) { AcpiOsPrintf ("\t\tResource Source Index: %X\n", - Address16Data->ResourceSourceIndex); + Address16Data->ResourceSource.Index); AcpiOsPrintf ("\t\tResource Source: %s\n", - Address16Data->ResourceSource); + Address16Data->ResourceSource.StringPtr); } return; @@ -691,7 +686,7 @@ AcpiRsDumpAddress16 ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -699,9 +694,9 @@ AcpiRsDumpAddress16 ( void AcpiRsDumpAddress32 ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - ADDRESS32_RESOURCE *Address32Data = (ADDRESS32_RESOURCE*) Data; + ACPI_RESOURCE_ADDRESS32 *Address32Data = (ACPI_RESOURCE_ADDRESS32 *) Data; AcpiOsPrintf ("\t32-Bit Address Space Resource\n"); @@ -816,12 +811,155 @@ AcpiRsDumpAddress32 ( AcpiOsPrintf ("\t\tAddress Length: %08X\n", Address32Data->AddressLength); - if(0xFF != Address32Data->ResourceSourceIndex) + if(0xFF != Address32Data->ResourceSource.Index) { AcpiOsPrintf ("\t\tResource Source Index: %X\n", - Address32Data->ResourceSourceIndex); + Address32Data->ResourceSource.Index); AcpiOsPrintf ("\t\tResource Source: %s\n", - Address32Data->ResourceSource); + Address32Data->ResourceSource.StringPtr); + } + + return; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpAddress64 + * + * PARAMETERS: Data - pointer to the resource structure to dump. + * + * RETURN: None + * + * DESCRIPTION: Prints out the various members of the Data structure type. + * + ******************************************************************************/ + +void +AcpiRsDumpAddress64 ( + ACPI_RESOURCE_DATA *Data) +{ + ACPI_RESOURCE_ADDRESS64 *Address64Data = (ACPI_RESOURCE_ADDRESS64 *) Data; + + + AcpiOsPrintf ("\t64-Bit Address Space Resource\n"); + + switch (Address64Data->ResourceType) + { + case MEMORY_RANGE: + + AcpiOsPrintf ("\t\tResource Type: Memory Range\n"); + + switch (Address64Data->Attribute.Memory.CacheAttribute) + { + case NON_CACHEABLE_MEMORY: + AcpiOsPrintf ("\t\tType Specific: " + "Noncacheable memory\n"); + break; + + case CACHABLE_MEMORY: + AcpiOsPrintf ("\t\tType Specific: " + "Cacheable memory\n"); + break; + + case WRITE_COMBINING_MEMORY: + AcpiOsPrintf ("\t\tType Specific: " + "Write-combining memory\n"); + break; + + case PREFETCHABLE_MEMORY: + AcpiOsPrintf ("\t\tType Specific: " + "Prefetchable memory\n"); + break; + + default: + AcpiOsPrintf ("\t\tType Specific: " + "Invalid cache attribute\n"); + break; + } + + AcpiOsPrintf ("\t\tType Specific: Read%s\n", + READ_WRITE_MEMORY == + Address64Data->Attribute.Memory.ReadWriteAttribute ? + "/Write" : " Only"); + break; + + case IO_RANGE: + + AcpiOsPrintf ("\t\tResource Type: Io Range\n"); + + switch (Address64Data->Attribute.Io.RangeAttribute) + { + case NON_ISA_ONLY_RANGES: + AcpiOsPrintf ("\t\tType Specific: " + "Non-ISA Io Addresses\n"); + break; + + case ISA_ONLY_RANGES: + AcpiOsPrintf ("\t\tType Specific: " + "ISA Io Addresses\n"); + break; + + case ENTIRE_RANGE: + AcpiOsPrintf ("\t\tType Specific: " + "ISA and non-ISA Io Addresses\n"); + break; + + default: + AcpiOsPrintf ("\t\tType Specific: " + "Invalid Range attribute"); + break; + } + break; + + case BUS_NUMBER_RANGE: + + AcpiOsPrintf ("\t\tResource Type: Bus Number Range\n"); + break; + + default: + + AcpiOsPrintf ("\t\tInvalid Resource Type..exiting.\n"); + return; + } + + AcpiOsPrintf ("\t\tResource %s\n", + CONSUMER == Address64Data->ProducerConsumer ? + "Consumer" : "Producer"); + + AcpiOsPrintf ("\t\t%s decode\n", + SUB_DECODE == Address64Data->Decode ? + "Subtractive" : "Positive"); + + AcpiOsPrintf ("\t\tMin address is %s fixed\n", + ADDRESS_FIXED == Address64Data->MinAddressFixed ? + "" : "not "); + + AcpiOsPrintf ("\t\tMax address is %s fixed\n", + ADDRESS_FIXED == Address64Data->MaxAddressFixed ? + "" : "not "); + + AcpiOsPrintf ("\t\tGranularity: %16X\n", + Address64Data->Granularity); + + AcpiOsPrintf ("\t\tAddress range min: %16X\n", + Address64Data->MinAddressRange); + + AcpiOsPrintf ("\t\tAddress range max: %16X\n", + Address64Data->MaxAddressRange); + + AcpiOsPrintf ("\t\tAddress translation offset: %16X\n", + Address64Data->AddressTranslationOffset); + + AcpiOsPrintf ("\t\tAddress Length: %16X\n", + Address64Data->AddressLength); + + if(0xFF != Address64Data->ResourceSource.Index) + { + AcpiOsPrintf ("\t\tResource Source Index: %X\n", + Address64Data->ResourceSource.Index); + AcpiOsPrintf ("\t\tResource Source: %s\n", + Address64Data->ResourceSource.StringPtr); } return; @@ -834,7 +972,7 @@ AcpiRsDumpAddress32 ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Prints out the various members of the Data structure type. * @@ -842,9 +980,9 @@ AcpiRsDumpAddress32 ( void AcpiRsDumpExtendedIrq ( - RESOURCE_DATA *Data) + ACPI_RESOURCE_DATA *Data) { - EXTENDED_IRQ_RESOURCE *ExtIrqData = (EXTENDED_IRQ_RESOURCE*) Data; + ACPI_RESOURCE_EXT_IRQ *ExtIrqData = (ACPI_RESOURCE_EXT_IRQ *) Data; UINT8 Index = 0; @@ -876,12 +1014,12 @@ AcpiRsDumpExtendedIrq ( AcpiOsPrintf (")\n"); - if(0xFF != ExtIrqData->ResourceSourceIndex) + if(0xFF != ExtIrqData->ResourceSource.Index) { AcpiOsPrintf ("\t\tResource Source Index: %X", - ExtIrqData->ResourceSourceIndex); + ExtIrqData->ResourceSource.Index); AcpiOsPrintf ("\t\tResource Source: %s", - ExtIrqData->ResourceSource); + ExtIrqData->ResourceSource.StringPtr); } return; @@ -894,7 +1032,7 @@ AcpiRsDumpExtendedIrq ( * * PARAMETERS: Data - pointer to the resource structure to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Dispatches the structure to the correct dump routine. * @@ -902,7 +1040,7 @@ AcpiRsDumpExtendedIrq ( void AcpiRsDumpResourceList ( - RESOURCE *Resource) + ACPI_RESOURCE *Resource) { UINT8 Count = 0; BOOLEAN Done = FALSE; @@ -916,62 +1054,66 @@ AcpiRsDumpResourceList ( switch (Resource->Id) { - case Irq: + case ACPI_RSTYPE_IRQ: AcpiRsDumpIrq (&Resource->Data); break; - case Dma: + case ACPI_RSTYPE_DMA: AcpiRsDumpDma (&Resource->Data); break; - case StartDependentFunctions: + case ACPI_RSTYPE_START_DPF: AcpiRsDumpStartDependentFunctions (&Resource->Data); break; - case EndDependentFunctions: + case ACPI_RSTYPE_END_DPF: AcpiOsPrintf ("\tEndDependentFunctions Resource\n"); /* AcpiRsDumpEndDependentFunctions (Resource->Data);*/ break; - case Io: + case ACPI_RSTYPE_IO: AcpiRsDumpIo (&Resource->Data); break; - case FixedIo: + case ACPI_RSTYPE_FIXED_IO: AcpiRsDumpFixedIo (&Resource->Data); break; - case VendorSpecific: + case ACPI_RSTYPE_VENDOR: AcpiRsDumpVendorSpecific (&Resource->Data); break; - case EndTag: + case ACPI_RSTYPE_END_TAG: /*RsDumpEndTag (Resource->Data);*/ AcpiOsPrintf ("\tEndTag Resource\n"); Done = TRUE; break; - case Memory24: + case ACPI_RSTYPE_MEM24: AcpiRsDumpMemory24 (&Resource->Data); break; - case Memory32: + case ACPI_RSTYPE_MEM32: AcpiRsDumpMemory32 (&Resource->Data); break; - case FixedMemory32: + case ACPI_RSTYPE_FIXED_MEM32: AcpiRsDumpFixedMemory32 (&Resource->Data); break; - case Address16: + case ACPI_RSTYPE_ADDRESS16: AcpiRsDumpAddress16 (&Resource->Data); break; - case Address32: + case ACPI_RSTYPE_ADDRESS32: AcpiRsDumpAddress32 (&Resource->Data); break; - case ExtendedIrq: + case ACPI_RSTYPE_ADDRESS64: + AcpiRsDumpAddress64 (&Resource->Data); + break; + + case ACPI_RSTYPE_EXT_IRQ: AcpiRsDumpExtendedIrq (&Resource->Data); break; @@ -981,8 +1123,7 @@ AcpiRsDumpResourceList ( } - Resource = (RESOURCE *) ((NATIVE_UINT) Resource + - (NATIVE_UINT) Resource->Length); + Resource = POINTER_ADD (ACPI_RESOURCE, Resource, Resource->Length); } } @@ -995,7 +1136,7 @@ AcpiRsDumpResourceList ( * * PARAMETERS: Data - pointer to the routing table to dump. * - * RETURN: + * RETURN: None * * DESCRIPTION: Dispatches the structures to the correct dump routine. * diff --git a/sys/contrib/dev/acpica/rsio.c b/sys/contrib/dev/acpica/rsio.c index 9244f58..c979585 100644 --- a/sys/contrib/dev/acpica/rsio.c +++ b/sys/contrib/dev/acpica/rsio.c @@ -1,12 +1,7 @@ /******************************************************************************* * - * Module Name: rsio - AcpiRsIoResource - * AcpiRsFixedIoResource - * AcpiRsIoStream - * AcpiRsFixedIoStream - * AcpiRsDmaResource - * AcpiRsDmaStream - * $Revision: 12 $ + * Module Name: rsio - IO and DMA resource descriptors + * $Revision: 14 $ * ******************************************************************************/ @@ -124,7 +119,7 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsio") @@ -133,20 +128,20 @@ * FUNCTION: AcpiRsIoResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -158,21 +153,21 @@ AcpiRsIoResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - UINT32 StructSize = sizeof (IO_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IO); FUNCTION_TRACE ("RsIoResource"); + /* * The number of bytes consumed are Constant */ *BytesConsumed = 8; - OutputStruct->Id = Io; + OutputStruct->Id = ACPI_RSTYPE_IO; /* * Check Decode @@ -223,7 +218,6 @@ AcpiRsIoResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -233,20 +227,20 @@ AcpiRsIoResource ( * FUNCTION: AcpiRsFixedIoResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -258,21 +252,21 @@ AcpiRsFixedIoResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - UINT32 StructSize = sizeof (FIXED_IO_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO); FUNCTION_TRACE ("RsFixedIoResource"); + /* * The number of bytes consumed are Constant */ *BytesConsumed = 4; - OutputStruct->Id = FixedIo; + OutputStruct->Id = ACPI_RSTYPE_FIXED_IO; /* * Check Range Base Address @@ -299,7 +293,6 @@ AcpiRsFixedIoResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -311,19 +304,19 @@ AcpiRsFixedIoResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsIoStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -334,6 +327,7 @@ AcpiRsIoStream ( FUNCTION_TRACE ("RsIoStream"); + /* * The descriptor field is static */ @@ -383,9 +377,7 @@ AcpiRsIoStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -397,19 +389,19 @@ AcpiRsIoStream ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsFixedIoStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -420,6 +412,7 @@ AcpiRsFixedIoStream ( FUNCTION_TRACE ("RsFixedIoStream"); + /* * The descriptor field is static */ @@ -446,9 +439,7 @@ AcpiRsFixedIoStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -458,20 +449,20 @@ AcpiRsFixedIoStream ( * FUNCTION: AcpiRsDmaResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -483,21 +474,21 @@ AcpiRsDmaResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT8 Temp8 = 0; UINT8 Index; UINT8 i; - UINT32 StructSize = sizeof(DMA_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_DMA); FUNCTION_TRACE ("RsDmaResource"); + /* * The number of bytes consumed are Constant */ *BytesConsumed = 3; - OutputStruct->Id = Dma; + OutputStruct->Id = ACPI_RSTYPE_DMA; /* * Point to the 8-bits of Byte 1 @@ -558,7 +549,6 @@ AcpiRsDmaResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -570,19 +560,19 @@ AcpiRsDmaResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsDmaStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -629,9 +619,7 @@ AcpiRsDmaStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rsirq.c b/sys/contrib/dev/acpica/rsirq.c index 586195e..ae7af71 100644 --- a/sys/contrib/dev/acpica/rsirq.c +++ b/sys/contrib/dev/acpica/rsirq.c @@ -1,10 +1,7 @@ /******************************************************************************* * - * Module Name: rsirq - AcpiRsIrqResource, - * AcpiRsIrqStream - * AcpiRsExtendedIrqResource - * AcpiRsExtendedIrqStream - * $Revision: 13 $ + * Module Name: rsirq - IRQ resource descriptors + * $Revision: 17 $ * ******************************************************************************/ @@ -122,7 +119,7 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsirq") @@ -131,20 +128,20 @@ * FUNCTION: AcpiRsIrqResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -156,24 +153,24 @@ AcpiRsIrqResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; UINT8 Index; UINT8 i; - UINT32 StructSize = sizeof (IRQ_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ); FUNCTION_TRACE ("RsIrqResource"); + /* * The number of bytes consumed are contained in the descriptor * (Bits:0-1) */ Temp8 = *Buffer; *BytesConsumed = (Temp8 & 0x03) + 1; - OutputStruct->Id = Irq; + OutputStruct->Id = ACPI_RSTYPE_IRQ; /* * Point to the 16-bits of Bytes 1 and 2 @@ -229,8 +226,8 @@ AcpiRsIrqResource ( { /* * Only _LL and _HE polarity/trigger interrupts - * are allowed (ACPI spec v1.0b ection 6.4.2.1), - * so an error will occur if we reach this point + * are allowed (ACPI spec v1.0b ection 6.4.2.1), + * so an error will occur if we reach this point */ return_ACPI_STATUS (AE_BAD_DATA); } @@ -246,7 +243,7 @@ AcpiRsIrqResource ( { /* * Assume Edge Sensitive, Active High, Non-Sharable - * per ACPI Specification + * per ACPI Specification */ OutputStruct->Data.Irq.EdgeLevel = EDGE_SENSITIVE; OutputStruct->Data.Irq.ActiveHighLow = ACTIVE_HIGH; @@ -262,7 +259,6 @@ AcpiRsIrqResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -274,19 +270,19 @@ AcpiRsIrqResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsIrqStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -302,7 +298,7 @@ AcpiRsIrqStream ( /* * The descriptor field is set based upon whether a third byte is - * needed to contain the IRQ Information. + * needed to contain the IRQ Information. */ if (EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel && ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow && @@ -311,6 +307,7 @@ AcpiRsIrqStream ( *Buffer = 0x22; IRQInfoByteNeeded = FALSE; } + else { *Buffer = 0x23; @@ -361,9 +358,7 @@ AcpiRsIrqStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -373,20 +368,20 @@ AcpiRsIrqStream ( * FUNCTION: AcpiRsExtendedIrqResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -398,16 +393,17 @@ AcpiRsExtendedIrqResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; + NATIVE_CHAR *TempPtr; UINT8 Index; - UINT32 StructSize = sizeof (EXTENDED_IRQ_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ); FUNCTION_TRACE ("RsExtendedIrqResource"); + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -415,7 +411,7 @@ AcpiRsExtendedIrqResource ( MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); *BytesConsumed = Temp16 + 3; - OutputStruct->Id = ExtendedIrq; + OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ; /* * Point to the Byte3 @@ -446,8 +442,8 @@ AcpiRsExtendedIrqResource ( { /* * Only _LL and _HE polarity/trigger interrupts - * are allowed (ACPI spec v1.0b ection 6.4.2.1), - * so an error will occur if we reach this point + * are allowed (ACPI spec v1.0b ection 6.4.2.1), + * so an error will occur if we reach this point */ return_ACPI_STATUS (AE_BAD_DATA); } @@ -456,8 +452,7 @@ AcpiRsExtendedIrqResource ( /* * Check for sharable */ - OutputStruct->Data.ExtendedIrq.SharedExclusive = - (Temp8 >> 3) & 0x01; + OutputStruct->Data.ExtendedIrq.SharedExclusive = (Temp8 >> 3) & 0x01; /* * Point to Byte4 (IRQ Table length) @@ -469,9 +464,9 @@ AcpiRsExtendedIrqResource ( /* * Add any additional structure size to properly calculate - * the next pointer at the end of this function + * the next pointer at the end of this function */ - StructSize += (Temp8 - 1) * 4; + StructSize += (Temp8 - 1) * 4; /* * Point to Byte5 (First IRQ Number) @@ -493,34 +488,40 @@ AcpiRsExtendedIrqResource ( /* * This will leave us pointing to the Resource Source Index - * If it is present, then save it off and calculate the - * pointer to where the null terminated string goes: - * Each Interrupt takes 32-bits + the 5 bytes of the - * stream that are default. + * If it is present, then save it off and calculate the + * pointer to where the null terminated string goes: + * Each Interrupt takes 32-bits + the 5 bytes of the + * stream that are default. */ if (*BytesConsumed > - (UINT32)(OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * - 4) + 5) + (UINT32)(OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + 5) { /* Dereference the Index */ Temp8 = *Buffer; - OutputStruct->Data.ExtendedIrq.ResourceSourceIndex = - (UINT32)Temp8; + OutputStruct->Data.ExtendedIrq.ResourceSource.Index = (UINT32) Temp8; /* Point to the String */ Buffer += 1; + /* + * Point the String pointer to the end of this structure. + */ + OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = + (NATIVE_CHAR *)(OutputStruct + StructSize); + + TempPtr = OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr; + /* Copy the string into the buffer */ Index = 0; while (0x00 != *Buffer) { - OutputStruct->Data.ExtendedIrq.ResourceSource[Index] = - *Buffer; + *TempPtr = *Buffer; + TempPtr += 1; Buffer += 1; Index += 1; } @@ -528,24 +529,23 @@ AcpiRsExtendedIrqResource ( /* * Add the terminating null */ - OutputStruct->Data.ExtendedIrq.ResourceSource[Index] = 0x00; - OutputStruct->Data.ExtendedIrq.ResourceSourceStringLength = - Index + 1; + *TempPtr = 0x00; + OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = Index + 1; /* - * In order for the StructSize to fall on a 32-bit boundry, - * calculate the length of the string and expand the - * StructSize to the next 32-bit boundry. + * In order for the StructSize to fall on a 32-bit boundary, + * calculate the length of the string and expand the + * StructSize to the next 32-bit boundary. */ Temp8 = (UINT8) (Index + 1); - Temp8 = (UINT8) ROUND_UP_TO_32BITS (Temp8); + StructSize += ROUND_UP_TO_32BITS (Temp8); } else { - OutputStruct->Data.ExtendedIrq.ResourceSourceIndex = 0x00; - OutputStruct->Data.ExtendedIrq.ResourceSourceStringLength = 0; - OutputStruct->Data.ExtendedIrq.ResourceSource[0] = 0x00; + OutputStruct->Data.ExtendedIrq.ResourceSource.Index = 0x00; + OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = 0; + OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = NULL; } /* @@ -557,7 +557,6 @@ AcpiRsExtendedIrqResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -569,10 +568,10 @@ AcpiRsExtendedIrqResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the * the appropriate bytes in a byte stream @@ -581,7 +580,7 @@ AcpiRsExtendedIrqResource ( ACPI_STATUS AcpiRsExtendedIrqStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -604,7 +603,6 @@ AcpiRsExtendedIrqStream ( /* * Set a pointer to the Length field - to be filled in later */ - LengthField = (UINT16 *)Buffer; Buffer += 2; @@ -612,7 +610,6 @@ AcpiRsExtendedIrqStream ( * Set the Interrupt vector flags */ Temp8 = (UINT8)(LinkedList->Data.ExtendedIrq.ProducerConsumer & 0x01); - Temp8 |= ((LinkedList->Data.ExtendedIrq.SharedExclusive & 0x01) << 3); if (LEVEL_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel && @@ -636,8 +633,7 @@ AcpiRsExtendedIrqStream ( *Buffer = Temp8; Buffer += 1; - for (Index = 0; - Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts; + for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts; Index++) { MOVE_UNALIGNED32_TO_32 (Buffer, @@ -648,9 +644,9 @@ AcpiRsExtendedIrqStream ( /* * Resource Source Index and Resource Source are optional */ - if (0 != LinkedList->Data.ExtendedIrq.ResourceSourceStringLength) + if (0 != LinkedList->Data.ExtendedIrq.ResourceSource.StringLength) { - *Buffer = (UINT8) LinkedList->Data.ExtendedIrq.ResourceSourceIndex; + *Buffer = (UINT8) LinkedList->Data.ExtendedIrq.ResourceSource.Index; Buffer += 1; TempPointer = (NATIVE_CHAR *) Buffer; @@ -658,27 +654,26 @@ AcpiRsExtendedIrqStream ( /* * Copy the string */ - STRCPY (TempPointer, LinkedList->Data.ExtendedIrq.ResourceSource); + STRCPY (TempPointer, + LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr); /* * Buffer needs to be set to the length of the sting + one for the - * terminating null + * terminating null */ - Buffer += (STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource) + 1); + Buffer += (STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1); } /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); /* * Set the length field to the number of bytes consumed - * minus the header size (3 bytes) + * minus the header size (3 bytes) */ *LengthField = (UINT16) (*BytesConsumed - 3); - return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rslist.c b/sys/contrib/dev/acpica/rslist.c index 60e10b4..d7ec0f9 100644 --- a/sys/contrib/dev/acpica/rslist.c +++ b/sys/contrib/dev/acpica/rslist.c @@ -1,8 +1,7 @@ /******************************************************************************* * - * Module Name: rslist - AcpiRsByteStreamToList - * AcpiListToByteStream - * $Revision: 11 $ + * Module Name: rslist - Linked list utilities + * $Revision: 17 $ * ******************************************************************************/ @@ -120,20 +119,65 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rslist") /******************************************************************************* * + * FUNCTION: AcpiRsGetResourceType + * + * PARAMETERS: ResourceStartByte - Byte 0 of a resource descriptor + * + * RETURN: The Resource Type (Name) with no extraneous bits + * + * DESCRIPTION: Extract the Resource Type/Name from the first byte of + * a resource descriptor. + * + ******************************************************************************/ + +UINT8 +AcpiRsGetResourceType ( + UINT8 ResourceStartByte) +{ + + /* + * Determine if this is a small or large resource + */ + switch (ResourceStartByte & RESOURCE_DESC_TYPE_MASK) + { + case RESOURCE_DESC_TYPE_SMALL: + + /* + * Small Resource Type -- Only bits 6:3 are valid + */ + return ((UINT8) (ResourceStartByte & RESOURCE_DESC_SMALL_MASK)); + break; + + + case RESOURCE_DESC_TYPE_LARGE: + + /* + * Large Resource Type -- All bits are valid + */ + return (ResourceStartByte); + break; + } + + return (0xFF); +} + + +/******************************************************************************* + * * FUNCTION: AcpiRsByteStreamToList * * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream * ByteStreamBufferLength - Length of ByteStreamBuffer * OutputBuffer - Pointer to the buffer that will - * contain the output structures + * contain the output structures * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Takes the resource byte stream and parses it, creating a * linked list of resources in the caller's output buffer @@ -162,222 +206,170 @@ AcpiRsByteStreamToList ( FALSE == EndTagProcessed) { /* - * Look at the next byte in the stream + * The next byte in the stream is the resource type */ - ResourceType = *ByteStreamBuffer; + ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer); - /* - * See if this is a small or large resource - */ - if(ResourceType & 0x80) + switch (ResourceType) { + case RESOURCE_DESC_MEMORY_24: + /* + * 24-Bit Memory Resource + */ + Status = AcpiRsMemory24Resource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_LARGE_VENDOR: + /* + * Vendor Defined Resource + */ + Status = AcpiRsVendorResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_MEMORY_32: + /* + * 32-Bit Memory Range Resource + */ + Status = AcpiRsMemory32RangeResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_FIXED_MEMORY_32: + /* + * 32-Bit Fixed Memory Resource + */ + Status = AcpiRsFixedMemory32Resource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_QWORD_ADDRESS_SPACE: + /* + * 64-Bit Address Resource + */ + Status = AcpiRsAddress64Resource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_DWORD_ADDRESS_SPACE: + /* + * 32-Bit Address Resource + */ + Status = AcpiRsAddress32Resource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_WORD_ADDRESS_SPACE: + /* + * 16-Bit Address Resource + */ + Status = AcpiRsAddress16Resource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_EXTENDED_XRUPT: /* - * Large Resource Type - */ - switch (ResourceType) - { - case MEMORY_RANGE_24: - /* - * 24-Bit Memory Resource - */ - Status = AcpiRsMemory24Resource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case LARGE_VENDOR_DEFINED: - /* - * Vendor Defined Resource - */ - Status = AcpiRsVendorResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case MEMORY_RANGE_32: - /* - * 32-Bit Memory Range Resource - */ - Status = AcpiRsMemory32RangeResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case FIXED_MEMORY_RANGE_32: - /* - * 32-Bit Fixed Memory Resource - */ - Status = AcpiRsFixedMemory32Resource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case DWORD_ADDRESS_SPACE: - /* - * 32-Bit Address Resource - */ - Status = AcpiRsAddress32Resource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case WORD_ADDRESS_SPACE: - /* - * 16-Bit Address Resource - */ - Status = AcpiRsAddress16Resource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case EXTENDED_IRQ: - /* - * Extended IRQ - */ - Status = AcpiRsExtendedIrqResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - -/* TBD: [Future] 64-bit not currently supported */ -/* - case 0x8A: - break; -*/ - - default: - /* - * If we get here, everything is out of sync, - * so exit with an error - */ - return_ACPI_STATUS (AE_AML_ERROR); - break; - } + * Extended IRQ + */ + Status = AcpiRsExtendedIrqResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_IRQ_FORMAT: + /* + * IRQ Resource + */ + Status = AcpiRsIrqResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_DMA_FORMAT: + /* + * DMA Resource + */ + Status = AcpiRsDmaResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_START_DEPENDENT: + /* + * Start Dependent Functions Resource + */ + Status = AcpiRsStartDependentFunctionsResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_END_DEPENDENT: + /* + * End Dependent Functions Resource + */ + Status = AcpiRsEndDependentFunctionsResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_IO_PORT: + /* + * IO Port Resource + */ + Status = AcpiRsIoResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_FIXED_IO_PORT: + /* + * Fixed IO Port Resource + */ + Status = AcpiRsFixedIoResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_SMALL_VENDOR: + /* + * Vendor Specific Resource + */ + Status = AcpiRsVendorResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + case RESOURCE_DESC_END_TAG: + /* + * End Tag + */ + EndTagProcessed = TRUE; + Status = AcpiRsEndTagResource (ByteStreamBuffer, + &BytesConsumed, Buffer, &StructureSize); + break; + + + default: + /* + * Invalid/Unknowns resource type + */ + Status = AE_AML_ERROR; + break; } - else + + if (!ACPI_SUCCESS(Status)) { - /* - * Small Resource Type - * Only bits 7:3 are valid - */ - ResourceType >>= 3; - - switch(ResourceType) - { - case IRQ_FORMAT: - /* - * IRQ Resource - */ - Status = AcpiRsIrqResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case DMA_FORMAT: - /* - * DMA Resource - */ - Status = AcpiRsDmaResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case START_DEPENDENT_TAG: - /* - * Start Dependent Functions Resource - */ - Status = AcpiRsStartDependentFunctionsResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case END_DEPENDENT_TAG: - /* - * End Dependent Functions Resource - */ - Status = AcpiRsEndDependentFunctionsResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case IO_PORT_DESCRIPTOR: - /* - * IO Port Resource - */ - Status = AcpiRsIoResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case FIXED_LOCATION_IO_DESCRIPTOR: - /* - * Fixed IO Port Resource - */ - Status = AcpiRsFixedIoResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case SMALL_VENDOR_DEFINED: - /* - * Vendor Specific Resource - */ - Status = AcpiRsVendorResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - - break; - - case END_TAG: - /* - * End Tag - */ - Status = AcpiRsEndTagResource(ByteStreamBuffer, - &BytesConsumed, - Buffer, - &StructureSize); - EndTagProcessed = TRUE; - - break; - - default: - /* - * If we get here, everything is out of sync, - * so exit with an error - */ - return_ACPI_STATUS (AE_AML_ERROR); - break; - - } /* switch */ - } /* end else */ + return_ACPI_STATUS (Status); + } /* * Update the return value and counter @@ -414,15 +406,15 @@ AcpiRsByteStreamToList ( * * PARAMETERS: LinkedList - Pointer to the resource linked list * ByteSteamSizeNeeded - Calculated size of the byte stream - * needed from calling - * AcpiRsCalculateByteStreamLength() - * The size of the OutputBuffer is - * guaranteed to be >= - * ByteStreamSizeNeeded + * needed from calling + * AcpiRsCalculateByteStreamLength() + * The size of the OutputBuffer is + * guaranteed to be >= + * ByteStreamSizeNeeded * OutputBuffer - Pointer to the buffer that will - * contain the byte stream + * contain the byte stream * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Takes the resource linked list and parses it, creating a * byte stream of resources in the caller's output buffer @@ -431,7 +423,7 @@ AcpiRsByteStreamToList ( ACPI_STATUS AcpiRsListToByteStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT32 ByteStreamSizeNeeded, UINT8 **OutputBuffer) { @@ -447,76 +439,62 @@ AcpiRsListToByteStream ( { switch (LinkedList->Id) { - case Irq: + case ACPI_RSTYPE_IRQ: /* * IRQ Resource */ - Status = AcpiRsIrqStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsIrqStream (LinkedList, &Buffer, &BytesConsumed); break; - case Dma: + case ACPI_RSTYPE_DMA: /* * DMA Resource */ - Status = AcpiRsDmaStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsDmaStream (LinkedList, &Buffer, &BytesConsumed); break; - case StartDependentFunctions: + case ACPI_RSTYPE_START_DPF: /* * Start Dependent Functions Resource */ Status = AcpiRsStartDependentFunctionsStream (LinkedList, - &Buffer, - &BytesConsumed); + &Buffer, &BytesConsumed); break; - case EndDependentFunctions: + case ACPI_RSTYPE_END_DPF: /* * End Dependent Functions Resource */ Status = AcpiRsEndDependentFunctionsStream (LinkedList, - &Buffer, - &BytesConsumed); + &Buffer, &BytesConsumed); break; - case Io: + case ACPI_RSTYPE_IO: /* * IO Port Resource */ - Status = AcpiRsIoStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsIoStream (LinkedList, &Buffer, &BytesConsumed); break; - case FixedIo: + case ACPI_RSTYPE_FIXED_IO: /* * Fixed IO Port Resource */ - Status = AcpiRsFixedIoStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsFixedIoStream (LinkedList, &Buffer, &BytesConsumed); break; - case VendorSpecific: + case ACPI_RSTYPE_VENDOR: /* * Vendor Defined Resource */ - Status = AcpiRsVendorStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsVendorStream (LinkedList, &Buffer, &BytesConsumed); break; - case EndTag: + case ACPI_RSTYPE_END_TAG: /* * End Tag */ - Status = AcpiRsEndTagStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsEndTagStream (LinkedList, &Buffer, &BytesConsumed); /* * An End Tag indicates the end of the Resource Template @@ -524,58 +502,59 @@ AcpiRsListToByteStream ( Done = TRUE; break; - case Memory24: + case ACPI_RSTYPE_MEM24: /* * 24-Bit Memory Resource */ - Status = AcpiRsMemory24Stream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsMemory24Stream (LinkedList, &Buffer, &BytesConsumed); break; - case Memory32: + case ACPI_RSTYPE_MEM32: /* * 32-Bit Memory Range Resource */ - Status = AcpiRsMemory32RangeStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsMemory32RangeStream (LinkedList, &Buffer, + &BytesConsumed); break; - case FixedMemory32: + case ACPI_RSTYPE_FIXED_MEM32: /* * 32-Bit Fixed Memory Resource */ - Status = AcpiRsFixedMemory32Stream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsFixedMemory32Stream (LinkedList, &Buffer, + &BytesConsumed); break; - case Address16: + case ACPI_RSTYPE_ADDRESS16: /* * 16-Bit Address Descriptor Resource */ - Status = AcpiRsAddress16Stream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsAddress16Stream (LinkedList, &Buffer, + &BytesConsumed); break; - case Address32: + case ACPI_RSTYPE_ADDRESS32: /* * 32-Bit Address Descriptor Resource */ - Status = AcpiRsAddress32Stream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsAddress32Stream (LinkedList, &Buffer, + &BytesConsumed); + break; + + case ACPI_RSTYPE_ADDRESS64: + /* + * 64-Bit Address Descriptor Resource + */ + Status = AcpiRsAddress64Stream (LinkedList, &Buffer, + &BytesConsumed); break; - case ExtendedIrq: + case ACPI_RSTYPE_EXT_IRQ: /* * Extended IRQ Resource */ - Status = AcpiRsExtendedIrqStream (LinkedList, - &Buffer, - &BytesConsumed); + Status = AcpiRsExtendedIrqStream (LinkedList, &Buffer, + &BytesConsumed); break; default: @@ -583,11 +562,17 @@ AcpiRsListToByteStream ( * If we get here, everything is out of sync, * so exit with an error */ - return_ACPI_STATUS (AE_BAD_DATA); + Status = AE_BAD_DATA; break; } /* switch (LinkedList->Id) */ + + if (!ACPI_SUCCESS(Status)) + { + return_ACPI_STATUS (Status); + } + /* * Set the Buffer to point to the open byte */ @@ -596,10 +581,10 @@ AcpiRsListToByteStream ( /* * Point to the next object */ - LinkedList = (RESOURCE *) ((NATIVE_UINT) LinkedList + - (NATIVE_UINT) LinkedList->Length); + LinkedList = POINTER_ADD (ACPI_RESOURCE, + LinkedList, LinkedList->Length); } - return_ACPI_STATUS (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rsmemory.c b/sys/contrib/dev/acpica/rsmemory.c index 21af073..368f765 100644 --- a/sys/contrib/dev/acpica/rsmemory.c +++ b/sys/contrib/dev/acpica/rsmemory.c @@ -1,12 +1,7 @@ /******************************************************************************* * - * Module Name: rsmem24 - AcpiRsMemory24Resource - * AcpiRsMemory24Stream - * AcpiRsMemory32RangeResource - * AcpiRsFixedMemory32Resource - * AcpiRsMemory32RangeStream - * AcpiRsFixedMemory32Stream - * $Revision: 12 $ + * Module Name: rsmem24 - Memory resource descriptors + * $Revision: 14 $ * ******************************************************************************/ @@ -124,7 +119,7 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsmemory") @@ -133,20 +128,20 @@ * FUNCTION: AcpiRsMemory24Resource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -158,15 +153,15 @@ AcpiRsMemory24Resource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - UINT32 StructSize = sizeof (MEMORY24_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24); FUNCTION_TRACE ("RsMemory24Resource"); + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -175,7 +170,7 @@ AcpiRsMemory24Resource ( MOVE_UNALIGNED16_TO_16 (&Temp16, Buffer); Buffer += 2; *BytesConsumed = Temp16 + 3; - OutputStruct->Id = Memory24; + OutputStruct->Id = ACPI_RSTYPE_MEM24; /* * Check Byte 3 the Read/Write bit @@ -220,7 +215,6 @@ AcpiRsMemory24Resource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -232,19 +226,19 @@ AcpiRsMemory24Resource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsMemory24Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -255,6 +249,7 @@ AcpiRsMemory24Stream ( FUNCTION_TRACE ("RsMemory24Stream"); + /* * The descriptor field is static */ @@ -302,9 +297,7 @@ AcpiRsMemory24Stream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -314,20 +307,20 @@ AcpiRsMemory24Stream ( * FUNCTION: AcpiRsMemory32RangeResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -339,15 +332,15 @@ AcpiRsMemory32RangeResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - UINT32 StructSize = sizeof (MEMORY32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32); FUNCTION_TRACE ("RsMemory32RangeResource"); + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -357,11 +350,11 @@ AcpiRsMemory32RangeResource ( Buffer += 2; *BytesConsumed = Temp16 + 3; - OutputStruct->Id = Memory32; + OutputStruct->Id = ACPI_RSTYPE_MEM32; /* * Point to the place in the output buffer where the data portion will - * begin. + * begin. * 1. Set the RESOURCE_DATA * Data to point to it's own address, then * 2. Set the pointer to the next address. * @@ -411,7 +404,6 @@ AcpiRsMemory32RangeResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -421,20 +413,20 @@ AcpiRsMemory32RangeResource ( * FUNCTION: AcpiRsFixedMemory32Resource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -446,15 +438,15 @@ AcpiRsFixedMemory32Resource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; - UINT32 StructSize = sizeof (FIXED_MEMORY32_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32); FUNCTION_TRACE ("RsFixedMemory32Resource"); + /* * Point past the Descriptor to get the number of bytes consumed */ @@ -464,7 +456,7 @@ AcpiRsFixedMemory32Resource ( Buffer += 2; *BytesConsumed = Temp16 + 3; - OutputStruct->Id = FixedMemory32; + OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32; /* * Check Byte 3 the Read/Write bit @@ -495,7 +487,6 @@ AcpiRsFixedMemory32Resource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -507,19 +498,19 @@ AcpiRsFixedMemory32Resource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsMemory32RangeStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -530,6 +521,7 @@ AcpiRsMemory32RangeStream ( FUNCTION_TRACE ("RsMemory32RangeStream"); + /* * The descriptor field is static */ @@ -578,9 +570,7 @@ AcpiRsMemory32RangeStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -592,19 +582,19 @@ AcpiRsMemory32RangeStream ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsFixedMemory32Stream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -615,6 +605,7 @@ AcpiRsFixedMemory32Stream ( FUNCTION_TRACE ("RsFixedMemory32Stream"); + /* * The descriptor field is static */ @@ -653,9 +644,7 @@ AcpiRsFixedMemory32Stream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rsmisc.c b/sys/contrib/dev/acpica/rsmisc.c index 2336ab9..54d8656 100644 --- a/sys/contrib/dev/acpica/rsmisc.c +++ b/sys/contrib/dev/acpica/rsmisc.c @@ -1,14 +1,7 @@ /******************************************************************************* * - * Module Name: rsmisc - AcpiRsEndTagResource - * AcpiRsEndTagStream - * AcpiRsVendorResource - * AcpiRsVendorStream - * AcpiRsStartDependentFunctionsResource - * AcpiRsEndDependentFunctionsResource - * AcpiRsStartDependentFunctionsStream - * AcpiRsEndDependentFunctionsStream - * $Revision: 12 $ + * Module Name: rsmisc - Miscellaneous resource descriptors + * $Revision: 15 $ * ******************************************************************************/ @@ -126,7 +119,7 @@ #include "acpi.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsmisc") @@ -135,20 +128,20 @@ * FUNCTION: AcpiRsEndTagResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -159,12 +152,13 @@ AcpiRsEndTagResource ( UINT8 **OutputBuffer, UINT32 *StructureSize) { - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; - UINT32 StructSize = RESOURCE_LENGTH; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + UINT32 StructSize = ACPI_RESOURCE_LENGTH; FUNCTION_TRACE ("RsEndTagResource"); + /* * The number of bytes consumed is static */ @@ -173,7 +167,7 @@ AcpiRsEndTagResource ( /* * Fill out the structure */ - OutputStruct->Id = EndTag; + OutputStruct->Id = ACPI_RSTYPE_END_TAG; /* * Set the Length parameter @@ -184,7 +178,6 @@ AcpiRsEndTagResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -196,19 +189,19 @@ AcpiRsEndTagResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsEndTagStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -218,6 +211,7 @@ AcpiRsEndTagStream ( FUNCTION_TRACE ("RsEndTagStream"); + /* * The descriptor field is static */ @@ -226,7 +220,7 @@ AcpiRsEndTagStream ( /* * Set the Checksum - zero means that the resource data is treated as if - * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) + * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8) */ Temp8 = 0; @@ -236,9 +230,7 @@ AcpiRsEndTagStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -248,20 +240,20 @@ AcpiRsEndTagStream ( * FUNCTION: AcpiRsVendorResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -273,16 +265,16 @@ AcpiRsVendorResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT16 Temp16 = 0; UINT8 Temp8 = 0; UINT8 Index; - UINT32 StructSize = sizeof (VENDOR_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR); FUNCTION_TRACE ("RsVendorResource"); + /* * Dereference the Descriptor to find if this is a large or small item. */ @@ -292,9 +284,8 @@ AcpiRsVendorResource ( { /* * Large Item + * Point to the length field */ - /* Point to the length field */ - Buffer += 1; /* Dereference */ @@ -314,10 +305,8 @@ AcpiRsVendorResource ( { /* * Small Item + * Dereference the size */ - - /* Dereference the size */ - Temp16 = (UINT8)(*Buffer & 0x07); /* Calculate bytes consumed */ @@ -329,7 +318,7 @@ AcpiRsVendorResource ( Buffer += 1; } - OutputStruct->Id = VendorSpecific; + OutputStruct->Id = ACPI_RSTYPE_VENDOR; OutputStruct->Data.VendorSpecific.Length = Temp16; for (Index = 0; Index < Temp16; Index++) @@ -339,9 +328,9 @@ AcpiRsVendorResource ( } /* - * In order for the StructSize to fall on a 32-bit boundry, - * calculate the length of the vendor string and expand the - * StructSize to the next 32-bit boundry. + * In order for the StructSize to fall on a 32-bit boundary, + * calculate the length of the vendor string and expand the + * StructSize to the next 32-bit boundary. */ StructSize += ROUND_UP_TO_32BITS (Temp16); @@ -354,7 +343,6 @@ AcpiRsVendorResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -366,19 +354,19 @@ AcpiRsVendorResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsVendorStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -390,16 +378,14 @@ AcpiRsVendorStream ( FUNCTION_TRACE ("RsVendorStream"); + /* * Dereference the length to find if this is a large or small item. */ - if(LinkedList->Data.VendorSpecific.Length > 7) { /* * Large Item - */ - /* * Set the descriptor field and length bytes */ *Buffer = 0x84; @@ -415,9 +401,6 @@ AcpiRsVendorStream ( { /* * Small Item - */ - - /* * Set the descriptor field */ Temp8 = 0x70; @@ -441,9 +424,7 @@ AcpiRsVendorStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -453,20 +434,20 @@ AcpiRsVendorStream ( * FUNCTION: AcpiRsStartDependentFunctionsResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -478,15 +459,14 @@ AcpiRsStartDependentFunctionsResource ( UINT32 *StructureSize) { UINT8 *Buffer = ByteStreamBuffer; - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; UINT8 Temp8 = 0; - UINT32 StructSize = - sizeof(START_DEPENDENT_FUNCTIONS_RESOURCE) + - RESOURCE_LENGTH_NO_DATA; + UINT32 StructSize = SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF); FUNCTION_TRACE ("RsStartDependentFunctionsResource"); + /* * The number of bytes consumed are contained in the descriptor (Bits:0-1) */ @@ -494,7 +474,7 @@ AcpiRsStartDependentFunctionsResource ( *BytesConsumed = (Temp8 & 0x01) + 1; - OutputStruct->Id = StartDependentFunctions; + OutputStruct->Id = ACPI_RSTYPE_START_DPF; /* * Point to Byte 1 if it is used @@ -507,10 +487,9 @@ AcpiRsStartDependentFunctionsResource ( /* * Check Compatibility priority */ - OutputStruct->Data.StartDependentFunctions.CompatibilityPriority = - Temp8 & 0x03; + OutputStruct->Data.StartDpf.CompatibilityPriority = Temp8 & 0x03; - if (3 == OutputStruct->Data.StartDependentFunctions.CompatibilityPriority) + if (3 == OutputStruct->Data.StartDpf.CompatibilityPriority) { return_ACPI_STATUS (AE_AML_ERROR); } @@ -518,10 +497,9 @@ AcpiRsStartDependentFunctionsResource ( /* * Check Performance/Robustness preference */ - OutputStruct->Data.StartDependentFunctions.PerformanceRobustness = - (Temp8 >> 2) & 0x03; + OutputStruct->Data.StartDpf.PerformanceRobustness = (Temp8 >> 2) & 0x03; - if (3 == OutputStruct->Data.StartDependentFunctions.PerformanceRobustness) + if (3 == OutputStruct->Data.StartDpf.PerformanceRobustness) { return_ACPI_STATUS (AE_AML_ERROR); } @@ -529,10 +507,10 @@ AcpiRsStartDependentFunctionsResource ( else { - OutputStruct->Data.StartDependentFunctions.CompatibilityPriority = + OutputStruct->Data.StartDpf.CompatibilityPriority = ACCEPTABLE_CONFIGURATION; - OutputStruct->Data.StartDependentFunctions.PerformanceRobustness = + OutputStruct->Data.StartDpf.PerformanceRobustness = ACCEPTABLE_CONFIGURATION; } @@ -545,7 +523,6 @@ AcpiRsStartDependentFunctionsResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -555,20 +532,20 @@ AcpiRsStartDependentFunctionsResource ( * FUNCTION: AcpiRsEndDependentFunctionsResource * * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte - * stream + * stream * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes consumed from - * the ByteStreamBuffer + * the number of bytes consumed from + * the ByteStreamBuffer * OutputBuffer - Pointer to the user's return buffer * StructureSize - UINT32 pointer that is filled with - * the number of bytes in the filled - * in structure + * the number of bytes in the filled + * in structure * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the resource byte stream and fill out the appropriate - * structure pointed to by the OutputBuffer. Return the - * number of bytes consumed from the byte stream. + * structure pointed to by the OutputBuffer. Return the + * number of bytes consumed from the byte stream. * ******************************************************************************/ @@ -579,12 +556,13 @@ AcpiRsEndDependentFunctionsResource ( UINT8 **OutputBuffer, UINT32 *StructureSize) { - RESOURCE *OutputStruct = (RESOURCE *) * OutputBuffer; - UINT32 StructSize = RESOURCE_LENGTH; + ACPI_RESOURCE *OutputStruct = (ACPI_RESOURCE *) *OutputBuffer; + UINT32 StructSize = ACPI_RESOURCE_LENGTH; FUNCTION_TRACE ("RsEndDependentFunctionsResource"); + /* * The number of bytes consumed is static */ @@ -593,7 +571,7 @@ AcpiRsEndDependentFunctionsResource ( /* * Fill out the structure */ - OutputStruct->Id = EndDependentFunctions; + OutputStruct->Id = ACPI_RSTYPE_END_DPF; /* * Set the Length parameter @@ -604,7 +582,6 @@ AcpiRsEndDependentFunctionsResource ( * Return the final size of the structure */ *StructureSize = StructSize; - return_ACPI_STATUS (AE_OK); } @@ -616,19 +593,19 @@ AcpiRsEndDependentFunctionsResource ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsStartDependentFunctionsStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed) { @@ -638,14 +615,15 @@ AcpiRsStartDependentFunctionsStream ( FUNCTION_TRACE ("RsStartDependentFunctionsStream"); + /* * The descriptor field is set based upon whether a byte is needed - * to contain Priority data. + * to contain Priority data. */ if (ACCEPTABLE_CONFIGURATION == - LinkedList->Data.StartDependentFunctions.CompatibilityPriority && + LinkedList->Data.StartDpf.CompatibilityPriority && ACCEPTABLE_CONFIGURATION == - LinkedList->Data.StartDependentFunctions.PerformanceRobustness) + LinkedList->Data.StartDpf.PerformanceRobustness) { *Buffer = 0x30; } @@ -658,13 +636,10 @@ AcpiRsStartDependentFunctionsStream ( * Set the Priority Byte Definition */ Temp8 = 0; - Temp8 = (UINT8) - ((LinkedList->Data.StartDependentFunctions.PerformanceRobustness & - 0x03) << 2); - Temp8 |= - (LinkedList->Data.StartDependentFunctions.CompatibilityPriority & - 0x03); - + Temp8 = (UINT8) ((LinkedList->Data.StartDpf.PerformanceRobustness & + 0x03) << 2); + Temp8 |= (LinkedList->Data.StartDpf.CompatibilityPriority & + 0x03); *Buffer = Temp8; } @@ -673,9 +648,7 @@ AcpiRsStartDependentFunctionsStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } @@ -687,19 +660,19 @@ AcpiRsStartDependentFunctionsStream ( * PARAMETERS: LinkedList - Pointer to the resource linked list * OutputBuffer - Pointer to the user's return buffer * BytesConsumed - UINT32 pointer that is filled with - * the number of bytes of the - * OutputBuffer used + * the number of bytes of the + * OutputBuffer used * - * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status * * DESCRIPTION: Take the linked list resource structure and fills in the - * the appropriate bytes in a byte stream + * the appropriate bytes in a byte stream * ******************************************************************************/ ACPI_STATUS AcpiRsEndDependentFunctionsStream ( - RESOURCE *LinkedList, + ACPI_RESOURCE *LinkedList, UINT8 **OutputBuffer, UINT32 *BytesConsumed ) @@ -709,6 +682,7 @@ AcpiRsEndDependentFunctionsStream ( FUNCTION_TRACE ("RsEndDependentFunctionsStream"); + /* * The descriptor field is static */ @@ -718,9 +692,7 @@ AcpiRsEndDependentFunctionsStream ( /* * Return the number of bytes consumed in this operation */ - *BytesConsumed = (UINT32) ((NATIVE_UINT) Buffer - - (NATIVE_UINT) *OutputBuffer); - + *BytesConsumed = POINTER_DIFF (Buffer, *OutputBuffer); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/rsutils.c b/sys/contrib/dev/acpica/rsutils.c index fb14be3..1225549 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: 14 $ + * $Revision: 19 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsutils") @@ -134,7 +134,7 @@ * RetBuffer - a pointer to a buffer structure for the * results * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to get the _PRT value of an object * contained in an object specified by the handle passed in @@ -174,7 +174,7 @@ AcpiRsGetPrtMethodData ( { /* Return object is required */ - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _PRT\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _PRT\n")); return_ACPI_STATUS (AE_TYPE); } @@ -196,9 +196,8 @@ AcpiRsGetPrtMethodData ( * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreatePciRoutingTable (RetObj, - RetBuffer->Pointer, - &BufferSpaceNeeded); + Status = AcpiRsCreatePciRoutingTable (RetObj, RetBuffer->Pointer, + &BufferSpaceNeeded); /* * Tell the user how much of the buffer we have used or is needed @@ -211,8 +210,7 @@ AcpiRsGetPrtMethodData ( Cleanup: - AcpiCmRemoveReference (RetObj); - + AcpiUtRemoveReference (RetObj); return_ACPI_STATUS (Status); } @@ -225,7 +223,7 @@ Cleanup: * RetBuffer - a pointer to a buffer structure for the * results * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to get the _CRS value of an object * contained in an object specified by the handle passed in @@ -263,7 +261,7 @@ AcpiRsGetCrsMethodData ( { /* Return object is required */ - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _CRS\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _CRS\n")); return_ACPI_STATUS (AE_TYPE); } @@ -284,15 +282,9 @@ AcpiRsGetCrsMethodData ( * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreateResourceList (RetObj, - RetBuffer->Pointer, - &BufferSpaceNeeded); - + Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer, + &BufferSpaceNeeded); - if (ACPI_SUCCESS (Status)) - { - DUMP_RESOURCE_LIST(RetBuffer->Pointer); - } /* * Tell the user how much of the buffer we have used or is needed @@ -305,8 +297,7 @@ AcpiRsGetCrsMethodData ( Cleanup: - AcpiCmRemoveReference (RetObj); - + AcpiUtRemoveReference (RetObj); return_ACPI_STATUS (Status); } @@ -319,7 +310,7 @@ Cleanup: * RetBuffer - a pointer to a buffer structure for the * results * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to get the _PRS value of an object * contained in an object specified by the handle passed in @@ -357,7 +348,7 @@ AcpiRsGetPrsMethodData ( { /* Return object is required */ - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _PRS\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _PRS\n")); return_ACPI_STATUS (AE_TYPE); } @@ -378,9 +369,8 @@ AcpiRsGetPrsMethodData ( * byte stream buffer that comes back from the _CRS method * execution. */ - Status = AcpiRsCreateResourceList (RetObj, - RetBuffer->Pointer, - &BufferSpaceNeeded); + Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer, + &BufferSpaceNeeded); /* * Tell the user how much of the buffer we have used or is needed @@ -393,8 +383,7 @@ AcpiRsGetPrsMethodData ( Cleanup: - AcpiCmRemoveReference (RetObj); - + AcpiUtRemoveReference (RetObj); return_ACPI_STATUS (Status); } @@ -407,7 +396,7 @@ Cleanup: * InBuffer - a pointer to a buffer structure of the * parameter * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to set the _SRS of an object contained * in an object specified by the handle passed in @@ -436,20 +425,19 @@ AcpiRsSetSrsMethodData ( /* * The InBuffer parameter will point to a linked list of - * resource parameters. It needs to be formatted into a - * byte stream to be sent in as an input parameter. + * resource parameters. It needs to be formatted into a + * byte stream to be sent in as an input parameter. */ BufferSizeNeeded = 0; /* * First call is to get the buffer size needed */ - Status = AcpiRsCreateByteStream (InBuffer->Pointer, - ByteStream, - &BufferSizeNeeded); + Status = AcpiRsCreateByteStream (InBuffer->Pointer, ByteStream, + &BufferSizeNeeded); /* * We expect a return of AE_BUFFER_OVERFLOW - * if not, exit with the error + * if not, exit with the error */ if (AE_BUFFER_OVERFLOW != Status) { @@ -459,7 +447,7 @@ AcpiRsSetSrsMethodData ( /* * Allocate the buffer needed */ - ByteStream = AcpiCmCallocate(BufferSizeNeeded); + ByteStream = AcpiUtCallocate(BufferSizeNeeded); if (NULL == ByteStream) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -468,21 +456,20 @@ AcpiRsSetSrsMethodData ( /* * Now call to convert the linked list into a byte stream */ - Status = AcpiRsCreateByteStream (InBuffer->Pointer, - ByteStream, - &BufferSizeNeeded); + Status = AcpiRsCreateByteStream (InBuffer->Pointer, ByteStream, + &BufferSizeNeeded); if (ACPI_FAILURE (Status)) { goto Cleanup; } /* - * Init the param object + * Init the param object */ - AcpiCmInitStaticObject (&ParamObj); + AcpiUtInitStaticObject (&ParamObj); /* - * Method requires one parameter. Set it up + * Method requires one parameter. Set it up */ Params [0] = &ParamObj; Params [1] = NULL; @@ -495,17 +482,16 @@ AcpiRsSetSrsMethodData ( ParamObj.Buffer.Pointer = ByteStream; /* - * Execute the method, no return value + * Execute the method, no return value */ Status = AcpiNsEvaluateRelative (Handle, "_SRS", Params, NULL); /* - * Clean up and return the status from AcpiNsEvaluateRelative + * Clean up and return the status from AcpiNsEvaluateRelative */ - Cleanup: - AcpiCmFree (ByteStream); + AcpiUtFree (ByteStream); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/rsxface.c b/sys/contrib/dev/acpica/rsxface.c index fa7c7cf..ea31fa2 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 ACPI subsystem - * $Revision: 10 $ + * Module Name: rsxface - Public interfaces to the resource manager + * $Revision: 13 $ * ******************************************************************************/ @@ -122,7 +122,7 @@ #include "acnamesp.h" #include "acresrc.h" -#define _COMPONENT RESOURCE_MANAGER +#define _COMPONENT ACPI_RESOURCES MODULE_NAME ("rsxface") @@ -134,7 +134,7 @@ * RetBuffer - a pointer to a buffer to receive the * current resources for the device * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to get the IRQ routing table for a * specific bus. The caller must first acquire a handle for the @@ -159,11 +159,20 @@ AcpiGetIrqRoutingTable ( FUNCTION_TRACE ("AcpiGetIrqRoutingTable "); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* - * Must have a valid handle and buffer, So we have to have a handle - * and a return buffer structure, and if there is a non-zero buffer length - * we also need a valid pointer in the buffer. If it's a zero buffer length, - * we'll be returning the needed buffer size, so keep going. + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. */ if ((!DeviceHandle) || (!RetBuffer) || @@ -173,7 +182,6 @@ AcpiGetIrqRoutingTable ( } Status = AcpiRsGetPrtMethodData (DeviceHandle, RetBuffer); - return_ACPI_STATUS (Status); } @@ -187,7 +195,7 @@ AcpiGetIrqRoutingTable ( * RetBuffer - a pointer to a buffer to receive the * current resources for the device * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to get the current resources for a * specific device. The caller must first acquire a handle for @@ -212,11 +220,20 @@ AcpiGetCurrentResources ( FUNCTION_TRACE ("AcpiGetCurrentResources"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* - * Must have a valid handle and buffer, So we have to have a handle - * and a return buffer structure, and if there is a non-zero buffer length - * we also need a valid pointer in the buffer. If it's a zero buffer length, - * we'll be returning the needed buffer size, so keep going. + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. */ if ((!DeviceHandle) || (!RetBuffer) || @@ -226,7 +243,6 @@ AcpiGetCurrentResources ( } Status = AcpiRsGetCrsMethodData (DeviceHandle, RetBuffer); - return_ACPI_STATUS (Status); } @@ -240,7 +256,7 @@ AcpiGetCurrentResources ( * RetBuffer - a pointer to a buffer to receive the * resources for the device * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to get a list of the possible resources * for a specific device. The caller must first acquire a handle @@ -262,21 +278,29 @@ AcpiGetPossibleResources ( FUNCTION_TRACE ("AcpiGetPossibleResources"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* - * Must have a valid handle and buffer, So we have to have a handle - * and a return buffer structure, and if there is a non-zero buffer length - * we also need a valid pointer in the buffer. If it's a zero buffer length, - * we'll be returning the needed buffer size, so keep going. + * Must have a valid handle and buffer, So we have to have a handle + * and a return buffer structure, and if there is a non-zero buffer length + * we also need a valid pointer in the buffer. If it's a zero buffer length, + * we'll be returning the needed buffer size, so keep going. */ if ((!DeviceHandle) || (!RetBuffer) || ((RetBuffer->Length) && (!RetBuffer->Pointer))) { return_ACPI_STATUS (AE_BAD_PARAMETER); - } + } Status = AcpiRsGetPrsMethodData (DeviceHandle, RetBuffer); - return_ACPI_STATUS (Status); } @@ -290,7 +314,7 @@ AcpiGetPossibleResources ( * InBuffer - a pointer to a buffer containing the * resources to be set for the device * - * RETURN: Status - the status of the call + * RETURN: Status * * DESCRIPTION: This function is called to set the current resources for a * specific device. The caller must first acquire a handle for @@ -309,8 +333,17 @@ AcpiSetCurrentResources ( FUNCTION_TRACE ("AcpiSetCurrentResources"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* - * Must have a valid handle and buffer + * Must have a valid handle and buffer */ if ((!DeviceHandle) || (!InBuffer) || @@ -321,6 +354,5 @@ AcpiSetCurrentResources ( } Status = AcpiRsSetSrsMethodData (DeviceHandle, InBuffer); - return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/tbconvrt.c b/sys/contrib/dev/acpica/tbconvrt.c index c298c35..1196014 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: 19 $ + * $Revision: 22 $ * *****************************************************************************/ @@ -122,31 +122,10 @@ #include "actbl.h" -#define _COMPONENT TABLE_MANAGER +#define _COMPONENT ACPI_TABLES MODULE_NAME ("tbconvrt") -/* - * Build a GAS structure from earlier ACPI table entries (V1.0 and 0.71 extensions) - * - * 1) Address space - * 2) Length in bytes -- convert to length in bits - * 3) Bit offset is zero - * 4) Reserved field is zero - * 5) Expand address to 64 bits - */ -#define ASL_BUILD_GAS_FROM_ENTRY(a,b,c,d) {a.AddressSpaceId = (UINT8) d;\ - a.RegisterBitWidth = (UINT8) MUL_8 (b);\ - a.RegisterBitOffset = 0;\ - a.Reserved = 0;\ - ACPI_STORE_ADDRESS (a.Address,c);} - - -/* ACPI V1.0 entries -- address space is always I/O */ - -#define ASL_BUILD_GAS_FROM_V1_ENTRY(a,b,c) ASL_BUILD_GAS_FROM_ENTRY(a,b,c,ADDRESS_SPACE_SYSTEM_IO) - - /******************************************************************************* * * FUNCTION: AcpiTbConvertToXsdt @@ -201,7 +180,7 @@ AcpiTbConvertToXsdt ( /* Allocate an XSDT */ - NewTable = AcpiCmCallocate (TableSize); + NewTable = AcpiUtCallocate (TableSize); if (!NewTable) { return (AE_NO_MEMORY); @@ -293,7 +272,7 @@ AcpiTbConvertTableFadt (void) /* AcpiGbl_FADT is valid */ /* Allocate and zero the 2.0 buffer */ - FADT2 = AcpiCmCallocate (sizeof (FADT_DESCRIPTOR_REV2)); + FADT2 = AcpiUtCallocate (sizeof (FADT_DESCRIPTOR_REV2)); if (FADT2 == NULL) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -612,7 +591,7 @@ AcpiTbBuildCommonFacs ( /* Allocate a common FACS */ - CommonFacs = AcpiCmCallocate (sizeof (ACPI_COMMON_FACS)); + CommonFacs = AcpiUtCallocate (sizeof (ACPI_COMMON_FACS)); if (!CommonFacs) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c index 965470c..f79f406 100644 --- a/sys/contrib/dev/acpica/tbget.c +++ b/sys/contrib/dev/acpica/tbget.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: tbget - ACPI Table get* routines - * $Revision: 43 $ + * $Revision: 46 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "actables.h" -#define _COMPONENT TABLE_MANAGER +#define _COMPONENT ACPI_TABLES MODULE_NAME ("tbget") #define RSDP_CHECKSUM_LENGTH 20 @@ -264,7 +264,7 @@ AcpiTbGetTable ( /* Allocate buffer for the entire table */ - FullTable = AcpiCmAllocate (TableHeader->Length); + FullTable = AcpiUtAllocate (TableHeader->Length); if (!FullTable) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -598,14 +598,14 @@ AcpiTbGetTableRsdt ( char *TableSignature; - FUNCTION_TRACE ("AcpiTbGetTableRsdt"); + FUNCTION_TRACE ("TbGetTableRsdt"); /* * Get the RSDT from the RSDP */ - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("RSDP located at %p, RSDT physical=%p \n", AcpiGbl_RSDP, AcpiGbl_RSDP->RsdtPhysicalAddress)); @@ -638,8 +638,8 @@ AcpiTbGetTableRsdt ( Status = AcpiTbGetTable (PhysicalAddress, NULL, &TableInfo); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, ("GetTableRsdt: Could not get the RSDT, %s\n", - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("Could not get the RSDT, %s\n", + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -687,7 +687,7 @@ AcpiTbGetTableRsdt ( AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer; - DEBUG_PRINT (ACPI_INFO, ("XSDT located at %p\n", AcpiGbl_XSDT)); + DEBUG_PRINTP (ACPI_INFO, ("XSDT located at %p\n", AcpiGbl_XSDT)); return_ACPI_STATUS (Status); } @@ -738,7 +738,7 @@ AcpiTbGetTableFacs ( * Getting table from a file -- allocate a buffer and * read the table. */ - TablePtr = AcpiCmAllocate (Size); + TablePtr = AcpiUtAllocate (Size); if(!TablePtr) { return_ACPI_STATUS (AE_NO_MEMORY); diff --git a/sys/contrib/dev/acpica/tbinstal.c b/sys/contrib/dev/acpica/tbinstal.c index 2df0fca..745307f 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: 36 $ + * $Revision: 39 $ * *****************************************************************************/ @@ -122,7 +122,7 @@ #include "actables.h" -#define _COMPONENT TABLE_MANAGER +#define _COMPONENT ACPI_TABLES MODULE_NAME ("tbinstal") @@ -164,16 +164,16 @@ AcpiTbInstallTable ( /* Lock tables while installing */ - AcpiCmAcquireMutex (ACPI_MTX_TABLES); + AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* Install the table into the global data structure */ Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo); - DEBUG_PRINT (ACPI_INFO, ("%s located at %p\n", + DEBUG_PRINTP (ACPI_INFO, ("%s located at %p\n", AcpiGbl_AcpiTableData[TableInfo->Type].Name, TableInfo->Pointer)); - AcpiCmReleaseMutex (ACPI_MTX_TABLES); + AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_ACPI_STATUS (Status); } @@ -241,8 +241,7 @@ AcpiTbRecognizeTable ( TableType = i; Status = AcpiGbl_AcpiTableData[i].Status; - DEBUG_PRINT (ACPI_INFO, - ("TbRecognizeTable: Found %4.4s\n", + DEBUG_PRINTP (ACPI_INFO, ("Found %4.4s\n", AcpiGbl_AcpiTableData[i].Signature)); break; } @@ -274,7 +273,7 @@ AcpiTbRecognizeTable ( if (Status == AE_SUPPORT) { - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("Unsupported table %s (Type %X) was found and discarded\n", AcpiGbl_AcpiTableData[TableType].Name, TableType)); } @@ -346,7 +345,7 @@ AcpiTbInitTableDescriptor ( if (ListHead->Pointer) { - TableDesc = AcpiCmCallocate (sizeof (ACPI_TABLE_DESC)); + TableDesc = AcpiUtCallocate (sizeof (ACPI_TABLE_DESC)); if (!TableDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -384,7 +383,7 @@ AcpiTbInitTableDescriptor ( TableDesc->AmlPointer = (UINT8 *) (TableDesc->Pointer + 1), TableDesc->AmlLength = (UINT32) (TableDesc->Length - (UINT32) sizeof (ACPI_TABLE_HEADER)); - TableDesc->TableId = AcpiCmAllocateOwnerId (OWNER_TYPE_TABLE); + TableDesc->TableId = AcpiUtAllocateOwnerId (OWNER_TYPE_TABLE); TableDesc->LoadedIntoNamespace = FALSE; /* @@ -464,7 +463,7 @@ AcpiTbDeleteAcpiTable ( } - AcpiCmAcquireMutex (ACPI_MTX_TABLES); + AcpiUtAcquireMutex (ACPI_MTX_TABLES); /* Free the table */ @@ -501,7 +500,7 @@ AcpiTbDeleteAcpiTable ( break; } - AcpiCmReleaseMutex (ACPI_MTX_TABLES); + AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_VOID; } @@ -587,7 +586,7 @@ AcpiTbDeleteSingleTable ( case ACPI_MEM_ALLOCATED: - AcpiCmFree (TableDesc->BasePointer); + AcpiUtFree (TableDesc->BasePointer); break; @@ -668,7 +667,7 @@ AcpiTbUninstallTable ( /* Free the table descriptor */ NextDesc = TableDesc->Next; - AcpiCmFree (TableDesc); + AcpiUtFree (TableDesc); } diff --git a/sys/contrib/dev/acpica/tbutils.c b/sys/contrib/dev/acpica/tbutils.c index 9bf9c75..0a4309e 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: 33 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "acinterp.h" -#define _COMPONENT TABLE_MANAGER +#define _COMPONENT ACPI_TABLES MODULE_NAME ("tbutils") @@ -277,11 +277,14 @@ AcpiTbValidateTableHeader ( ACPI_NAME Signature; + PROC_NAME ("TbValidateTableHeader"); + + /* Verify that this is a valid address */ if (!AcpiOsReadable (TableHeader, sizeof (ACPI_TABLE_HEADER))) { - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Cannot read table header at %p\n", TableHeader)); return (AE_BAD_ADDRESS); } @@ -290,13 +293,13 @@ AcpiTbValidateTableHeader ( /* Ensure that the signature is 4 ASCII characters */ MOVE_UNALIGNED32_TO_32 (&Signature, &TableHeader->Signature); - if (!AcpiCmValidAcpiName (Signature)) + if (!AcpiUtValidAcpiName (Signature)) { - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Table signature at %p [%X] has invalid characters\n", TableHeader, &Signature)); - REPORT_WARNING (("Invalid table signature found\n")); + REPORT_WARNING (("Invalid table signature %4.4s found\n", &Signature)); DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER)); return (AE_BAD_SIGNATURE); } @@ -306,7 +309,7 @@ AcpiTbValidateTableHeader ( if (TableHeader->Length < sizeof (ACPI_TABLE_HEADER)) { - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Invalid length in table header %p name %4.4s\n", TableHeader, &Signature)); diff --git a/sys/contrib/dev/acpica/tbxface.c b/sys/contrib/dev/acpica/tbxface.c index d2bc9cb..4accd25 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: 34 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -123,7 +123,7 @@ #include "actables.h" -#define _COMPONENT TABLE_MANAGER +#define _COMPONENT ACPI_TABLES MODULE_NAME ("tbxface") @@ -144,20 +144,28 @@ ACPI_STATUS AcpiLoadTables ( ACPI_PHYSICAL_ADDRESS RsdpPhysicalAddress) { - ACPI_STATUS Status = AE_OK; + ACPI_STATUS Status; UINT32 NumberOfTables = 0; FUNCTION_TRACE ("AcpiLoadTables"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Map and validate the RSDP */ Status = AcpiTbVerifyRsdp (RsdpPhysicalAddress); if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); goto ErrorExit; } @@ -167,7 +175,7 @@ AcpiLoadTables ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); goto ErrorExit; } @@ -177,11 +185,11 @@ AcpiLoadTables ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); goto ErrorExit; } - DEBUG_PRINT (ACPI_OK, ("ACPI Tables successfully loaded\n")); + DEBUG_PRINTP (ACPI_OK, ("ACPI Tables successfully loaded\n")); /* Load the namespace from the tables */ @@ -190,7 +198,7 @@ AcpiLoadTables ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); goto ErrorExit; } @@ -199,7 +207,7 @@ AcpiLoadTables ( ErrorExit: REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -233,6 +241,15 @@ AcpiLoadTable ( FUNCTION_TRACE ("AcpiLoadTable"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if (!TablePtr) { return_ACPI_STATUS (AE_BAD_PARAMETER); @@ -289,11 +306,20 @@ AcpiUnloadTable ( ACPI_TABLE_TYPE TableType) { ACPI_TABLE_DESC *ListHead; + ACPI_STATUS Status; FUNCTION_TRACE ("AcpiUnloadTable"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* Parameter validation */ if (TableType > ACPI_TABLE_MAX) @@ -362,6 +388,15 @@ AcpiGetTableHeader ( FUNCTION_TRACE ("AcpiGetTableHeader"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + if ((Instance == 0) || (TableType == ACPI_TABLE_RSDP) || (!OutTableHeader)) @@ -444,6 +479,15 @@ AcpiGetTable ( FUNCTION_TRACE ("AcpiGetTable"); + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* * If we have a buffer, we must have a length too */ diff --git a/sys/contrib/dev/acpica/tbxfroot.c b/sys/contrib/dev/acpica/tbxfroot.c index 4bcf9c9..14b09b1 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: 35 $ + * $Revision: 37 $ * *****************************************************************************/ @@ -121,7 +121,7 @@ #include "actables.h" -#define _COMPONENT TABLE_MANAGER +#define _COMPONENT ACPI_TABLES MODULE_NAME ("tbxfroot") #define RSDP_CHECKSUM_LENGTH 20 @@ -155,7 +155,7 @@ AcpiFindRootPointer ( Status = AcpiTbFindRsdp (&TableInfo); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, ("RSDP structure not found\n")); + DEBUG_PRINTP (ACPI_ERROR, ("RSDP structure not found\n")); return_ACPI_STATUS (AE_NO_ACPI_TABLES); } diff --git a/sys/contrib/dev/acpica/utalloc.c b/sys/contrib/dev/acpica/utalloc.c index 243ee21..ecef385 100644 --- a/sys/contrib/dev/acpica/utalloc.c +++ b/sys/contrib/dev/acpica/utalloc.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmalloc - local memory allocation routines - * $Revision: 84 $ + * Module Name: utalloc - local memory allocation routines + * $Revision: 90 $ * *****************************************************************************/ @@ -114,7 +114,7 @@ * *****************************************************************************/ -#define __CMALLOC_C__ +#define __UTALLOC_C__ #include "acpi.h" #include "acparser.h" @@ -122,8 +122,8 @@ #include "acnamesp.h" #include "acglobal.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmalloc") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utalloc") #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS @@ -133,14 +133,14 @@ * gets compiled out when the ACPI_DEBUG flag is not set. * Every memory allocation is kept track of in a doubly linked list. Each * element contains the caller's component, module name, function name, and - * line number. _CmAllocate and _CmCallocate call AcpiCmAddElementToAllocList - * to add an element to the list; deletion occurs in the bosy of _CmFree. + * line number. _UtAllocate and _UtCallocate call AcpiUtAddElementToAllocList + * to add an element to the list; deletion occurs in the bosy of _UtFree. */ -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmSearchAllocList + * FUNCTION: AcpiUtSearchAllocList * * PARAMETERS: Address - Address of allocated memory * @@ -148,13 +148,13 @@ * * DESCRIPTION: Searches for an element in the global allocation tracking list. * - ****************************************************************************/ + ******************************************************************************/ -ALLOCATION_INFO * -AcpiCmSearchAllocList ( +ACPI_ALLOCATION_INFO * +AcpiUtSearchAllocList ( void *Address) { - ALLOCATION_INFO *Element = AcpiGbl_HeadAllocPtr; + ACPI_ALLOCATION_INFO *Element = AcpiGbl_HeadAllocPtr; /* Search for the address. */ @@ -173,9 +173,9 @@ AcpiCmSearchAllocList ( } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmAddElementToAllocList + * FUNCTION: AcpiUtAddElementToAllocList * * PARAMETERS: Address - Address of allocated memory * Size - Size of the allocation @@ -188,10 +188,10 @@ AcpiCmSearchAllocList ( * * DESCRIPTION: Inserts an element into the global allocation tracking list. * - ****************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiCmAddElementToAllocList ( +AcpiUtAddElementToAllocList ( void *Address, UINT32 Size, UINT8 AllocType, @@ -199,14 +199,14 @@ AcpiCmAddElementToAllocList ( NATIVE_CHAR *Module, UINT32 Line) { - ALLOCATION_INFO *Element; + ACPI_ALLOCATION_INFO *Element; ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_PTR ("CmAddElementToAllocList", Address); + FUNCTION_TRACE_PTR ("UtAddElementToAllocList", Address); - AcpiCmAcquireMutex (ACPI_MTX_MEMORY); + AcpiUtAcquireMutex (ACPI_MTX_MEMORY); /* Keep track of the running total of all allocations. */ @@ -230,13 +230,10 @@ AcpiCmAddElementToAllocList ( if (NULL == AcpiGbl_HeadAllocPtr) { - AcpiGbl_HeadAllocPtr = - (ALLOCATION_INFO *) AcpiOsCallocate (sizeof (ALLOCATION_INFO)); - + AcpiGbl_HeadAllocPtr = AcpiOsCallocate (sizeof (ACPI_ALLOCATION_INFO)); if (!AcpiGbl_HeadAllocPtr) { - DEBUG_PRINT (ACPI_ERROR, - ("Could not allocate memory info block\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Could not allocate mem info block\n")); Status = AE_NO_MEMORY; goto UnlockAndExit; } @@ -246,12 +243,10 @@ AcpiCmAddElementToAllocList ( else { - AcpiGbl_TailAllocPtr->Next = - (ALLOCATION_INFO *) AcpiOsCallocate (sizeof (ALLOCATION_INFO)); + AcpiGbl_TailAllocPtr->Next = AcpiOsCallocate (sizeof (ACPI_ALLOCATION_INFO)); if (!AcpiGbl_TailAllocPtr->Next) { - DEBUG_PRINT (ACPI_ERROR, - ("Could not allocate memory info block\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Could not allocate mem info block\n")); Status = AE_NO_MEMORY; goto UnlockAndExit; } @@ -267,13 +262,13 @@ AcpiCmAddElementToAllocList ( * This will catch several kinds of problems. */ - Element = AcpiCmSearchAllocList (Address); + Element = AcpiUtSearchAllocList (Address); if (Element) { - REPORT_ERROR (("CmAddElementToAllocList: Address already present in list! (%p)\n", + REPORT_ERROR (("UtAddElementToAllocList: Address already present in list! (%p)\n", Address)); - DEBUG_PRINT (ACPI_ERROR, ("Element %p Address %p\n", Element, Address)); + DEBUG_PRINTP (ACPI_ERROR, ("Element %p Address %p\n", Element, Address)); BREAKPOINT3; } @@ -290,14 +285,14 @@ AcpiCmAddElementToAllocList ( UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); + AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return_ACPI_STATUS (Status); } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmDeleteElementFromAllocList + * FUNCTION: AcpiUtDeleteElementFromAllocList * * PARAMETERS: Address - Address of allocated memory * Component - Component type of caller @@ -308,36 +303,36 @@ UnlockAndExit: * * DESCRIPTION: Deletes an element from the global allocation tracking list. * - ****************************************************************************/ + ******************************************************************************/ void -AcpiCmDeleteElementFromAllocList ( +AcpiUtDeleteElementFromAllocList ( void *Address, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line) { - ALLOCATION_INFO *Element; + ACPI_ALLOCATION_INFO *Element; UINT32 *DwordPtr; UINT32 DwordLen; UINT32 Size; UINT32 i; - FUNCTION_TRACE ("CmDeleteElementFromAllocList"); + FUNCTION_TRACE ("UtDeleteElementFromAllocList"); if (NULL == AcpiGbl_HeadAllocPtr) { /* Boy we got problems. */ _REPORT_ERROR (Module, Line, Component, - ("CmDeleteElementFromAllocList: Empty allocation list, nothing to free!\n")); + ("UtDeleteElementFromAllocList: Empty allocation list, nothing to free!\n")); return_VOID; } - AcpiCmAcquireMutex (ACPI_MTX_MEMORY); + AcpiUtAcquireMutex (ACPI_MTX_MEMORY); /* Keep track of the amount of memory allocated. */ @@ -349,7 +344,7 @@ AcpiCmDeleteElementFromAllocList ( if (Address != AcpiGbl_HeadAllocPtr->Address) { _REPORT_ERROR (Module, Line, Component, - ("CmDeleteElementFromAllocList: Deleting non-allocated memory\n")); + ("UtDeleteElementFromAllocList: Deleting non-allocated memory\n")); goto Cleanup; } @@ -360,8 +355,8 @@ AcpiCmDeleteElementFromAllocList ( AcpiGbl_HeadAllocPtr = NULL; AcpiGbl_TailAllocPtr = NULL; - DEBUG_PRINT (TRACE_ALLOCATIONS, - ("_CmFree: Allocation list deleted. There are no outstanding allocations\n")); + DEBUG_PRINTP (TRACE_ALLOCATIONS, + ("Allocation list deleted. There are no outstanding allocations\n")); goto Cleanup; } @@ -369,7 +364,7 @@ AcpiCmDeleteElementFromAllocList ( /* Search list for this address */ - Element = AcpiCmSearchAllocList (Address); + Element = AcpiUtSearchAllocList (Address); if (Element) { /* cases: head, tail, other */ @@ -419,16 +414,17 @@ AcpiCmDeleteElementFromAllocList ( Size = Element->Size; - MEMSET (Element, 0xEA, sizeof (ALLOCATION_INFO)); + MEMSET (Element, 0xEA, sizeof (ACPI_ALLOCATION_INFO)); if (Size == sizeof (ACPI_OPERAND_OBJECT)) { - DEBUG_PRINT (TRACE_ALLOCATIONS, ("CmDelete: Freeing size %X (ACPI_OPERAND_OBJECT)\n", Size)); + DEBUG_PRINTP (TRACE_ALLOCATIONS, + ("Freeing size %X (ACPI_OPERAND_OBJECT)\n", Size)); } else { - DEBUG_PRINT (TRACE_ALLOCATIONS, ("CmDelete: Freeing size %X\n", Size)); + DEBUG_PRINTP (TRACE_ALLOCATIONS, ("Freeing size %X\n", Size)); } AcpiOsFree (Element); @@ -437,11 +433,10 @@ AcpiCmDeleteElementFromAllocList ( else { _REPORT_ERROR (Module, Line, Component, - ("_CmFree: Entry not found in list\n")); - DEBUG_PRINT (ACPI_ERROR, - ("_CmFree: Entry %p was not found in allocation list\n", + ("_UtFree: Entry not found in list\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Entry %p was not found in allocation list\n", Address)); - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); + AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return_VOID; } @@ -449,15 +444,15 @@ AcpiCmDeleteElementFromAllocList ( Cleanup: AcpiGbl_CurrentAllocSize -= Size; - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); + AcpiUtReleaseMutex (ACPI_MTX_MEMORY); return_VOID; } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmDumpAllocationInfo + * FUNCTION: AcpiUtDumpAllocationInfo * * PARAMETERS: * @@ -465,13 +460,13 @@ Cleanup: * * DESCRIPTION: Print some info about the outstanding allocations. * - ****************************************************************************/ + ******************************************************************************/ void -AcpiCmDumpAllocationInfo ( +AcpiUtDumpAllocationInfo ( void) { - FUNCTION_TRACE ("CmDumpAllocationInfo"); + FUNCTION_TRACE ("UtDumpAllocationInfo"); DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, @@ -518,9 +513,9 @@ AcpiCmDumpAllocationInfo ( } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmDumpCurrentAllocations + * FUNCTION: AcpiUtDumpCurrentAllocations * * PARAMETERS: Component - Component(s) to dump info for. * Module - Module to dump info for. NULL means all. @@ -529,18 +524,18 @@ AcpiCmDumpAllocationInfo ( * * DESCRIPTION: Print a list of all outstanding allocations. * - ****************************************************************************/ + ******************************************************************************/ void -AcpiCmDumpCurrentAllocations ( +AcpiUtDumpCurrentAllocations ( UINT32 Component, NATIVE_CHAR *Module) { - ALLOCATION_INFO *Element = AcpiGbl_HeadAllocPtr; + ACPI_ALLOCATION_INFO *Element = AcpiGbl_HeadAllocPtr; UINT32 i; - FUNCTION_TRACE ("CmDumpCurrentAllocations"); + FUNCTION_TRACE ("UtDumpCurrentAllocations"); if (Element == NULL) @@ -555,7 +550,7 @@ AcpiCmDumpCurrentAllocations ( * Walk the allocation list. */ - AcpiCmAcquireMutex (ACPI_MTX_MEMORY); + AcpiUtAcquireMutex (ACPI_MTX_MEMORY); DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, ("Outstanding allocations:\n")); @@ -578,7 +573,7 @@ AcpiCmDumpCurrentAllocations ( case ACPI_DESC_TYPE_INTERNAL: DEBUG_PRINT_RAW (TRACE_ALLOCATIONS | TRACE_TABLES, (" ObjType %s", - AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *)(Element->Address))->Common.Type))); + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)(Element->Address))->Common.Type))); break; case ACPI_DESC_TYPE_PARSER: @@ -610,7 +605,7 @@ AcpiCmDumpCurrentAllocations ( Element = Element->Next; } - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); + AcpiUtReleaseMutex (ACPI_MTX_MEMORY); DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, ("Total number of unfreed allocations = %d(%X)\n", i,i)); @@ -621,9 +616,9 @@ AcpiCmDumpCurrentAllocations ( } #endif /* #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS */ -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: _CmAllocate + * FUNCTION: _UtAllocate * * PARAMETERS: Size - Size of the allocation * Component - Component type of caller @@ -634,10 +629,10 @@ AcpiCmDumpCurrentAllocations ( * * DESCRIPTION: The subsystem's equivalent of malloc. * - ****************************************************************************/ + ******************************************************************************/ void * -_CmAllocate ( +_UtAllocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, @@ -646,7 +641,7 @@ _CmAllocate ( void *Address = NULL; - FUNCTION_TRACE_U32 ("_CmAllocate", Size); + FUNCTION_TRACE_U32 ("_UtAllocate", Size); /* Check for an inadvertent size of zero bytes */ @@ -654,7 +649,7 @@ _CmAllocate ( if (!Size) { _REPORT_ERROR (Module, Line, Component, - ("CmAllocate: Attempt to allocate zero bytes\n")); + ("UtAllocate: Attempt to allocate zero bytes\n")); Size = 1; } @@ -664,31 +659,30 @@ _CmAllocate ( /* Report allocation error */ _REPORT_ERROR (Module, Line, Component, - ("CmAllocate: Could not allocate size %X\n", Size)); + ("UtAllocate: Could not allocate size %X\n", Size)); - return_VALUE (NULL); + return_PTR (NULL); } #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - if (ACPI_FAILURE (AcpiCmAddElementToAllocList (Address, Size, MEM_MALLOC, + if (ACPI_FAILURE (AcpiUtAddElementToAllocList (Address, Size, MEM_MALLOC, Component, Module, Line))) { AcpiOsFree (Address); return_PTR (NULL); } - DEBUG_PRINT (TRACE_ALLOCATIONS, - ("CmAllocate: %p Size %X\n", Address, Size)); + DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p Size %X\n", Address, Size)); #endif return_PTR (Address); } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: _CmCallocate + * FUNCTION: _UtCallocate * * PARAMETERS: Size - Size of the allocation * Component - Component type of caller @@ -699,10 +693,10 @@ _CmAllocate ( * * DESCRIPTION: Subsystem equivalent of calloc. * - ****************************************************************************/ + ******************************************************************************/ void * -_CmCallocate ( +_UtCallocate ( UINT32 Size, UINT32 Component, NATIVE_CHAR *Module, @@ -711,7 +705,7 @@ _CmCallocate ( void *Address = NULL; - FUNCTION_TRACE_U32 ("_CmCallocate", Size); + FUNCTION_TRACE_U32 ("_UtCallocate", Size); /* Check for an inadvertent size of zero bytes */ @@ -719,25 +713,24 @@ _CmCallocate ( if (!Size) { _REPORT_ERROR (Module, Line, Component, - ("CmCallocate: Attempt to allocate zero bytes\n")); - return_VALUE (NULL); + ("UtCallocate: Attempt to allocate zero bytes\n")); + return_PTR (NULL); } Address = AcpiOsCallocate (Size); - if (!Address) { /* Report allocation error */ _REPORT_ERROR (Module, Line, Component, - ("CmCallocate: Could not allocate size %X\n", Size)); - return_VALUE (NULL); + ("UtCallocate: Could not allocate size %X\n", Size)); + return_PTR (NULL); } #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - if (ACPI_FAILURE (AcpiCmAddElementToAllocList (Address, Size, MEM_CALLOC, + if (ACPI_FAILURE (AcpiUtAddElementToAllocList (Address, Size, MEM_CALLOC, Component,Module, Line))) { AcpiOsFree (Address); @@ -745,16 +738,15 @@ _CmCallocate ( } #endif - DEBUG_PRINT (TRACE_ALLOCATIONS, - ("CmCallocate: %p Size %X\n", Address, Size)); + DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p Size %X\n", Address, Size)); return_PTR (Address); } -/***************************************************************************** +/******************************************************************************* * - * FUNCTION: _CmFree + * FUNCTION: _UtFree * * PARAMETERS: Address - Address of the memory to deallocate * Component - Component type of caller @@ -765,33 +757,33 @@ _CmCallocate ( * * DESCRIPTION: Frees the memory at Address * - ****************************************************************************/ + ******************************************************************************/ void -_CmFree ( +_UtFree ( void *Address, UINT32 Component, NATIVE_CHAR *Module, UINT32 Line) { - FUNCTION_TRACE_PTR ("_CmFree", Address); + FUNCTION_TRACE_PTR ("_UtFree", Address); if (NULL == Address) { _REPORT_ERROR (Module, Line, Component, - ("_CmFree: Trying to delete a NULL address\n")); + ("_UtFree: Trying to delete a NULL address\n")); return_VOID; } #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - AcpiCmDeleteElementFromAllocList (Address, Component, Module, Line); + AcpiUtDeleteElementFromAllocList (Address, Component, Module, Line); #endif AcpiOsFree (Address); - DEBUG_PRINT (TRACE_ALLOCATIONS, ("CmFree: %p freed\n", Address)); + DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p freed\n", Address)); return_VOID; } diff --git a/sys/contrib/dev/acpica/utclib.c b/sys/contrib/dev/acpica/utclib.c index 2318d9e..5b5b0e0 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: 32 $ + * $Revision: 38 $ * *****************************************************************************/ @@ -149,11 +149,11 @@ ******************************************************************************/ -NATIVE_UINT -AcpiCmStrlen ( +UINT32 +AcpiUtStrlen ( const NATIVE_CHAR *String) { - NATIVE_UINT Length = 0; + UINT32 Length = 0; /* Count the string until a null is encountered */ @@ -182,7 +182,7 @@ AcpiCmStrlen ( ******************************************************************************/ NATIVE_CHAR * -AcpiCmStrcpy ( +AcpiUtStrcpy ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString) { @@ -222,7 +222,7 @@ AcpiCmStrcpy ( ******************************************************************************/ NATIVE_CHAR * -AcpiCmStrncpy ( +AcpiUtStrncpy ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString, NATIVE_UINT Count) @@ -264,7 +264,7 @@ AcpiCmStrncpy ( ******************************************************************************/ UINT32 -AcpiCmStrcmp ( +AcpiUtStrcmp ( const NATIVE_CHAR *String1, const NATIVE_CHAR *String2) { @@ -298,7 +298,7 @@ AcpiCmStrcmp ( ******************************************************************************/ UINT32 -AcpiCmStrncmp ( +AcpiUtStrncmp ( const NATIVE_CHAR *String1, const NATIVE_CHAR *String2, NATIVE_UINT Count) @@ -332,7 +332,7 @@ AcpiCmStrncmp ( ******************************************************************************/ NATIVE_CHAR * -AcpiCmStrcat ( +AcpiUtStrcat ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString) { @@ -369,7 +369,7 @@ AcpiCmStrcat ( ******************************************************************************/ NATIVE_CHAR * -AcpiCmStrncat ( +AcpiUtStrncat ( NATIVE_CHAR *DstString, const NATIVE_CHAR *SrcString, NATIVE_UINT Count) @@ -416,7 +416,7 @@ AcpiCmStrncat ( ******************************************************************************/ void * -AcpiCmMemcpy ( +AcpiUtMemcpy ( void *Dest, const void *Src, NATIVE_UINT Count) @@ -452,7 +452,7 @@ AcpiCmMemcpy ( ******************************************************************************/ void * -AcpiCmMemset ( +AcpiUtMemset ( void *Dest, NATIVE_UINT Value, NATIVE_UINT Count) @@ -635,7 +635,7 @@ static const UINT8 _acpi_ctype[257] = { /******************************************************************************* * - * FUNCTION: AcpiCmToUpper + * FUNCTION: AcpiUtToUpper * * PARAMETERS: * @@ -646,7 +646,7 @@ static const UINT8 _acpi_ctype[257] = { ******************************************************************************/ UINT32 -AcpiCmToUpper ( +AcpiUtToUpper ( UINT32 c) { @@ -656,7 +656,7 @@ AcpiCmToUpper ( /******************************************************************************* * - * FUNCTION: AcpiCmToLower + * FUNCTION: AcpiUtToLower * * PARAMETERS: * @@ -667,7 +667,7 @@ AcpiCmToUpper ( ******************************************************************************/ UINT32 -AcpiCmToLower ( +AcpiUtToLower ( UINT32 c) { @@ -677,38 +677,6 @@ AcpiCmToLower ( /******************************************************************************* * - * FUNCTION: strupr - * - * PARAMETERS: SrcString - The source string to convert to - * - * RETURN: SrcString - * - * DESCRIPTION: Convert string to uppercase - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrupr ( - NATIVE_CHAR *SrcString) -{ - NATIVE_CHAR *String; - - - /* Walk entire string, uppercasing the letters */ - - for (String = SrcString; *String; ) - { - *String = (char) AcpiCmToUpper (*String); - String++; - } - - - return (SrcString); -} - - -/******************************************************************************* - * * FUNCTION: strstr * * PARAMETERS: String1 - @@ -723,14 +691,14 @@ AcpiCmStrupr ( ******************************************************************************/ NATIVE_CHAR * -AcpiCmStrstr ( +AcpiUtStrstr ( NATIVE_CHAR *String1, NATIVE_CHAR *String2) { NATIVE_CHAR *String; - if (AcpiCmStrlen (String2) > AcpiCmStrlen (String1)) + if (AcpiUtStrlen (String2) > AcpiUtStrlen (String1)) { return (NULL); } @@ -768,10 +736,10 @@ AcpiCmStrstr ( ******************************************************************************/ UINT32 -AcpiCmStrtoul ( +AcpiUtStrtoul ( const NATIVE_CHAR *String, NATIVE_CHAR **Terminator, - NATIVE_UINT Base) + UINT32 Base) { UINT32 converted = 0; UINT32 index; @@ -821,7 +789,7 @@ AcpiCmStrtoul ( { if (*String == '0') { - if (AcpiCmToLower (*(++String)) == 'x') + if (AcpiUtToLower (*(++String)) == 'x') { Base = 16; ++String; @@ -859,7 +827,7 @@ AcpiCmStrtoul ( if (Base == 16 && *String == '0' && - AcpiCmToLower (*(++String)) == 'x') + AcpiUtToLower (*(++String)) == 'x') { String++; } @@ -877,7 +845,7 @@ AcpiCmStrtoul ( else { - index = AcpiCmToUpper (*String); + index = 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 a081e83..4e5ef80 100644 --- a/sys/contrib/dev/acpica/utcopy.c +++ b/sys/contrib/dev/acpica/utcopy.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmcopy - Internal to external object translation utilities - * $Revision: 66 $ + * Module Name: utcopy - Internal to external object translation utilities + * $Revision: 74 $ * *****************************************************************************/ @@ -114,7 +114,7 @@ * *****************************************************************************/ -#define __CMCOPY_C__ +#define __UTCOPY_C__ #include "acpi.h" #include "acinterp.h" @@ -122,14 +122,13 @@ #include "amlcode.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmcopy") - +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utcopy") /******************************************************************************* * - * FUNCTION: AcpiCmCopyIsimpleToEsimple + * FUNCTION: AcpiUtCopyIsimpleToEsimple * * PARAMETERS: *InternalObject - Pointer to the object we are examining * *Buffer - Where the object is returned @@ -145,7 +144,7 @@ ******************************************************************************/ static ACPI_STATUS -AcpiCmCopyIsimpleToEsimple ( +AcpiUtCopyIsimpleToEsimple ( ACPI_OPERAND_OBJECT *InternalObject, ACPI_OBJECT *ExternalObject, UINT8 *DataSpace, @@ -155,7 +154,7 @@ AcpiCmCopyIsimpleToEsimple ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("CmCopyIsimpleToEsimple"); + FUNCTION_TRACE ("UtCopyIsimpleToEsimple"); /* @@ -215,7 +214,7 @@ AcpiCmCopyIsimpleToEsimple ( * This is an object reference. Attempt to dereference it. */ - switch (InternalObject->Reference.OpCode) + switch (InternalObject->Reference.Opcode) { case AML_ZERO_OP: ExternalObject->Type = ACPI_TYPE_INTEGER; @@ -232,7 +231,7 @@ AcpiCmCopyIsimpleToEsimple ( ExternalObject->Integer.Value = ACPI_INTEGER_MAX; break; - case AML_NAMEPATH_OP: + 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 @@ -242,13 +241,17 @@ AcpiCmCopyIsimpleToEsimple ( ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) InternalObject->Reference.Node, &Length, (char *) DataSpace); + + /* Converted (external) string length is returned from above */ + + ExternalObject->String.Length = Length; break; default: - /* + /* * Use the object type of "Any" to indicate a reference * to object containing a handle to an ACPI named object. - */ + */ ExternalObject->Type = ACPI_TYPE_ANY; ExternalObject->Reference.Handle = InternalObject->Reference.Node; break; @@ -266,7 +269,7 @@ AcpiCmCopyIsimpleToEsimple ( case ACPI_TYPE_POWER: - ExternalObject->PowerResource.SystemLevel = + ExternalObject->PowerResource.SystemLevel = InternalObject->PowerResource.SystemLevel; ExternalObject->PowerResource.ResourceOrder = @@ -283,7 +286,6 @@ AcpiCmCopyIsimpleToEsimple ( } - *BufferSpaceUsed = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); return_ACPI_STATUS (Status); @@ -292,7 +294,7 @@ AcpiCmCopyIsimpleToEsimple ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyIelementToEelement + * FUNCTION: AcpiUtCopyIelementToEelement * * PARAMETERS: ACPI_PKG_CALLBACK * @@ -303,7 +305,7 @@ AcpiCmCopyIsimpleToEsimple ( ******************************************************************************/ ACPI_STATUS -AcpiCmCopyIelementToEelement ( +AcpiUtCopyIelementToEelement ( UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, @@ -316,7 +318,6 @@ AcpiCmCopyIelementToEelement ( ACPI_OBJECT *TargetObject; - ThisIndex = State->Pkg.Index; TargetObject = (ACPI_OBJECT *) &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex]; @@ -324,13 +325,13 @@ AcpiCmCopyIelementToEelement ( switch (ObjectType) { - case 0: + case ACPI_COPY_TYPE_SIMPLE: /* * This is a simple or null object -- get the size */ - Status = AcpiCmCopyIsimpleToEsimple (SourceObject, + Status = AcpiUtCopyIsimpleToEsimple (SourceObject, TargetObject, Info->FreeSpace, &ObjectSpace); if (ACPI_FAILURE (Status)) { @@ -339,7 +340,7 @@ AcpiCmCopyIelementToEelement ( break; - case 1: + case ACPI_COPY_TYPE_PACKAGE: /* * Build the package object @@ -375,7 +376,7 @@ AcpiCmCopyIelementToEelement ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyIpackageToEpackage + * FUNCTION: AcpiUtCopyIpackageToEpackage * * PARAMETERS: *InternalObject - Pointer to the object we are returning * *Buffer - Where the object is returned @@ -388,12 +389,12 @@ AcpiCmCopyIelementToEelement ( * * The buffer is assumed to have sufficient space for the object. * The caller must have verified the buffer length needed using the - * AcpiCmGetObjectSize function before calling this function. + * AcpiUtGetObjectSize function before calling this function. * ******************************************************************************/ static ACPI_STATUS -AcpiCmCopyIpackageToEpackage ( +AcpiUtCopyIpackageToEpackage ( ACPI_OPERAND_OBJECT *InternalObject, UINT8 *Buffer, UINT32 *SpaceUsed) @@ -403,7 +404,7 @@ AcpiCmCopyIpackageToEpackage ( ACPI_PKG_INFO Info; - FUNCTION_TRACE ("CmCopyIpackageToEpackage"); + FUNCTION_TRACE ("UtCopyIpackageToEpackage"); /* @@ -420,7 +421,6 @@ AcpiCmCopyIpackageToEpackage ( Info.FreeSpace = Buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - ExternalObject->Type = InternalObject->Common.Type; ExternalObject->Package.Count = InternalObject->Package.Count; ExternalObject->Package.Elements = (ACPI_OBJECT *) Info.FreeSpace; @@ -435,8 +435,8 @@ AcpiCmCopyIpackageToEpackage ( ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - Status = AcpiCmWalkPackageTree (InternalObject, ExternalObject, - AcpiCmCopyIelementToEelement, &Info); + Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject, + AcpiUtCopyIelementToEelement, &Info); *SpaceUsed = Info.Length; @@ -446,12 +446,12 @@ AcpiCmCopyIpackageToEpackage ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyIobjectToEobject + * FUNCTION: AcpiUtCopyIobjectToEobject * * PARAMETERS: *InternalObject - The internal object to be converted * *BufferPtr - Where the object is returned * - * RETURN: Status + * RETURN: Status * * DESCRIPTION: This function is called to build an API object to be returned to * the caller. @@ -459,23 +459,23 @@ AcpiCmCopyIpackageToEpackage ( ******************************************************************************/ ACPI_STATUS -AcpiCmCopyIobjectToEobject ( +AcpiUtCopyIobjectToEobject ( ACPI_OPERAND_OBJECT *InternalObject, ACPI_BUFFER *RetBuffer) { ACPI_STATUS Status; - FUNCTION_TRACE ("CmCopyIobjectToEobject"); + FUNCTION_TRACE ("UtCopyIobjectToEobject"); if (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE)) { /* - * Package object: Copy all subobjects (including + * Package object: Copy all subobjects (including * nested packages) */ - Status = AcpiCmCopyIpackageToEpackage (InternalObject, + Status = AcpiUtCopyIpackageToEpackage (InternalObject, RetBuffer->Pointer, &RetBuffer->Length); } @@ -484,7 +484,7 @@ AcpiCmCopyIobjectToEobject ( /* * Build a simple object (no nested objects) */ - Status = AcpiCmCopyIsimpleToEsimple (InternalObject, + Status = AcpiUtCopyIsimpleToEsimple (InternalObject, (ACPI_OBJECT *) RetBuffer->Pointer, ((UINT8 *) RetBuffer->Pointer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), @@ -500,10 +500,9 @@ AcpiCmCopyIobjectToEobject ( } - /******************************************************************************* * - * FUNCTION: AcpiCmCopyEsimpleToIsimple + * FUNCTION: AcpiUtCopyEsimpleToIsimple * * PARAMETERS: *ExternalObject - The external object to be converted * *InternalObject - Where the internal object is returned @@ -518,12 +517,12 @@ AcpiCmCopyIobjectToEobject ( ******************************************************************************/ ACPI_STATUS -AcpiCmCopyEsimpleToIsimple ( +AcpiUtCopyEsimpleToIsimple ( ACPI_OBJECT *ExternalObject, ACPI_OPERAND_OBJECT *InternalObject) { - FUNCTION_TRACE ("CmCopyEsimpleToIsimple"); + FUNCTION_TRACE ("UtCopyEsimpleToIsimple"); InternalObject->Common.Type = (UINT8) ExternalObject->Type; @@ -569,7 +568,7 @@ AcpiCmCopyEsimpleToIsimple ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyEpackageToIpackage + * FUNCTION: AcpiUtCopyEpackageToIpackage * * PARAMETERS: *InternalObject - Pointer to the object we are returning * *Buffer - Where the object is returned @@ -582,12 +581,12 @@ AcpiCmCopyEsimpleToIsimple ( * * The buffer is assumed to have sufficient space for the object. * The caller must have verified the buffer length needed using the - * AcpiCmGetObjectSize function before calling this function. + * AcpiUtGetObjectSize function before calling this function. * ******************************************************************************/ static ACPI_STATUS -AcpiCmCopyEpackageToIpackage ( +AcpiUtCopyEpackageToIpackage ( ACPI_OPERAND_OBJECT *InternalObject, UINT8 *Buffer, UINT32 *SpaceUsed) @@ -601,7 +600,7 @@ AcpiCmCopyEpackageToIpackage ( ACPI_OBJECT *ThisExternalObj; - FUNCTION_TRACE ("CmCopyEpackageToIpackage"); + FUNCTION_TRACE ("UtCopyEpackageToIpackage"); /* @@ -637,7 +636,7 @@ AcpiCmCopyEpackageToIpackage ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyEobjectToIobject + * FUNCTION: AcpiUtCopyEobjectToIobject * * PARAMETERS: *InternalObject - The external object to be converted * *BufferPtr - Where the internal object is returned @@ -649,14 +648,14 @@ AcpiCmCopyEpackageToIpackage ( ******************************************************************************/ ACPI_STATUS -AcpiCmCopyEobjectToIobject ( +AcpiUtCopyEobjectToIobject ( ACPI_OBJECT *ExternalObject, ACPI_OPERAND_OBJECT *InternalObject) { ACPI_STATUS Status; - FUNCTION_TRACE ("AcpiCmCopyEobjectToIobject"); + FUNCTION_TRACE ("UtCopyEobjectToIobject"); if (ExternalObject->Type == ACPI_TYPE_PACKAGE) @@ -670,12 +669,11 @@ AcpiCmCopyEobjectToIobject ( * control methods only. This is a very, very rare case. */ /* - Status = AcpiCmCopyEpackageToIpackage(InternalObject, + Status = AcpiUtCopyEpackageToIpackage(InternalObject, RetBuffer->Pointer, &RetBuffer->Length); */ - DEBUG_PRINT (ACPI_ERROR, - ("AcpiCmCopyEobjectToIobject: Packages as parameters not implemented!\n")); + DEBUG_PRINTP (ACPI_ERROR, ("Packages as parameters not implemented!\n")); return_ACPI_STATUS (AE_NOT_IMPLEMENTED); } @@ -685,7 +683,7 @@ AcpiCmCopyEobjectToIobject ( /* * Build a simple object (no nested objects) */ - Status = AcpiCmCopyEsimpleToIsimple (ExternalObject, InternalObject); + Status = AcpiUtCopyEsimpleToIsimple (ExternalObject, InternalObject); /* * build simple does not include the object size in the length * so we add it in here @@ -696,10 +694,9 @@ AcpiCmCopyEobjectToIobject ( } - /******************************************************************************* * - * FUNCTION: AcpiCmCopyIelementToIelement + * FUNCTION: AcpiUtCopyIelementToIelement * * PARAMETERS: ACPI_PKG_CALLBACK * @@ -710,7 +707,7 @@ AcpiCmCopyEobjectToIobject ( ******************************************************************************/ ACPI_STATUS -AcpiCmCopyIelementToIelement ( +AcpiUtCopyIelementToIelement ( UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, @@ -722,9 +719,8 @@ AcpiCmCopyIelementToIelement ( ACPI_OPERAND_OBJECT *TargetObject; - ThisIndex = State->Pkg.Index; - ThisTargetPtr = (ACPI_OPERAND_OBJECT **) + ThisTargetPtr = (ACPI_OPERAND_OBJECT **) &State->Pkg.DestObject->Package.Elements[ThisIndex]; switch (ObjectType) @@ -734,13 +730,13 @@ AcpiCmCopyIelementToIelement ( /* * This is a simple object, just copy it */ - TargetObject = AcpiCmCreateInternalObject (SourceObject->Common.Type); + TargetObject = AcpiUtCreateInternalObject (SourceObject->Common.Type); if (!TargetObject) { return (AE_NO_MEMORY); } - Status = AcpiAmlStoreObjectToObject (SourceObject, TargetObject, + Status = AcpiExStoreObjectToObject (SourceObject, TargetObject, (ACPI_WALK_STATE *) Context); if (ACPI_FAILURE (Status)) { @@ -753,10 +749,10 @@ AcpiCmCopyIelementToIelement ( case 1: /* - * This object is a package - go down another nesting level + * This object is a package - go down another nesting level * Create and build the package object */ - TargetObject = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE); + TargetObject = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); if (!TargetObject) { /* TBD: must delete package created up to this point */ @@ -788,7 +784,7 @@ AcpiCmCopyIelementToIelement ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyIpackageToIpackage + * FUNCTION: AcpiUtCopyIpackageToIpackage * * PARAMETERS: *SourceObj - Pointer to the source package object * *DestObj - Where the internal object is returned @@ -801,15 +797,14 @@ AcpiCmCopyIelementToIelement ( ******************************************************************************/ ACPI_STATUS -AcpiCmCopyIpackageToIpackage ( +AcpiUtCopyIpackageToIpackage ( ACPI_OPERAND_OBJECT *SourceObj, ACPI_OPERAND_OBJECT *DestObj, ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE ("CmCopyIpackageToIpackage"); - + FUNCTION_TRACE ("UtCopyIpackageToIpackage"); DestObj->Common.Type = SourceObj->Common.Type; @@ -820,7 +815,7 @@ AcpiCmCopyIpackageToIpackage ( * Create the object array and walk the source package tree */ - DestObj->Package.Elements = AcpiCmCallocate ((SourceObj->Package.Count + 1) * + DestObj->Package.Elements = AcpiUtCallocate ((SourceObj->Package.Count + 1) * sizeof (void *)); DestObj->Package.NextElement = DestObj->Package.Elements; @@ -832,8 +827,8 @@ AcpiCmCopyIpackageToIpackage ( } - Status = AcpiCmWalkPackageTree (SourceObj, DestObj, - AcpiCmCopyIelementToIelement, WalkState); + Status = AcpiUtWalkPackageTree (SourceObj, DestObj, + AcpiUtCopyIelementToIelement, WalkState); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/utdebug.c b/sys/contrib/dev/acpica/utdebug.c index 5792a13..0a27da2 100644 --- a/sys/contrib/dev/acpica/utdebug.c +++ b/sys/contrib/dev/acpica/utdebug.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmdebug - Debug print routines - * $Revision: 64 $ + * Module Name: utdebug - Debug print routines + * $Revision: 72 $ * *****************************************************************************/ @@ -114,14 +114,16 @@ * *****************************************************************************/ -#define __CMDEBUG_C__ +#define __UTDEBUG_C__ #include "acpi.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdebug") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utdebug") +UINT32 PrevThreadId = 0xFFFFFFFF; + /***************************************************************************** * * FUNCTION: Get/Set debug level @@ -344,7 +346,7 @@ FunctionStatusExit ( " %2.2ld Exiting Function: %s, %s\n", AcpiGbl_NestingLevel, FunctionName, - AcpiCmFormatException (Status)); + AcpiUtFormatException (Status)); AcpiGbl_NestingLevel--; } @@ -446,6 +448,10 @@ DebugPrint ( ...) { va_list args; + UINT32 ThreadId; + + + ThreadId = AcpiOsGetThreadId (); /* Both the level and the component must be enabled */ @@ -455,7 +461,26 @@ DebugPrint ( { va_start (args, Format); - AcpiOsPrintf ("%8s-%04d: ", ModuleName, LineNumber); + if (ThreadId != PrevThreadId) + { + if (TRACE_THREADS & AcpiDbgLevel) + { + AcpiOsPrintf ("\n**** Context Switch from TID %X to TID %X ****\n\n", + PrevThreadId, ThreadId); + } + + PrevThreadId = ThreadId; + } + + if (TRACE_THREADS & AcpiDbgLevel) + { + AcpiOsPrintf ("%8s-%04d[%04X]: ", ModuleName, LineNumber, ThreadId); + } + else + { + AcpiOsPrintf ("%8s-%04d: ", ModuleName, LineNumber); + } + AcpiOsVprintf (Format, args); } } @@ -481,9 +506,31 @@ DebugPrintPrefix ( NATIVE_CHAR *ModuleName, UINT32 LineNumber) { + UINT32 ThreadId; + + + ThreadId = AcpiOsGetThreadId (); + + if (ThreadId != PrevThreadId) + { + if (TRACE_THREADS & AcpiDbgLevel) + { + AcpiOsPrintf ("\n**** Context Switch from TID %X to TID %X ****\n\n", + PrevThreadId, ThreadId); + } + PrevThreadId = ThreadId; + } + + if (TRACE_THREADS & AcpiDbgLevel) + { + AcpiOsPrintf ("%8s-%04d[%04X]: ", ModuleName, LineNumber, ThreadId); + } + else + { + AcpiOsPrintf ("%8s-%04d: ", ModuleName, LineNumber); + } - AcpiOsPrintf ("%8s-%04d: ", ModuleName, LineNumber); } @@ -518,7 +565,7 @@ DebugPrintRaw ( /***************************************************************************** * - * FUNCTION: AcpiCmDumpBuffer + * FUNCTION: AcpiUtDumpBuffer * * PARAMETERS: Buffer - Buffer to dump * Count - Amount to dump, in bytes @@ -531,7 +578,7 @@ DebugPrintRaw ( ****************************************************************************/ void -AcpiCmDumpBuffer ( +AcpiUtDumpBuffer ( UINT8 *Buffer, UINT32 Count, UINT32 Display, diff --git a/sys/contrib/dev/acpica/utdelete.c b/sys/contrib/dev/acpica/utdelete.c index 34a42ae..8a7409a 100644 --- a/sys/contrib/dev/acpica/utdelete.c +++ b/sys/contrib/dev/acpica/utdelete.c @@ -1,7 +1,7 @@ /******************************************************************************* * - * Module Name: cmdelete - object deletion and reference count utilities - * $Revision: 62 $ + * Module Name: utdelete - object deletion and reference count utilities + * $Revision: 71 $ * ******************************************************************************/ @@ -114,7 +114,7 @@ * *****************************************************************************/ -#define __CMDELETE_C__ +#define __UTDELETE_C__ #include "acpi.h" #include "acinterp.h" @@ -122,13 +122,13 @@ #include "actables.h" #include "acparser.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdelete") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utdelete") /******************************************************************************* * - * FUNCTION: AcpiCmDeleteInternalObj + * FUNCTION: AcpiUtDeleteInternalObj * * PARAMETERS: *Object - Pointer to the list to be deleted * @@ -140,14 +140,14 @@ ******************************************************************************/ void -AcpiCmDeleteInternalObj ( +AcpiUtDeleteInternalObj ( ACPI_OPERAND_OBJECT *Object) { void *ObjPointer = NULL; ACPI_OPERAND_OBJECT *HandlerDesc; - FUNCTION_TRACE_PTR ("CmDeleteInternalObj", Object); + FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object); if (!Object) @@ -165,8 +165,7 @@ AcpiCmDeleteInternalObj ( case ACPI_TYPE_STRING: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: **** String %p, ptr %p\n", + DEBUG_PRINTP (ACPI_INFO, ("**** String %p, ptr %p\n", Object, Object->String.Pointer)); /* Free the actual string buffer */ @@ -177,8 +176,7 @@ AcpiCmDeleteInternalObj ( case ACPI_TYPE_BUFFER: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: **** Buffer %p, ptr %p\n", + DEBUG_PRINTP (ACPI_INFO, ("**** Buffer %p, ptr %p\n", Object, Object->Buffer.Pointer)); /* Free the actual buffer */ @@ -189,8 +187,7 @@ AcpiCmDeleteInternalObj ( case ACPI_TYPE_PACKAGE: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: **** Package of count %X\n", + DEBUG_PRINTP (ACPI_INFO, (" **** Package of count %X\n", Object->Package.Count)); /* @@ -206,18 +203,17 @@ AcpiCmDeleteInternalObj ( case ACPI_TYPE_MUTEX: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Mutex %p, Semaphore %p\n", + DEBUG_PRINTP (ACPI_INFO, ("***** Mutex %p, Semaphore %p\n", Object, Object->Mutex.Semaphore)); + AcpiExUnlinkMutex (Object); AcpiOsDeleteSemaphore (Object->Mutex.Semaphore); break; case ACPI_TYPE_EVENT: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Event %p, Semaphore %p\n", + DEBUG_PRINTP (ACPI_INFO, ("***** Event %p, Semaphore %p\n", Object, Object->Event.Semaphore)); AcpiOsDeleteSemaphore (Object->Event.Semaphore); @@ -227,8 +223,7 @@ AcpiCmDeleteInternalObj ( case ACPI_TYPE_METHOD: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Method %p\n", Object)); + DEBUG_PRINTP (ACPI_INFO, ("***** Method %p\n", Object)); /* Delete the method semaphore if it exists */ @@ -243,10 +238,7 @@ AcpiCmDeleteInternalObj ( case ACPI_TYPE_REGION: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Region %p\n", - Object)); - + DEBUG_PRINTP (ACPI_INFO, ("***** Region %p\n", Object)); if (Object->Region.Extra) { @@ -264,20 +256,18 @@ AcpiCmDeleteInternalObj ( /* Now we can free the Extra object */ - AcpiCmDeleteObjectDesc (Object->Region.Extra); + AcpiUtDeleteObjectDesc (Object->Region.Extra); } break; - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** FieldUnit %p\n", - Object)); + DEBUG_PRINTP (ACPI_INFO, ("***** Buffer Field %p\n", Object)); - if (Object->FieldUnit.Extra) + if (Object->BufferField.Extra) { - AcpiCmDeleteObjectDesc (Object->FieldUnit.Extra); + AcpiUtDeleteObjectDesc (Object->BufferField.Extra); } break; @@ -289,15 +279,13 @@ AcpiCmDeleteInternalObj ( /* * Delete any allocated memory found above */ - if (ObjPointer) { if (!AcpiTbSystemTablePointer (ObjPointer)) { - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: Deleting Obj Ptr %p \n", ObjPointer)); + DEBUG_PRINTP (ACPI_INFO, ("Deleting Obj Ptr %p \n", ObjPointer)); - AcpiCmFree (ObjPointer); + AcpiUtFree (ObjPointer); } } @@ -306,19 +294,16 @@ AcpiCmDeleteInternalObj ( if (Object->Common.Flags & AOPOBJ_STATIC_ALLOCATION) { - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: Object %p [%s] static allocation, no delete\n", - Object, AcpiCmGetTypeName (Object->Common.Type))); + DEBUG_PRINTP (ACPI_INFO, ("Object %p [%s] static allocation, no delete\n", + Object, AcpiUtGetTypeName (Object->Common.Type))); } if (!(Object->Common.Flags & AOPOBJ_STATIC_ALLOCATION)) { - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: Deleting object %p [%s]\n", - Object, AcpiCmGetTypeName (Object->Common.Type))); - - AcpiCmDeleteObjectDesc (Object); + DEBUG_PRINTP (ACPI_INFO, ("Deleting object %p [%s]\n", + Object, AcpiUtGetTypeName (Object->Common.Type))); + AcpiUtDeleteObjectDesc (Object); } return_VOID; @@ -327,7 +312,7 @@ AcpiCmDeleteInternalObj ( /******************************************************************************* * - * FUNCTION: AcpiCmDeleteInternalObjectList + * FUNCTION: AcpiUtDeleteInternalObjectList * * PARAMETERS: *ObjList - Pointer to the list to be deleted * @@ -339,13 +324,13 @@ AcpiCmDeleteInternalObj ( ******************************************************************************/ ACPI_STATUS -AcpiCmDeleteInternalObjectList ( +AcpiUtDeleteInternalObjectList ( ACPI_OPERAND_OBJECT **ObjList) { ACPI_OPERAND_OBJECT **InternalObj; - FUNCTION_TRACE ("CmDeleteInternalObjectList"); + FUNCTION_TRACE ("UtDeleteInternalObjectList"); /* Walk the null-terminated internal list */ @@ -366,14 +351,14 @@ AcpiCmDeleteInternalObjectList ( * TBD: [Investigate] This might not be the right thing to do, * depending on how the internal package object was allocated!!! */ - AcpiCmDeleteInternalObj (*InternalObj); + AcpiUtDeleteInternalObj (*InternalObj); } } /* Free the combined parameter pointer list and object array */ - AcpiCmFree (ObjList); + AcpiUtFree (ObjList); return_ACPI_STATUS (AE_OK); } @@ -381,7 +366,7 @@ AcpiCmDeleteInternalObjectList ( /******************************************************************************* * - * FUNCTION: AcpiCmUpdateRefCount + * FUNCTION: AcpiUtUpdateRefCount * * PARAMETERS: *Object - Object whose ref count is to be updated * Action - What to do @@ -393,7 +378,7 @@ AcpiCmDeleteInternalObjectList ( ******************************************************************************/ static void -AcpiCmUpdateRefCount ( +AcpiUtUpdateRefCount ( ACPI_OPERAND_OBJECT *Object, UINT32 Action) { @@ -401,6 +386,8 @@ AcpiCmUpdateRefCount ( UINT16 NewCount; + PROC_NAME ("UtUpdateRefCount"); + if (!Object) { return; @@ -422,8 +409,7 @@ AcpiCmUpdateRefCount ( NewCount++; Object->Common.ReferenceCount = NewCount; - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, [Incremented]\n", + DEBUG_PRINTP (ACPI_INFO, ("Obj %p Refs=%X, [Incremented]\n", Object, NewCount)); break; @@ -432,8 +418,7 @@ AcpiCmUpdateRefCount ( if (Count < 1) { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, can't decrement! (Set to 0)\n", + DEBUG_PRINTP (ACPI_INFO, ("Obj %p Refs=%X, can't decrement! (Set to 0)\n", Object, NewCount)); NewCount = 0; @@ -443,22 +428,20 @@ AcpiCmUpdateRefCount ( { NewCount--; - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, [Decremented]\n", + DEBUG_PRINTP (ACPI_INFO, ("Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); } if (Object->Common.Type == ACPI_TYPE_METHOD) { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Method Obj %p Refs=%X, [Decremented]\n", + DEBUG_PRINTP (ACPI_INFO, ("Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount)); } Object->Common.ReferenceCount = NewCount; if (NewCount == 0) { - AcpiCmDeleteInternalObj (Object); + AcpiUtDeleteInternalObj (Object); } break; @@ -466,20 +449,18 @@ AcpiCmUpdateRefCount ( case REF_FORCE_DELETE: - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, Force delete! (Set to 0)\n", + DEBUG_PRINTP (ACPI_INFO, ("Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count)); NewCount = 0; Object->Common.ReferenceCount = NewCount; - AcpiCmDeleteInternalObj (Object); + AcpiUtDeleteInternalObj (Object); break; default: - DEBUG_PRINT (ACPI_ERROR, - ("CmUpdateRefCount: Unknown action (%X)\n", Action)); + DEBUG_PRINTP (ACPI_ERROR, ("Unknown action (%X)\n", Action)); break; } @@ -492,8 +473,8 @@ AcpiCmUpdateRefCount ( if (Count > MAX_REFERENCE_COUNT) { - DEBUG_PRINT (ACPI_ERROR, - ("CmUpdateRefCount: **** AE_ERROR **** Invalid Reference Count (%X) in object %p\n\n", + DEBUG_PRINTP (ACPI_ERROR, + ("**** AE_ERROR **** Invalid Reference Count (%X) in object %p\n\n", Count, Object)); } @@ -503,7 +484,7 @@ AcpiCmUpdateRefCount ( /******************************************************************************* * - * FUNCTION: AcpiCmUpdateObjectReference + * FUNCTION: AcpiUtUpdateObjectReference * * PARAMETERS: *Object - Increment ref count for this object * and all sub-objects @@ -524,7 +505,7 @@ AcpiCmUpdateRefCount ( ******************************************************************************/ ACPI_STATUS -AcpiCmUpdateObjectReference ( +AcpiUtUpdateObjectReference ( ACPI_OPERAND_OBJECT *Object, UINT16 Action) { @@ -536,7 +517,7 @@ AcpiCmUpdateObjectReference ( ACPI_GENERIC_STATE *State; - FUNCTION_TRACE_PTR ("CmUpdateObjectReference", Object); + FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object); /* Ignore a null object ptr */ @@ -553,29 +534,24 @@ AcpiCmUpdateObjectReference ( if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)) { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateObjectReference: Object %p is NS handle\n", - Object)); + DEBUG_PRINTP (ACPI_INFO, ("Object %p is NS handle\n", Object)); return_ACPI_STATUS (AE_OK); } if (AcpiTbSystemTablePointer (Object)) { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateObjectReference: **** Object %p is Pcode Ptr\n", - Object)); + DEBUG_PRINTP (ACPI_INFO, ("**** Object %p is Pcode Ptr\n", Object)); return_ACPI_STATUS (AE_OK); } - State = AcpiCmCreateUpdateState (Object, Action); + State = AcpiUtCreateUpdateState (Object, Action); while (State) { - Object = State->Update.Object; Action = State->Update.Value; - AcpiCmDeleteGenericState (State); + AcpiUtDeleteGenericState (State); /* * All sub-objects must have their reference count incremented also. @@ -586,15 +562,15 @@ AcpiCmUpdateObjectReference ( case ACPI_TYPE_DEVICE: - Status = AcpiCmCreateUpdateStateAndPush (Object->Device.AddrHandler, + Status = AcpiUtCreateUpdateStateAndPush (Object->Device.AddrHandler, Action, &StateList); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - AcpiCmUpdateRefCount (Object->Device.SysHandler, Action); - AcpiCmUpdateRefCount (Object->Device.DrvHandler, Action); + AcpiUtUpdateRefCount (Object->Device.SysHandler, Action); + AcpiUtUpdateRefCount (Object->Device.DrvHandler, Action); break; @@ -606,7 +582,7 @@ AcpiCmUpdateObjectReference ( while (Next) { New = Next->AddrHandler.Next; - AcpiCmUpdateRefCount (Next, Action); + AcpiUtUpdateRefCount (Next, Action); Next = New; } @@ -627,7 +603,7 @@ AcpiCmUpdateObjectReference ( * these are simply ignored */ - Status = AcpiCmCreateUpdateStateAndPush ( + Status = AcpiUtCreateUpdateStateAndPush ( Object->Package.Elements[i], Action, &StateList); if (ACPI_FAILURE (Status)) { @@ -637,10 +613,10 @@ AcpiCmUpdateObjectReference ( break; - case ACPI_TYPE_FIELD_UNIT: + case ACPI_TYPE_BUFFER_FIELD: - Status = AcpiCmCreateUpdateStateAndPush ( - Object->FieldUnit.Container, Action, &StateList); + Status = AcpiUtCreateUpdateStateAndPush ( + Object->BufferField.BufferObj, Action, &StateList); if (ACPI_FAILURE (Status)) { @@ -649,10 +625,10 @@ AcpiCmUpdateObjectReference ( break; - case INTERNAL_TYPE_DEF_FIELD: + case INTERNAL_TYPE_REGION_FIELD: - Status = AcpiCmCreateUpdateStateAndPush ( - Object->Field.Container, Action, &StateList); + Status = AcpiUtCreateUpdateStateAndPush ( + Object->Field.RegionObj, Action, &StateList); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -662,15 +638,33 @@ AcpiCmUpdateObjectReference ( case INTERNAL_TYPE_BANK_FIELD: - Status = AcpiCmCreateUpdateStateAndPush ( - Object->BankField.BankSelect, Action, &StateList); + Status = AcpiUtCreateUpdateStateAndPush ( + Object->BankField.BankRegisterObj, Action, &StateList); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } - Status = AcpiCmCreateUpdateStateAndPush ( - Object->BankField.Container, Action, &StateList); + Status = AcpiUtCreateUpdateStateAndPush ( + Object->BankField.RegionObj, Action, &StateList); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + break; + + + case INTERNAL_TYPE_INDEX_FIELD: + + Status = AcpiUtCreateUpdateStateAndPush ( + Object->IndexField.IndexObj, Action, &StateList); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + Status = AcpiUtCreateUpdateStateAndPush ( + Object->IndexField.DataObj, Action, &StateList); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -681,11 +675,11 @@ AcpiCmUpdateObjectReference ( case ACPI_TYPE_REGION: /* TBD: [Investigate] - AcpiCmUpdateRefCount (Object->Region.AddrHandler, Action); + AcpiUtUpdateRefCount (Object->Region.AddrHandler, Action); */ /* Status = - AcpiCmCreateUpdateStateAndPush (Object->Region.AddrHandler, + AcpiUtCreateUpdateStateAndPush (Object->Region.AddrHandler, Action, &StateList); if (ACPI_FAILURE (Status)) { @@ -707,12 +701,12 @@ AcpiCmUpdateObjectReference ( * main object to be deleted. */ - AcpiCmUpdateRefCount (Object, Action); + AcpiUtUpdateRefCount (Object, Action); /* Move on to the next object to be updated */ - State = AcpiCmPopGenericState (&StateList); + State = AcpiUtPopGenericState (&StateList); } @@ -722,7 +716,7 @@ AcpiCmUpdateObjectReference ( /******************************************************************************* * - * FUNCTION: AcpiCmAddReference + * FUNCTION: AcpiUtAddReference * * PARAMETERS: *Object - Object whose reference count is to be * incremented @@ -734,18 +728,18 @@ AcpiCmUpdateObjectReference ( ******************************************************************************/ void -AcpiCmAddReference ( +AcpiUtAddReference ( ACPI_OPERAND_OBJECT *Object) { - FUNCTION_TRACE_PTR ("CmAddReference", Object); + FUNCTION_TRACE_PTR ("UtAddReference", Object); /* * Ensure that we have a valid object */ - if (!AcpiCmValidInternalObject (Object)) + if (!AcpiUtValidInternalObject (Object)) { return_VOID; } @@ -754,7 +748,7 @@ AcpiCmAddReference ( * We have a valid ACPI internal object, now increment the reference count */ - AcpiCmUpdateObjectReference (Object, REF_INCREMENT); + AcpiUtUpdateObjectReference (Object, REF_INCREMENT); return_VOID; } @@ -762,7 +756,7 @@ AcpiCmAddReference ( /******************************************************************************* * - * FUNCTION: AcpiCmRemoveReference + * FUNCTION: AcpiUtRemoveReference * * PARAMETERS: *Object - Object whose ref count will be decremented * @@ -773,24 +767,24 @@ AcpiCmAddReference ( ******************************************************************************/ void -AcpiCmRemoveReference ( +AcpiUtRemoveReference ( ACPI_OPERAND_OBJECT *Object) { - FUNCTION_TRACE_PTR ("CmRemoveReference", Object); + FUNCTION_TRACE_PTR ("UtRemoveReference", Object); /* * Ensure that we have a valid object */ - if (!AcpiCmValidInternalObject (Object)) + if (!AcpiUtValidInternalObject (Object)) { return_VOID; } - DEBUG_PRINT (ACPI_INFO, ("CmRemoveReference: Obj %p Refs=%X\n", - Object, Object->Common.ReferenceCount)); + DEBUG_PRINTP (ACPI_INFO, ("Obj %p Refs=%X\n", + Object, Object->Common.ReferenceCount)); /* * Decrement the reference count, and only actually delete the object @@ -798,8 +792,7 @@ AcpiCmRemoveReference ( * of all subobjects!) */ - AcpiCmUpdateObjectReference (Object, REF_DECREMENT); - + AcpiUtUpdateObjectReference (Object, REF_DECREMENT); return_VOID; } diff --git a/sys/contrib/dev/acpica/uteval.c b/sys/contrib/dev/acpica/uteval.c index 2987090..3dc815f 100644 --- a/sys/contrib/dev/acpica/uteval.c +++ b/sys/contrib/dev/acpica/uteval.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmeval - Object evaluation - * $Revision: 21 $ + * Module Name: uteval - Object evaluation + * $Revision: 27 $ * *****************************************************************************/ @@ -114,20 +114,20 @@ * *****************************************************************************/ -#define __CMEVAL_C__ +#define __UTEVAL_C__ #include "acpi.h" #include "acnamesp.h" #include "acinterp.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmeval") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("uteval") -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmEvaluateNumericObject + * FUNCTION: AcpiUtEvaluateNumericObject * * PARAMETERS: *ObjectName - Object name to be evaluated * DeviceNode - Node for the device @@ -140,10 +140,10 @@ * * NOTE: Internal function, no parameter validation * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiCmEvaluateNumericObject ( +AcpiUtEvaluateNumericObject ( NATIVE_CHAR *ObjectName, ACPI_NAMESPACE_NODE *DeviceNode, ACPI_INTEGER *Address) @@ -152,7 +152,7 @@ AcpiCmEvaluateNumericObject ( ACPI_STATUS Status; - FUNCTION_TRACE ("CmEvaluateNumericObject"); + FUNCTION_TRACE ("UtEvaluateNumericObject"); /* Execute the method */ @@ -162,16 +162,14 @@ AcpiCmEvaluateNumericObject ( { if (Status == AE_NOT_FOUND) { - DEBUG_PRINT (ACPI_INFO, - ("%s on %4.4s was not found\n", ObjectName, - &DeviceNode->Name)); + DEBUG_PRINTP (ACPI_INFO, ("%s on %4.4s was not found\n", + ObjectName, &DeviceNode->Name)); } else { - DEBUG_PRINT (ACPI_ERROR, - ("%s on %4.4s failed with status %4.4x\n", ObjectName, - &DeviceNode->Name, - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("%s on %4.4s failed with status %s\n", + ObjectName, &DeviceNode->Name, + AcpiUtFormatException (Status))); } return_ACPI_STATUS (Status); @@ -182,8 +180,8 @@ AcpiCmEvaluateNumericObject ( if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, - ("No object was returned from %s\n", ObjectName)); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from %s\n", + ObjectName)); return_ACPI_STATUS (AE_TYPE); } @@ -192,7 +190,7 @@ AcpiCmEvaluateNumericObject ( if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Type returned from %s was not a number: %X \n", ObjectName, ObjDesc->Common.Type)); } @@ -207,15 +205,15 @@ AcpiCmEvaluateNumericObject ( /* On exit, we must delete the return object */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmExecute_HID + * FUNCTION: AcpiUtExecute_HID * * PARAMETERS: DeviceNode - Node for the device * *Hid - Where the HID is returned @@ -227,18 +225,18 @@ AcpiCmEvaluateNumericObject ( * * NOTE: Internal function, no parameter validation * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiCmExecute_HID ( +AcpiUtExecute_HID ( ACPI_NAMESPACE_NODE *DeviceNode, - DEVICE_ID *Hid) + ACPI_DEVICE_ID *Hid) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; - FUNCTION_TRACE ("CmExecute_HID"); + FUNCTION_TRACE ("UtExecute_HID"); /* Execute the method */ @@ -249,17 +247,14 @@ AcpiCmExecute_HID ( { if (Status == AE_NOT_FOUND) { - DEBUG_PRINT (ACPI_INFO, - ("_HID on %4.4s was not found\n", + DEBUG_PRINTP (ACPI_INFO, ("_HID on %4.4s was not found\n", &DeviceNode->Name)); } else { - DEBUG_PRINT (ACPI_ERROR, - ("_HID on %4.4s failed with status %4.4x\n", - &DeviceNode->Name, - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("_HID on %4.4s failed %s\n", + &DeviceNode->Name, AcpiUtFormatException (Status))); } return_ACPI_STATUS (Status); @@ -269,7 +264,7 @@ AcpiCmExecute_HID ( if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _HID\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _HID\n")); return_ACPI_STATUS (AE_TYPE); } @@ -277,14 +272,13 @@ AcpiCmExecute_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)) { Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Type returned from _HID not a number or string: %s(%X) \n", - AcpiCmGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); + AcpiUtGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); } else @@ -293,7 +287,7 @@ AcpiCmExecute_HID ( { /* Convert the Numeric HID to string */ - AcpiAmlEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); + AcpiExEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); } else @@ -307,15 +301,15 @@ AcpiCmExecute_HID ( /* On exit, we must delete the return object */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return_ACPI_STATUS (Status); } -/**************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmExecute_UID + * FUNCTION: AcpiUtExecute_UID * * PARAMETERS: DeviceNode - Node for the device * *Uid - Where the UID is returned @@ -327,17 +321,20 @@ AcpiCmExecute_HID ( * * NOTE: Internal function, no parameter validation * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiCmExecute_UID ( +AcpiUtExecute_UID ( ACPI_NAMESPACE_NODE *DeviceNode, - DEVICE_ID *Uid) + ACPI_DEVICE_ID *Uid) { ACPI_OPERAND_OBJECT *ObjDesc; ACPI_STATUS Status; + PROC_NAME ("UtExecute_UID"); + + /* Execute the method */ Status = AcpiNsEvaluateRelative (DeviceNode, @@ -346,17 +343,15 @@ AcpiCmExecute_UID ( { if (Status == AE_NOT_FOUND) { - DEBUG_PRINT (ACPI_INFO, - ("_UID on %4.4s was not found\n", + DEBUG_PRINTP (ACPI_INFO, ("_UID on %4.4s was not found\n", &DeviceNode->Name)); } else { - DEBUG_PRINT (ACPI_ERROR, - ("_UID on %4.4s failed with status %4.4x\n", - &DeviceNode->Name, - AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, + ("_UID on %4.4s failed %s\n", + &DeviceNode->Name, AcpiUtFormatException (Status))); } return (Status); @@ -366,7 +361,7 @@ AcpiCmExecute_UID ( if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _UID\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _UID\n")); return (AE_TYPE); } @@ -374,12 +369,11 @@ AcpiCmExecute_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)) { Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Type returned from _UID was not a number or string: %X \n", ObjDesc->Common.Type)); } @@ -390,7 +384,7 @@ AcpiCmExecute_UID ( { /* Convert the Numeric UID to string */ - AcpiAmlUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); + AcpiExUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); } else @@ -404,14 +398,15 @@ AcpiCmExecute_UID ( /* On exit, we must delete the return object */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); return (Status); } -/**************************************************************************** + +/******************************************************************************* * - * FUNCTION: AcpiCmExecute_STA + * FUNCTION: AcpiUtExecute_STA * * PARAMETERS: DeviceNode - Node for the device * *Flags - Where the status flags are returned @@ -423,10 +418,10 @@ AcpiCmExecute_UID ( * * NOTE: Internal function, no parameter validation * - ***************************************************************************/ + ******************************************************************************/ ACPI_STATUS -AcpiCmExecute_STA ( +AcpiUtExecute_STA ( ACPI_NAMESPACE_NODE *DeviceNode, UINT32 *Flags) { @@ -434,7 +429,8 @@ AcpiCmExecute_STA ( ACPI_STATUS Status; - FUNCTION_TRACE ("CmExecute_STA"); + FUNCTION_TRACE ("UtExecute_STA"); + /* Execute the method */ @@ -442,7 +438,7 @@ AcpiCmExecute_STA ( METHOD_NAME__STA, NULL, &ObjDesc); if (AE_NOT_FOUND == Status) { - DEBUG_PRINT (ACPI_INFO, + DEBUG_PRINTP (ACPI_INFO, ("_STA on %4.4s was not found, assuming present.\n", &DeviceNode->Name)); @@ -452,10 +448,9 @@ AcpiCmExecute_STA ( else if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, - ("_STA on %4.4s failed with status %s\n", + DEBUG_PRINTP (ACPI_ERROR, ("_STA on %4.4s failed %s\n", &DeviceNode->Name, - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); } else /* success */ @@ -464,7 +459,7 @@ AcpiCmExecute_STA ( if (!ObjDesc) { - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _STA\n")); + DEBUG_PRINTP (ACPI_ERROR, ("No object was returned from _STA\n")); return_ACPI_STATUS (AE_TYPE); } @@ -473,7 +468,7 @@ AcpiCmExecute_STA ( if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, + DEBUG_PRINTP (ACPI_ERROR, ("Type returned from _STA was not a number: %X \n", ObjDesc->Common.Type)); } @@ -487,7 +482,7 @@ AcpiCmExecute_STA ( /* On exit, we must delete the return object */ - AcpiCmRemoveReference (ObjDesc); + AcpiUtRemoveReference (ObjDesc); } return_ACPI_STATUS (Status); diff --git a/sys/contrib/dev/acpica/utglobal.c b/sys/contrib/dev/acpica/utglobal.c index 2cea5c6..f96a279 100644 --- a/sys/contrib/dev/acpica/utglobal.c +++ b/sys/contrib/dev/acpica/utglobal.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmglobal - Global variables for the ACPI subsystem - * $Revision: 116 $ + * Module Name: utglobal - Global variables for the ACPI subsystem + * $Revision: 122 $ * *****************************************************************************/ @@ -114,7 +114,7 @@ * *****************************************************************************/ -#define __CMGLOBAL_C__ +#define __UTGLOBAL_C__ #define DEFINE_ACPI_GLOBALS #include "acpi.h" @@ -124,8 +124,8 @@ #include "amlcode.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmglobal") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utglobal") /****************************************************************************** @@ -149,7 +149,7 @@ UINT32 AcpiDbgLevel = NORMAL_DEFAULT; /* Debug switch - layer (component) mask */ -UINT32 AcpiDbgLayer = COMPONENT_DEFAULT; +UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; UINT32 AcpiGbl_NestingLevel = 0; @@ -182,22 +182,23 @@ UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; * * Initial values are currently supported only for types String and Number. * To avoid type punning, both are specified as strings in this table. + * + * NOTES: + * 1) _SB_ is defined to be a device to allow _SB_/_INI to be run + * during the initialization sequence. */ PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { {"_GPE", INTERNAL_TYPE_DEF_ANY}, {"_PR_", INTERNAL_TYPE_DEF_ANY}, - {"_SB_", INTERNAL_TYPE_DEF_ANY}, + {"_SB_", ACPI_TYPE_DEVICE}, {"_SI_", INTERNAL_TYPE_DEF_ANY}, {"_TZ_", INTERNAL_TYPE_DEF_ANY}, {"_REV", ACPI_TYPE_INTEGER, "2"}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, "0"}, - - /* Table terminator */ - - {NULL, ACPI_TYPE_ANY} + {NULL, ACPI_TYPE_ANY} /* Table terminator */ }; @@ -296,7 +297,7 @@ NATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n" /***************************************************************************** * - * FUNCTION: AcpiCmGetMutexName + * FUNCTION: AcpiUtGetMutexName * * PARAMETERS: None. * @@ -307,7 +308,7 @@ NATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n" ****************************************************************************/ NATIVE_CHAR * -AcpiCmGetMutexName ( +AcpiUtGetMutexName ( UINT32 MutexId) { @@ -348,18 +349,18 @@ static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC /* 11 */ "Power", /* 12 */ "Processor", /* 13 */ "Thermal", - /* 14 */ "BufferFld", + /* 14 */ "BuffField", /* 15 */ "DdbHandle", /* 16 */ "DebugObj", - /* 17 */ "DefField", - /* 18 */ "BnkField", - /* 19 */ "IdxField", + /* 17 */ "RegnField", + /* 18 */ "BankField", + /* 19 */ "IndxField", /* 20 */ "Reference", /* 21 */ "Alias", /* 22 */ "Notify", /* 23 */ "AddrHndlr", /* 24 */ "Resource", - /* 25 */ "DefFldDfn", + /* 25 */ "RgnFldDfn", /* 26 */ "BnkFldDfn", /* 27 */ "IdxFldDfn", /* 28 */ "If", @@ -374,7 +375,7 @@ static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC /***************************************************************************** * - * FUNCTION: AcpiCmGetTypeName + * FUNCTION: AcpiUtGetTypeName * * PARAMETERS: None. * @@ -385,7 +386,7 @@ static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of AC ****************************************************************************/ NATIVE_CHAR * -AcpiCmGetTypeName ( +AcpiUtGetTypeName ( UINT32 Type) { @@ -414,7 +415,7 @@ NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = /***************************************************************************** * - * FUNCTION: AcpiCmGetRegionName + * FUNCTION: AcpiUtGetRegionName * * PARAMETERS: None. * @@ -425,7 +426,7 @@ NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = ****************************************************************************/ NATIVE_CHAR * -AcpiCmGetRegionName ( +AcpiUtGetRegionName ( UINT8 SpaceId) { @@ -492,7 +493,7 @@ NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = /***************************************************************************** * - * FUNCTION: AcpiCmValidObjectType + * FUNCTION: AcpiUtValidObjectType * * PARAMETERS: None. * @@ -503,7 +504,7 @@ NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = ****************************************************************************/ BOOLEAN -AcpiCmValidObjectType ( +AcpiUtValidObjectType ( UINT32 Type) { @@ -522,7 +523,7 @@ AcpiCmValidObjectType ( /***************************************************************************** * - * FUNCTION: AcpiCmFormatException + * FUNCTION: AcpiUtFormatException * * PARAMETERS: Status - Acpi status to be formatted * @@ -533,7 +534,7 @@ AcpiCmValidObjectType ( ****************************************************************************/ NATIVE_CHAR * -AcpiCmFormatException ( +AcpiUtFormatException ( ACPI_STATUS Status) { NATIVE_CHAR *Exception = "UNKNOWN_STATUS"; @@ -596,7 +597,7 @@ AcpiCmFormatException ( /**************************************************************************** * - * FUNCTION: AcpiCmAllocateOwnerId + * FUNCTION: AcpiUtAllocateOwnerId * * PARAMETERS: IdType - Type of ID (method or table) * @@ -605,16 +606,16 @@ AcpiCmFormatException ( ***************************************************************************/ ACPI_OWNER_ID -AcpiCmAllocateOwnerId ( +AcpiUtAllocateOwnerId ( UINT32 IdType) { ACPI_OWNER_ID OwnerId = 0xFFFF; - FUNCTION_TRACE ("CmAllocateOwnerId"); + FUNCTION_TRACE ("UtAllocateOwnerId"); - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); switch (IdType) { @@ -643,7 +644,7 @@ AcpiCmAllocateOwnerId ( } - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); return_VALUE (OwnerId); } @@ -651,7 +652,7 @@ AcpiCmAllocateOwnerId ( /**************************************************************************** * - * FUNCTION: AcpiCmInitGlobals + * FUNCTION: AcpiUtInitGlobals * * PARAMETERS: none * @@ -661,13 +662,13 @@ AcpiCmAllocateOwnerId ( ***************************************************************************/ void -AcpiCmInitGlobals ( +AcpiUtInitGlobals ( void) { UINT32 i; - FUNCTION_TRACE ("CmInitGlobals"); + FUNCTION_TRACE ("UtInitGlobals"); /* ACPI table structure */ @@ -696,7 +697,7 @@ AcpiCmInitGlobals ( for (i = 0; i < NUM_MTX; i++) { AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; - AcpiGbl_AcpiMutexInfo[i].Locked = FALSE; + AcpiGbl_AcpiMutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; AcpiGbl_AcpiMutexInfo[i].UseCount = 0; } @@ -723,7 +724,6 @@ AcpiCmInitGlobals ( AcpiGbl_SystemFlags = 0; AcpiGbl_StartupFlags = 0; - AcpiGbl_GlobalLockSet = FALSE; AcpiGbl_RsdpOriginalLocation = 0; AcpiGbl_CmSingleStep = FALSE; AcpiGbl_DbTerminateThreads = FALSE; diff --git a/sys/contrib/dev/acpica/utinit.c b/sys/contrib/dev/acpica/utinit.c index f2972a0..4a96268 100644 --- a/sys/contrib/dev/acpica/utinit.c +++ b/sys/contrib/dev/acpica/utinit.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cminit - Common ACPI subsystem initialization - * $Revision: 93 $ + * Module Name: utinit - Common ACPI subsystem initialization + * $Revision: 96 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __CMINIT_C__ +#define __UTINIT_C__ #include "acpi.h" #include "achware.h" @@ -124,8 +124,8 @@ #include "acparser.h" #include "acdispat.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cminit") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utinit") #define ACPI_OFFSET(d,o) ((UINT32) &(((d *)0)->o)) @@ -133,7 +133,7 @@ /******************************************************************************* * - * FUNCTION: AcpiCmFadtRegisterError + * FUNCTION: AcpiUtFadtRegisterError * * PARAMETERS: *RegisterName - Pointer to string identifying register * Value - Actual register contents value @@ -147,7 +147,7 @@ ******************************************************************************/ static ACPI_STATUS -AcpiCmFadtRegisterError ( +AcpiUtFadtRegisterError ( NATIVE_CHAR *RegisterName, UINT32 Value, UINT32 Offset) @@ -164,7 +164,7 @@ AcpiCmFadtRegisterError ( /****************************************************************************** * - * FUNCTION: AcpiCmValidateFadt + * FUNCTION: AcpiUtValidateFadt * * PARAMETERS: None * @@ -175,7 +175,7 @@ AcpiCmFadtRegisterError ( ******************************************************************************/ ACPI_STATUS -AcpiCmValidateFadt ( +AcpiUtValidateFadt ( void) { ACPI_STATUS Status = AE_OK; @@ -188,46 +188,46 @@ AcpiCmValidateFadt ( if (AcpiGbl_FADT->Pm1EvtLen < 4) { - Status = AcpiCmFadtRegisterError ("PM1_EVT_LEN", + Status = AcpiUtFadtRegisterError ("PM1_EVT_LEN", (UINT32) AcpiGbl_FADT->Pm1EvtLen, ACPI_FADT_OFFSET (Pm1EvtLen)); } if (!AcpiGbl_FADT->Pm1CntLen) { - Status = AcpiCmFadtRegisterError ("PM1_CNT_LEN", 0, + Status = AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0, ACPI_FADT_OFFSET (Pm1CntLen)); } if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)) { - Status = AcpiCmFadtRegisterError ("X_PM1a_EVT_BLK", 0, + Status = AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0, ACPI_FADT_OFFSET (XPm1aEvtBlk.Address)); } if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address)) { - Status = AcpiCmFadtRegisterError ("X_PM1a_CNT_BLK", 0, + Status = AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0, ACPI_FADT_OFFSET (XPm1aCntBlk.Address)); } if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address)) { - Status = AcpiCmFadtRegisterError ("X_PM_TMR_BLK", 0, + Status = AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0, ACPI_FADT_OFFSET (XPmTmrBlk.Address)); } if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) && !AcpiGbl_FADT->Pm2CntLen)) { - Status = AcpiCmFadtRegisterError ("PM2_CNT_LEN", + Status = AcpiUtFadtRegisterError ("PM2_CNT_LEN", (UINT32) AcpiGbl_FADT->Pm2CntLen, ACPI_FADT_OFFSET (Pm2CntLen)); } if (AcpiGbl_FADT->PmTmLen < 4) { - Status = AcpiCmFadtRegisterError ("PM_TM_LEN", + Status = AcpiUtFadtRegisterError ("PM_TM_LEN", (UINT32) AcpiGbl_FADT->PmTmLen, ACPI_FADT_OFFSET (PmTmLen)); } @@ -238,7 +238,7 @@ AcpiCmValidateFadt ( if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) && (AcpiGbl_FADT->Gpe0BlkLen & 1)) { - Status = AcpiCmFadtRegisterError ("(x)GPE0_BLK_LEN", + Status = AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN", (UINT32) AcpiGbl_FADT->Gpe0BlkLen, ACPI_FADT_OFFSET (Gpe0BlkLen)); } @@ -246,7 +246,7 @@ AcpiCmValidateFadt ( if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) && (AcpiGbl_FADT->Gpe1BlkLen & 1)) { - Status = AcpiCmFadtRegisterError ("(x)GPE1_BLK_LEN", + Status = AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN", (UINT32) AcpiGbl_FADT->Gpe1BlkLen, ACPI_FADT_OFFSET (Gpe1BlkLen)); } @@ -257,7 +257,7 @@ AcpiCmValidateFadt ( /****************************************************************************** * - * FUNCTION: AcpiCmTerminate + * FUNCTION: AcpiUtTerminate * * PARAMETERS: none * @@ -268,22 +268,22 @@ AcpiCmValidateFadt ( ******************************************************************************/ void -AcpiCmTerminate (void) +AcpiUtTerminate (void) { - FUNCTION_TRACE ("CmTerminate"); + FUNCTION_TRACE ("UtTerminate"); /* Free global tables, etc. */ if (AcpiGbl_Gpe0EnableRegisterSave) { - AcpiCmFree (AcpiGbl_Gpe0EnableRegisterSave); + AcpiUtFree (AcpiGbl_Gpe0EnableRegisterSave); } if (AcpiGbl_Gpe1EnableRegisterSave) { - AcpiCmFree (AcpiGbl_Gpe1EnableRegisterSave); + AcpiUtFree (AcpiGbl_Gpe1EnableRegisterSave); } @@ -291,9 +291,9 @@ AcpiCmTerminate (void) } -/****************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmSubsystemShutdown + * FUNCTION: AcpiUtSubsystemShutdown * * PARAMETERS: none * @@ -305,23 +305,23 @@ AcpiCmTerminate (void) ******************************************************************************/ ACPI_STATUS -AcpiCmSubsystemShutdown (void) +AcpiUtSubsystemShutdown (void) { - FUNCTION_TRACE ("CmSubsystemShutdown"); + FUNCTION_TRACE ("UtSubsystemShutdown"); /* Just exit if subsystem is already shutdown */ if (AcpiGbl_Shutdown) { - DEBUG_PRINT (ACPI_ERROR, ("ACPI Subsystem is already terminated\n")); + DEBUG_PRINTP (ACPI_ERROR, ("ACPI Subsystem is already terminated\n")); return_ACPI_STATUS (AE_OK); } /* Subsystem appears active, go ahead and shut it down */ AcpiGbl_Shutdown = TRUE; - DEBUG_PRINT (ACPI_INFO, ("Shutting down ACPI Subsystem...\n")); + DEBUG_PRINTP (ACPI_INFO, ("Shutting down ACPI Subsystem...\n")); /* Close the Namespace */ @@ -334,12 +334,12 @@ AcpiCmSubsystemShutdown (void) /* Close the globals */ - AcpiCmTerminate (); + AcpiUtTerminate (); /* Flush the local cache(s) */ - AcpiCmDeleteGenericStateCache (); - AcpiCmDeleteObjectCache (); + AcpiUtDeleteGenericStateCache (); + AcpiUtDeleteObjectCache (); AcpiDsDeleteWalkStateCache (); /* Close the Parser */ @@ -350,7 +350,7 @@ AcpiCmSubsystemShutdown (void) /* Debug only - display leftover memory allocation, if any */ #ifdef ENABLE_DEBUGGER - AcpiCmDumpCurrentAllocations (ACPI_UINT32_MAX, NULL); + AcpiUtDumpCurrentAllocations (ACPI_UINT32_MAX, NULL); #endif return_ACPI_STATUS (AE_OK); diff --git a/sys/contrib/dev/acpica/utmisc.c b/sys/contrib/dev/acpica/utmisc.c index 123e4e1..f5d4b42 100644 --- a/sys/contrib/dev/acpica/utmisc.c +++ b/sys/contrib/dev/acpica/utmisc.c @@ -1,7 +1,7 @@ /******************************************************************************* * - * Module Name: cmutils - common utility procedures - * $Revision: 27 $ + * Module Name: utmisc - common utility procedures + * $Revision: 42 $ * ******************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __CMUTILS_C__ +#define __UTMISC_C__ #include "acpi.h" #include "acevents.h" @@ -126,13 +126,13 @@ #include "acdebug.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmutils") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utmisc") /******************************************************************************* * - * FUNCTION: AcpiCmValidAcpiName + * FUNCTION: AcpiUtValidAcpiName * * PARAMETERS: Character - The character to be examined * @@ -146,7 +146,7 @@ ******************************************************************************/ BOOLEAN -AcpiCmValidAcpiName ( +AcpiUtValidAcpiName ( UINT32 Name) { NATIVE_CHAR *NamePtr = (NATIVE_CHAR *) &Name; @@ -170,7 +170,7 @@ AcpiCmValidAcpiName ( /******************************************************************************* * - * FUNCTION: AcpiCmValidAcpiCharacter + * FUNCTION: AcpiUtValidAcpiCharacter * * PARAMETERS: Character - The character to be examined * @@ -181,7 +181,7 @@ AcpiCmValidAcpiName ( ******************************************************************************/ BOOLEAN -AcpiCmValidAcpiCharacter ( +AcpiUtValidAcpiCharacter ( NATIVE_CHAR Character) { @@ -190,10 +190,40 @@ AcpiCmValidAcpiCharacter ( (Character >= '0' && Character <= '9'))); } +/******************************************************************************* + * + * FUNCTION: AcpiUtStrupr + * + * PARAMETERS: SrcString - The source string to convert to + * + * RETURN: SrcString + * + * DESCRIPTION: Convert string to uppercase + * + ******************************************************************************/ + +NATIVE_CHAR * +AcpiUtStrupr ( + NATIVE_CHAR *SrcString) +{ + NATIVE_CHAR *String; + + + /* Walk entire string, uppercasing the letters */ + + for (String = SrcString; *String; ) + { + *String = (char) TOUPPER (*String); + String++; + } + + + return (SrcString); +} /******************************************************************************* * - * FUNCTION: AcpiCmMutexInitialize + * FUNCTION: AcpiUtMutexInitialize * * PARAMETERS: None. * @@ -204,14 +234,14 @@ AcpiCmValidAcpiCharacter ( ******************************************************************************/ ACPI_STATUS -AcpiCmMutexInitialize ( +AcpiUtMutexInitialize ( void) { UINT32 i; ACPI_STATUS Status; - FUNCTION_TRACE ("CmMutexInitialize"); + FUNCTION_TRACE ("UtMutexInitialize"); /* @@ -219,7 +249,7 @@ AcpiCmMutexInitialize ( */ for (i = 0; i < NUM_MTX; i++) { - Status = AcpiCmCreateMutex (i); + Status = AcpiUtCreateMutex (i); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -232,7 +262,7 @@ AcpiCmMutexInitialize ( /******************************************************************************* * - * FUNCTION: AcpiCmMutexTerminate + * FUNCTION: AcpiUtMutexTerminate * * PARAMETERS: None. * @@ -243,13 +273,13 @@ AcpiCmMutexInitialize ( ******************************************************************************/ void -AcpiCmMutexTerminate ( +AcpiUtMutexTerminate ( void) { UINT32 i; - FUNCTION_TRACE ("CmMutexTerminate"); + FUNCTION_TRACE ("UtMutexTerminate"); /* @@ -257,7 +287,7 @@ AcpiCmMutexTerminate ( */ for (i = 0; i < NUM_MTX; i++) { - AcpiCmDeleteMutex (i); + AcpiUtDeleteMutex (i); } return_VOID; @@ -266,7 +296,7 @@ AcpiCmMutexTerminate ( /******************************************************************************* * - * FUNCTION: AcpiCmCreateMutex + * FUNCTION: AcpiUtCreateMutex * * PARAMETERS: MutexID - ID of the mutex to be created * @@ -277,13 +307,13 @@ AcpiCmMutexTerminate ( ******************************************************************************/ ACPI_STATUS -AcpiCmCreateMutex ( +AcpiUtCreateMutex ( ACPI_MUTEX_HANDLE MutexId) { ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_U32 ("CmCreateMutex", MutexId); + FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId); if (MutexId > MAX_MTX) @@ -295,8 +325,8 @@ AcpiCmCreateMutex ( if (!AcpiGbl_AcpiMutexInfo[MutexId].Mutex) { Status = AcpiOsCreateSemaphore (1, 1, - &AcpiGbl_AcpiMutexInfo[MutexId].Mutex); - AcpiGbl_AcpiMutexInfo[MutexId].Locked = FALSE; + &AcpiGbl_AcpiMutexInfo[MutexId].Mutex); + AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; AcpiGbl_AcpiMutexInfo[MutexId].UseCount = 0; } @@ -306,7 +336,7 @@ AcpiCmCreateMutex ( /******************************************************************************* * - * FUNCTION: AcpiCmDeleteMutex + * FUNCTION: AcpiUtDeleteMutex * * PARAMETERS: MutexID - ID of the mutex to be deleted * @@ -317,13 +347,13 @@ AcpiCmCreateMutex ( ******************************************************************************/ ACPI_STATUS -AcpiCmDeleteMutex ( +AcpiUtDeleteMutex ( ACPI_MUTEX_HANDLE MutexId) { ACPI_STATUS Status; - FUNCTION_TRACE_U32 ("CmDeleteMutex", MutexId); + FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId); if (MutexId > MAX_MTX) @@ -335,7 +365,7 @@ AcpiCmDeleteMutex ( Status = AcpiOsDeleteSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex); AcpiGbl_AcpiMutexInfo[MutexId].Mutex = NULL; - AcpiGbl_AcpiMutexInfo[MutexId].Locked = FALSE; + AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; return_ACPI_STATUS (Status); } @@ -343,7 +373,7 @@ AcpiCmDeleteMutex ( /******************************************************************************* * - * FUNCTION: AcpiCmAcquireMutex + * FUNCTION: AcpiUtAcquireMutex * * PARAMETERS: MutexID - ID of the mutex to be acquired * @@ -354,14 +384,16 @@ AcpiCmDeleteMutex ( ******************************************************************************/ ACPI_STATUS -AcpiCmAcquireMutex ( +AcpiUtAcquireMutex ( ACPI_MUTEX_HANDLE MutexId) { ACPI_STATUS Status; + UINT32 i; + UINT32 ThisThreadId; + + PROC_NAME ("UtAcquireMutex"); - DEBUG_PRINT (TRACE_MUTEX, - ("Acquiring Mutex [%s]\n", AcpiCmGetMutexName (MutexId))); if (MutexId > MAX_MTX) { @@ -369,16 +401,58 @@ AcpiCmAcquireMutex ( } + ThisThreadId = AcpiOsGetThreadId (); + + /* + * Deadlock prevention. Check if this thread owns any mutexes of value + * greater than or equal to this one. If so, the thread has violated + * the mutex ordering rule. This indicates a coding error somewhere in + * the ACPI subsystem code. + */ + for (i = MutexId; i < MAX_MTX; i++) + { + if (AcpiGbl_AcpiMutexInfo[i].OwnerId == ThisThreadId) + { + if (i == MutexId) + { + DEBUG_PRINTP (ACPI_ERROR, + ("Mutex [%s] already acquired by this thread [%X]\n", + AcpiUtGetMutexName (MutexId), ThisThreadId)); + + return (AE_ALREADY_ACQUIRED); + } + + DEBUG_PRINTP (ACPI_ERROR, + ("Invalid acquire order: Thread %X owns [%s], wants [%s]\n", + ThisThreadId, AcpiUtGetMutexName (i), + AcpiUtGetMutexName (MutexId))); + + return (AE_ACQUIRE_DEADLOCK); + } + } + + + DEBUG_PRINTP (TRACE_MUTEX, + ("Thread %X attempting to acquire Mutex [%s]\n", + ThisThreadId, AcpiUtGetMutexName (MutexId))); + Status = AcpiOsWaitSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, 1, WAIT_FOREVER); - DEBUG_PRINT (TRACE_MUTEX, ("Acquired Mutex [%s] Status %s\n", - AcpiCmGetMutexName (MutexId), AcpiCmFormatException (Status))); - if (ACPI_SUCCESS (Status)) { - AcpiGbl_AcpiMutexInfo[MutexId].Locked = TRUE; + DEBUG_PRINTP (TRACE_MUTEX, ("Thread %X acquired Mutex [%s]\n", + ThisThreadId, AcpiUtGetMutexName (MutexId))); + AcpiGbl_AcpiMutexInfo[MutexId].UseCount++; + AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ThisThreadId; + } + + else + { + DEBUG_PRINTP (ACPI_ERROR, ("Thread %X could not acquire Mutex [%s] %s\n", + ThisThreadId, AcpiUtGetMutexName (MutexId), + AcpiUtFormatException (Status))); } return (Status); @@ -387,7 +461,7 @@ AcpiCmAcquireMutex ( /******************************************************************************* * - * FUNCTION: AcpiCmReleaseMutex + * FUNCTION: AcpiUtReleaseMutex * * PARAMETERS: MutexID - ID of the mutex to be released * @@ -398,14 +472,21 @@ AcpiCmAcquireMutex ( ******************************************************************************/ ACPI_STATUS -AcpiCmReleaseMutex ( +AcpiUtReleaseMutex ( ACPI_MUTEX_HANDLE MutexId) { ACPI_STATUS Status; + UINT32 i; + UINT32 ThisThreadId; + + + PROC_NAME ("UtReleaseMutex"); - DEBUG_PRINT (TRACE_MUTEX, - ("Releasing Mutex [%s]\n", AcpiCmGetMutexName (MutexId))); + ThisThreadId = AcpiOsGetThreadId (); + DEBUG_PRINTP (TRACE_MUTEX, + ("Thread %X releasing Mutex [%s]\n", ThisThreadId, + AcpiUtGetMutexName (MutexId))); if (MutexId > MAX_MTX) { @@ -413,19 +494,59 @@ AcpiCmReleaseMutex ( } - AcpiGbl_AcpiMutexInfo[MutexId].Locked = FALSE; /* Mark before unlocking */ + /* + * Mutex must be acquired in order to release it! + */ + if (AcpiGbl_AcpiMutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED) + { + DEBUG_PRINTP (ACPI_ERROR, + ("Mutex [%s] is not acquired, cannot release\n", + AcpiUtGetMutexName (MutexId))); + + return (AE_NOT_ACQUIRED); + } + + + /* + * Deadlock prevention. Check if this thread owns any mutexes of value + * greater than this one. If so, the thread has violated the mutex + * ordering rule. This indicates a coding error somewhere in + * the ACPI subsystem code. + */ + for (i = MutexId; i < MAX_MTX; i++) + { + if (AcpiGbl_AcpiMutexInfo[i].OwnerId == ThisThreadId) + { + if (i == MutexId) + { + continue; + } + + DEBUG_PRINTP (ACPI_ERROR, + ("Invalid release order: owns [%s], releasing [%s]\n", + AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId))); + + return (AE_RELEASE_DEADLOCK); + } + } + + + /* Mark unlocked FIRST */ + + AcpiGbl_AcpiMutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED; Status = AcpiOsSignalSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, 1); if (ACPI_FAILURE (Status)) { - DEBUG_PRINT (ACPI_ERROR, ("Error Releasing Mutex [%s], %s\n", - AcpiCmGetMutexName (MutexId), AcpiCmFormatException (Status))); + DEBUG_PRINTP (ACPI_ERROR, ("Thread %X could not release Mutex [%s] %s\n", + ThisThreadId, AcpiUtGetMutexName (MutexId), + AcpiUtFormatException (Status))); } else { - DEBUG_PRINT (TRACE_MUTEX, ("Released Mutex [%s], %s\n", - AcpiCmGetMutexName (MutexId), AcpiCmFormatException (Status))); + DEBUG_PRINTP (TRACE_MUTEX, ("Thread %X released Mutex [%s]\n", + ThisThreadId, AcpiUtGetMutexName (MutexId))); } return (Status); @@ -434,7 +555,7 @@ AcpiCmReleaseMutex ( /******************************************************************************* * - * FUNCTION: AcpiCmCreateUpdateStateAndPush + * FUNCTION: AcpiUtCreateUpdateStateAndPush * * PARAMETERS: *Object - Object to be added to the new state * Action - Increment/Decrement @@ -447,7 +568,7 @@ AcpiCmReleaseMutex ( ******************************************************************************/ ACPI_STATUS -AcpiCmCreateUpdateStateAndPush ( +AcpiUtCreateUpdateStateAndPush ( ACPI_OPERAND_OBJECT *Object, UINT16 Action, ACPI_GENERIC_STATE **StateList) @@ -462,21 +583,21 @@ AcpiCmCreateUpdateStateAndPush ( return (AE_OK); } - State = AcpiCmCreateUpdateState (Object, Action); + State = AcpiUtCreateUpdateState (Object, Action); if (!State) { return (AE_NO_MEMORY); } - AcpiCmPushGenericState (StateList, State); + AcpiUtPushGenericState (StateList, State); return (AE_OK); } /******************************************************************************* * - * FUNCTION: AcpiCmCreatePkgStateAndPush + * FUNCTION: AcpiUtCreatePkgStateAndPush * * PARAMETERS: *Object - Object to be added to the new state * Action - Increment/Decrement @@ -489,7 +610,7 @@ AcpiCmCreateUpdateStateAndPush ( ******************************************************************************/ ACPI_STATUS -AcpiCmCreatePkgStateAndPush ( +AcpiUtCreatePkgStateAndPush ( void *InternalObject, void *ExternalObject, UINT16 Index, @@ -498,23 +619,21 @@ AcpiCmCreatePkgStateAndPush ( ACPI_GENERIC_STATE *State; - - State = AcpiCmCreatePkgState (InternalObject, ExternalObject, Index); + State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index); if (!State) { return (AE_NO_MEMORY); } - AcpiCmPushGenericState (StateList, State); + AcpiUtPushGenericState (StateList, State); return (AE_OK); } - /******************************************************************************* * - * FUNCTION: AcpiCmPushGenericState + * FUNCTION: AcpiUtPushGenericState * * PARAMETERS: ListHead - Head of the state stack * State - State object to push @@ -526,11 +645,11 @@ AcpiCmCreatePkgStateAndPush ( ******************************************************************************/ void -AcpiCmPushGenericState ( +AcpiUtPushGenericState ( ACPI_GENERIC_STATE **ListHead, ACPI_GENERIC_STATE *State) { - FUNCTION_TRACE ("CmPushGenericState"); + FUNCTION_TRACE ("UtPushGenericState"); /* Push the state object onto the front of the list (stack) */ @@ -543,7 +662,7 @@ AcpiCmPushGenericState ( /******************************************************************************* * - * FUNCTION: AcpiCmPopGenericState + * FUNCTION: AcpiUtPopGenericState * * PARAMETERS: ListHead - Head of the state stack * @@ -554,7 +673,7 @@ AcpiCmPushGenericState ( ******************************************************************************/ ACPI_GENERIC_STATE * -AcpiCmPopGenericState ( +AcpiUtPopGenericState ( ACPI_GENERIC_STATE **ListHead) { ACPI_GENERIC_STATE *State; @@ -579,7 +698,7 @@ AcpiCmPopGenericState ( /******************************************************************************* * - * FUNCTION: AcpiCmCreateGenericState + * FUNCTION: AcpiUtCreateGenericState * * PARAMETERS: None * @@ -591,12 +710,12 @@ AcpiCmPopGenericState ( ******************************************************************************/ ACPI_GENERIC_STATE * -AcpiCmCreateGenericState (void) +AcpiUtCreateGenericState (void) { ACPI_GENERIC_STATE *State; - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_StateCacheRequests++; @@ -613,7 +732,7 @@ AcpiCmCreateGenericState (void) AcpiGbl_StateCacheHits++; AcpiGbl_GenericStateCacheDepth--; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); DEBUG_PRINT (TRACE_EXEC, ("CreateGenState: State %p from cache\n", State)); } @@ -622,9 +741,9 @@ AcpiCmCreateGenericState (void) { /* The cache is empty, create a new object */ - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); - State = AcpiCmCallocate (sizeof (ACPI_GENERIC_STATE)); + State = AcpiUtCallocate (sizeof (ACPI_GENERIC_STATE)); } /* Initialize */ @@ -644,7 +763,7 @@ AcpiCmCreateGenericState (void) /******************************************************************************* * - * FUNCTION: AcpiCmCreateUpdateState + * FUNCTION: AcpiUtCreateUpdateState * * PARAMETERS: Object - Initial Object to be installed in the * state @@ -659,19 +778,19 @@ AcpiCmCreateGenericState (void) ******************************************************************************/ ACPI_GENERIC_STATE * -AcpiCmCreateUpdateState ( +AcpiUtCreateUpdateState ( ACPI_OPERAND_OBJECT *Object, UINT16 Action) { ACPI_GENERIC_STATE *State; - FUNCTION_TRACE_PTR ("CmCreateUpdateState", Object); + FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object); /* Create the generic state object */ - State = AcpiCmCreateGenericState (); + State = AcpiUtCreateGenericState (); if (!State) { return (NULL); @@ -688,7 +807,7 @@ AcpiCmCreateUpdateState ( /******************************************************************************* * - * FUNCTION: AcpiCmCreatePkgState + * FUNCTION: AcpiUtCreatePkgState * * PARAMETERS: Object - Initial Object to be installed in the * state @@ -703,7 +822,7 @@ AcpiCmCreateUpdateState ( ******************************************************************************/ ACPI_GENERIC_STATE * -AcpiCmCreatePkgState ( +AcpiUtCreatePkgState ( void *InternalObject, void *ExternalObject, UINT16 Index) @@ -711,12 +830,12 @@ AcpiCmCreatePkgState ( ACPI_GENERIC_STATE *State; - FUNCTION_TRACE_PTR ("CmCreatePkgState", InternalObject); + FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject); /* Create the generic state object */ - State = AcpiCmCreateGenericState (); + State = AcpiUtCreateGenericState (); if (!State) { return (NULL); @@ -727,16 +846,15 @@ AcpiCmCreatePkgState ( State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; State->Pkg.DestObject = ExternalObject; State->Pkg.Index = Index; - State->Pkg.NumPackages = 1; + State->Pkg.NumPackages = 1; return_PTR (State); } - /******************************************************************************* * - * FUNCTION: AcpiCmCreateControlState + * FUNCTION: AcpiUtCreateControlState * * PARAMETERS: None * @@ -748,17 +866,17 @@ AcpiCmCreatePkgState ( ******************************************************************************/ ACPI_GENERIC_STATE * -AcpiCmCreateControlState ( +AcpiUtCreateControlState ( void) { ACPI_GENERIC_STATE *State; - FUNCTION_TRACE ("CmCreateControlState"); + FUNCTION_TRACE ("UtCreateControlState"); /* Create the generic state object */ - State = AcpiCmCreateGenericState (); + State = AcpiUtCreateGenericState (); if (!State) { return (NULL); @@ -775,7 +893,7 @@ AcpiCmCreateControlState ( /******************************************************************************* * - * FUNCTION: AcpiCmDeleteGenericState + * FUNCTION: AcpiUtDeleteGenericState * * PARAMETERS: State - The state object to be deleted * @@ -787,24 +905,24 @@ AcpiCmCreateControlState ( ******************************************************************************/ void -AcpiCmDeleteGenericState ( +AcpiUtDeleteGenericState ( ACPI_GENERIC_STATE *State) { - FUNCTION_TRACE ("CmDeleteGenericState"); + FUNCTION_TRACE ("UtDeleteGenericState"); /* If cache is full, just free this state object */ if (AcpiGbl_GenericStateCacheDepth >= MAX_STATE_CACHE_DEPTH) { - AcpiCmFree (State); + AcpiUtFree (State); } /* Otherwise put this object back into the cache */ else { - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); /* Clear the state */ @@ -818,7 +936,7 @@ AcpiCmDeleteGenericState ( AcpiGbl_GenericStateCacheDepth++; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); } return_VOID; } @@ -826,7 +944,7 @@ AcpiCmDeleteGenericState ( /******************************************************************************* * - * FUNCTION: AcpiCmDeleteGenericStateCache + * FUNCTION: AcpiUtDeleteGenericStateCache * * PARAMETERS: None * @@ -838,13 +956,13 @@ AcpiCmDeleteGenericState ( ******************************************************************************/ void -AcpiCmDeleteGenericStateCache ( +AcpiUtDeleteGenericStateCache ( void) { ACPI_GENERIC_STATE *Next; - FUNCTION_TRACE ("CmDeleteGenericStateCache"); + FUNCTION_TRACE ("UtDeleteGenericStateCache"); /* Traverse the global cache list */ @@ -854,7 +972,7 @@ AcpiCmDeleteGenericStateCache ( /* Delete one cached state object */ Next = AcpiGbl_GenericStateCache->Common.Next; - AcpiCmFree (AcpiGbl_GenericStateCache); + AcpiUtFree (AcpiGbl_GenericStateCache); AcpiGbl_GenericStateCache = Next; AcpiGbl_GenericStateCacheDepth--; } @@ -865,7 +983,7 @@ AcpiCmDeleteGenericStateCache ( /******************************************************************************* * - * FUNCTION: AcpiCmResolvePackageReferences + * FUNCTION: AcpiUtResolvePackageReferences * * PARAMETERS: ObjDesc - The Package object on which to resolve refs * @@ -876,14 +994,14 @@ AcpiCmDeleteGenericStateCache ( ******************************************************************************/ ACPI_STATUS -AcpiCmResolvePackageReferences ( +AcpiUtResolvePackageReferences ( ACPI_OPERAND_OBJECT *ObjDesc) { UINT32 Count; ACPI_OPERAND_OBJECT *SubObject; - FUNCTION_TRACE ("AcpiCmResolvePackageReferences"); + FUNCTION_TRACE ("AcpiUtResolvePackageReferences"); if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE) @@ -903,17 +1021,19 @@ AcpiCmResolvePackageReferences ( if (SubObject->Common.Type == INTERNAL_TYPE_REFERENCE) { - if (SubObject->Reference.OpCode == AML_ZERO_OP) + if (SubObject->Reference.Opcode == AML_ZERO_OP) { SubObject->Common.Type = ACPI_TYPE_INTEGER; SubObject->Integer.Value = 0; } - else if (SubObject->Reference.OpCode == AML_ONE_OP) + + else if (SubObject->Reference.Opcode == AML_ONE_OP) { SubObject->Common.Type = ACPI_TYPE_INTEGER; SubObject->Integer.Value = 1; } - else if (SubObject->Reference.OpCode == AML_ONES_OP) + + else if (SubObject->Reference.Opcode == AML_ONES_OP) { SubObject->Common.Type = ACPI_TYPE_INTEGER; SubObject->Integer.Value = ACPI_INTEGER_MAX; @@ -926,9 +1046,9 @@ AcpiCmResolvePackageReferences ( #ifdef ACPI_DEBUG -/****************************************************************************** +/******************************************************************************* * - * FUNCTION: AcpiCmDisplayInitPathname + * FUNCTION: AcpiUtDisplayInitPathname * * PARAMETERS: ObjHandle - Handle whose pathname will be displayed * Path - Additional path string to be appended @@ -937,10 +1057,10 @@ AcpiCmResolvePackageReferences ( * * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY * - *****************************************************************************/ + ******************************************************************************/ void -AcpiCmDisplayInitPathname ( +AcpiUtDisplayInitPathname ( ACPI_HANDLE ObjHandle, char *Path) { @@ -966,7 +1086,7 @@ AcpiCmDisplayInitPathname ( /******************************************************************************* * - * FUNCTION: AcpiCmWalkPackageTree + * FUNCTION: AcpiUtWalkPackageTree * * PARAMETERS: ObjDesc - The Package object on which to resolve refs * @@ -977,7 +1097,7 @@ AcpiCmDisplayInitPathname ( ******************************************************************************/ ACPI_STATUS -AcpiCmWalkPackageTree ( +AcpiUtWalkPackageTree ( ACPI_OPERAND_OBJECT *SourceObject, void *TargetObject, ACPI_PKG_CALLBACK WalkCallback, @@ -990,10 +1110,10 @@ AcpiCmWalkPackageTree ( ACPI_OPERAND_OBJECT *ThisSourceObj; - FUNCTION_TRACE ("AcpiCmWalkPackageTree"); + FUNCTION_TRACE ("AcpiUtWalkPackageTree"); - State = AcpiCmCreatePkgState (SourceObject, TargetObject, 0); + State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0); if (!State) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -1001,16 +1121,17 @@ AcpiCmWalkPackageTree ( while (State) { - ThisIndex = State->Pkg.Index; - ThisSourceObj = (ACPI_OPERAND_OBJECT *) - State->Pkg.SourceObject->Package.Elements[ThisIndex]; + ThisIndex = State->Pkg.Index; + ThisSourceObj = (ACPI_OPERAND_OBJECT *) + State->Pkg.SourceObject->Package.Elements[ThisIndex]; /* - * Check for + * Check for * 1) An uninitialized package element. It is completely * legal to declare a package and leave it uninitialized * 2) Not an internal object - can be a namespace node instead - * 3) Any type other than a package. Packages are handled in else case below. + * 3) Any type other than a package. Packages are handled in else + * case below. */ if ((!ThisSourceObj) || (!VALID_DESCRIPTOR_TYPE ( @@ -1019,7 +1140,8 @@ AcpiCmWalkPackageTree ( ThisSourceObj, ACPI_TYPE_PACKAGE))) { - Status = WalkCallback (0, ThisSourceObj, State, Context); + Status = WalkCallback (ACPI_COPY_TYPE_SIMPLE, ThisSourceObj, + State, Context); if (ACPI_FAILURE (Status)) { /* TBD: must delete package created up to this point */ @@ -1037,9 +1159,9 @@ AcpiCmWalkPackageTree ( * * Delete this state and pop the previous state (package). */ - AcpiCmDeleteGenericState (State); - State = AcpiCmPopGenericState (&StateList); - + AcpiUtDeleteGenericState (State); + State = AcpiUtPopGenericState (&StateList); + /* Finished when there are no more states */ @@ -1065,7 +1187,8 @@ AcpiCmWalkPackageTree ( { /* This is a sub-object of type package */ - Status = WalkCallback (1, ThisSourceObj, State, Context); + Status = WalkCallback (ACPI_COPY_TYPE_PACKAGE, ThisSourceObj, + State, Context); if (ACPI_FAILURE (Status)) { /* TBD: must delete package created up to this point */ @@ -1074,15 +1197,16 @@ AcpiCmWalkPackageTree ( } - /* + /* * The callback above returned a new target package object. */ /* * Push the current state and create a new one */ - AcpiCmPushGenericState (&StateList, State); - State = AcpiCmCreatePkgState (ThisSourceObj, State->Pkg.ThisTargetObj, 0); + AcpiUtPushGenericState (&StateList, State); + State = AcpiUtCreatePkgState (ThisSourceObj, + State->Pkg.ThisTargetObj, 0); if (!State) { /* TBD: must delete package created up to this point */ @@ -1099,7 +1223,6 @@ AcpiCmWalkPackageTree ( } - /******************************************************************************* * * FUNCTION: _ReportError diff --git a/sys/contrib/dev/acpica/utobject.c b/sys/contrib/dev/acpica/utobject.c index 13869b3..98f866b 100644 --- a/sys/contrib/dev/acpica/utobject.c +++ b/sys/contrib/dev/acpica/utobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmobject - ACPI object create/delete/size/cache routines - * $Revision: 36 $ + * Module Name: utobject - ACPI object create/delete/size/cache routines + * $Revision: 46 $ * *****************************************************************************/ @@ -114,7 +114,7 @@ * *****************************************************************************/ -#define __CMOBJECT_C__ +#define __UTOBJECT_C__ #include "acpi.h" #include "acinterp.h" @@ -123,13 +123,13 @@ #include "amlcode.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmobject") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utobject") /******************************************************************************* * - * FUNCTION: _CmCreateInternalObject + * FUNCTION: _UtCreateInternalObject * * PARAMETERS: Address - Address of the memory to deallocate * Component - Component type of caller @@ -141,35 +141,35 @@ * * DESCRIPTION: Create and initialize a new internal object. * - * NOTE: We always allocate the worst-case object descriptor because - * these objects are cached, and we want them to be - * one-size-satisifies-any-request. This in itself may not be - * the most memory efficient, but the efficiency of the object + * NOTE: We always allocate the worst-case object descriptor because + * these objects are cached, and we want them to be + * one-size-satisifies-any-request. This in itself may not be + * the most memory efficient, but the efficiency of the object * cache should more than make up for this! * ******************************************************************************/ ACPI_OPERAND_OBJECT * -_CmCreateInternalObject ( +_UtCreateInternalObject ( NATIVE_CHAR *ModuleName, UINT32 LineNumber, UINT32 ComponentId, - OBJECT_TYPE_INTERNAL Type) + ACPI_OBJECT_TYPE8 Type) { ACPI_OPERAND_OBJECT *Object; - FUNCTION_TRACE_STR ("CmCreateInternalObject", AcpiCmGetTypeName (Type)); + FUNCTION_TRACE_STR ("UtCreateInternalObject", AcpiUtGetTypeName (Type)); /* Allocate the raw object descriptor */ - Object = _CmAllocateObjectDesc (ModuleName, LineNumber, ComponentId); + Object = _UtAllocateObjectDesc (ModuleName, LineNumber, ComponentId); if (!Object) { /* Allocation failure */ - return_VALUE (NULL); + return_PTR (NULL); } /* Save the object type in the object descriptor */ @@ -189,7 +189,7 @@ _CmCreateInternalObject ( /******************************************************************************* * - * FUNCTION: AcpiCmValidInternalObject + * FUNCTION: AcpiUtValidInternalObject * * PARAMETERS: Operand - Object to be validated * @@ -198,16 +198,19 @@ _CmCreateInternalObject ( ******************************************************************************/ BOOLEAN -AcpiCmValidInternalObject ( +AcpiUtValidInternalObject ( void *Object) { + PROC_NAME ("UtValidInternalObject"); + + /* Check for a null pointer */ if (!Object) { DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Null Object Ptr\n")); + ("**** Null Object Ptr\n")); return (FALSE); } @@ -215,8 +218,7 @@ AcpiCmValidInternalObject ( if (AcpiTbSystemTablePointer (Object)) { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Object %p is a Pcode Ptr\n", Object)); + DEBUG_PRINTP (ACPI_INFO, ("**** Object %p is a Pcode Ptr\n", Object)); return (FALSE); } @@ -228,23 +230,20 @@ AcpiCmValidInternalObject ( if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)) { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Obj %p is a named obj, not ACPI obj\n", - Object)); + DEBUG_PRINTP (ACPI_INFO, + ("**** Obj %p is a named obj, not ACPI obj\n", Object)); } else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_PARSER)) { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Obj %p is a parser obj, not ACPI obj\n", - Object)); + DEBUG_PRINTP (ACPI_INFO, + ("**** Obj %p is a parser obj, not ACPI obj\n", Object)); } else { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Obj %p is of unknown type\n", - Object)); + DEBUG_PRINTP (ACPI_INFO, + ("**** Obj %p is of unknown type\n", Object)); } return (FALSE); @@ -259,7 +258,7 @@ AcpiCmValidInternalObject ( /******************************************************************************* * - * FUNCTION: _CmAllocateObjectDesc + * FUNCTION: _UtAllocateObjectDesc * * PARAMETERS: ModuleName - Caller's module name (for error output) * LineNumber - Caller's line number (for error output) @@ -274,7 +273,7 @@ AcpiCmValidInternalObject ( ******************************************************************************/ void * -_CmAllocateObjectDesc ( +_UtAllocateObjectDesc ( NATIVE_CHAR *ModuleName, UINT32 LineNumber, UINT32 ComponentId) @@ -285,7 +284,7 @@ _CmAllocateObjectDesc ( FUNCTION_TRACE ("_AllocateObjectDesc"); - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); AcpiGbl_ObjectCacheRequests++; @@ -302,18 +301,18 @@ _CmAllocateObjectDesc ( AcpiGbl_ObjectCacheHits++; AcpiGbl_ObjectCacheDepth--; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); } else { /* The cache is empty, create a new object */ - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); /* Attempt to allocate new descriptor */ - Object = _CmCallocate (sizeof (ACPI_OPERAND_OBJECT), ComponentId, + Object = _UtCallocate (sizeof (ACPI_OPERAND_OBJECT), ComponentId, ModuleName, LineNumber); if (!Object) { @@ -334,8 +333,8 @@ _CmAllocateObjectDesc ( Object->Common.DataType = ACPI_DESC_TYPE_INTERNAL; - DEBUG_PRINT (TRACE_ALLOCATIONS, ("AllocateObjectDesc: %p Size %X\n", - Object, sizeof (ACPI_OPERAND_OBJECT))); + DEBUG_PRINTP (TRACE_ALLOCATIONS, ("%p Size %X\n", + Object, sizeof (ACPI_OPERAND_OBJECT))); return_PTR (Object); } @@ -343,7 +342,7 @@ _CmAllocateObjectDesc ( /******************************************************************************* * - * FUNCTION: AcpiCmDeleteObjectDesc + * FUNCTION: AcpiUtDeleteObjectDesc * * PARAMETERS: Object - Acpi internal object to be deleted * @@ -354,20 +353,19 @@ _CmAllocateObjectDesc ( ******************************************************************************/ void -AcpiCmDeleteObjectDesc ( +AcpiUtDeleteObjectDesc ( ACPI_OPERAND_OBJECT *Object) { - FUNCTION_TRACE_PTR ("AcpiCmDeleteObjectDesc", Object); + FUNCTION_TRACE_PTR ("AcpiUtDeleteObjectDesc", Object); /* Make sure that the object isn't already in the cache */ if (Object->Common.DataType == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) { - DEBUG_PRINT (ACPI_ERROR, - ("CmDeleteObjectDesc: Obj %p is already in the object cache\n", - Object)); + DEBUG_PRINTP (ACPI_ERROR, + ("Obj %p is already in the object cache\n", Object)); return_VOID; } @@ -375,8 +373,8 @@ AcpiCmDeleteObjectDesc ( if (Object->Common.DataType != ACPI_DESC_TYPE_INTERNAL) { - DEBUG_PRINT (ACPI_ERROR, - ("CmDeleteObjectDesc: Obj %p is not an ACPI object\n", Object)); + DEBUG_PRINTP (ACPI_ERROR, + ("Obj %p is not an ACPI object\n", Object)); return_VOID; } @@ -391,11 +389,11 @@ AcpiCmDeleteObjectDesc ( */ DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - AcpiCmFree (Object); + AcpiUtFree (Object); return_VOID; } - AcpiCmAcquireMutex (ACPI_MTX_CACHES); + AcpiUtAcquireMutex (ACPI_MTX_CACHES); /* Clear the entire object. This is important! */ @@ -409,14 +407,14 @@ AcpiCmDeleteObjectDesc ( AcpiGbl_ObjectCacheDepth++; - AcpiCmReleaseMutex (ACPI_MTX_CACHES); + AcpiUtReleaseMutex (ACPI_MTX_CACHES); return_VOID; } /******************************************************************************* * - * FUNCTION: AcpiCmDeleteObjectCache + * FUNCTION: AcpiUtDeleteObjectCache * * PARAMETERS: None * @@ -428,13 +426,13 @@ AcpiCmDeleteObjectDesc ( ******************************************************************************/ void -AcpiCmDeleteObjectCache ( +AcpiUtDeleteObjectCache ( void) { ACPI_OPERAND_OBJECT *Next; - FUNCTION_TRACE ("CmDeleteObjectCache"); + FUNCTION_TRACE ("UtDeleteObjectCache"); /* Traverse the global cache list */ @@ -452,7 +450,7 @@ AcpiCmDeleteObjectCache ( */ DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - AcpiCmFree (AcpiGbl_ObjectCache); + AcpiUtFree (AcpiGbl_ObjectCache); AcpiGbl_ObjectCache = Next; AcpiGbl_ObjectCacheDepth--; } @@ -463,7 +461,7 @@ AcpiCmDeleteObjectCache ( /******************************************************************************* * - * FUNCTION: AcpiCmInitStaticObject + * FUNCTION: AcpiUtInitStaticObject * * PARAMETERS: ObjDesc - Pointer to a "static" object - on stack * or in the data segment. @@ -476,11 +474,11 @@ AcpiCmDeleteObjectCache ( ******************************************************************************/ void -AcpiCmInitStaticObject ( +AcpiUtInitStaticObject ( ACPI_OPERAND_OBJECT *ObjDesc) { - FUNCTION_TRACE_PTR ("CmInitStaticObject", ObjDesc); + FUNCTION_TRACE_PTR ("UtInitStaticObject", ObjDesc); if (!ObjDesc) @@ -514,7 +512,7 @@ AcpiCmInitStaticObject ( /******************************************************************************* * - * FUNCTION: AcpiCmGetSimpleObjectSize + * FUNCTION: AcpiUtGetSimpleObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining * *RetLength - Where the length is returned @@ -530,7 +528,7 @@ AcpiCmInitStaticObject ( ******************************************************************************/ ACPI_STATUS -AcpiCmGetSimpleObjectSize ( +AcpiUtGetSimpleObjectSize ( ACPI_OPERAND_OBJECT *InternalObject, UINT32 *ObjLength) { @@ -538,7 +536,7 @@ AcpiCmGetSimpleObjectSize ( ACPI_STATUS Status = AE_OK; - FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObject); + FUNCTION_TRACE_PTR ("UtGetSimpleObjectSize", InternalObject); /* Handle a null object (Could be a uninitialized package element -- which is legal) */ @@ -566,9 +564,8 @@ AcpiCmGetSimpleObjectSize ( /* * 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. - * - * TBD:[Investigate] do strings and buffers require alignment also? + * must be accessed bytewise or there may be alignment problems on + * certain processors */ switch (InternalObject->Common.Type) @@ -599,23 +596,31 @@ AcpiCmGetSimpleObjectSize ( case INTERNAL_TYPE_REFERENCE: /* - * The only type that should be here is opcode AML_NAMEPATH_OP -- since + * The only type that should be here is internal opcode NAMEPATH_OP -- since * this means an object reference */ - if (InternalObject->Reference.OpCode != AML_NAMEPATH_OP) + if (InternalObject->Reference.Opcode != AML_INT_NAMEPATH_OP) { - DEBUG_PRINT (ACPI_ERROR, - ("CmGetSimpleObjectSize: Unsupported Reference opcode=%X in object %p\n", - InternalObject->Reference.OpCode, InternalObject)); + DEBUG_PRINTP (ACPI_ERROR, + ("Unsupported Reference opcode=%X in object %p\n", + InternalObject->Reference.Opcode, InternalObject)); Status = AE_TYPE; } + + else + { + /* + * Get the actual length of the full pathname to this object. + * The reference will be converted to the pathname to the object + */ + Length += ROUND_UP_TO_NATIVE_WORD (AcpiNsGetPathnameLength (InternalObject->Reference.Node)); + } break; default: - DEBUG_PRINT (ACPI_ERROR, - ("CmGetSimpleObjectSize: Unsupported type=%X in object %p\n", + DEBUG_PRINTP (ACPI_ERROR, ("Unsupported type=%X in object %p\n", InternalObject->Common.Type, InternalObject)); Status = AE_TYPE; break; @@ -636,18 +641,18 @@ AcpiCmGetSimpleObjectSize ( /******************************************************************************* * - * FUNCTION: AcpiCmCopyPackageToInternal + * FUNCTION: AcpiUtGetElementLength * * PARAMETERS: ACPI_PKG_CALLBACK * * RETURN: Status - the status of the call * - * DESCRIPTION: + * DESCRIPTION: Get the length of one package element. * ******************************************************************************/ ACPI_STATUS -AcpiCmGetElementLength ( +AcpiUtGetElementLength ( UINT8 ObjectType, ACPI_OPERAND_OBJECT *SourceObject, ACPI_GENERIC_STATE *State, @@ -666,7 +671,7 @@ AcpiCmGetElementLength ( * Simple object - just get the size (Null object/entry is handled * here also) and sum it into the running package length */ - Status = AcpiCmGetSimpleObjectSize (SourceObject, &ObjectSpace); + Status = AcpiUtGetSimpleObjectSize (SourceObject, &ObjectSpace); if (ACPI_FAILURE (Status)) { return (Status); @@ -694,23 +699,23 @@ AcpiCmGetElementLength ( /******************************************************************************* * - * FUNCTION: AcpiCmGetPackageObjectSize + * FUNCTION: AcpiUtGetPackageObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining * *RetLength - Where the length is returned * * RETURN: Status * - * DESCRIPTION: This function is called to determine the space required to + * DESCRIPTION: This function is called to determine the space required to * contain a package object for return to an API user. * - * This is moderately complex since a package contains other + * This is moderately complex since a package contains other * objects including packages. * ******************************************************************************/ ACPI_STATUS -AcpiCmGetPackageObjectSize ( +AcpiUtGetPackageObjectSize ( ACPI_OPERAND_OBJECT *InternalObject, UINT32 *ObjLength) { @@ -718,15 +723,15 @@ AcpiCmGetPackageObjectSize ( ACPI_PKG_INFO Info; - FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObject); + FUNCTION_TRACE_PTR ("UtGetPackageObjectSize", InternalObject); Info.Length = 0; Info.ObjectSpace = 0; Info.NumPackages = 1; - Status = AcpiCmWalkPackageTree (InternalObject, NULL, - AcpiCmGetElementLength, &Info); + Status = AcpiUtWalkPackageTree (InternalObject, NULL, + AcpiUtGetElementLength, &Info); /* * We have handled all of the objects in all levels of the package. @@ -743,15 +748,14 @@ AcpiCmGetPackageObjectSize ( } - /******************************************************************************* * - * FUNCTION: AcpiCmGetObjectSize + * FUNCTION: AcpiUtGetObjectSize * * PARAMETERS: *InternalObject - Pointer to the object we are examining * *RetLength - Where the length will be returned * - * RETURN: Status + * RETURN: Status * * DESCRIPTION: This function is called to determine the space required to * contain an object for return to an API user. @@ -759,7 +763,7 @@ AcpiCmGetPackageObjectSize ( ******************************************************************************/ ACPI_STATUS -AcpiCmGetObjectSize( +AcpiUtGetObjectSize( ACPI_OPERAND_OBJECT *InternalObject, UINT32 *ObjLength) { @@ -769,12 +773,12 @@ AcpiCmGetObjectSize( if ((VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_INTERNAL)) && (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE))) { - Status = AcpiCmGetPackageObjectSize (InternalObject, ObjLength); + Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength); } else { - Status = AcpiCmGetSimpleObjectSize (InternalObject, ObjLength); + Status = AcpiUtGetSimpleObjectSize (InternalObject, ObjLength); } return (Status); diff --git a/sys/contrib/dev/acpica/utxface.c b/sys/contrib/dev/acpica/utxface.c index 92312b9..1e74682 100644 --- a/sys/contrib/dev/acpica/utxface.c +++ b/sys/contrib/dev/acpica/utxface.c @@ -1,7 +1,7 @@ /****************************************************************************** * - * Module Name: cmxface - External interfaces for "global" ACPI functions - * $Revision: 64 $ + * Module Name: utxface - External interfaces for "global" ACPI functions + * $Revision: 72 $ * *****************************************************************************/ @@ -115,7 +115,7 @@ *****************************************************************************/ -#define __CMXFACE_C__ +#define __UTXFACE_C__ #include "acpi.h" #include "acevents.h" @@ -126,8 +126,8 @@ #include "acdebug.h" -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmxface") +#define _COMPONENT ACPI_UTILITIES + MODULE_NAME ("utxface") /******************************************************************************* @@ -154,7 +154,7 @@ AcpiInitializeSubsystem ( /* Initialize all globals used by the subsystem */ - AcpiCmInitGlobals (); + AcpiUtInitGlobals (); /* Initialize the OS-Dependent layer */ @@ -162,17 +162,17 @@ AcpiInitializeSubsystem ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("OSD failed to initialize, %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } /* Create the default mutex objects */ - Status = AcpiCmMutexInitialize (); + Status = AcpiUtMutexInitialize (); if (ACPI_FAILURE (Status)) { REPORT_ERROR (("Global mutex creation failure, %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -185,7 +185,7 @@ AcpiInitializeSubsystem ( if (ACPI_FAILURE (Status)) { REPORT_ERROR (("Namespace initialization failure, %s\n", - AcpiCmFormatException (Status))); + AcpiUtFormatException (Status))); return_ACPI_STATUS (Status); } @@ -223,7 +223,7 @@ AcpiEnableSubsystem ( /* Sanity check the FADT for valid values */ - Status = AcpiCmValidateFadt (); + Status = AcpiUtValidateFadt (); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -350,25 +350,36 @@ AcpiEnableSubsystem ( ACPI_STATUS AcpiTerminate (void) { + ACPI_STATUS Status; + FUNCTION_TRACE ("AcpiTerminate"); - /* Terminate the AML Debuger if present */ + + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Terminate the AML Debugger if present */ DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); /* TBD: [Investigate] This is no longer needed?*/ -/* AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); */ +/* AcpiUtReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); */ /* Shutdown and free all resources */ - AcpiCmSubsystemShutdown (); + AcpiUtSubsystemShutdown (); /* Free the mutex objects */ - AcpiCmMutexTerminate (); + AcpiUtMutexTerminate (); /* Now we can shutdown the OS-dependent layer */ @@ -404,11 +415,20 @@ AcpiGetSystemInfo ( { ACPI_SYSTEM_INFO *InfoPtr; UINT32 i; + ACPI_STATUS Status; FUNCTION_TRACE ("AcpiGetSystemInfo"); + /* Ensure that ACPI has been initialized */ + + ACPI_IS_INITIALIZATION_COMPLETE (Status); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + /* * Must have a valid buffer */ @@ -514,7 +534,7 @@ AcpiFormatException ( /* Convert the exception code (Handles bad exception codes) */ - FormattedException = AcpiCmFormatException (Exception); + FormattedException = AcpiUtFormatException (Exception); /* * Get length of string and check if it will fit in caller's buffer @@ -535,3 +555,68 @@ AcpiFormatException ( return_ACPI_STATUS (AE_OK); } + +/***************************************************************************** + * + * FUNCTION: AcpiAllocate + * + * PARAMETERS: Size - Size of the allocation + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: The subsystem's equivalent of malloc. + * External front-end to the Ut* memory manager + * + ****************************************************************************/ + +void * +AcpiAllocate ( + UINT32 Size) +{ + + return (AcpiUtAllocate (Size)); +} + + +/***************************************************************************** + * + * FUNCTION: AcpiCallocate + * + * PARAMETERS: Size - Size of the allocation + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: The subsystem's equivalent of calloc. + * External front-end to the Ut* memory manager + * + ****************************************************************************/ + +void * +AcpiCallocate ( + UINT32 Size) +{ + + return (AcpiUtCallocate (Size)); +} + + +/***************************************************************************** + * + * FUNCTION: AcpiFree + * + * PARAMETERS: Address - Address of the memory to deallocate + * + * RETURN: None + * + * DESCRIPTION: Frees the memory at Address + * External front-end to the Ut* memory manager + * + ****************************************************************************/ + +void +AcpiFree ( + void *Address) +{ + + AcpiUtFree (Address); +} |