示例#1
0
void
AcpiDbDisplayTemplate (
    char                    *BufferArg)
{
    ACPI_NAMESPACE_NODE     *Node;
    ACPI_STATUS             Status;
    ACPI_BUFFER             ReturnBuffer;


    /* Translate BufferArg to an Named object */

    Node = AcpiDbConvertToNode (BufferArg);
    if (!Node || (Node == AcpiGbl_RootNode))
    {
        AcpiOsPrintf ("Invalid argument: %s\n", BufferArg);
        return;
    }

    /* We must have a buffer object */

    if (Node->Type != ACPI_TYPE_BUFFER)
    {
        AcpiOsPrintf ("Not a Buffer object, cannot be a template: %s\n",
            BufferArg);
        return;
    }

    ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE;
    ReturnBuffer.Pointer = AcpiGbl_DbBuffer;

    /* Attempt to convert the raw buffer to a resource list */

    Status = AcpiRsCreateResourceList (Node->Object, &ReturnBuffer);

    AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
    AcpiDbgLevel |= ACPI_LV_RESOURCES;

    if (ACPI_FAILURE (Status))
    {
        AcpiOsPrintf (
            "Could not convert Buffer to a resource list: %s, %s\n",
            BufferArg, AcpiFormatException (Status));
        goto DumpBuffer;
    }

    /* Now we can dump the resource list */

    AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
        ReturnBuffer.Pointer));

DumpBuffer:
    AcpiOsPrintf ("\nRaw data buffer:\n");
    AcpiUtDebugDumpBuffer ((UINT8 *) Node->Object->Buffer.Pointer,
        Node->Object->Buffer.Length,
        DB_BYTE_DISPLAY, ACPI_UINT32_MAX);

    AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
    return;
}
示例#2
0
文件: rsutils.c 项目: MarginC/kame
ACPI_STATUS
AcpiRsGetPrsMethodData (
    ACPI_HANDLE             Handle,
    ACPI_BUFFER             *RetBuffer)
{
    ACPI_OPERAND_OBJECT     *RetObj;
    ACPI_STATUS             Status;
    UINT32                  BufferSpaceNeeded = RetBuffer->Length;


    FUNCTION_TRACE ("RsGetPrsMethodData");


    /* already validated params, so we won't repeat here */

    /*
     *  Execute the method, no parameters
     */
    Status = AcpiNsEvaluateRelative (Handle, "_PRS", NULL, &RetObj);
    if (ACPI_FAILURE (Status))
    {
        return_ACPI_STATUS (Status);
    }

    if (!RetObj)
    {
        /* Return object is required */

        ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
        return_ACPI_STATUS (AE_TYPE);
    }

    /*
     * The return object will be a buffer, but check the
     *  parameters.  If the return object is not a buffer,
     *  then the underlying AML code is corrupt or improperly
     *  written..
     */
    if (ACPI_TYPE_BUFFER != RetObj->Common.Type)
    {
        Status = AE_AML_OPERAND_TYPE;
        goto Cleanup;
    }

    /*
     * Make the call to create a resource linked list from the
     *  byte stream buffer that comes back from the _CRS method
     *  execution.
     */
    Status = AcpiRsCreateResourceList (RetObj, RetBuffer->Pointer,
                &BufferSpaceNeeded);

    /*
     * Tell the user how much of the buffer we have used or is needed
     *  and return the final status.
     */
    RetBuffer->Length = BufferSpaceNeeded;


    /* On exit, we must delete the object returned by evaluateObject */

Cleanup:

    AcpiUtRemoveReference (RetObj);
    return_ACPI_STATUS (Status);
}