diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2013-01-02 19:01:21 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2013-01-02 19:01:21 +0000 | 
| commit | b28e481ae9b051dab150e9b5a89730cdc1103a9c (patch) | |
| tree | 434e706ece73a93073f350c91cd35ed7d7e98811 /source/components/debugger/dbcmds.c | |
| parent | c2463a8709e5b3a5ce54c09d35b4820a756b0fc5 (diff) | |
Notes
Diffstat (limited to 'source/components/debugger/dbcmds.c')
| -rw-r--r-- | source/components/debugger/dbcmds.c | 158 | 
1 files changed, 88 insertions, 70 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index 5cd41781765f9..924e683118cab 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -87,12 +87,12 @@ AcpiDbDeviceResources (   *   * FUNCTION:    AcpiDbConvertToNode   * - * PARAMETERS:  InString        - String to convert + * PARAMETERS:  InString            - String to convert   *   * RETURN:      Pointer to a NS node   *   * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or - *              alpha strings. + *              alphanumeric strings.   *   ******************************************************************************/ @@ -126,9 +126,9 @@ AcpiDbConvertToNode (      }      else      { -        /* Alpha argument */ -        /* The parameter is a name string that must be resolved to a -         * Named obj +        /* +         * Alpha argument: The parameter is a name string that must be +         * resolved to a Namespace object.           */          Node = AcpiDbLocalNsLookup (InString);          if (!Node) @@ -145,7 +145,7 @@ AcpiDbConvertToNode (   *   * FUNCTION:    AcpiDbSleep   * - * PARAMETERS:  ObjectArg       - Desired sleep state (0-5) + * PARAMETERS:  ObjectArg           - Desired sleep state (0-5)   *   * RETURN:      Status   * @@ -236,7 +236,7 @@ AcpiDbDisplayLocks (   *   * FUNCTION:    AcpiDbDisplayTableInfo   * - * PARAMETERS:  TableArg        - String with name of table to be displayed + * PARAMETERS:  TableArg            - Name of table to be displayed   *   * RETURN:      None   * @@ -377,8 +377,8 @@ AcpiDbUnloadAcpiTable (   *   * FUNCTION:    AcpiDbSendNotify   * - * PARAMETERS:  Name            - Name of ACPI object to send the notify to - *              Value           - Value of the notify to send. + * PARAMETERS:  Name                - Name of ACPI object where to send notify + *              Value               - Value of the notify to send.   *   * RETURN:      None   * @@ -416,7 +416,8 @@ AcpiDbSendNotify (      }      else      { -        AcpiOsPrintf ("Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n", +        AcpiOsPrintf ( +            "Named object [%4.4s] Type %s, must be Device/Thermal/Processor type\n",              AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type));      }  } @@ -453,7 +454,6 @@ AcpiDbDisplayInterfaces (                      ACPI_WAIT_FOREVER);          NextInterface = AcpiGbl_SupportedInterfaces; -          while (NextInterface)          {              if (!(NextInterface->Flags & ACPI_OSI_INVALID)) @@ -518,7 +518,7 @@ AcpiDbDisplayInterfaces (   *   * FUNCTION:    AcpiDbDisplayTemplate   * - * PARAMETERS:  BufferArg           - Buffer name or addrss + * PARAMETERS:  BufferArg           - Buffer name or address   *   * RETURN:      None   * @@ -532,7 +532,7 @@ AcpiDbDisplayTemplate (  {      ACPI_NAMESPACE_NODE     *Node;      ACPI_STATUS             Status; -    ACPI_BUFFER             ReturnObj; +    ACPI_BUFFER             ReturnBuffer;      /* Translate BufferArg to an Named object */ @@ -553,12 +553,12 @@ AcpiDbDisplayTemplate (          return;      } -    ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; -    ReturnObj.Pointer = AcpiGbl_DbBuffer; +    ReturnBuffer.Length = ACPI_DEBUG_BUFFER_SIZE; +    ReturnBuffer.Pointer = AcpiGbl_DbBuffer;      /* Attempt to convert the raw buffer to a resource list */ -    Status = AcpiRsCreateResourceList (Node->Object, &ReturnObj); +    Status = AcpiRsCreateResourceList (Node->Object, &ReturnBuffer);      AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);      AcpiDbgLevel |= ACPI_LV_RESOURCES; @@ -573,7 +573,7 @@ AcpiDbDisplayTemplate (      /* Now we can dump the resource list */      AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, -        ReturnObj.Pointer)); +        ReturnBuffer.Pointer));  DumpBuffer:      AcpiOsPrintf ("\nRaw data buffer:\n"); @@ -666,7 +666,8 @@ AcpiDmCompareAmlResources (              {                  if (Aml1[i] != Aml2[i])                  { -                    AcpiOsPrintf ("Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n", +                    AcpiOsPrintf ( +                        "Mismatch at byte offset %.2X: is %2.2X, should be %2.2X\n",                          i, Aml2[i], Aml1[i]);                  }              } @@ -693,8 +694,8 @@ AcpiDmCompareAmlResources (   *   * FUNCTION:    AcpiDmTestResourceConversion   * - * PARAMETERS:  Node            - Parent device node - *              Name            - resource method name (_CRS) + * PARAMETERS:  Node                - Parent device node + *              Name                - resource method name (_CRS)   *   * RETURN:      Status   * @@ -709,8 +710,8 @@ AcpiDmTestResourceConversion (      char                    *Name)  {      ACPI_STATUS             Status; -    ACPI_BUFFER             ReturnObj; -    ACPI_BUFFER             ResourceObj; +    ACPI_BUFFER             ReturnBuffer; +    ACPI_BUFFER             ResourceBuffer;      ACPI_BUFFER             NewAml;      ACPI_OBJECT             *OriginalAml; @@ -718,12 +719,12 @@ AcpiDmTestResourceConversion (      AcpiOsPrintf ("Resource Conversion Comparison:\n");      NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER; -    ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; -    ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; +    ReturnBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; +    ResourceBuffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;      /* Get the original _CRS AML resource template */ -    Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj); +    Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnBuffer);      if (ACPI_FAILURE (Status))      {          AcpiOsPrintf ("Could not obtain %s: %s\n", @@ -733,7 +734,7 @@ AcpiDmTestResourceConversion (      /* Get the AML resource template, converted to internal resource structs */ -    Status = AcpiGetCurrentResources (Node, &ResourceObj); +    Status = AcpiGetCurrentResources (Node, &ResourceBuffer);      if (ACPI_FAILURE (Status))      {          AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", @@ -743,7 +744,7 @@ AcpiDmTestResourceConversion (      /* Convert internal resource list to external AML resource template */ -    Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml); +    Status = AcpiRsCreateAmlResources (ResourceBuffer.Pointer, &NewAml);      if (ACPI_FAILURE (Status))      {          AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n", @@ -753,7 +754,7 @@ AcpiDmTestResourceConversion (      /* Compare original AML to the newly created AML resource list */ -    OriginalAml = ReturnObj.Pointer; +    OriginalAml = ReturnBuffer.Pointer;      AcpiDmCompareAmlResources (          OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, @@ -763,9 +764,9 @@ AcpiDmTestResourceConversion (      ACPI_FREE (NewAml.Pointer);  Exit2: -    ACPI_FREE (ResourceObj.Pointer); +    ACPI_FREE (ResourceBuffer.Pointer);  Exit1: -    ACPI_FREE (ReturnObj.Pointer); +    ACPI_FREE (ReturnBuffer.Pointer);      return (Status);  } @@ -778,7 +779,8 @@ Exit1:   *   * RETURN:      Status   * - * DESCRIPTION: Simple callback to exercise AcpiWalkResources + * DESCRIPTION: Simple callback to exercise AcpiWalkResources and + *              AcpiWalkResourceBuffer.   *   ******************************************************************************/ @@ -817,7 +819,7 @@ AcpiDbDeviceResources (      ACPI_NAMESPACE_NODE     *PrsNode = NULL;      ACPI_NAMESPACE_NODE     *AeiNode = NULL;      char                    *ParentPath; -    ACPI_BUFFER             ReturnObj; +    ACPI_BUFFER             ReturnBuffer;      ACPI_STATUS             Status; @@ -843,8 +845,8 @@ AcpiDbDeviceResources (      /* Prepare for a return object of arbitrary size */ -    ReturnObj.Pointer = AcpiGbl_DbBuffer; -    ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +    ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +    ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE;      /* _PRT */ @@ -853,7 +855,7 @@ AcpiDbDeviceResources (      {          AcpiOsPrintf ("Evaluating _PRT\n"); -        Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnObj); +        Status = AcpiEvaluateObject (PrtNode, NULL, NULL, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("Could not evaluate _PRT: %s\n", @@ -861,10 +863,10 @@ AcpiDbDeviceResources (              goto GetCrs;          } -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE; -        Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); +        Status = AcpiGetIrqRoutingTable (Node, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", @@ -883,10 +885,10 @@ GetCrs:      {          AcpiOsPrintf ("Evaluating _CRS\n"); -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE; -        Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnObj); +        Status = AcpiEvaluateObject (CrsNode, NULL, NULL, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("Could not evaluate _CRS: %s\n", @@ -894,7 +896,7 @@ GetCrs:              goto GetPrs;          } -        /* This code is here to exercise the AcpiWalkResources interface */ +        /* This code exercises the AcpiWalkResources interface */          Status = AcpiWalkResources (Node, METHOD_NAME__CRS,              AcpiDbResourceCallback, NULL); @@ -905,12 +907,12 @@ GetCrs:              goto GetPrs;          } -        /* Get the _CRS resource list */ +        /* Get the _CRS resource list (test ALLOCATE buffer) */ -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = NULL; +        ReturnBuffer.Length  = ACPI_ALLOCATE_LOCAL_BUFFER; -        Status = AcpiGetCurrentResources (Node, &ReturnObj); +        Status = AcpiGetCurrentResources (Node, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", @@ -918,26 +920,41 @@ GetCrs:              goto GetPrs;          } +        /* This code exercises the AcpiWalkResourceBuffer interface */ + +        Status = AcpiWalkResourceBuffer (&ReturnBuffer, +            AcpiDbResourceCallback, NULL); +        if (ACPI_FAILURE (Status)) +        { +            AcpiOsPrintf ("AcpiWalkResourceBuffer failed: %s\n", +                AcpiFormatException (Status)); +            goto EndCrs; +        } +          /* Dump the _CRS resource list */          AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, -            ReturnObj.Pointer)); +            ReturnBuffer.Pointer));          /* -         * Perform comparison of original AML to newly created AML. This tests both -         * the AML->Resource conversion and the Resource->Aml conversion. +         * Perform comparison of original AML to newly created AML. This +         * tests both the AML->Resource conversion and the Resource->AML +         * conversion.           */ -        Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); +        (void) AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);          /* Execute _SRS with the resource list */ -        Status = AcpiSetCurrentResources (Node, &ReturnObj); +        Status = AcpiSetCurrentResources (Node, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",                  AcpiFormatException (Status)); -            goto GetPrs; +            goto EndCrs;          } + +EndCrs: +        ACPI_FREE_BUFFER (ReturnBuffer);      } @@ -948,10 +965,10 @@ GetPrs:      {          AcpiOsPrintf ("Evaluating _PRS\n"); -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE; -        Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnObj); +        Status = AcpiEvaluateObject (PrsNode, NULL, NULL, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("Could not evaluate _PRS: %s\n", @@ -959,10 +976,10 @@ GetPrs:              goto GetAei;          } -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE; -        Status = AcpiGetPossibleResources (Node, &ReturnObj); +        Status = AcpiGetPossibleResources (Node, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", @@ -981,10 +998,10 @@ GetAei:      {          AcpiOsPrintf ("Evaluating _AEI\n"); -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE; -        Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnObj); +        Status = AcpiEvaluateObject (AeiNode, NULL, NULL, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("Could not evaluate _AEI: %s\n", @@ -992,10 +1009,10 @@ GetAei:              goto Cleanup;          } -        ReturnObj.Pointer = AcpiGbl_DbBuffer; -        ReturnObj.Length  = ACPI_DEBUG_BUFFER_SIZE; +        ReturnBuffer.Pointer = AcpiGbl_DbBuffer; +        ReturnBuffer.Length  = ACPI_DEBUG_BUFFER_SIZE; -        Status = AcpiGetEventResources (Node, &ReturnObj); +        Status = AcpiGetEventResources (Node, &ReturnBuffer);          if (ACPI_FAILURE (Status))          {              AcpiOsPrintf ("AcpiGetEventResources failed: %s\n", @@ -1017,8 +1034,9 @@ Cleanup:   *   * FUNCTION:    AcpiDbDisplayResources   * - * PARAMETERS:  ObjectArg       - String object name or object pointer. - *                                "*" means "display resources for all devices" + * PARAMETERS:  ObjectArg           - String object name or object pointer. + *                                    "*" means "display resources for all + *                                    devices"   *   * RETURN:      None   * @@ -1071,13 +1089,13 @@ AcpiDbDisplayResources (   *   * FUNCTION:    AcpiDbGenerateGpe   * - * PARAMETERS:  GpeArg          - Raw GPE number, ascii string - *              BlockArg        - GPE block number, ascii string - *                                0 or 1 for FADT GPE blocks + * PARAMETERS:  GpeArg              - Raw GPE number, ascii string + *              BlockArg            - GPE block number, ascii string + *                                    0 or 1 for FADT GPE blocks   *   * RETURN:      None   * - * DESCRIPTION: Generate a GPE + * DESCRIPTION: Simulate firing of a GPE   *   ******************************************************************************/  | 
