device/Kconfig: Put gfx init methods into a `choice`

Provide all gfx init methods as a Kconfig `choice`. This elimates the
option to select native gfx init along with running a Video BIOS. It's
been only theoretically useful in one corner case: Hybrid graphics
where only one controller is supported by native gfx init. Though I
suppose in that case it's fair to assume that one would use SeaBIOS to
run the VBIOS.

For the case that we want the payload to initialize graphics or no
pre-boot graphics at all, the new symbol NO_GFX_INIT was added to the
choice. If multiple options are available, the default is chosen as
follows:

  * NO_GFX_INIT, if we add a Video BIOS and the payload is SeaBIOS,
  * VGA_ROM_RUN, if we add a Video BIOS and the payload is not SeaBIOS,
  * NATIVE_VGA_INIT, if we don't add a Video BIOS.

As a side effect, libgfxinit is now an independent choice.

Change-Id: I06bc65ecf3724f299f59888a97219fdbd3d2d08b
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/19814
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Nico Huber 2017-05-22 13:49:22 +02:00 committed by Nico Huber
parent 26ce9af9a0
commit d4ebeaf475
10 changed files with 61 additions and 66 deletions

View File

@ -42,39 +42,36 @@ config MAINBOARD_HAS_NATIVE_VGA_INIT
config MAINBOARD_FORCE_NATIVE_VGA_INIT config MAINBOARD_FORCE_NATIVE_VGA_INIT
def_bool n def_bool n
depends on MAINBOARD_HAS_NATIVE_VGA_INIT || MAINBOARD_HAS_LIBGFXINIT depends on MAINBOARD_HAS_NATIVE_VGA_INIT || MAINBOARD_HAS_LIBGFXINIT
select MAINBOARD_DO_NATIVE_VGA_INIT
help help
Selected by mainboards / chipsets whose graphics driver can't or Selected by mainboards / chipsets whose graphics driver can't or
shouldn't be disabled. shouldn't be disabled.
config MAINBOARD_DO_NATIVE_VGA_INIT
bool "Use native graphics initialization"
depends on MAINBOARD_HAS_NATIVE_VGA_INIT
default n
help
Some mainboards, such as the Google Link, allow initializing the display
without the need of a binary only VGA OPROM. Enabling this option may be
faster, but also lacks flexibility in setting modes.
If unsure, say N.
config MAINBOARD_HAS_LIBGFXINIT config MAINBOARD_HAS_LIBGFXINIT
def_bool n def_bool n
select MAINBOARD_HAS_NATIVE_VGA_INIT
help help
Selected by mainboards that implement support for `libgfxinit`. Selected by mainboards that implement support for `libgfxinit`.
Usually this requires a list of ports to be probed for displays. Usually this requires a list of ports to be probed for displays.
choice
prompt "Graphics initialization"
default NO_GFX_INIT if VGA_BIOS && PAYLOAD_SEABIOS
default VGA_ROM_RUN if VGA_BIOS
config MAINBOARD_DO_NATIVE_VGA_INIT
bool "Use native graphics init"
depends on MAINBOARD_HAS_NATIVE_VGA_INIT
help
Some mainboards, such as the Google Link, allow initializing the
display without the need of a binary only VGA OPROM. Enabling this
option may be faster, but also lacks flexibility in setting modes.
config MAINBOARD_USE_LIBGFXINIT config MAINBOARD_USE_LIBGFXINIT
bool "Use libgfxinit for native graphics initialization" bool "Use libgfxinit"
depends on MAINBOARD_DO_NATIVE_VGA_INIT
depends on MAINBOARD_HAS_LIBGFXINIT depends on MAINBOARD_HAS_LIBGFXINIT
select HAVE_VGA_TEXT_FRAMEBUFFER select HAVE_VGA_TEXT_FRAMEBUFFER
select HAVE_LINEAR_FRAMEBUFFER select HAVE_LINEAR_FRAMEBUFFER
select RAMSTAGE_LIBHWBASE select RAMSTAGE_LIBHWBASE
select VGA if VGA_TEXT_FRAMEBUFFER select VGA if VGA_TEXT_FRAMEBUFFER
select NO_EDID_FILL_FB
default n
help help
Use the SPARK library `libgfxinit` for the native graphics Use the SPARK library `libgfxinit` for the native graphics
initialization. This requires an Ada toolchain. initialization. This requires an Ada toolchain.
@ -82,12 +79,10 @@ config MAINBOARD_USE_LIBGFXINIT
# TODO: Explain differences (if any) for onboard cards. # TODO: Explain differences (if any) for onboard cards.
config VGA_ROM_RUN config VGA_ROM_RUN
bool "Run VGA Option ROMs" bool "Run VGA Option ROMs"
default n if PAYLOAD_SEABIOS depends on PCI && !MAINBOARD_FORCE_NATIVE_VGA_INIT
default y if !PAYLOAD_SEABIOS
depends on PCI && !MAINBOARD_DO_NATIVE_VGA_INIT
select HAVE_VGA_TEXT_FRAMEBUFFER select HAVE_VGA_TEXT_FRAMEBUFFER
help help
Execute VGA Option ROMs in coreboot if found. This is required Execute VGA Option ROMs in coreboot if found. This can be used
to enable PCI/AGP/PCI-E video cards when not using a SeaBIOS to enable PCI/AGP/PCI-E video cards when not using a SeaBIOS
payload. payload.
@ -95,7 +90,15 @@ config VGA_ROM_RUN
more complete BIOS interrupt services available than coreboot, more complete BIOS interrupt services available than coreboot,
which some option ROMs require in order to function correctly. which some option ROMs require in order to function correctly.
If unsure, say N when using SeaBIOS as payload, Y otherwise. config NO_GFX_INIT
bool "None"
depends on !MAINBOARD_FORCE_NATIVE_VGA_INIT
help
Select this to not perform any graphics initialization in
coreboot. This is useful if the payload (e.g. SeaBIOS) can
initialize graphics or if pre-boot graphics are not required.
endchoice
config S3_VGA_ROM_RUN config S3_VGA_ROM_RUN
bool "Re-run VGA Option ROMs on S3 resume" bool "Re-run VGA Option ROMs on S3 resume"

