FreeBSD/sys/dev/drm2/radeon/radeon_bios.c
/**
 * radeon_atrm_call - fetch a chunk of the vbios
 *
 * @atrm_handle: acpi ATRM handle
 * @bios: vbios image pointer
 * @offset: offset of vbios image data to fetch
 * @len: length of vbios image data to fetch
 *
 * Executes ATRM to fetch a chunk of the discrete
 * vbios image on PX systems (all asics).
 * Returns the length of the buffer fetched.
 */
fetch a chunk of the vbios
@atrm_handle: acpi ATRM handle
@bios: vbios image pointer
@offset: offset of vbios image data to fetch
@len: length of vbios image data to fetch

Executes ATRM to fetch a chunk of the discrete
vbios image on PX systems (all asics).
Returns the length of the buffer fetched.
fetch a chunk of the vbios @atrm_handle : acpi ATRM handle @bios : vbios image pointer @offset : offset of vbios image data to fetch @len : length of vbios image data to fetch Executes ATRM to fetch a chunk of the discrete vbios image on PX systems ( all asics ) . Returns the length of the buffer fetched .
static int radeon_atrm_call(ACPI_HANDLE atrm_handle, uint8_t *bios,
			    int offset, int len)
{
	ACPI_STATUS status;
	ACPI_OBJECT atrm_arg_elements[2], *obj;
	ACPI_OBJECT_LIST atrm_arg;
	ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER, NULL};
	atrm_arg.Count = 2;
	atrm_arg.Pointer = &atrm_arg_elements[0];
	atrm_arg_elements[0].Type = ACPI_TYPE_INTEGER;
	atrm_arg_elements[0].Integer.Value = offset;
	atrm_arg_elements[1].Type = ACPI_TYPE_INTEGER;
	atrm_arg_elements[1].Integer.Value = len;
	status = AcpiEvaluateObject(atrm_handle, NULL, &atrm_arg, &buffer);
	if (ACPI_FAILURE(status)) {
		DRM_ERROR("failed to evaluate ATRM got %s\n", AcpiFormatException(status));
		return -ENODEV;
	}
	obj = (ACPI_OBJECT *)buffer.Pointer;
	memcpy(bios+offset, obj->Buffer.Pointer, obj->Buffer.Length);
	len = obj->Buffer.Length;
	AcpiOsFree(buffer.Pointer);
	return len;
}
static int radeon_atrm_call ( ACPI_HANDLE atrm_handle , uint8_t * bios , int offset , int len ) { ACPI_STATUS status ; ACPI_OBJECT atrm_arg_elements [ 2 ] , * obj ; ACPI_OBJECT_LIST atrm_arg ; ACPI_BUFFER buffer = { ACPI_ALLOCATE_BUFFER , NULL } ; atrm_arg . Count = 2 ; atrm_arg . Pointer = & atrm_arg_elements [ 0 ] ; atrm_arg_elements [ 0 ] . Type = ACPI_TYPE_INTEGER ; atrm_arg_elements [ 0 ] . Integer . Value = offset ; atrm_arg_elements [ 1 ] . Type = ACPI_TYPE_INTEGER ; atrm_arg_elements [ 1 ] . Integer . Value = len ; status = AcpiEvaluateObject ( atrm_handle , NULL , & atrm_arg , & buffer ) ; if ( ACPI_FAILURE ( status ) ) { DRM_ERROR ( " \n " , AcpiFormatException ( status ) ) ; return - ENODEV ; } obj = ( ACPI_OBJECT * ) buffer . Pointer ; memcpy ( bios + offset , obj -> Buffer . Pointer , obj -> Buffer . Length ) ; len = obj -> Buffer . Length ; AcpiOsFree ( buffer . Pointer ) ; return len ; }
radeon_atrm_call - fetch a chunk of the vbios
 @atrm_handle: acpi ATRM handle
 @bios: vbios image pointer
 @offset: offset of vbios image data to fetch
 @len: length of vbios image data to fetch
radeon_atrm_call - fetch a chunk of the vbios @atrm_handle : acpi ATRM handle @bios : vbios image pointer @offset : offset of vbios image data to fetch @len : length of vbios image data to fetch