1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-23 11:18:54 +00:00

Resolve conflicts of unchanged files that are off the vendor branch.

This commit is contained in:
Jung-uk Kim 2007-03-22 17:58:27 +00:00
parent f487a6a811
commit 676ba8b815
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167811
21 changed files with 1445 additions and 1091 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
* $Revision: 169 $
* $Revision: 1.234 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -137,7 +137,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20051021
#define ACPI_CA_VERSION 0x20070320
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@ -155,9 +155,10 @@
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
/*
* Should the subystem abort the loading of an ACPI table if the
* Should the subsystem abort the loading of an ACPI table if the
* table checksum is incorrect?
*/
#define ACPI_CHECKSUM_ABORT FALSE
@ -173,23 +174,26 @@
#define ACPI_CA_SUPPORT_LEVEL 3
/* String size constants */
#define ACPI_MAX_STRING_LENGTH 512
#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
/* Maximum count for a semaphore object */
#define ACPI_MAX_SEMAPHORE_COUNT 256
/* Max reference count (for debug only) */
/* Maximum object reference count (detects object deletion issues) */
#define ACPI_MAX_REFERENCE_COUNT 0x400
#define ACPI_MAX_REFERENCE_COUNT 0x800
/* Size of cached memory mapping for system memory operation region */
#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
/* OwnerId tracking. 8 entries allows for 255 OwnerIds */
#define ACPI_NUM_OWNERID_MASKS 8
/* Size of the root table array is increased by this increment */
#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
/******************************************************************************
*
@ -210,14 +214,11 @@
#define ACPI_METHOD_NUM_ARGS 7
#define ACPI_METHOD_MAX_ARG 6
/* Maximum length of resulting string when converting from a buffer */
#define ACPI_MAX_STRING_CONVERSION 200
/* Length of _HID, _UID, and _CID values */
/* Length of _HID, _UID, _CID, and UUID values */
#define ACPI_DEVICE_ID_LENGTH 0x09
#define ACPI_MAX_CID_LENGTH 48
#define ACPI_UUID_LENGTH 16
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
@ -225,12 +226,28 @@
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
/* Number of elements in the Result Stack frame, can be an arbitrary value */
#define ACPI_RESULTS_FRAME_OBJ_NUM 8
/*
* Maximal number of elements the Result Stack can contain,
* it may be an arbitray value not exceeding the types of
* ResultSize and ResultCount (now UINT8).
*/
#define ACPI_RESULTS_OBJ_NUM_MAX 255
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4
#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define ACPI_PATH_SEPARATOR '.'
/* Sizes for ACPI table headers */
#define ACPI_OEM_ID_SIZE 6
#define ACPI_OEM_TABLE_ID_SIZE 8
/* Constants used in searching for the RSDP in low memory */
#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
@ -251,12 +268,7 @@
/* Array sizes. Used for range checking also */
#define ACPI_NUM_ACCESS_TYPES 6
#define ACPI_NUM_UPDATE_RULES 3
#define ACPI_NUM_LOCK_RULES 2
#define ACPI_NUM_MATCH_OPS 6
#define ACPI_NUM_OPCODES 256
#define ACPI_NUM_FIELD_NAMES 2
#define ACPI_MAX_MATCH_OPCODE 5
/* RSDP checksums */
@ -267,10 +279,6 @@
#define ACPI_SMBUS_BUFFER_SIZE 34
/* Number of strings associated with the _OSI reserved method */
#define ACPI_NUM_OSI_STRINGS 10
/******************************************************************************
*

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
* $Revision: 109 $
* $Revision: 1.131 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -123,33 +123,41 @@
*/
#ifdef ACPI_LIBRARY
/*
* Note: The non-debug version of the AcpiLibrary does not contain any
* debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG
*/
#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
#endif
#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_MUTEX_DEBUG
#endif
#ifdef ACPI_ASL_COMPILER
#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_CONSTANT_EVAL_ONLY
#define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
#ifdef ACPI_EXEC_APP
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#define ACPI_FULL_DEBUG
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
#define ACPI_MUTEX_DEBUG
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#ifdef ACPI_DASM_APP
#ifndef MSDOS
#define ACPI_DEBUG_OUTPUT
#endif
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
#define ACPI_NO_METHOD_EXECUTION
#define ACPI_LARGE_NAMESPACE_NODE
#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
#ifdef ACPI_APPLICATION
@ -157,6 +165,13 @@
#define ACPI_USE_LOCAL_CACHE
#endif
#ifdef ACPI_FULL_DEBUG
#define ACPI_DEBUGGER
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER
#endif
/*
* Environment configuration. The purpose of this file is to interface to the
* local generation environment.
@ -211,7 +226,7 @@
#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
#include "acdos16.h"
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <contrib/dev/acpica/acfreebsd.h>
#elif defined(__NetBSD__)
@ -223,6 +238,9 @@
#elif defined(NETWARE)
#include "acnetware.h"
#elif defined(__sun)
#include "acsolaris.h"
#else
/* All other environments */
@ -232,24 +250,6 @@
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
/*
* This macro is used to tag functions as "printf-like" because
* some compilers can catch printf format string problems. MSVC
* doesn't, so this is proprocessed away.
*/
#define ACPI_PRINTF_LIKE_FUNC
#endif
/*
* Memory allocation tracking. Used only if
* 1) This is the debug version
* 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
*/
#ifdef ACPI_DEBUG_OUTPUT
#if ACPI_MACHINE_WIDTH != 16
#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
#endif
/*! [End] no source code translation !*/

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
* $Revision: 17 $
* $Revision: 1.25 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -124,6 +124,11 @@
#include <sys/types.h>
#include <machine/acpica_machdep.h>
#define ACPI_THREAD_ID pid_t
#define ACPI_UINTPTR_T uintptr_t
#define ACPI_USE_LOCAL_CACHE
#define __cdecl
#ifdef _KERNEL
#include "opt_acpi.h"
#endif
@ -143,7 +148,9 @@
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
#define DEBUGGER_THREADING 0 /* integrated with DDB */
#ifdef ACPI_DEBUG_OUTPUT
#include "opt_ddb.h"
#ifdef DDB
@ -169,4 +176,26 @@
/* Always use FreeBSD code over our local versions */
#define ACPI_USE_SYSTEM_CLIBRARY
#if defined(_KERNEL) && (__FreeBSD_version < 700020)
/* Or strstr (used in debugging mode, also move to libkern) */
static __inline char *
strstr (char *s, char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0) {
len = strlen (find);
do {
do {
if ((sc = *s++) == 0)
return (NULL);
} while (sc != c);
} while (strncmp (s, find, len) != 0);
s--;
}
return ((char *) s);
}
#endif /* _KERNEL */
#endif /* __ACFREEBSD_H__ */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
* $Revision: 26 $
* $Revision: 1.32 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -121,16 +121,19 @@
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
/* This macro is used to tag functions as "printf-like" because
/*
* 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__, 6, 7)))
#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
/* Some compilers complain about unused variables. Sometimes we don't want to
/*
* Some compilers complain about unused variables. Sometimes we don't want to
* 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.
*/
#define ACPI_UNUSED_VAR __attribute__ ((unused))
#endif /* __ACGCC_H__ */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
* $Revision: 57 $
* $Revision: 1.61 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License

View File

@ -12,7 +12,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -125,12 +125,18 @@
#include <contrib/dev/acpica/actypes.h>
/* Priorities for AcpiOsQueueForExecution */
/* Types for AcpiOsExecute */
#define OSD_PRIORITY_GPE 1
#define OSD_PRIORITY_HIGH 2
#define OSD_PRIORITY_MED 3
#define OSD_PRIORITY_LO 4
typedef enum
{
OSL_GLOBAL_LOCK_HANDLER,
OSL_NOTIFY_HANDLER,
OSL_GPE_HANDLER,
OSL_DEBUGGER_THREAD,
OSL_EC_POLL_HANDLER,
OSL_EC_BURST_HANDLER
} ACPI_EXECUTE_TYPE;
#define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
#define ACPI_MUTEX_SEM 1
@ -165,10 +171,9 @@ AcpiOsTerminate (
/*
* ACPI Table interfaces
*/
ACPI_STATUS
ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
UINT32 Flags,
ACPI_POINTER *Address);
void);
ACPI_STATUS
AcpiOsPredefinedOverride (
@ -182,45 +187,77 @@ AcpiOsTableOverride (
/*
* Synchronization primitives
* Spinlock primitives
*/
ACPI_STATUS
AcpiOsCreateLock (
ACPI_SPINLOCK *OutHandle);
void
AcpiOsDeleteLock (
ACPI_SPINLOCK Handle);
ACPI_CPU_FLAGS
AcpiOsAcquireLock (
ACPI_SPINLOCK Handle);
void
AcpiOsReleaseLock (
ACPI_SPINLOCK Handle,
ACPI_CPU_FLAGS Flags);
/*
* Semaphore primitives
*/
ACPI_STATUS
AcpiOsCreateSemaphore (
UINT32 MaxUnits,
UINT32 InitialUnits,
ACPI_HANDLE *OutHandle);
ACPI_SEMAPHORE *OutHandle);
ACPI_STATUS
AcpiOsDeleteSemaphore (
ACPI_HANDLE Handle);
ACPI_SEMAPHORE Handle);
ACPI_STATUS
AcpiOsWaitSemaphore (
ACPI_HANDLE Handle,
ACPI_SEMAPHORE Handle,
UINT32 Units,
UINT16 Timeout);
ACPI_STATUS
AcpiOsSignalSemaphore (
ACPI_HANDLE Handle,
ACPI_SEMAPHORE Handle,
UINT32 Units);
/*
* Mutex primitives
*/
ACPI_STATUS
AcpiOsCreateLock (
ACPI_HANDLE *OutHandle);
AcpiOsCreateMutex (
ACPI_MUTEX *OutHandle);
void
AcpiOsDeleteLock (
ACPI_HANDLE Handle);
AcpiOsDeleteMutex (
ACPI_MUTEX Handle);
ACPI_NATIVE_UINT
AcpiOsAcquireLock (
ACPI_HANDLE Handle);
ACPI_STATUS
AcpiOsAcquireMutex (
ACPI_MUTEX Handle,
UINT16 Timeout);
void
AcpiOsReleaseLock (
ACPI_HANDLE Handle,
ACPI_NATIVE_UINT Flags);
AcpiOsReleaseMutex (
ACPI_MUTEX Handle);
/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle)
#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle)
#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1)
/*
@ -234,11 +271,10 @@ void
AcpiOsFree (
void * Memory);
ACPI_STATUS
void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS PhysicalAddress,
ACPI_SIZE Size,
void **LogicalAddress);
ACPI_PHYSICAL_ADDRESS Where,
ACPI_NATIVE_UINT Length);
void
AcpiOsUnmapMemory (
@ -297,13 +333,13 @@ AcpiOsRemoveInterruptHandler (
/*
* Threads and Scheduling
*/
UINT32
ACPI_THREAD_ID
AcpiOsGetThreadId (
void);
ACPI_STATUS
AcpiOsQueueForExecution (
UINT32 Priority,
AcpiOsExecute (
ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context);
@ -371,6 +407,7 @@ AcpiOsWritePciConfiguration (
ACPI_INTEGER Value,
UINT32 Width);
/*
* Interim function needed for PCI IRQ routing
*/
@ -380,9 +417,20 @@ AcpiOsDerivePciId(
ACPI_HANDLE Chandle,
ACPI_PCI_ID **PciId);
/*
* Miscellaneous
*/
ACPI_STATUS
AcpiOsValidateInterface (
char *Interface);
ACPI_STATUS
AcpiOsValidateAddress (
UINT8 SpaceId,
ACPI_PHYSICAL_ADDRESS Address,
ACPI_SIZE Length);
BOOLEAN
AcpiOsReadable (
void *Pointer,
@ -402,6 +450,7 @@ AcpiOsSignal (
UINT32 Function,
void *Info);
/*
* Debug print routines
*/
@ -451,14 +500,5 @@ void
AcpiOsCloseDirectory (
void *DirHandle);
/*
* Debug
*/
void
AcpiOsDbgAssert(
void *FailedAssertion,
void *FileName,
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 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -126,6 +126,12 @@
* Global interfaces
*/
ACPI_STATUS
AcpiInitializeTables (
ACPI_TABLE_DESC *InitialStorage,
UINT32 InitialTableCount,
BOOLEAN AllowResize);
ACPI_STATUS
AcpiInitializeSubsystem (
void);
@ -190,40 +196,33 @@ AcpiFree (
* ACPI table manipulation interfaces
*/
ACPI_STATUS
AcpiReallocateRootTable (
void);
ACPI_STATUS
AcpiFindRootPointer (
UINT32 Flags,
ACPI_POINTER *RsdpAddress);
ACPI_NATIVE_UINT *RsdpAddress);
ACPI_STATUS
AcpiLoadTables (
void);
ACPI_STATUS
AcpiLoadTable (
ACPI_TABLE_HEADER *TablePtr);
ACPI_STATUS
AcpiUnloadTable (
ACPI_TABLE_TYPE TableType);
ACPI_STATUS
AcpiGetTableHeader (
ACPI_TABLE_TYPE TableType,
UINT32 Instance,
ACPI_STRING Signature,
ACPI_NATIVE_UINT Instance,
ACPI_TABLE_HEADER *OutTableHeader);
ACPI_STATUS
AcpiGetTable (
ACPI_TABLE_TYPE TableType,
UINT32 Instance,
ACPI_BUFFER *RetBuffer);
ACPI_STRING Signature,
ACPI_NATIVE_UINT Instance,
ACPI_TABLE_HEADER **OutTable);
ACPI_STATUS
AcpiGetFirmwareTable (
ACPI_STRING Signature,
UINT32 Instance,
UINT32 Flags,
ACPI_TABLE_HEADER **TablePointer);
AcpiGetTableByIndex (
ACPI_NATIVE_UINT TableIndex,
ACPI_TABLE_HEADER **OutTable);
/*
@ -465,6 +464,12 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
ACPI_RESOURCE *Resource,
void *Context);
ACPI_STATUS
AcpiGetVendorResource (
ACPI_HANDLE DeviceHandle,
char *Name,
ACPI_VENDOR_UUID *Uuid,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiGetCurrentResources(
@ -478,10 +483,10 @@ AcpiGetPossibleResources(
ACPI_STATUS
AcpiWalkResources (
ACPI_HANDLE DeviceHandle,
char *Path,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context);
ACPI_HANDLE DeviceHandle,
char *Name,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context);
ACPI_STATUS
AcpiSetCurrentResources (
@ -504,14 +509,12 @@ AcpiResourceToAddress64 (
ACPI_STATUS
AcpiGetRegister (
UINT32 RegisterId,
UINT32 *ReturnValue,
UINT32 Flags);
UINT32 *ReturnValue);
ACPI_STATUS
AcpiSetRegister (
UINT32 RegisterId,
UINT32 Value,
UINT32 Flags);
UINT32 Value);
ACPI_STATUS
AcpiSetFirmwareWakingVector (

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
* $Revision: 164 $
* $Revision: 1.200 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -118,6 +118,47 @@
#define _ACUTILS_H
extern const UINT8 AcpiGbl_ResourceAmlSizes[];
/* Strings used by the disassembler and debugger resource dump routines */
#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
extern const char *AcpiGbl_BmDecode[];
extern const char *AcpiGbl_ConfigDecode[];
extern const char *AcpiGbl_ConsumeDecode[];
extern const char *AcpiGbl_DecDecode[];
extern const char *AcpiGbl_HeDecode[];
extern const char *AcpiGbl_IoDecode[];
extern const char *AcpiGbl_LlDecode[];
extern const char *AcpiGbl_MaxDecode[];
extern const char *AcpiGbl_MemDecode[];
extern const char *AcpiGbl_MinDecode[];
extern const char *AcpiGbl_MtpDecode[];
extern const char *AcpiGbl_RngDecode[];
extern const char *AcpiGbl_RwDecode[];
extern const char *AcpiGbl_ShrDecode[];
extern const char *AcpiGbl_SizDecode[];
extern const char *AcpiGbl_TrsDecode[];
extern const char *AcpiGbl_TtpDecode[];
extern const char *AcpiGbl_TypDecode[];
#endif
/* Types for Resource descriptor entries */
#define ACPI_INVALID_RESOURCE 0
#define ACPI_FIXED_LENGTH 1
#define ACPI_VARIABLE_LENGTH 2
#define ACPI_SMALL_VARIABLE_LENGTH 3
typedef
ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
UINT8 *Aml,
UINT32 Length,
UINT32 Offset,
UINT8 ResourceIndex,
void *Context);
typedef
ACPI_STATUS (*ACPI_PKG_CALLBACK) (
UINT8 ObjectType,
@ -206,10 +247,6 @@ void
AcpiUtSubsystemShutdown (
void);
ACPI_STATUS
AcpiUtValidateFadt (
void);
/*
* utclib - Local implementations of C library functions
@ -434,24 +471,6 @@ AcpiUtPtrExit (
UINT32 ComponentId,
UINT8 *Ptr);
void
AcpiUtReportInfo (
char *ModuleName,
UINT32 LineNumber,
UINT32 ComponentId);
void
AcpiUtReportError (
char *ModuleName,
UINT32 LineNumber,
UINT32 ComponentId);
void
AcpiUtReportWarning (
char *ModuleName,
UINT32 LineNumber,
UINT32 ComponentId);
void
AcpiUtDumpBuffer (
UINT8 *Buffer,
@ -459,6 +478,29 @@ AcpiUtDumpBuffer (
UINT32 Display,
UINT32 componentId);
void
AcpiUtDumpBuffer2 (
UINT8 *Buffer,
UINT32 Count,
UINT32 Display);
void
AcpiUtReportError (
char *ModuleName,
UINT32 LineNumber);
void
AcpiUtReportInfo (
char *ModuleName,
UINT32 LineNumber);
void
AcpiUtReportWarning (
char *ModuleName,
UINT32 LineNumber);
/* Error and message reporting interfaces */
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrint (
UINT32 RequestedDebugLevel,
@ -467,7 +509,7 @@ AcpiUtDebugPrint (
char *ModuleName,
UINT32 ComponentId,
char *Format,
...) ACPI_PRINTF_LIKE_FUNC;
...) ACPI_PRINTF_LIKE(6);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrintRaw (
@ -477,7 +519,36 @@ AcpiUtDebugPrintRaw (
char *ModuleName,
UINT32 ComponentId,
char *Format,
...) ACPI_PRINTF_LIKE_FUNC;
...) ACPI_PRINTF_LIKE(6);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtError (
char *ModuleName,
UINT32 LineNumber,
char *Format,
...) ACPI_PRINTF_LIKE(3);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtException (
char *ModuleName,
UINT32 LineNumber,
ACPI_STATUS Status,
char *Format,
...) ACPI_PRINTF_LIKE(4);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtWarning (
char *ModuleName,
UINT32 LineNumber,
char *Format,
...) ACPI_PRINTF_LIKE(3);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtInfo (
char *ModuleName,
UINT32 LineNumber,
char *Format,
...) ACPI_PRINTF_LIKE(3);
/*
@ -665,6 +736,14 @@ AcpiUtShortDivide (
/*
* utmisc
*/
const char *
AcpiUtValidateException (
ACPI_STATUS Status);
BOOLEAN
AcpiUtIsAmlTable (
ACPI_TABLE_HEADER *Table);
ACPI_STATUS
AcpiUtAllocateOwnerId (
ACPI_OWNER_ID *OwnerId);
@ -693,9 +772,14 @@ BOOLEAN
AcpiUtValidAcpiName (
UINT32 Name);
ACPI_NAME
AcpiUtRepairName (
char *Name);
BOOLEAN
AcpiUtValidAcpiCharacter (
char Character);
AcpiUtValidAcpiChar (
char Character,
ACPI_NATIVE_UINT Position);
ACPI_STATUS
AcpiUtStrtoul64 (
@ -707,27 +791,6 @@ AcpiUtStrtoul64 (
#define ACPI_ANY_BASE 0
UINT32
AcpiUtGetDescriptorLength (
void *Aml);
UINT16
AcpiUtGetResourceLength (
void *Aml);
UINT8
AcpiUtGetResourceType (
void *Aml);
UINT8 *
AcpiUtGetResourceEndTag (
ACPI_OPERAND_OBJECT *ObjDesc);
UINT8
AcpiUtGenerateChecksum (
UINT8 *Buffer,
UINT32 Length);
UINT32
AcpiUtDwordByteSwap (
UINT32 Value);
@ -742,10 +805,46 @@ AcpiUtDisplayInitPathname (
UINT8 Type,
ACPI_NAMESPACE_NODE *ObjHandle,
char *Path);
#endif
/*
* utresrc
*/
ACPI_STATUS
AcpiUtWalkAmlResources (
UINT8 *Aml,
ACPI_SIZE AmlLength,
ACPI_WALK_AML_CALLBACK UserFunction,
void *Context);
ACPI_STATUS
AcpiUtValidateResource (
void *Aml,
UINT8 *ReturnIndex);
UINT32
AcpiUtGetDescriptorLength (
void *Aml);
UINT16
AcpiUtGetResourceLength (
void *Aml);
UINT8
AcpiUtGetResourceHeaderLength (
void *Aml);
UINT8
AcpiUtGetResourceType (
void *Aml);
ACPI_STATUS
AcpiUtGetResourceEndTag (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT8 **EndTag);
/*
* utmutex - mutex support
*/
@ -794,7 +893,7 @@ AcpiUtAllocate (
UINT32 Line);
void *
AcpiUtCallocate (
AcpiUtAllocateZeroed (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@ -809,7 +908,7 @@ AcpiUtAllocateAndTrack (
UINT32 Line);
void *
AcpiUtCallocateAndTrack (
AcpiUtAllocateZeroedAndTrack (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@ -830,6 +929,14 @@ void
AcpiUtDumpAllocations (
UINT32 Component,
char *Module);
ACPI_STATUS
AcpiUtCreateList (
char *ListName,
UINT16 ObjectSize,
ACPI_MEMORY_LIST **ReturnCache);
#endif
#endif /* _ACUTILS_H */

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -135,6 +135,7 @@
#include <contrib/dev/acpica/acapps.h>
extern FILE *AcpiGbl_DebugFile;
extern BOOLEAN AcpiGbl_IgnoreErrors;
/*
* Debug Regions
@ -145,6 +146,7 @@ typedef struct Region
UINT32 Length;
void *Buffer;
void *NextRegion;
UINT8 SpaceId;
} REGION;
@ -183,7 +185,7 @@ typedef union ptr_ovl
#define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\
AcpiOsPrintf PARAM_LIST(fp);}
void
void __cdecl
AeCtrlCHandler (
int Sig);
@ -229,7 +231,12 @@ AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
AeInstallHandlers (void);
AeInstallHandlers (
void);
void
AeMiscellaneousTests (
void);
#endif /* _AECOMMON */

View File

@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
* $Revision: 76 $
* $Revision: 1.94 $
*
******************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acdebug.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
#include <contrib/dev/acpica/acdisasm.h>
#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
@ -151,7 +152,6 @@ AcpiDbCheckTextModeCorruption (
static ACPI_STATUS
AeLocalLoadTable (
ACPI_TABLE_HEADER *TablePtr);
#endif
/*******************************************************************************
@ -250,8 +250,8 @@ AcpiDbCheckTextModeCorruption (
if (TableLength != FileLength)
{
ACPI_REPORT_WARNING ((
"File length (0x%X) is not the same as the table length (0x%X)\n",
ACPI_WARNING ((AE_INFO,
"File length (0x%X) is not the same as the table length (0x%X)",
FileLength, TableLength));
}
@ -277,6 +277,11 @@ AcpiDbCheckTextModeCorruption (
}
}
if (!Pairs)
{
return (AE_OK);
}
/*
* Entire table scanned, each CR is part of a CR/LF pair --
* meaning that the table was treated as a text file somewhere.
@ -316,61 +321,95 @@ AcpiDbReadTable (
UINT32 Actual;
ACPI_STATUS Status;
UINT32 FileSize;
BOOLEAN StandardHeader = TRUE;
/* Get the file size */
fseek (fp, 0, SEEK_END);
FileSize = (UINT32) ftell (fp);
fseek (fp, 0, SEEK_SET);
if (FileSize < 4)
{
return (AE_BAD_HEADER);
}
/* Read the signature */
if (fread (&TableHeader, 1, 4, fp) != 4)
{
AcpiOsPrintf ("Could not read the table signature\n");
return (AE_BAD_HEADER);
}
fseek (fp, 0, SEEK_SET);
/* The RSDT and FACS tables do not have standard ACPI headers */
if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
ACPI_COMPARE_NAME (TableHeader.Signature, "FACS"))
{
*TableLength = FileSize;
StandardHeader = FALSE;
}
else
{
/* Read the table header */
if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
sizeof (ACPI_TABLE_HEADER))
{
AcpiOsPrintf ("Could not read the table header\n");
return (AE_BAD_HEADER);
}
if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
sizeof (ACPI_TABLE_HEADER))
{
AcpiOsPrintf ("Could not read the table header\n");
return (AE_BAD_HEADER);
}
/* Validate the table header/length */
#if 0
/* Validate the table header/length */
Status = AcpiTbValidateTableHeader (&TableHeader);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Table header is invalid!\n");
return (Status);
}
Status = AcpiTbValidateTableHeader (&TableHeader);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Table header is invalid!\n");
return (Status);
}
#endif
/* File size must be at least as long as the Header-specified length */
/* File size must be at least as long as the Header-specified length */
if (TableHeader.Length > FileSize)
{
AcpiOsPrintf (
"TableHeader length [0x%X] greater than the input file size [0x%X]\n",
TableHeader.Length, FileSize);
return (AE_BAD_HEADER);
}
if (TableHeader.Length > FileSize)
{
AcpiOsPrintf (
"TableHeader length [0x%X] greater than the input file size [0x%X]\n",
TableHeader.Length, FileSize);
return (AE_BAD_HEADER);
}
/* We only support a limited number of table types */
#ifdef ACPI_OBSOLETE_CODE
/* We only support a limited number of table types */
if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
{
AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
(char *) TableHeader.Signature);
ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
return (AE_ERROR);
if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
{
AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
(char *) TableHeader.Signature);
ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
return (AE_ERROR);
}
#endif
*TableLength = TableHeader.Length;
}
/* Allocate a buffer for the table */
*TableLength = TableHeader.Length;
*Table = AcpiOsAllocate ((size_t) (FileSize));
*Table = AcpiOsAllocate ((size_t) FileSize);
if (!*Table)
{
AcpiOsPrintf (
"Could not allocate memory for ACPI table %4.4s (size=0x%X)\n",
TableHeader.Signature, TableHeader.Length);
TableHeader.Signature, *TableLength);
return (AE_NO_MEMORY);
}
@ -380,15 +419,19 @@ AcpiDbReadTable (
Actual = fread (*Table, 1, (size_t) FileSize, fp);
if (Actual == FileSize)
{
/* Now validate the checksum */
Status = AcpiTbVerifyTableChecksum (*Table);
if (Status == AE_BAD_CHECKSUM)
if (StandardHeader)
{
Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
FileSize, (*Table)->Length);
return (Status);
/* Now validate the checksum */
Status = AcpiTbChecksum ((void *) *Table,
ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length);
if (Status == AE_BAD_CHECKSUM)
{
Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
FileSize, (*Table)->Length);
return (Status);
}
}
return (AE_OK);
}
@ -429,11 +472,12 @@ static ACPI_STATUS
AeLocalLoadTable (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
ACPI_TABLE_DESC TableInfo;
ACPI_STATUS Status = AE_OK;
/* ACPI_TABLE_DESC TableInfo; */
ACPI_FUNCTION_TRACE ("AeLocalLoadTable");
ACPI_FUNCTION_TRACE (AeLocalLoadTable);
#if 0
if (!Table)
@ -473,9 +517,10 @@ AeLocalLoadTable (
{
/* Uninstall table and free the buffer */
AcpiTbDeleteTablesByType (ACPI_TABLE_DSDT);
AcpiTbDeleteTablesByType (ACPI_TABLE_ID_DSDT);
return_ACPI_STATUS (Status);
}
#endif
#endif
return_ACPI_STATUS (Status);
@ -552,6 +597,7 @@ AcpiDbGetTableFromFile (
#ifdef ACPI_APPLICATION
ACPI_STATUS Status;
ACPI_TABLE_HEADER *Table;
BOOLEAN IsAmlTable = TRUE;
Status = AcpiDbReadTableFromFile (Filename, &Table);
@ -560,28 +606,36 @@ AcpiDbGetTableFromFile (
return (Status);
}
/* Attempt to recognize and install the table */
#ifdef ACPI_DATA_TABLE_DISASSEMBLY
IsAmlTable = AcpiUtIsAmlTable (Table);
#endif
Status = AeLocalLoadTable (Table);
if (ACPI_FAILURE (Status))
if (IsAmlTable)
{
if (Status == AE_ALREADY_EXISTS)
/* Attempt to recognize and install the table */
Status = AeLocalLoadTable (Table);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Table %4.4s is already installed\n",
Table->Signature);
}
else
{
AcpiOsPrintf ("Could not install table, %s\n",
AcpiFormatException (Status));
if (Status == AE_ALREADY_EXISTS)
{
AcpiOsPrintf ("Table %4.4s is already installed\n",
Table->Signature);
}
else
{
AcpiOsPrintf ("Could not install table, %s\n",
AcpiFormatException (Status));
}
return (Status);
}
return (Status);
fprintf (stderr,
"Acpi table [%4.4s] successfully installed and loaded\n",
Table->Signature);
}
fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
Table->Signature);
AcpiGbl_AcpiHardwarePresent = FALSE;
if (ReturnTable)
{

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
* $Revision: 85 $
* $Revision: 1.101 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -202,16 +202,16 @@ AcpiDmFieldFlags (
UINT32 Flags;
/* The next Op contains the flags */
/* The next peer Op (not child op) contains the flags */
Op = AcpiPsGetDepthNext (NULL, Op);
Op = Op->Common.Next;
Flags = (UINT8) Op->Common.Value.Integer;
/* Mark the Op as completed */
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x0F]);
AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]);
AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
}
@ -340,14 +340,14 @@ AcpiDmMatchKeyword (
{
if (((UINT32) Op->Common.Value.Integer) >= ACPI_NUM_MATCH_OPS)
if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
{
AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
}
else
{
AcpiOsPrintf ("%s", (char *) (uintptr_t)
AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
}
}
@ -375,6 +375,8 @@ AcpiDmDisassembleOneOp (
const ACPI_OPCODE_INFO *OpInfo = NULL;
UINT32 Offset;
UINT32 Length;
ACPI_PARSE_OBJECT *Child;
ACPI_STATUS Status;
if (!Op)
@ -390,38 +392,52 @@ AcpiDmDisassembleOneOp (
AcpiDmMatchKeyword (Op);
return;
case ACPI_DASM_LNOT_SUFFIX:
switch (Op->Common.AmlOpcode)
{
case AML_LEQUAL_OP:
AcpiOsPrintf ("LNotEqual");
break;
case AML_LGREATER_OP:
AcpiOsPrintf ("LLessEqual");
break;
case AML_LLESS_OP:
AcpiOsPrintf ("LGreaterEqual");
break;
}
Op->Common.DisasmOpcode = 0;
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
return;
default:
break;
}
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
/* The op and arguments */
switch (Op->Common.AmlOpcode)
{
case AML_ZERO_OP:
case AML_LNOT_OP:
AcpiOsPrintf ("Zero");
Child = Op->Common.Value.Arg;
if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
(Child->Common.AmlOpcode == AML_LGREATER_OP) ||
(Child->Common.AmlOpcode == AML_LLESS_OP))
{
Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
}
else
{
AcpiOsPrintf ("%s", OpInfo->Name);
}
break;
case AML_ONE_OP:
AcpiOsPrintf ("One");
break;
case AML_ONES_OP:
AcpiOsPrintf ("Ones");
break;
case AML_REVISION_OP:
AcpiOsPrintf ("Revision");
break;
case AML_BYTE_OP:
AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
@ -481,12 +497,19 @@ AcpiDmDisassembleOneOp (
* types of buffers, we have to closely look at the data in the
* buffer to determine the type.
*/
if (AcpiDmIsResourceTemplate (Op))
Status = AcpiDmIsResourceTemplate (Op);
if (ACPI_SUCCESS (Status))
{
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
AcpiOsPrintf ("ResourceTemplate");
break;
}
else if (AcpiDmIsUnicodeBuffer (Op))
else if (Status == AE_AML_NO_RESOURCE_END_TAG)
{
AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
}
if (AcpiDmIsUnicodeBuffer (Op))
{
Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
AcpiOsPrintf ("Unicode (");
@ -543,7 +566,7 @@ AcpiDmDisassembleOneOp (
if (Info->BitOffset % 8 == 0)
{
AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
}
else
{
@ -556,8 +579,8 @@ AcpiDmDisassembleOneOp (
case AML_INT_ACCESSFIELD_OP:
AcpiOsPrintf ("AccessAs (%s, ",
AcpiGbl_AccessTypes [(UINT32) Op->Common.Value.Integer >> 8]);
AcpiOsPrintf (" AccessAs (%s, ",
AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]);
AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
AcpiOsPrintf (")");
@ -573,7 +596,6 @@ AcpiDmDisassembleOneOp (
case AML_INT_METHODCALL_OP:
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
Op = AcpiPsGetDepthNext (NULL, Op);
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
@ -585,7 +607,6 @@ AcpiDmDisassembleOneOp (
/* Just get the opcode name and print it */
OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
AcpiOsPrintf ("%s", OpInfo->Name);
@ -594,13 +615,15 @@ AcpiDmDisassembleOneOp (
if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
(WalkState) &&
(WalkState->Results) &&
(WalkState->Results->Results.NumResults))
(WalkState->ResultCount))
{
AcpiDmDecodeInternalObject (
WalkState->Results->Results.ObjDesc [
WalkState->Results->Results.NumResults-1]);
(WalkState->ResultCount - 1) %
ACPI_RESULTS_FRAME_OBJ_NUM]);
}
#endif
break;
}
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 111 $
* $Revision: 1.128 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -172,7 +172,7 @@ AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *RgnDesc;
ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
@ -181,7 +181,7 @@ AcpiExSetupRegion (
if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE (RgnDesc),
AcpiUtGetObjectTypeName (RgnDesc)));
@ -201,6 +201,17 @@ AcpiExSetupRegion (
}
}
/* Exit if Address/Length have been disallowed by the host OS */
if (RgnDesc->Common.Flags & AOPOBJ_INVALID)
{
return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
}
/*
* Exit now for SMBus address space, it has a non-linear address space
* and the request cannot be directly validated
*/
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
/* SMBus has a non-linear address space */
@ -227,9 +238,10 @@ 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)
{
@ -239,10 +251,10 @@ AcpiExSetupRegion (
* access width boundary.
*/
if (ACPI_ROUND_UP (RgnDesc->Region.Length,
ObjDesc->CommonField.AccessByteWidth) >=
ObjDesc->CommonField.AccessByteWidth) >=
(ObjDesc->CommonField.BaseByteOffset +
(ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
FieldDatumByteOffset))
(ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
FieldDatumByteOffset))
{
return_ACPI_STATUS (AE_OK);
}
@ -255,8 +267,8 @@ AcpiExSetupRegion (
* than the region itself. For example, a region of length one
* byte, and a field with Dword access specified.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
ACPI_ERROR ((AE_INFO,
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.AccessByteWidth,
AcpiUtGetNodeName (RgnDesc->Region.Node),
@ -267,8 +279,8 @@ AcpiExSetupRegion (
* Offset rounded up to next multiple of field width
* exceeds region length, indicate an error
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
ACPI_ERROR ((AE_INFO,
"Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
@ -312,7 +324,7 @@ AcpiExAccessRegion (
ACPI_PHYSICAL_ADDRESS Address;
ACPI_FUNCTION_TRACE ("ExAccessRegion");
ACPI_FUNCTION_TRACE (ExAccessRegion);
/*
@ -347,13 +359,13 @@ AcpiExAccessRegion (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
" Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
" Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId,
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
ACPI_FORMAT_UINT64 (Address)));
(void *) Address));
/* Invoke the appropriate AddressSpace/OpRegion handler */
@ -365,15 +377,15 @@ AcpiExAccessRegion (
{
if (Status == AE_NOT_IMPLEMENTED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Region %s(%X) not implemented\n",
ACPI_ERROR ((AE_INFO,
"Region %s(%X) not implemented",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
else if (Status == AE_NOT_EXIST)
{
ACPI_REPORT_ERROR ((
"Region %s(%X) has no handler\n",
ACPI_ERROR ((AE_INFO,
"Region %s(%X) has no handler",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
@ -459,7 +471,7 @@ AcpiExFieldDatumIo (
ACPI_INTEGER LocalValue;
ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
ACPI_FUNCTION_TRACE_U32 (ExFieldDatumIo, FieldDatumByteOffset);
if (ReadWrite == ACPI_READ)
@ -522,9 +534,9 @@ AcpiExFieldDatumIo (
* Length is the field width in bytes.
*/
ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
ObjDesc->BufferField.BaseByteOffset +
FieldDatumByteOffset,
Value, ObjDesc->CommonField.AccessByteWidth);
ObjDesc->BufferField.BaseByteOffset +
FieldDatumByteOffset,
Value, ObjDesc->CommonField.AccessByteWidth);
}
Status = AE_OK;
@ -538,7 +550,7 @@ AcpiExFieldDatumIo (
* the register
*/
if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj,
(ACPI_INTEGER) ObjDesc->BankField.Value))
(ACPI_INTEGER) ObjDesc->BankField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@ -548,8 +560,8 @@ AcpiExFieldDatumIo (
* (itself a RegionField) before we can access the data.
*/
Status = AcpiExInsertIntoField (ObjDesc->BankField.BankObj,
&ObjDesc->BankField.Value,
sizeof (ObjDesc->BankField.Value));
&ObjDesc->BankField.Value,
sizeof (ObjDesc->BankField.Value));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -569,7 +581,7 @@ AcpiExFieldDatumIo (
* Operation Region.
*/
Status = AcpiExAccessRegion (ObjDesc, FieldDatumByteOffset, Value,
ReadWrite);
ReadWrite);
break;
@ -581,7 +593,7 @@ AcpiExFieldDatumIo (
* the register
*/
if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj,
(ACPI_INTEGER) ObjDesc->IndexField.Value))
(ACPI_INTEGER) ObjDesc->IndexField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@ -591,41 +603,40 @@ AcpiExFieldDatumIo (
FieldDatumByteOffset += ObjDesc->IndexField.Value;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Write to Index Register: Value %8.8X\n",
FieldDatumByteOffset));
"Write to Index Register: Value %8.8X\n",
FieldDatumByteOffset));
Status = AcpiExInsertIntoField (ObjDesc->IndexField.IndexObj,
&FieldDatumByteOffset,
sizeof (FieldDatumByteOffset));
&FieldDatumByteOffset,
sizeof (FieldDatumByteOffset));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"I/O to Data Register: ValuePtr %p\n",
Value));
"I/O to Data Register: ValuePtr %p\n", Value));
if (ReadWrite == ACPI_READ)
{
/* Read the datum from the DataRegister */
Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
Value, sizeof (ACPI_INTEGER));
}
else
{
/* Write the datum to the DataRegister */
Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
Value, sizeof (ACPI_INTEGER));
Value, sizeof (ACPI_INTEGER));
}
break;
default:
ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n",
ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_INTERNAL;
break;
@ -680,7 +691,7 @@ AcpiExWriteWithUpdateRule (
ACPI_INTEGER CurrentValue;
ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
ACPI_FUNCTION_TRACE_U32 (ExWriteWithUpdateRule, Mask);
/* Start with the new bits */
@ -708,7 +719,7 @@ AcpiExWriteWithUpdateRule (
* the field, and merge with the new field value.
*/
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
&CurrentValue, ACPI_READ);
&CurrentValue, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -734,8 +745,8 @@ AcpiExWriteWithUpdateRule (
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"WriteWithUpdateRule: Unknown UpdateRule setting: %X\n",
ACPI_ERROR ((AE_INFO,
"Unknown UpdateRule value: %X",
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@ -752,7 +763,7 @@ AcpiExWriteWithUpdateRule (
/* Write the merged value */
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
&MergedValue, ACPI_WRITE);
&MergedValue, ACPI_WRITE);
return_ACPI_STATUS (Status);
}
@ -789,16 +800,16 @@ AcpiExExtractFromField (
UINT32 i;
ACPI_FUNCTION_TRACE ("ExExtractFromField");
ACPI_FUNCTION_TRACE (ExExtractFromField);
/* Validate target buffer and clear it */
if (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength))
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",
ACPI_ERROR ((AE_INFO,
"Field size %X (bits) is too large for buffer (%X)",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
@ -832,17 +843,27 @@ AcpiExExtractFromField (
FieldOffset += ObjDesc->CommonField.AccessByteWidth;
Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset,
&RawDatum, ACPI_READ);
&RawDatum, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Merge with previous datum if necessary */
MergedDatum |= RawDatum <<
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
/*
* Merge with previous datum if necessary.
*
* Note: Before the shift, check if the shift value will be larger than
* the integer size. If so, there is no need to perform the operation.
* This avoids the differences in behavior between different compilers
* concerning shift values larger than the target data width.
*/
if ((ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
{
MergedDatum |= RawDatum <<
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
}
if (i == DatumCount)
{
@ -853,7 +874,7 @@ AcpiExExtractFromField (
ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
BufferLength - BufferOffset));
BufferOffset += ObjDesc->CommonField.AccessByteWidth;
MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
@ -872,7 +893,7 @@ AcpiExExtractFromField (
ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
BufferLength - BufferOffset));
return_ACPI_STATUS (AE_OK);
}
@ -900,6 +921,7 @@ AcpiExInsertIntoField (
{
ACPI_STATUS Status;
ACPI_INTEGER Mask;
ACPI_INTEGER WidthMask;
ACPI_INTEGER MergedDatum;
ACPI_INTEGER RawDatum = 0;
UINT32 FieldOffset = 0;
@ -910,26 +932,43 @@ AcpiExInsertIntoField (
UINT32 i;
ACPI_FUNCTION_TRACE ("ExInsertIntoField");
ACPI_FUNCTION_TRACE (ExInsertIntoField);
/* Validate input buffer */
if (BufferLength < ACPI_ROUND_BITS_UP_TO_BYTES (
ObjDesc->CommonField.BitLength))
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",
ACPI_ERROR ((AE_INFO,
"Field size %X (bits) is too large for buffer (%X)",
ObjDesc->CommonField.BitLength, BufferLength));
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
/*
* Create the bitmasks used for bit insertion.
* Note: This if/else is used to bypass compiler differences with the
* shift operator
*/
if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
{
WidthMask = ACPI_INTEGER_MAX;
}
else
{
WidthMask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.AccessBitWidth);
}
Mask = WidthMask &
ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
/* Compute the number of datums (access width data items) */
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);
@ -938,7 +977,7 @@ AcpiExInsertIntoField (
ACPI_MEMCPY (&RawDatum, Buffer,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
BufferLength - BufferOffset));
MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
@ -956,13 +995,30 @@ AcpiExInsertIntoField (
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;
/*
* Start new output datum by merging with previous input datum
* if necessary.
*
* Note: Before the shift, check if the shift value will be larger than
* the integer size. If so, there is no need to perform the operation.
* This avoids the differences in behavior between different compilers
* concerning shift values larger than the target data width.
*/
if ((ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
{
MergedDatum = RawDatum >>
(ObjDesc->CommonField.AccessBitWidth -
ObjDesc->CommonField.StartFieldBitOffset);
}
else
{
MergedDatum = 0;
}
Mask = WidthMask;
if (i == DatumCount)
{

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
* $Revision: 81 $
* $Revision: 1.93 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -136,23 +136,22 @@
*
* DESCRIPTION: Implements a semaphore wait with a check to see if the
* semaphore is available immediately. If it is not, the
* interpreter is released.
* interpreter is released before waiting.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemWaitSemaphore (
ACPI_HANDLE Semaphore,
ACPI_SEMAPHORE Semaphore,
UINT16 Timeout)
{
ACPI_STATUS Status;
ACPI_STATUS Status2;
ACPI_FUNCTION_TRACE ("ExSystemWaitSemaphore");
ACPI_FUNCTION_TRACE (ExSystemWaitSemaphore);
Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
Status = AcpiOsWaitSemaphore (Semaphore, 1, ACPI_DO_NOT_WAIT);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
@ -162,7 +161,7 @@ AcpiExSystemWaitSemaphore (
{
/* We must wait, so unlock the interpreter */
AcpiExExitInterpreter ();
AcpiExRelinquishInterpreter ();
Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
@ -172,13 +171,60 @@ AcpiExSystemWaitSemaphore (
/* Reacquire the interpreter */
Status2 = AcpiExEnterInterpreter ();
if (ACPI_FAILURE (Status2))
{
/* Report fatal error, could not acquire interpreter */
AcpiExReacquireInterpreter ();
}
return_ACPI_STATUS (Status2);
}
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiExSystemWaitMutex
*
* PARAMETERS: Mutex - Mutex to wait on
* Timeout - Max time to wait
*
* RETURN: Status
*
* DESCRIPTION: Implements a mutex wait with a check to see if the
* mutex is available immediately. If it is not, the
* interpreter is released before waiting.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemWaitMutex (
ACPI_MUTEX Mutex,
UINT16 Timeout)
{
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (ExSystemWaitMutex);
Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
}
if (Status == AE_TIME)
{
/* We must wait, so unlock the interpreter */
AcpiExRelinquishInterpreter ();
Status = AcpiOsAcquireMutex (Mutex, Timeout);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"*** Thread awake after blocking, %s\n",
AcpiFormatException (Status)));
/* Reacquire the interpreter */
AcpiExReacquireInterpreter ();
}
return_ACPI_STATUS (Status);
@ -220,7 +266,7 @@ 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",
ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)",
HowLong));
Status = AE_AML_OPERAND_VALUE;
}
@ -250,110 +296,19 @@ ACPI_STATUS
AcpiExSystemDoSuspend (
ACPI_INTEGER HowLong)
{
ACPI_STATUS Status;
ACPI_FUNCTION_ENTRY ();
/* Since this thread will sleep, we must release the interpreter */
AcpiExExitInterpreter ();
AcpiExRelinquishInterpreter ();
AcpiOsSleep (HowLong);
/* And now we must get the interpreter again */
Status = AcpiExEnterInterpreter ();
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiExSystemAcquireMutex
*
* PARAMETERS: TimeDesc - The 'time to delay' object descriptor
* ObjDesc - The object descriptor for this op
*
* RETURN: Status
*
* DESCRIPTION: Provides an access point to perform synchronization operations
* within the AML. This function will cause a lock to be generated
* for the Mutex pointed to by ObjDesc.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemAcquireMutex (
ACPI_OPERAND_OBJECT *TimeDesc,
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Support for the _GL_ Mutex object -- go get the global lock */
if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
{
Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value);
return_ACPI_STATUS (Status);
}
Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore,
(UINT16) TimeDesc->Integer.Value);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
* FUNCTION: AcpiExSystemReleaseMutex
*
* PARAMETERS: ObjDesc - The object descriptor for this op
*
* RETURN: Status
*
* DESCRIPTION: Provides an access point to perform synchronization operations
* within the AML. This operation is a request to release a
* previously acquired Mutex. If the Mutex variable is set then
* it will be decremented.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemReleaseMutex (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE ("ExSystemReleaseMutex");
if (!ObjDesc)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Support for the _GL_ Mutex object -- release the global lock */
if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
{
Status = AcpiEvReleaseGlobalLock ();
return_ACPI_STATUS (Status);
}
Status = AcpiOsSignalSemaphore (ObjDesc->Mutex.Semaphore, 1);
return_ACPI_STATUS (Status);
AcpiExReacquireInterpreter ();
return (AE_OK);
}
@ -377,12 +332,12 @@ AcpiExSystemSignalEvent (
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE ("ExSystemSignalEvent");
ACPI_FUNCTION_TRACE (ExSystemSignalEvent);
if (ObjDesc)
{
Status = AcpiOsSignalSemaphore (ObjDesc->Event.Semaphore, 1);
Status = AcpiOsSignalSemaphore (ObjDesc->Event.OsSemaphore, 1);
}
return_ACPI_STATUS (Status);
@ -412,12 +367,12 @@ AcpiExSystemWaitEvent (
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE ("ExSystemWaitEvent");
ACPI_FUNCTION_TRACE (ExSystemWaitEvent);
if (ObjDesc)
{
Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore,
Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore,
(UINT16) TimeDesc->Integer.Value);
}
@ -442,7 +397,7 @@ AcpiExSystemResetEvent (
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status = AE_OK;
void *TempSemaphore;
ACPI_SEMAPHORE TempSemaphore;
ACPI_FUNCTION_ENTRY ();
@ -455,8 +410,8 @@ AcpiExSystemResetEvent (
Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
if (ACPI_SUCCESS (Status))
{
(void) AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore);
ObjDesc->Event.Semaphore = TempSemaphore;
(void) AcpiOsDeleteSemaphore (ObjDesc->Event.OsSemaphore);
ObjDesc->Event.OsSemaphore = TempSemaphore;
}
return (Status);

View File

@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
* $Revision: 162 $
* $Revision: 1.187 $
*
******************************************************************************/
@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,9 +130,9 @@
*
* FUNCTION: AcpiHwClearAcpiStatus
*
* PARAMETERS: Flags - Lock the hardware or not
* PARAMETERS: None
*
* RETURN: none
* RETURN: None
*
* DESCRIPTION: Clears all fixed and general purpose status bits
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
@ -141,26 +141,20 @@
ACPI_STATUS
AcpiHwClearAcpiStatus (
UINT32 Flags)
void)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS LockFlags = 0;
ACPI_FUNCTION_TRACE ("HwClearAcpiStatus");
ACPI_FUNCTION_TRACE (HwClearAcpiStatus);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
ACPI_BITMASK_ALL_FIXED_STATUS,
(UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
(UINT16) AcpiGbl_FADT.XPm1aEventBlock.Address));
if (Flags & ACPI_MTX_LOCK)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_STATUS,
@ -172,10 +166,10 @@ AcpiHwClearAcpiStatus (
/* Clear the fixed events */
if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
if (AcpiGbl_FADT.XPm1bEventBlock.Address)
{
Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS,
&AcpiGbl_FADT->XPm1bEvtBlk);
&AcpiGbl_FADT.XPm1bEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@ -187,10 +181,7 @@ AcpiHwClearAcpiStatus (
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
UnlockAndExit:
if (Flags & ACPI_MTX_LOCK)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
}
AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
return_ACPI_STATUS (Status);
}
@ -217,11 +208,10 @@ AcpiGetSleepTypeData (
UINT8 *SleepTypeB)
{
ACPI_STATUS Status = AE_OK;
ACPI_PARAMETER_INFO Info;
char *SleepStateName;
ACPI_EVALUATE_INFO *Info;
ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData");
ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData);
/* Validate parameters */
@ -232,64 +222,70 @@ AcpiGetSleepTypeData (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
/* Allocate the evaluation information block */
Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
if (!Info)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]);
/* Evaluate the namespace object containing the values for this state */
Info.Parameters = NULL;
Info.ReturnObject = NULL;
SleepStateName = (char *) (uintptr_t) AcpiGbl_SleepStateNames[SleepState];
Status = AcpiNsEvaluateByName (SleepStateName, &Info);
Status = AcpiNsEvaluate (Info);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"%s while evaluating SleepState [%s]\n",
AcpiFormatException (Status), SleepStateName));
AcpiFormatException (Status), Info->Pathname));
return_ACPI_STATUS (Status);
goto Cleanup;
}
/* Must have a return object */
if (!Info.ReturnObject)
if (!Info->ReturnObject)
{
ACPI_REPORT_ERROR (("No Sleep State object returned from [%s]\n",
SleepStateName));
ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]",
Info->Pathname));
Status = AE_NOT_EXIST;
}
/* It must be of type Package */
else if (ACPI_GET_OBJECT_TYPE (Info.ReturnObject) != ACPI_TYPE_PACKAGE)
else if (ACPI_GET_OBJECT_TYPE (Info->ReturnObject) != ACPI_TYPE_PACKAGE)
{
ACPI_REPORT_ERROR (("Sleep State return object is not a Package\n"));
ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package"));
Status = AE_AML_OPERAND_TYPE;
}
/*
* The package must have at least two elements. NOTE (March 2005): This
* The package must have at least two elements. NOTE (March 2005): This
* goes against the current ACPI spec which defines this object as a
* package with one encoded DWORD element. However, existing practice
* package with one encoded DWORD element. However, existing practice
* by BIOS vendors seems to be to have 2 or more elements, at least
* one per sleep type (A/B).
*/
else if (Info.ReturnObject->Package.Count < 2)
else if (Info->ReturnObject->Package.Count < 2)
{
ACPI_REPORT_ERROR ((
"Sleep State return package does not have at least two elements\n"));
ACPI_ERROR ((AE_INFO,
"Sleep State return package does not have at least two elements"));
Status = AE_AML_NO_OPERAND;
}
/* The first two elements must both be of type Integer */
else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0])
else if ((ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[0])
!= ACPI_TYPE_INTEGER) ||
(ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1])
(ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[1])
!= ACPI_TYPE_INTEGER))
{
ACPI_REPORT_ERROR ((
"Sleep State return package elements are not both Integers (%s, %s)\n",
AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[0]),
AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[1])));
ACPI_ERROR ((AE_INFO,
"Sleep State return package elements are not both Integers (%s, %s)",
AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]),
AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1])));
Status = AE_AML_OPERAND_TYPE;
}
else
@ -297,24 +293,28 @@ AcpiGetSleepTypeData (
/* Valid _Sx_ package size, type, and value */
*SleepTypeA = (UINT8)
(Info.ReturnObject->Package.Elements[0])->Integer.Value;
(Info->ReturnObject->Package.Elements[0])->Integer.Value;
*SleepTypeB = (UINT8)
(Info.ReturnObject->Package.Elements[1])->Integer.Value;
(Info->ReturnObject->Package.Elements[1])->Integer.Value;
}
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"%s While evaluating SleepState [%s], bad Sleep object %p type %s\n",
AcpiFormatException (Status),
SleepStateName, Info.ReturnObject,
AcpiUtGetObjectTypeName (Info.ReturnObject)));
ACPI_EXCEPTION ((AE_INFO, Status,
"While evaluating SleepState [%s], bad Sleep object %p type %s",
Info->Pathname, Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
}
AcpiUtRemoveReference (Info.ReturnObject);
AcpiUtRemoveReference (Info->ReturnObject);
Cleanup:
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData)
/*******************************************************************************
*
@ -332,12 +332,12 @@ ACPI_BIT_REGISTER_INFO *
AcpiHwGetBitRegisterInfo (
UINT32 RegisterId)
{
ACPI_FUNCTION_NAME ("HwGetBitRegisterInfo");
ACPI_FUNCTION_ENTRY ();
if (RegisterId > ACPI_BITREG_MAX)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid BitRegister ID: %X\n", RegisterId));
ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId));
return (NULL);
}
@ -351,9 +351,8 @@ AcpiHwGetBitRegisterInfo (
*
* PARAMETERS: RegisterId - ID of ACPI BitRegister to access
* ReturnValue - Value that was read from the register
* Flags - Lock the hardware or not
*
* RETURN: Status and the value read from specified Register. Value
* RETURN: Status and the value read from specified Register. Value
* returned is normalized to bit0 (is shifted all the way right)
*
* DESCRIPTION: ACPI BitRegister read function.
@ -363,15 +362,14 @@ AcpiHwGetBitRegisterInfo (
ACPI_STATUS
AcpiGetRegister (
UINT32 RegisterId,
UINT32 *ReturnValue,
UINT32 Flags)
UINT32 *ReturnValue)
{
UINT32 RegisterValue = 0;
ACPI_BIT_REGISTER_INFO *BitRegInfo;
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("AcpiGetRegister");
ACPI_FUNCTION_TRACE (AcpiGetRegister);
/* Get the info structure corresponding to the requested ACPI Register */
@ -382,24 +380,10 @@ AcpiGetRegister (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (Flags & ACPI_MTX_LOCK)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
/* Read from the register */
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
BitRegInfo->ParentRegister, &RegisterValue);
if (Flags & ACPI_MTX_LOCK)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
}
Status = AcpiHwRegisterRead (ACPI_MTX_LOCK,
BitRegInfo->ParentRegister, &RegisterValue);
if (ACPI_SUCCESS (Status))
{
@ -411,12 +395,14 @@ AcpiGetRegister (
*ReturnValue = RegisterValue;
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
RegisterValue, BitRegInfo->ParentRegister));
RegisterValue, BitRegInfo->ParentRegister));
}
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiGetRegister)
/*******************************************************************************
*
@ -425,7 +411,6 @@ AcpiGetRegister (
* PARAMETERS: RegisterId - ID of ACPI BitRegister to access
* Value - (only used on write) value to write to the
* Register, NOT pre-normalized to the bit pos
* Flags - Lock the hardware or not
*
* RETURN: Status
*
@ -436,15 +421,15 @@ AcpiGetRegister (
ACPI_STATUS
AcpiSetRegister (
UINT32 RegisterId,
UINT32 Value,
UINT32 Flags)
UINT32 Value)
{
UINT32 RegisterValue = 0;
ACPI_BIT_REGISTER_INFO *BitRegInfo;
ACPI_STATUS Status;
ACPI_CPU_FLAGS LockFlags;
ACPI_FUNCTION_TRACE_U32 ("AcpiSetRegister", RegisterId);
ACPI_FUNCTION_TRACE_U32 (AcpiSetRegister, RegisterId);
/* Get the info structure corresponding to the requested ACPI Register */
@ -452,18 +437,11 @@ AcpiSetRegister (
BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
if (!BitRegInfo)
{
ACPI_REPORT_ERROR (("Bad ACPI HW RegisterId: %X\n", RegisterId));
ACPI_ERROR ((AE_INFO, "Bad ACPI HW RegisterId: %X", RegisterId));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
if (Flags & ACPI_MTX_LOCK)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
}
LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
/* Always do a register read first so we can insert the new bits */
@ -486,8 +464,8 @@ AcpiSetRegister (
case ACPI_REGISTER_PM1_STATUS:
/*
* Status Registers are different from the rest. Clear by
* writing 1, and writing 0 has no effect. So, the only relevant
* Status Registers are different from the rest. Clear by
* writing 1, and writing 0 has no effect. So, the only relevant
* information is the single bit we're interested in, all others should
* be written as 0 so they will be left unchanged.
*/
@ -505,7 +483,7 @@ AcpiSetRegister (
case ACPI_REGISTER_PM1_ENABLE:
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
BitRegInfo->AccessBitMask, Value);
BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
@ -519,10 +497,11 @@ AcpiSetRegister (
* Note that at this level, the fact that there are actually TWO
* registers (A and B - and B may not exist) is abstracted.
*/
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", RegisterValue));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n",
RegisterValue));
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
BitRegInfo->AccessBitMask, Value);
BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
@ -540,16 +519,14 @@ AcpiSetRegister (
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
RegisterValue,
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
AcpiGbl_FADT->XPm2CntBlk.Address))));
ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
BitRegInfo->AccessBitMask, Value);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
RegisterValue,
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (
AcpiGbl_FADT->XPm2CntBlk.Address))));
ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
@ -563,10 +540,7 @@ AcpiSetRegister (
UnlockAndExit:
if (Flags & ACPI_MTX_LOCK)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
}
AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
/* Normalize the value that was read */
@ -575,23 +549,24 @@ AcpiSetRegister (
BitRegInfo->BitPosition));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
Value, RegisterValue, BitRegInfo->ParentRegister));
Value, RegisterValue, BitRegInfo->ParentRegister));
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiSetRegister)
/******************************************************************************
*
* FUNCTION: AcpiHwRegisterRead
*
* PARAMETERS: UseLock - Mutex hw access
* RegisterId - RegisterID + Offset
* PARAMETERS: UseLock - Lock hardware? True/False
* RegisterId - ACPI Register ID
* ReturnValue - Where the register value is returned
*
* RETURN: Status and the value read.
*
* DESCRIPTION: Acpi register read function. Registers are read at the
* given offset.
* DESCRIPTION: Read from the specified ACPI register
*
******************************************************************************/
@ -604,25 +579,22 @@ AcpiHwRegisterRead (
UINT32 Value1 = 0;
UINT32 Value2 = 0;
ACPI_STATUS Status;
ACPI_CPU_FLAGS LockFlags = 0;
ACPI_FUNCTION_TRACE ("HwRegisterRead");
ACPI_FUNCTION_TRACE (HwRegisterRead);
if (ACPI_MTX_LOCK == UseLock)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
}
switch (RegisterId)
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk);
Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@ -630,7 +602,7 @@ AcpiHwRegisterRead (
/* PM1B is optional */
Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk);
Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bEventBlock);
Value1 |= Value2;
break;
@ -652,35 +624,35 @@ AcpiHwRegisterRead (
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk);
Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aControlBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk);
Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bControlBlock);
Value1 |= Value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk);
Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk);
Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT.XPmTimerBlock);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
Status = AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value1, 8);
Status = AcpiOsReadPort (AcpiGbl_FADT.SmiCommand, &Value1, 8);
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n",
ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
RegisterId));
Status = AE_BAD_PARAMETER;
break;
@ -689,7 +661,7 @@ AcpiHwRegisterRead (
UnlockAndExit:
if (ACPI_MTX_LOCK == UseLock)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
}
if (ACPI_SUCCESS (Status))
@ -705,14 +677,26 @@ AcpiHwRegisterRead (
*
* FUNCTION: AcpiHwRegisterWrite
*
* PARAMETERS: UseLock - Mutex hw access
* RegisterId - RegisterID + Offset
* PARAMETERS: UseLock - Lock hardware? True/False
* RegisterId - ACPI Register ID
* Value - The value to write
*
* RETURN: Status
*
* DESCRIPTION: Acpi register Write function. Registers are written at the
* given offset.
* DESCRIPTION: Write to the specified ACPI register
*
* NOTE: In accordance with the ACPI specification, this function automatically
* preserves the value of the following bits, meaning that these bits cannot be
* changed via this interface:
*
* PM1_CONTROL[0] = SCI_EN
* PM1_CONTROL[9]
* PM1_STATUS[11]
*
* ACPI References:
* 1) Hardware Ignored Bits: When software writes to a register with ignored
* bit fields, it preserves the ignored bit fields
* 2) SCI_EN: OSPM always preserves this bit position
*
******************************************************************************/
@ -723,25 +707,38 @@ AcpiHwRegisterWrite (
UINT32 Value)
{
ACPI_STATUS Status;
ACPI_CPU_FLAGS LockFlags = 0;
UINT32 ReadValue;
ACPI_FUNCTION_TRACE ("HwRegisterWrite");
ACPI_FUNCTION_TRACE (HwRegisterWrite);
if (ACPI_MTX_LOCK == UseLock)
{
Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
}
switch (RegisterId)
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk);
/* Perform a read first to preserve certain bits (per ACPI spec) */
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_STATUS, &ReadValue);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
/* Insert the bits to be preserved */
ACPI_INSERT_BITS (Value, ACPI_PM1_STATUS_PRESERVED_BITS, ReadValue);
/* Now we can write the data */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@ -749,11 +746,11 @@ AcpiHwRegisterWrite (
/* PM1B is optional */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk);
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bEventBlock);
break;
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable);
if (ACPI_FAILURE (Status))
@ -769,37 +766,55 @@ AcpiHwRegisterWrite (
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
/*
* Perform a read first to preserve certain bits (per ACPI spec)
*
* Note: This includes SCI_EN, we never want to change this bit
*/
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
ACPI_REGISTER_PM1_CONTROL, &ReadValue);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
/* Insert the bits to be preserved */
ACPI_INSERT_BITS (Value, ACPI_PM1_CONTROL_PRESERVED_BITS, ReadValue);
/* Now we can write the data */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk);
Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk);
Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT.XPmTimerBlock);
break;
@ -807,7 +822,7 @@ AcpiHwRegisterWrite (
/* SMI_CMD is currently always in IO space */
Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8);
Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
break;
@ -819,7 +834,7 @@ AcpiHwRegisterWrite (
UnlockAndExit:
if (ACPI_MTX_LOCK == UseLock)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
}
return_ACPI_STATUS (Status);
@ -850,7 +865,7 @@ AcpiHwLowLevelRead (
ACPI_STATUS Status;
ACPI_FUNCTION_NAME ("HwLowLevelRead");
ACPI_FUNCTION_NAME (HwLowLevelRead);
/*
@ -863,10 +878,10 @@ AcpiHwLowLevelRead (
return (AE_OK);
}
/* Get a local copy of the address. Handles possible alignment issues */
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
if (!ACPI_VALID_ADDRESS (Address))
if (!Address)
{
return (AE_OK);
}
@ -876,34 +891,31 @@ AcpiHwLowLevelRead (
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
*/
switch (Reg->AddressSpaceId)
switch (Reg->SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Status = AcpiOsReadMemory (
(ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
Value, Width);
(ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
Value, Width);
Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, Width);
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unsupported address space: %X\n", Reg->AddressSpaceId));
ACPI_ERROR ((AE_INFO,
"Unsupported address space: %X", Reg->SpaceId));
return (AE_BAD_PARAMETER);
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
*Value, Width,
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)),
AcpiUtGetRegionName (Reg->AddressSpaceId)));
*Value, Width, ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
}
@ -933,7 +945,7 @@ AcpiHwLowLevelWrite (
ACPI_STATUS Status;
ACPI_FUNCTION_NAME ("HwLowLevelWrite");
ACPI_FUNCTION_NAME (HwLowLevelWrite);
/*
@ -946,10 +958,10 @@ AcpiHwLowLevelWrite (
return (AE_OK);
}
/* Get a local copy of the address. Handles possible alignment issues */
/* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
if (!ACPI_VALID_ADDRESS (Address))
if (!Address)
{
return (AE_OK);
}
@ -958,34 +970,32 @@ AcpiHwLowLevelWrite (
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
*/
switch (Reg->AddressSpaceId)
switch (Reg->SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Status = AcpiOsWriteMemory (
(ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
Value, Width);
(ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
Value, Width);
Status = AcpiOsWritePort (
(ACPI_IO_ADDRESS) Address, Value, Width);
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unsupported address space: %X\n", Reg->AddressSpaceId));
ACPI_ERROR ((AE_INFO,
"Unsupported address space: %X", Reg->SpaceId));
return (AE_BAD_PARAMETER);
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
"Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
Value, Width,
ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)),
AcpiUtGetRegionName (Reg->AddressSpaceId)));
Value, Width, ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
}