View File

@ -81,10 +81,6 @@ config ONBOARD_VGA_IS_PRIMARY
bool bool
default y default y
config MAINBOARD_DO_NATIVE_VGA_INIT
bool
default y
config MAINBOARD_POWER_ON_AFTER_POWER_FAIL config MAINBOARD_POWER_ON_AFTER_POWER_FAIL
bool bool
default y default y

View File

@ -87,10 +87,6 @@ config ONBOARD_VGA_IS_PRIMARY
bool bool
default y default y
config MAINBOARD_DO_NATIVE_VGA_INIT
bool
default y
config MAINBOARD_POWER_ON_AFTER_POWER_FAIL config MAINBOARD_POWER_ON_AFTER_POWER_FAIL
bool bool
default y default y

View File

@ -15,7 +15,6 @@ config BOARD_GOOGLE_BASEBOARD_SLIPPY
select MAINBOARD_HAS_LPC_TPM select MAINBOARD_HAS_LPC_TPM
select INTEL_INT15 select INTEL_INT15
select MAINBOARD_HAS_LIBGFXINIT select MAINBOARD_HAS_LIBGFXINIT
select MAINBOARD_USE_LIBGFXINIT if MAINBOARD_DO_NATIVE_VGA_INIT
if BOARD_GOOGLE_BASEBOARD_SLIPPY if BOARD_GOOGLE_BASEBOARD_SLIPPY

View File

@ -14,7 +14,6 @@ config BOARD_SPECIFIC_OPTIONS
select HAVE_CMOS_DEFAULT select HAVE_CMOS_DEFAULT
select HAVE_ACPI_RESUME select HAVE_ACPI_RESUME
select MAINBOARD_HAS_LIBGFXINIT select MAINBOARD_HAS_LIBGFXINIT
select MAINBOARD_USE_LIBGFXINIT if MAINBOARD_DO_NATIVE_VGA_INIT
select INTEL_INT15 select INTEL_INT15
select UDELAY_TSC select UDELAY_TSC
select SERIRQ_CONTINUOUS_MODE select SERIRQ_CONTINUOUS_MODE

View File

