diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2019-02-20 23:04:28 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2019-02-20 23:04:28 +0000 | 
| commit | 933b0124ad04366156cb4793d2530ad791d88ead (patch) | |
| tree | 6d20df0ad987596d76c7b0f8e58ef8e8e25b4b69 /source/components/debugger | |
| parent | ca9862327327526f102b9370cc74b2a9e4641b0d (diff) | |
Notes
Diffstat (limited to 'source/components/debugger')
| -rw-r--r-- | source/components/debugger/dbdisply.c | 4 | ||||
| -rw-r--r-- | source/components/debugger/dbexec.c | 4 | ||||
| -rw-r--r-- | source/components/debugger/dbnames.c | 2 | ||||
| -rw-r--r-- | source/components/debugger/dbobject.c | 2 | ||||
| -rw-r--r-- | source/components/debugger/dbtest.c | 163 | 
5 files changed, 103 insertions, 72 deletions
diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index d0583fc7498f..539ff5af117d 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -410,7 +410,7 @@ AcpiDbDecodeAndDisplayObject (          default: -            /* Is not a recognizeable object */ +            /* Is not a recognizable object */              AcpiOsPrintf (                  "Not a known ACPI internal object, descriptor type %2.2X\n", @@ -866,7 +866,7 @@ AcpiDbDisplayObjectType (   *   * DESCRIPTION: Display the result of an AML opcode   * - * Note: Curently only displays the result object if we are single stepping. + * Note: Currently only displays the result object if we are single stepping.   * However, this output may be useful in other contexts and could be enabled   * to do so if needed.   * diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 03ea9bf2eadc..49d1180fba58 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -331,12 +331,12 @@ AcpiDbExecuteMethod (          }          ACPI_EXCEPTION ((AE_INFO, Status, -            "while executing %s from debugger", Info->Pathname)); +            "while executing %s from AML Debugger", Info->Pathname));          if (Status == AE_BUFFER_OVERFLOW)          {              ACPI_ERROR ((AE_INFO, -                "Possible overflow of internal debugger " +                "Possible buffer overflow within AML Debugger "                  "buffer (size 0x%X needed 0x%X)",                  ACPI_DEBUG_BUFFER_SIZE, (UINT32) ReturnObj->Length));          } diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c index 781e3a981cb5..3c01e8088651 100644 --- a/source/components/debugger/dbnames.c +++ b/source/components/debugger/dbnames.c @@ -1175,7 +1175,7 @@ AcpiDbBusWalk (   *   * RETURN:      None   * - * DESCRIPTION: Display info about system busses. + * DESCRIPTION: Display info about system buses.   *   ******************************************************************************/ diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c index c54394def601..f9dc6687cd1b 100644 --- a/source/components/debugger/dbobject.c +++ b/source/components/debugger/dbobject.c @@ -420,7 +420,7 @@ AcpiDbDisplayInternalObject (              AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); -            /* Decode the refererence */ +            /* Decode the reference */              switch (ObjDesc->Reference.Class)              { diff --git a/source/components/debugger/dbtest.c b/source/components/debugger/dbtest.c index 560fb86f8697..67b9cbea22a8 100644 --- a/source/components/debugger/dbtest.c +++ b/source/components/debugger/dbtest.c @@ -154,6 +154,7 @@  #include "acdebug.h"  #include "acnamesp.h"  #include "acpredef.h" +#include "acinterp.h"  #define _COMPONENT          ACPI_CA_DEBUGGER @@ -193,6 +194,10 @@ AcpiDbTestPackageType (      ACPI_NAMESPACE_NODE     *Node);  static ACPI_STATUS +AcpiDbTestFieldUnitType ( +    ACPI_OPERAND_OBJECT     *ObjDesc); + +static ACPI_STATUS  AcpiDbReadFromObject (      ACPI_NAMESPACE_NODE     *Node,      ACPI_OBJECT_TYPE        ExpectedType, @@ -241,7 +246,7 @@ static ACPI_DB_ARGUMENT_INFO    AcpiDbTestTypes [] =  static ACPI_HANDLE          ReadHandle = NULL;  static ACPI_HANDLE          WriteHandle = NULL; -/* ASL Definitions of the debugger read/write control methods */ +/* ASL Definitions of the debugger read/write control methods. AML below. */  #if 0  DefinitionBlock ("ssdt.aml", "SSDT", 2, "Intel", "DEBUG", 0x00000001) @@ -407,10 +412,8 @@ AcpiDbTestAllObjects (   * RETURN:      Status   *   * DESCRIPTION: Test one namespace object. Supported types are Integer, - *              String, Buffer, BufferField, and FieldUnit. All other object - *              types are simply ignored. - * - *              Note: Support for Packages is not implemented. + *              String, Buffer, Package, BufferField, and FieldUnit. + *              All other object types are simply ignored.   *   ******************************************************************************/ @@ -423,7 +426,6 @@ AcpiDbTestOneObject (  {      ACPI_NAMESPACE_NODE     *Node;      ACPI_OPERAND_OBJECT     *ObjDesc; -    ACPI_OPERAND_OBJECT     *RegionObj;      ACPI_OBJECT_TYPE        LocalType;      UINT32                  BitLength = 0;      UINT32                  ByteLength = 0; @@ -466,19 +468,22 @@ AcpiDbTestOneObject (          break;      case ACPI_TYPE_FIELD_UNIT: -    case ACPI_TYPE_BUFFER_FIELD:      case ACPI_TYPE_LOCAL_REGION_FIELD:      case ACPI_TYPE_LOCAL_INDEX_FIELD:      case ACPI_TYPE_LOCAL_BANK_FIELD: +        LocalType = ACPI_TYPE_FIELD_UNIT; +        break; + +    case ACPI_TYPE_BUFFER_FIELD: +        /* +         * The returned object will be a Buffer if the field length +         * is larger than the size of an Integer (32 or 64 bits +         * depending on the DSDT version). +         */          LocalType = ACPI_TYPE_INTEGER;          if (ObjDesc)          { -            /* -             * Returned object will be a Buffer if the field length -             * is larger than the size of an Integer (32 or 64 bits -             * depending on the DSDT version). -             */              BitLength = ObjDesc->CommonField.BitLength;              ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);              if (BitLength > AcpiGbl_IntegerBitWidth) @@ -488,9 +493,9 @@ AcpiDbTestOneObject (          }          break; -    default: +default: -        /* Ignore all other types */ +        /* Ignore all non-data types - Methods, Devices, Scopes, etc. */          return (AE_OK);      } @@ -502,40 +507,10 @@ AcpiDbTestOneObject (      if (!ObjDesc)      { -        AcpiOsPrintf (" Ignoring, no attached object\n"); +        AcpiOsPrintf (" No attached sub-object, ignoring\n");          return (AE_OK);      } -    /* -     * Check for unsupported region types. Note: AcpiExec simulates -     * access to SystemMemory, SystemIO, PCI_Config, and EC. -     */ -    switch (Node->Type) -    { -    case ACPI_TYPE_LOCAL_REGION_FIELD: - -        RegionObj = ObjDesc->Field.RegionObj; -        switch (RegionObj->Region.SpaceId) -        { -        case ACPI_ADR_SPACE_SYSTEM_MEMORY: -        case ACPI_ADR_SPACE_SYSTEM_IO: -        case ACPI_ADR_SPACE_PCI_CONFIG: - -            break; - -        default: - -            AcpiOsPrintf ("      %s space is not supported in this command [%4.4s]\n", -                AcpiUtGetRegionName (RegionObj->Region.SpaceId), -                RegionObj->Region.Node->Name.Ascii); -            return (AE_OK); -        } -        break; - -    default: -        break; -    } -      /* At this point, we have resolved the object to one of the major types */      switch (LocalType) @@ -560,6 +535,11 @@ AcpiDbTestOneObject (          Status = AcpiDbTestPackageType (Node);          break; +    case ACPI_TYPE_FIELD_UNIT: + +        Status = AcpiDbTestFieldUnitType (ObjDesc); +        break; +      default:          AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)", @@ -572,24 +552,8 @@ AcpiDbTestOneObject (      if (ACPI_FAILURE (Status))      {          Status = AE_OK; -        goto Exit; -    } - -    switch (Node->Type) -    { -    case ACPI_TYPE_LOCAL_REGION_FIELD: - -        RegionObj = ObjDesc->Field.RegionObj; -        AcpiOsPrintf (" (%s)", -            AcpiUtGetRegionName (RegionObj->Region.SpaceId)); - -        break; - -    default: -        break;      } -Exit:      AcpiOsPrintf ("\n");      return (Status);  } @@ -639,7 +603,7 @@ AcpiDbTestIntegerType (          return (Status);      } -    AcpiOsPrintf (" (%4.4X/%3.3X) %8.8X%8.8X", +    AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " %8.8X%8.8X",          BitLength, ACPI_ROUND_BITS_UP_TO_BYTES (BitLength),          ACPI_FORMAT_UINT64 (Temp1->Integer.Value)); @@ -761,8 +725,8 @@ AcpiDbTestBufferType (      /* Emit a few bytes of the buffer */ -    AcpiOsPrintf (" (%4.4X/%3.3X)", BitLength, Temp1->Buffer.Length); -    for (i = 0; ((i < 4) && (i < ByteLength)); i++) +    AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT, BitLength, Temp1->Buffer.Length); +    for (i = 0; ((i < 8) && (i < ByteLength)); i++)      {          AcpiOsPrintf (" %2.2X", Temp1->Buffer.Pointer[i]);      } @@ -876,7 +840,7 @@ AcpiDbTestStringType (          return (Status);      } -    AcpiOsPrintf (" (%4.4X/%3.3X) \"%s\"", (Temp1->String.Length * 8), +    AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " \"%s\"", (Temp1->String.Length * 8),          Temp1->String.Length, Temp1->String.Pointer);      /* Write a new value */ @@ -966,7 +930,7 @@ AcpiDbTestPackageType (          return (Status);      } -    AcpiOsPrintf (" %8.8X Elements", Temp1->Package.Count); +    AcpiOsPrintf (" %.2X Elements", Temp1->Package.Count);      AcpiOsFree (Temp1);      return (Status);  } @@ -974,6 +938,73 @@ AcpiDbTestPackageType (  /*******************************************************************************   * + * FUNCTION:    AcpiDbTestFieldUnitType + * + * PARAMETERS:  ObjDesc                 - A field unit object + * + * RETURN:      Status + * + * DESCRIPTION: Test read/write on a named field unit. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDbTestFieldUnitType ( +    ACPI_OPERAND_OBJECT     *ObjDesc) +{ +    ACPI_OPERAND_OBJECT     *RegionObj; +    UINT32                  BitLength = 0; +    UINT32                  ByteLength = 0; +    ACPI_STATUS             Status = AE_OK; +    ACPI_OPERAND_OBJECT     *RetBufferDesc; + + +    /* Supported spaces are memory/io/pci_config */ + +    RegionObj = ObjDesc->Field.RegionObj; +    switch (RegionObj->Region.SpaceId) +    { +    case ACPI_ADR_SPACE_SYSTEM_MEMORY: +    case ACPI_ADR_SPACE_SYSTEM_IO: +    case ACPI_ADR_SPACE_PCI_CONFIG: + +        /* Need the interpreter to execute */ + +        AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER); +        AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + +        /* Exercise read-then-write */ + +        Status = AcpiExReadDataFromField (NULL, ObjDesc, &RetBufferDesc); +        if (Status == AE_OK) +        { +            AcpiExWriteDataToField (RetBufferDesc, ObjDesc, NULL); +            AcpiUtRemoveReference (RetBufferDesc); +        } + +        AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); +        AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER); + +        BitLength = ObjDesc->CommonField.BitLength; +        ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength); + +        AcpiOsPrintf (ACPI_DEBUG_LENGTH_FORMAT " [%s]", BitLength, +            ByteLength, AcpiUtGetRegionName (RegionObj->Region.SpaceId)); +        return (Status); + +    default: + +        AcpiOsPrintf ( +            "      %s address space is not supported in this command [%4.4s]", +            AcpiUtGetRegionName (RegionObj->Region.SpaceId), +            RegionObj->Region.Node->Name.Ascii); +        return (AE_OK); +    } +} + + +/******************************************************************************* + *   * FUNCTION:    AcpiDbReadFromObject   *   * PARAMETERS:  Node                - Parent NS node for the object  | 
