Debian Codegraph @

src/soc/amd/common/fsp/fsp_graphics.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2
3 #include <amdblocks/graphics.h>
4 #include <amdblocks/vbt.h>
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/pci.h>
8 #include <fsp/graphics.h>
9
10 void fsp_graphics_init(struct device *const dev)
11 {
12 struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0);
13
14 if (res && res->base)
15 fsp_report_framebuffer_info(res->base, LB_FB_ORIENTATION_NORMAL);
16 else
17 printk(BIOS_ERR, "%s: Unable to find resource for %s\n",
18 __func__, dev_path(dev));
19
20 /*
21 * Calculate and set checksum for VBIOS data if FSP GOP driver used,
22 * Since GOP driver modifies ATOMBIOS tables at end of BS_DEV_RESOURCES.
23 * While Linux does not verify the checksum the Windows kernel driver does.
24 */
25 struct rom_header *vbios = (struct rom_header *)vbt_get();
26 if (!vbios || !vbios->size) {
27 printk(BIOS_ERR, "%s: No VGA BIOS loaded for %s\n",
28 __func__, dev_path(dev));
29 return;
30 }
31
32 uint8_t *data = (uint8_t *)vbios;
33
34 /* Clear existing checksum before recalculating */
35 data[VFCT_VBIOS_CHECKSUM_OFFSET] = 0;
36 data[VFCT_VBIOS_CHECKSUM_OFFSET] =
37 acpi_checksum(data, vbios->size * 512);
38 }