[PATCH 1/2] drm/amd/amdgpu: stored bios_size

Edward O'Callaghan funfunctor at folklore1984.net
Wed Dec 7 23:46:56 UTC 2016


1&2 are Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 12/08/2016 06:22 AM, Alex Deucher wrote:
> From: Evan Quan <evan.quan at amd.com>
> 
> It's necessary if we want to export vbios image out.
> 
> Signed-off-by: Evan Quan <evan.quan at amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> Reviewed-by: Christian Koenig <christian.koenig at amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h      | 1 +
>  drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 29d3a91..f31936b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1330,6 +1330,7 @@ struct amdgpu_device {
>  
>  	/* BIOS */
>  	uint8_t				*bios;
> +	uint32_t			bios_size;
>  	bool				is_atom_bios;
>  	struct amdgpu_bo		*stollen_vga_memory;
>  	uint32_t			bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> index b7e2762..4f973a9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
> @@ -74,6 +74,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
>  		iounmap(bios);
>  		return false;
>  	}
> +	adev->bios_size = size;
>  	memcpy_fromio(adev->bios, bios, size);
>  	iounmap(bios);
>  	return true;
> @@ -103,6 +104,7 @@ bool amdgpu_read_bios(struct amdgpu_device *adev)
>  		pci_unmap_rom(adev->pdev, bios);
>  		return false;
>  	}
> +	adev->bios_size = size;
>  	memcpy_fromio(adev->bios, bios, size);
>  	pci_unmap_rom(adev->pdev, bios);
>  	return true;
> @@ -135,6 +137,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)
>  		DRM_ERROR("no memory to allocate for BIOS\n");
>  		return false;
>  	}
> +	adev->bios_size = len;
>  
>  	/* read complete BIOS */
>  	return amdgpu_asic_read_bios_from_rom(adev, adev->bios, len);
> @@ -159,6 +162,7 @@ static bool amdgpu_read_platform_bios(struct amdgpu_device *adev)
>  	if (adev->bios == NULL) {
>  		return false;
>  	}
> +	adev->bios_size = size;
>  
>  	return true;
>  }
> @@ -273,6 +277,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
>  		kfree(adev->bios);
>  		return false;
>  	}
> +	adev->bios_size = size;
>  	return true;
>  }
>  #else
> @@ -334,6 +339,7 @@ static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev)
>  	}
>  
>  	adev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL);
> +	adev->bios_size = vhdr->ImageLength;
>  	ret = !!adev->bios;
>  
>  out_unmap:
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20161208/4fd0b860/attachment.sig>


More information about the amd-gfx mailing list