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 149364945a64d9d8b290187c4226ef3500425fc2
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 300afca77d05f8cfbd05c8c21c4e315e59e71a7b
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.
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");
Patrick Rudolph (siro(a)das-labor.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14219
-gerrit
commit b997dab411537187fe4f5f0601233d8751523da0
Author: Patrick Rudolph <siro(a)das-labor.org>
Date: Fri Mar 18 18:03:32 2016 +0100
device/pci_rom: Always use pci_rom
The following series always needs to access the functions
provided pci_rom.c.
Remove the dependency to CONFIG_VGA_ROM_RUN.
Change-Id: I6ed7ff5380edc7cd88dc1c71b43b1129a3de0f52
Signed-off-by: Patrick Rudolph <siro(a)das-labor.org>
---
src/device/Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/device/Makefile.inc b/src/device/Makefile.inc
index 6bad0cd..76c59e5 100644
--- a/src/device/Makefile.inc
+++ b/src/device/Makefile.inc
@@ -25,7 +25,7 @@ romstage-$(CONFIG_PCI) += pci_early.c
subdirs-y += oprom dram
-ramstage-$(CONFIG_VGA_ROM_RUN) += pci_rom.c
+ramstage-y += pci_rom.c
bootblock-$(CONFIG_SOFTWARE_I2C) += software_i2c.c
verstage-$(CONFIG_SOFTWARE_I2C) += software_i2c.c
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/3943
-gerrit
commit e7a59d4671ca5d9b74069647cb7193e344d7f323
Author: Gabe Black <gabeblack(a)chromium.org>
Date: Tue Sep 24 01:40:07 2013 -0700
beaglebone: Add code to set the value of the LEDs
The LEDs on the beaglebone are connected to GPIOs called USR0-USR3. This
change adds some functions to make it easy to set their value and clear
what the calling code is trying to do.
Change-Id: I0bb83bbc2e195ce1a0104afcd120089efaa22916
Signed-off-by: Gabe Black <gabeblack(a)chromium.org>
---
src/mainboard/ti/beaglebone/Makefile.inc | 1 +
src/mainboard/ti/beaglebone/leds.c | 44 ++++++++++++++++++++++++++++++++
src/mainboard/ti/beaglebone/leds.h | 29 +++++++++++++++++++++
3 files changed, 74 insertions(+)
diff --git a/src/mainboard/ti/beaglebone/Makefile.inc b/src/mainboard/ti/beaglebone/Makefile.inc
index f6e09a2..6c137d2 100644
--- a/src/mainboard/ti/beaglebone/Makefile.inc
+++ b/src/mainboard/ti/beaglebone/Makefile.inc
@@ -14,6 +14,7 @@
##
bootblock-y += bootblock.c
+bootblock-y += leds.c
romstage-y += romstage.c
#ramstage-y += ramstage.c
diff --git a/src/mainboard/ti/beaglebone/leds.c b/src/mainboard/ti/beaglebone/leds.c
new file mode 100644
index 0000000..405661f
--- /dev/null
+++ b/src/mainboard/ti/beaglebone/leds.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <assert.h>
+#include <console/console.h>
+#include <cpu/ti/am335x/gpio.h>
+#include <stdlib.h>
+
+#include "leds.h"
+
+static const int led_gpios[BEAGLEBONE_LED_COUNT] = {
+ [BEAGLEBONE_LED_USR0] = AM335X_GPIO_BITS_PER_BANK + 21,
+ [BEAGLEBONE_LED_USR1] = AM335X_GPIO_BITS_PER_BANK + 22,
+ [BEAGLEBONE_LED_USR2] = AM335X_GPIO_BITS_PER_BANK + 23,
+ [BEAGLEBONE_LED_USR3] = AM335X_GPIO_BITS_PER_BANK + 24
+};
+
+void beaglebone_leds_init(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(led_gpios); i++)
+ gpio_direction_output(led_gpios[i], 0);
+}
+
+void beaglebone_leds_set(enum beaglebone_led led, int on)
+{
+ int res;
+
+ ASSERT(led < ARRAY_SIZE(led_gpios) && led_gpios[led]);
+ res = gpio_set_value(led_gpios[led], on);
+ ASSERT(res != -1);
+}
diff --git a/src/mainboard/ti/beaglebone/leds.h b/src/mainboard/ti/beaglebone/leds.h
new file mode 100644
index 0000000..a4a6001
--- /dev/null
+++ b/src/mainboard/ti/beaglebone/leds.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __MAINBOARD_TI_BEAGLEBONE_LEDS_H__
+#define __MAINBOARD_TI_BEAGLEBONE_LEDS_H__
+
+enum beaglebone_led {
+ BEAGLEBONE_LED_USR0,
+ BEAGLEBONE_LED_USR1,
+ BEAGLEBONE_LED_USR2,
+ BEAGLEBONE_LED_USR3,
+ BEAGLEBONE_LED_COUNT
+};
+
+void beaglebone_leds_init(void);
+void beaglebone_leds_set(enum beaglebone_led led, int on);
+
+#endif /* __MAINBOARD_TI_BEAGLEBONE_LEDS_H__ */