Moved common utility functions to utility directory

This commit is contained in:
rmoore1 2005-10-07 21:38:06 +00:00
parent 0b5473973b
commit 5f950af50c
3 changed files with 10 additions and 145 deletions

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
* $Revision: 1.64 $
* $Revision: 1.65 $
*
******************************************************************************/
@ -448,7 +448,7 @@ AcpiRsGetListLength (
{
/* The next byte in the stream is the resource descriptor type */
ResourceType = AcpiRsGetResourceType (*AmlBuffer);
ResourceType = AcpiUtGetResourceType (AmlBuffer);
/* Get the base stream size and structure sizes for the descriptor */
@ -460,8 +460,7 @@ AcpiRsGetListLength (
/* Get the Length field from the input resource descriptor */
ResourceLength = AcpiRsGetResourceLength (
ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer));
ResourceLength = AcpiUtGetResourceLength (AmlBuffer);
/* Augment the size for descriptors with optional fields */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
* $Revision: 1.45 $
* $Revision: 1.46 $
*
******************************************************************************/
@ -169,7 +169,7 @@ AcpiRsValidateResourceLength (
return (AE_AML_INVALID_RESOURCE_TYPE);
}
ResourceLength = AcpiRsGetResourceLength (Aml);
ResourceLength = AcpiUtGetResourceLength (Aml);
MinimumAmlResourceLength = ResourceInfo->MinimumAmlResourceLength;
/* Validate based upon the type of resource, fixed length or variable */
@ -299,11 +299,8 @@ AcpiRsConvertAmlToResources (
return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
}
ResourceLength = AcpiRsGetResourceLength (
ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer));
DescriptorLength = AcpiRsGetDescriptorLength (
ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer));
ResourceLength = AcpiUtGetResourceLength (AmlBuffer);
DescriptorLength = AcpiUtGetDescriptorLength (AmlBuffer);
/*
* Perform limited validation of the resource length, based upon
@ -335,7 +332,7 @@ AcpiRsConvertAmlToResources (
/* Normal exit on completion of an EndTag resource descriptor */
if (AcpiRsGetResourceType (*AmlBuffer) == ACPI_RESOURCE_NAME_END_TAG)
if (AcpiUtGetResourceType (AmlBuffer) == ACPI_RESOURCE_NAME_END_TAG)
{
return_ACPI_STATUS (AE_OK);
}
@ -434,8 +431,7 @@ AcpiRsConvertResourcesToAml (
/* Extract the total length of the new descriptor */
/* Set the AmlBuffer to point to the next (output) resource descriptor */
AmlBuffer += AcpiRsGetDescriptorLength (
ACPI_CAST_PTR (AML_RESOURCE, AmlBuffer));
AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer);
/* Point to the next input resource descriptor */

View File

@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
* $Revision: 1.48 $
* $Revision: 1.49 $
*
******************************************************************************/
@ -242,98 +242,6 @@ AcpiRsGetResourceInfo (
}
/*******************************************************************************
*
* FUNCTION: AcpiRsGetResourceLength
*
* PARAMETERS: Aml - Pointer to the raw AML resource descriptor
*
* RETURN: Byte Length
*
* DESCRIPTION: Get the "Resource Length" of a raw AML descriptor. By
* definition, this does not include the size of the descriptor
* header or the length field itself.
*
******************************************************************************/
UINT16
AcpiRsGetResourceLength (
AML_RESOURCE *Aml)
{
UINT16 ResourceLength;
ACPI_FUNCTION_ENTRY ();
/* Determine if this is a small or large resource */
if (Aml->LargeHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
{
/* Large Resource type -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_16 (&ResourceLength, &Aml->LargeHeader.ResourceLength);
}
else
{
/* Small Resource type -- bits 2:0 of byte 0 contain the length */
ResourceLength = (UINT16) (Aml->SmallHeader.DescriptorType &
ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
}
return (ResourceLength);
}
/*******************************************************************************
*
* FUNCTION: AcpiRsGetDescriptorLength
*
* PARAMETERS: Aml - Pointer to the raw AML resource descriptor
*
* RETURN: Byte length
*
* DESCRIPTION: Get the total byte length of a raw AML descriptor, including the
* length of the descriptor header and the length field itself.
* Used to walk descriptor lists.
*
******************************************************************************/
UINT32
AcpiRsGetDescriptorLength (
AML_RESOURCE *Aml)
{
UINT32 DescriptorLength;
ACPI_FUNCTION_ENTRY ();
/* Determine if this is a small or large resource */
if (Aml->LargeHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
{
/* Large Resource type -- bytes 1-2 contain the 16-bit length */
ACPI_MOVE_16_TO_32 (&DescriptorLength, &Aml->LargeHeader.ResourceLength);
DescriptorLength += sizeof (AML_RESOURCE_LARGE_HEADER);
}
else
{
/* Small Resource type -- bits 2:0 of byte 0 contain the length */
DescriptorLength = (UINT32) (Aml->SmallHeader.DescriptorType &
ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK);
DescriptorLength += sizeof (AML_RESOURCE_SMALL_HEADER);
}
return (DescriptorLength);
}
/*******************************************************************************
*
* FUNCTION: AcpiRsSetResourceHeader
@ -392,44 +300,6 @@ AcpiRsSetResourceHeader (
}
/*******************************************************************************
*
* FUNCTION: AcpiRsGetResourceType
*
* PARAMETERS: ResourceType - Byte 0 of a resource descriptor
*
* RETURN: The Resource Type with no extraneous bits (except the
* Large/Small descriptor bit -- this is left alone)
*
* DESCRIPTION: Extract the Resource Type/Name from the first byte of
* a resource descriptor.
*
******************************************************************************/
UINT8
AcpiRsGetResourceType (
UINT8 ResourceType)
{
ACPI_FUNCTION_ENTRY ();
/* Determine if this is a small or large resource */
if (ResourceType & ACPI_RESOURCE_NAME_LARGE)
{
/* Large Resource Type -- bits 6:0 contain the name */
return (ResourceType);
}
else
{
/* Small Resource Type -- bits 6:3 contain the name */
return ((UINT8) (ResourceType & ACPI_RESOURCE_NAME_SMALL_MASK));
}
}
/*******************************************************************************
*
* FUNCTION: AcpiRsStrcpy