dbmethod.c revision 199767f8919635c4928607450d9e0abb932109ce
/*******************************************************************************
*
* Module Name: dbmethod - Debug commands for control methods
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbmethod")
/*******************************************************************************
*
* FUNCTION: AcpiDbSetMethodBreakpoint
*
* PARAMETERS: Location - AML offset of breakpoint
* WalkState - Current walk info
* Op - Current Op (from parse walk)
*
* RETURN: None
*
* DESCRIPTION: Set a breakpoint in a control method at the specified
* AML offset
*
******************************************************************************/
void
char *Location,
{
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
/* Get and verify the breakpoint address */
{
AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
}
/* Save breakpoint in current walk */
}
/*******************************************************************************
*
* FUNCTION: AcpiDbSetMethodCallBreakpoint
*
* PARAMETERS: Op - Current Op (from parse walk)
*
* RETURN: None
*
* DESCRIPTION: Set a breakpoint in a control method at the specified
* AML offset
*
******************************************************************************/
void
{
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbSetMethodData
*
* PARAMETERS: TypeArg - L for local, A for argument
* IndexArg - which one
* ValueArg - Value to set.
*
* RETURN: None
*
* DESCRIPTION: Set a local or argument for the running control method.
* NOTE: only object supported is Number.
*
******************************************************************************/
void
char *TypeArg,
char *IndexArg,
char *ValueArg)
{
char Type;
/* Validate TypeArg */
if ((Type != 'L') &&
(Type != 'A') &&
(Type != 'N'))
{
return;
}
if (Type == 'N')
{
if (!Node)
{
return;
}
{
AcpiOsPrintf ("Can only set Integer nodes\n");
return;
}
return;
}
/* Get the index and value */
if (!WalkState)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
/* Create and initialize the new object */
if (!ObjDesc)
{
AcpiOsPrintf ("Could not create an internal object\n");
return;
}
/* Store the new object into the target */
switch (Type)
{
case 'A':
/* Set a method argument */
if (Index > ACPI_METHOD_MAX_ARG)
{
AcpiOsPrintf ("Arg%u - Invalid argument name\n",
Index);
goto Cleanup;
}
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
break;
case 'L':
/* Set a method local */
if (Index > ACPI_METHOD_MAX_LOCAL)
{
AcpiOsPrintf ("Local%u - Invalid local variable name\n",
Index);
goto Cleanup;
}
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisassembleAml
*
* PARAMETERS: Statements - Number of statements to disassemble
* Op - Current Op (from parse walk)
*
* RETURN: None
*
* DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
* of statements specified.
*
******************************************************************************/
void
char *Statements,
{
if (!Op)
{
AcpiOsPrintf ("There is no method currently executing\n");
return;
}
if (Statements)
{
}
#ifdef ACPI_DISASSEMBLER
#endif
}
/*******************************************************************************
*
* FUNCTION: AcpiDbDisassembleMethod
*
* PARAMETERS: Name - Name of control method
*
* RETURN: None
*
* DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
* of statements specified.
*
******************************************************************************/
char *Name)
{
if (!Method)
{
return (AE_BAD_PARAMETER);
}
{
return (AE_BAD_PARAMETER);
}
if (!Op)
{
return (AE_NO_MEMORY);
}
/* Create and initialize a new walk state */
if (!WalkState)
{
return (AE_NO_MEMORY);
}
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Push start scope on scope stack and make it current */
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Parse the entire method AML including deferred operators */
#ifdef ACPI_DISASSEMBLER
(void) AcpiDmParseDeferredOps (Op);
/* Now we can disassemble the method */
#endif
/* Method cleanup */
return (AE_OK);
}