Commit a9f5db9c authored by Evan Quan's avatar Evan Quan Committed by Alex Deucher

drm/amd/amdgpu: stored bios_size

It's necessary if we want to export vbios image out.
Reviewed-by: default avatarEdward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarChristian Koenig <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ff9d6460
...@@ -1330,6 +1330,7 @@ struct amdgpu_device { ...@@ -1330,6 +1330,7 @@ struct amdgpu_device {
/* BIOS */ /* BIOS */
uint8_t *bios; uint8_t *bios;
uint32_t bios_size;
bool is_atom_bios; bool is_atom_bios;
struct amdgpu_bo *stollen_vga_memory; struct amdgpu_bo *stollen_vga_memory;
uint32_t bios_scratch[AMDGPU_BIOS_NUM_SCRATCH]; uint32_t bios_scratch[AMDGPU_BIOS_NUM_SCRATCH];
......
...@@ -74,6 +74,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev) ...@@ -74,6 +74,7 @@ static bool igp_read_bios_from_vram(struct amdgpu_device *adev)
iounmap(bios); iounmap(bios);
return false; return false;
} }
adev->bios_size = size;
memcpy_fromio(adev->bios, bios, size); memcpy_fromio(adev->bios, bios, size);
iounmap(bios); iounmap(bios);
return true; return true;
...@@ -103,6 +104,7 @@ bool amdgpu_read_bios(struct amdgpu_device *adev) ...@@ -103,6 +104,7 @@ bool amdgpu_read_bios(struct amdgpu_device *adev)
pci_unmap_rom(adev->pdev, bios); pci_unmap_rom(adev->pdev, bios);
return false; return false;
} }
adev->bios_size = size;
memcpy_fromio(adev->bios, bios, size); memcpy_fromio(adev->bios, bios, size);
pci_unmap_rom(adev->pdev, bios); pci_unmap_rom(adev->pdev, bios);
return true; return true;
...@@ -135,6 +137,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev) ...@@ -135,6 +137,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)
DRM_ERROR("no memory to allocate for BIOS\n"); DRM_ERROR("no memory to allocate for BIOS\n");
return false; return false;
} }
adev->bios_size = len;
/* read complete BIOS */ /* read complete BIOS */
return amdgpu_asic_read_bios_from_rom(adev, adev->bios, len); 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) ...@@ -159,6 +162,7 @@ static bool amdgpu_read_platform_bios(struct amdgpu_device *adev)
if (adev->bios == NULL) { if (adev->bios == NULL) {
return false; return false;
} }
adev->bios_size = size;
return true; return true;
} }
...@@ -273,6 +277,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev) ...@@ -273,6 +277,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
kfree(adev->bios); kfree(adev->bios);
return false; return false;
} }
adev->bios_size = size;
return true; return true;
} }
#else #else
...@@ -334,6 +339,7 @@ static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev) ...@@ -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 = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL);
adev->bios_size = vhdr->ImageLength;
ret = !!adev->bios; ret = !!adev->bios;
out_unmap: out_unmap:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment