diff options
author | jkim <jkim@FreeBSD.org> | 2005-11-01 22:23:25 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2005-11-01 22:23:25 +0000 |
commit | dd36e4d5eb10993dd99534fbeadf6c9c7cccb9ba (patch) | |
tree | 9d89d8097942c067213936887b4b525b4b2832f9 /sys | |
parent | 275739933be2e0a9ad83b1d753c607d172b7d201 (diff) | |
download | FreeBSD-src-dd36e4d5eb10993dd99534fbeadf6c9c7cccb9ba.zip FreeBSD-src-dd36e4d5eb10993dd99534fbeadf6c9c7cccb9ba.tar.gz |
Unchanged files that are off the vendor branch
Diffstat (limited to 'sys')
-rw-r--r-- | sys/contrib/dev/acpica/acconfig.h | 22 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acenv.h | 70 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acfreebsd.h | 14 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acgcc.h | 10 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acpi.h | 3 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acpiosxf.h | 53 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acpixf.h | 24 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acutils.h | 358 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exfldio.c | 690 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exsystem.c | 50 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/psparse.c | 866 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/rscreate.c | 93 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/tbget.c | 65 |
13 files changed, 639 insertions, 1679 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index f5b994a..b35d1d4 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -135,9 +135,9 @@ * */ -/* Version string */ +/* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20041119 +#define ACPI_CA_VERSION 0x20051021 /* * OS name, used for the _OS object. The _OS object is essentially obsolete, @@ -151,11 +151,10 @@ /* Maximum objects in the various object caches */ -#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */ +#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */ #define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */ -#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */ -#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */ -#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */ +#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */ +#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */ /* * Should the subystem abort the loading of an ACPI table if the @@ -172,7 +171,7 @@ /* Version of ACPI supported */ -#define ACPI_CA_SUPPORT_LEVEL 2 +#define ACPI_CA_SUPPORT_LEVEL 3 /* String size constants */ @@ -203,9 +202,8 @@ #define ACPI_MAX_GPE_BLOCKS 2 #define ACPI_GPE_REGISTER_WIDTH 8 -/* - * Method info (in WALK_STATE), containing local variables and argumetns - */ +/* Method info (in WALK_STATE), containing local variables and argumetns */ + #define ACPI_METHOD_NUM_LOCALS 8 #define ACPI_METHOD_MAX_LOCAL 7 @@ -271,7 +269,7 @@ /* Number of strings associated with the _OSI reserved method */ -#define ACPI_NUM_OSI_STRINGS 9 +#define ACPI_NUM_OSI_STRINGS 10 /****************************************************************************** diff --git a/sys/contrib/dev/acpica/acenv.h b/sys/contrib/dev/acpica/acenv.h index 09dc5bc..b0438f1 100644 --- a/sys/contrib/dev/acpica/acenv.h +++ b/sys/contrib/dev/acpica/acenv.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -122,32 +122,39 @@ * Configuration for ACPI tools and utilities */ -#ifdef _ACPI_DUMP_APP +#ifdef ACPI_LIBRARY +#define ACPI_USE_LOCAL_CACHE +#endif + +#ifdef ACPI_DUMP_APP #ifndef MSDOS #define ACPI_DEBUG_OUTPUT #endif #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_NO_METHOD_EXECUTION -#define ACPI_USE_SYSTEM_CLIBRARY #endif -#ifdef _ACPI_EXEC_APP +#ifdef ACPI_EXEC_APP #undef DEBUGGER_THREADING #define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DEBUGGER #define ACPI_DISASSEMBLER -#define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_MUTEX_DEBUG #endif -#ifdef _ACPI_ASL_COMPILER +#ifdef ACPI_ASL_COMPILER #define ACPI_DEBUG_OUTPUT #define ACPI_APPLICATION #define ACPI_DISASSEMBLER #define ACPI_CONSTANT_EVAL_ONLY +#endif + +#ifdef ACPI_APPLICATION #define ACPI_USE_SYSTEM_CLIBRARY +#define ACPI_USE_LOCAL_CACHE #endif /* @@ -268,18 +275,20 @@ #endif #endif /* !DEBUGGER_THREADING */ + /****************************************************************************** * * C library configuration * *****************************************************************************/ +#define ACPI_IS_ASCII(c) ((c) < 0x80) + #ifdef ACPI_USE_SYSTEM_CLIBRARY /* * Use the standard C library headers. * We want to keep these to a minimum. */ - #ifdef ACPI_USE_STANDARD_HEADERS /* * Use the standard headers from the standard locations @@ -294,9 +303,8 @@ /* * We will be linking to the standard Clib functions */ - #define ACPI_STRSTR(s1,s2) strstr((s1), (s2)) -#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) +#define ACPI_STRCHR(s1,c) strchr((s1), (c)) #define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s)) #define ACPI_STRCPY(d,s) (void) strcpy((d), (s)) #define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n)) @@ -305,28 +313,28 @@ #define ACPI_STRCAT(d,s) (void) strcat((d), (s)) #define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n)) #define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (ACPI_SIZE)(n)) +#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) #define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n)) #define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n)) -#define ACPI_TOUPPER toupper -#define ACPI_TOLOWER tolower -#define ACPI_IS_XDIGIT isxdigit -#define ACPI_IS_DIGIT isdigit -#define ACPI_IS_SPACE isspace -#define ACPI_IS_UPPER isupper -#define ACPI_IS_PRINT isprint -#define ACPI_IS_ALPHA isalpha -#define ACPI_IS_ASCII isascii +#define ACPI_TOUPPER(i) toupper((int) (i)) +#define ACPI_TOLOWER(i) tolower((int) (i)) +#define ACPI_IS_XDIGIT(i) isxdigit((int) (i)) +#define ACPI_IS_DIGIT(i) isdigit((int) (i)) +#define ACPI_IS_SPACE(i) isspace((int) (i)) +#define ACPI_IS_UPPER(i) isupper((int) (i)) +#define ACPI_IS_PRINT(i) isprint((int) (i)) +#define ACPI_IS_ALPHA(i) isalpha((int) (i)) + +#else /****************************************************************************** * * Not using native C library, use local implementations * *****************************************************************************/ -#else -/* + /* * Use local definitions of C library macros and functions * NOTE: The function implementations may not be as efficient * as an inline or assembly code implementation provided by a @@ -343,14 +351,12 @@ typedef char *va_list; /* * Storage alignment properties */ - #define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1) #define _ADNBND (sizeof (ACPI_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 @@ -359,19 +365,19 @@ typedef char *va_list; #endif /* va_arg */ -#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) -#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s)) -#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) -#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) +#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2)) +#define ACPI_STRCHR(s1,c) AcpiUtStrchr ((s1), (c)) +#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s)) +#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s)) #define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n)) #define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) -#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) +#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s)) +#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s)) #define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n)) #define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((s1), (s2), (ACPI_SIZE)(n)) -#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) -#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) +#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n)) +#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n)) +#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n)) #define ACPI_TOUPPER AcpiUtToUpper #define ACPI_TOLOWER AcpiUtToLower diff --git a/sys/contrib/dev/acpica/acfreebsd.h b/sys/contrib/dev/acpica/acfreebsd.h index 5b5cd17..141cd58 100644 --- a/sys/contrib/dev/acpica/acfreebsd.h +++ b/sys/contrib/dev/acpica/acfreebsd.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -169,18 +169,6 @@ /* 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 * diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h index 35bb951..2f45863 100644 --- a/sys/contrib/dev/acpica/acgcc.h +++ b/sys/contrib/dev/acpica/acgcc.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -117,13 +117,17 @@ #ifndef __ACGCC_H__ #define __ACGCC_H__ +/* Function name is used for debug output. Non-ANSI, compiler-dependent */ + +#define ACPI_GET_FUNCTION_NAME __FUNCTION__ + /* This macro is used to tag functions as "printf-like" because * some compilers (like GCC) can catch printf format string problems. */ -#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5))) +#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 6, 7))) /* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us + * use all the variables (for example, _AcpiModuleName). This allows us * to to tell the compiler warning in a per-variable manner that a variable * is unused. */ diff --git a/sys/contrib/dev/acpica/acpi.h b/sys/contrib/dev/acpica/acpi.h index c3477e1..7f3ebda 100644 --- a/sys/contrib/dev/acpica/acpi.h +++ b/sys/contrib/dev/acpica/acpi.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -122,6 +122,7 @@ * We put them here because we don't want to duplicate them * in the rest of the source code again and again. */ +#include <contrib/dev/acpica/acnames.h> /* Global ACPI names and strings */ #include <contrib/dev/acpica/acconfig.h> /* Configuration constants */ #include <contrib/dev/acpica/acenv.h> /* Target environment specific items */ #include <contrib/dev/acpica/actypes.h> /* Fundamental common data types */ diff --git a/sys/contrib/dev/acpica/acpiosxf.h b/sys/contrib/dev/acpica/acpiosxf.h index f12db21..7f219ef 100644 --- a/sys/contrib/dev/acpica/acpiosxf.h +++ b/sys/contrib/dev/acpica/acpiosxf.h @@ -12,7 +12,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -153,7 +153,6 @@ typedef struct acpi_signal_fatal_info /* * OSL Initialization and shutdown primitives */ - ACPI_STATUS AcpiOsInitialize ( void); @@ -166,7 +165,6 @@ AcpiOsTerminate ( /* * ACPI Table interfaces */ - ACPI_STATUS AcpiOsGetRootPointer ( UINT32 Flags, @@ -186,7 +184,6 @@ AcpiOsTableOverride ( /* * Synchronization primitives */ - ACPI_STATUS AcpiOsCreateSemaphore ( UINT32 MaxUnits, @@ -216,21 +213,19 @@ void AcpiOsDeleteLock ( ACPI_HANDLE Handle); -void +ACPI_NATIVE_UINT AcpiOsAcquireLock ( - ACPI_HANDLE Handle, - UINT32 Flags); + ACPI_HANDLE Handle); void AcpiOsReleaseLock ( ACPI_HANDLE Handle, - UINT32 Flags); + ACPI_NATIVE_UINT Flags); /* * Memory allocation and mapping */ - void * AcpiOsAllocate ( ACPI_SIZE Size); @@ -257,9 +252,36 @@ AcpiOsGetPhysicalAddress ( /* - * Interrupt handlers + * Memory/Object Cache */ +ACPI_STATUS +AcpiOsCreateCache ( + char *CacheName, + UINT16 ObjectSize, + UINT16 MaxDepth, + ACPI_CACHE_T **ReturnCache); + +ACPI_STATUS +AcpiOsDeleteCache ( + ACPI_CACHE_T *Cache); + +ACPI_STATUS +AcpiOsPurgeCache ( + ACPI_CACHE_T *Cache); + +void * +AcpiOsAcquireObject ( + ACPI_CACHE_T *Cache); + +ACPI_STATUS +AcpiOsReleaseObject ( + ACPI_CACHE_T *Cache, + void *Object); + +/* + * Interrupt handlers + */ ACPI_STATUS AcpiOsInstallInterruptHandler ( UINT32 InterruptNumber, @@ -275,7 +297,6 @@ AcpiOsRemoveInterruptHandler ( /* * Threads and Scheduling */ - UINT32 AcpiOsGetThreadId ( void); @@ -302,7 +323,6 @@ AcpiOsStall ( /* * Platform and hardware-independent I/O interfaces */ - ACPI_STATUS AcpiOsReadPort ( ACPI_IO_ADDRESS Address, @@ -319,7 +339,6 @@ AcpiOsWritePort ( /* * Platform and hardware-independent physical memory interfaces */ - ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, @@ -338,7 +357,6 @@ AcpiOsWriteMemory ( * Note: Can't use "Register" as a parameter, changed to "Reg" -- * certain compilers complain. */ - ACPI_STATUS AcpiOsReadPciConfiguration ( ACPI_PCI_ID *PciId, @@ -356,7 +374,6 @@ AcpiOsWritePciConfiguration ( /* * Interim function needed for PCI IRQ routing */ - void AcpiOsDerivePciId( ACPI_HANDLE Rhandle, @@ -366,7 +383,6 @@ AcpiOsDerivePciId( /* * Miscellaneous */ - BOOLEAN AcpiOsReadable ( void *Pointer, @@ -389,7 +405,6 @@ AcpiOsSignal ( /* * Debug print routines */ - void ACPI_INTERNAL_VAR_XFACE AcpiOsPrintf ( const char *Format, @@ -408,7 +423,6 @@ AcpiOsRedirectOutput ( /* * Debug input */ - UINT32 AcpiOsGetLine ( char *Buffer); @@ -417,7 +431,6 @@ AcpiOsGetLine ( /* * Directory manipulation */ - void * AcpiOsOpenDirectory ( char *Pathname, @@ -441,7 +454,6 @@ AcpiOsCloseDirectory ( /* * Debug */ - void AcpiOsDbgAssert( void *FailedAssertion, @@ -449,5 +461,4 @@ AcpiOsDbgAssert( UINT32 LineNumber, char *Message); - #endif /* __ACPIOSXF_H__ */ diff --git a/sys/contrib/dev/acpica/acpixf.h b/sys/contrib/dev/acpica/acpixf.h index a5cf76c..f895cc2 100644 --- a/sys/contrib/dev/acpica/acpixf.h +++ b/sys/contrib/dev/acpica/acpixf.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -122,10 +122,9 @@ #include <contrib/dev/acpica/actbl.h> - /* +/* * Global interfaces */ - ACPI_STATUS AcpiInitializeSubsystem ( void); @@ -172,9 +171,8 @@ AcpiInstallInitializationHandler ( UINT32 Function); /* - * ACPI Memory manager + * ACPI Memory managment */ - void * AcpiAllocate ( UINT32 Size); @@ -191,7 +189,6 @@ AcpiFree ( /* * ACPI table manipulation interfaces */ - ACPI_STATUS AcpiFindRootPointer ( UINT32 Flags, @@ -232,7 +229,6 @@ AcpiGetFirmwareTable ( /* * Namespace and name interfaces */ - ACPI_STATUS AcpiWalkNamespace ( ACPI_OBJECT_TYPE Type, @@ -278,11 +274,17 @@ AcpiGetData ( ACPI_OBJECT_HANDLER Handler, void **Data); +ACPI_STATUS +AcpiDebugTrace ( + char *Name, + UINT32 DebugLevel, + UINT32 DebugLayer, + UINT32 Flags); + /* * Object manipulation and enumeration */ - ACPI_STATUS AcpiEvaluateObject ( ACPI_HANDLE Object, @@ -324,7 +326,6 @@ AcpiGetParent ( /* * Event handler interfaces */ - ACPI_STATUS AcpiInstallFixedEventHandler ( UINT32 AcpiEvent, @@ -379,7 +380,6 @@ AcpiInstallExceptionHandler ( /* * Event interfaces */ - ACPI_STATUS AcpiAcquireGlobalLock ( UINT16 Timeout, @@ -450,7 +450,7 @@ AcpiInstallGpeBlock ( ACPI_HANDLE GpeDevice, ACPI_GENERIC_ADDRESS *GpeBlockAddress, UINT32 RegisterCount, - UINT32 InterruptLevel); + UINT32 InterruptNumber); ACPI_STATUS AcpiRemoveGpeBlock ( @@ -460,7 +460,6 @@ AcpiRemoveGpeBlock ( /* * Resource interfaces */ - typedef ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) ( ACPI_RESOURCE *Resource, @@ -502,7 +501,6 @@ AcpiResourceToAddress64 ( /* * Hardware (ACPI device) interfaces */ - ACPI_STATUS AcpiGetRegister ( UINT32 RegisterId, diff --git a/sys/contrib/dev/acpica/acutils.h b/sys/contrib/dev/acpica/acutils.h index 749e015..71de0b0 100644 --- a/sys/contrib/dev/acpica/acutils.h +++ b/sys/contrib/dev/acpica/acutils.h @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -125,13 +125,6 @@ ACPI_STATUS (*ACPI_PKG_CALLBACK) ( ACPI_GENERIC_STATE *State, void *Context); -ACPI_STATUS -AcpiUtWalkPackageTree ( - ACPI_OPERAND_OBJECT *SourceObject, - void *TargetObject, - ACPI_PKG_CALLBACK WalkCallback, - void *Context); - typedef struct acpi_pkg_info { UINT8 *FreeSpace; @@ -153,37 +146,13 @@ typedef struct acpi_pkg_info #define DB_QWORD_DISPLAY 8 -/* Global initialization interfaces */ - -void -AcpiUtInitGlobals ( - void); - -void -AcpiUtTerminate ( - void); - - /* - * UtInit - miscellaneous initialization and shutdown + * utglobal - Global data structures and procedures */ - -ACPI_STATUS -AcpiUtHardwareInitialize ( - void); - void -AcpiUtSubsystemShutdown ( - void); - -ACPI_STATUS -AcpiUtValidateFadt ( +AcpiUtInitGlobals ( void); -/* - * UtGlobal - Global data structures and procedures - */ - #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) char * @@ -225,15 +194,26 @@ BOOLEAN AcpiUtValidObjectType ( ACPI_OBJECT_TYPE Type); -ACPI_OWNER_ID -AcpiUtAllocateOwnerId ( - UINT32 IdType); - /* - * UtClib - Local implementations of C library functions + * utinit - miscellaneous initialization and shutdown */ +ACPI_STATUS +AcpiUtHardwareInitialize ( + void); + +void +AcpiUtSubsystemShutdown ( + void); +ACPI_STATUS +AcpiUtValidateFadt ( + void); + + +/* + * utclib - Local implementations of C library functions + */ #ifndef ACPI_USE_SYSTEM_CLIBRARY ACPI_SIZE @@ -330,14 +310,13 @@ extern const UINT8 _acpi_ctype[]; #define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) #define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU)) #define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP)) -#define ACPI_IS_ASCII(c) ((c) < 0x80) #endif /* ACPI_USE_SYSTEM_CLIBRARY */ + /* - * UtCopy - Object construction and conversion interfaces + * utcopy - Object construction and conversion interfaces */ - ACPI_STATUS AcpiUtBuildSimpleObject( ACPI_OPERAND_OBJECT *Obj, @@ -352,30 +331,11 @@ AcpiUtBuildPackageObject ( UINT32 *SpaceUsed); ACPI_STATUS -AcpiUtCopyIelementToEelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - -ACPI_STATUS -AcpiUtCopyIelementToIelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - -ACPI_STATUS AcpiUtCopyIobjectToEobject ( ACPI_OPERAND_OBJECT *Obj, ACPI_BUFFER *RetBuffer); ACPI_STATUS -AcpiUtCopyEsimpleToIsimple( - ACPI_OBJECT *UserObj, - ACPI_OPERAND_OBJECT **ReturnObj); - -ACPI_STATUS AcpiUtCopyEobjectToIobject ( ACPI_OBJECT *Obj, ACPI_OPERAND_OBJECT **InternalObj); @@ -386,17 +346,6 @@ AcpiUtCopyISimpleToIsimple ( ACPI_OPERAND_OBJECT *DestObj); ACPI_STATUS -AcpiUtCopyIpackageToIpackage ( - ACPI_OPERAND_OBJECT *SourceObj, - ACPI_OPERAND_OBJECT *DestObj, - ACPI_WALK_STATE *WalkState); - -ACPI_STATUS -AcpiUtCopySimpleObject ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *DestDesc); - -ACPI_STATUS AcpiUtCopyIobjectToIobject ( ACPI_OPERAND_OBJECT *SourceDesc, ACPI_OPERAND_OBJECT **DestDesc, @@ -404,9 +353,8 @@ AcpiUtCopyIobjectToIobject ( /* - * UtCreate - Object creation + * utcreate - Object creation */ - ACPI_STATUS AcpiUtUpdateObjectReference ( ACPI_OPERAND_OBJECT *Object, @@ -414,9 +362,8 @@ AcpiUtUpdateObjectReference ( /* - * UtDebug - Debug interfaces + * utdebug - Debug interfaces */ - void AcpiUtInitStackPtrTrace ( void); @@ -428,47 +375,63 @@ AcpiUtTrackStackPtr ( void AcpiUtTrace ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo); + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId); void AcpiUtTracePtr ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, void *Pointer); void AcpiUtTraceU32 ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, UINT32 Integer); void AcpiUtTraceStr ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, char *String); void AcpiUtExit ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo); + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId); void AcpiUtStatusExit ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, ACPI_STATUS Status); void AcpiUtValueExit ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, ACPI_INTEGER Value); void AcpiUtPtrExit ( UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, UINT8 *Ptr); void @@ -500,7 +463,9 @@ void ACPI_INTERNAL_VAR_XFACE AcpiUtDebugPrint ( UINT32 RequestedDebugLevel, UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, char *Format, ...) ACPI_PRINTF_LIKE_FUNC; @@ -508,17 +473,22 @@ void ACPI_INTERNAL_VAR_XFACE AcpiUtDebugPrintRaw ( UINT32 RequestedDebugLevel, UINT32 LineNumber, - ACPI_DEBUG_PRINT_INFO *DbgInfo, + const char *FunctionName, + char *ModuleName, + UINT32 ComponentId, char *Format, ...) ACPI_PRINTF_LIKE_FUNC; /* - * UtDelete - Object deletion + * utdelete - Object deletion and reference counts */ +void +AcpiUtAddReference ( + ACPI_OPERAND_OBJECT *Object); void -AcpiUtDeleteInternalObj ( +AcpiUtRemoveReference ( ACPI_OPERAND_OBJECT *Object); void @@ -535,25 +505,8 @@ AcpiUtDeleteInternalObjectList ( /* - * UtEval - object evaluation + * uteval - object evaluation */ - -/* Method name strings */ - -#define METHOD_NAME__HID "_HID" -#define METHOD_NAME__CID "_CID" -#define METHOD_NAME__UID "_UID" -#define METHOD_NAME__ADR "_ADR" -#define METHOD_NAME__STA "_STA" -#define METHOD_NAME__REG "_REG" -#define METHOD_NAME__SEG "_SEG" -#define METHOD_NAME__BBN "_BBN" -#define METHOD_NAME__PRT "_PRT" -#define METHOD_NAME__CRS "_CRS" -#define METHOD_NAME__PRS "_PRS" -#define METHOD_NAME__PRW "_PRW" - - ACPI_STATUS AcpiUtOsiImplementation ( ACPI_WALK_STATE *WalkState); @@ -596,39 +549,10 @@ AcpiUtExecute_Sxds ( ACPI_NAMESPACE_NODE *DeviceNode, UINT8 *Highest); -/* - * UtMutex - mutual exclusion interfaces - */ - -ACPI_STATUS -AcpiUtMutexInitialize ( - void); - -void -AcpiUtMutexTerminate ( - void); - -ACPI_STATUS -AcpiUtCreateMutex ( - ACPI_MUTEX_HANDLE MutexId); - -ACPI_STATUS -AcpiUtDeleteMutex ( - ACPI_MUTEX_HANDLE MutexId); - -ACPI_STATUS -AcpiUtAcquireMutex ( - ACPI_MUTEX_HANDLE MutexId); - -ACPI_STATUS -AcpiUtReleaseMutex ( - ACPI_MUTEX_HANDLE MutexId); - /* - * UtObject - internal object create/delete/cache routines + * utobject - internal object create/delete/cache routines */ - ACPI_OPERAND_OBJECT * AcpiUtCreateInternalObjectDbg ( char *ModuleName, @@ -642,8 +566,8 @@ AcpiUtAllocateObjectDescDbg ( UINT32 LineNumber, UINT32 ComponentId); -#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t) -#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT) +#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t) +#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT) void AcpiUtDeleteObjectDesc ( @@ -661,50 +585,15 @@ ACPI_OPERAND_OBJECT * AcpiUtCreateStringObject ( ACPI_SIZE StringSize); - -/* - * UtRefCnt - Object reference count management - */ - -void -AcpiUtAddReference ( - ACPI_OPERAND_OBJECT *Object); - -void -AcpiUtRemoveReference ( - ACPI_OPERAND_OBJECT *Object); - -/* - * UtSize - Object size routines - */ - -ACPI_STATUS -AcpiUtGetSimpleObjectSize ( - ACPI_OPERAND_OBJECT *Obj, - ACPI_SIZE *ObjLength); - -ACPI_STATUS -AcpiUtGetPackageObjectSize ( - ACPI_OPERAND_OBJECT *Obj, - ACPI_SIZE *ObjLength); - ACPI_STATUS AcpiUtGetObjectSize( ACPI_OPERAND_OBJECT *Obj, ACPI_SIZE *ObjLength); -ACPI_STATUS -AcpiUtGetElementLength ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context); - /* - * UtState - Generic state creation/cache routines + * utstate - Generic state creation/cache routines */ - void AcpiUtPushGenericState ( ACPI_GENERIC_STATE **ListHead, @@ -755,23 +644,10 @@ void AcpiUtDeleteGenericState ( ACPI_GENERIC_STATE *State); -void -AcpiUtDeleteGenericStateCache ( - void); - -void -AcpiUtDeleteObjectCache ( - void); /* - * utmisc + * utmath */ - -void -AcpiUtPrintString ( - char *String, - UINT8 MaxLength); - ACPI_STATUS AcpiUtDivide ( ACPI_INTEGER InDividend, @@ -786,6 +662,33 @@ AcpiUtShortDivide ( ACPI_INTEGER *OutQuotient, UINT32 *OutRemainder); +/* + * utmisc + */ +ACPI_STATUS +AcpiUtAllocateOwnerId ( + ACPI_OWNER_ID *OwnerId); + +void +AcpiUtReleaseOwnerId ( + ACPI_OWNER_ID *OwnerId); + +ACPI_STATUS +AcpiUtWalkPackageTree ( + ACPI_OPERAND_OBJECT *SourceObject, + void *TargetObject, + ACPI_PKG_CALLBACK WalkCallback, + void *Context); + +void +AcpiUtStrupr ( + char *SrcString); + +void +AcpiUtPrintString ( + char *String, + UINT8 MaxLength); + BOOLEAN AcpiUtValidAcpiName ( UINT32 Name); @@ -804,9 +707,17 @@ AcpiUtStrtoul64 ( #define ACPI_ANY_BASE 0 -char * -AcpiUtStrupr ( - char *SrcString); +UINT32 +AcpiUtGetDescriptorLength ( + void *Aml); + +UINT16 +AcpiUtGetResourceLength ( + void *Aml); + +UINT8 +AcpiUtGetResourceType ( + void *Aml); UINT8 * AcpiUtGetResourceEndTag ( @@ -836,21 +747,35 @@ AcpiUtDisplayInitPathname ( /* - * Utalloc - memory allocation and object caching + * utmutex - mutex support */ - -void * -AcpiUtAcquireFromCache ( - UINT32 ListId); +ACPI_STATUS +AcpiUtMutexInitialize ( + void); void -AcpiUtReleaseToCache ( - UINT32 ListId, - void *Object); +AcpiUtMutexTerminate ( + void); -void -AcpiUtDeleteGenericCache ( - UINT32 ListId); +ACPI_STATUS +AcpiUtAcquireMutex ( + ACPI_MUTEX_HANDLE MutexId); + +ACPI_STATUS +AcpiUtReleaseMutex ( + ACPI_MUTEX_HANDLE MutexId); + + +/* + * utalloc - memory allocation and object caching + */ +ACPI_STATUS +AcpiUtCreateCaches ( + void); + +ACPI_STATUS +AcpiUtDeleteCaches ( + void); ACPI_STATUS AcpiUtValidateBuffer ( @@ -861,9 +786,6 @@ AcpiUtInitializeBuffer ( ACPI_BUFFER *Buffer, ACPI_SIZE RequiredLength); - -/* Memory allocation functions */ - void * AcpiUtAllocate ( ACPI_SIZE Size, @@ -878,9 +800,7 @@ AcpiUtCallocate ( char *Module, UINT32 Line); - #ifdef ACPI_DBG_TRACK_ALLOCATIONS - void * AcpiUtAllocateAndTrack ( ACPI_SIZE Size, @@ -902,29 +822,6 @@ AcpiUtFreeAndTrack ( char *Module, UINT32 Line); -ACPI_DEBUG_MEM_BLOCK * -AcpiUtFindAllocation ( - UINT32 ListId, - void *Allocation); - -ACPI_STATUS -AcpiUtTrackAllocation ( - UINT32 ListId, - ACPI_DEBUG_MEM_BLOCK *Address, - ACPI_SIZE Size, - UINT8 AllocType, - UINT32 Component, - char *Module, - UINT32 Line); - -ACPI_STATUS -AcpiUtRemoveAllocation ( - UINT32 ListId, - ACPI_DEBUG_MEM_BLOCK *Address, - UINT32 Component, - char *Module, - UINT32 Line); - void AcpiUtDumpAllocationInfo ( void); @@ -935,5 +832,4 @@ AcpiUtDumpAllocations ( char *Module); #endif - #endif /* _ACUTILS_H */ diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index 3b56738..7ad5717 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -127,12 +127,31 @@ #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exfldio") +/* Local prototypes */ + +static ACPI_STATUS +AcpiExFieldDatumIo ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 FieldDatumByteOffset, + ACPI_INTEGER *Value, + UINT32 ReadWrite); + +static BOOLEAN +AcpiExRegisterOverflow ( + ACPI_OPERAND_OBJECT *ObjDesc, + ACPI_INTEGER Value); + +static ACPI_STATUS +AcpiExSetupRegion ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 FieldDatumByteOffset); + /******************************************************************************* * * FUNCTION: AcpiExSetupRegion * - * PARAMETERS: *ObjDesc - Field to be read or written + * PARAMETERS: ObjDesc - Field to be read or written * FieldDatumByteOffset - Byte offset of this datum within the * parent field * @@ -144,7 +163,7 @@ * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiExSetupRegion ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset) @@ -208,9 +227,9 @@ AcpiExSetupRegion ( * 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.BaseByteOffset + + FieldDatumByteOffset + + ObjDesc->CommonField.AccessByteWidth)) { if (AcpiGbl_EnableInterpreterSlack) { @@ -240,7 +259,8 @@ AcpiExSetupRegion ( "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n", AcpiUtGetNodeName (ObjDesc->CommonField.Node), ObjDesc->CommonField.AccessByteWidth, - AcpiUtGetNodeName (RgnDesc->Region.Node), RgnDesc->Region.Length)); + AcpiUtGetNodeName (RgnDesc->Region.Node), + RgnDesc->Region.Length)); } /* @@ -252,7 +272,8 @@ AcpiExSetupRegion ( AcpiUtGetNodeName (ObjDesc->CommonField.Node), ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, - AcpiUtGetNodeName (RgnDesc->Region.Node), RgnDesc->Region.Length)); + AcpiUtGetNodeName (RgnDesc->Region.Node), + RgnDesc->Region.Length)); return_ACPI_STATUS (AE_AML_REGION_LIMIT); } @@ -265,10 +286,10 @@ AcpiExSetupRegion ( * * FUNCTION: AcpiExAccessRegion * - * PARAMETERS: *ObjDesc - Field to be read + * PARAMETERS: ObjDesc - Field to be read * FieldDatumByteOffset - Byte offset of this datum within the * parent field - * *Value - Where to store value (must at least + * Value - Where to store value (must at least * the size of ACPI_INTEGER) * Function - Read or Write flag plus other region- * dependent flags @@ -312,9 +333,9 @@ AcpiExAccessRegion ( * 3) The current offset into the field */ RgnDesc = ObjDesc->CommonField.RegionObj; - Address = RgnDesc->Region.Address - + ObjDesc->CommonField.BaseByteOffset - + FieldDatumByteOffset; + Address = RgnDesc->Region.Address + + ObjDesc->CommonField.BaseByteOffset + + FieldDatumByteOffset; if ((Function & ACPI_IO_MASK) == ACPI_READ) { @@ -337,7 +358,8 @@ AcpiExAccessRegion ( /* Invoke the appropriate AddressSpace/OpRegion handler */ Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, - Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); + Address, + ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) { @@ -365,7 +387,7 @@ AcpiExAccessRegion ( * * FUNCTION: AcpiExRegisterOverflow * - * PARAMETERS: *ObjDesc - Register(Field) to be written + * PARAMETERS: ObjDesc - Register(Field) to be written * Value - Value to be stored * * RETURN: TRUE if value overflows the field, FALSE otherwise @@ -378,7 +400,7 @@ AcpiExAccessRegion ( * ******************************************************************************/ -BOOLEAN +static BOOLEAN AcpiExRegisterOverflow ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_INTEGER Value) @@ -412,10 +434,10 @@ AcpiExRegisterOverflow ( * * FUNCTION: AcpiExFieldDatumIo * - * PARAMETERS: *ObjDesc - Field to be read + * PARAMETERS: ObjDesc - Field to be read * FieldDatumByteOffset - Byte offset of this datum within the * parent field - * *Value - Where to store value (must be 64 bits) + * Value - Where to store value (must be 64 bits) * ReadWrite - Read or Write flag * * RETURN: Status @@ -426,7 +448,7 @@ AcpiExRegisterOverflow ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiExFieldDatumIo ( ACPI_OPERAND_OBJECT *ObjDesc, UINT32 FieldDatumByteOffset, @@ -445,7 +467,9 @@ AcpiExFieldDatumIo ( if (!Value) { LocalValue = 0; - Value = &LocalValue; /* To support reads without saving return value */ + + /* To support reads without saving return value */ + Value = &LocalValue; } /* Clear the entire return buffer first, [Very Important!] */ @@ -458,8 +482,10 @@ AcpiExFieldDatumIo ( * * BufferField - Read/write from/to a Buffer * RegionField - Read/write from/to a Operation Region. - * BankField - Write to a Bank Register, then read/write from/to an OpRegion - * IndexField - Write to an Index Register, then read/write from/to a Data Register + * BankField - Write to a Bank Register, then read/write from/to an + * OperationRegion + * IndexField - Write to an Index Register, then read/write from/to a + * Data Register */ switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { @@ -483,10 +509,11 @@ AcpiExFieldDatumIo ( * Copy the data from the source buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer - + ObjDesc->BufferField.BaseByteOffset - + FieldDatumByteOffset, - ObjDesc->CommonField.AccessByteWidth); + ACPI_MEMCPY (Value, + (ObjDesc->BufferField.BufferObj)->Buffer.Pointer + + ObjDesc->BufferField.BaseByteOffset + + FieldDatumByteOffset, + ObjDesc->CommonField.AccessByteWidth); } else { @@ -494,9 +521,9 @@ AcpiExFieldDatumIo ( * Copy the data to the target buffer. * Length is the field width in bytes. */ - ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer - + ObjDesc->BufferField.BaseByteOffset - + FieldDatumByteOffset, + ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer + + ObjDesc->BufferField.BaseByteOffset + + FieldDatumByteOffset, Value, ObjDesc->CommonField.AccessByteWidth); } @@ -506,8 +533,10 @@ AcpiExFieldDatumIo ( case ACPI_TYPE_LOCAL_BANK_FIELD: - /* Ensure that the BankValue is not beyond the capacity of the register */ - + /* + * Ensure that the BankValue is not beyond the capacity of + * the register + */ if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj, (ACPI_INTEGER) ObjDesc->BankField.Value)) { @@ -547,8 +576,10 @@ AcpiExFieldDatumIo ( case ACPI_TYPE_LOCAL_INDEX_FIELD: - /* Ensure that the IndexValue is not beyond the capacity of the register */ - + /* + * Ensure that the IndexValue is not beyond the capacity of + * the register + */ if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj, (ACPI_INTEGER) ObjDesc->IndexField.Value)) { @@ -604,15 +635,17 @@ AcpiExFieldDatumIo ( { if (ReadWrite == ACPI_READ) { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n", - ACPI_FORMAT_UINT64 (*Value), - ObjDesc->CommonField.AccessByteWidth)); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Value Read %8.8X%8.8X, Width %d\n", + ACPI_FORMAT_UINT64 (*Value), + ObjDesc->CommonField.AccessByteWidth)); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n", - ACPI_FORMAT_UINT64 (*Value), - ObjDesc->CommonField.AccessByteWidth)); + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Value Written %8.8X%8.8X, Width %d\n", + ACPI_FORMAT_UINT64 (*Value), + ObjDesc->CommonField.AccessByteWidth)); } } @@ -624,8 +657,10 @@ AcpiExFieldDatumIo ( * * FUNCTION: AcpiExWriteWithUpdateRule * - * PARAMETERS: *ObjDesc - Field to be set - * Value - Value to store + * PARAMETERS: ObjDesc - Field to be written + * Mask - bitmask within field datum + * FieldValue - Value to write + * FieldDatumByteOffset - Offset of datum within field * * RETURN: Status * @@ -725,213 +760,6 @@ AcpiExWriteWithUpdateRule ( /******************************************************************************* * - * FUNCTION: AcpiExGetBufferDatum - * - * PARAMETERS: Datum - Where the Datum is returned - * Buffer - Raw field buffer - * BufferLength - Entire length (used for big-endian only) - * ByteGranularity - 1/2/4/8 Granularity of the field - * (aka Datum Size) - * BufferOffset - Datum offset into the buffer - * - * RETURN: none - * - * DESCRIPTION: Get a datum from the buffer according to the buffer field - * byte granularity - * - ******************************************************************************/ - -void -AcpiExGetBufferDatum ( - ACPI_INTEGER *Datum, - void *Buffer, - UINT32 BufferLength, - UINT32 ByteGranularity, - UINT32 BufferOffset) -{ - UINT32 Index; - - - ACPI_FUNCTION_TRACE_U32 ("ExGetBufferDatum", ByteGranularity); - - - /* Get proper index into buffer (handles big/little endian) */ - - Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity); - - /* Move the requested number of bytes */ - - switch (ByteGranularity) - { - case ACPI_FIELD_BYTE_GRANULARITY: - - *Datum = ((UINT8 *) Buffer) [Index]; - break; - - case ACPI_FIELD_WORD_GRANULARITY: - - ACPI_MOVE_16_TO_64 (Datum, &(((UINT16 *) Buffer) [Index])); - break; - - case ACPI_FIELD_DWORD_GRANULARITY: - - ACPI_MOVE_32_TO_64 (Datum, &(((UINT32 *) Buffer) [Index])); - break; - - case ACPI_FIELD_QWORD_GRANULARITY: - - ACPI_MOVE_64_TO_64 (Datum, &(((UINT64 *) Buffer) [Index])); - break; - - default: - /* Should not get here */ - break; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExSetBufferDatum - * - * PARAMETERS: MergedDatum - Value to store - * Buffer - Receiving buffer - * BufferLength - Entire length (used for big-endian only) - * ByteGranularity - 1/2/4/8 Granularity of the field - * (aka Datum Size) - * BufferOffset - Datum offset into the buffer - * - * RETURN: none - * - * DESCRIPTION: Store the merged datum to the buffer according to the - * byte granularity - * - ******************************************************************************/ - -void -AcpiExSetBufferDatum ( - ACPI_INTEGER MergedDatum, - void *Buffer, - UINT32 BufferLength, - UINT32 ByteGranularity, - UINT32 BufferOffset) -{ - UINT32 Index; - - - ACPI_FUNCTION_TRACE_U32 ("ExSetBufferDatum", ByteGranularity); - - - /* Get proper index into buffer (handles big/little endian) */ - - Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity); - - /* Move the requested number of bytes */ - - switch (ByteGranularity) - { - case ACPI_FIELD_BYTE_GRANULARITY: - - ((UINT8 *) Buffer) [Index] = (UINT8) MergedDatum; - break; - - case ACPI_FIELD_WORD_GRANULARITY: - - ACPI_MOVE_64_TO_16 (&(((UINT16 *) Buffer)[Index]), &MergedDatum); - break; - - case ACPI_FIELD_DWORD_GRANULARITY: - - ACPI_MOVE_64_TO_32 (&(((UINT32 *) Buffer)[Index]), &MergedDatum); - break; - - case ACPI_FIELD_QWORD_GRANULARITY: - - ACPI_MOVE_64_TO_64 (&(((UINT64 *) Buffer)[Index]), &MergedDatum); - break; - - default: - /* Should not get here */ - break; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiExCommonBufferSetup - * - * PARAMETERS: ObjDesc - Field object - * BufferLength - Length of caller's buffer - * DatumCount - Where the DatumCount is returned - * - * RETURN: Status, DatumCount - * - * DESCRIPTION: Common code to validate the incoming buffer size and compute - * the number of field "datums" that must be read or written. - * A "datum" is the smallest unit that can be read or written - * to the field, it is either 1,2,4, or 8 bytes. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCommonBufferSetup ( - ACPI_OPERAND_OBJECT *ObjDesc, - UINT32 BufferLength, - UINT32 *DatumCount) -{ - UINT32 ByteFieldLength; - UINT32 ActualByteFieldLength; - - - ACPI_FUNCTION_TRACE ("ExCommonBufferSetup"); - - - /* - * Incoming buffer must be at least as long as the field, we do not - * allow "partial" field reads/writes. We do not care if the buffer is - * larger than the field, this typically happens when an integer is - * read/written to a field that is actually smaller than an integer. - */ - ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - if (ByteFieldLength > BufferLength) - { - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "Field size %X (bytes) is too large for buffer (%X)\n", - ByteFieldLength, BufferLength)); - - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - /* - * Create "actual" field byte count (minimum number of bytes that - * must be read), then convert to datum count (minimum number - * of datum-sized units that must be read) - */ - ActualByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.StartFieldBitOffset + - ObjDesc->CommonField.BitLength); - - - *DatumCount = ACPI_ROUND_UP_TO (ActualByteFieldLength, - ObjDesc->CommonField.AccessByteWidth); - - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "BufferBytes %X, ActualBytes %X, Datums %X, ByteGran %X\n", - ByteFieldLength, ActualByteFieldLength, - *DatumCount, ObjDesc->CommonField.AccessByteWidth)); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * * FUNCTION: AcpiExExtractFromField * * PARAMETERS: ObjDesc - Field to be read @@ -951,139 +779,101 @@ AcpiExExtractFromField ( UINT32 BufferLength) { ACPI_STATUS Status; - UINT32 FieldDatumByteOffset; - UINT32 BufferDatumOffset; - ACPI_INTEGER PreviousRawDatum = 0; - ACPI_INTEGER ThisRawDatum = 0; - ACPI_INTEGER MergedDatum = 0; + ACPI_INTEGER RawDatum; + ACPI_INTEGER MergedDatum; + UINT32 FieldOffset = 0; + UINT32 BufferOffset = 0; + UINT32 BufferTailBits; UINT32 DatumCount; + UINT32 FieldDatumCount; UINT32 i; ACPI_FUNCTION_TRACE ("ExExtractFromField"); - /* Validate buffer, compute number of datums */ + /* Validate target buffer and clear it */ - Status = AcpiExCommonBufferSetup (ObjDesc, BufferLength, &DatumCount); - if (ACPI_FAILURE (Status)) + if (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength)) { - return_ACPI_STATUS (Status); - } + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Field size %X (bits) is too large for buffer (%X)\n", + ObjDesc->CommonField.BitLength, BufferLength)); - /* - * Clear the caller's buffer (the whole buffer length as given) - * This is very important, especially in the cases where the buffer - * is longer than the size of the field. - */ + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + } ACPI_MEMSET (Buffer, 0, BufferLength); - FieldDatumByteOffset = 0; - BufferDatumOffset= 0; - - /* Read the entire field */ - - for (i = 0; i < DatumCount; i++) - { - Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, - &ThisRawDatum, ACPI_READ); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* We might actually be done if the request fits in one datum */ - - if ((DatumCount == 1) && - (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM)) - { - /* 1) Shift the valid data bits down to start at bit 0 */ + /* Compute the number of datums (access width data items) */ - MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); + DatumCount = ACPI_ROUND_UP_TO ( + ObjDesc->CommonField.BitLength, + ObjDesc->CommonField.AccessBitWidth); + FieldDatumCount = ACPI_ROUND_UP_TO ( + ObjDesc->CommonField.BitLength + + ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.AccessBitWidth); - /* 2) Mask off any upper unused bits (bits not part of the field) */ + /* Priming read from the field */ - if (ObjDesc->CommonField.EndBufferValidBits) - { - MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); - } + Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, &RawDatum, ACPI_READ); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset; - /* Store the datum to the caller buffer */ + /* Read the rest of the field */ - AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); + for (i = 1; i < FieldDatumCount; i++) + { + /* Get next input datum from the field */ - return_ACPI_STATUS (AE_OK); + FieldOffset += ObjDesc->CommonField.AccessByteWidth; + Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, + &RawDatum, ACPI_READ); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); } - /* Special handling for the last datum to ignore extra bits */ + /* Merge with previous datum if necessary */ - if ((i >= (DatumCount -1)) && - (ObjDesc->CommonField.EndFieldValidBits)) - { - /* - * This is the last iteration of the loop. We need to clear - * any unused bits (bits that are not part of this field) before - * we store the final merged datum into the caller buffer. - */ - ThisRawDatum &= - ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); - } + MergedDatum |= RawDatum << + (ObjDesc->CommonField.AccessBitWidth - + ObjDesc->CommonField.StartFieldBitOffset); - /* - * Create the (possibly) merged datum to be stored to the caller buffer - */ - if (ObjDesc->CommonField.StartFieldBitOffset == 0) + if (i == DatumCount) { - /* Field is not skewed and we can just copy the datum */ - - AcpiExSetBufferDatum (ThisRawDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); - BufferDatumOffset++; + break; } - else - { - /* Not aligned -- on the first iteration, just save the datum */ - - if (i != 0) - { - /* - * 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 - */ - MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); - - /* 2) Insert the second datum "above" the first datum */ - MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits); - - AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); - BufferDatumOffset++; - } + /* Write merged datum to target buffer */ - /* - * Save the raw datum that was just acquired since it may contain bits - * of the *next* field datum - */ - PreviousRawDatum = ThisRawDatum; - } + ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum, + ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, + BufferLength - BufferOffset)); - FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; + BufferOffset += ObjDesc->CommonField.AccessByteWidth; + MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset; } - /* For non-aligned case, there is one last datum to insert */ + /* Mask off any extra bits in the last datum */ - if (ObjDesc->CommonField.StartFieldBitOffset != 0) + BufferTailBits = ObjDesc->CommonField.BitLength % + ObjDesc->CommonField.AccessBitWidth; + if (BufferTailBits) { - MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); - - AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset); + MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits); } + /* Write the last datum to the buffer */ + + ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum, + ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, + BufferLength - BufferOffset)); + return_ACPI_STATUS (AE_OK); } @@ -1109,180 +899,100 @@ AcpiExInsertIntoField ( UINT32 BufferLength) { ACPI_STATUS Status; - UINT32 FieldDatumByteOffset; - UINT32 DatumOffset; ACPI_INTEGER Mask; ACPI_INTEGER MergedDatum; - ACPI_INTEGER PreviousRawDatum; - ACPI_INTEGER ThisRawDatum; + ACPI_INTEGER RawDatum = 0; + UINT32 FieldOffset = 0; + UINT32 BufferOffset = 0; + UINT32 BufferTailBits; UINT32 DatumCount; + UINT32 FieldDatumCount; + UINT32 i; ACPI_FUNCTION_TRACE ("ExInsertIntoField"); - /* Validate buffer, compute number of datums */ + /* Validate input buffer */ - Status = AcpiExCommonBufferSetup (ObjDesc, BufferLength, &DatumCount); - if (ACPI_FAILURE (Status)) + if (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength)) { - return_ACPI_STATUS (Status); - } - - /* - * 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, BufferLength, - 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) - * - * Mask off bits that are "below" the field (if any) - */ - Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); - - /* If the field fits in one datum, may need to mask upper bits */ - - if ((ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM) && - ObjDesc->CommonField.EndFieldValidBits) - { - /* There are bits above the field, mask them off also */ + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Field size %X (bits) is too large for buffer (%X)\n", + ObjDesc->CommonField.BitLength, BufferLength)); - Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); + return_ACPI_STATUS (AE_BUFFER_OVERFLOW); } - /* Shift and mask the value into the field position */ - - MergedDatum = (PreviousRawDatum << ObjDesc->CommonField.StartFieldBitOffset); - MergedDatum &= Mask; + /* Compute the number of datums (access width data items) */ - /* Apply the update rule (if necessary) and write the datum to the field */ + Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset); + DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength, + ObjDesc->CommonField.AccessBitWidth); + FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength + + ObjDesc->CommonField.StartFieldBitOffset, + ObjDesc->CommonField.AccessBitWidth); - Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, - FieldDatumByteOffset); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } + /* Get initial Datum from the input buffer */ - /* We just wrote the first datum */ + ACPI_MEMCPY (&RawDatum, Buffer, + ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, + BufferLength - BufferOffset)); - DatumOffset++; + MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset; - /* If the entire field fits within one datum, we are done. */ + /* Write the entire field */ - if ((DatumCount == 1) && - (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM)) + for (i = 1; i < FieldDatumCount; i++) { - return_ACPI_STATUS (AE_OK); - } + /* Write merged datum to the target field */ - /* - * Part2: - * Write the aligned data. - * - * We don't need to worry about the update rule for these data, because - * all of the bits in each datum are part of the field. - * - * 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 (DatumOffset < DatumCount) - { - FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; + MergedDatum &= Mask; + Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, + MergedDatum, FieldOffset); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } - /* - * Get the next raw buffer datum. It may contain bits of the previous - * field datum - */ - AcpiExGetBufferDatum (&ThisRawDatum, Buffer, BufferLength, - ObjDesc->CommonField.AccessByteWidth, DatumOffset); + /* Start new output datum by merging with previous input datum */ - /* Create the field datum based on the field alignment */ + FieldOffset += ObjDesc->CommonField.AccessByteWidth; + MergedDatum = RawDatum >> + (ObjDesc->CommonField.AccessBitWidth - + ObjDesc->CommonField.StartFieldBitOffset); + Mask = ACPI_INTEGER_MAX; - if (ObjDesc->CommonField.StartFieldBitOffset != 0) + if (i == DatumCount) { - /* - * 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 - { - /* Field began aligned on datum boundary */ - - MergedDatum = ThisRawDatum; + break; } - /* - * 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. - */ - DatumOffset++; - if ((DatumOffset == DatumCount) && - (ObjDesc->CommonField.EndFieldValidBits)) - { - /* - * If there are dangling non-aligned bits, perform one more merged write - * Else - field is aligned at the end, no need for any more writes - */ + /* Get the next input datum from the buffer */ - /* - * 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. - * - * Mask off the unused bits above (after) the end-of-field - */ - Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits); - MergedDatum &= Mask; + BufferOffset += ObjDesc->CommonField.AccessByteWidth; + ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset, + ACPI_MIN(ObjDesc->CommonField.AccessByteWidth, + BufferLength - BufferOffset)); + MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset; + } - /* Write the last datum with the update rule */ + /* Mask off any extra bits in the last datum */ - Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, - FieldDatumByteOffset); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - else - { - /* Normal (aligned) case -- write the completed datum */ + BufferTailBits = (ObjDesc->CommonField.BitLength + + ObjDesc->CommonField.StartFieldBitOffset) % + ObjDesc->CommonField.AccessBitWidth; + if (BufferTailBits) + { + Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits); + } - Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset, - &MergedDatum, ACPI_WRITE); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } + /* Write the last datum to the field */ - /* - * Save the most recent datum since it may contain bits of the *next* - * field datum. Update current byte offset. - */ - PreviousRawDatum = ThisRawDatum; - } + MergedDatum &= Mask; + Status = AcpiExWriteWithUpdateRule (ObjDesc, + Mask, MergedDatum, FieldOffset); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/exsystem.c b/sys/contrib/dev/acpica/exsystem.c index 8e11af5..b08db06 100644 --- a/sys/contrib/dev/acpica/exsystem.c +++ b/sys/contrib/dev/acpica/exsystem.c @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -129,8 +129,8 @@ * * FUNCTION: AcpiExSystemWaitSemaphore * - * PARAMETERS: Semaphore - OSD semaphore to wait on - * Timeout - Max time to wait + * PARAMETERS: Semaphore - Semaphore to wait on + * Timeout - Max time to wait * * RETURN: Status * @@ -166,7 +166,8 @@ AcpiExSystemWaitSemaphore ( Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n", + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "*** Thread awake after blocking, %s\n", AcpiFormatException (Status))); /* Reacquire the interpreter */ @@ -188,8 +189,8 @@ AcpiExSystemWaitSemaphore ( * * FUNCTION: AcpiExSystemDoStall * - * PARAMETERS: HowLong - The amount of time to stall, - * in microseconds + * PARAMETERS: HowLong - The amount of time to stall, + * in microseconds * * RETURN: Status * @@ -219,7 +220,8 @@ AcpiExSystemDoStall ( * (ACPI specifies 100 usec as max, but this gives some slack in * order to support existing BIOSs) */ - ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", HowLong)); + ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", + HowLong)); Status = AE_AML_OPERAND_VALUE; } else @@ -235,8 +237,8 @@ AcpiExSystemDoStall ( * * FUNCTION: AcpiExSystemDoSuspend * - * PARAMETERS: HowLong - The amount of time to suspend, - * in milliseconds + * PARAMETERS: HowLong - The amount of time to suspend, + * in milliseconds * * RETURN: None * @@ -271,8 +273,8 @@ AcpiExSystemDoSuspend ( * * FUNCTION: AcpiExSystemAcquireMutex * - * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor - * *ObjDesc - The object descriptor for this op + * PARAMETERS: TimeDesc - The 'time to delay' object descriptor + * ObjDesc - The object descriptor for this op * * RETURN: Status * @@ -298,9 +300,8 @@ AcpiExSystemAcquireMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Support for the _GL_ Mutex object -- go get the global lock - */ + /* Support for the _GL_ Mutex object -- go get the global lock */ + if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore) { Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value); @@ -308,7 +309,7 @@ AcpiExSystemAcquireMutex ( } Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore, - (UINT16) TimeDesc->Integer.Value); + (UINT16) TimeDesc->Integer.Value); return_ACPI_STATUS (Status); } @@ -317,7 +318,7 @@ AcpiExSystemAcquireMutex ( * * FUNCTION: AcpiExSystemReleaseMutex * - * PARAMETERS: *ObjDesc - The object descriptor for this op + * PARAMETERS: ObjDesc - The object descriptor for this op * * RETURN: Status * @@ -343,9 +344,8 @@ AcpiExSystemReleaseMutex ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Support for the _GL_ Mutex object -- release the global lock - */ + /* Support for the _GL_ Mutex object -- release the global lock */ + if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore) { Status = AcpiEvReleaseGlobalLock (); @@ -361,9 +361,9 @@ AcpiExSystemReleaseMutex ( * * FUNCTION: AcpiExSystemSignalEvent * - * PARAMETERS: *ObjDesc - The object descriptor for this op + * PARAMETERS: ObjDesc - The object descriptor for this op * - * RETURN: AE_OK + * RETURN: Status * * DESCRIPTION: Provides an access point to perform synchronization operations * within the AML. @@ -393,8 +393,8 @@ AcpiExSystemSignalEvent ( * * FUNCTION: AcpiExSystemWaitEvent * - * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor - * *ObjDesc - The object descriptor for this op + * PARAMETERS: TimeDesc - The 'time to delay' object descriptor + * ObjDesc - The object descriptor for this op * * RETURN: Status * @@ -418,7 +418,7 @@ AcpiExSystemWaitEvent ( if (ObjDesc) { Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore, - (UINT16) TimeDesc->Integer.Value); + (UINT16) TimeDesc->Integer.Value); } return_ACPI_STATUS (Status); @@ -429,7 +429,7 @@ AcpiExSystemWaitEvent ( * * FUNCTION: AcpiExSystemResetEvent * - * PARAMETERS: *ObjDesc - The object descriptor for this op + * PARAMETERS: ObjDesc - The object descriptor for this op * * RETURN: Status * diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index 9a62670..b9d34ed 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -135,9 +135,6 @@ ACPI_MODULE_NAME ("psparse") -static UINT32 AcpiGbl_Depth = 0; - - /******************************************************************************* * * FUNCTION: AcpiPsGetOpcodeSize @@ -174,7 +171,7 @@ AcpiPsGetOpcodeSize ( * * PARAMETERS: ParserState - A parser state object * - * RETURN: Status + * RETURN: Next AML opcode * * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) * @@ -191,10 +188,9 @@ AcpiPsPeekOpcode ( Aml = ParserState->Aml; Opcode = (UINT16) ACPI_GET8 (Aml); - - if (Opcode == AML_EXTOP) + if (Opcode == AML_EXTENDED_OP_PREFIX) { - /* Extended opcode */ + /* Extended opcode, get the second opcode byte */ Aml++; Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml)); @@ -211,13 +207,13 @@ AcpiPsPeekOpcode ( * PARAMETERS: WalkState - Current State * Op - Op to complete * - * RETURN: None. + * RETURN: Status * * DESCRIPTION: Perform any cleanup at the completion of an Op. * ******************************************************************************/ -void +ACPI_STATUS AcpiPsCompleteThisOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op) @@ -235,7 +231,7 @@ AcpiPsCompleteThisOp ( if (!Op) { - return_VOID; + return_ACPI_STATUS (AE_OK); /* OK for now */ } /* Delete this op and the subtree below it if asked to */ @@ -243,18 +239,26 @@ AcpiPsCompleteThisOp ( if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) || (WalkState->OpInfo->Class == AML_CLASS_ARGUMENT)) { - return_VOID; + return_ACPI_STATUS (AE_OK); } /* Make sure that we only delete this subtree */ if (Op->Common.Parent) { + Prev = Op->Common.Parent->Common.Value.Arg; + if (!Prev) + { + /* Nothing more to do */ + + goto Cleanup; + } + /* * Check if we need to replace the operator and its subtree * with a return value op (placeholder op) */ - ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); + ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode); switch (ParentInfo->Class) { @@ -270,7 +274,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto Cleanup; + goto AllocateError; } break; @@ -289,13 +293,11 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto Cleanup; + goto AllocateError; } } - - if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && - (WalkState->DescendingCallback != AcpiDsExecBeginOp)) - + else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && + (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2)) { if ((Op->Common.AmlOpcode == AML_BUFFER_OP) || (Op->Common.AmlOpcode == AML_PACKAGE_OP) || @@ -304,7 +306,7 @@ AcpiPsCompleteThisOp ( ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode); if (!ReplacementOp) { - goto Cleanup; + goto AllocateError; } ReplacementOp->Named.Data = Op->Named.Data; @@ -314,16 +316,16 @@ AcpiPsCompleteThisOp ( break; default: + ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP); if (!ReplacementOp) { - goto Cleanup; + goto AllocateError; } } /* We must unlink this op from the parent tree */ - Prev = Op->Common.Parent->Common.Value.Arg; if (Prev == Op) { /* This op is the first in the list */ @@ -366,7 +368,6 @@ AcpiPsCompleteThisOp ( Next = NULL; } } - Prev = Next; } } @@ -374,10 +375,18 @@ AcpiPsCompleteThisOp ( Cleanup: - /* Now we can actually delete the subtree rooted at op */ + /* Now we can actually delete the subtree rooted at Op */ + + AcpiPsDeleteParseTree (Op); + return_ACPI_STATUS (AE_OK); + + +AllocateError: + + /* Always delete the subtree, even on error */ AcpiPsDeleteParseTree (Op); - return_VOID; + return_ACPI_STATUS (AE_NO_MEMORY); } @@ -385,7 +394,9 @@ Cleanup: * * FUNCTION: AcpiPsNextParseState * - * PARAMETERS: ParserState - Current parser state object + * PARAMETERS: WalkState - Current state + * Op - Current parse op + * CallbackStatus - Status from previous operation * * RETURN: Status * @@ -477,9 +488,8 @@ AcpiPsNextParseState ( case AE_CTRL_TRANSFER: - /* - * A method call (invocation) -- transfer control - */ + /* A method call (invocation) -- transfer control */ + Status = AE_CTRL_TRANSFER; WalkState->PrevOp = Op; WalkState->MethodCallOp = Op; @@ -492,6 +502,7 @@ AcpiPsNextParseState ( default: + Status = CallbackStatus; if ((CallbackStatus & AE_CODE_MASK) == AE_CODE_CONTROL) { @@ -506,715 +517,9 @@ AcpiPsNextParseState ( /******************************************************************************* * - * FUNCTION: AcpiPsParseLoop - * - * PARAMETERS: ParserState - Current parser state object - * - * RETURN: Status - * - * DESCRIPTION: Parse AML (pointed to by the current parser state) and return - * a tree of ops. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiPsParseLoop ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PARSE_OBJECT *Op = NULL; /* current op */ - ACPI_PARSE_OBJECT *Arg = NULL; - ACPI_PARSE_OBJECT *PreOp = NULL; - ACPI_PARSE_STATE *ParserState; - UINT8 *AmlOpStart = NULL; - - - ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState); - - if (WalkState->DescendingCallback == NULL) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - ParserState = &WalkState->ParserState; - WalkState->ArgTypes = 0; - -#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY)) - if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART) - { - /* We are restarting a preempted control method */ - - if (AcpiPsHasCompletedScope (ParserState)) - { - /* - * We must check if a predicate to an IF or WHILE statement - * was just completed - */ - if ((ParserState->Scope->ParseScope.Op) && - ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) || - (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) && - (WalkState->ControlState) && - (WalkState->ControlState->Common.State == - ACPI_CONTROL_PREDICATE_EXECUTING)) - { - /* - * A predicate was just completed, get the value of the - * predicate and branch based on that value - */ - WalkState->Op = NULL; - Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE)); - if (ACPI_FAILURE (Status) && - ((Status & AE_CODE_MASK) != AE_CODE_CONTROL)) - { - if (Status == AE_AML_NO_RETURN_VALUE) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Invoked method did not return a value, %s\n", - AcpiFormatException (Status))); - - } - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GetPredicate Failed, %s\n", - AcpiFormatException (Status))); - return_ACPI_STATUS (Status); - } - - Status = AcpiPsNextParseState (WalkState, Op, Status); - } - - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op)); - } - else if (WalkState->PrevOp) - { - /* We were in the middle of an op */ - - Op = WalkState->PrevOp; - WalkState->ArgTypes = WalkState->PrevArgTypes; - } - } -#endif - - /* - * Iterative parsing loop, while there is more aml to process: - */ - while ((ParserState->Aml < ParserState->AmlEnd) || (Op)) - { - AmlOpStart = ParserState->Aml; - if (!Op) - { - /* Get the next opcode from the AML stream */ - - WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); - WalkState->Opcode = AcpiPsPeekOpcode (ParserState); - - /* - * First cut to determine what we have found: - * 1) A valid AML opcode - * 2) A name string - * 3) An unknown/invalid opcode - */ - WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); - switch (WalkState->OpInfo->Class) - { - case AML_CLASS_ASCII: - case AML_CLASS_PREFIX: - /* - * Starts with a valid prefix or ASCII char, this is a name - * string. Convert the bare name string to a namepath. - */ - WalkState->Opcode = AML_INT_NAMEPATH_OP; - WalkState->ArgTypes = ARGP_NAMESTRING; - break; - - case AML_CLASS_UNKNOWN: - - /* The opcode is unrecognized. Just skip unknown opcodes */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, - "Found unknown opcode %X at AML address %p offset %X, ignoring\n", - WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset)); - - ACPI_DUMP_BUFFER (ParserState->Aml, 128); - - /* Assume one-byte bad opcode */ - - ParserState->Aml++; - continue; - - default: - - /* Found opcode info, this is a normal opcode */ - - ParserState->Aml += AcpiPsGetOpcodeSize (WalkState->Opcode); - WalkState->ArgTypes = WalkState->OpInfo->ParseArgs; - break; - } - - /* Create Op structure and append to parent's argument list */ - - if (WalkState->OpInfo->Flags & AML_NAMED) - { - /* Allocate a new PreOp if necessary */ - - if (!PreOp) - { - PreOp = AcpiPsAllocOp (WalkState->Opcode); - if (!PreOp) - { - Status = AE_NO_MEMORY; - goto CloseThisOp; - } - } - - PreOp->Common.Value.Arg = NULL; - PreOp->Common.AmlOpcode = WalkState->Opcode; - - /* - * Get and append arguments until we find the node that contains - * the name (the type ARGP_NAME). - */ - while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && - (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME)) - { - Status = AcpiPsGetNextArg (WalkState, ParserState, - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } - - AcpiPsAppendArg (PreOp, Arg); - INCREMENT_ARG_LIST (WalkState->ArgTypes); - } - - /* Make sure that we found a NAME and didn't run out of arguments */ - - if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes)) - { - Status = AE_AML_NO_OPERAND; - goto CloseThisOp; - } - - /* We know that this arg is a name, move to next arg */ - - INCREMENT_ARG_LIST (WalkState->ArgTypes); - - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - WalkState->Op = NULL; - - Status = WalkState->DescendingCallback (WalkState, &Op); - if (ACPI_FAILURE (Status)) - { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n", - AcpiFormatException (Status))); - goto CloseThisOp; - } - - if (Op == NULL) - { - continue; - } - - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_OK; - goto CloseThisOp; - } - - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } - - AcpiPsAppendArg (Op, PreOp->Common.Value.Arg); - AcpiGbl_Depth++; - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - /* - * Defer final parsing of an OperationRegion body, - * because we don't have enough info in the first pass - * to parse it correctly (i.e., there may be method - * calls within the TermArg elements of the body.) - * - * However, we must continue parsing because - * the opregion is not a standalone package -- - * we don't know where the end is at this point. - * - * (Length is unknown until parse of the body complete) - */ - Op->Named.Data = AmlOpStart; - Op->Named.Length = 0; - } - } - else - { - /* Not a named opcode, just allocate Op and append to parent */ - - WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); - Op = AcpiPsAllocOp (WalkState->Opcode); - if (!Op) - { - Status = AE_NO_MEMORY; - goto CloseThisOp; - } - - if (WalkState->OpInfo->Flags & AML_CREATE) - { - /* - * Backup to beginning of CreateXXXfield declaration - * BodyLength is unknown until we parse the body - */ - Op->Named.Data = AmlOpStart; - Op->Named.Length = 0; - } - - AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op); - - if ((WalkState->DescendingCallback != NULL)) - { - /* - * Find the object. This will either insert the object into - * the namespace or simply look it up - */ - WalkState->Op = Op; - - Status = WalkState->DescendingCallback (WalkState, &Op); - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_OK; - goto CloseThisOp; - } - - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } - } - } - - Op->Common.AmlOffset = WalkState->AmlOffset; - - if (WalkState->OpInfo) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n", - (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name, - Op, ParserState->Aml, Op->Common.AmlOffset)); - } - } - - - /* Start ArgCount at zero because we don't know if there are any args yet */ - - WalkState->ArgCount = 0; - - if (WalkState->ArgTypes) /* Are there any arguments that must be processed? */ - { - /* Get arguments */ - - switch (Op->Common.AmlOpcode) - { - case AML_BYTE_OP: /* AML_BYTEDATA_ARG */ - case AML_WORD_OP: /* AML_WORDDATA_ARG */ - case AML_DWORD_OP: /* AML_DWORDATA_ARG */ - case AML_QWORD_OP: /* AML_QWORDATA_ARG */ - case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */ - - /* Fill in constant or string argument directly */ - - AcpiPsGetNextSimpleArg (ParserState, - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op); - break; - - case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */ - - Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1); - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } - - WalkState->ArgTypes = 0; - break; - - default: - - /* Op is not a constant or string, append each argument to the Op */ - - while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) && - !WalkState->ArgCount) - { - WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml, - ParserState->AmlStart); - Status = AcpiPsGetNextArg (WalkState, ParserState, - GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg); - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } - - if (Arg) - { - Arg->Common.AmlOffset = WalkState->AmlOffset; - AcpiPsAppendArg (Op, Arg); - } - INCREMENT_ARG_LIST (WalkState->ArgTypes); - } - - /* Special processing for certain opcodes */ - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - - /* - * Skip parsing of control method - * because we don't have enough info in the first pass - * to parse it correctly. - * - * Save the length and address of the body - */ - Op->Named.Data = ParserState->Aml; - Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml); - - /* Skip body of method */ - - ParserState->Aml = ParserState->PkgEnd; - WalkState->ArgCount = 0; - break; - - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - if ((Op->Common.Parent) && - (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) && - (WalkState->DescendingCallback != AcpiDsExecBeginOp)) - { - /* - * Skip parsing of Buffers and Packages - * because we don't have enough info in the first pass - * to parse them correctly. - */ - Op->Named.Data = AmlOpStart; - Op->Named.Length = (UINT32) (ParserState->PkgEnd - AmlOpStart); - - /* Skip body */ - - ParserState->Aml = ParserState->PkgEnd; - WalkState->ArgCount = 0; - } - break; - - case AML_WHILE_OP: - - if (WalkState->ControlState) - { - WalkState->ControlState->Control.PackageEnd = ParserState->PkgEnd; - } - break; - - default: - - /* No action for all other opcodes */ - break; - } - break; - } - } - - /* Check for arguments that need to be processed */ - - if (WalkState->ArgCount) - { - /* There are arguments (complex ones), push Op and prepare for argument */ - - Status = AcpiPsPushScope (ParserState, Op, - WalkState->ArgTypes, WalkState->ArgCount); - if (ACPI_FAILURE (Status)) - { - goto CloseThisOp; - } - Op = NULL; - continue; - } - - /* All arguments have been processed -- Op is complete, prepare for next */ - - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (WalkState->OpInfo->Flags & AML_NAMED) - { - if (AcpiGbl_Depth) - { - AcpiGbl_Depth--; - } - - if (Op->Common.AmlOpcode == AML_REGION_OP) - { - /* - * Skip parsing of control method or opregion body, - * because we don't have enough info in the first pass - * to parse them correctly. - * - * Completed parsing an OpRegion declaration, we now - * know the length. - */ - Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); - } - } - - if (WalkState->OpInfo->Flags & AML_CREATE) - { - /* - * Backup to beginning of CreateXXXfield declaration (1 for - * Opcode) - * - * BodyLength is unknown until we parse the body - */ - Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data); - } - - /* This op complete, notify the dispatcher */ - - if (WalkState->AscendingCallback != NULL) - { - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_OK; - goto CloseThisOp; - } - } - - -CloseThisOp: - /* - * Finished one argument of the containing scope - */ - ParserState->Scope->ParseScope.ArgCount--; - - /* Close this Op (will result in parse subtree deletion) */ - - AcpiPsCompleteThisOp (WalkState, Op); - Op = NULL; - if (PreOp) - { - AcpiPsFreeOp (PreOp); - PreOp = NULL; - } - - switch (Status) - { - case AE_OK: - break; - - - case AE_CTRL_TRANSFER: - - /* - * We are about to transfer to a called method. - */ - WalkState->PrevOp = Op; - WalkState->PrevArgTypes = WalkState->ArgTypes; - return_ACPI_STATUS (Status); - - - case AE_CTRL_END: - - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - if (Op) - { - WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - WalkState->Opcode = Op->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, Op, Status); - - AcpiPsCompleteThisOp (WalkState, Op); - Op = NULL; - } - Status = AE_OK; - break; - - - case AE_CTRL_BREAK: - case AE_CTRL_CONTINUE: - - /* Pop off scopes until we find the While */ - - while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP)) - { - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - } - - /* Close this iteration of the While loop */ - - WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - WalkState->Opcode = Op->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, Op, Status); - - AcpiPsCompleteThisOp (WalkState, Op); - Op = NULL; - - Status = AE_OK; - break; - - - case AE_CTRL_TERMINATE: - - Status = AE_OK; - - /* Clean up */ - do - { - if (Op) - { - AcpiPsCompleteThisOp (WalkState, Op); - } - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - } while (Op); - - return_ACPI_STATUS (Status); - - - default: /* All other non-AE_OK status */ - - do - { - if (Op) - { - AcpiPsCompleteThisOp (WalkState, Op); - } - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - } while (Op); - - - /* - * TBD: Cleanup parse ops on error - */ -#if 0 - if (Op == NULL) - { - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - } -#endif - WalkState->PrevOp = Op; - WalkState->PrevArgTypes = WalkState->ArgTypes; - return_ACPI_STATUS (Status); - } - - /* This scope complete? */ - - if (AcpiPsHasCompletedScope (ParserState)) - { - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op)); - } - else - { - Op = NULL; - } - - } /* while ParserState->Aml */ - - - /* - * Complete the last Op (if not completed), and clear the scope stack. - * It is easily possible to end an AML "package" with an unbounded number - * of open scopes (such as when several ASL blocks are closed with - * sequential closing braces). We want to terminate each one cleanly. - */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op)); - do - { - if (Op) - { - if (WalkState->AscendingCallback != NULL) - { - WalkState->Op = Op; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - WalkState->Opcode = Op->Common.AmlOpcode; - - Status = WalkState->AscendingCallback (WalkState); - Status = AcpiPsNextParseState (WalkState, Op, Status); - if (Status == AE_CTRL_PENDING) - { - Status = AE_OK; - goto CloseThisOp; - } - - if (Status == AE_CTRL_TERMINATE) - { - Status = AE_OK; - - /* Clean up */ - do - { - if (Op) - { - AcpiPsCompleteThisOp (WalkState, Op); - } - - AcpiPsPopScope (ParserState, &Op, - &WalkState->ArgTypes, &WalkState->ArgCount); - - } while (Op); - - return_ACPI_STATUS (Status); - } - - else if (ACPI_FAILURE (Status)) - { - AcpiPsCompleteThisOp (WalkState, Op); - return_ACPI_STATUS (Status); - } - } - - AcpiPsCompleteThisOp (WalkState, Op); - } - - AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes, - &WalkState->ArgCount); - - } while (Op); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiPsParseAml * - * PARAMETERS: StartScope - The starting point of the parse. Becomes the - * root of the parsed op tree. - * Aml - Pointer to the raw AML code to parse - * AmlSize - Length of the AML to parse + * PARAMETERS: WalkState - Current state * * * RETURN: Status @@ -1228,7 +533,6 @@ AcpiPsParseAml ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status; - ACPI_STATUS TerminateStatus; ACPI_THREAD_STATE *Thread; ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList; ACPI_WALK_STATE *PreviousWalkState; @@ -1236,8 +540,10 @@ AcpiPsParseAml ( ACPI_FUNCTION_TRACE ("PsParseAml"); - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with WalkState=%p Aml=%p size=%X\n", - WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Entered with WalkState=%p Aml=%p size=%X\n", + WalkState, WalkState->ParserState.Aml, + WalkState->ParserState.AmlSize)); /* Create and initialize a new thread state */ @@ -1303,31 +609,26 @@ AcpiPsParseAml ( ACPI_REPORT_METHOD_ERROR ("Method execution failed", WalkState->MethodNode, NULL, Status); + /* Ensure proper cleanup */ + + WalkState->ParseFlags |= ACPI_PARSE_EXECUTE; + /* Check for possible multi-thread reentrancy problem */ if ((Status == AE_ALREADY_EXISTS) && (!WalkState->MethodDesc->Method.Semaphore)) { /* - * This method is marked NotSerialized, but it tried to create a named - * object, causing the second thread entrance to fail. We will workaround - * this by marking the method permanently as Serialized. + * This method is marked NotSerialized, but it tried to create + * a named object, causing the second thread entrance to fail. + * We will workaround this by marking the method permanently + * as Serialized. */ WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED; WalkState->MethodDesc->Method.Concurrency = 1; } } - if (WalkState->MethodDesc) - { - /* Decrement the thread count on the method parse tree */ - - if (WalkState->MethodDesc->Method.ThreadCount) - { - WalkState->MethodDesc->Method.ThreadCount--; - } - } - /* We are done with this walk, move on to the parent if any */ WalkState = AcpiDsPopWalkState (Thread); @@ -1342,14 +643,14 @@ AcpiPsParseAml ( */ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { - TerminateStatus = AcpiDsTerminateControlMethod (WalkState); - if (ACPI_FAILURE (TerminateStatus)) + if (WalkState->MethodDesc) { - ACPI_REPORT_ERROR (( - "Could not terminate control method properly\n")); + /* Decrement the thread count on the method parse tree */ - /* Ignore error and continue */ + WalkState->MethodDesc->Method.ThreadCount--; } + + AcpiDsTerminateControlMethod (WalkState); } /* Delete this walk state and all linked control states */ @@ -1358,8 +659,9 @@ AcpiPsParseAml ( PreviousWalkState = WalkState; - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "ReturnValue=%p, State=%p\n", - WalkState->ReturnDesc, WalkState)); + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "ReturnValue=%p, ImplicitValue=%p State=%p\n", + WalkState->ReturnDesc, WalkState->ImplicitReturnObj, WalkState)); /* Check if we have restarted a preempted walk */ @@ -1373,8 +675,22 @@ AcpiPsParseAml ( * If the method return value is not used by the parent, * The object is deleted */ - Status = AcpiDsRestartControlMethod (WalkState, - PreviousWalkState->ReturnDesc); + if (!PreviousWalkState->ReturnDesc) + { + Status = AcpiDsRestartControlMethod (WalkState, + PreviousWalkState->ImplicitReturnObj); + } + else + { + /* + * We have a valid return value, delete any implicit + * return value. + */ + AcpiDsClearImplicitReturn (PreviousWalkState); + + Status = AcpiDsRestartControlMethod (WalkState, + PreviousWalkState->ReturnDesc); + } if (ACPI_SUCCESS (Status)) { WalkState->WalkType |= ACPI_WALK_METHOD_RESTART; @@ -1394,13 +710,33 @@ AcpiPsParseAml ( */ else if (PreviousWalkState->CallerReturnDesc) { - *(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */ + if (PreviousWalkState->ImplicitReturnObj) + { + *(PreviousWalkState->CallerReturnDesc) = + PreviousWalkState->ImplicitReturnObj; + } + else + { + /* NULL if no return value */ + + *(PreviousWalkState->CallerReturnDesc) = + PreviousWalkState->ReturnDesc; + } } - else if (PreviousWalkState->ReturnDesc) + else { - /* Caller doesn't want it, must delete it */ + if (PreviousWalkState->ReturnDesc) + { + /* Caller doesn't want it, must delete it */ - AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); + AcpiUtRemoveReference (PreviousWalkState->ReturnDesc); + } + if (PreviousWalkState->ImplicitReturnObj) + { + /* Caller doesn't want it, must delete it */ + + AcpiUtRemoveReference (PreviousWalkState->ImplicitReturnObj); + } } AcpiDsDeleteWalkState (PreviousWalkState); diff --git a/sys/contrib/dev/acpica/rscreate.c b/sys/contrib/dev/acpica/rscreate.c index afc4814..f65606a 100644 --- a/sys/contrib/dev/acpica/rscreate.c +++ b/sys/contrib/dev/acpica/rscreate.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -130,10 +130,10 @@ * * FUNCTION: AcpiRsCreateResourceList * - * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream - * OutputBuffer - Pointer to the user's buffer + * PARAMETERS: AmlBuffer - Pointer to the resource byte stream + * OutputBuffer - Pointer to the user's buffer * - * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code + * RETURN: Status: AE_OK if okay, else a valid ACPI_STATUS code * If OutputBuffer is not large enough, OutputBufferLength * indicates how large OutputBuffer should be, else it * indicates how may UINT8 elements of OutputBuffer are valid. @@ -146,33 +146,32 @@ ACPI_STATUS AcpiRsCreateResourceList ( - ACPI_OPERAND_OBJECT *ByteStreamBuffer, + ACPI_OPERAND_OBJECT *AmlBuffer, ACPI_BUFFER *OutputBuffer) { ACPI_STATUS Status; - UINT8 *ByteStreamStart; + UINT8 *AmlStart; ACPI_SIZE ListSizeNeeded = 0; - UINT32 ByteStreamBufferLength; + UINT32 AmlBufferLength; ACPI_FUNCTION_TRACE ("RsCreateResourceList"); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", - ByteStreamBuffer)); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n", + AmlBuffer)); - /* - * Params already validated, so we don't re-validate here - */ - ByteStreamBufferLength = ByteStreamBuffer->Buffer.Length; - ByteStreamStart = ByteStreamBuffer->Buffer.Pointer; + /* Params already validated, so we don't re-validate here */ + + AmlBufferLength = AmlBuffer->Buffer.Length; + AmlStart = AmlBuffer->Buffer.Pointer; /* - * Pass the ByteStreamBuffer into a module that can calculate + * Pass the AmlBuffer into a module that can calculate * the buffer size needed for the linked list */ - Status = AcpiRsGetListLength (ByteStreamStart, ByteStreamBufferLength, + Status = AcpiRsGetListLength (AmlStart, AmlBufferLength, &ListSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n", @@ -192,7 +191,7 @@ AcpiRsCreateResourceList ( /* Do the conversion */ - Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength, + Status = AcpiRsConvertAmlToResources (AmlStart, AmlBufferLength, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { @@ -249,9 +248,8 @@ AcpiRsCreatePciRoutingTable ( /* Params already validated, so we don't re-validate here */ - /* - * Get the required buffer length - */ + /* Get the required buffer length */ + Status = AcpiRsGetPciRoutingTableLength (PackageObject, &BufferSizeNeeded); if (ACPI_FAILURE (Status)) @@ -298,9 +296,8 @@ AcpiRsCreatePciRoutingTable ( */ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); - /* - * Each element of the top-level package must also be a package - */ + /* Each element of the top-level package must also be a package */ + if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE) { ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, @@ -326,9 +323,8 @@ AcpiRsCreatePciRoutingTable ( */ SubObjectList = (*TopObjectList)->Package.Elements; - /* - * 1) First subobject: Dereference the PRT.Address - */ + /* 1) First subobject: Dereference the PRT.Address */ + ObjDesc = SubObjectList[0]; if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { @@ -342,9 +338,8 @@ AcpiRsCreatePciRoutingTable ( return_ACPI_STATUS (AE_BAD_DATA); } - /* - * 2) Second subobject: Dereference the PRT.Pin - */ + /* 2) Second subobject: Dereference the PRT.Pin */ + ObjDesc = SubObjectList[1]; if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { @@ -358,9 +353,8 @@ AcpiRsCreatePciRoutingTable ( return_ACPI_STATUS (AE_BAD_DATA); } - /* - * 3) Third subobject: Dereference the PRT.SourceName - */ + /* 3) Third subobject: Dereference the PRT.SourceName */ + ObjDesc = SubObjectList[2]; switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) { @@ -385,7 +379,9 @@ AcpiRsCreatePciRoutingTable ( Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer); - UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */ + /* +1 to include null terminator */ + + UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; break; @@ -393,8 +389,10 @@ AcpiRsCreatePciRoutingTable ( ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer); - /* Add to the Length field the length of the string (add 1 for terminator) */ - + /* + * Add to the Length field the length of the string + * (add 1 for terminator) + */ UserPrt->Length += ObjDesc->String.Length + 1; break; @@ -422,9 +420,8 @@ AcpiRsCreatePciRoutingTable ( UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BITS (UserPrt->Length); - /* - * 4) Fourth subobject: Dereference the PRT.SourceIndex - */ + /* 4) Fourth subobject: Dereference the PRT.SourceIndex */ + ObjDesc = SubObjectList[3]; if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) { @@ -451,7 +448,7 @@ AcpiRsCreatePciRoutingTable ( /******************************************************************************* * - * FUNCTION: AcpiRsCreateByteStream + * FUNCTION: AcpiRsCreateAmlResources * * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list * OutputBuffer - Pointer to the user's buffer @@ -468,15 +465,15 @@ AcpiRsCreatePciRoutingTable ( ******************************************************************************/ ACPI_STATUS -AcpiRsCreateByteStream ( +AcpiRsCreateAmlResources ( ACPI_RESOURCE *LinkedListBuffer, ACPI_BUFFER *OutputBuffer) { ACPI_STATUS Status; - ACPI_SIZE ByteStreamSizeNeeded = 0; + ACPI_SIZE AmlSizeNeeded = 0; - ACPI_FUNCTION_TRACE ("RsCreateByteStream"); + ACPI_FUNCTION_TRACE ("RsCreateAmlResources"); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", @@ -488,11 +485,11 @@ AcpiRsCreateByteStream ( * Pass the LinkedListBuffer into a module that calculates * the buffer size needed for the byte stream. */ - Status = AcpiRsGetByteStreamLength (LinkedListBuffer, - &ByteStreamSizeNeeded); + Status = AcpiRsGetAmlLength (LinkedListBuffer, + &AmlSizeNeeded); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n", - (UINT32) ByteStreamSizeNeeded, AcpiFormatException (Status))); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", + (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -500,7 +497,7 @@ AcpiRsCreateByteStream ( /* Validate/Allocate/Clear caller buffer */ - Status = AcpiUtInitializeBuffer (OutputBuffer, ByteStreamSizeNeeded); + Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -508,7 +505,7 @@ AcpiRsCreateByteStream ( /* Do the conversion */ - Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded, + Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/tbget.c b/sys/contrib/dev/acpica/tbget.c index fd0cba4..e361166 100644 --- a/sys/contrib/dev/acpica/tbget.c +++ b/sys/contrib/dev/acpica/tbget.c @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. * All rights reserved. * * 2. License @@ -123,6 +123,19 @@ #define _COMPONENT ACPI_TABLES ACPI_MODULE_NAME ("tbget") +/* Local prototypes */ + +static ACPI_STATUS +AcpiTbGetThisTable ( + ACPI_POINTER *Address, + ACPI_TABLE_HEADER *Header, + ACPI_TABLE_DESC *TableInfo); + +static ACPI_STATUS +AcpiTbTableOverride ( + ACPI_TABLE_HEADER *Header, + ACPI_TABLE_DESC *TableInfo); + /******************************************************************************* * @@ -150,9 +163,8 @@ AcpiTbGetTable ( ACPI_FUNCTION_TRACE ("TbGetTable"); - /* - * Get the header in order to get signature and table size - */ + /* Get the header in order to get signature and table size */ + Status = AcpiTbGetTableHeader (Address, &Header); if (ACPI_FAILURE (Status)) { @@ -203,8 +215,8 @@ AcpiTbGetTableHeader ( /* - * Flags contains the current processor mode (Virtual or Physical addressing) - * The PointerType is either Logical or Physical + * Flags contains the current processor mode (Virtual or Physical + * addressing) The PointerType is either Logical or Physical */ switch (Address->PointerType) { @@ -213,7 +225,8 @@ AcpiTbGetTableHeader ( /* Pointer matches processor mode, copy the header */ - ACPI_MEMCPY (ReturnHeader, Address->Pointer.Logical, sizeof (ACPI_TABLE_HEADER)); + ACPI_MEMCPY (ReturnHeader, Address->Pointer.Logical, + sizeof (ACPI_TABLE_HEADER)); break; @@ -221,11 +234,12 @@ AcpiTbGetTableHeader ( /* Create a logical address for the physical pointer*/ - Status = AcpiOsMapMemory (Address->Pointer.Physical, sizeof (ACPI_TABLE_HEADER), - (void *) &Header); + Status = AcpiOsMapMemory (Address->Pointer.Physical, + sizeof (ACPI_TABLE_HEADER), (void *) &Header); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not map memory at %8.8X%8.8X for length %X\n", + ACPI_REPORT_ERROR (( + "Could not map memory at %8.8X%8.8X for length %X\n", ACPI_FORMAT_UINT64 (Address->Pointer.Physical), sizeof (ACPI_TABLE_HEADER))); return_ACPI_STATUS (Status); @@ -289,9 +303,8 @@ AcpiTbGetTableBody ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - /* - * Attempt table override. - */ + /* Attempt table override. */ + Status = AcpiTbTableOverride (Header, TableInfo); if (ACPI_SUCCESS (Status)) { @@ -321,7 +334,7 @@ AcpiTbGetTableBody ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiTbTableOverride ( ACPI_TABLE_HEADER *Header, ACPI_TABLE_DESC *TableInfo) @@ -398,7 +411,7 @@ AcpiTbTableOverride ( * ******************************************************************************/ -ACPI_STATUS +static ACPI_STATUS AcpiTbGetThisTable ( ACPI_POINTER *Address, ACPI_TABLE_HEADER *Header, @@ -413,8 +426,8 @@ AcpiTbGetThisTable ( /* - * Flags contains the current processor mode (Virtual or Physical addressing) - * The PointerType is either Logical or Physical + * Flags contains the current processor mode (Virtual or Physical + * addressing) The PointerType is either Logical or Physical */ switch (Address->PointerType) { @@ -426,7 +439,8 @@ AcpiTbGetThisTable ( FullTable = ACPI_MEM_ALLOCATE (Header->Length); if (!FullTable) { - ACPI_REPORT_ERROR (("Could not allocate table memory for [%4.4s] length %X\n", + ACPI_REPORT_ERROR (( + "Could not allocate table memory for [%4.4s] length %X\n", Header->Signature, Header->Length)); return_ACPI_STATUS (AE_NO_MEMORY); } @@ -447,13 +461,15 @@ AcpiTbGetThisTable ( * Just map the table's physical memory * into our address space. */ - Status = AcpiOsMapMemory (Address->Pointer.Physical, (ACPI_SIZE) Header->Length, - (void *) &FullTable); + Status = AcpiOsMapMemory (Address->Pointer.Physical, + (ACPI_SIZE) Header->Length, (void *) &FullTable); if (ACPI_FAILURE (Status)) { - ACPI_REPORT_ERROR (("Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", + ACPI_REPORT_ERROR (( + "Could not map memory for table [%4.4s] at %8.8X%8.8X for length %X\n", Header->Signature, - ACPI_FORMAT_UINT64 (Address->Pointer.Physical), Header->Length)); + ACPI_FORMAT_UINT64 (Address->Pointer.Physical), + Header->Length)); return (Status); } @@ -557,9 +573,8 @@ AcpiTbGetTablePtr ( return_ACPI_STATUS (AE_OK); } - /* - * Check for instance out of range - */ + /* Check for instance out of range */ + if (Instance > AcpiGbl_TableLists[TableType].Count) { return_ACPI_STATUS (AE_NOT_EXIST); |