Prefixed C library macros (MEMSET, etc.) with "ACPI_".

date	2002.02.13.18.54.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 17:24:40 +00:00
parent 72107a7852
commit b628258003
7 changed files with 1386 additions and 1678 deletions

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
* $Revision: 1.142 $
* $Revision: 1.145 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -124,7 +124,7 @@
#include "acparser.h"
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exdump")
ACPI_MODULE_NAME ("exdump")
/*
@ -161,7 +161,7 @@ AcpiExShowHexValue (
UINT8 *CurrentAmlPtr = NULL; /* Pointer to current byte of AML value */
FUNCTION_TRACE ("ExShowHexValue");
ACPI_FUNCTION_TRACE ("ExShowHexValue");
if (!((ACPI_LV_LOAD & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@ -171,7 +171,7 @@ AcpiExShowHexValue (
if (!AmlStart)
{
REPORT_ERROR (("ExShowHexValue: null pointer\n"));
ACPI_REPORT_ERROR (("ExShowHexValue: null pointer\n"));
return;
}
@ -248,7 +248,7 @@ AcpiExDumpOperand (
UINT32 i;
PROC_NAME ("ExDumpOperand")
ACPI_FUNCTION_NAME ("ExDumpOperand")
if (!((ACPI_LV_INFO & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@ -270,14 +270,14 @@ AcpiExDumpOperand (
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p NS Node: ", ObjDesc));
DUMP_ENTRY (ObjDesc, ACPI_LV_INFO);
ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_INFO);
return (AE_OK);
}
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%p is not a local object\n", ObjDesc));
DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
ACPI_DUMP_BUFFER (ObjDesc, sizeof (ACPI_OPERAND_OBJECT));
return (AE_OK);
}
@ -323,9 +323,9 @@ AcpiExDumpOperand (
case AML_NAME_OP:
DUMP_PATHNAME (ObjDesc->Reference.Object, "Reference: Name: ",
ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object, "Reference: Name: ",
ACPI_LV_INFO, _COMPONENT);
DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
break;
@ -346,8 +346,8 @@ AcpiExDumpOperand (
/* Value is a Number */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
HIDWORD(ObjDesc->Integer.Value),
LODWORD(ObjDesc->Integer.Value));
ACPI_HIDWORD(ObjDesc->Integer.Value),
ACPI_LODWORD(ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
@ -365,8 +365,8 @@ AcpiExDumpOperand (
/* Value is a Number */
AcpiOsPrintf (" value is [%8.8X%8.8x]",
HIDWORD(ObjDesc->Integer.Value),
LODWORD(ObjDesc->Integer.Value));
ACPI_HIDWORD(ObjDesc->Integer.Value),
ACPI_LODWORD(ObjDesc->Integer.Value));
}
AcpiOsPrintf ("\n");
@ -423,24 +423,24 @@ AcpiExDumpOperand (
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("Integer %8.8X%8.8X\n",
HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case INTERNAL_TYPE_IF:
AcpiOsPrintf ("If [Integer] %8.8X%8.8X\n",
HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
case INTERNAL_TYPE_WHILE:
AcpiOsPrintf ("While [Integer] %8.8X%8.8X\n",
HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;
@ -490,8 +490,8 @@ AcpiExDumpOperand (
else
{
AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
HIDWORD(ObjDesc->Region.Address),
LODWORD(ObjDesc->Region.Address),
ACPI_HIDWORD (ObjDesc->Region.Address),
ACPI_LODWORD (ObjDesc->Region.Address),
ObjDesc->Region.Length);
}
break;
@ -523,10 +523,10 @@ AcpiExDumpOperand (
AcpiOsPrintf (
"RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
ObjDesc->Field.BitLength, ObjDesc->Field.AccessByteWidth,
ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
ObjDesc->Field.BaseByteOffset, ObjDesc->Field.StartFieldBitOffset);
DUMP_STACK_ENTRY (ObjDesc->Field.RegionObj);
ACPI_DUMP_STACK_ENTRY (ObjDesc->Field.RegionObj);
break;
@ -556,7 +556,7 @@ AcpiExDumpOperand (
else
{
DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj);
ACPI_DUMP_STACK_ENTRY (ObjDesc->BufferField.BufferObj);
}
break;
@ -634,7 +634,7 @@ AcpiExDumpOperand (
void
AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **Operands,
OPERATING_MODE InterpreterMode,
ACPI_INTERPRETER_MODE InterpreterMode,
NATIVE_CHAR *Ident,
UINT32 NumLevels,
NATIVE_CHAR *Note,
@ -645,7 +645,7 @@ AcpiExDumpOperands (
ACPI_OPERAND_OBJECT **ObjDesc;
PROC_NAME ("ExDumpOperands");
ACPI_FUNCTION_NAME ("ExDumpOperands");
if (!Ident)
@ -733,7 +733,7 @@ AcpiExOutAddress (
AcpiOsPrintf ("%20s : %p\n", Title, Value);
#else
AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title,
HIDWORD (Value), LODWORD (Value));
ACPI_HIDWORD (Value), ACPI_LODWORD (Value));
#endif
}
@ -755,7 +755,7 @@ AcpiExDumpNode (
UINT32 Flags)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
if (!Flags)
@ -767,8 +767,8 @@ AcpiExDumpNode (
}
AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char*)&Node->Name);
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiOsPrintf ("%20s : %4.4s\n", "Name", (char *) &Node->Name);
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
AcpiExOutInteger ("Flags", Node->Flags);
AcpiExOutInteger ("Owner Id", Node->OwnerId);
AcpiExOutInteger ("Reference Count", Node->ReferenceCount);
@ -798,7 +798,7 @@ AcpiExDumpObjectDescriptor (
UINT32 i;
FUNCTION_TRACE ("ExDumpObjectDescriptor");
ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
if (!Flags)
@ -827,8 +827,9 @@ AcpiExDumpObjectDescriptor (
{
case ACPI_TYPE_INTEGER:
AcpiOsPrintf ("%20s : %X%8.8X\n", "Value", HIDWORD (ObjDesc->Integer.Value),
LODWORD (ObjDesc->Integer.Value));
AcpiOsPrintf ("%20s : %X%8.8X\n", "Value",
ACPI_HIDWORD (ObjDesc->Integer.Value),
ACPI_LODWORD (ObjDesc->Integer.Value));
break;

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
* $Revision: 1.100 $
* $Revision: 1.105 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -127,21 +127,20 @@
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exfield")
ACPI_MODULE_NAME ("exfield")
/*******************************************************************************
*
* FUNCTION: AcpiExReadDataFromField
*
* PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
* *FieldNode - Parent node for field to be accessed
* *Buffer - Value(s) to be read or written
* BufferLength - Number of bytes to transfer
* PARAMETERS: ObjDesc - The named field
* RetBufferDesc - Where the return data object is stored
*
* RETURN: Status3
* RETURN: Status
*
* DESCRIPTION: Read or write a named field
* DESCRIPTION: Read from a named field. Returns either an Integer or a
* Buffer, depending on the size of the field.
*
******************************************************************************/
@ -157,7 +156,7 @@ AcpiExReadDataFromField (
BOOLEAN Locked;
FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
/* Parameter validation */
@ -193,7 +192,7 @@ AcpiExReadDataFromField (
*
* Note: Field.length is in bits.
*/
Length = ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
Length = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->Field.BitLength);
if (Length > sizeof (ACPI_INTEGER))
{
@ -217,7 +216,6 @@ AcpiExReadDataFromField (
BufferDesc->Buffer.Length = Length;
Buffer = BufferDesc->Buffer.Pointer;
}
else
{
/* Field will fit within an Integer (normal case) */
@ -252,12 +250,10 @@ AcpiExReadDataFromField (
*/
AcpiExReleaseGlobalLock (Locked);
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (BufferDesc);
}
else if (RetBufferDesc)
{
*RetBufferDesc = BufferDesc;
@ -271,14 +267,12 @@ AcpiExReadDataFromField (
*
* FUNCTION: AcpiExWriteDataToField
*
* PARAMETERS: Mode - ACPI_READ or ACPI_WRITE
* *FieldNode - Parent node for field to be accessed
* *Buffer - Value(s) to be read or written
* BufferLength - Number of bytes to transfer
* PARAMETERS: SourceDesc - Contains data to write
* ObjDesc - The named field
*
* RETURN: Status
*
* DESCRIPTION: Read or write a named field
* DESCRIPTION: Write to a named field
*
******************************************************************************/
@ -295,7 +289,7 @@ AcpiExWriteDataToField (
BOOLEAN Locked;
FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
ACPI_FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
/* Parameter validation */
@ -321,7 +315,6 @@ AcpiExWriteDataToField (
}
}
/*
* Get a pointer to the data to be written
*/
@ -348,12 +341,12 @@ AcpiExWriteDataToField (
/*
* We must have a buffer that is at least as long as the field
* we are writing to. This is because individual fields are
* we are writing to. This is because individual fields are
* indivisible and partial writes are not supported -- as per
* the ACPI specification.
*/
NewBuffer = NULL;
RequiredLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (Length < RequiredLength)
{
@ -370,7 +363,7 @@ AcpiExWriteDataToField (
* at Byte zero. All unused (upper) bytes of the
* buffer will be 0.
*/
MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length);
Buffer = NewBuffer;
Length = RequiredLength;
}

View File

@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
* $Revision: 1.78 $
* $Revision: 1.82 $
*
*****************************************************************************/
@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -127,7 +127,7 @@
#define _COMPONENT ACPI_EXECUTER
MODULE_NAME ("exfldio")
ACPI_MODULE_NAME ("exfldio")
/*******************************************************************************
@ -154,7 +154,7 @@ AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *RgnDesc;
FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
@ -197,7 +197,7 @@ AcpiExSetupRegion (
*/
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
"Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
(char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.AccessByteWidth,
(char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.AccessByteWidth,
(char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length));
}
@ -207,8 +207,8 @@ AcpiExSetupRegion (
*/
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",
(char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
(char *) &ObjDesc->CommonField.Node->Name, ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
(char *) &RgnDesc->Region.Node->Name, RgnDesc->Region.Length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT);
@ -246,7 +246,7 @@ AcpiExAccessRegion (
ACPI_PHYSICAL_ADDRESS Address;
FUNCTION_TRACE ("AcpiExAccessRegion");
ACPI_FUNCTION_TRACE ("AcpiExAccessRegion");
/*
@ -277,12 +277,12 @@ AcpiExAccessRegion (
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
HIDWORD (Address), LODWORD (Address)));
ACPI_HIDWORD (Address), ACPI_LODWORD (Address)));
/* Invoke the appropriate AddressSpace/OpRegion handler */
Status = AcpiEvAddressSpaceDispatch (RgnDesc, ReadWrite,
Address, MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
{
@ -333,7 +333,7 @@ AcpiExRegisterOverflow (
if (ObjDesc->CommonField.BitLength >= ACPI_INTEGER_BIT_SIZE)
{
/*
* The field is large enough to hold the maximum integer, so we can
* The field is large enough to hold the maximum integer, so we can
* never overflow it.
*/
return (FALSE);
@ -383,7 +383,7 @@ AcpiExFieldDatumIo (
ACPI_INTEGER LocalValue;
FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
if (ReadWrite == ACPI_READ)
@ -429,7 +429,7 @@ AcpiExFieldDatumIo (
* Copy the data from the source buffer.
* Length is the field width in bytes.
*/
MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
ACPI_MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ObjDesc->BufferField.BaseByteOffset
+ FieldDatumByteOffset,
ObjDesc->CommonField.AccessByteWidth);
@ -440,7 +440,7 @@ AcpiExFieldDatumIo (
* Copy the data to the target buffer.
* Length is the field width in bytes.
*/
MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
+ ObjDesc->BufferField.BaseByteOffset
+ FieldDatumByteOffset,
Value, ObjDesc->CommonField.AccessByteWidth);
@ -547,12 +547,12 @@ AcpiExFieldDatumIo (
if (ReadWrite == ACPI_READ)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read=%8.8X%8.8X\n",
HIDWORD(*Value), LODWORD(*Value)));
ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written=%8.8X%8.8X\n",
HIDWORD(*Value), LODWORD(*Value)));
ACPI_HIDWORD (*Value), ACPI_LODWORD (*Value)));
}
}
@ -585,7 +585,7 @@ AcpiExWriteWithUpdateRule (
ACPI_INTEGER CurrentValue;
FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
/* Start with the new bits */
@ -605,8 +605,8 @@ AcpiExWriteWithUpdateRule (
* Check if update rule needs to be applied (not if mask is all
* ones) The left shift drops the bits we want to ignore.
*/
if ((~Mask << (MUL_8 (sizeof (Mask)) -
MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0)
if ((~Mask << (ACPI_MUL_8 (sizeof (Mask)) -
ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth))) != 0)
{
/*
* Read the current contents of the byte/word/dword containing
@ -637,7 +637,6 @@ AcpiExWriteWithUpdateRule (
"WriteWithUpdateRule: Unknown UpdateRule setting: %x\n",
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
break;
}
}
@ -648,10 +647,10 @@ AcpiExWriteWithUpdateRule (
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Mask %8.8X%8.8X DatumOffset %X Value %8.8X%8.8X, MergedValue %8.8X%8.8X\n",
HIDWORD(Mask), LODWORD(Mask),
ACPI_HIDWORD (Mask), ACPI_LODWORD (Mask),
FieldDatumByteOffset,
HIDWORD(FieldValue), LODWORD(FieldValue),
HIDWORD(MergedValue),LODWORD(MergedValue)));
ACPI_HIDWORD (FieldValue), ACPI_LODWORD (FieldValue),
ACPI_HIDWORD (MergedValue),ACPI_LODWORD (MergedValue)));
return_ACPI_STATUS (Status);
}
@ -682,25 +681,29 @@ AcpiExGetBufferDatum(
UINT32 Offset)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
*Datum = ((UINT8 *) Buffer) [Offset];
break;
case ACPI_FIELD_WORD_GRANULARITY:
MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
ACPI_MOVE_UNALIGNED16_TO_32 (Datum, &(((UINT16 *) Buffer) [Offset]));
break;
case ACPI_FIELD_DWORD_GRANULARITY:
MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
ACPI_MOVE_UNALIGNED32_TO_32 (Datum, &(((UINT32 *) Buffer) [Offset]));
break;
case ACPI_FIELD_QWORD_GRANULARITY:
MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
ACPI_MOVE_UNALIGNED64_TO_64 (Datum, &(((UINT64 *) Buffer) [Offset]));
break;
}
}
@ -731,25 +734,29 @@ AcpiExSetBufferDatum (
UINT32 Offset)
{
FUNCTION_ENTRY ();
ACPI_FUNCTION_ENTRY ();
switch (ByteGranularity)
{
case ACPI_FIELD_BYTE_GRANULARITY:
((UINT8 *) Buffer) [Offset] = (UINT8) MergedDatum;
break;
case ACPI_FIELD_WORD_GRANULARITY:
MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
ACPI_MOVE_UNALIGNED16_TO_16 (&(((UINT16 *) Buffer)[Offset]), &MergedDatum);
break;
case ACPI_FIELD_DWORD_GRANULARITY:
MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
ACPI_MOVE_UNALIGNED32_TO_32 (&(((UINT32 *) Buffer)[Offset]), &MergedDatum);
break;
case ACPI_FIELD_QWORD_GRANULARITY:
MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
ACPI_MOVE_UNALIGNED64_TO_64 (&(((UINT64 *) Buffer)[Offset]), &MergedDatum);
break;
}
}
@ -784,16 +791,16 @@ AcpiExExtractFromField (
UINT32 DatumCount;
FUNCTION_TRACE ("ExExtractFromField");
ACPI_FUNCTION_TRACE ("ExExtractFromField");
/*
* The field must fit within the caller's buffer
*/
ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (ByteFieldLength > BufferLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Field size %X (bytes) too large for buffer (%X)\n",
ByteFieldLength, BufferLength));
@ -802,7 +809,7 @@ AcpiExExtractFromField (
/* Convert field byte count to datum count, round up if necessary */
DatumCount = ROUND_UP_TO (ByteFieldLength,
DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength,
ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
@ -814,7 +821,7 @@ AcpiExExtractFromField (
* This is very important, especially in the cases where a byte is read,
* but the buffer is really a UINT32 (4 bytes).
*/
MEMSET (Buffer, 0, BufferLength);
ACPI_MEMSET (Buffer, 0, BufferLength);
/* Read the first raw datum to prime the loop */
@ -842,7 +849,7 @@ AcpiExExtractFromField (
if (ObjDesc->CommonField.EndBufferValidBits)
{
MergedDatum &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
/* Store the datum to the caller buffer */
@ -865,7 +872,7 @@ AcpiExExtractFromField (
* to perform a final read, since this would potentially read
* past the end of the region.
*
* We could just split the aligned and non-aligned cases since the
* We could just split the aligned and non-aligned cases since the
* aligned case is so very simple, but this would require more code.
*/
if ((ObjDesc->CommonField.StartFieldBitOffset != 0) ||
@ -918,7 +925,7 @@ AcpiExExtractFromField (
if (ObjDesc->CommonField.EndBufferValidBits)
{
MergedDatum &=
MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
}
}
}
@ -927,7 +934,7 @@ AcpiExExtractFromField (
* Store the merged field datum in the caller's buffer, according to
* the granularity of the field (size of each datum).
*/
AcpiExSetBufferDatum (MergedDatum, Buffer,
AcpiExSetBufferDatum (MergedDatum, Buffer,
ObjDesc->CommonField.AccessByteWidth, DatumOffset);
/*
@ -972,7 +979,7 @@ AcpiExInsertIntoField (
UINT32 DatumCount;
FUNCTION_TRACE ("ExInsertIntoField");
ACPI_FUNCTION_TRACE ("ExInsertIntoField");
/*
@ -981,7 +988,7 @@ AcpiExInsertIntoField (
* larger than the field, this typically happens when an integer is
* written to a field that is actually smaller than an integer.
*/
ByteFieldLength = ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
if (BufferLength < ByteFieldLength)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Buffer length %X too small for field %X\n",
@ -992,7 +999,7 @@ AcpiExInsertIntoField (
/* Convert byte count to datum count, round up if necessary */
DatumCount = ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
DatumCount = ACPI_ROUND_UP_TO (ByteFieldLength, ObjDesc->CommonField.AccessByteWidth);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"ByteLen=%x, DatumLen=%x, ByteGran=%x\n",
@ -1022,7 +1029,7 @@ AcpiExInsertIntoField (
*
* Mask off bits that are "below" the field (if any)
*/
Mask = MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
/* If the field fits in one datum, may need to mask upper bits */
@ -1031,7 +1038,7 @@ AcpiExInsertIntoField (
{
/* There are bits above the field, mask them off also */
Mask &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
}
/* Shift and mask the value into the field position */
@ -1118,7 +1125,7 @@ AcpiExInsertIntoField (
*
* Mask off the unused bits above (after) the end-of-field
*/
Mask = MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
MergedDatum &= Mask;
/* Write the last datum with the update rule */

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,8 @@
/******************************************************************************
*
* Module Name: isnames - interpreter/scanner name load/execute
*
* Module Name: exnames - interpreter/scanner name load/execute
* $Revision: 1.90 $
*
*****************************************************************************/
@ -9,8 +10,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
*
@ -38,9 +39,9 @@
* The above copyright and patent license is granted only if the following
* conditions are met:
*
* 3. Conditions
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
@ -48,11 +49,11 @@
* Licensee must cause all Covered Code to which Licensee contributes to
* contain a file documenting the changes Licensee made to create that Covered
* Code and the date of any change. Licensee must include in that file the
* documentation of any changes made by any predecessor Licensee. Licensee
* documentation of any changes made by any predecessor Licensee. Licensee
* must include a prominent statement that the modification is derived,
* directly or indirectly, from Original Intel Code.
*
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* 3.2. Redistribution of Source with no Rights to Further Distribute Source.
* Redistribution of source code of any substantial portion of the Covered
* Code or modification without rights to further distribute source must
* include the following Disclaimer and Export Compliance provision in the
@ -86,7 +87,7 @@
* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
* PARTICULAR PURPOSE.
* PARTICULAR PURPOSE.
*
* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
@ -114,26 +115,28 @@
*
*****************************************************************************/
#define __ISNAMES_C__
#define __EXNAMES_C__
#include <acpi.h>
#include <interp.h>
#include <amlcode.h>
#include <namesp.h>
#include "acpi.h"
#include "acinterp.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT INTERPRETER
MODULE_NAME ("isnames");
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exnames")
#define PKG_Type1 64 /* or 0x40 Max encoding size = 0x3F */
#define PKG_Type2 16384 /* or 0x4000 Max encoding size = 0xFFF */
#define PKG_Type3 4194304 /* or 0x400000 Max encoding size = 0xFFFFF */
#define PKG_Type4 1073741824 /* or 0x40000000 Max encoding size = 0xFFFFFFF */
/* AML Package Length encodings */
#define ACPI_AML_PACKAGE_TYPE1 0x40
#define ACPI_AML_PACKAGE_TYPE2 0x4000
#define ACPI_AML_PACKAGE_TYPE3 0x400000
#define ACPI_AML_PACKAGE_TYPE4 0x40000000
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AmlAllocateNameString
* FUNCTION: AcpiExAllocateNameString
*
* PARAMETERS: PrefixCount - Count of parent levels. Special cases:
* (-1) = root, 0 = none
@ -142,208 +145,95 @@
* RETURN: A pointer to the allocated string segment. This segment must
* be deleted by the caller.
*
* DESCRIPTION: Ensure allocated name string is long enough,
* and set up prefix if any.
* DESCRIPTION: Allocate a buffer for a name string. Ensure allocated name
* string is long enough, and set up prefix if any.
*
****************************************************************************/
******************************************************************************/
char *
AmlAllocateNameString (
INT32 PrefixCount,
INT32 NumNameSegs)
NATIVE_CHAR *
AcpiExAllocateNameString (
UINT32 PrefixCount,
UINT32 NumNameSegs)
{
char *TempPtr;
char *NameString;
INT32 SizeNeeded;
NATIVE_CHAR *TempPtr;
NATIVE_CHAR *NameString;
UINT32 SizeNeeded;
ACPI_FUNCTION_TRACE ("ExAllocateNameString");
FUNCTION_TRACE ("AmlAllocateNameString");
/*
/*
* Allow room for all \ and ^ prefixes, all segments, and a MultiNamePrefix.
* Also, one byte for the null terminator.
* This may actually be somewhat longer than needed.
*/
if (PrefixCount < 0)
if (PrefixCount == ACPI_UINT32_MAX)
{
SizeNeeded = 1 /* root */ + (ACPI_NAME_SIZE * NumNameSegs) + 2;
/* Special case for root */
SizeNeeded = 1 + (ACPI_NAME_SIZE * NumNameSegs) + 2 + 1;
}
else
{
SizeNeeded = PrefixCount + (ACPI_NAME_SIZE * NumNameSegs) + 2;
SizeNeeded = PrefixCount + (ACPI_NAME_SIZE * NumNameSegs) + 2 + 1;
}
/*
/*
* Allocate a buffer for the name.
* This buffer must be deleted by the caller!
*/
NameString = CmAllocate ((ACPI_SIZE) SizeNeeded);
NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
if (!NameString)
{
/* Allocation failure */
REPORT_ERROR ("AmlAllocateNameString: name allocation failure");
return_VALUE (NULL);
ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
return_PTR (NULL);
}
TempPtr = NameString;
/* Set up Root or Parent prefixes if needed */
if (PrefixCount < 0)
if (PrefixCount == ACPI_UINT32_MAX)
{
*TempPtr++ = AML_RootPrefix;
*TempPtr++ = AML_ROOT_PREFIX;
}
else
{
while (PrefixCount--)
{
*TempPtr++ = AML_ParentPrefix;
*TempPtr++ = AML_PARENT_PREFIX;
}
}
/* Set up Dual or Multi prefixes if needed */
if (NumNameSegs > 2)
{
/* Set up multi prefixes */
*TempPtr++ = AML_MultiNamePrefixOp;
*TempPtr++ = AML_MULTI_NAME_PREFIX_OP;
*TempPtr++ = (char) NumNameSegs;
}
else if (2 == NumNameSegs)
{
/* Set up dual prefixes */
*TempPtr++ = AML_DualNamePrefix;
*TempPtr++ = AML_DUAL_NAME_PREFIX;
}
/* Terminate string following prefixes. AmlExecNameSegment() will append the segment(s) */
/*
* Terminate string following prefixes. AcpiExNameSegment() will
* append the segment(s)
*/
*TempPtr = 0;
return_VALUE (NameString);
return_PTR (NameString);
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AmlGoodName
*
* PARAMETERS: Character - The character to be examined
*
* RETURN: 1 if Character may appear in a name, else 0
*
* DESCRIPTION: Check for a printable character
*
****************************************************************************/
BOOLEAN
AmlGoodName (
UINT32 Name)
{
char *NamePtr = (char *) &Name;
UINT32 i;
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
if (!((NamePtr[i] == '_') ||
(NamePtr[i] >= 'A' && NamePtr[i] <= 'Z') ||
(NamePtr[i] >= '0' && NamePtr[i] <= '9')))
{
return FALSE;
}
}
return TRUE;
}
/*****************************************************************************
*
* FUNCTION: AmlGoodChar
*
* PARAMETERS: Character - The character to be examined
*
* RETURN: 1 if Character may appear in a name, else 0
*
* DESCRIPTION: Check for a printable character
*
****************************************************************************/
INT32
AmlGoodChar (
INT32 Character)
{
return ((Character == '_') ||
(Character >= 'A' && Character <= 'Z') ||
(Character >= '0' && Character <= '9'));
}
/*****************************************************************************
*
* FUNCTION: AmlDecodePackageLength
*
* PARAMETERS: LastPkgLen - latest value decoded by DoPkgLength() for
* most recently examined package or field
*
* RETURN: Number of bytes contained in package length encoding
*
* DESCRIPTION: Decodes the Package Length. Upper 2 bits are are used to
* tell if type 1, 2, 3, or 4.
* 0x3F = Max 1 byte encoding,
* 0xFFF = Max 2 byte encoding,
* 0xFFFFF = Max 3 Byte encoding,
* 0xFFFFFFFFF = Max 4 Byte encoding.
*
****************************************************************************/
INT32
AmlDecodePackageLength (
INT32 LastPkgLen)
{
INT32 NumBytes = 0;
FUNCTION_TRACE ("AmlDecodePackageLength");
if (LastPkgLen < PKG_Type1)
{
NumBytes = 1;
}
else if (LastPkgLen < PKG_Type2)
{
NumBytes = 2;
}
else if (LastPkgLen < PKG_Type3)
{
NumBytes = 3;
}
else if (LastPkgLen < PKG_Type4)
{
NumBytes = 4;
}
return_VALUE (NumBytes);
}
/*****************************************************************************
*
* FUNCTION: AmlExecNameSegment
* FUNCTION: AcpiExNameSegment
*
* PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
*
@ -351,38 +241,42 @@ AmlDecodePackageLength (
*
* DESCRIPTION: Execute a name segment (4 bytes)
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
AmlExecNameSegment (
AcpiExNameSegment (
UINT8 **InAmlAddress,
char *NameString)
NATIVE_CHAR *NameString)
{
UINT8 *AmlAddress = *InAmlAddress;
ACPI_STATUS Status = AE_OK;
INT32 Index;
char CharBuf[5];
UINT32 Index;
NATIVE_CHAR CharBuf[5];
FUNCTION_TRACE ("AmlExecNameSegment");
ACPI_FUNCTION_TRACE ("ExNameSegment");
/* If first character is a digit, we aren't looking at a valid name segment */
/*
* If first character is a digit, then we know that we aren't looking at a
* valid name segment
*/
CharBuf[0] = *AmlAddress;
if ('0' <= CharBuf[0] && CharBuf[0] <= '9')
{
DEBUG_PRINT (ACPI_ERROR, ("AmlExecNameSegment: leading digit: %c\n", CharBuf[0]));
return_ACPI_STATUS (AE_PENDING);
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", CharBuf[0]));
return_ACPI_STATUS (AE_CTRL_PENDING);
}
DEBUG_PRINT (TRACE_LOAD, ("AmlExecNameSegment: Bytes from stream:\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
for (Index = 4; Index > 0 && AmlGoodChar (*AmlAddress); --Index)
for (Index = 4;
(Index > 0) && (AcpiUtValidAcpiCharacter (*AmlAddress));
Index--)
{
CharBuf[4 - Index] = *AmlAddress++;
DEBUG_PRINT (TRACE_LOAD, ("%c\n", CharBuf[4 - Index]));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "%c\n", CharBuf[4 - Index]));
}
@ -391,51 +285,49 @@ AmlExecNameSegment (
if (0 == Index)
{
/* Found 4 valid characters */
CharBuf[4] = '\0';
if (NameString)
{
STRCAT (NameString, CharBuf);
DEBUG_PRINT (TRACE_NAMES, ("AmlExecNameSegment: Appended to - %s \n", NameString));
ACPI_STRCAT (NameString, CharBuf);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Appended to - %s \n", NameString));
}
else
{
DEBUG_PRINT (TRACE_NAMES, ("AmlExecNameSegment: No Name string - %s \n", CharBuf));
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"No Name string - %s \n", CharBuf));
}
}
else if (4 == Index)
{
/*
/*
* First character was not a valid name character,
* so we are looking at something other than a name.
*/
DEBUG_PRINT (ACPI_INFO, ("AmlExecNameSegment: Leading char not alpha: %02Xh (not a name)\n", CharBuf[0]));
Status = AE_PENDING;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Leading character is not alpha: %02Xh (not a name)\n",
CharBuf[0]));
Status = AE_CTRL_PENDING;
}
else
{
/* Segment started with one or more valid characters, but fewer than 4 */
Status = AE_AML_ERROR;
DEBUG_PRINT (ACPI_ERROR, ("AmlExecNameSegment: Bad char %02x in name, at %p\n", *AmlAddress, AmlAddress));
}
DEBUG_PRINT (TRACE_EXEC, ("Leave AmlExecNameSegment %s \n", Gbl_ExceptionNames[Status]));
Status = AE_AML_BAD_NAME;
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n",
*AmlAddress, AmlAddress));
}
*InAmlAddress = AmlAddress;
return_ACPI_STATUS (Status);
}
/*****************************************************************************
/*******************************************************************************
*
* FUNCTION: AmlGetNameString
* FUNCTION: AcpiExGetNameString
*
* PARAMETERS: DataType - Data type to be associated with this name
*
@ -443,153 +335,160 @@ AmlExecNameSegment (
*
* DESCRIPTION: Get a name, including any prefixes.
*
****************************************************************************/
******************************************************************************/
ACPI_STATUS
AmlGetNameString (
ACPI_OBJECT_TYPE DataType,
AcpiExGetNameString (
ACPI_OBJECT_TYPE DataType,
UINT8 *InAmlAddress,
char **OutNameString,
UINT32 *OutNameLength)
NATIVE_CHAR **OutNameString,
UINT32 *OutNameLength)
{
ACPI_STATUS Status = AE_OK;
UINT8 *AmlAddress = InAmlAddress;
char *NameString = NULL;
INT32 NumSegments;
INT32 PrefixCount = 0;
UINT8 Prefix = 0;
NATIVE_CHAR *NameString = NULL;
UINT32 NumSegments;
UINT32 PrefixCount = 0;
BOOLEAN HasPrefix = FALSE;
FUNCTION_TRACE_PTR ("AmlGetNameString", AmlAddress);
ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
if (INTERNAL_TYPE_DefField == DataType ||
INTERNAL_TYPE_BankField == DataType ||
INTERNAL_TYPE_IndexField == DataType)
{
/* Disallow prefixes for types associated with field names */
if (INTERNAL_TYPE_REGION_FIELD == DataType ||
INTERNAL_TYPE_BANK_FIELD == DataType ||
INTERNAL_TYPE_INDEX_FIELD == DataType)
{
/* Disallow prefixes for types associated with FieldUnit names */
NameString = AmlAllocateNameString (0, 1);
NameString = AcpiExAllocateNameString (0, 1);
if (!NameString)
{
Status = AE_NO_MEMORY;
}
else
{
Status = AmlExecNameSegment (&AmlAddress, NameString);
Status = AcpiExNameSegment (&AmlAddress, NameString);
}
}
else
{
/* DataType is not a field name */
{
/*
* DataType is not a field name.
* Examine first character of name for root or parent prefix operators
*/
switch (*AmlAddress)
{
/* Examine first character of name for root or parent prefix operators */
{
case AML_ROOT_PREFIX:
case AML_RootPrefix:
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
Prefix = *AmlAddress++;
DEBUG_PRINT (TRACE_LOAD, ("RootPrefix: %x\n", Prefix));
/*
/*
* Remember that we have a RootPrefix --
* see comment in AmlAllocateNameString()
* see comment in AcpiExAllocateNameString()
*/
PrefixCount = -1;
AmlAddress++;
PrefixCount = ACPI_UINT32_MAX;
HasPrefix = TRUE;
break;
case AML_ParentPrefix:
case AML_PARENT_PREFIX:
/* Increment past possibly multiple parent prefixes */
do
{
Prefix = *AmlAddress++;
DEBUG_PRINT (TRACE_LOAD, ("ParentPrefix: %x\n", Prefix));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
++PrefixCount;
AmlAddress++;
PrefixCount++;
} while (*AmlAddress == AML_ParentPrefix);
} while (*AmlAddress == AML_PARENT_PREFIX);
HasPrefix = TRUE;
break;
default:
/* Not a prefix character */
break;
}
/* Examine first character of name for name segment prefix operator */
switch (*AmlAddress)
{
/* Examine first character of name for name segment prefix operator */
case AML_DualNamePrefix:
case AML_DUAL_NAME_PREFIX:
Prefix = *AmlAddress++;
DEBUG_PRINT (TRACE_LOAD, ("DualNamePrefix: %x\n", Prefix));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
NameString = AmlAllocateNameString (PrefixCount, 2);
AmlAddress++;
NameString = AcpiExAllocateNameString (PrefixCount, 2);
if (!NameString)
{
Status = AE_NO_MEMORY;
break;
}
/* Ensure PrefixCount != 0 to remember processing a prefix */
PrefixCount += 2;
/* Indicate that we processed a prefix */
if ((Status = AmlExecNameSegment (&AmlAddress, NameString)) == AE_OK)
HasPrefix = TRUE;
Status = AcpiExNameSegment (&AmlAddress, NameString);
if (ACPI_SUCCESS (Status))
{
Status = AmlExecNameSegment (&AmlAddress, NameString);
Status = AcpiExNameSegment (&AmlAddress, NameString);
}
break;
case AML_MultiNamePrefixOp:
case AML_MULTI_NAME_PREFIX_OP:
Prefix = *AmlAddress++;
DEBUG_PRINT (TRACE_LOAD, ("MultiNamePrefix: %x\n", Prefix));
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
NumSegments = *AmlAddress++; /* fetch count of segments */
/* Fetch count of segments remaining in name path */
NameString = AmlAllocateNameString (PrefixCount, NumSegments);
AmlAddress++;
NumSegments = *AmlAddress;
NameString = AcpiExAllocateNameString (PrefixCount, NumSegments);
if (!NameString)
{
Status = AE_NO_MEMORY;
break;
}
/* Ensure PrefixCount != 0 to remember processing a prefix */
PrefixCount += 2;
/* Indicate that we processed a prefix */
while (NumSegments && (Status = AmlExecNameSegment (&AmlAddress, NameString)) == AE_OK)
AmlAddress++;
HasPrefix = TRUE;
while (NumSegments &&
(Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK)
{
--NumSegments;
NumSegments--;
}
break;
case 0:
case 0:
/* NullName valid as of 8-12-98 ASL/AML Grammar Update */
if (-1 == PrefixCount)
if (PrefixCount == ACPI_UINT32_MAX)
{
/* RootPrefix followed by NULL */
DEBUG_PRINT (TRACE_EXEC,
("AmlDoName: NameSeg is \"\\\" followed by NULL\n"));
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "NameSeg is \"\\\" followed by NULL\n"));
}
AmlAddress++; /* consume NULL byte */
NameString = AmlAllocateNameString (PrefixCount, 0);
/* Consume the NULL byte */
AmlAddress++;
NameString = AcpiExAllocateNameString (PrefixCount, 0);
if (!NameString)
{
Status = AE_NO_MEMORY;
@ -603,31 +502,27 @@ AmlGetNameString (
/* Name segment string */
NameString = AmlAllocateNameString (PrefixCount, 1);
NameString = AcpiExAllocateNameString (PrefixCount, 1);
if (!NameString)
{
Status = AE_NO_MEMORY;
break;
}
Status = AmlExecNameSegment (&AmlAddress, NameString);
Status = AcpiExNameSegment (&AmlAddress, NameString);
break;
} /* Switch (PeekOp ()) */
}
}
if (AE_PENDING == Status && PrefixCount != 0)
if (AE_CTRL_PENDING == Status && HasPrefix)
{
/* Ran out of segments after processing a prefix */
DEBUG_PRINT (ACPI_ERROR, ("AmlDoName: Malformed Name\n"));
REPORT_ERROR ("Ran out of segments after processing a prefix");
Status = AE_AML_ERROR;
ACPI_REPORT_ERROR (
("ExDoName: Malformed Name at %p\n", NameString));
Status = AE_AML_BAD_NAME;
}
*OutNameString = NameString;
*OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
@ -635,5 +530,3 @@ AmlGetNameString (
}

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
* $Revision: 1.23 $
* $Revision: 1.9 $
*
*****************************************************************************/
@ -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 - 2002, Intel Corp.
* All rights reserved.
*
* 2. License
@ -172,20 +172,20 @@ AcpiExOpcode_3A_0T_0R (
ACPI_STATUS Status = AE_OK;
ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R",
AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */
case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
(UINT32) Operand[0]->Integer.Value,
(UINT32) Operand[1]->Integer.Value,
"FatalOp: Type %x Code %x Arg %x <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
(UINT32) Operand[0]->Integer.Value, (UINT32) Operand[1]->Integer.Value,
(UINT32) Operand[2]->Integer.Value));
Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
if (Fatal)
{
@ -194,9 +194,10 @@ AcpiExOpcode_3A_0T_0R (
Fatal->Argument = (UINT32) Operand[2]->Integer.Value;
}
/* Always signal the OS! */
Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
/*
* Always signal the OS!
*/
AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
/* Might return while OS is shutting down, just continue */
@ -239,24 +240,22 @@ AcpiExOpcode_3A_1T_1R (
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
char *Buffer;
ACPI_STATUS Status = AE_OK;
ACPI_NATIVE_UINT Index;
ACPI_SIZE Length;
UINT32 Index;
UINT32 Length;
ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R",
AcpiPsGetOpcodeName (WalkState->Opcode));
ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
/*
* Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type.
*/
ReturnDesc = AcpiUtCreateInternalObject (
ACPI_GET_OBJECT_TYPE (Operand[0]));
ReturnDesc = AcpiUtCreateInternalObject (Operand[0]->Common.Type);
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@ -265,8 +264,8 @@ AcpiExOpcode_3A_1T_1R (
/* Get the Integer values from the objects */
Index = (ACPI_NATIVE_UINT) Operand[1]->Integer.Value;
Length = (ACPI_SIZE) Operand[2]->Integer.Value;
Index = (UINT32) Operand[1]->Integer.Value;
Length = (UINT32) Operand[2]->Integer.Value;
/*
* If the index is beyond the length of the String/Buffer, or if the
@ -280,12 +279,12 @@ AcpiExOpcode_3A_1T_1R (
if ((Index + Length) >
Operand[0]->String.Length)
{
Length = (ACPI_SIZE) Operand[0]->String.Length - Index;
Length = Operand[0]->String.Length - Index;
}
/* Allocate a new buffer for the String/Buffer */
Buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
Buffer = ACPI_MEM_CALLOCATE (Length + 1);
if (!Buffer)
{
Status = AE_NO_MEMORY;
@ -300,12 +299,8 @@ AcpiExOpcode_3A_1T_1R (
/* Set the length of the new String/Buffer */
ReturnDesc->String.Pointer = Buffer;
ReturnDesc->String.Length = (UINT32) Length;
ReturnDesc->String.Length = Length;
}
/* Mark buffer initialized */
ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
break;
@ -332,10 +327,7 @@ Cleanup:
/* Set the return object and exit */
if (!WalkState->ResultObj)
{
WalkState->ResultObj = ReturnDesc;
}
WalkState->ResultObj = ReturnDesc;
return_ACPI_STATUS (Status);
}