diff options
author | Matt DeVillier <matt.devillier@amd.corp-partner.google.com> | 2023-10-23 10:10:50 -0500 |
---|---|---|
committer | Matt DeVillier <matt.devillier@amd.corp-partner.google.com> | 2023-10-24 16:04:12 +0000 |
commit | b92148390ceb51db191478087bc8bfe82518e4f8 (patch) | |
tree | 836bfde419d5e5400be03f4fd37b67a0387d46ef /src/soc | |
parent | ded5a601b5f8c5eaf57dae4088f9264dc55991c6 (diff) |
soc/amd/common/graphics: Factor out FSP graphics init
Factor out the FSP-dependent graphics init call and header into a
separate file, so that the common graphics init can be used by non-FSP
platforms (eg Stoneyridge) without any preprocessor guards.
TEST=build google/skyrim
Change-Id: Ib025ad3adec0945b4454892d78c30b4cc79e57a0
Signed-off-by: Matt DeVillier <matt.devillier@amd.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78599
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc')
-rw-r--r-- | src/soc/amd/common/block/graphics/graphics.c | 14 | ||||
-rw-r--r-- | src/soc/amd/common/block/include/amdblocks/graphics.h | 10 | ||||
-rw-r--r-- | src/soc/amd/common/fsp/Makefile.inc | 1 | ||||
-rw-r--r-- | src/soc/amd/common/fsp/fsp_graphics.c | 19 |
4 files changed, 34 insertions, 10 deletions
diff --git a/src/soc/amd/common/block/graphics/graphics.c b/src/soc/amd/common/block/graphics/graphics.c index 4d33cadf94..9dff18dd73 100644 --- a/src/soc/amd/common/block/graphics/graphics.c +++ b/src/soc/amd/common/block/graphics/graphics.c @@ -2,14 +2,15 @@ #include <acpi/acpi_device.h> #include <acpi/acpigen.h> +#include <amdblocks/graphics.h> #include <amdblocks/vbios_cache.h> #include <boot/coreboot_tables.h> #include <bootmode.h> #include <bootstate.h> #include <console/console.h> +#include <device/device.h> #include <device/pci.h> #include <fmap.h> -#include <fsp/graphics.h> #include <security/vboot/vbios_cache_hash_tpm.h> #include <soc/intel/common/vbt.h> #include <timestamp.h> @@ -177,15 +178,8 @@ static void graphics_set_resources(struct device *const dev) static void graphics_dev_init(struct device *const dev) { - if (CONFIG(RUN_FSP_GOP)) { - struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); - - if (res && res->base) - fsp_report_framebuffer_info(res->base, LB_FB_ORIENTATION_NORMAL); - else - printk(BIOS_ERR, "%s: Unable to find resource for %s\n", - __func__, dev_path(dev)); - } + if (CONFIG(RUN_FSP_GOP)) + fsp_graphics_init(dev); /* Initialize PCI device, load/execute BIOS Option ROM */ pci_dev_init(dev); diff --git a/src/soc/amd/common/block/include/amdblocks/graphics.h b/src/soc/amd/common/block/include/amdblocks/graphics.h new file mode 100644 index 0000000000..f8811e8bf8 --- /dev/null +++ b/src/soc/amd/common/block/include/amdblocks/graphics.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef AMD_BLOCK_GRAPHICS_H +#define AMD_BLOCK_GRAPHICS_H + +#include <device/device.h> + +void fsp_graphics_init(struct device *const dev); + +#endif /* AMD_BLOCK_GRAPHICS_H */ diff --git a/src/soc/amd/common/fsp/Makefile.inc b/src/soc/amd/common/fsp/Makefile.inc index f26fe8f884..14f1f8510b 100644 --- a/src/soc/amd/common/fsp/Makefile.inc +++ b/src/soc/amd/common/fsp/Makefile.inc @@ -3,6 +3,7 @@ ifeq ($(CONFIG_PLATFORM_USES_FSP2_0),y) romstage-y += fsp_memmap.c romstage-y += fsp_reset.c romstage-y += fsp_validate.c +ramstage-y += fsp_graphics.c ramstage-y += fsp_memmap.c ramstage-y += fsp_report_resources.c ramstage-y += fsp_reset.c diff --git a/src/soc/amd/common/fsp/fsp_graphics.c b/src/soc/amd/common/fsp/fsp_graphics.c new file mode 100644 index 0000000000..4847e3c253 --- /dev/null +++ b/src/soc/amd/common/fsp/fsp_graphics.c @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <amdblocks/graphics.h> +#include <console/console.h> +#include <device/device.h> +#include <device/pci.h> +#include <device/resource.h> +#include <fsp/graphics.h> + +void fsp_graphics_init(struct device *const dev) +{ + struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); + + if (res && res->base) + fsp_report_framebuffer_info(res->base, LB_FB_ORIENTATION_NORMAL); + else + printk(BIOS_ERR, "%s: Unable to find resource for %s\n", + __func__, dev_path(dev)); +} |