Patrick Rudolph (siro(a)das-labor.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14223
-gerrit
commit 094a52fd50281d258b59ca14072df378bb380b6e
Author: Patrick Rudolph <siro(a)das-labor.org>
Date: Thu Mar 31 19:08:53 2016 +0200
device/pci_rom: support calling pci_rom_probe multiple times
Calling the function twice on the same device causes the rom_address
to be of by one as the PCI_ROM_ADDRESS_ENABLE bit is set and not
masked.
Mask the PCI_ROM_ADDRESS_ENABLE bit to always return the same
rom address.
Change-Id: Iafd8824f66981a3ff08defcdc7ea7e9184fa102c
Signed-off-by: Patrick Rudolph <siro(a)das-labor.org>
---
src/device/pci_rom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c
index 56eafef..288a5f0 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -65,6 +65,7 @@ struct rom_header *pci_rom_probe(struct device *dev)
uintptr_t rom_address;
rom_address = pci_read_config32(dev, PCI_ROM_ADDRESS);
+ rom_address &= ~PCI_ROM_ADDRESS_ENABLE;
if (rom_address == 0x00000000 || rom_address == 0xffffffff) {
#if CONFIG_BOARD_EMULATION_QEMU_X86
Patrick Rudolph (siro(a)das-labor.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14221
-gerrit
commit 06a0e8ea4c40e148d3b7b6a741320ee045c89880
Author: Patrick Rudolph <siro(a)das-labor.org>
Date: Sat Mar 19 13:47:39 2016 +0100
device/pci_rom: Always load primary Option Rom
The linux kernel expects the primary VGA Option Rom to be shadowed
at 0xc0000, but it is only loaded if CONFIG_VGA_ROM_RUN is set.
For users that don't want to run Option Roms always load the
Option Rom and run it if CONFIG_VGA_ROM_RUN is set.
Depends on: Iacdff8618d080d7c928d307756662fe33ee13cf0
Change-Id: I52e8e435ba7ddc37288a690ed9730633f6aff8e0
Signed-off-by: Patrick Rudolph <siro(a)das-labor.org>
---
src/device/Kconfig | 12 ---------
src/device/pci_rom.c | 69 +++++++++++++++++++++++++++-------------------------
2 files changed, 36 insertions(+), 45 deletions(-)
diff --git a/src/device/Kconfig b/src/device/Kconfig
index d156d36..3d154e5 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -72,18 +72,6 @@ config S3_VGA_ROM_RUN
If unsure, say N when using SeaBIOS as payload, Y otherwise.
-config ALWAYS_LOAD_OPROM
- def_bool n
- depends on VGA_ROM_RUN
- help
- Always load option ROMs if any are found. The decision to run
- the ROM is still determined at runtime, but the distinction
- between loading and not running comes into play for CHROMEOS.
-
- An example where this is required is that VBT (Video BIOS Tables)
- are needed for the kernel's display driver to know how a piece of
- hardware is configured to be used.
-
config ON_DEVICE_ROM_LOAD
bool "Load Option ROMs on PCI devices"
default n if PAYLOAD_SEABIOS
diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c
index acda996..5abfd8e 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -30,6 +30,8 @@
/* Rmodules don't like weak symbols. */
u32 __attribute__((weak)) map_oprom_vendev(u32 vendev) { return vendev; }
+extern device_t vga_pri; /* Primary VGA device (device.c). */
+
struct rom_header *pci_rom_probe(struct device *dev)
{
struct rom_header *rom_header;
@@ -149,17 +151,15 @@ struct rom_header *pci_rom_load(struct device *dev,
* whether the ROM image is for a VGA device because some
* devices have a mismatch between the hardware and the ROM.
*/
- if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) {
-#if !CONFIG_MULTIPLE_VGA_ADAPTERS
- extern device_t vga_pri; /* Primary VGA device (device.c). */
- if (dev != vga_pri) return NULL; /* Only one VGA supported. */
-#endif
+ if (PCI_CLASS_DISPLAY_VGA == (dev->class >> 8)) {
+ if (!IS_ENABLED(CONFIG_MULTIPLE_VGA_ADAPTERS) && dev != vga_pri)
+ return NULL; /* Only one VGA supported. */
if ((void *)PCI_VGA_RAM_IMAGE_START != rom_header) {
printk(BIOS_DEBUG, "Copying VGA ROM Image from %p to "
- "0x%x, 0x%x bytes\n", rom_header,
- PCI_VGA_RAM_IMAGE_START, rom_size);
+ "0x%x, 0x%x bytes\n", rom_header,
+ PCI_VGA_RAM_IMAGE_START, rom_size);
memcpy((void *)PCI_VGA_RAM_IMAGE_START, rom_header,
- rom_size);
+ rom_size);
}
return (struct rom_header *) (PCI_VGA_RAM_IMAGE_START);
}
@@ -172,19 +172,41 @@ struct rom_header *pci_rom_load(struct device *dev,
return (struct rom_header *) (pci_ram_image_start-rom_size);
}
-#if CONFIG_VGA_ROM_RUN
static int should_run_oprom(struct device *dev)
{
static int should_run = -1;
- if (should_run >= 0)
- return should_run;
+ /* If CONFIG_VGA_ROM_RUN is disabled, skip running VGA option
+ * ROMs.
+ */
+ if (!IS_ENABLED(CONFIG_VGA_ROM_RUN)) {
+ printk(BIOS_DEBUG, "Not running VGA Option ROM\n");
+ return 0;
+ }
+
+ /* If S3_VGA_ROM_RUN is disabled, skip running VGA option
+ * ROMs when coming out of an S3 resume.
+ */
+ if (!IS_ENABLED(CONFIG_S3_VGA_ROM_RUN) && acpi_is_wakeup_s3() &&
+ ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA)) {
+ printk(BIOS_DEBUG, "Not running VGA Option ROM\n");
+ return 0;
+ }
+
+ /* Only run primary VGA device Option Rom.
+ */
+ if (vga_pri != dev) {
+ printk(BIOS_DEBUG, "Not running VGA Option ROM\n");
+ return 0;
+ }
/* Don't run VGA option ROMs, unless we have to print
* something on the screen before the kernel is loaded.
+ * Only run the primary vga device's Option Rom.
*/
should_run = !IS_ENABLED(CONFIG_BOOTMODE_STRAPS) ||
- developer_mode_enabled() || recovery_mode_enabled();
+ developer_mode_enabled() ||
+ recovery_mode_enabled();
#if CONFIG_CHROMEOS
if (!should_run)
@@ -195,23 +217,6 @@ static int should_run_oprom(struct device *dev)
return should_run;
}
-static int should_load_oprom(struct device *dev)
-{
- /* If S3_VGA_ROM_RUN is disabled, skip running VGA option
- * ROMs when coming out of an S3 resume.
- */
- if (!IS_ENABLED(CONFIG_S3_VGA_ROM_RUN) && acpi_is_wakeup_s3() &&
- ((dev->class >> 8) == PCI_CLASS_DISPLAY_VGA))
- return 0;
- if (IS_ENABLED(CONFIG_ALWAYS_LOAD_OPROM))
- return 1;
- if (should_run_oprom(dev))
- return 1;
-
- return 0;
-}
-#endif /* CONFIG_VGA_ROM_RUN */
-
/* TODO: find a good name for this function */
/**
* Load or run PCI Option Roms.
@@ -220,15 +225,12 @@ static int should_load_oprom(struct device *dev)
*/
void pci_rom_load_and_run(struct device *dev)
{
-#if CONFIG_VGA_ROM_RUN
struct rom_header *rom, *ram;
/* Only execute VGA ROMs. */
if (((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA))
return;
- if (!should_load_oprom(dev))
- return;
-
+ /* Always load VGA Option Roms. */
rom = pci_rom_probe(dev);
if (rom == NULL)
return;
@@ -240,6 +242,7 @@ void pci_rom_load_and_run(struct device *dev)
if (!should_run_oprom(dev))
return;
+#if CONFIG_VGA_ROM_RUN
run_bios(dev, (unsigned long)ram);
gfx_set_init_done(1);
printk(BIOS_DEBUG, "VGA Option ROM was run\n");
the following patch was just integrated into master:
commit 808a9c223d2115d1e5ffaf9a55023f153f750180
Author: Patrick Rudolph <siro(a)das-labor.org>
Date: Wed Mar 30 17:59:09 2016 +0200
intel/gma: Fix VBT generation
The log shows the following error on systems that use the
native gfx init. The error isn't shown using the VBIOS blob:
GET_VBIOS: aa55 8086 0 3 0
VBIOS not found.
Don't shift the class-code, as it's already shifted by the PCI layer.
Tested-on: x220
Tested-by: Alexander Couzens <lynxis(a)fe80.eu>
Change-Id: I69018940dd51966b45774e0576a1380f90716dce
Signed-off-by: Patrick Rudolph <siro(a)das-labor.org>
Reviewed-on: https://review.coreboot.org/14188
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Alexander Couzens <lynxis(a)fe80.eu>
See https://review.coreboot.org/14188 for details.
-gerrit