Purged unnecessary 0x's in debug output, most output is hex

date	2000.11.17.19.36.00;	author rmoore1;	state Exp;
This commit is contained in:
aystarik 2005-06-29 18:41:34 +00:00
parent fb8e5864d0
commit 346b3faf4f
3 changed files with 527 additions and 666 deletions

View File

@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
* $Revision: 1.74 $
* $Revision: 1.75 $
*
******************************************************************************/
@ -350,7 +350,7 @@ AcpiEvaluateObject (
*/
DEBUG_PRINT (ACPI_INFO,
("AcpiEvaluateObject: Needed buffer size %d, received %d\n",
("AcpiEvaluateObject: Needed buffer size %X, received %X\n",
BufferSpaceNeeded, UserBufferLength));
ReturnBuffer->Length = BufferSpaceNeeded;

View File

@ -1,7 +1,9 @@
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
* $Revision: 1.51 $
* Module Name: rscreate - AcpiRsCreateResourceList
* AcpiRsCreatePciRoutingTable
* AcpiRsCreateByteStream
* $Revision: 1.22 $
*
******************************************************************************/
@ -9,8 +11,8 @@
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
* All rights reserved.
* Some or all of this work - Copyright (c) 1999, Intel Corp. All rights
* reserved.
*
* 2. License
*
@ -119,10 +121,8 @@
#include "acpi.h"
#include "acresrc.h"
#include "amlcode.h"
#include "acnamesp.h"
#define _COMPONENT ACPI_RESOURCES
#define _COMPONENT RESOURCE_MANAGER
MODULE_NAME ("rscreate")
@ -130,7 +130,8 @@
*
* FUNCTION: AcpiRsCreateResourceList
*
* PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
* PARAMETERS:
* ByteStreamBuffer - Pointer to the resource byte stream
* OutputBuffer - Pointer to the user's buffer
* OutputBufferLength - Pointer to the size of OutputBuffer
*
@ -148,23 +149,26 @@
ACPI_STATUS
AcpiRsCreateResourceList (
ACPI_OPERAND_OBJECT *ByteStreamBuffer,
ACPI_BUFFER *OutputBuffer)
UINT8 *OutputBuffer,
UINT32 *OutputBufferLength)
{
ACPI_STATUS Status;
UINT8 *ByteStreamStart;
ACPI_SIZE ListSizeNeeded = 0;
UINT32 ByteStreamBufferLength;
UINT8 *ByteStreamStart = NULL;
UINT32 ListSizeNeeded = 0;
UINT32 ByteStreamBufferLength = 0;
FUNCTION_TRACE ("RsCreateResourceList");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n", ByteStreamBuffer));
DEBUG_PRINT (VERBOSE_INFO, ("RsCreateResourceList: ByteStreamBuffer = %p\n",
ByteStreamBuffer));
/*
* Params already validated, so we don't re-validate here
*/
ByteStreamBufferLength = ByteStreamBuffer->Buffer.Length;
ByteStreamStart = ByteStreamBuffer->Buffer.Pointer;
@ -172,36 +176,59 @@ AcpiRsCreateResourceList (
* Pass the ByteStreamBuffer into a module that can calculate
* the buffer size needed for the linked list
*/
Status = AcpiRsCalculateListLength (ByteStreamStart, ByteStreamBufferLength,
&ListSizeNeeded);
Status = AcpiRsCalculateListLength (ByteStreamStart,
ByteStreamBufferLength,
&ListSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
DEBUG_PRINT (VERBOSE_INFO,
("RsCreateResourceList: Status=%X ListSizeNeeded=%X\n",
Status, ListSizeNeeded));
/*
* Exit with the error passed back
*/
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate/Allocate/Clear caller buffer */
/*
* If the linked list will fit into the available buffer
* call to fill in the list
*/
Status = AcpiUtInitializeBuffer (OutputBuffer, ListSizeNeeded);
if (ACPI_FAILURE (Status))
if (ListSizeNeeded <= *OutputBufferLength)
{
return_ACPI_STATUS (Status);
/*
* Zero out the return buffer before proceeding
*/
MEMSET (OutputBuffer, 0x00, *OutputBufferLength);
Status = AcpiRsByteStreamToList (ByteStreamStart,
ByteStreamBufferLength,
&OutputBuffer);
/*
* Exit with the error passed back
*/
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
DEBUG_PRINT (VERBOSE_INFO, ("RsByteStreamToList: OutputBuffer = %p\n",
OutputBuffer));
}
/* Do the conversion */
Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength,
OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
else
{
return_ACPI_STATUS (Status);
*OutputBufferLength = ListSizeNeeded;
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
OutputBuffer->Pointer, OutputBuffer->Length));
*OutputBufferLength = ListSizeNeeded;
return_ACPI_STATUS (AE_OK);
}
@ -209,221 +236,219 @@ AcpiRsCreateResourceList (
*
* FUNCTION: AcpiRsCreatePciRoutingTable
*
* PARAMETERS: PackageObject - Pointer to an ACPI_OPERAND_OBJECT
* package
* PARAMETERS:
* PackageObject - Pointer to an ACPI_OPERAND_OBJECT
* package
* OutputBuffer - Pointer to the user's buffer
* OutputBufferLength - Size of OutputBuffer
*
* RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
* If the OutputBuffer is too small, the error will be
* AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
* AE_BUFFER_OVERFLOW and OutputBufferLength will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the ACPI_OPERAND_OBJECT package and creates a
* linked list of PCI interrupt descriptions
*
* NOTE: It is the caller's responsibility to ensure that the start of the
* output buffer is aligned properly (if necessary).
*
******************************************************************************/
ACPI_STATUS
AcpiRsCreatePciRoutingTable (
ACPI_OPERAND_OBJECT *PackageObject,
ACPI_BUFFER *OutputBuffer)
UINT8 *OutputBuffer,
UINT32 *OutputBufferLength)
{
UINT8 *Buffer;
UINT8 *Buffer = OutputBuffer;
ACPI_OPERAND_OBJECT **TopObjectList = NULL;
ACPI_OPERAND_OBJECT **SubObjectList = NULL;
ACPI_OPERAND_OBJECT *PackageElement = NULL;
ACPI_SIZE BufferSizeNeeded = 0;
UINT32 BufferSizeNeeded = 0;
UINT32 NumberOfElements = 0;
UINT32 Index = 0;
ACPI_PCI_ROUTING_TABLE *UserPrt = NULL;
ACPI_NAMESPACE_NODE *Node;
PCI_ROUTING_TABLE *UserPrt = NULL;
ACPI_STATUS Status;
ACPI_BUFFER PathBuffer;
FUNCTION_TRACE ("RsCreatePciRoutingTable");
/* Params already validated, so we don't re-validate here */
/*
* Params already validated, so we don't re-validate here
*/
Status = AcpiRsCalculatePciRoutingTableLength(PackageObject,
&BufferSizeNeeded);
DEBUG_PRINT (VERBOSE_INFO,
("RsCreatePciRoutingTable: BufferSizeNeeded = %X\n",
BufferSizeNeeded));
/*
* Get the required buffer length
* If the data will fit into the available buffer
* call to fill in the list
*/
Status = AcpiRsCalculatePciRoutingTableLength (PackageObject,
&BufferSizeNeeded);
if (!ACPI_SUCCESS(Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "BufferSizeNeeded = %X\n", BufferSizeNeeded));
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutputBuffer, BufferSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
* Loop through the ACPI_INTERNAL_OBJECTS - Each object should contain an
* ACPI_INTEGER Address, a UINT8 Pin, a Name and a UINT8 SourceIndex.
*/
TopObjectList = PackageObject->Package.Elements;
NumberOfElements = PackageObject->Package.Count;
Buffer = OutputBuffer->Pointer;
UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer;
for (Index = 0; Index < NumberOfElements; Index++)
if (BufferSizeNeeded <= *OutputBufferLength)
{
/*
* Point UserPrt past this current structure
*
* NOTE: On the first iteration, UserPrt->Length will
* be zero because we cleared the return buffer earlier
* Zero out the return buffer before proceeding
*/
Buffer += UserPrt->Length;
UserPrt = (ACPI_PCI_ROUTING_TABLE *) Buffer;
MEMSET (OutputBuffer, 0x00, *OutputBufferLength);
/*
* Fill in the Length field with the information we have at this point.
* The minus four is to subtract the size of the UINT8 Source[4] member
* because it is added below.
* Loop through the ACPI_INTERNAL_OBJECTS - Each object should
* contain a UINT32 Address, a UINT8 Pin, a Name and a UINT8
* SourceIndex.
*/
UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) -4);
TopObjectList = PackageObject->Package.Elements;
NumberOfElements = PackageObject->Package.Count;
UserPrt = (PCI_ROUTING_TABLE *) Buffer;
/*
* Dereference the sub-package
*/
PackageElement = *TopObjectList;
/*
* The SubObjectList will now point to an array of the four IRQ
* elements: Address, Pin, Source and SourceIndex
*/
SubObjectList = PackageElement->Package.Elements;
Buffer = ROUND_PTR_UP_TO_8 (Buffer, UINT8);
/*
* 1) First subobject: Dereference the Address
*/
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
for (Index = 0; Index < NumberOfElements; Index++)
{
UserPrt->Address = (*SubObjectList)->Integer.Value;
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
AcpiUtGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Point UserPrt past this current structure
*
* NOTE: On the first iteration, UserPrt->Length will
* be zero because we cleared the return buffer earlier
*/
Buffer += UserPrt->Length;
UserPrt = (PCI_ROUTING_TABLE *) Buffer;
/*
* 2) Second subobject: Dereference the Pin
*/
SubObjectList++;
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->Pin = (UINT32) (*SubObjectList)->Integer.Value;
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
AcpiUtGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Fill in the Length field with the information we
* have at this point.
* The minus one is to subtract the size of the
* UINT8 Source[1] member because it is added below.
*/
UserPrt->Length = (sizeof (PCI_ROUTING_TABLE) - 1);
/*
* 3) Third subobject: Dereference the Source Name
*/
SubObjectList++;
/*
* Dereference the sub-package
*/
PackageElement = *TopObjectList;
switch ((*SubObjectList)->Common.Type)
{
case INTERNAL_TYPE_REFERENCE:
/*
* The SubObjectList will now point to an array of
* the four IRQ elements: Address, Pin, Source and
* SourceIndex
*/
SubObjectList = PackageElement->Package.Elements;
if ((*SubObjectList)->Reference.Opcode != AML_INT_NAMEPATH_OP)
/*
* Dereference the Address
*/
if (ACPI_TYPE_NUMBER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.Address =
(*SubObjectList)->Number.Value;
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need name, found reference op %X\n",
(*SubObjectList)->Reference.Opcode));
return_ACPI_STATUS (AE_BAD_DATA);
}
Node = (*SubObjectList)->Reference.Node;
/* Use *remaining* length of the buffer as max for pathname */
PathBuffer.Length = OutputBuffer->Length -
(UINT32) ((UINT8 *) UserPrt->Source - (UINT8 *) OutputBuffer->Pointer);
PathBuffer.Pointer = UserPrt->Source;
Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) Node, &PathBuffer);
UserPrt->Length += STRLEN (UserPrt->Source) + 1; /* include null terminator */
break;
case ACPI_TYPE_STRING:
STRCPY (UserPrt->Source,
(*SubObjectList)->String.Pointer);
/* Add to the Length field the length of the string */
UserPrt->Length += (*SubObjectList)->String.Length;
break;
case ACPI_TYPE_INTEGER:
/*
* If this is a number, then the Source Name is NULL, since the
* entire buffer was zeroed out, we can leave this alone.
*
* Add to the Length field the length of the UINT32 NULL
* Dereference the Pin
*/
UserPrt->Length += sizeof (UINT32);
break;
SubObjectList++;
if (ACPI_TYPE_NUMBER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.Pin =
(UINT32) (*SubObjectList)->Number.Value;
}
default:
else
{
return_ACPI_STATUS (AE_BAD_DATA);
}
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
AcpiUtGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
/*
* Dereference the Source Name
*/
SubObjectList++;
if (ACPI_TYPE_STRING == (*SubObjectList)->Common.Type)
{
STRCPY (UserPrt->Data.Source,
(*SubObjectList)->String.Pointer);
/*
* Add to the Length field the length of the string
*/
UserPrt->Length += (*SubObjectList)->String.Length;
}
else
{
/*
* If this is a number, then the Source Name
* is NULL, since the entire buffer was zeroed
* out, we can leave this alone.
*/
if (ACPI_TYPE_NUMBER == (*SubObjectList)->Common.Type)
{
/*
* Add to the Length field the length of
* the UINT32 NULL
*/
UserPrt->Length += sizeof (UINT32);
}
else
{
return_ACPI_STATUS (AE_BAD_DATA);
}
}
/* Now align the current length */
UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length);
/*
* Dereference the Source Index
*/
SubObjectList++;
if (ACPI_TYPE_NUMBER == (*SubObjectList)->Common.Type)
{
UserPrt->Data.SourceIndex =
(UINT32) (*SubObjectList)->Number.Value;
}
else
{
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* Point to the next ACPI_OPERAND_OBJECT
*/
TopObjectList++;
}
/* Now align the current length */
UserPrt->Length = ROUND_UP_TO_64BITS (UserPrt->Length);
/*
* 4) Fourth subobject: Dereference the Source Index
*/
SubObjectList++;
if (ACPI_TYPE_INTEGER == (*SubObjectList)->Common.Type)
{
UserPrt->SourceIndex = (UINT32) (*SubObjectList)->Integer.Value;
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Need Integer, found %s\n",
AcpiUtGetTypeName ((*SubObjectList)->Common.Type)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/* Point to the next ACPI_OPERAND_OBJECT */
TopObjectList++;
DEBUG_PRINT (VERBOSE_INFO,
("RsCreatePciRoutingTable: OutputBuffer = %p\n",
OutputBuffer));
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
OutputBuffer->Pointer, OutputBuffer->Length));
else
{
*OutputBufferLength = BufferSizeNeeded;
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
/*
* Report the amount of buffer used
*/
*OutputBufferLength = BufferSizeNeeded;
return_ACPI_STATUS (AE_OK);
}
@ -432,12 +457,14 @@ AcpiRsCreatePciRoutingTable (
*
* FUNCTION: AcpiRsCreateByteStream
*
* PARAMETERS: LinkedListBuffer - Pointer to the resource linked list
* PARAMETERS:
* LinkedListBuffer - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's buffer
* OutputBufferLength - Size of OutputBuffer
*
* RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code.
* If the OutputBuffer is too small, the error will be
* AE_BUFFER_OVERFLOW and OutputBuffer->Length will point
* AE_BUFFER_OVERFLOW and OutputBufferLength will point
* to the size buffer needed.
*
* DESCRIPTION: Takes the linked list of device resources and
@ -448,53 +475,77 @@ AcpiRsCreatePciRoutingTable (
ACPI_STATUS
AcpiRsCreateByteStream (
ACPI_RESOURCE *LinkedListBuffer,
ACPI_BUFFER *OutputBuffer)
RESOURCE *LinkedListBuffer,
UINT8 *OutputBuffer,
UINT32 *OutputBufferLength)
{
ACPI_STATUS Status;
ACPI_SIZE ByteStreamSizeNeeded = 0;
UINT32 ByteStreamSizeNeeded = 0;
FUNCTION_TRACE ("RsCreateByteStream");
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", LinkedListBuffer));
DEBUG_PRINT (VERBOSE_INFO,
("RsCreateByteStream: LinkedListBuffer = %p\n",
LinkedListBuffer));
/*
* Params already validated, so we don't re-validate here
*
* Pass the LinkedListBuffer into a module that calculates
* Pass the LinkedListBuffer into a module that can calculate
* the buffer size needed for the byte stream.
*/
Status = AcpiRsCalculateByteStreamLength (LinkedListBuffer,
&ByteStreamSizeNeeded);
&ByteStreamSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n",
ByteStreamSizeNeeded, AcpiFormatException (Status)));
DEBUG_PRINT (VERBOSE_INFO,
("RsCreateByteStream: ByteStreamSizeNeeded=%X, %s\n",
ByteStreamSizeNeeded,
AcpiCmFormatException (Status)));
/*
* Exit with the error passed back
*/
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/* Validate/Allocate/Clear caller buffer */
/*
* If the linked list will fit into the available buffer
* call to fill in the list
*/
Status = AcpiUtInitializeBuffer (OutputBuffer, ByteStreamSizeNeeded);
if (ACPI_FAILURE (Status))
if (ByteStreamSizeNeeded <= *OutputBufferLength)
{
return_ACPI_STATUS (Status);
/*
* Zero out the return buffer before proceeding
*/
MEMSET (OutputBuffer, 0x00, *OutputBufferLength);
Status = AcpiRsListToByteStream (LinkedListBuffer,
ByteStreamSizeNeeded,
&OutputBuffer);
/*
* Exit with the error passed back
*/
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
DEBUG_PRINT (VERBOSE_INFO,
("RsListToByteStream: OutputBuffer = %p\n",
OutputBuffer));
}
else
{
*OutputBufferLength = ByteStreamSizeNeeded;
return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
}
/* Do the conversion */
Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded,
OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
OutputBuffer->Pointer, OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}

File diff suppressed because it is too large Load Diff