Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: Use dbg level for VBIOS check messages

Driver has different ways to fetch VBIOS. If one of the methods doesn't
find an authentic one, it will show misleading info messages eventhough
a subsequent method finds a valid VBIOS. Keep the message level at debug
and add device context.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lijo Lazar and committed by
Alex Deucher
635c659f 54a1b36d

+14 -12
+14 -12
drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
··· 47 47 /* Check if current bios is an ATOM BIOS. 48 48 * Return true if it is ATOM BIOS. Otherwise, return false. 49 49 */ 50 - static bool check_atom_bios(uint8_t *bios, size_t size) 50 + static bool check_atom_bios(struct amdgpu_device *adev, size_t size) 51 51 { 52 52 uint16_t tmp, bios_header_start; 53 + uint8_t *bios = adev->bios; 53 54 54 55 if (!bios || size < 0x49) { 55 - DRM_INFO("vbios mem is null or mem size is wrong\n"); 56 + dev_dbg(adev->dev, "VBIOS mem is null or mem size is wrong\n"); 56 57 return false; 57 58 } 58 59 59 60 if (!AMD_IS_VALID_VBIOS(bios)) { 60 - DRM_INFO("BIOS signature incorrect %x %x\n", bios[0], bios[1]); 61 + dev_dbg(adev->dev, "VBIOS signature incorrect %x %x\n", bios[0], 62 + bios[1]); 61 63 return false; 62 64 } 63 65 64 66 bios_header_start = bios[0x48] | (bios[0x49] << 8); 65 67 if (!bios_header_start) { 66 - DRM_INFO("Can't locate bios header\n"); 68 + dev_dbg(adev->dev, "Can't locate VBIOS header\n"); 67 69 return false; 68 70 } 69 71 70 72 tmp = bios_header_start + 4; 71 73 if (size < tmp) { 72 - DRM_INFO("BIOS header is broken\n"); 74 + dev_dbg(adev->dev, "VBIOS header is broken\n"); 73 75 return false; 74 76 } 75 77 76 78 if (!memcmp(bios + tmp, "ATOM", 4) || 77 79 !memcmp(bios + tmp, "MOTA", 4)) { 78 - DRM_DEBUG("ATOMBIOS detected\n"); 80 + dev_dbg(adev->dev, "ATOMBIOS detected\n"); 79 81 return true; 80 82 } 81 83 ··· 120 118 memcpy_fromio(adev->bios, bios, size); 121 119 iounmap(bios); 122 120 123 - if (!check_atom_bios(adev->bios, size)) { 121 + if (!check_atom_bios(adev, size)) { 124 122 kfree(adev->bios); 125 123 return false; 126 124 } ··· 148 146 memcpy_fromio(adev->bios, bios, size); 149 147 pci_unmap_rom(adev->pdev, bios); 150 148 151 - if (!check_atom_bios(adev->bios, size)) { 149 + if (!check_atom_bios(adev, size)) { 152 150 kfree(adev->bios); 153 151 return false; 154 152 } ··· 188 186 /* read complete BIOS */ 189 187 amdgpu_asic_read_bios_from_rom(adev, adev->bios, len); 190 188 191 - if (!check_atom_bios(adev->bios, len)) { 189 + if (!check_atom_bios(adev, len)) { 192 190 kfree(adev->bios); 193 191 return false; 194 192 } ··· 218 216 memcpy_fromio(adev->bios, bios, romlen); 219 217 iounmap(bios); 220 218 221 - if (!check_atom_bios(adev->bios, romlen)) 219 + if (!check_atom_bios(adev, romlen)) 222 220 goto free_bios; 223 221 224 222 adev->bios_size = romlen; ··· 326 324 break; 327 325 } 328 326 329 - if (!check_atom_bios(adev->bios, size)) { 327 + if (!check_atom_bios(adev, size)) { 330 328 kfree(adev->bios); 331 329 return false; 332 330 } ··· 391 389 vhdr->ImageLength, 392 390 GFP_KERNEL); 393 391 394 - if (!check_atom_bios(adev->bios, vhdr->ImageLength)) { 392 + if (!check_atom_bios(adev, vhdr->ImageLength)) { 395 393 kfree(adev->bios); 396 394 return false; 397 395 }