FreeBSD/sys/contrib/dev/acpica/components/namespace/nsxfeval.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiEvaluateObjectTyped
 *
 * PARAMETERS:  Handle              - Object handle (optional)
 *              Pathname            - Object pathname (optional)
 *              ExternalParams      - List of parameters to pass to method,
 *                                    terminated by NULL. May be NULL
 *                                    if no parameters are being passed.
 *              ReturnBuffer        - Where to put method's return value (if
 *                                    any). If NULL, no value is returned.
 *              ReturnType          - Expected type of return object
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Find and evaluate the given object, passing the given
 *              parameters if necessary. One of "Handle" or "Pathname" must
 *              be valid (non-null)
 *
 ******************************************************************************/
AcpiEvaluateObjectTyped
PARAMETERS:  Handle              - Object handle (optional)
Pathname            - Object pathname (optional)
ExternalParams      - List of parameters to pass to method,
terminated by NULL. May be NULL
if no parameters are being passed.
ReturnBuffer        - Where to put method's return value (if
any). If NULL, no value is returned.
ReturnType          - Expected type of return object

Status

Find and evaluate the given object, passing the given
parameters if necessary. One of "Handle" or "Pathname" must
be valid (non-null)
AcpiEvaluateObjectTyped PARAMETERS : Handle - Object handle ( optional ) Pathname - Object pathname ( optional ) ExternalParams - List of parameters to pass to method terminated by NULL . May be NULL if no parameters are being passed . ReturnBuffer - Where to put method ' s return value ( if any ) . If NULL no value is returned . ReturnType - Expected type of return object Status Find and evaluate the given object passing the given parameters if necessary . One of " Handle " or " Pathname " must be valid ( non - null )
ACPI_STATUS
AcpiEvaluateObjectTyped (
    ACPI_HANDLE             Handle,
    ACPI_STRING             Pathname,
    ACPI_OBJECT_LIST        *ExternalParams,
    ACPI_BUFFER             *ReturnBuffer,
    ACPI_OBJECT_TYPE        ReturnType)
{
    ACPI_STATUS             Status;
    BOOLEAN                 FreeBufferOnError = FALSE;
    ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped);
    if (!ReturnBuffer)
    {
        return_ACPI_STATUS (AE_BAD_PARAMETER);
    }
    if (ReturnBuffer->Length == ACPI_ALLOCATE_BUFFER)
    {
        FreeBufferOnError = TRUE;
    }
    Status = AcpiEvaluateObject (Handle, Pathname,
        ExternalParams, ReturnBuffer);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }
    if (ReturnType == ACPI_TYPE_ANY)
    {
        return_ACPI_STATUS (AE_OK);
    }
    if (ReturnBuffer->Length == 0)
    {
        ACPI_ERROR ((AE_INFO, "No return value"));
        return_ACPI_STATUS (AE_NULL_OBJECT);
    }
    if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType)
    {
        return_ACPI_STATUS (AE_OK);
    }
    ACPI_ERROR ((AE_INFO,
        "Incorrect return type [%s] requested [%s]",
        AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
        AcpiUtGetTypeName (ReturnType)));
    if (FreeBufferOnError)
    {
        AcpiOsFree (ReturnBuffer->Pointer);
        ReturnBuffer->Pointer = NULL;
    }
    ReturnBuffer->Length = 0;
    return_ACPI_STATUS (AE_TYPE);
}
ACPI_STATUS AcpiEvaluateObjectTyped ( ACPI_HANDLE Handle , ACPI_STRING Pathname , ACPI_OBJECT_LIST * ExternalParams , ACPI_BUFFER * ReturnBuffer , ACPI_OBJECT_TYPE ReturnType ) { ACPI_STATUS Status ; BOOLEAN FreeBufferOnError = FALSE ; ACPI_FUNCTION_TRACE ( AcpiEvaluateObjectTyped ) ; if ( ! ReturnBuffer ) { return_ACPI_STATUS ( AE_BAD_PARAMETER ) ; } if ( ReturnBuffer -> Length == ACPI_ALLOCATE_BUFFER ) { FreeBufferOnError = TRUE ; } Status = AcpiEvaluateObject ( Handle , Pathname , ExternalParams , ReturnBuffer ) ; if ( ACPI_FAILURE ( Status ) ) { return_ACPI_STATUS ( Status ) ; } if ( ReturnType == ACPI_TYPE_ANY ) { return_ACPI_STATUS ( AE_OK ) ; } if ( ReturnBuffer -> Length == 0 ) { ACPI_ERROR ( ( AE_INFO , " " ) ) ; return_ACPI_STATUS ( AE_NULL_OBJECT ) ; } if ( ( ( ACPI_OBJECT * ) ReturnBuffer -> Pointer ) -> Type == ReturnType ) { return_ACPI_STATUS ( AE_OK ) ; } ACPI_ERROR ( ( AE_INFO , " " , AcpiUtGetTypeName ( ( ( ACPI_OBJECT * ) ReturnBuffer -> Pointer ) -> Type ) , AcpiUtGetTypeName ( ReturnType ) ) ) ; if ( FreeBufferOnError ) { AcpiOsFree ( ReturnBuffer -> Pointer ) ; ReturnBuffer -> Pointer = NULL ; } ReturnBuffer -> Length = 0 ; return_ACPI_STATUS ( AE_TYPE ) ; }
FUNCTION:    AcpiEvaluateObjectTyped
 PARAMETERS:  Handle              - Object handle (optional)
              Pathname            - Object pathname (optional)
              ExternalParams      - List of parameters to pass to method,
                                    terminated by NULL.
FUNCTION : AcpiEvaluateObjectTyped PARAMETERS : Handle - Object handle ( optional ) Pathname - Object pathname ( optional ) ExternalParams - List of parameters to pass to method terminated by NULL .
/* Return buffer must be valid */ /* Evaluate the object */ /* Type ANY means "don't care" */ /* Error because caller specifically asked for a return value */ /* Examine the object type returned from EvaluateObject */ /* Return object type does not match requested type */ /*
         * Free a buffer created via ACPI_ALLOCATE_BUFFER.
         * Note: We use AcpiOsFree here because AcpiOsAllocate was used
         * to allocate the buffer. This purposefully bypasses the
         * (optionally enabled) allocation tracking mechanism since we
         * only want to track internal allocations.
         */