Angel Pons | 8a3453f | 2020-04-02 23:48:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 2 | |
Kyösti Mälkki | 0a54685 | 2021-01-24 18:06:26 +0200 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Duncan Laurie | 1249f05 | 2016-01-20 13:21:32 -0800 | [diff] [blame] | 4 | #include <bootmode.h> |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 5 | #include <console/console.h> |
Matt DeVillier | 1f6e329 | 2018-06-20 00:35:27 -0500 | [diff] [blame] | 6 | #include <drivers/intel/gma/opregion.h> |
Lee Leahy | 94b856e | 2015-10-15 12:07:03 -0700 | [diff] [blame] | 7 | #include <fsp/ramstage.h> |
Aaron Durbin | 789f2b6 | 2015-09-09 17:05:06 -0500 | [diff] [blame] | 8 | #include <fsp/util.h> |
Matt DeVillier | 1f6e329 | 2018-06-20 00:35:27 -0500 | [diff] [blame] | 9 | #include <lib.h> |
Matt DeVillier | 660de34 | 2017-06-13 16:54:00 -0500 | [diff] [blame] | 10 | |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 11 | /* Locate VBT and pass it to FSP GOP */ |
Kyösti Mälkki | 0a54685 | 2021-01-24 18:06:26 +0200 | [diff] [blame] | 12 | void load_vbt(SILICON_INIT_UPD *params) |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 13 | { |
Duncan Laurie | 1249f05 | 2016-01-20 13:21:32 -0800 | [diff] [blame] | 14 | const optionrom_vbt_t *vbt_data = NULL; |
Matt DeVillier | 06c373d | 2018-06-25 13:02:27 -0500 | [diff] [blame] | 15 | size_t vbt_len; |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 16 | |
| 17 | /* Check boot mode - for S3 resume path VBT loading is not needed */ |
Kyösti Mälkki | 0a54685 | 2021-01-24 18:06:26 +0200 | [diff] [blame] | 18 | if (acpi_is_wakeup_s3()) { |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 19 | printk(BIOS_DEBUG, "S3 resume do not pass VBT to GOP\n"); |
Duncan Laurie | 1249f05 | 2016-01-20 13:21:32 -0800 | [diff] [blame] | 20 | } else if (display_init_required()) { |
| 21 | /* Get VBT data */ |
Matt DeVillier | 1f6e329 | 2018-06-20 00:35:27 -0500 | [diff] [blame] | 22 | vbt_data = locate_vbt(&vbt_len); |
| 23 | if (vbt_data != NULL) { |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 24 | if (CONFIG(DISPLAY_VBT)) { |
Matt DeVillier | 1f6e329 | 2018-06-20 00:35:27 -0500 | [diff] [blame] | 25 | /* 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 Laurie | 1249f05 | 2016-01-20 13:21:32 -0800 | [diff] [blame] | 30 | printk(BIOS_DEBUG, "Passing VBT to GOP\n"); |
Matt DeVillier | 1f6e329 | 2018-06-20 00:35:27 -0500 | [diff] [blame] | 31 | } else { |
Duncan Laurie | 1249f05 | 2016-01-20 13:21:32 -0800 | [diff] [blame] | 32 | printk(BIOS_DEBUG, "VBT not found!\n"); |
Matt DeVillier | 1f6e329 | 2018-06-20 00:35:27 -0500 | [diff] [blame] | 33 | } |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 34 | } else { |
Duncan Laurie | 1249f05 | 2016-01-20 13:21:32 -0800 | [diff] [blame] | 35 | printk(BIOS_DEBUG, "Not passing VBT to GOP\n"); |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 36 | } |
Subrata Banik | 13cd331 | 2015-08-07 18:22:54 +0530 | [diff] [blame] | 37 | params->GraphicsConfigPtr = (u32)vbt_data; |
Lee Leahy | 0946ec3 | 2015-04-20 15:24:54 -0700 | [diff] [blame] | 38 | } |