FreeBSD/sys/dev/drm2/radeon/radeon_acpi.c
/**
 * radeon_atcs_call - call an ATCS method
 *
 * @handle: acpi handle
 * @function: the ATCS function to execute
 * @params: ATCS function params
 *
 * Executes the requested ATCS function (all asics).
 * Returns a pointer to the acpi output buffer.
 */
call an ATCS method
@handle: acpi handle
@function: the ATCS function to execute
@params: ATCS function params

Executes the requested ATCS function (all asics).
Returns a pointer to the acpi output buffer.
call an ATCS method @handle : acpi handle @function : the ATCS function to execute @params : ATCS function params Executes the requested ATCS function ( all asics ) . Returns a pointer to the acpi output buffer .
static union acpi_object *radeon_atcs_call(ACPI_HANDLE handle, int function,
					   ACPI_BUFFER *params)
{
	ACPI_STATUS status;
	ACPI_OBJECT atcs_arg_elements[2];
	ACPI_OBJECT_LIST atcs_arg;
	ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL };
	atcs_arg.Count = 2;
	atcs_arg.Pointer = &atcs_arg_elements[0];
	atcs_arg_elements[0].Type = ACPI_TYPE_INTEGER;
	atcs_arg_elements[0].Integer.Value = function;
	if (params) {
		atcs_arg_elements[1].Type = ACPI_TYPE_BUFFER;
		atcs_arg_elements[1].Buffer.Length = params->Length;
		atcs_arg_elements[1].Buffer.Pointer = params->Pointer;
	} else {
		atcs_arg_elements[1].Type = ACPI_TYPE_INTEGER;
		atcs_arg_elements[1].Integer.Value = 0;
	}
	status = AcpiEvaluateObject(handle, "ATCS", &atcs_arg, &buffer);
	if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
		DRM_DEBUG_DRIVER("failed to evaluate ATCS got %s\n",
				 AcpiFormatException(status));
		AcpiOsFree(buffer.Pointer);
		return NULL;
	}
	return buffer.Pointer;
}
static union acpi_object * radeon_atcs_call ( ACPI_HANDLE handle , int function , ACPI_BUFFER * params ) { ACPI_STATUS status ; ACPI_OBJECT atcs_arg_elements [ 2 ] ; ACPI_OBJECT_LIST atcs_arg ; ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER , NULL } ; atcs_arg . Count = 2 ; atcs_arg . Pointer = & atcs_arg_elements [ 0 ] ; atcs_arg_elements [ 0 ] . Type = ACPI_TYPE_INTEGER ; atcs_arg_elements [ 0 ] . Integer . Value = function ; if ( params ) { atcs_arg_elements [ 1 ] . Type = ACPI_TYPE_BUFFER ; atcs_arg_elements [ 1 ] . Buffer . Length = params -> Length ; atcs_arg_elements [ 1 ] . Buffer . Pointer = params -> Pointer ; } else { atcs_arg_elements [ 1 ] . Type = ACPI_TYPE_INTEGER ; atcs_arg_elements [ 1 ] . Integer . Value = 0 ; } status = AcpiEvaluateObject ( handle , " " , & atcs_arg , & buffer ) ; if ( ACPI_FAILURE ( status ) && status != AE_NOT_FOUND ) { DRM_DEBUG_DRIVER ( " \n " , AcpiFormatException ( status ) ) ; AcpiOsFree ( buffer . Pointer ) ; return NULL ; } return buffer . Pointer ; }
radeon_atcs_call - call an ATCS method
 @handle: acpi handle
 @function: the ATCS function to execute
 @params: ATCS function params
radeon_atcs_call - call an ATCS method @handle : acpi handle @function : the ATCS function to execute @params : ATCS function params
/* We need a second fake parameter */ /* Fail only if calling the method fails and ATIF is supported */