Unchanged files that are off the vendor branch

This commit is contained in:
Jung-uk Kim 2005-11-01 22:23:25 +00:00
parent 43ea53ef1f
commit 775a51a92f
13 changed files with 655 additions and 1695 deletions

View File

@ -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
/******************************************************************************

View File

@ -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

View File

@ -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 *

View File

@ -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.
*/

View File

@ -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 */

View File

@ -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);
@ -256,10 +251,37 @@ AcpiOsGetPhysicalAddress (
ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
/*
* 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__ */

View File

@ -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,

View File

@ -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 */
/*
* utglobal - Global data structures and procedures
*/
void
AcpiUtInitGlobals (
void);
void
AcpiUtTerminate (
void);
/*
* UtInit - miscellaneous initialization and shutdown
*/
ACPI_STATUS
AcpiUtHardwareInitialize (
void);
void
AcpiUtSubsystemShutdown (
void);
ACPI_STATUS
AcpiUtValidateFadt (
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);
/*
* utinit - miscellaneous initialization and shutdown
*/
ACPI_STATUS
AcpiUtHardwareInitialize (
void);
void
AcpiUtSubsystemShutdown (
void);
ACPI_STATUS
AcpiUtValidateFadt (
void);
/*
* UtClib - Local implementations of C library functions
* 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,
@ -351,30 +330,11 @@ AcpiUtBuildPackageObject (
UINT8 *Buffer,
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,
@ -385,17 +345,6 @@ AcpiUtCopyISimpleToIsimple (
ACPI_OPERAND_OBJECT *SourceObj,
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,
@ -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 */

View File

@ -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
*
@ -723,213 +758,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
@ -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 (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field size %X (bits) is too large for buffer (%X)\n",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
ACPI_MEMSET (Buffer, 0, BufferLength);
/* Compute the number of datums (access width data items) */
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);
/* Priming read from the field */
Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, &RawDatum, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
/*
* 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.
*/
ACPI_MEMSET (Buffer, 0, BufferLength);
/* Read the rest of the field */
FieldDatumByteOffset = 0;
BufferDatumOffset= 0;
/* Read the entire field */
for (i = 0; i < DatumCount; i++)
for (i = 1; i < FieldDatumCount; i++)
{
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
&ThisRawDatum, ACPI_READ);
/* Get next input datum from the field */
FieldOffset += ObjDesc->CommonField.AccessByteWidth;
Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset,
&RawDatum, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* We might actually be done if the request fits in one datum */
/* Merge with previous datum if necessary */
if ((DatumCount == 1) &&
(ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))
MergedDatum |= RawDatum <<
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
if (i == DatumCount)
{
/* 1) Shift the valid data bits down to start at bit 0 */
MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset);
/* 2) Mask off any upper unused bits (bits not part of the field) */
if (ObjDesc->CommonField.EndBufferValidBits)
{
MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
/* Store the datum to the caller buffer */
AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset);
return_ACPI_STATUS (AE_OK);
break;
}
/* Special handling for the last datum to ignore extra bits */
/* Write merged datum to target buffer */
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);
}
ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
/*
* Create the (possibly) merged datum to be stored to the caller buffer
*/
if (ObjDesc->CommonField.StartFieldBitOffset == 0)
{
/* Field is not skewed and we can just copy the datum */
AcpiExSetBufferDatum (ThisRawDatum, Buffer, BufferLength,
ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset);
BufferDatumOffset++;
}
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++;
}
/*
* Save the raw datum that was just acquired since it may contain bits
* of the *next* field datum
*/
PreviousRawDatum = ThisRawDatum;
}
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);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field size %X (bits) is too large for buffer (%X)\n",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
/*
* 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;
/* Compute the number of datums (access width data items) */
/* 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);
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);
/* If the field fits in one datum, may need to mask upper bits */
/* Get initial Datum from the input buffer */
if ((ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM) &&
ObjDesc->CommonField.EndFieldValidBits)
ACPI_MEMCPY (&RawDatum, Buffer,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
/* Write the entire field */
for (i = 1; i < FieldDatumCount; i++)
{
/* There are bits above the field, mask them off also */
/* Write merged datum to the target field */
Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
MergedDatum &= Mask;
Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask,
MergedDatum, FieldOffset);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Start new output datum by merging with previous input datum */
FieldOffset += ObjDesc->CommonField.AccessByteWidth;
MergedDatum = RawDatum >>
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
Mask = ACPI_INTEGER_MAX;
if (i == DatumCount)
{
break;
}
/* Get the next input datum from the buffer */
BufferOffset += ObjDesc->CommonField.AccessByteWidth;
ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
}
/* Shift and mask the value into the field position */
/* Mask off any extra bits in the last datum */
BufferTailBits = (ObjDesc->CommonField.BitLength +
ObjDesc->CommonField.StartFieldBitOffset) %
ObjDesc->CommonField.AccessBitWidth;
if (BufferTailBits)
{
Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
}
/* Write the last datum to the field */
MergedDatum = (PreviousRawDatum << ObjDesc->CommonField.StartFieldBitOffset);
MergedDatum &= Mask;
/* Apply the update rule (if necessary) and write the datum to the field */
Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum,
FieldDatumByteOffset);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* We just wrote the first datum */
DatumOffset++;
/* If the entire field fits within one datum, we are done. */
if ((DatumCount == 1) &&
(ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))
{
return_ACPI_STATUS (AE_OK);
}
/*
* Part2:
* Write the aligned data.
*
* We don't need to worry about the update rule for these data, because
* all of the bits 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;
/*
* Get the next raw buffer datum. It may contain bits of the previous
* field datum
*/
AcpiExGetBufferDatum (&ThisRawDatum, Buffer, BufferLength,
ObjDesc->CommonField.AccessByteWidth, DatumOffset);
/* Create the field datum based on the field alignment */
if (ObjDesc->CommonField.StartFieldBitOffset != 0)
{
/*
* 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;
}
/*
* 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
*/
/*
* 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;
/* Write the last datum with the update rule */
Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum,
FieldDatumByteOffset);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
else
{
/* Normal (aligned) case -- write the completed datum */
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
&MergedDatum, ACPI_WRITE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/*
* Save the most recent datum since it may contain bits of the *next*
* field datum. Update current byte offset.
*/
PreviousRawDatum = ThisRawDatum;
}
Status = AcpiExWriteWithUpdateRule (ObjDesc,
Mask, MergedDatum, FieldOffset);
return_ACPI_STATUS (Status);
}

View File

@ -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
*

File diff suppressed because it is too large Load Diff

View File

@ -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 */
AmlBufferLength = AmlBuffer->Buffer.Length;
AmlStart = AmlBuffer->Buffer.Pointer;
/*
* Params already validated, so we don't re-validate here
*/
ByteStreamBufferLength = ByteStreamBuffer->Buffer.Length;
ByteStreamStart = ByteStreamBuffer->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))
{

View File

@ -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);