[U-Boot,v2,19/22] x86: pci: Allow conditionally run VGA rom in S3

Submitted by Bin Meng on April 21, 2017, 2:24 p.m.

Details

Message ID 1492784689-15701-20-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng April 21, 2017, 2:24 p.m.
Introduce a new CONFIG_S3_VGA_ROM_RUN option so that U-Boot can
bypass executing VGA roms in S3.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

Changes in v2: None

 arch/x86/Kconfig      | 12 ++++++++++++
 drivers/pci/pci_rom.c | 14 ++++++++++++++
 2 files changed, 26 insertions(+)

Comments

Simon Glass April 24, 2017, 3:38 a.m.
On 21 April 2017 at 08:24, Bin Meng <bmeng.cn@gmail.com> wrote:
> Introduce a new CONFIG_S3_VGA_ROM_RUN option so that U-Boot can
> bypass executing VGA roms in S3.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
> Changes in v2: None
>
>  arch/x86/Kconfig      | 12 ++++++++++++
>  drivers/pci/pci_rom.c | 14 ++++++++++++++
>  2 files changed, 26 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng April 26, 2017, 7:35 a.m.
On Mon, Apr 24, 2017 at 11:38 AM, Simon Glass <sjg@chromium.org> wrote:
> On 21 April 2017 at 08:24, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Introduce a new CONFIG_S3_VGA_ROM_RUN option so that U-Boot can
>> bypass executing VGA roms in S3.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>> Changes in v2: None
>>
>>  arch/x86/Kconfig      | 12 ++++++++++++
>>  drivers/pci/pci_rom.c | 14 ++++++++++++++
>>  2 files changed, 26 insertions(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86/next, thanks!

Patch hide | download patch | download mbox

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 5322eff..0cd981e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -601,6 +601,18 @@  config HAVE_ACPI_RESUME
 	  is done, U-Boot needs to find out the wakeup vector provided by OSes
 	  and jump there.
 
+config S3_VGA_ROM_RUN
+	bool "Re-run VGA option ROMs on S3 resume"
+	depends on HAVE_ACPI_RESUME
+	default y if HAVE_ACPI_RESUME
+	help
+	  Execute VGA option ROMs in U-Boot when resuming from S3. Normally
+	  this is needed when graphics console is being used in the kernel.
+
+	  Turning it off can reduce some resume time, but be aware that your
+	  graphics console won't work without VGA options ROMs. Set it to N
+	  if your kernel is only on a serial console.
+
 config STACK_SIZE
 	hex
 	depends on HAVE_ACPI_RESUME
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index 57204c4..75fb093 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -35,8 +35,22 @@ 
 #include <video_fb.h>
 #include <linux/screen_info.h>
 
+#ifdef CONFIG_X86
+#include <asm/acpi_s3.h>
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 __weak bool board_should_run_oprom(struct udevice *dev)
 {
+#if defined(CONFIG_X86) && defined(CONFIG_HAVE_ACPI_RESUME)
+	if (gd->arch.prev_sleep_state == ACPI_S3) {
+		if (IS_ENABLED(CONFIG_S3_VGA_ROM_RUN))
+			return true;
+		else
+			return false;
+	}
+#endif
+
 	return true;
 }