Attention is currently required from: Patrick Rudolph, Christian Walter, Arthur Heymans. Hello Arthur Heymans,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/62649
to review the following change.
Change subject: [WIP]mb/prodrive/hermes: Change gfx init depending on eeprom config ......................................................................
[WIP]mb/prodrive/hermes: Change gfx init depending on eeprom config
untested
Change-Id: I24d9ebc2055dc246e7f257aa2f3853b22c8af370 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/mainboard/prodrive/hermes/mainboard.c 1 file changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/62649/1
diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c index 2f0de61..d363c77 100644 --- a/src/mainboard/prodrive/hermes/mainboard.c +++ b/src/mainboard/prodrive/hermes/mainboard.c @@ -8,6 +8,7 @@ #include <crc_byte.h> #include <device/device.h> #include <device/dram/spd.h> +#include <device/pci_ids.h> #include <drivers/intel/gma/opregion.h> #include <gpio.h> #include <intelblocks/gpio.h> @@ -257,3 +258,38 @@ }
BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_EXIT, mainboard_early, NULL); + +enum internale_gfx { + PRIMARY_VIDEO_ASPEED = 0, + PRIMARY_VIDEO_INTEL = 1, +}; + +static void disable_internal_gfx(struct device *dev) +{ + if (!dev) + return; + dev->ops->init = NULL; +} + +/* + * In the current setup with EDK2 as a payload, only the Intel GFX or Aspeed one is set up by + * coreboot. The other ones are set up as GOP by the payload. The coreboot tables handoff only + * supports one framebuffer at the moment, so disabling the .init function of PCI driver is + * done to make sure of that. + */ +static void mainboard_configure_internal_gfx(void *unused) +{ + struct device *dev; + const struct eeprom_board_settings *board_cfg = get_board_settings(); + switch (board_cfg->primary_video) { + default: + case PRIMARY_VIDEO_ASPEED: + dev = pcidev_on_root(2, 0); + break; + case PRIMARY_VIDEO_INTEL: + dev = dev_find_device(PCI_VENDOR_ID_ASPEED, PCI_DEVICE_ID_ASPEED_AST2050_VGA, NULL); + break; + } + disable_internal_gfx(dev); +} +BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_ENTRY, mainboard_configure_internal_gfx, NULL)