blob: 37471e5c83a384cc55e32934b9ea4546f7aa6f30 [file] [log] [blame]
Angel Pons8a3453f2020-04-02 23:48:19 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahy0946ec32015-04-20 15:24:54 -07002
Kyösti Mälkki0a546852021-01-24 18:06:26 +02003#include <acpi/acpi.h>
Duncan Laurie1249f052016-01-20 13:21:32 -08004#include <bootmode.h>
Lee Leahy0946ec32015-04-20 15:24:54 -07005#include <console/console.h>
Matt DeVillier1f6e3292018-06-20 00:35:27 -05006#include <drivers/intel/gma/opregion.h>
Lee Leahy94b856e2015-10-15 12:07:03 -07007#include <fsp/ramstage.h>
Aaron Durbin789f2b62015-09-09 17:05:06 -05008#include <fsp/util.h>
Matt DeVillier1f6e3292018-06-20 00:35:27 -05009#include <lib.h>
Matt DeVillier660de342017-06-13 16:54:00 -050010
Lee Leahy0946ec32015-04-20 15:24:54 -070011/* Locate VBT and pass it to FSP GOP */
Kyösti Mälkki0a546852021-01-24 18:06:26 +020012void load_vbt(SILICON_INIT_UPD *params)
Lee Leahy0946ec32015-04-20 15:24:54 -070013{
Duncan Laurie1249f052016-01-20 13:21:32 -080014 const optionrom_vbt_t *vbt_data = NULL;
Matt DeVillier06c373d2018-06-25 13:02:27 -050015 size_t vbt_len;
Lee Leahy0946ec32015-04-20 15:24:54 -070016
17 /* Check boot mode - for S3 resume path VBT loading is not needed */
Kyösti Mälkki0a546852021-01-24 18:06:26 +020018 if (acpi_is_wakeup_s3()) {
Lee Leahy0946ec32015-04-20 15:24:54 -070019 printk(BIOS_DEBUG, "S3 resume do not pass VBT to GOP\n");
Duncan Laurie1249f052016-01-20 13:21:32 -080020 } else if (display_init_required()) {
21 /* Get VBT data */
Matt DeVillier1f6e3292018-06-20 00:35:27 -050022 vbt_data = locate_vbt(&vbt_len);
23 if (vbt_data != NULL) {
Julius Wernercd49cce2019-03-05 16:53:33 -080024 if (CONFIG(DISPLAY_VBT)) {
Matt DeVillier1f6e3292018-06-20 00:35:27 -050025 /* Display the vbt file contents */
26 printk(BIOS_DEBUG, "VBT Data:\n");
27 hexdump(vbt_data, vbt_len);
28 printk(BIOS_DEBUG, "\n");
29 }
Duncan Laurie1249f052016-01-20 13:21:32 -080030 printk(BIOS_DEBUG, "Passing VBT to GOP\n");
Matt DeVillier1f6e3292018-06-20 00:35:27 -050031 } else {
Duncan Laurie1249f052016-01-20 13:21:32 -080032 printk(BIOS_DEBUG, "VBT not found!\n");
Matt DeVillier1f6e3292018-06-20 00:35:27 -050033 }
Lee Leahy0946ec32015-04-20 15:24:54 -070034 } else {
Duncan Laurie1249f052016-01-20 13:21:32 -080035 printk(BIOS_DEBUG, "Not passing VBT to GOP\n");
Lee Leahy0946ec32015-04-20 15:24:54 -070036 }
Subrata Banik13cd3312015-08-07 18:22:54 +053037 params->GraphicsConfigPtr = (u32)vbt_data;
Lee Leahy0946ec32015-04-20 15:24:54 -070038}