Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3135
-gerrit
commit 7906f4a57aba4390ff28fc9df260d50976dad986
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Wed Apr 24 16:28:52 2013 -0500
coverage: use boot state callbacks
Utilize the static boot state callback scheduling to initialize
and tear down the coverage infrastructure at the appropriate points.
The coverage initialization is performed at BS_PRE_DEVICE which is the
earliest point a callback can be called. The tear down occurs at the
2 exit points of ramstage: OS resume and payload boot.
Change-Id: Ie5ee51268e1f473f98fa517710a266e38dc01b6d
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/x86/boot/acpi.c | 4 ----
src/include/coverage.h | 21 ---------------------
src/lib/gcov-glue.c | 12 ++++++++----
src/lib/hardwaremain.c | 5 -----
src/lib/selfboot.c | 4 ----
5 files changed, 8 insertions(+), 38 deletions(-)
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index 1c373ac..a3bf718 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -36,7 +36,6 @@
#if CONFIG_COLLECT_TIMESTAMPS
#include <timestamp.h>
#endif
-#include <coverage.h>
/* FIXME: Kconfig doesn't support overridable defaults :-( */
#ifndef CONFIG_HPET_MIN_TICKS
@@ -638,9 +637,6 @@ void acpi_resume(void *wake_vec)
/* Call mainboard resume handler first, if defined. */
if (mainboard_suspend_resume)
mainboard_suspend_resume();
-#if CONFIG_COVERAGE
- coverage_exit();
-#endif
/* Tear down the caching of the ROM. */
if (disable_cache_rom)
disable_cache_rom();
diff --git a/src/include/coverage.h b/src/include/coverage.h
deleted file mode 100644
index e1c50c5..0000000
--- a/src/include/coverage.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2012 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; version 2 of the License.
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
- */
-
-void coverage_init(void);
-void coverage_exit(void);
diff --git a/src/lib/gcov-glue.c b/src/lib/gcov-glue.c
index 4e2b290..ab9062b 100644
--- a/src/lib/gcov-glue.c
+++ b/src/lib/gcov-glue.c
@@ -18,8 +18,8 @@
*/
#include <stdint.h>
+#include <bootstate.h>
#include <cbmem.h>
-#include <coverage.h>
typedef struct file {
uint32_t magic;
@@ -128,7 +128,7 @@ static void setbuf(FILE *stream, char *buf)
gcc_assert(buf == 0);
}
-void coverage_init(void)
+static void coverage_init(void *unused)
{
extern long __CTOR_LIST__;
typedef void (*func_ptr)(void) ;
@@ -142,7 +142,7 @@ void coverage_init(void)
}
void __gcov_flush(void);
-void coverage_exit(void)
+static void coverage_exit(void *unused)
{
#if CONFIG_DEBUG_COVERAGE
printk(BIOS_DEBUG, "Syncing coverage data.\n");
@@ -150,4 +150,8 @@ void coverage_exit(void)
__gcov_flush();
}
-
+BOOT_STATE_INIT_ENTRIES(gcov_bscb) = {
+ BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, coverage_init, NULL),
+ BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, coverage_exit, NULL),
+ BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, coverage_exit, NULL),
+};
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 47a482e..2c6b726 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -41,7 +41,6 @@ it with the version available from LANL.
#include <arch/acpi.h>
#endif
#include <cbmem.h>
-#include <coverage.h>
#include <timestamp.h>
#define BS_DEBUG_LVL BIOS_NEVER
@@ -324,10 +323,6 @@ void hardwaremain(int boot_complete)
timestamp_stash(TS_START_RAMSTAGE);
post_code(POST_ENTRY_RAMSTAGE);
-#if CONFIG_COVERAGE
- coverage_init();
-#endif
-
/* console_init() MUST PRECEDE ALL printk()! */
console_init();
diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c
index be03b85..934c131 100644
--- a/src/lib/selfboot.c
+++ b/src/lib/selfboot.c
@@ -33,7 +33,6 @@
#if CONFIG_COLLECT_TIMESTAMPS
#include <timestamp.h>
#endif
-#include <coverage.h>
/* Maximum physical address we can use for the coreboot bounce buffer. */
#ifndef MAX_ADDR
@@ -537,9 +536,6 @@ int selfboot(struct lb_memory *mem, struct cbfs_payload *payload)
#if CONFIG_COLLECT_TIMESTAMPS
timestamp_add_now(TS_SELFBOOT_JUMP);
#endif
-#if CONFIG_COVERAGE
- coverage_exit();
-#endif
/* Tear down the caching of the ROM. */
if (disable_cache_rom)
Aaron Durbin (adurbin(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3131
-gerrit
commit a8f660655a010ecc5ba251e19e91eb47ba76d65b
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Apr 25 08:42:23 2013 -0500
cbfs: make searching for a file less verbose
The cbfs core code would print out all unmatched file
names when searching for a file. This contributes to a lot
of unnecessary messages in the boot log. Change this
message to a DEBUG one so that it will only be printed when
CONFIG_DEBUG_CBFS is enabled.
Change-Id: I1e46a4b21d80e5d2f9b511a163def7f5d4e0fb99
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/lib/cbfs_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/lib/cbfs_core.c b/src/lib/cbfs_core.c
index 9732b82..1220d48 100644
--- a/src/lib/cbfs_core.c
+++ b/src/lib/cbfs_core.c
@@ -158,7 +158,8 @@ struct cbfs_file *cbfs_get_file(struct cbfs_media *media, const char *name)
media->close(media);
return file_ptr;
} else {
- LOG(" (unmatched file @0x%x: %s)\n", offset, file_name);
+ DEBUG(" (unmatched file @0x%x: %s)\n", offset,
+ file_name);
media->unmap(media, file_name);
}
Hung-Te Lin (hungte(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3102
-gerrit
commit e15c7ea444609890a84c4c5680b284efbdf504c5
Author: Hung-Te Lin <hungte(a)chromium.org>
Date: Thu Apr 25 19:49:40 2013 +0800
Google/Snow: Enable suspend/resume.
Add the suspend/resume feature into bootblock and romstage.
Note, resuming with X and touchpad driver may be still unstable.
Verified by building and booting successfully on Google/Snow, and then executing
the "suspend_stress_test" in text mode ("stop ui; suspend_stress_test") in
Chromium OS, passed at least 20 iterations.
Change-Id: I65681c42eeef2736e55bb906595f42a5b1dfdf11
Signed-off-by: Hung-Te Lin <hungte(a)chromium.org>
---
src/mainboard/google/snow/bootblock.c | 17 ++++++++++++-----
src/mainboard/google/snow/romstage.c | 13 ++++++++++---
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/src/mainboard/google/snow/bootblock.c b/src/mainboard/google/snow/bootblock.c
index d2e0b50..d6411b5 100644
--- a/src/mainboard/google/snow/bootblock.c
+++ b/src/mainboard/google/snow/bootblock.c
@@ -25,16 +25,23 @@
#include <console/console.h>
#include <cpu/samsung/exynos5250/periph.h>
#include <cpu/samsung/exynos5250/pinmux.h>
+#include "mainboard.h"
void bootblock_mainboard_init(void);
void bootblock_mainboard_init(void)
{
- /* kick off the microsecond timer. We want to do this as early
- * as we can.
- */
- timer_start();
+ switch (board_get_wakeup_state()) {
+ case BOARD_WAKEUP_DIRECT:
+ board_wakeup();
+ break;
- exynos_pinmux_config(PERIPH_ID_SPI1, PINMUX_FLAG_NONE);
+ case BOARD_IS_NOT_WAKEUP:
+ /* kick off the microsecond timer.
+ * We want to do this as early as we can.
+ */
+ timer_start();
+ break;
+ }
#if CONFIG_EARLY_CONSOLE
exynos_pinmux_config(PERIPH_ID_UART3, PINMUX_FLAG_NONE);
console_init();
diff --git a/src/mainboard/google/snow/romstage.c b/src/mainboard/google/snow/romstage.c
index c067629..3eff129 100644
--- a/src/mainboard/google/snow/romstage.c
+++ b/src/mainboard/google/snow/romstage.c
@@ -170,15 +170,22 @@ void main(void)
{
struct mem_timings *mem;
void *entry;
+ int is_resume = (board_get_wakeup_state() != BOARD_IS_NOT_WAKEUP);
/* Clock must be initialized before console_init, otherwise you may need
* to re-initialize serial console drivers again. */
mem = board_setup_clock();
- console_init();
- board_setup_power();
+ if (!is_resume) {
+ console_init();
+ board_setup_power();
+ }
+
+ board_setup_memory(mem, is_resume);
- board_setup_memory(mem, 0);
+ if (is_resume) {
+ board_wakeup();
+ }
board_setup_storage();
board_setup_gpio();
Hung-Te Lin (hungte(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3129
-gerrit
commit c89d5265659b9a4a1799d38eab864984237a40d2
Author: Hung-Te Lin <hungte(a)chromium.org>
Date: Thu Apr 25 17:38:55 2013 +0800
google/snow: Add "wakeup" module for suspend/resume.
The "wakeup" procedure will be shared by bootblock and romstage for different
types of resume processes.
Note, this commit does not include changes in romstage/bootblock to enable
suspend/resume feature. Simply adding functions to handle suspend/resume.
Verified by successfully building and booting Google/Snow firmware image.
Change-Id: I17a256afb99f2f8b5e0eac3393cdf6959b239341
Signed-off-by: Hung-Te Lin <hungte(a)chromium.org>
---
src/cpu/samsung/exynos5250/Makefile.inc | 2 +-
src/mainboard/google/snow/Makefile.inc | 3 ++
src/mainboard/google/snow/mainboard.h | 11 ++++++
src/mainboard/google/snow/romstage.c | 13 -------
src/mainboard/google/snow/wakeup.c | 62 +++++++++++++++++++++++++++++++++
5 files changed, 77 insertions(+), 14 deletions(-)
diff --git a/src/cpu/samsung/exynos5250/Makefile.inc b/src/cpu/samsung/exynos5250/Makefile.inc
index 8788a6c..25d1bc5 100644
--- a/src/cpu/samsung/exynos5250/Makefile.inc
+++ b/src/cpu/samsung/exynos5250/Makefile.inc
@@ -3,7 +3,7 @@
# image outside of CBFS
#INTERMEDIATE += exynos5250_add_bl1
-bootblock-y += pinmux.c mct.c
+bootblock-y += pinmux.c mct.c power.c
# Clock is required for UART
bootblock-$(CONFIG_EARLY_CONSOLE) += clock_init.c
bootblock-$(CONFIG_EARLY_CONSOLE) += clock.c
diff --git a/src/mainboard/google/snow/Makefile.inc b/src/mainboard/google/snow/Makefile.inc
index 46e366f..84a8c05 100644
--- a/src/mainboard/google/snow/Makefile.inc
+++ b/src/mainboard/google/snow/Makefile.inc
@@ -17,9 +17,12 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
+bootblock-y += wakeup.c
+
romstage-y += mainboard.c
romstage-y += memory.c
romstage-y += romstage.c
+romstage-y += wakeup.c
# ramstage-y += ec.c
ramstage-y += ramstage.c
diff --git a/src/mainboard/google/snow/mainboard.h b/src/mainboard/google/snow/mainboard.h
index 6fe371f..63a2c18 100644
--- a/src/mainboard/google/snow/mainboard.h
+++ b/src/mainboard/google/snow/mainboard.h
@@ -35,4 +35,15 @@ enum snow_board_config {
int board_get_config(void);
+enum {
+ BOARD_IS_NOT_WAKEUP, // A normal boot (not suspend/resume).
+ BOARD_WAKEUP_DIRECT, // A wake up event that can be resumed any time.
+ BOARD_WAKEUP_NEED_CLOCK_RESET, // A wake up event that must be resumed
+ // only after clock and memory
+ // controllers are re-initialized.
+};
+
+int board_get_wakeup_state(void);
+void board_wakeup(void);
+
#endif /* MAINBOARD_H */
diff --git a/src/mainboard/google/snow/romstage.c b/src/mainboard/google/snow/romstage.c
index edbe009..6e312fa 100644
--- a/src/mainboard/google/snow/romstage.c
+++ b/src/mainboard/google/snow/romstage.c
@@ -46,19 +46,6 @@
#define PMIC_BUS 0
#define MMC0_GPIO_PIN (58)
-#if 0
-static int board_wakeup_permitted(void)
-{
- const int gpio = GPIO_Y10;
- int is_bad_wake;
-
- /* We're a bad wakeup if the gpio was defined and was high */
- is_bad_wake = ((gpio != -1) && gpio_get_value(gpio));
-
- return !is_bad_wake;
-}
-#endif
-
static int setup_pmic(void)
{
int error = 0;
diff --git a/src/mainboard/google/snow/wakeup.c b/src/mainboard/google/snow/wakeup.c
new file mode 100644
index 0000000..33ea9d8
--- /dev/null
+++ b/src/mainboard/google/snow/wakeup.c
@@ -0,0 +1,62 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google, Inc. All rights reserved.
+ *
+ * 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; version 2 of the License.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <arch/gpio.h>
+#include <arch/hlt.h>
+#include <console/console.h>
+#include <cpu/samsung/exynos5250/gpio.h>
+#include <cpu/samsung/exynos5250/power.h>
+#include <cpu/samsung/exynos5-common/exynos5-common.h>
+
+#include "mainboard.h"
+
+static int wakeup_need_reset(void)
+{
+ /* The "wake up" event is not reliable (known as "bad wakeup") and needs
+ * reset if GPIO value is high. */
+ return gpio_get_value(GPIO_Y10);
+}
+
+void board_wakeup(void)
+{
+ if (wakeup_need_reset())
+ power_reset();
+
+ power_init(); /* Ensure ps_hold_setup() for early wakeup. */
+ power_exit_wakeup();
+ /* Should never return. */
+ die("Failed to wake up.\n");
+}
+
+int board_get_wakeup_state()
+{
+ uint32_t status = power_read_reset_status();
+
+ /* DIDLE/LPA can be resumed without clock reset (ex, bootblock),
+ * and SLEEP requires resetting clock (should be done in ROM stage).
+ */
+
+ if (status == S5P_CHECK_DIDLE || status == S5P_CHECK_LPA)
+ return BOARD_WAKEUP_DIRECT;
+
+ if (status == S5P_CHECK_SLEEP)
+ return BOARD_WAKEUP_NEED_CLOCK_RESET;
+
+ return BOARD_IS_NOT_WAKEUP;
+}