Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14214
-gerrit
commit a96c91d801648eace8cc86e26fe4896d4070ad9a
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Mar 31 13:49:00 2016 -0500
lib/prog_loading: introduce prog_segment_loaded()
In order to not muddle arch vs chipset implementations provide
a generic prog_segment_loaded() which calls platform_segment_loaded()
and arch_segment_loaded() in that order. This allows the arch variants
to live in src/arch while the chipset/platform code can implement
their own.
Change-Id: I17b6497219ec904d92bd286f18c9ec96b2b7af25
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/arch/x86/postcar_loader.c | 2 +-
src/drivers/intel/fsp2_0/util.c | 2 +-
src/include/program_loading.h | 11 +++++++++--
src/lib/cbfs.c | 2 +-
src/lib/prog_ops.c | 12 ++++++++++++
src/lib/rmodule.c | 2 +-
src/lib/selfboot.c | 2 +-
7 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index eba90d4..cc1d460 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -115,7 +115,7 @@ void run_postcar_phase(struct postcar_frame *pcf)
* Signal to rest of system that another update was made to the
* postcar program prior to running it.
*/
- arch_segment_loaded((uintptr_t)rsl.params, sizeof(uintptr_t),
+ prog_segment_loaded((uintptr_t)rsl.params, sizeof(uintptr_t),
SEG_FINAL);
prog_run(&prog);
diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c
index c4fe8dc..743bc9a 100644
--- a/src/drivers/intel/fsp2_0/util.c
+++ b/src/drivers/intel/fsp2_0/util.c
@@ -132,7 +132,7 @@ enum cb_err fsp_load_binary(struct fsp_header *hdr,
return CB_ERR;
/* Signal that FSP component has been loaded. */
- arch_segment_loaded(hdr->image_base, hdr->image_size, SEG_FINAL);
+ prog_segment_loaded(hdr->image_base, hdr->image_size, SEG_FINAL);
return CB_SUCCESS;
}
diff --git a/src/include/program_loading.h b/src/include/program_loading.h
index 8ac73dd..42addb8 100644
--- a/src/include/program_loading.h
+++ b/src/include/program_loading.h
@@ -37,8 +37,15 @@ enum prog_type {
PROG_BL32,
};
-/* Called for each segment of a program loaded. The SEG_FINAL flag will be
- * set on the last segment loaded. */
+/*
+ * prog_segment_loaded() is called for each segment of a program loaded. The
+ * SEG_FINAL flag will be set on the last segment loaded. The following two
+ * functions, platform_segment_loaded() and arch_segment_loaded(), are called
+ * in that order within prog_segment_loaded(). In short, rely on
+ * prog_segment_loaded() to perform the proper dispatch sequence.
+ */
+void prog_segment_loaded(uintptr_t start, size_t size, int flags);
+void platform_segment_loaded(uintptr_t start, size_t size, int flags);
void arch_segment_loaded(uintptr_t start, size_t size, int flags);
/* Return true if arch supports bounce buffer. */
diff --git a/src/lib/cbfs.c b/src/lib/cbfs.c
index 82bfa2d..e1626d7 100644
--- a/src/lib/cbfs.c
+++ b/src/lib/cbfs.c
@@ -206,7 +206,7 @@ int cbfs_prog_stage_load(struct prog *pstage)
/* Clear area not covered by file. */
memset(&load[fsize], 0, stage.memlen - fsize);
- arch_segment_loaded((uintptr_t)load, stage.memlen, SEG_FINAL);
+ prog_segment_loaded((uintptr_t)load, stage.memlen, SEG_FINAL);
out:
prog_set_area(pstage, load, stage.memlen);
diff --git a/src/lib/prog_ops.c b/src/lib/prog_ops.c
index 67bdcc0..bc889fc 100644
--- a/src/lib/prog_ops.c
+++ b/src/lib/prog_ops.c
@@ -17,6 +17,18 @@
#include <program_loading.h>
/* For each segment of a program loaded this function is called*/
+void prog_segment_loaded(uintptr_t start, size_t size, int flags)
+{
+ platform_segment_loaded(start, size, flags);
+ arch_segment_loaded(start, size, flags);
+}
+
+void __attribute__ ((weak)) platform_segment_loaded(uintptr_t start,
+ size_t size, int flags)
+{
+ /* do nothing */
+}
+
void __attribute__ ((weak)) arch_segment_loaded(uintptr_t start, size_t size,
int flags)
{
diff --git a/src/lib/rmodule.c b/src/lib/rmodule.c
index 9825e6a..7043157 100644
--- a/src/lib/rmodule.c
+++ b/src/lib/rmodule.c
@@ -197,7 +197,7 @@ int rmodule_load(void *base, struct rmodule *module)
return -1;
rmodule_clear_bss(module);
- arch_segment_loaded((uintptr_t)module->location,
+ prog_segment_loaded((uintptr_t)module->location,
rmodule_memory_size(module), SEG_FINAL);
return 0;
diff --git a/src/lib/selfboot.c b/src/lib/selfboot.c
index 7d3e2dd..23eda14 100644
--- a/src/lib/selfboot.c
+++ b/src/lib/selfboot.c
@@ -452,7 +452,7 @@ static int load_self_segments(
* Each architecture can perform additonal operations
* on the loaded segment
*/
- arch_segment_loaded((uintptr_t)dest, ptr->s_memsz,
+ prog_segment_loaded((uintptr_t)dest, ptr->s_memsz,
last_non_empty == ptr ? SEG_FINAL : 0);
}
}
the following patch was just integrated into master:
commit dd95e006e3c972e5e9c5508bc5fc165a9e6296db
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Mar 31 13:36:33 2016 -0500
arch/x86: notify the system when the postcar parameter was updated
While rmodule_load() calls arch_segment_loaded() when it's done
loading any pieces of code which further modify it, like changing
parameters within the program itself, need to notify the rest of
the system.
Change-Id: Ia3374b58488120ba6279592a77d7f9c6217f1215
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://review.coreboot.org/14213
Reviewed-by: Furquan Shaikh <furquan(a)google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Andrey Petrov <andrey.petrov(a)intel.com>
See https://review.coreboot.org/14213 for details.
-gerrit
the following patch was just integrated into master:
commit 5be350b9fbaa9c49b25a482199bdd3d8fadc91e3
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Mar 31 13:26:46 2016 -0500
soc/intel/apollolake: use arch_segment_loaded() for CAR code coherency
Instead of using platform_prog_run() for flushing programs
from L1D to L2 for code coherency purposes use arch_segment_loaded()
instead as that it's primary purpose. The arch_segment_loaded()
is called within the infrastructure at the appropriate places when
loading programs. Therefore use that to perform the L1D flush
instead of when something is just about to run.
Change-Id: Ib0a6be6f676dcf2c946ef5702471af65d89133e9
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://review.coreboot.org/14212
Reviewed-by: Furquan Shaikh <furquan(a)google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Andrey Petrov <andrey.petrov(a)intel.com>
See https://review.coreboot.org/14212 for details.
-gerrit
Aaron Durbin (adurbin(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14212
-gerrit
commit 7e2b68bed8043ed8e1c7568437e68b1155263662
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Mar 31 13:26:46 2016 -0500
soc/intel/apollolake: use arch_segment_loaded() for CAR code coherency
Instead of using platform_prog_run() for flushing programs
from L1D to L2 for code coherency purposes use arch_segment_loaded()
instead as that it's primary purpose. The arch_segment_loaded()
is called within the infrastructure at the appropriate places when
loading programs. Therefore use that to perform the L1D flush
instead of when something is just about to run.
Change-Id: Ib0a6be6f676dcf2c946ef5702471af65d89133e9
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
---
src/soc/intel/apollolake/car.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/soc/intel/apollolake/car.c b/src/soc/intel/apollolake/car.c
index 7646865..c49d7ef 100644
--- a/src/soc/intel/apollolake/car.c
+++ b/src/soc/intel/apollolake/car.c
@@ -26,8 +26,9 @@ static void flush_l1d_to_l2(void)
wrmsr(MSR_POWER_MISC, msr);
}
-void platform_prog_run(struct prog *prog)
+void arch_segment_loaded(uintptr_t start, size_t size, int flags)
{
- /* Flush L1D cache to L2 */
- flush_l1d_to_l2();
+ /* Flush L1D cache to L2 on final segment loaded */
+ if (flags & SEG_FINAL)
+ flush_l1d_to_l2();
}
the following patch was just integrated into master:
commit a33c6d773be39af6939b99efbdbadb8bc32a5729
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Mar 31 12:48:30 2016 -0500
drivers/intel/fsp2_0: signal that FSP components are loaded
In order for the platform code to handle situations where
special actions are required after a piece of code is loaded
use arch_segment_loaded() to signal to the platform code
that the component is fully loaded into memory.
Change-Id: I119cfc9913f15eb4968fe5bf6a56589e2c53f2d1
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://review.coreboot.org/14211
Reviewed-by: Furquan Shaikh <furquan(a)google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Andrey Petrov <andrey.petrov(a)intel.com>
See https://review.coreboot.org/14211 for details.
-gerrit
the following patch was just integrated into master:
commit 595688a3d60c7ad0227ec7f72d8f2e73fd8f236e
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Mar 31 11:38:13 2016 -0500
soc/intel/apollolake: use CAR code coherency for all CAR stages
The flush L1D to L2 operation was only being used when loading
romstage from bootblock. However, when the FSP-M component is
loaded no code coherency actions are taken. I suspect this is
because the FSP-M component is larger than the 24KiB L1D and
the entry point is early in the image. Thus, when loading
the FSP-M component the earlier part of the image is flushed
out to L2 in the process of loading the latter part of the
component. Also, once verstage is introduced the same
code coherency actions need to be taken as well. Therefore,
position the apollolake code to handle all these cases.
Change-Id: Ie71764f1b420a6072c4f149ad3e37278b6cb70e1
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://review.coreboot.org/14210
Tested-by: build bot (Jenkins)
Reviewed-by: Furquan Shaikh <furquan(a)google.com>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Andrey Petrov <andrey.petrov(a)intel.com>
See https://review.coreboot.org/14210 for details.
-gerrit
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 23f9bbfa7531b701d03e23e2c030adfd4a535cae
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__ */