Created
May 15, 2020 09:27
-
-
Save Geofferey/cca41b5cf72a016f02c470084ba09ba5 to your computer and use it in GitHub Desktop.
A patch to allow loading radeon graphics adapter bios from /lib/firmware/radeon/vbios.bin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a simple patch that will allow Radeon graphics adapters to function in Linux VMs running under ESXi | |
File is located in drivers/gpu/drm/radeon/radeon_bios.c | |
*/ | |
//* Add this line after other includes | |
#include <linux/firmware.h> | |
//* Add this function to file | |
static bool radeon_read_bios_from_firmware(struct radeon_device *rdev) | |
{ | |
const uint8_t __iomem *bios; | |
resource_size_t size; | |
const struct firmware *fw = NULL; | |
request_firmware(&fw, "radeon/vbios.bin", rdev->dev); | |
if (!fw) { | |
DRM_ERROR("No bios\n"); | |
return false; | |
} | |
size = fw->size; | |
bios = fw->data; | |
if (!bios) { | |
DRM_ERROR("No bios\n"); | |
return false; | |
} | |
if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | |
DRM_ERROR("wrong sig\n"); | |
release_firmware(fw); | |
return false; | |
} | |
rdev->bios = kmalloc(size, GFP_KERNEL); | |
if (rdev->bios == NULL) { | |
DRM_ERROR("alloc fail\n"); | |
release_firmware(fw); | |
return false; | |
} | |
memcpy(rdev->bios, bios, size); | |
release_firmware(fw); | |
return true; | |
} | |
/* | |
Add the call to function after this line | |
r = radeon_read_platform_bios(rdev); | |
*/ | |
if (r == false) | |
r = radeon_read_bios_from_firmware(rdev); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment