Macro cleanup (CAST_PTR), automated cleanup

This commit is contained in:
rmoore1 2005-11-14 23:38:24 +00:00
parent a60b6eb959
commit fc4ba0f267
26 changed files with 188 additions and 158 deletions

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcodegen - AML code generation
* $Revision: 1.58 $
* $Revision: 1.59 $
*
*****************************************************************************/
@ -588,7 +588,6 @@ CgWriteNode (
ASL_RESOURCE_NODE *Rnode;
/* Always check for DEFAULT_ARG and other "Noop" nodes */
/* TBD: this may not be the best place for this check */

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcompile - top level compile module
* $Revision: 1.91 $
* $Revision: 1.92 $
*
*****************************************************************************/
@ -432,7 +432,6 @@ FlCheckForAscii (
ASL_FILE_STATUS Status;
Status.Line = 1;
Status.Offset = 0;

View File

@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslcompiler.y - Bison input file (ASL grammar and actions)
* $Revision: 1.95 $
* $Revision: 1.96 $
*
*****************************************************************************/
@ -135,7 +135,7 @@
/*
* Global Notes:
*
*
* October 2005: The following list terms have been optimized (from the
* original ASL grammar in the ACPI specification) to force the immediate
* reduction of each list item so that the parse stack use doesn't increase on
@ -143,7 +143,7 @@
* This dramatically reduces use of the parse stack overall.
*
* ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
* ResourceMacroList, and FieldUnitList
* ResourceMacroList, and FieldUnitList
*/
@ -913,7 +913,7 @@ ArgList
;
/*
Removed from TermArg due to reduce/reduce conflicts
Removed from TermArg due to reduce/reduce conflicts
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslresource - Resource templates and descriptors
* $Revision: 1.39 $
* $Revision: 1.40 $
*
*****************************************************************************/
@ -697,7 +697,7 @@ RsDoResourceTemplate (
/*
* Process all resource descriptors in the list
* Note: It is assumed that the EndTag node has been automatically
* Note: It is assumed that the EndTag node has been automatically
* inserted at the end of the template by the parser.
*/
State = ACPI_RSTATE_NORMAL;

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltypes.h - compiler data types and struct definitions
* $Revision: 1.81 $
* $Revision: 1.82 $
*
*****************************************************************************/
@ -231,7 +231,6 @@ typedef struct asl_file_status
} ASL_FILE_STATUS;
/* File types */
typedef enum

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
* $Revision: 1.67 $
* $Revision: 1.68 $
*
*****************************************************************************/
@ -463,7 +463,7 @@ UtSetParseOpName (
ACPI_PARSE_OBJECT *Op)
{
strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode),
strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode),
ACPI_MAX_PARSEOP_NAME);
}
@ -489,7 +489,7 @@ UtGetOpName (
* First entries (ASL_YYTNAME_START) in yytname are special reserved names.
* Ignore first 8 characters of the name
*/
return ((char *) yytname
return ((char *) yytname
[(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
* $Revision: 1.137 $
* $Revision: 1.138 $
*
******************************************************************************/
@ -1488,7 +1488,7 @@ AcpiDbDisplayResources (
goto GetCrs;
}
AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer);
AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
/* _CRS */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
* $Revision: 1.76 $
* $Revision: 1.77 $
*
******************************************************************************/
@ -274,7 +274,7 @@ AcpiDbDumpExternalObject (
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
* $Revision: 1.29 $
* $Revision: 1.30 $
*
******************************************************************************/
@ -225,11 +225,13 @@ AcpiDmMemoryFields (
switch (Type)
{
case 16:
AcpiDmDumpInteger16 (((UINT16 *) Source)[i], AcpiDmMemoryNames[i]);
AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
AcpiDmMemoryNames[i]);
break;
case 32:
AcpiDmDumpInteger32 (((UINT32 *) Source)[i], AcpiDmMemoryNames[i]);
AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
AcpiDmMemoryNames[i]);
break;
default:
@ -241,7 +243,7 @@ AcpiDmMemoryFields (
/*******************************************************************************
*
* FUNCTION: AcpiDm
* FUNCTION: AcpiDmAddressFields
*
* PARAMETERS: Source - Pointer to the contiguous data fields
* Type - 16, 32, or 64 (bit)
@ -271,15 +273,18 @@ AcpiDmAddressFields (
switch (Type)
{
case 16:
AcpiDmDumpInteger16 (((UINT16 *) Source)[i], AcpiDmAddressNames[i]);
AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
AcpiDmAddressNames[i]);
break;
case 32:
AcpiDmDumpInteger32 (((UINT32 *) Source)[i], AcpiDmAddressNames[i]);
AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
AcpiDmAddressNames[i]);
break;
case 64:
AcpiDmDumpInteger64 (((UINT64 *) Source)[i], AcpiDmAddressNames[i]);
AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
AcpiDmAddressNames[i]);
break;
default:
@ -601,7 +606,7 @@ AcpiDmResourceSource (
/* Get a pointer to the ResourceSource */
AmlResourceSource = ((UINT8 *) Resource) + MinimumTotalLength;
AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
/*
* Always emit the ResourceSourceIndex (Byte)
@ -1071,7 +1076,7 @@ AcpiDmVendorLargeDescriptor (
{
AcpiDmVendorCommon ("Long () ",
((UINT8 *) Resource) + sizeof (AML_RESOURCE_LARGE_HEADER),
ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
Length, Level);
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
* $Revision: 1.10 $
* $Revision: 1.11 $
*
******************************************************************************/
@ -364,7 +364,7 @@ AcpiDmVendorSmallDescriptor (
{
AcpiDmVendorCommon ("Short ()",
((UINT8 *) Resource) + sizeof (AML_RESOURCE_SMALL_HEADER),
ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
Length, Level);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
* $Revision: 1.98 $
* $Revision: 1.99 $
*
*****************************************************************************/
@ -403,7 +403,7 @@ AcpiDsLoad1BeginOp (
Op->Named.Name = Node->Name.Integer;
#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
Op->Named.Path = (UINT8 *) Path;
Op->Named.Path = ACPI_CAST_PTR (UINT8, Path);
#endif

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
* $Revision: 1.48 $
* $Revision: 1.49 $
*
*****************************************************************************/
@ -971,7 +971,7 @@ AcpiEvCreateGpeInfoBlocks (
}
/* Disable all GPEs within this register */
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
&ThisRegister->EnableAddress);
if (ACPI_FAILURE (Status))

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.192 $
* $Revision: 1.193 $
*
*****************************************************************************/
@ -440,7 +440,7 @@ AcpiExDumpObject (
while (Count)
{
Target = ((UINT8 *) ObjDesc) + Info->Offset;
Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
Name = Info->Name;
switch (Info->Opcode)
@ -459,18 +459,18 @@ AcpiExDumpObject (
case ACPI_EXD_UINT16:
AcpiOsPrintf ("%20s : %4.4X\n", Name, *ACPI_CAST_PTR (UINT16, Target));
AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
break;
case ACPI_EXD_UINT32:
AcpiOsPrintf ("%20s : %8.8X\n", Name, *ACPI_CAST_PTR (UINT32, Target));
AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
break;
case ACPI_EXD_UINT64:
AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
ACPI_FORMAT_UINT64 (*ACPI_CAST_PTR (UINT64, Target)));
ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
break;
case ACPI_EXD_POINTER:
@ -1135,7 +1135,7 @@ AcpiExDumpPackageObj (
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 1.103 $
* $Revision: 1.104 $
*
*****************************************************************************/
@ -329,7 +329,7 @@ AcpiExNameSegment (
*AmlAddress, AmlAddress));
}
*InAmlAddress = (UINT8 *) AmlAddress;
*InAmlAddress = ACPI_CAST_PTR (UINT8, AmlAddress);
return_ACPI_STATUS (Status);
}

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
* $Revision: 1.91 $
* $Revision: 1.92 $
*
*****************************************************************************/
@ -285,20 +285,20 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
*Value = (ACPI_INTEGER) *((UINT8 *) LogicalAddrPtr);
*Value = (ACPI_INTEGER) ACPI_GET8 (LogicalAddrPtr);
break;
case 16:
*Value = (ACPI_INTEGER) *((UINT16 *) LogicalAddrPtr);
*Value = (ACPI_INTEGER) ACPI_GET16 (LogicalAddrPtr);
break;
case 32:
*Value = (ACPI_INTEGER) *((UINT32 *) LogicalAddrPtr);
*Value = (ACPI_INTEGER) ACPI_GET32 (LogicalAddrPtr);
break;
#if ACPI_MACHINE_WIDTH != 16
case 64:
*Value = (ACPI_INTEGER) *((UINT64 *) LogicalAddrPtr);
*Value = (ACPI_INTEGER) ACPI_GET64 (LogicalAddrPtr);
break;
#endif
default:
@ -312,20 +312,20 @@ AcpiExSystemMemorySpaceHandler (
switch (BitWidth)
{
case 8:
*(UINT8 *) LogicalAddrPtr = (UINT8) *Value;
ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
break;
case 16:
*(UINT16 *) LogicalAddrPtr = (UINT16) *Value;
ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
break;
case 32:
*(UINT32 *) LogicalAddrPtr = (UINT32) *Value;
ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
break;
#if ACPI_MACHINE_WIDTH != 16
case 64:
*(UINT64 *) LogicalAddrPtr = (UINT64) *Value;
ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
break;
#endif

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
* $Revision: 1.52 $
* $Revision: 1.58 $
*
*****************************************************************************/
@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
* All rights reserved.
*
* 2. License
@ -150,10 +150,9 @@ AcpiExStoreBufferToBuffer (
ACPI_FUNCTION_TRACE_PTR ("ExStoreBufferToBuffer", SourceDesc);
/*
* We know that SourceDesc is a buffer by now
*/
Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
/* We know that SourceDesc is a buffer by now */
Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer);
Length = SourceDesc->Buffer.Length;
/*
@ -181,15 +180,35 @@ AcpiExStoreBufferToBuffer (
ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
/* Set the new length of the target */
#ifdef ACPI_OBSOLETE_BEHAVIOR
/*
* NOTE: ACPI versions up to 3.0 specified that the buffer must be
* truncated if the string is smaller than the buffer. However, "other"
* implementations of ACPI never did this and thus became the defacto
* standard. ACPI 3.0A changes this behavior such that the buffer
* is no longer truncated.
*/
TargetDesc->Buffer.Length = Length;
/*
* OBSOLETE BEHAVIOR:
* If the original source was a string, we must truncate the buffer,
* according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer
* copy must not truncate the original buffer.
*/
if (OriginalSrcType == ACPI_TYPE_STRING)
{
/* Set the new length of the target */
TargetDesc->Buffer.Length = Length;
}
#endif
}
else
{
/* Truncate the source, copy only what will fit */
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer,
TargetDesc->Buffer.Length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Truncating source buffer from %X to %X\n",
@ -229,10 +248,9 @@ AcpiExStoreStringToString (
ACPI_FUNCTION_TRACE_PTR ("ExStoreStringToString", SourceDesc);
/*
* We know that SourceDesc is a string by now.
*/
Buffer = (UINT8 *) SourceDesc->String.Pointer;
/* We know that SourceDesc is a string by now */
Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer);
Length = SourceDesc->String.Length;
/*
@ -246,7 +264,8 @@ AcpiExStoreStringToString (
* String will fit in existing non-static buffer.
* Clear old string and copy in the new one
*/
ACPI_MEMSET (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1);
ACPI_MEMSET (TargetDesc->String.Pointer, 0,
(ACPI_SIZE) TargetDesc->String.Length + 1);
ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
else
@ -258,13 +277,13 @@ AcpiExStoreStringToString (
if (TargetDesc->String.Pointer &&
(!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
{
/*
* Only free if not a pointer into the DSDT
*/
/* Only free if not a pointer into the DSDT */
ACPI_MEM_FREE (TargetDesc->String.Pointer);
}
TargetDesc->String.Pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
TargetDesc->String.Pointer = ACPI_MEM_CALLOCATE (
(ACPI_SIZE) Length + 1);
if (!TargetDesc->String.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
* $Revision: 1.82 $
* $Revision: 1.83 $
*
*****************************************************************************/
@ -144,7 +144,7 @@ AcpiPsGetNextField (
* RETURN: Decoded package length. On completion, the AML pointer points
* past the length byte or bytes.
*
* DESCRIPTION: Decode and return a package length field.
* DESCRIPTION: Decode and return a package length field.
* Note: Largest package length is 28 bits, from ACPI specification
*
******************************************************************************/
@ -174,7 +174,7 @@ AcpiPsGetNextPackageLength (
while (ByteCount)
{
/*
* Final bit positions for the package length bytes:
* Final bit positions for the package length bytes:
* Byte3->[20:27]
* Byte2->[12:19]
* Byte1->[04:11]

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
* $Revision: 1.56 $
* $Revision: 1.57 $
*
******************************************************************************/
@ -434,7 +434,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)
@ -462,19 +462,19 @@ AcpiRsDumpDescriptor (
/* Data items, 8/16/32/64 bit */
case ACPI_RSD_UINT8:
AcpiRsOutInteger8 (Name, *ACPI_CAST_PTR (UINT8, Target));
AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
break;
case ACPI_RSD_UINT16:
AcpiRsOutInteger16 (Name, *ACPI_CAST_PTR (UINT16, Target));
AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
break;
case ACPI_RSD_UINT32:
AcpiRsOutInteger32 (Name, *ACPI_CAST_PTR (UINT32, Target));
AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
break;
case ACPI_RSD_UINT64:
AcpiRsOutInteger64 (Name, *ACPI_CAST_PTR (UINT64, Target));
AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
break;
/* Flags: 1-bit and 2-bit flags supported */
@ -508,7 +508,7 @@ AcpiRsDumpDescriptor (
*/
if (PreviousTarget)
{
AcpiRsDumpByteList (*ACPI_CAST_PTR (UINT16, PreviousTarget), Target);
AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
}
break;
@ -735,8 +735,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);
}
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
* $Revision: 1.36 $
* $Revision: 1.37 $
*
******************************************************************************/
@ -188,8 +188,8 @@ AcpiRsConvertAmlToResource (
* Source is the external AML byte stream buffer,
* destination is the internal resource descriptor
*/
Source = ((UINT8 *) Aml) + Info->AmlOffset;
Destination = ((UINT8 *) Resource) + Info->ResourceOffset;
Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
switch (Info->Opcode)
{
@ -217,8 +217,8 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bit
*/
*((UINT8 *) Destination) = (UINT8)
((*((UINT8 *) Source) >> Info->Value) & 0x01);
ACPI_SET8 (Destination) = (UINT8)
((ACPI_GET8 (Source) >> Info->Value) & 0x01);
break;
@ -226,15 +226,15 @@ AcpiRsConvertAmlToResource (
/*
* Mask and shift the flag bits
*/
*((UINT8 *) Destination) = (UINT8)
((*((UINT8 *) Source) >> Info->Value) & 0x03);
ACPI_SET8 (Destination) = (UINT8)
((ACPI_GET8 (Source) >> Info->Value) & 0x03);
break;
case ACPI_RSC_COUNT:
ItemCount = *((UINT8 *) Source);
*((UINT8 *) Destination) = (UINT8) ItemCount;
ItemCount = ACPI_GET8 (Source);
ACPI_SET8 (Destination) = (UINT8) ItemCount;
Resource->Length = Resource->Length +
(Info->Value * (ItemCount - 1));
@ -244,7 +244,7 @@ AcpiRsConvertAmlToResource (
case ACPI_RSC_COUNT16:
ItemCount = AmlResourceLength;
*((UINT16 *) Destination) = ItemCount;
ACPI_SET16 (Destination) = ItemCount;
Resource->Length = Resource->Length +
(Info->Value * (ItemCount - 1));
@ -269,8 +269,7 @@ AcpiRsConvertAmlToResource (
{
ItemCount = Info->Value;
}
AcpiRsMoveData (Destination, Source, ItemCount,
Info->Opcode);
AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
break;
@ -282,8 +281,8 @@ AcpiRsConvertAmlToResource (
case ACPI_RSC_DATA8:
Target = ((char *) Resource) + Info->Value;
ACPI_MEMCPY (Destination, Source, *(ACPI_CAST_PTR (UINT16, Target)));
Target = ACPI_ADD_PTR (char, Resource, Info->Value);
ACPI_MEMCPY (Destination, Source, ACPI_GET16 (Target));
break;
@ -313,7 +312,7 @@ AcpiRsConvertAmlToResource (
* Optional ResourceSource (Index and String). This is the more
* complicated case used by the Interrupt() macro
*/
Target = ((char *) Resource) + Info->AmlOffset + (ItemCount * 4);
Target = ACPI_ADD_PTR (char, Resource, Info->AmlOffset + (ItemCount * 4));
Resource->Length +=
AcpiRsGetResourceSource (AmlResourceLength,
@ -326,14 +325,14 @@ AcpiRsConvertAmlToResource (
/*
* 8-bit encoded bitmask (DMA macro)
*/
ItemCount = AcpiRsDecodeBitmask (*((UINT8 *) Source), Destination);
ItemCount = AcpiRsDecodeBitmask (ACPI_GET8 (Source), Destination);
if (ItemCount)
{
Resource->Length += (ItemCount - 1);
}
Target = ((char *) Resource) + Info->Value;
*((UINT8 *) Target) = (UINT8) ItemCount;
Target = ACPI_ADD_PTR (char, Resource, Info->Value);
ACPI_SET8 (Target) = (UINT8) ItemCount;
break;
@ -349,8 +348,8 @@ AcpiRsConvertAmlToResource (
Resource->Length += (ItemCount - 1);
}
Target = ((char *) Resource) + Info->Value;
*((UINT8 *) Target) = (UINT8) ItemCount;
Target = ACPI_ADD_PTR (char, Resource, Info->Value);
ACPI_SET8 (Target) = (UINT8) ItemCount;
break;
@ -368,7 +367,7 @@ AcpiRsConvertAmlToResource (
break;
case ACPI_RSC_COMPARE_VALUE:
if (*((UINT8 *) Source) != Info->Value)
if (ACPI_GET8 (Source) != Info->Value)
{
goto Exit;
}
@ -454,8 +453,8 @@ AcpiRsConvertResourceToAml (
* Source is the internal resource descriptor,
* destination is the external AML byte stream buffer
*/
Source = ((UINT8 *) Resource) + Info->ResourceOffset;
Destination = ((UINT8 *) Aml) + Info->AmlOffset;
Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
switch (Info->Opcode)
{
@ -475,7 +474,7 @@ AcpiRsConvertResourceToAml (
/*
* Clear the flag byte
*/
*((UINT8 *) Destination) = 0;
ACPI_SET8 (Destination) = 0;
break;
@ -483,8 +482,8 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bit
*/
*((UINT8 *) Destination) |= (UINT8)
((*((UINT8 *) Source) & 0x01) << Info->Value);
ACPI_SET8 (Destination) |= (UINT8)
((ACPI_GET8 (Source) & 0x01) << Info->Value);
break;
@ -492,24 +491,23 @@ AcpiRsConvertResourceToAml (
/*
* Mask and shift the flag bits
*/
*((UINT8 *) Destination) |= (UINT8)
((*((UINT8 *) Source) & 0x03) << Info->Value);
ACPI_SET8 (Destination) |= (UINT8)
((ACPI_GET8 (Source) & 0x03) << Info->Value);
break;
case ACPI_RSC_COUNT:
ItemCount = *((UINT8 *) Source);
*((UINT8 *) Destination) = (UINT8) ItemCount;
ItemCount = ACPI_GET8 (Source);
ACPI_SET8 (Destination) = (UINT8) ItemCount;
AmlLength = (UINT16) (AmlLength +
(Info->Value * (ItemCount - 1)));
AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1)));
break;
case ACPI_RSC_COUNT16:
ItemCount = *((UINT16 *) Source);
ItemCount = ACPI_GET16 (Source);
AmlLength = (UINT16) (AmlLength + ItemCount);
AcpiRsSetResourceLength (AmlLength, Aml);
break;
@ -566,8 +564,9 @@ AcpiRsConvertResourceToAml (
/*
* 8-bit encoded bitmask (DMA macro)
*/
*((UINT8 *) Destination) = (UINT8)
AcpiRsEncodeBitmask (Source, *(((UINT8 *) Resource) + Info->Value));
ACPI_SET8 (Destination) = (UINT8)
AcpiRsEncodeBitmask (Source,
*ACPI_ADD_PTR (UINT8, Resource, Info->Value));
break;
@ -575,7 +574,8 @@ AcpiRsConvertResourceToAml (
/*
* 16-bit encoded bitmask (IRQ macro)
*/
Temp16 = AcpiRsEncodeBitmask (Source, *(((UINT8 *) Resource) + Info->Value));
Temp16 = AcpiRsEncodeBitmask (Source,
*ACPI_ADD_PTR (UINT8, Resource, Info->Value));
ACPI_MOVE_16_TO_16 (Destination, &Temp16);
break;
@ -598,7 +598,9 @@ AcpiRsConvertResourceToAml (
switch (COMPARE_OPCODE (Info))
{
case ACPI_RSC_COMPARE_VALUE:
if (*((UINT8 *) (((UINT8 *) Resource) + COMPARE_TARGET(Info))) != COMPARE_VALUE (Info))
if (*ACPI_ADD_PTR (UINT8, Resource,
COMPARE_TARGET (Info)) != COMPARE_VALUE (Info))
{
goto Exit;
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
* $Revision: 1.53 $
* $Revision: 1.54 $
*
******************************************************************************/
@ -254,18 +254,18 @@ AcpiRsMoveData (
* misaligned memory transfers
*/
case ACPI_RSC_MOVE16:
ACPI_MOVE_16_TO_16 (&((UINT16 *) Destination)[i],
&((UINT16 *) Source)[i]);
ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
&ACPI_CAST_PTR (UINT16, Source)[i]);
break;
case ACPI_RSC_MOVE32:
ACPI_MOVE_32_TO_32 (&((UINT32 *) Destination)[i],
&((UINT32 *) Source)[i]);
ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
&ACPI_CAST_PTR (UINT32, Source)[i]);
break;
case ACPI_RSC_MOVE64:
ACPI_MOVE_64_TO_64 (&((UINT64 *) Destination)[i],
&((UINT64 *) Source)[i]);
ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
&ACPI_CAST_PTR (UINT64, Source)[i]);
break;
default:
@ -440,7 +440,7 @@ AcpiRsGetResourceSource (
TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
AmlResourceSource = ((UINT8 *) Aml) + MinimumLength;
AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
/*
* ResourceSource is present if the length of the descriptor is longer than
@ -462,8 +462,8 @@ AcpiRsGetResourceSource (
* String destination pointer is not specified; Set the String
* pointer to the end of the current ResourceSource structure.
*/
ResourceSource->StringPtr = (char *)
((UINT8 *) ResourceSource) + sizeof (ACPI_RESOURCE_SOURCE);
ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
sizeof (ACPI_RESOURCE_SOURCE));
}
/*
@ -532,7 +532,7 @@ AcpiRsSetResourceSource (
{
/* Point to the end of the AML descriptor */
AmlResourceSource = ((UINT8 *) Aml) + MinimumLength;
AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
/* Copy the ResourceSourceIndex */

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbutils - Table manipulation utilities
* $Revision: 1.71 $
* $Revision: 1.72 $
*
*****************************************************************************/
@ -338,23 +338,23 @@ AcpiTbGenerateChecksum (
void *Buffer,
UINT32 Length)
{
const UINT8 *limit;
const UINT8 *rover;
UINT8 sum = 0;
UINT8 *EndBuffer;
UINT8 *Rover;
UINT8 Sum = 0;
if (Buffer && Length)
{
/* Buffer and Length are valid */
limit = (UINT8 *) Buffer + Length;
EndBuffer = ACPI_ADD_PTR (UINT8, Buffer, Length);
for (rover = Buffer; rover < limit; rover++)
for (Rover = Buffer; Rover < EndBuffer; Rover++)
{
sum = (UINT8) (sum + *rover);
Sum = (UINT8) (Sum + *Rover);
}
}
return (sum);
return (Sum);
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
* $Revision: 1.122 $
* $Revision: 1.123 $
*
*****************************************************************************/
@ -504,9 +504,9 @@ AcpiUtCopyIobjectToEobject (
* Build a simple object (no nested objects)
*/
Status = AcpiUtCopyIsimpleToEsimple (InternalObject,
(ACPI_OBJECT *) RetBuffer->Pointer,
((UINT8 *) RetBuffer->Pointer +
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer),
ACPI_ADD_PTR (UINT8, RetBuffer->Pointer,
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
&RetBuffer->Length);
/*
* build simple does not include the object size in the length

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
* $Revision: 1.216 $
* $Revision: 1.217 $
*
*****************************************************************************/
@ -697,7 +697,7 @@ AcpiUtGetNodeName (
/* Name must be a valid ACPI name */
if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii))
if (!AcpiUtValidAcpiName (ACPI_GET32 (Node->Name.Ascii)))
{
return ("????");
}

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utresrc - Resource managment utilities
* $Revision: 1.3 $
* $Revision: 1.4 $
*
******************************************************************************/
@ -244,7 +244,7 @@ AcpiUtValidateResource (
/*
* 1) Validate the ResourceType field (Byte 0)
*/
ResourceType = *((UINT8 *) Aml);
ResourceType = ACPI_GET8 (Aml);
/*
* Byte 0 contains the descriptor name (Resource Type)
@ -368,17 +368,17 @@ AcpiUtGetResourceType (
* Byte 0 contains the descriptor name (Resource Type)
* Examine the large/small bit in the resource header
*/
if (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_LARGE)
if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE)
{
/* Large Resource Type -- bits 6:0 contain the name */
return (*((UINT8 *) Aml));
return (ACPI_GET8 (Aml));
}
else
{
/* Small Resource Type -- bits 6:3 contain the name */
return ((UINT8) (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
return ((UINT8) (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_SMALL_MASK));
}
}
@ -411,18 +411,18 @@ AcpiUtGetResourceLength (
* Byte 0 contains the descriptor name (Resource Type)
* Examine the large/small bit in the resource header
*/
if (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_LARGE)
if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE)
{
/* Large Resource type -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16 (&ResourceLength, &((UINT8 *) Aml)[1]);
ACPI_MOVE_16_TO_16 (&ResourceLength, ACPI_ADD_PTR (UINT8, Aml, 1));
}
else
{
/* Small Resource type -- bits 2:0 of byte 0 contain the length */
ResourceLength = (UINT16) (*((UINT8 *) Aml) &
ResourceLength = (UINT16) (ACPI_GET8 (Aml) &
ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
}
@ -451,7 +451,7 @@ AcpiUtGetResourceHeaderLength (
/* Examine the large/small bit in the resource header */
if (*((UINT8 *) Aml) & ACPI_RESOURCE_NAME_LARGE)
if (ACPI_GET8 (Aml) & ACPI_RESOURCE_NAME_LARGE)
{
return (sizeof (AML_RESOURCE_LARGE_HEADER));
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
* $Revision: 1.168 $
* $Revision: 1.169 $
*
*****************************************************************************/
@ -182,13 +182,20 @@
* Extract a byte of data using a pointer. Any more than a byte and we
* get into potential aligment issues -- see the STORE macros below
*/
#define ACPI_GET8(addr) (*(UINT8*)(addr))
#define ACPI_GET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
#define ACPI_GET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
#define ACPI_GET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
#define ACPI_GET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
#define ACPI_SET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
#define ACPI_SET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
#define ACPI_SET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
#define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
/* Pointer manipulation */
#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_NATIVE_UINT)(b)))
#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_NATIVE_UINT)(b)))
#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b))
/* Pointer/Integer type conversions */
@ -449,7 +456,7 @@
(b) & 0xFF, ((b) >> 8) & 0xFF, \
(c) & 0xFF, ((c) >> 8) & 0xFF, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
/*
* An ACPI_NAMESPACE_NODE * can appear in some contexts,
* where a pointer to an ACPI_OPERAND_OBJECT can also

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aeexec - Support routines for AcpiExec utility
* $Revision: 1.89 $
* $Revision: 1.90 $
*
*****************************************************************************/
@ -1037,7 +1037,7 @@ AeMiscellaneousTests (
ACPI_VENDOR_UUID Uuid = {0, ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)};
ACPI_STATUS Status;
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;