@ -443,7 +443,7 @@ static void gma_func0_init(struct device *dev)
/* Pre panel init */ /* Pre panel init */
gma_setup_panel(dev); gma_setup_panel(dev);
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
printk(BIOS_SPEW, "NATIVE graphics, run native enable\n"); printk(BIOS_SPEW, "NATIVE graphics, run native enable\n");
physbase = pci_read_config32(dev, 0x5c) & ~0xf; physbase = pci_read_config32(dev, 0x5c) & ~0xf;
gma_gfxinit(gtt_res->base, linearfb_res->base, gma_gfxinit(gtt_res->base, linearfb_res->base,

View File

@ -1008,10 +1008,8 @@ static void gma_func0_init(struct device *dev)
/* Init graphics power management */ /* Init graphics power management */
gma_pm_init_pre_vbios(dev); gma_pm_init_pre_vbios(dev);
#if !CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) ||
/* PCI Init, will run VBIOS */ IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
pci_dev_init(dev);
#else
u32 physbase; u32 physbase;
struct northbridge_intel_nehalem_config *conf = dev->chip_info; struct northbridge_intel_nehalem_config *conf = dev->chip_info;
struct resource *lfb_res; struct resource *lfb_res;
@ -1022,24 +1020,28 @@ static void gma_func0_init(struct device *dev)
physbase = pci_read_config32(dev, 0x5c) & ~0xf; physbase = pci_read_config32(dev, 0x5c) & ~0xf;
if (gtt_res && gtt_res->base && physbase && pio_res && pio_res->base if (gtt_res && gtt_res->base && physbase &&
&& lfb_res && lfb_res->base) { pio_res && pio_res->base && lfb_res && lfb_res->base) {
printk(BIOS_SPEW, "Initializing VGA without OPROM. MMIO 0x%llx\n", printk(BIOS_SPEW,
"Initializing VGA without OPROM. MMIO 0x%llx\n",
gtt_res->base); gtt_res->base);
if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) { if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
int lightup_ok; int lightup_ok;
gma_gfxinit(gtt_res->base, lfb_res->base, gma_gfxinit(gtt_res->base, lfb_res->base,
physbase, &lightup_ok); physbase, &lightup_ok);
} else { } else {
intel_gma_init(conf, res2mmio(gtt_res, 0, 0), physbase, intel_gma_init(conf, res2mmio(gtt_res, 0, 0),
pio_res->base, lfb_res->base); physbase, pio_res->base, lfb_res->base);
} }
} }
/* Linux relies on VBT for panel info. */ /* Linux relies on VBT for panel info. */
generate_fake_intel_oprom(&conf->gfx, dev, "$VBT IRONLAKE-MOBILE"); generate_fake_intel_oprom(&conf->gfx, dev,
#endif "$VBT IRONLAKE-MOBILE");
} else {
/* PCI Init, will run VBIOS */
pci_dev_init(dev);
}
/* Post VBIOS init */ /* Post VBIOS init */
gma_pm_init_post_vbios(dev); gma_pm_init_post_vbios(dev);

View File

@ -26,12 +26,9 @@ config NORTHBRIDGE_SPECIFIC_OPTIONS # dummy
select VGA select VGA
select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT
select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT
select INTEL_EDID if MAINBOARD_DO_NATIVE_VGA_INIT
select RELOCATABLE_RAMSTAGE select RELOCATABLE_RAMSTAGE
config MAINBOARD_DO_NATIVE_VGA_INIT
def_bool y
select INTEL_EDID
config BOOTBLOCK_NORTHBRIDGE_INIT config BOOTBLOCK_NORTHBRIDGE_INIT
string string
default "northbridge/intel/pineview/bootblock.c" default "northbridge/intel/pineview/bootblock.c"

View File

@ -59,7 +59,9 @@ config SANDYBRIDGE_IVYBRIDGE_LVDS
select VGA select VGA
select MAINBOARD_HAS_NATIVE_VGA_INIT select MAINBOARD_HAS_NATIVE_VGA_INIT
config MAINBOARD_DO_NATIVE_VGA_INIT config IF_NATIVE_VGA_INIT
def_bool y
depends on MAINBOARD_DO_NATIVE_VGA_INIT
select VGA select VGA
select INTEL_EDID select INTEL_EDID
select HAVE_LINEAR_FRAMEBUFFER select HAVE_LINEAR_FRAMEBUFFER

View File

@ -595,7 +595,8 @@ static void gma_func0_init(struct device *dev)
/* Post VBIOS init */ /* Post VBIOS init */
gma_pm_init_post_vbios(dev); gma_pm_init_post_vbios(dev);
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) ||
IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) {
/* This should probably run before post VBIOS init. */ /* This should probably run before post VBIOS init. */
printk(BIOS_SPEW, "Initializing VGA without OPROM.\n"); printk(BIOS_SPEW, "Initializing VGA without OPROM.\n");
u8 *mmiobase; u8 *mmiobase;