aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2016-12-06 20:56:46 -0500
committerAlex Deucher <alexander.deucher@amd.com>2016-12-08 14:09:05 -0500
commita9f5db9ca7a92aa00af82b3d10416e34b31a9493 (patch)
tree9357b843471cd7e8584c19184d5db8819e1edae1
parentff9d646017b9c7aaa5e33ef62d608309bb9fd91e (diff)
drm/amd/amdgpu: stored bios_size
It's necessary if we want to export vbios image out. Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Signed-off-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian Koenig <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c6
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 29d3a914fc88..f31936b65a58 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1330,6 +1330,7 @@ struct amdgpu_device {
1330 1330
1331 /* BIOS */ 1331 /* BIOS */
1332 uint8_t *bios; 1332 uint8_t *bios;
1333 uint32_t bios_size;
1333 bool is_atom_bios; 1334 bool is_atom_bios;
1334 struct amdgpu_bo *stollen_vga_memory; 1335 struct amdgpu_bo *stollen_vga_memory;
1335 uint32_t bios_scratch[AMDGPU_BIOS_NUM_SCRATCH]; 1336 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 b7e2762fcdd2..4f973a9c7b87 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)
74 iounmap(bios); 74 iounmap(bios);
75 return false; 75 return false;
76 } 76 }
77 adev->bios_size = size;
77 memcpy_fromio(adev->bios, bios, size); 78 memcpy_fromio(adev->bios, bios, size);
78 iounmap(bios); 79 iounmap(bios);
79 return true; 80 return true;
@@ -103,6 +104,7 @@ bool amdgpu_read_bios(struct amdgpu_device *adev)
103 pci_unmap_rom(adev->pdev, bios); 104 pci_unmap_rom(adev->pdev, bios);
104 return false; 105 return false;
105 } 106 }
107 adev->bios_size = size;
106 memcpy_fromio(adev->bios, bios, size); 108 memcpy_fromio(adev->bios, bios, size);
107 pci_unmap_rom(adev->pdev, bios); 109 pci_unmap_rom(adev->pdev, bios);
108 return true; 110 return true;
@@ -135,6 +137,7 @@ static bool amdgpu_read_bios_from_rom(struct amdgpu_device *adev)
135 DRM_ERROR("no memory to allocate for BIOS\n"); 137 DRM_ERROR("no memory to allocate for BIOS\n");
136 return false; 138 return false;
137 } 139 }
140 adev->bios_size = len;
138 141
139 /* read complete BIOS */ 142 /* read complete BIOS */
140 return amdgpu_asic_read_bios_from_rom(adev, adev->bios, len); 143 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 if (adev->bios == NULL) { 162 if (adev->bios == NULL) {
160 return false; 163 return false;
161 } 164 }
165 adev->bios_size = size;
162 166
163 return true; 167 return true;
164} 168}
@@ -273,6 +277,7 @@ static bool amdgpu_atrm_get_bios(struct amdgpu_device *adev)
273 kfree(adev->bios); 277 kfree(adev->bios);
274 return false; 278 return false;
275 } 279 }
280 adev->bios_size = size;
276 return true; 281 return true;
277} 282}
278#else 283#else
@@ -334,6 +339,7 @@ static bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev)
334 } 339 }
335 340
336 adev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL); 341 adev->bios = kmemdup(&vbios->VbiosContent, vhdr->ImageLength, GFP_KERNEL);
342 adev->bios_size = vhdr->ImageLength;
337 ret = !!adev->bios; 343 ret = !!adev->bios;
338 344
339out_unmap: 345out_unmap: