Merge two bug fixes from the vendor branch.

Reported by:	pjd
This commit is contained in:
Jung-uk Kim 2013-01-28 20:37:32 +00:00
commit 6f4860fc7d
4 changed files with 40 additions and 22 deletions

View File

@ -95,7 +95,6 @@ AcpiOsCreateCache (
/* Populate the cache object and return it */
ACPI_MEMSET (Cache, 0, sizeof (ACPI_MEMORY_LIST));
Cache->LinkOffset = 8;
Cache->ListName = CacheName;
Cache->ObjectSize = ObjectSize;
Cache->MaxDepth = MaxDepth;
@ -121,7 +120,7 @@ ACPI_STATUS
AcpiOsPurgeCache (
ACPI_MEMORY_LIST *Cache)
{
char *Next;
void *Next;
ACPI_STATUS Status;
@ -145,8 +144,7 @@ AcpiOsPurgeCache (
{
/* Delete and unlink one cached state object */
Next = *(ACPI_CAST_INDIRECT_PTR (char,
&(((char *) Cache->ListHead)[Cache->LinkOffset])));
Next = ACPI_GET_DESCRIPTOR_PTR (Cache->ListHead);
ACPI_FREE (Cache->ListHead);
Cache->ListHead = Next;
@ -251,8 +249,7 @@ AcpiOsReleaseObject (
/* Put the object at the head of the cache list */
* (ACPI_CAST_INDIRECT_PTR (char,
&(((char *) Object)[Cache->LinkOffset]))) = Cache->ListHead;
ACPI_SET_DESCRIPTOR_PTR (Object, Cache->ListHead);
Cache->ListHead = Object;
Cache->CurrentDepth++;
@ -307,8 +304,7 @@ AcpiOsAcquireObject (
/* There is an object available, use it */
Object = Cache->ListHead;
Cache->ListHead = *(ACPI_CAST_INDIRECT_PTR (char,
&(((char *) Object)[Cache->LinkOffset])));
Cache->ListHead = ACPI_GET_DESCRIPTOR_PTR (Object);
Cache->CurrentDepth--;

View File

@ -325,10 +325,12 @@
* where a pointer to an object of type ACPI_OPERAND_OBJECT can also
* appear. This macro is used to distinguish them.
*
* The "Descriptor" field is the first field in both structures.
* The "DescriptorType" field is the second field in both structures.
*/
#define ACPI_GET_DESCRIPTOR_PTR(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.CommonPointer)
#define ACPI_SET_DESCRIPTOR_PTR(d, p) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.CommonPointer = (p))
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = t)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = (t))
/*
* Macros for the master AML opcode table

View File

@ -329,9 +329,9 @@
/* Helper macro */
#define ACPI_TRACE_ENTRY(Name, Function, Cast, Param) \
#define ACPI_TRACE_ENTRY(Name, Function, Type, Param) \
ACPI_FUNCTION_NAME (Name) \
Function (ACPI_DEBUG_PARAMETERS, Cast (Param))
Function (ACPI_DEBUG_PARAMETERS, (Type) (Param))
/* The actual entry trace macros */
@ -340,13 +340,13 @@
AcpiUtTrace (ACPI_DEBUG_PARAMETERS)
#define ACPI_FUNCTION_TRACE_PTR(Name, Pointer) \
ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, (void *), Pointer)
ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, void *, Pointer)
#define ACPI_FUNCTION_TRACE_U32(Name, Value) \
ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, (UINT32), Value)
ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, UINT32, Value)
#define ACPI_FUNCTION_TRACE_STR(Name, String) \
ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, (char *), String)
ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, char *, String)
#define ACPI_FUNCTION_ENTRY() \
AcpiUtTrackStackPtr()
@ -361,16 +361,37 @@
*
* One of the FUNCTION_TRACE macros above must be used in conjunction
* with these macros so that "_AcpiFunctionName" is defined.
*
* There are two versions of most of the return macros. The default version is
* safer, since it avoids side-effects by guaranteeing that the argument will
* not be evaluated twice.
*
* A less-safe version of the macros is provided for optional use if the
* compiler uses excessive CPU stack (for example, this may happen in the
* debug case if code optimzation is disabled.)
*/
/* Exit trace helper macro */
#define ACPI_TRACE_EXIT(Function, Cast, Param) \
#ifndef ACPI_SIMPLE_RETURN_MACROS
#define ACPI_TRACE_EXIT(Function, Type, Param) \
ACPI_DO_WHILE0 ({ \
Function (ACPI_DEBUG_PARAMETERS, Cast (Param)); \
return ((Param)); \
register Type _Param = (Type) (Param); \
Function (ACPI_DEBUG_PARAMETERS, _Param); \
return (_Param); \
})
#else /* Use original less-safe macros */
#define ACPI_TRACE_EXIT(Function, Type, Param) \
ACPI_DO_WHILE0 ({ \
Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)); \
return (Param); \
})
#endif /* ACPI_SIMPLE_RETURN_MACROS */
/* The actual exit macros */
#define return_VOID \
@ -380,13 +401,13 @@
})
#define return_ACPI_STATUS(Status) \
ACPI_TRACE_EXIT (AcpiUtStatusExit, (ACPI_STATUS), Status)
ACPI_TRACE_EXIT (AcpiUtStatusExit, ACPI_STATUS, Status)
#define return_PTR(Pointer) \
ACPI_TRACE_EXIT (AcpiUtPtrExit, (UINT8 *), Pointer)
ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer)
#define return_VALUE(Value) \
ACPI_TRACE_EXIT (AcpiUtValueExit, (UINT64), Value)
ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value)
/* Conditional execution */

View File

@ -1226,7 +1226,6 @@ typedef struct acpi_memory_list
UINT16 ObjectSize;
UINT16 MaxDepth;
UINT16 CurrentDepth;
UINT16 LinkOffset;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS