Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17254
-gerrit
commit 97458df34c3ca8329fc8e564fac19e0d8f04c748
Author: Ronald G. Minnich <rminnich(a)gmail.com>
Date: Sun Nov 6 16:13:52 2016 -0800
riscv: change payload() to pass the config string pointer as arg0
The riscv 1.9 standard defines a textual config string to be passed
to kernels and hypervisors. A pointer to this string is available
at a platform-dependent location, default 0x100c on all extant platforms.
Define a new config variable, ARCH_CONFIGSTRING_RISCV, to contain
this location and change payload() arguments so arg0 is this pointer
and arg1 is the pointer to the payload.
Change-Id: I3be7f1712accf2d726704e4c970f22749d3c3f36
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
---
src/arch/riscv/Kconfig | 5 +++++
src/arch/riscv/boot.c | 4 ++--
src/arch/riscv/payload.S | 4 +++-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/arch/riscv/Kconfig b/src/arch/riscv/Kconfig
index a30cb70..7c43da4 100644
--- a/src/arch/riscv/Kconfig
+++ b/src/arch/riscv/Kconfig
@@ -19,3 +19,8 @@ config ARCH_ROMSTAGE_RISCV
config ARCH_RAMSTAGE_RISCV
bool
default n
+
+config ARCH_CONFIGSTRING_RISCV
+ hex "Location of pointer to RISCV config string"
+ default 0x100c
+ depends on ARCH_RISCV
diff --git a/src/arch/riscv/boot.c b/src/arch/riscv/boot.c
index ff1844e..598377c 100644
--- a/src/arch/riscv/boot.c
+++ b/src/arch/riscv/boot.c
@@ -22,12 +22,12 @@
void arch_prog_run(struct prog *prog)
{
void (*doit)(void *) = prog_entry(prog);
- void riscvpayload(void *);
+ void riscvpayload(void *configstring, void *payload);
if (ENV_RAMSTAGE && prog_type(prog) == PROG_PAYLOAD) {
initVirtualMemory();
printk(BIOS_SPEW, "OK, let's go\n");
- riscvpayload(doit);
+ riscvpayload((void *)CONFIG_ARCH_CONFIGSTRING_RISCV, doit);
}
doit(prog_entry_arg(prog));
diff --git a/src/arch/riscv/payload.S b/src/arch/riscv/payload.S
index 3261a80..e50a589 100644
--- a/src/arch/riscv/payload.S
+++ b/src/arch/riscv/payload.S
@@ -11,10 +11,12 @@
* GNU General Public License for more details.
*/
+// "return" to a payload pointed to by a1 with
+// a pointer to the config string in a0.
.global riscvpayload
riscvpayload:
/* Jump to a0 in S-mode */
- mv t0,a0
+ mv t0,a1
csrw mepc, t0
csrr t0, mstatus
li t1, ~(3<<11)
Ronald G. Minnich (rminnich(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17233
-gerrit
commit 6779d7f56aac30d8e4baa682a8cd3309453862fa
Author: Ronald G. Minnich <rminnich(a)gmail.com>
Date: Fri Nov 4 11:27:25 2016 -0700
riscv: map first 2GiB of physical memory at the top of virtual address space
We were mapping physical to virtual 1:1, which makes no sense;
most kernels want to start at high negative address space.
Doing it this way ensures that we're following the intent
of the RISCV designers, i.e that virtual addresses are
correct at the start; and that the kernel does not have to
unmap the low physical addresses once it starts.
Change-Id: I8c577ad885891b4c33c20077995abbd90f355f1c
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
---
src/arch/riscv/virtual_memory.c | 43 ++++++++++++++++++++++++++++++++++++-----
1 file changed, 38 insertions(+), 5 deletions(-)
diff --git a/src/arch/riscv/virtual_memory.c b/src/arch/riscv/virtual_memory.c
index 999d73c..7091f02 100644
--- a/src/arch/riscv/virtual_memory.c
+++ b/src/arch/riscv/virtual_memory.c
@@ -168,12 +168,40 @@ void init_vm(uintptr_t virtMemStart, uintptr_t physMemStart, pte_t *sbi_pt)
// IO space.
root_pt[0] = pte_create(0, PTE_W|PTE_R, 0);
- root_pt[1] = pte_create(0x40000000>>RISCV_PGSHIFT,
+ root_pt[1] = pte_create(0x40000000 >> RISCV_PGSHIFT,
PTE_W|PTE_R, 0);
// Start of RAM
- root_pt[2] = pte_create(0x80000000>>RISCV_PGSHIFT,
- PTE_W|PTE_R, 0);
+ //
+ // A RISCV goal is that Machine or Hypervisor modes be able
+ // start a Supervisor (kernel) at the C entry point. The
+ // intent is that firmware creates the virtual memory maps for
+ // the kernel to use.
+ //
+ // Question: what is the virtual address of physical memory
+ // for a kernel? Hey, glad you asked! In most kernels out
+ // there, physical memory is mapped at the top of the virtual
+ // address space. The express intent of the RISCV designers
+ // (I asked them) is that we be able to enter a kernel at
+ // main() in C, with no assembly needed.
+ //
+ // This is a neat idea that may not quite work out. For
+ // example: where's the stack go? Once you start in
+ // Supervisor mode, you are using virtual addresses set up by
+ // coreboot. So you can't use the coreboot stack, it's mapped
+ // to low physical addresses. You *should* not use the
+ // coreboot stack, your kernel may need it in a different
+ // place. So the kernel needs to change the stack, in ... a
+ // bit of startup assembly code, what else? Oh well. Map
+ // physical to high virtual. It's the most common way to
+ // go. Kernels that want to put kernel virtual addresses based
+ // at 0 will need to fixup page tables in ... a bit of startup
+ // assembly code :-)
+ //
+ // TODO: use a constant for the number of PTEs per page, when
+ // (hopefully) newer RISCV toolchains define that constant.
+ root_pt[0x1ff] = pte_create(0x80000000 >> RISCV_PGSHIFT,
+ PTE_R | PTE_W | PTE_X, 0);
mb();
root_page_table = root_pt;
uintptr_t ptbr = ((uintptr_t) root_pt) >> RISCV_PGSHIFT;
@@ -198,9 +226,14 @@ void initVirtualMemory(void) {
}
// TODO: Figure out how to grab this from cbfs
+ // N.B. We used to map phsyical from 0x81000000,
+ // but since kernels need to be able to see the page tables
+ // created by firmware, we're going to map from start of RAM.
+ // All this is subject to change as we learn more. Much
+ // about RISCV is still in flux.
printk(BIOS_DEBUG, "Initializing virtual memory...\n");
- uintptr_t physicalStart = 0x81000000;
- uintptr_t virtualStart = 0xffffffff81000000;
+ uintptr_t physicalStart = 0x80000000;
+ uintptr_t virtualStart = 0xffffffff80000000;
init_vm(virtualStart, physicalStart, (pte_t *)_pagetables);
mb();
flush_tlb();
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17240
-gerrit
commit 322f747c6a474ba40aba15a0d4c48af432d0cad0
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Sun Nov 6 00:12:23 2016 -0700
google/chromeec: Sync ec_commands.h host events with ec codebase
BUG=chrome-os-partner:59352
BRANCH=None
TEST=Compiles successfully
Change-Id: Ibfa5681e16a97e342633104d2aae1fb0402939b8
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/ec/google/chromeec/ec_commands.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h
index 4a551c2..ec404f0 100644
--- a/src/ec/google/chromeec/ec_commands.h
+++ b/src/ec/google/chromeec/ec_commands.h
@@ -471,9 +471,21 @@ enum host_event_code {
/* Emulate MKBP event */
EC_HOST_EVENT_MKBP = 27,
+ /* EC desires to change state of host-controlled USB mux */
+ EC_HOST_EVENT_USB_MUX = 28,
+
/* TABLET/LAPTOP mode event*/
EC_HOST_EVENT_MODE_CHANGE = 29,
+ /* Keyboard recovery combo with hardware reinitialization */
+ EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT = 30,
+
+ /*
+ * Reserve this last bit to indicate that at least one bit in a
+ * secondary host event word is set. See crbug.com/633646.
+ */
+ EC_HOST_EVENT_EXTENDED = 31,
+
/*
* The high bit of the event mask is not used as a host event code. If
* it reads back as set, then the entire event mask should be
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17241
-gerrit
commit 30745ed7463b66ef5f0b2c3817d278f092987027
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Sat Nov 5 23:52:08 2016 -0700
vboot: Add support for recovery mode with forced memory retraining
1. Add new function vboot_recovery_mode_memory_retrain that indicates if
recovery mode requires memory retraining to be performed.
2. Add helper functions {get,clear}_recovery_mode_retrain_switch to read
memory retrain switch. These are provided as weak functions which should
be implemented by mainboard just like {get,clear}_recovery_mode_switch.
3. Additionally, the switch for recovery mode with forced memory
training should be cleared when recovery mode switch is cleared.
BUG=chrome-os-partner:59352
BRANCH=None
TEST=Verified behavior of recovery mode with forced memory retraining on
reef.
Change-Id: I46c10fbf25bc100d9f562c36da3ac646c9dae7d1
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/include/bootmode.h | 2 ++
src/vboot/bootmode.c | 15 +++++++++++++++
src/vboot/vboot_common.h | 1 +
src/vboot/vboot_handoff.c | 1 +
4 files changed, 19 insertions(+)
diff --git a/src/include/bootmode.h b/src/include/bootmode.h
index 21aa386..012bc39 100644
--- a/src/include/bootmode.h
+++ b/src/include/bootmode.h
@@ -22,7 +22,9 @@ int get_write_protect_state(void);
int get_sw_write_protect_state(void);
int get_developer_mode_switch(void);
int get_recovery_mode_switch(void);
+int get_recovery_mode_retrain_switch(void);
int clear_recovery_mode_switch(void);
+int clear_recovery_mode_retrain_switch(void);
int get_wipeout_mode_switch(void);
int get_lid_switch(void);
diff --git a/src/vboot/bootmode.c b/src/vboot/bootmode.c
index 12a4dc0..34377e1 100644
--- a/src/vboot/bootmode.c
+++ b/src/vboot/bootmode.c
@@ -162,6 +162,21 @@ int vboot_recovery_mode_enabled(void)
return !!vboot_check_recovery_request();
}
+int __attribute__((weak)) get_recovery_mode_retrain_switch(void)
+{
+ return 0;
+}
+
+int __attribute__((weak)) clear_recovery_mode_retrain_switch(void)
+{
+ return 0;
+}
+
+int vboot_recovery_mode_memory_retrain(void)
+{
+ return get_recovery_mode_retrain_switch();
+}
+
int vboot_developer_mode_enabled(void)
{
if (!IS_ENABLED(CONFIG_VBOOT))
diff --git a/src/vboot/vboot_common.h b/src/vboot/vboot_common.h
index 59fd44c..956b54c 100644
--- a/src/vboot/vboot_common.h
+++ b/src/vboot/vboot_common.h
@@ -107,5 +107,6 @@ void verstage_mainboard_init(void);
/* Check boot modes */
int vboot_developer_mode_enabled(void);
int vboot_recovery_mode_enabled(void);
+int vboot_recovery_mode_memory_retrain(void);
#endif /* __VBOOT_VBOOT_COMMON_H__ */
diff --git a/src/vboot/vboot_handoff.c b/src/vboot/vboot_handoff.c
index b0bd04c..a2409cf 100644
--- a/src/vboot/vboot_handoff.c
+++ b/src/vboot/vboot_handoff.c
@@ -163,6 +163,7 @@ void vboot_fill_handoff(void)
* is known to be up.
*/
clear_recovery_mode_switch();
+ clear_recovery_mode_retrain_switch();
}
/*
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17238
-gerrit
commit ad7ad5bdf672f4a3802fa6262c65af2808de81fc
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Sat Nov 5 23:37:11 2016 -0700
fmap: Add support for checking existence of region
Implement fmap_region_exists which acts as a wrapper for checking if a
region name exists in FMAP.
BUG=chrome-os-partner:59352
BRANCH=None
TEST=Verified that fmap_exists returns existence of region names present
in FMAP.
Change-Id: I288ea8c7c57d3b0f237cdece42c4f5fe9c2c066a
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/include/fmap.h | 3 +++
src/lib/fmap.c | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/src/include/fmap.h b/src/include/fmap.h
index 5834831..774fbfe 100644
--- a/src/include/fmap.h
+++ b/src/include/fmap.h
@@ -36,6 +36,9 @@ int fmap_locate_area_as_rdev_rw(const char *name, struct region_device *area);
* < 0 on error. */
int fmap_locate_area(const char *name, struct region *r);
+/* Check if region exists in fmap. Return 1 on success, 0 on error. */
+int fmap_region_exists(const char *name);
+
/* Find fmap area name by offset and size.
* Return 0 on success, < 0 on error. */
int fmap_find_region_name(const struct region * const ar,
diff --git a/src/lib/fmap.c b/src/lib/fmap.c
index 9602134..8cb7267 100644
--- a/src/lib/fmap.c
+++ b/src/lib/fmap.c
@@ -131,6 +131,12 @@ int fmap_locate_area(const char *name, struct region *ar)
return -1;
}
+int fmap_region_exists(const char *name)
+{
+ struct region ar;
+ return !fmap_locate_area(name, &ar);
+}
+
int fmap_find_region_name(const struct region * const ar,
char name[FMAP_STRLEN])
{
the following patch was just integrated into master:
commit 7d9068fe0b5d87fe3fe075d5d9a5f7493f5b1eac
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Fri Nov 4 10:07:14 2016 -0500
soc/intel/common: log event when MRC cache is updated
Log when the MRC cache is attempted to be updated with status
of success or failure. Just one slot is supported currently
which is deemed 'normal'. This is because there are more slots
anticipated in the future.
BUG=chrome-os-partner:59395
Change-Id: I0f81458325697aff9924cc359a4173e0d35da5da
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://review.coreboot.org/17231
Reviewed-by: Furquan Shaikh <furquan(a)google.com>
Tested-by: build bot (Jenkins)
See https://review.coreboot.org/17231 for details.
-gerrit