Print this page
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
*** 3,13 ****
* Module Name: rsxface - Public interfaces to the resource manager
*
******************************************************************************/
/*
! * Copyright (C) 2000 - 2011, 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:
--- 3,13 ----
* Module Name: rsxface - Public interfaces to the resource manager
*
******************************************************************************/
/*
! * Copyright (C) 2000 - 2013, 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:
*** 41,50 ****
--- 41,51 ----
* POSSIBILITY OF SUCH DAMAGES.
*/
#define __RSXFACE_C__
+ #define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
#include "acresrc.h"
#include "acnamesp.h"
*** 349,358 ****
--- 350,405 ----
}
ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
+ /*******************************************************************************
+ *
+ * FUNCTION: AcpiGetEventResources
+ *
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are getting resources
+ * InBuffer - Pointer to a buffer containing the
+ * resources to be set for the device
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to get the event resources for a
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is passed to the routine
+ * the buffer pointed to by the InBuffer variable. Uses the
+ * _AEI method.
+ *
+ ******************************************************************************/
+
+ ACPI_STATUS
+ AcpiGetEventResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *RetBuffer)
+ {
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE (AcpiGetEventResources);
+
+
+ /* Validate parameters then dispatch to internal routine */
+
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiRsGetAeiMethodData (Node, RetBuffer);
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_EXPORT_SYMBOL (AcpiGetEventResources)
+
+
/******************************************************************************
*
* FUNCTION: AcpiResourceToAddress64
*
* PARAMETERS: Resource - Pointer to a resource
*** 404,413 ****
--- 451,461 ----
ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
break;
default:
+
return (AE_BAD_PARAMETER);
}
return (AE_OK);
}
*** 426,436 ****
* includes both subtype and 16-byte UUID
* RetBuffer - Where the vendor resource is returned
*
* RETURN: Status
*
! * DESCRIPTION: Walk a resource template for the specified evice to find a
* vendor-defined resource that matches the supplied UUID and
* UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
*
******************************************************************************/
--- 474,484 ----
* includes both subtype and 16-byte UUID
* RetBuffer - Where the vendor resource is returned
*
* RETURN: Status
*
! * DESCRIPTION: Walk a resource template for the specified device to find a
* vendor-defined resource that matches the supplied UUID and
* UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
*
******************************************************************************/
*** 538,615 ****
}
/*******************************************************************************
*
! * FUNCTION: AcpiWalkResources
*
! * PARAMETERS: DeviceHandle - Handle to the device object for the
! * device we are querying
! * Name - Method name of the resources we want
! * (METHOD_NAME__CRS or METHOD_NAME__PRS)
* UserFunction - Called for each resource
* Context - Passed to UserFunction
*
* RETURN: Status
*
! * DESCRIPTION: Retrieves the current or possible resource list for the
! * specified device. The UserFunction is called once for
! * each resource in the list.
*
******************************************************************************/
ACPI_STATUS
! AcpiWalkResources (
! ACPI_HANDLE DeviceHandle,
! char *Name,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context)
{
! ACPI_STATUS Status;
! ACPI_BUFFER Buffer;
ACPI_RESOURCE *Resource;
ACPI_RESOURCE *ResourceEnd;
! ACPI_FUNCTION_TRACE (AcpiWalkResources);
/* Parameter validation */
! if (!DeviceHandle || !UserFunction || !Name ||
! (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
! !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS)))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
! /* Get the _CRS or _PRS resource list */
! Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
! Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
! if (ACPI_FAILURE (Status))
! {
! return_ACPI_STATUS (Status);
! }
- /* Buffer now contains the resource list */
-
- Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer.Pointer);
- ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer.Pointer, Buffer.Length);
-
/* Walk the resource list until the EndTag is found (or buffer end) */
while (Resource < ResourceEnd)
{
! /* Sanity check the resource */
if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
{
Status = AE_AML_INVALID_RESOURCE_TYPE;
break;
}
/* Invoke the user function, abort on any error returned */
Status = UserFunction (Resource, Context);
if (ACPI_FAILURE (Status))
{
--- 586,654 ----
}
/*******************************************************************************
*
! * FUNCTION: AcpiWalkResourceBuffer
*
! * PARAMETERS: Buffer - Formatted buffer returned by one of the
! * various Get*Resource functions
* UserFunction - Called for each resource
* Context - Passed to UserFunction
*
* RETURN: Status
*
! * DESCRIPTION: Walks the input resource template. The UserFunction is called
! * once for each resource in the list.
*
******************************************************************************/
ACPI_STATUS
! AcpiWalkResourceBuffer (
! ACPI_BUFFER *Buffer,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context)
{
! ACPI_STATUS Status = AE_OK;
ACPI_RESOURCE *Resource;
ACPI_RESOURCE *ResourceEnd;
! ACPI_FUNCTION_TRACE (AcpiWalkResourceBuffer);
/* Parameter validation */
! if (!Buffer || !Buffer->Pointer || !UserFunction)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
! /* Buffer contains the resource list and length */
! Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer->Pointer);
! ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer->Pointer, Buffer->Length);
/* Walk the resource list until the EndTag is found (or buffer end) */
while (Resource < ResourceEnd)
{
! /* Sanity check the resource type */
if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
{
Status = AE_AML_INVALID_RESOURCE_TYPE;
break;
}
+ /* Sanity check the length. It must not be zero, or we loop forever */
+
+ if (!Resource->Length)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+ }
+
/* Invoke the user function, abort on any error returned */
Status = UserFunction (Resource, Context);
if (ACPI_FAILURE (Status))
{
*** 629,641 ****
break;
}
/* Get the next resource descriptor */
! Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
}
ACPI_FREE (Buffer.Pointer);
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiWalkResources)
--- 668,742 ----
break;
}
/* Get the next resource descriptor */
! Resource = ACPI_NEXT_RESOURCE (Resource);
}
+ return_ACPI_STATUS (Status);
+ }
+
+ ACPI_EXPORT_SYMBOL (AcpiWalkResourceBuffer)
+
+
+ /*******************************************************************************
+ *
+ * FUNCTION: AcpiWalkResources
+ *
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are querying
+ * Name - Method name of the resources we want.
+ * (METHOD_NAME__CRS, METHOD_NAME__PRS, or
+ * METHOD_NAME__AEI)
+ * UserFunction - Called for each resource
+ * Context - Passed to UserFunction
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Retrieves the current or possible resource list for the
+ * specified device. The UserFunction is called once for
+ * each resource in the list.
+ *
+ ******************************************************************************/
+
+ ACPI_STATUS
+ AcpiWalkResources (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context)
+ {
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+
+
+ ACPI_FUNCTION_TRACE (AcpiWalkResources);
+
+
+ /* Parameter validation */
+
+ if (!DeviceHandle || !UserFunction || !Name ||
+ (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
+ !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS) &&
+ !ACPI_COMPARE_NAME (Name, METHOD_NAME__AEI)))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the _CRS/_PRS/_AEI resource list */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Walk the resource list and cleanup */
+
+ Status = AcpiWalkResourceBuffer (&Buffer, UserFunction, Context);
ACPI_FREE (Buffer.Pointer);
return_ACPI_STATUS (Status);
}
ACPI_EXPORT_SYMBOL (AcpiWalkResources)