/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
*
******************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
#include "acresrc.h"
#include "acnamesp.h"
ACPI_MODULE_NAME ("rsxface")
/* Local macros for 16,32-bit to 64-bit conversion */
/* Local prototypes */
static ACPI_STATUS
void *Context);
static ACPI_STATUS
/*******************************************************************************
*
* FUNCTION: AcpiRsValidateParameters
*
* PARAMETERS: DeviceHandle - Handle to a device
* Buffer - Pointer to a data buffer
* ReturnNode - Pointer to where the device node is returned
*
* RETURN: Status
*
* DESCRIPTION: Common parameter validation for resource interfaces
*
******************************************************************************/
static ACPI_STATUS
{
/*
* Must have a valid handle to an ACPI device
*/
if (!DeviceHandle)
{
}
if (!Node)
{
}
{
}
/*
* Validate the user buffer object
*
* if there is a non-zero buffer length we also need a valid pointer in
* the buffer. If it's a zero buffer length, we'll be returning the
* needed buffer size (later), so keep going.
*/
if (ACPI_FAILURE (Status))
{
}
*ReturnNode = Node;
}
/*******************************************************************************
*
* FUNCTION: AcpiGetIrqRoutingTable
*
* PARAMETERS: DeviceHandle - Handle to the Bus device we are querying
* RetBuffer - Pointer to a buffer to receive the
* current resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get the IRQ routing table for a
* specific bus. The caller must first acquire a handle for the
* desired bus. The routine table is placed in the buffer pointed
* to by the RetBuffer variable parameter.
*
* If the function fails an appropriate status will be returned
* and the value of RetBuffer is undefined.
*
* This function attempts to execute the _PRT method contained in
* the object indicated by the passed DeviceHandle.
*
******************************************************************************/
{
/* Validate parameters then dispatch to internal routine */
if (ACPI_FAILURE (Status))
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiGetCurrentResources
*
* PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
* RetBuffer - Pointer to a buffer to receive the
* current resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get the current resources for a
* specific device. The caller must first acquire a handle for
* the desired device. The resource data is placed in the buffer
* pointed to by the RetBuffer variable parameter.
*
* If the function fails an appropriate status will be returned
* and the value of RetBuffer is undefined.
*
* This function attempts to execute the _CRS method contained in
* the object indicated by the passed DeviceHandle.
*
******************************************************************************/
{
/* Validate parameters then dispatch to internal routine */
if (ACPI_FAILURE (Status))
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiGetPossibleResources
*
* PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
* RetBuffer - Pointer to a buffer to receive the
* resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get a list of the possible resources
* for a specific device. The caller must first acquire a handle
* for the desired device. The resource data is placed in the
* buffer pointed to by the RetBuffer variable.
*
* If the function fails an appropriate status will be returned
* and the value of RetBuffer is undefined.
*
******************************************************************************/
{
/* Validate parameters then dispatch to internal routine */
if (ACPI_FAILURE (Status))
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiSetCurrentResources
*
* PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are setting resources
* InBuffer - Pointer to a buffer containing the
* resources to be set for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to set the current 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.
*
******************************************************************************/
{
/* Validate the buffer, don't allow zero length */
if ((!InBuffer) ||
{
}
/* Validate parameters then dispatch to internal routine */
if (ACPI_FAILURE (Status))
{
}
}
/*******************************************************************************
*
* 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.
*
******************************************************************************/
{
/* Validate parameters then dispatch to internal routine */
if (ACPI_FAILURE (Status))
{
}
}
/******************************************************************************
*
* FUNCTION: AcpiResourceToAddress64
*
* PARAMETERS: Resource - Pointer to a resource
* Out - Pointer to the users's return buffer
* (a struct acpi_resource_address64)
*
* RETURN: Status
*
* DESCRIPTION: If the resource is an address16, address32, or address64,
* copy it to the address64 return buffer. This saves the
* caller from having to duplicate code for different-sized
* addresses.
*
******************************************************************************/
{
{
return (AE_BAD_PARAMETER);
}
/* Convert 16 or 32 address descriptor to 64 */
{
break;
break;
/* Simple copy for 64 bit source */
break;
default:
return (AE_BAD_PARAMETER);
}
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiGetVendorResource
*
* PARAMETERS: DeviceHandle - Handle for the parent device object
* Name - Method name for the parent resource
* (METHOD_NAME__CRS or METHOD_NAME__PRS)
* Uuid - Pointer to the UUID to be matched.
* 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.
*
******************************************************************************/
char *Name,
{
/* Other parameters are validated by AcpiWalkResources */
{
return (AE_BAD_PARAMETER);
}
/* Walk the _CRS or _PRS resource list for this device */
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
/*******************************************************************************
*
* FUNCTION: AcpiRsMatchVendorResource
*
* PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
*
* RETURN: Status
*
* DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID
*
******************************************************************************/
static ACPI_STATUS
void *Context)
{
/* Ignore all descriptors except Vendor */
{
return (AE_OK);
}
/*
* For a valid match, these conditions must hold:
*
* 1) Length of descriptor data must be at least as long as a UUID struct
* 2) The UUID subtypes must match
* 3) The UUID data must match
*/
{
return (AE_OK);
}
if (ACPI_FAILURE (Status))
{
return (Status);
}
/* Found the correct resource, copy and return it */
/* Found the desired descriptor, terminate resource walk */
return (AE_CTRL_TERMINATE);
}
/*******************************************************************************
*
* 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.
*
******************************************************************************/
void *Context)
{
/* Parameter validation */
{
}
/* Buffer contains the resource list and length */
/* Walk the resource list until the EndTag is found (or buffer end) */
while (Resource < ResourceEnd)
{
/* Sanity check the resource type */
{
break;
}
/* Sanity check the length. It must not be zero, or we loop forever */
{
}
/* Invoke the user function, abort on any error returned */
if (ACPI_FAILURE (Status))
{
if (Status == AE_CTRL_TERMINATE)
{
/* This is an OK termination by the user function */
}
break;
}
/* EndTag indicates end-of-list */
{
break;
}
/* Get the next resource descriptor */
}
}
/*******************************************************************************
*
* 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.
*
******************************************************************************/
char *Name,
void *Context)
{
/* Parameter validation */
{
}
/* Get the _CRS/_PRS/_AEI resource list */
if (ACPI_FAILURE (Status))
{
}
/* Walk the resource list and cleanup */
}