summaryrefslogtreecommitdiffstats
path: root/source/components/resources
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/resources')
-rw-r--r--source/components/resources/rscalc.c6
-rw-r--r--source/components/resources/rscreate.c35
-rw-r--r--source/components/resources/rsutils.c2
3 files changed, 22 insertions, 21 deletions
diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c
index a6e8b38..a5a8e5a 100644
--- a/source/components/resources/rscalc.c
+++ b/source/components/resources/rscalc.c
@@ -197,6 +197,7 @@ AcpiRsStreamOptionLength (
* FUNCTION: AcpiRsGetAmlLength
*
* PARAMETERS: Resource - Pointer to the resource linked list
+ * ResourceListSize - Size of the resource linked list
* SizeNeeded - Where the required size is returned
*
* RETURN: Status
@@ -210,9 +211,11 @@ AcpiRsStreamOptionLength (
ACPI_STATUS
AcpiRsGetAmlLength (
ACPI_RESOURCE *Resource,
+ ACPI_SIZE ResourceListSize,
ACPI_SIZE *SizeNeeded)
{
ACPI_SIZE AmlSizeNeeded = 0;
+ ACPI_RESOURCE *ResourceEnd;
ACPI_RS_LENGTH TotalSize;
@@ -221,7 +224,8 @@ AcpiRsGetAmlLength (
/* Traverse entire list of internal resource descriptors */
- while (Resource)
+ ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize);
+ while (Resource < ResourceEnd)
{
/* Validate the descriptor type */
diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c
index 209b503..fa6b4aa 100644
--- a/source/components/resources/rscreate.c
+++ b/source/components/resources/rscreate.c
@@ -435,23 +435,22 @@ AcpiRsCreatePciRoutingTable (
*
* FUNCTION: AcpiRsCreateAmlResources
*
- * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's buffer
+ * PARAMETERS: ResourceList - Pointer to the resource list buffer
+ * OutputBuffer - Where the AML buffer is returned
*
* 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
* to the size buffer needed.
*
- * DESCRIPTION: Takes the linked list of device resources and
- * creates a bytestream to be used as input for the
- * _SRS control method.
+ * DESCRIPTION: Converts a list of device resources to an AML bytestream
+ * to be used as input for the _SRS control method.
*
******************************************************************************/
ACPI_STATUS
AcpiRsCreateAmlResources (
- ACPI_RESOURCE *LinkedListBuffer,
+ ACPI_BUFFER *ResourceList,
ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
@@ -461,17 +460,15 @@ AcpiRsCreateAmlResources (
ACPI_FUNCTION_TRACE (RsCreateAmlResources);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
- LinkedListBuffer));
+ /* Params already validated, no need to re-validate here */
- /*
- * Params already validated, so we don't re-validate here
- *
- * Pass the LinkedListBuffer into a module that calculates
- * the buffer size needed for the byte stream.
- */
- Status = AcpiRsGetAmlLength (LinkedListBuffer,
- &AmlSizeNeeded);
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ResourceList Buffer = %p\n",
+ ResourceList->Pointer));
+
+ /* Get the buffer size needed for the AML byte stream */
+
+ Status = AcpiRsGetAmlLength (ResourceList->Pointer,
+ ResourceList->Length, &AmlSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
(UINT32) AmlSizeNeeded, AcpiFormatException (Status)));
@@ -490,14 +487,14 @@ AcpiRsCreateAmlResources (
/* Do the conversion */
- Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded,
- OutputBuffer->Pointer);
+ Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer,
+ AmlSizeNeeded, OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n",
- OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
+ OutputBuffer->Pointer, (UINT32) OutputBuffer->Length));
return_ACPI_STATUS (AE_OK);
}
diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c
index 04591d9..eb0d93c 100644
--- a/source/components/resources/rsutils.c
+++ b/source/components/resources/rsutils.c
@@ -827,7 +827,7 @@ AcpiRsSetSrsMethodData (
* Convert the linked list into a byte stream
*/
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer);
+ Status = AcpiRsCreateAmlResources (InBuffer, &Buffer);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
OpenPOWER on IntegriCloud