View File

@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -130,8 +130,6 @@
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acdebug.h>
#include <contrib/dev/acpica/compiler/aslcompiler.h>
#define _COMPONENT ACPI_OS_SERVICES
ACPI_MODULE_NAME ("osunixxf")
@ -139,6 +137,10 @@
extern FILE *AcpiGbl_DebugFile;
FILE *AcpiGbl_OutputFile;
ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
void);
/******************************************************************************
*
@ -172,22 +174,20 @@ AcpiOsTerminate (void)
*
* FUNCTION: AcpiOsGetRootPointer
*
* PARAMETERS: Flags - Logical or physical addressing mode
* Address - Where the address is returned
* PARAMETERS: None
*
* RETURN: Status
* RETURN: RSDP physical address
*
* DESCRIPTION: Gets the root pointer (RSDP)
*
*****************************************************************************/
ACPI_STATUS
ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
UINT32 Flags,
ACPI_POINTER *Address)
void)
{
return (AeLocalGetRootPointer(Flags, (ACPI_PHYSICAL_ADDRESS *) Address));
return (AeLocalGetRootPointer ());
}
@ -252,7 +252,7 @@ AcpiOsTableOverride (
/* This code exercises the table override mechanism in the core */
if (!ACPI_STRNCMP (ExistingTable->Signature, DSDT_SIG, ACPI_NAME_SIZE))
if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
{
/* override DSDT with itself */
@ -458,7 +458,6 @@ AcpiOsGetLine (
*
* PARAMETERS: where Physical address of memory to be mapped
* length How much memory to map
* there Logical address of mapped memory
*
* RETURN: Pointer to mapped memory. Null on error.
*
@ -466,15 +465,13 @@ AcpiOsGetLine (
*
*****************************************************************************/
ACPI_STATUS
void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS where,
ACPI_SIZE length,
void **there)
ACPI_SIZE length)
{
*there = ACPI_TO_POINTER (where);
return AE_OK;
return (ACPI_TO_POINTER ((ACPI_NATIVE_UINT) where));
}
@ -652,7 +649,7 @@ AcpiOsSignalSemaphore (
ACPI_STATUS
AcpiOsCreateLock (
ACPI_HANDLE *OutHandle)
ACPI_SPINLOCK *OutHandle)
{
return (AcpiOsCreateSemaphore (1, 1, OutHandle));
@ -660,13 +657,13 @@ AcpiOsCreateLock (
void
AcpiOsDeleteLock (
ACPI_HANDLE Handle)
ACPI_SPINLOCK Handle)
{
AcpiOsDeleteSemaphore (Handle);
}
ACPI_NATIVE_UINT
ACPI_CPU_FLAGS
AcpiOsAcquireLock (
ACPI_HANDLE Handle)
{
@ -677,8 +674,8 @@ AcpiOsAcquireLock (
void
AcpiOsReleaseLock (
ACPI_HANDLE Handle,
ACPI_NATIVE_UINT Flags)
ACPI_SPINLOCK Handle,
ACPI_CPU_FLAGS Flags)
{
AcpiOsSignalSemaphore (Handle, 1);
}
@ -735,21 +732,21 @@ AcpiOsRemoveInterruptHandler (
/******************************************************************************
*
* FUNCTION: AcpiOsQueueForExecution
* FUNCTION: AcpiOsExecute
*
* PARAMETERS: Priority - Requested execution priority
* PARAMETERS: Type - Type of execution
* Function - Address of the function to execute
* Context - Passed as a parameter to the function
*
* RETURN: Status.
*
* DESCRIPTION: Sleep at microsecond granularity
* DESCRIPTION: Execute a new thread
*
*****************************************************************************/
ACPI_STATUS
AcpiOsQueueForExecution (
UINT32 Priority,
AcpiOsExecute (
ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context)
{
@ -776,8 +773,6 @@ AcpiOsBreakpoint (
char *Msg)
{
/* Print the message and do an INT 3 */
if (Msg)
{
AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
@ -787,7 +782,6 @@ AcpiOsBreakpoint (
AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
}
return AE_OK;
}
@ -869,6 +863,55 @@ AcpiOsGetTimer (void)
}
/******************************************************************************
*
* FUNCTION: AcpiOsValidateInterface
*
* PARAMETERS: Interface - Requested interface to be validated
*
* RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
*
* DESCRIPTION: Match an interface string to the interfaces supported by the
* host. Strings originate from an AML call to the _OSI method.
*
*****************************************************************************/
ACPI_STATUS
AcpiOsValidateInterface (
char *Interface)
{
return (AE_SUPPORT);
}
/******************************************************************************
*
* FUNCTION: AcpiOsValidateAddress
*
* PARAMETERS: SpaceId - ACPI space ID
* Address - Physical address
* Length - Address length
*
* RETURN: AE_OK if Address/Length is valid for the SpaceId. Otherwise,
* should return AE_AML_ILLEGAL_ADDRESS.
*
* DESCRIPTION: Validate a system address via the host OS. Used to validate
* the addresses accessed by AML operation regions.
*
*****************************************************************************/
ACPI_STATUS
AcpiOsValidateAddress (
UINT8 SpaceId,
ACPI_PHYSICAL_ADDRESS Address,
ACPI_SIZE Length)
{
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AcpiOsReadPciConfiguration
@ -1060,7 +1103,7 @@ AcpiOsWriteMemory (
}
UINT32
ACPI_THREAD_ID
AcpiOsGetThreadId(void)
{
return getpid();

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
* $Revision: 146 $
* $Revision: 1.171 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -224,7 +224,7 @@ AcpiPsCompleteThisOp (
ACPI_PARSE_OBJECT *ReplacementOp = NULL;
ACPI_FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op);
/* Check for null Op, can happen if AML code is corrupt */
@ -415,13 +415,12 @@ AcpiPsNextParseState (
ACPI_STATUS Status = AE_CTRL_PENDING;
ACPI_FUNCTION_TRACE_PTR ("PsNextParseState", Op);
ACPI_FUNCTION_TRACE_PTR (PsNextParseState, Op);
switch (CallbackStatus)
{
case AE_CTRL_TERMINATE:
/*
* A control method was terminated via a RETURN statement.
* The walk of this method is complete.
@ -438,13 +437,14 @@ AcpiPsNextParseState (
Status = AE_CTRL_BREAK;
break;
case AE_CTRL_CONTINUE:
case AE_CTRL_CONTINUE:
ParserState->Aml = WalkState->AmlLastWhile;
Status = AE_CTRL_CONTINUE;
break;
case AE_CTRL_PENDING:
ParserState->Aml = WalkState->AmlLastWhile;
@ -459,17 +459,16 @@ AcpiPsNextParseState (
#endif
case AE_CTRL_TRUE:
/*
* Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package
*/
ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
Status = AE_CTRL_PENDING;
break;
case AE_CTRL_FALSE:
/*
* Either an IF/WHILE Predicate was false or we encountered a BREAK
* opcode. In both cases, we do not execute the rest of the
@ -538,7 +537,7 @@ AcpiPsParseAml (
ACPI_WALK_STATE *PreviousWalkState;
ACPI_FUNCTION_TRACE ("PsParseAml");
ACPI_FUNCTION_TRACE (PsParseAml);
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"Entered with WalkState=%p Aml=%p size=%X\n",
@ -551,10 +550,21 @@ AcpiPsParseAml (
Thread = AcpiUtCreateThreadState ();
if (!Thread)
{
AcpiDsDeleteWalkState (WalkState);
return_ACPI_STATUS (AE_NO_MEMORY);
}
WalkState->Thread = Thread;
/*
* If executing a method, the starting SyncLevel is this method's
* SyncLevel
*/
if (WalkState->MethodDesc)
{
WalkState->Thread->CurrentSyncLevel = WalkState->MethodDesc->Method.SyncLevel;
}
AcpiDsPushWalkState (WalkState, Thread);
/*
@ -592,6 +602,10 @@ AcpiPsParseAml (
* Transfer control to the called control method
*/
Status = AcpiDsCallControlMethod (Thread, WalkState, NULL);
if (ACPI_FAILURE (Status))
{
Status = AcpiDsMethodError (Status, WalkState);
}
/*
* If the transfer to the new method method call worked, a new walk
@ -606,26 +620,30 @@ AcpiPsParseAml (
}
else if ((Status != AE_OK) && (WalkState->MethodDesc))
{
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
/* Either the method parse or actual execution failed */
ACPI_ERROR_METHOD ("Method parse/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))
(!WalkState->MethodDesc->Method.Mutex))
{
ACPI_INFO ((AE_INFO, "Marking method %4.4s as Serialized",
WalkState->MethodNode->Name.Ascii));
/*
* This method is marked NotSerialized, but it tried to create
* Method tried to create an object twice. The probable cause is
* that the method cannot handle reentrancy.
*
* The 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
* Workaround this problem by marking the method permanently
* as Serialized.
*/
WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED;
WalkState->MethodDesc->Method.Concurrency = 1;
WalkState->MethodDesc->Method.SyncLevel = 0;
}
}
@ -638,25 +656,19 @@ AcpiPsParseAml (
AcpiDsScopeStackClear (WalkState);
/*
* If we just returned from the execution of a control method,
* there's lots of cleanup to do
* If we just returned from the execution of a control method or if we
* encountered an error during the method parse phase, there's lots of
* cleanup to do
*/
if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE)
if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) ||
(ACPI_FAILURE (Status)))
{
if (WalkState->MethodDesc)
{
/* Decrement the thread count on the method parse tree */
WalkState->MethodDesc->Method.ThreadCount--;
}
AcpiDsTerminateControlMethod (WalkState);
AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
}
/* Delete this walk state and all linked control states */
AcpiPsCleanupScope (&WalkState->ParserState);
PreviousWalkState = WalkState;
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
* $Revision: 66 $
* $Revision: 1.78 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -154,9 +154,10 @@ AcpiRsCreateResourceList (
UINT8 *AmlStart;
ACPI_SIZE ListSizeNeeded = 0;
UINT32 AmlBufferLength;
void *Resource;
ACPI_FUNCTION_TRACE ("RsCreateResourceList");
ACPI_FUNCTION_TRACE (RsCreateResourceList);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n",
@ -191,8 +192,9 @@ AcpiRsCreateResourceList (
/* Do the conversion */
Status = AcpiRsConvertAmlToResources (AmlStart, AmlBufferLength,
OutputBuffer->Pointer);
Resource = OutputBuffer->Pointer;
Status = AcpiUtWalkAmlResources (AmlStart, AmlBufferLength,
AcpiRsConvertAmlToResources, &Resource);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@ -243,7 +245,7 @@ AcpiRsCreatePciRoutingTable (
ACPI_BUFFER PathBuffer;
ACPI_FUNCTION_TRACE ("RsCreatePciRoutingTable");
ACPI_FUNCTION_TRACE (RsCreatePciRoutingTable);
/* Params already validated, so we don't re-validate here */
@ -300,8 +302,8 @@ AcpiRsCreatePciRoutingTable (
if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X]) Need sub-package, found %s\n",
ACPI_ERROR ((AE_INFO,
"(PRT[%X]) Need sub-package, found %s",
Index, AcpiUtGetObjectTypeName (*TopObjectList)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@ -310,8 +312,8 @@ AcpiRsCreatePciRoutingTable (
if ((*TopObjectList)->Package.Count != 4)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X]) Need package of length 4, found length %d\n",
ACPI_ERROR ((AE_INFO,
"(PRT[%X]) Need package of length 4, found length %d",
Index, (*TopObjectList)->Package.Count));
return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
}
@ -332,8 +334,8 @@ AcpiRsCreatePciRoutingTable (
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Address) Need Integer, found %s\n",
ACPI_ERROR ((AE_INFO,
"(PRT[%X].Address) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
@ -347,78 +349,83 @@ AcpiRsCreatePciRoutingTable (
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Pin) Need Integer, found %s\n",
ACPI_ERROR ((AE_INFO,
"(PRT[%X].Pin) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/* 3) Third subobject: Dereference the PRT.SourceName */
/*
* 3) Third subobject: Dereference the PRT.SourceName
* The name may be unresolved (slack mode), so allow a null object
*/
ObjDesc = SubObjectList[2];
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
if (ObjDesc)
{
case ACPI_TYPE_LOCAL_REFERENCE:
if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Source) Need name, found reference op %X\n",
Index, ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_BAD_DATA);
case ACPI_TYPE_LOCAL_REFERENCE:
if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
{
ACPI_ERROR ((AE_INFO,
"(PRT[%X].Source) Need name, found reference op %X",
Index, ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_BAD_DATA);
}
Node = ObjDesc->Reference.Node;
/* Use *remaining* length of the buffer as max for pathname */
PathBuffer.Length = OutputBuffer->Length -
(UINT32) ((UINT8 *) UserPrt->Source -
(UINT8 *) OutputBuffer->Pointer);
PathBuffer.Pointer = UserPrt->Source;
Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
/* +1 to include null terminator */
UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1;
break;
case ACPI_TYPE_STRING:
ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
/*
* Add to the Length field the length of the string
* (add 1 for terminator)
*/
UserPrt->Length += ObjDesc->String.Length + 1;
break;
case ACPI_TYPE_INTEGER:
/*
* If this is a number, then the Source Name is NULL, since the
* entire buffer was zeroed out, we can leave this alone.
*
* Add to the Length field the length of the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
break;
default:
ACPI_ERROR ((AE_INFO,
"(PRT[%X].Source) Need Ref/String/Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
Node = ObjDesc->Reference.Node;
/* Use *remaining* length of the buffer as max for pathname */
PathBuffer.Length = OutputBuffer->Length -
(UINT32) ((UINT8 *) UserPrt->Source -
(UINT8 *) OutputBuffer->Pointer);
PathBuffer.Pointer = UserPrt->Source;
Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
/* +1 to include null terminator */
UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1;
break;
case ACPI_TYPE_STRING:
ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
/*
* Add to the Length field the length of the string
* (add 1 for terminator)
*/
UserPrt->Length += ObjDesc->String.Length + 1;
break;
case ACPI_TYPE_INTEGER:
/*
* If this is a number, then the Source Name is NULL, since the
* entire buffer was zeroed out, we can leave this alone.
*
* Add to the Length field the length of the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
break;
default:
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/* Now align the current length */
UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BITS (UserPrt->Length);
UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BIT (UserPrt->Length);
/* 4) Fourth subobject: Dereference the PRT.SourceIndex */
@ -429,8 +436,8 @@ AcpiRsCreatePciRoutingTable (
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"(PRT[%X].SourceIndex) Need Integer, found %s\n",
ACPI_ERROR ((AE_INFO,
"(PRT[%X].SourceIndex) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
@ -473,7 +480,7 @@ AcpiRsCreateAmlResources (
ACPI_SIZE AmlSizeNeeded = 0;
ACPI_FUNCTION_TRACE ("RsCreateAmlResources");
ACPI_FUNCTION_TRACE (RsCreateAmlResources);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n",

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
* $Revision: 1.54 $
* $Revision: 1.62 $
*
******************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -119,7 +119,6 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acresrc.h>
#include <contrib/dev/acpica/acdisasm.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsdump")
@ -204,9 +203,9 @@ AcpiRsDumpDescriptor (
ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HEDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LLDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_SHRDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode},
{ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL},
{ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL}
};
@ -214,9 +213,9 @@ ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] =
ACPI_RSDUMP_INFO AcpiRsDumpDma[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TYPDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BMDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SIZDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL},
{ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL}
};
@ -265,7 +264,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] =
ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL},
{ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL},
@ -275,7 +274,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] =
ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL},
@ -285,7 +284,7 @@ ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] =
ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL},
{ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL}
};
@ -342,9 +341,9 @@ ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HEDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LLDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_SHRDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode},
{ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL},
{ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL},
{ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL}
@ -368,26 +367,26 @@ static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
{
{ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DECDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode}
};
static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
{
{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", "Memory Range"},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RWDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MEMDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MTPDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TTPDecode}
{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode}
};
static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
{
{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", "I/O Range"},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RNGDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TTPDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TRSDecode}
{ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"},
{ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode},
{ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode}
};
@ -421,8 +420,8 @@ AcpiRsDumpDescriptor (
void *Resource,
ACPI_RSDUMP_INFO *Table)
{
void *Target = NULL;
void *PreviousTarget;
UINT8 *Target = NULL;
UINT8 *PreviousTarget;
char *Name;
UINT8 Count;
@ -434,7 +433,7 @@ AcpiRsDumpDescriptor (
while (Count)
{
PreviousTarget = Target;
Target = ((UINT8 *) Resource) + Table->Offset;
Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
Name = Table->Name;
switch (Table->Opcode)
@ -452,41 +451,41 @@ AcpiRsDumpDescriptor (
/* Strings */
case ACPI_RSD_LITERAL:
AcpiRsOutString (Name, (char *) (uintptr_t) Table->Pointer);
AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
break;
case ACPI_RSD_STRING:
AcpiRsOutString (Name, (char *) (uintptr_t) Target);
AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
break;
/* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8:
AcpiRsOutInteger8 (Name, *(UINT8 *) Target);
AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
break;
case ACPI_RSD_UINT16:
AcpiRsOutInteger16 (Name, *(UINT16 *) Target);
AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
break;
case ACPI_RSD_UINT32:
AcpiRsOutInteger32 (Name, *(UINT32 *) Target);
AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
break;
case ACPI_RSD_UINT64:
AcpiRsOutInteger64 (Name, *(UINT64 *) Target);
AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
break;
/* Flags: 1-bit and 2-bit flags supported */
case ACPI_RSD_1BITFLAG:
AcpiRsOutString (Name, (char *) (uintptr_t)
((const char **) (uintptr_t) Table->Pointer)[(*(UINT8 *) Target) & 0x01]);
AcpiRsOutString (Name, ACPI_CAST_PTR (char,
Table->Pointer [*Target & 0x01]));
break;
case ACPI_RSD_2BITFLAG:
AcpiRsOutString (Name, (char *) (uintptr_t)
((const char **) (uintptr_t) Table->Pointer)[(*(UINT8 *) Target) & 0x03]);
AcpiRsOutString (Name, ACPI_CAST_PTR (char,
Table->Pointer [*Target & 0x03]));
break;
case ACPI_RSD_SHORTLIST:
@ -497,8 +496,7 @@ AcpiRsDumpDescriptor (
if (PreviousTarget)
{
AcpiRsOutTitle (Name);
AcpiRsDumpShortByteList (*((UINT8 *) PreviousTarget),
(UINT8 *) Target);
AcpiRsDumpShortByteList (*PreviousTarget, Target);
}
break;
@ -509,8 +507,7 @@ AcpiRsDumpDescriptor (
*/
if (PreviousTarget)
{
AcpiRsDumpByteList (*((UINT16 *) PreviousTarget),
(UINT8 *) Target);
AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
}
break;
@ -521,8 +518,8 @@ AcpiRsDumpDescriptor (
*/
if (PreviousTarget)
{
AcpiRsDumpDwordList (*((UINT8 *) PreviousTarget),
(UINT32 *) Target);
AcpiRsDumpDwordList (*PreviousTarget,
ACPI_CAST_PTR (UINT32, Target));
}
break;
@ -530,14 +527,14 @@ AcpiRsDumpDescriptor (
/*
* Common flags for all Address resources
*/
AcpiRsDumpAddressCommon ((ACPI_RESOURCE_DATA *) Target);
AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
break;
case ACPI_RSD_SOURCE:
/*
* Optional ResourceSource for Address resources
*/
AcpiRsDumpResourceSource ((ACPI_RESOURCE_SOURCE *) Target);
AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
break;
default:
@ -691,7 +688,7 @@ AcpiRsDumpResourceList (
/* Point to the next resource structure */
ResourceList = ACPI_PTR_ADD (ACPI_RESOURCE, ResourceList,
ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
ResourceList->Length);
/* Exit when END_TAG descriptor is reached */
@ -737,8 +734,8 @@ AcpiRsDumpIrqList (
AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE,
((UINT8 *) PrtElement) + PrtElement->Length);
PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
PrtElement, PrtElement->Length);
}
}
@ -762,7 +759,12 @@ AcpiRsOutString (
char *Title,
char *Value)
{
AcpiOsPrintf ("%27s : %s\n", Title, Value);
AcpiOsPrintf ("%27s : %s", Title, Value);
if (!*Value)
{
AcpiOsPrintf ("[NULL NAMESTRING]");
}
AcpiOsPrintf ("\n");
}
static void

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
* $Revision: 1.126 $
* $Revision: 1.133 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -212,14 +212,14 @@ AcpiUtTrimFunctionName (
/* All Function names are longer than 4 chars, check is safe */
if (*((UINT32 *) (uintptr_t) FunctionName) == ACPI_PREFIX_MIXED)
if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
{
/* This is the case where the original source has not been modified */
return (FunctionName + 4);
}
if (*((UINT32 *) (uintptr_t) FunctionName) == ACPI_PREFIX_LOWER)
if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
{
/* This is the case where the source has been 'linuxized' */
@ -259,7 +259,7 @@ AcpiUtDebugPrint (
char *Format,
...)
{
UINT32 ThreadId;
ACPI_THREAD_ID ThreadId;
va_list args;
@ -276,7 +276,6 @@ AcpiUtDebugPrint (
* Thread tracking and context switch notification
*/
ThreadId = AcpiOsGetThreadId ();
if (ThreadId != AcpiGbl_PrevThreadId)
{
if (ACPI_LV_THREADS & AcpiDbgLevel)
@ -307,6 +306,8 @@ AcpiUtDebugPrint (
AcpiOsVprintf (Format, args);
}
ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint)
/*******************************************************************************
*
@ -350,6 +351,8 @@ AcpiUtDebugPrintRaw (
AcpiOsVprintf (Format, args);
}
ACPI_EXPORT_SYMBOL (AcpiUtDebugPrintRaw)
/*******************************************************************************
*
@ -383,6 +386,8 @@ AcpiUtTrace (
"%s\n", AcpiGbl_FnEntryStr);
}
ACPI_EXPORT_SYMBOL (AcpiUtTrace)
/*******************************************************************************
*
@ -519,6 +524,8 @@ AcpiUtExit (
AcpiGbl_NestingLevel--;
}
ACPI_EXPORT_SYMBOL (AcpiUtExit)
/*******************************************************************************
*
@ -564,6 +571,8 @@ AcpiUtStatusExit (
AcpiGbl_NestingLevel--;
}
ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
/*******************************************************************************
*
@ -599,6 +608,8 @@ AcpiUtValueExit (
AcpiGbl_NestingLevel--;
}
ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
/*******************************************************************************
*
@ -652,11 +663,10 @@ AcpiUtPtrExit (
******************************************************************************/
void
AcpiUtDumpBuffer (
AcpiUtDumpBuffer2 (
UINT8 *Buffer,
UINT32 Count,
UINT32 Display,
UINT32 ComponentId)
UINT32 Display)
{
ACPI_NATIVE_UINT i = 0;
ACPI_NATIVE_UINT j;
@ -664,14 +674,6 @@ AcpiUtDumpBuffer (
UINT8 BufChar;
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
(ComponentId & AcpiDbgLayer)))
{
return;
}
if ((Count < 4) || (Count & 0x01))
{
Display = DB_BYTE_DISPLAY;
@ -700,6 +702,7 @@ AcpiUtDumpBuffer (
switch (Display)
{
case DB_BYTE_DISPLAY:
default: /* Default is BYTE display */
AcpiOsPrintf ("%02X ", Buffer[i + j]);
@ -766,3 +769,39 @@ AcpiUtDumpBuffer (
return;
}
/*******************************************************************************
*
* FUNCTION: AcpiUtDumpBuffer
*
* PARAMETERS: Buffer - Buffer to dump
* Count - Amount to dump, in bytes
* Display - BYTE, WORD, DWORD, or QWORD display
* ComponentID - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
******************************************************************************/
void
AcpiUtDumpBuffer (
UINT8 *Buffer,
UINT32 Count,
UINT32 Display,
UINT32 ComponentId)
{
/* Only dump the buffer if tracing is enabled */
if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
(ComponentId & AcpiDbgLayer)))
{
return;
}
AcpiUtDumpBuffer2 (Buffer, Count, Display);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: uteval - Object evaluation
* $Revision: 54 $
* $Revision: 1.71 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -138,6 +138,37 @@ AcpiUtTranslateOneCid (
ACPI_COMPATIBLE_ID *OneCid);
/*
* Strings supported by the _OSI predefined (internal) method.
*/
static const char *AcpiInterfacesSupported[] =
{
/* Operating System Vendor Strings */
"Linux",
"Windows 2000",
"Windows 2001",
"Windows 2001 SP0",
"Windows 2001 SP1",
"Windows 2001 SP2",
"Windows 2001 SP3",
"Windows 2001 SP4",
"Windows 2001.1",
"Windows 2001.1 SP1", /* Added 03/2006 */
"Windows 2006", /* Added 03/2006 */
/* Feature Group Strings */
"Extended Address Space Descriptor"
/*
* All "optional" feature group strings (features that are implemented
* by the host) should be implemented in the host version of
* AcpiOsValidateInterface and should not be added here.
*/
};
/*******************************************************************************
*
* FUNCTION: AcpiUtOsiImplementation
@ -146,8 +177,7 @@ AcpiUtTranslateOneCid (
*
* RETURN: Status
*
* DESCRIPTION: Implementation of _OSI predefined control method
* Supported = _OSI (String)
* DESCRIPTION: Implementation of the _OSI predefined control method
*
******************************************************************************/
@ -155,12 +185,13 @@ ACPI_STATUS
AcpiUtOsiImplementation (
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *StringDesc;
ACPI_OPERAND_OBJECT *ReturnDesc;
ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("UtOsiImplementation");
ACPI_FUNCTION_TRACE (UtOsiImplementation);
/* Validate the string input argument */
@ -171,7 +202,7 @@ AcpiUtOsiImplementation (
return_ACPI_STATUS (AE_TYPE);
}
/* Create a return object (Default value = 0) */
/* Create a return object */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
@ -179,21 +210,39 @@ AcpiUtOsiImplementation (
return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Compare input string to table of supported strings */
/* Default return value is SUPPORTED */
for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++)
ReturnDesc->Integer.Value = ACPI_UINT32_MAX;
WalkState->ReturnDesc = ReturnDesc;
/* Compare input string to static table of supported interfaces */
for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++)
{
if (!ACPI_STRCMP (StringDesc->String.Pointer,
(char *) (uintptr_t) AcpiGbl_ValidOsiStrings[i]))
if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i]))
{
/* This string is supported */
/* The interface is supported */
ReturnDesc->Integer.Value = 0xFFFFFFFF;
break;
return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
}
WalkState->ReturnDesc = ReturnDesc;
/*
* Did not match the string in the static table, call the host OSL to
* check for a match with one of the optional strings (such as
* "Module Device", "3.0 Thermal Model", etc.)
*/
Status = AcpiOsValidateInterface (StringDesc->String.Pointer);
if (ACPI_SUCCESS (Status))
{
/* The interface is supported */
return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
/* The interface is not supported */
ReturnDesc->Integer.Value = 0;
return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
@ -224,21 +273,29 @@ AcpiUtEvaluateObject (
UINT32 ExpectedReturnBtypes,
ACPI_OPERAND_OBJECT **ReturnDesc)
{
ACPI_PARAMETER_INFO Info;
ACPI_EVALUATE_INFO *Info;
ACPI_STATUS Status;
UINT32 ReturnBtype;
ACPI_FUNCTION_TRACE ("UtEvaluateObject");
ACPI_FUNCTION_TRACE (UtEvaluateObject);
Info.Node = PrefixNode;
Info.Parameters = NULL;
Info.ParameterType = ACPI_PARAM_ARGS;
/* Allocate the evaluation information block */
Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
if (!Info)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
Info->PrefixNode = PrefixNode;
Info->Pathname = Path;
Info->ParameterType = ACPI_PARAM_ARGS;
/* Evaluate the object/method */
Status = AcpiNsEvaluateRelative (Path, &Info);
Status = AcpiNsEvaluate (Info);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@ -248,31 +305,31 @@ AcpiUtEvaluateObject (
}
else
{
ACPI_REPORT_METHOD_ERROR ("Method execution failed",
ACPI_ERROR_METHOD ("Method execution failed",
PrefixNode, Path, Status);
}
return_ACPI_STATUS (Status);
goto Cleanup;
}
/* Did we get a return object? */
if (!Info.ReturnObject)
if (!Info->ReturnObject)
{
if (ExpectedReturnBtypes)
{
ACPI_REPORT_METHOD_ERROR ("No object was returned from",
ACPI_ERROR_METHOD ("No object was returned from",
PrefixNode, Path, AE_NOT_EXIST);
return_ACPI_STATUS (AE_NOT_EXIST);
Status = AE_NOT_EXIST;
}
return_ACPI_STATUS (AE_OK);
goto Cleanup;
}
/* Map the return object type to the bitmapped type */
switch (ACPI_GET_OBJECT_TYPE (Info.ReturnObject))
switch (ACPI_GET_OBJECT_TYPE (Info->ReturnObject))
{
case ACPI_TYPE_INTEGER:
ReturnBtype = ACPI_BTYPE_INTEGER;
@ -303,32 +360,36 @@ AcpiUtEvaluateObject (
* happen frequently if the "implicit return" feature is enabled.
* Just delete the return object and return AE_OK.
*/
AcpiUtRemoveReference (Info.ReturnObject);
return_ACPI_STATUS (AE_OK);
AcpiUtRemoveReference (Info->ReturnObject);
goto Cleanup;
}
/* Is the return object one of the expected types? */
if (!(ExpectedReturnBtypes & ReturnBtype))
{
ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
ACPI_ERROR_METHOD ("Return object type is incorrect",
PrefixNode, Path, AE_TYPE);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Type returned from %s was incorrect: %s, expected Btypes: %X\n",
Path, AcpiUtGetObjectTypeName (Info.ReturnObject),
ACPI_ERROR ((AE_INFO,
"Type returned from %s was incorrect: %s, expected Btypes: %X",
Path, AcpiUtGetObjectTypeName (Info->ReturnObject),
ExpectedReturnBtypes));
/* On error exit, we must delete the return object */
AcpiUtRemoveReference (Info.ReturnObject);
return_ACPI_STATUS (AE_TYPE);
AcpiUtRemoveReference (Info->ReturnObject);
Status = AE_TYPE;
goto Cleanup;
}
/* Object type is OK, return it */
*ReturnDesc = Info.ReturnObject;
return_ACPI_STATUS (AE_OK);
*ReturnDesc = Info->ReturnObject;
Cleanup:
ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
@ -359,7 +420,7 @@ AcpiUtEvaluateNumericObject (
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject");
ACPI_FUNCTION_TRACE (UtEvaluateNumericObject);
Status = AcpiUtEvaluateObject (DeviceNode, ObjectName,
@ -445,7 +506,7 @@ AcpiUtExecute_HID (
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("UtExecute_HID");
ACPI_FUNCTION_TRACE (UtExecute_HID);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID,
@ -558,7 +619,7 @@ AcpiUtExecute_CID (
ACPI_NATIVE_UINT i;
ACPI_FUNCTION_TRACE ("UtExecute_CID");
ACPI_FUNCTION_TRACE (UtExecute_CID);
/* Evaluate the _CID method for this device */
@ -584,7 +645,7 @@ AcpiUtExecute_CID (
Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
sizeof (ACPI_COMPATIBLE_ID_LIST));
CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
CidList = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Size);
if (!CidList)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@ -629,7 +690,7 @@ AcpiUtExecute_CID (
if (ACPI_FAILURE (Status))
{
ACPI_MEM_FREE (CidList);
ACPI_FREE (CidList);
}
else
{
@ -668,7 +729,7 @@ AcpiUtExecute_UID (
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("UtExecute_UID");
ACPI_FUNCTION_TRACE (UtExecute_UID);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID,
@ -724,7 +785,7 @@ AcpiUtExecute_STA (
ACPI_STATUS Status;
ACPI_FUNCTION_TRACE ("UtExecute_STA");
ACPI_FUNCTION_TRACE (UtExecute_STA);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA,
@ -737,7 +798,7 @@ AcpiUtExecute_STA (
"_STA on %4.4s was not found, assuming device is present\n",
AcpiUtGetNodeName (DeviceNode)));
*Flags = 0x0F;
*Flags = ACPI_UINT32_MAX;
Status = AE_OK;
}
@ -781,14 +842,14 @@ AcpiUtExecute_Sxds (
UINT32 i;
ACPI_FUNCTION_TRACE ("UtExecute_Sxds");
ACPI_FUNCTION_TRACE (UtExecute_Sxds);
for (i = 0; i < 4; i++)
{
Highest[i] = 0xFF;
Status = AcpiUtEvaluateObject (DeviceNode,
(char *) (uintptr_t) AcpiGbl_HighestDstateNames[i],
ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]),
ACPI_BTYPE_INTEGER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
@ -796,7 +857,7 @@ AcpiUtExecute_Sxds (
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"%s on Device %4.4s, %s\n",
(char *) (uintptr_t) AcpiGbl_HighestDstateNames[i],
ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]),
AcpiUtGetNodeName (DeviceNode),
AcpiFormatException (Status)));

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 202 $
* $Revision: 1.249 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@ -120,96 +120,12 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
/*******************************************************************************
*
* FUNCTION: AcpiFormatException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. A valid pointer is
* always returned.
*
* DESCRIPTION: This function translates an ACPI exception into an ASCII string.
*
******************************************************************************/
const char *
AcpiFormatException (
ACPI_STATUS Status)
{
ACPI_STATUS SubStatus;
const char *Exception = NULL;
ACPI_FUNCTION_NAME ("FormatException");
SubStatus = (Status & ~AE_CODE_MASK);
switch (Status & AE_CODE_MASK)
{
case AE_CODE_ENVIRONMENTAL:
if (SubStatus <= AE_CODE_ENV_MAX)
{
Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
}
break;
case AE_CODE_PROGRAMMER:
if (SubStatus <= AE_CODE_PGM_MAX)
{
Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
}
break;
case AE_CODE_ACPI_TABLES:
if (SubStatus <= AE_CODE_TBL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
}
break;
case AE_CODE_AML:
if (SubStatus <= AE_CODE_AML_MAX)
{
Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
}
break;
case AE_CODE_CONTROL:
if (SubStatus <= AE_CODE_CTRL_MAX)
{
Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
}
break;
default:
break;
}
if (!Exception)
{
/* Exception code was not recognized */
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Unknown exception code: 0x%8.8X\n", Status));
return ((const char *) "UNKNOWN_STATUS_CODE");
}
return ((const char *) Exception);
}
/*******************************************************************************
*
* Static global variable initialization.
@ -234,7 +150,6 @@ UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
UINT32 AcpiGbl_NestingLevel = 0;
/* Debugger globals */
BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
@ -249,8 +164,6 @@ UINT32 AcpiGbl_StartupFlags = 0;
BOOLEAN AcpiGbl_Shutdown = TRUE;
const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
{
"\\_S0_",
@ -269,28 +182,46 @@ const char *AcpiGbl_HighestDstateNames[4] =
"_S4D"
};
/*
* Strings supported by the _OSI predefined (internal) method.
* When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
*/
const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS] =
/*******************************************************************************
*
* FUNCTION: AcpiFormatException
*
* PARAMETERS: Status - The ACPI_STATUS code to be formatted
*
* RETURN: A string containing the exception text. A valid pointer is
* always returned.
*
* DESCRIPTION: This function translates an ACPI exception into an ASCII string
* It is here instead of utxface.c so it is always present.
*
******************************************************************************/
const char *
AcpiFormatException (
ACPI_STATUS Status)
{
/* Operating System Vendor Strings */
const char *Exception = NULL;
"Linux",
"Windows 2000",
"Windows 2001",
"Windows 2001.1",
"Windows 2001 SP0",
"Windows 2001 SP1",
"Windows 2001 SP2",
"Windows 2001 SP3",
"Windows 2001 SP4",
/* Feature Group Strings */
ACPI_FUNCTION_ENTRY ();
"Extended Address Space Descriptor"
};
Exception = AcpiUtValidateException (Status);
if (!Exception)
{
/* Exception code was not recognized */
ACPI_ERROR ((AE_INFO,
"Unknown exception code: 0x%8.8X", Status));
Exception = "UNKNOWN_STATUS_CODE";
}
return (ACPI_CAST_PTR (const char, Exception));
}
ACPI_EXPORT_SYMBOL (AcpiFormatException)
/*******************************************************************************
@ -401,35 +332,6 @@ AcpiUtHexToAsciiChar (
}
/*******************************************************************************
*
* Table name globals
*
* NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
* it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
* that are not used by the subsystem are simply ignored.
*
* Do NOT add any table to this list that is not consumed directly by this
* subsystem (No MADT, ECDT, SBST, etc.)
*
******************************************************************************/
ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] =
{
/*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
/* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
/* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
/* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
/* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
/* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
/* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
/* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
};
/******************************************************************************
*
* Event and Hardware globals
@ -493,7 +395,6 @@ ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS] =
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
"SystemMemory",
"SystemIO",
"PCI_Config",
@ -502,7 +403,6 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
"CMOS",
"PCIBARTarget",
"DataTable"
/*! [End] no source code translation !*/
};
@ -520,7 +420,7 @@ AcpiUtGetRegionName (
return ("InvalidSpaceId");
}
return ((char *) (uintptr_t) AcpiGbl_RegionTypes[SpaceId]);
return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
}
@ -540,13 +440,11 @@ AcpiUtGetRegionName (
static const char *AcpiGbl_EventTypes[ACPI_NUM_FIXED_EVENTS] =
{
/*! [Begin] no source code translation (keep these strings as-is) */
"PM_Timer",
"GlobalLock",
"PowerButton",
"SleepButton",
"RealTimeClock",
/*! [End] no source code translation !*/
};
@ -560,7 +458,7 @@ AcpiUtGetEventName (
return ("InvalidEventID");
}
return ((char *) (uintptr_t) AcpiGbl_EventTypes[EventId]);
return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
}
@ -590,7 +488,6 @@ static const char AcpiGbl_BadType[] = "UNDEFINED";
static const char *AcpiGbl_NsTypeNames[] =
{
/*! [Begin] no source code translation (keep these strings as-is) */
/* 00 */ "Untyped",
/* 01 */ "Integer",
/* 02 */ "String",
@ -622,7 +519,6 @@ static const char *AcpiGbl_NsTypeNames[] =
/* 28 */ "Extra",
/* 29 */ "Data",
/* 30 */ "Invalid"
/*! [End] no source code translation !*/
};
@ -633,10 +529,10 @@ AcpiUtGetTypeName (
if (Type > ACPI_TYPE_INVALID)
{
return ((char *) (uintptr_t) AcpiGbl_BadType);
return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
return ((char *) (uintptr_t) AcpiGbl_NsTypeNames[Type]);
return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
}
@ -690,16 +586,16 @@ AcpiUtGetNodeName (
/* Descriptor must be a namespace node */
if (Node->Descriptor != ACPI_DESC_TYPE_NAMED)
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
return ("####");
}
/* Name must be a valid ACPI name */
if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii))
if (!AcpiUtValidAcpiName (Node->Name.Integer))
{
return ("????");
Node->Name.Integer = AcpiUtRepairName (Node->Name.Ascii);
}
/* Return the name */
@ -724,7 +620,6 @@ AcpiUtGetNodeName (
static const char *AcpiGbl_DescTypeNames[] =
{
/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
/* 00 */ "Invalid",
/* 01 */ "Cached",
/* 02 */ "State-Generic",
@ -741,7 +636,6 @@ static const char *AcpiGbl_DescTypeNames[] =
/* 13 */ "Parser",
/* 14 */ "Operand",
/* 15 */ "Node"
/*! [End] no source code translation !*/
};
@ -757,10 +651,11 @@ AcpiUtGetDescriptorName (
if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
{
return ((char *) (uintptr_t) AcpiGbl_BadType);
return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
return ((char *) (uintptr_t) AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]);
return (ACPI_CAST_PTR (char,
AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
}
@ -788,7 +683,7 @@ AcpiUtGetMutexName (
UINT32 MutexId)
{
if (MutexId > MAX_MUTEX)
if (MutexId > ACPI_MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
@ -847,7 +742,7 @@ AcpiUtInitGlobals (
UINT32 i;
ACPI_FUNCTION_TRACE ("UtInitGlobals");
ACPI_FUNCTION_TRACE (UtInitGlobals);
/* Create all memory caches */
@ -858,25 +753,24 @@ AcpiUtInitGlobals (
return;
}
/* ACPI table structure */
for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
{
AcpiGbl_TableLists[i].Next = NULL;
AcpiGbl_TableLists[i].Count = 0;
}
/* Mutex locked flags */
for (i = 0; i < NUM_MUTEX; i++)
for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiGbl_MutexInfo[i].Mutex = NULL;
AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
AcpiGbl_MutexInfo[i].UseCount = 0;
}
for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
{
AcpiGbl_OwnerIdMask[i] = 0;
}
AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
/* GPE support */
AcpiGpeCount = 0;
AcpiGbl_GpeXruptListHead = NULL;
AcpiGbl_GpeFadtBlocks[0] = NULL;
AcpiGbl_GpeFadtBlocks[1] = NULL;
@ -888,31 +782,23 @@ AcpiUtInitGlobals (
AcpiGbl_ExceptionHandler = NULL;
AcpiGbl_InitHandler = NULL;
/* Global "typed" ACPI table pointers */
AcpiGbl_RSDP = NULL;
AcpiGbl_XSDT = NULL;
AcpiGbl_FACS = NULL;
AcpiGbl_FADT = NULL;
AcpiGbl_DSDT = NULL;
/* Global Lock support */
AcpiGbl_GlobalLockSemaphore = NULL;
AcpiGbl_GlobalLockMutex = NULL;
AcpiGbl_GlobalLockAcquired = FALSE;
AcpiGbl_GlobalLockThreadCount = 0;
AcpiGbl_GlobalLockHandle = 0;
/* Miscellaneous variables */
AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
AcpiGbl_RsdpOriginalLocation = 0;
AcpiGbl_CmSingleStep = FALSE;
AcpiGbl_DbTerminateThreads = FALSE;
AcpiGbl_Shutdown = FALSE;
AcpiGbl_NsLookupCount = 0;
AcpiGbl_PsFindCount = 0;
AcpiGbl_AcpiHardwarePresent = TRUE;
AcpiGbl_OwnerIdMask = 0;
AcpiGbl_LastOwnerIdIndex = 0;
AcpiGbl_NextOwnerIdOffset = 0;
AcpiGbl_TraceMethodName = 0;
AcpiGbl_TraceDbgLevel = 0;
AcpiGbl_TraceDbgLayer = 0;
@ -927,9 +813,8 @@ AcpiUtInitGlobals (
/* Namespace */
AcpiGbl_RootNode = NULL;
AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
AcpiGbl_RootNodeStruct.Child = NULL;
AcpiGbl_RootNodeStruct.Peer = NULL;
@ -941,7 +826,17 @@ AcpiUtInitGlobals (
AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;
#endif
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiGbl_DisplayFinalMemStats = FALSE;
#endif
return_VOID;
}
/* Public globals */
ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
ACPI_EXPORT_SYMBOL (AcpiGpeCount)